@rcsb/rcsb-statistics 0.3.44-dev.aipcb.4 → 0.3.44-dev.aipcb.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rcsb/rcsb-statistics",
3
- "version": "0.3.44-dev.aipcb.4",
3
+ "version": "0.3.44-dev.aipcb.5",
4
4
  "private": false,
5
5
  "files": [
6
6
  "build"
@@ -1 +0,0 @@
1
- (self.webpackChunk_rcsb_rcsb_statistics=self.webpackChunk_rcsb_rcsb_statistics||[]).push([[489],{8596(e,t,r){function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function i(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const o=r(3482),s=e=>Boolean(e&&"object"==typeof e&&!Array.isArray(e)),l=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c=e=>{throw new Error(e)};function u(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"Chart";if(t.$ref)return u(e,r.$defs[t.$ref.split("/").pop()],r,n);if(t.anyOf)return void(t.anyOf.some(t=>{try{return u(e,t,r,n),!0}catch(e){return!1}})||c("".concat(n," has an invalid value.")));const a=t.type;("object"===a&&!s(e)||"array"===a&&!Array.isArray(e)||"integer"===a&&!Number.isInteger(e)||"number"===a&&("number"!=typeof e||!Number.isFinite(e))||"string"===a&&"string"!=typeof e||"boolean"===a&&"boolean"!=typeof e||"null"===a&&null!==e)&&c("".concat(n," must be ").concat(a,".")),t.enum&&!t.enum.includes(e)&&c("".concat(n," is not supported.")),"number"==typeof e&&(void 0!==t.minimum&&e<t.minimum||void 0!==t.maximum&&e>t.maximum)&&c("".concat(n," is outside the supported range.")),"string"==typeof e&&(t.minLength&&e.trim().length<t.minLength||t.maxLength&&e.length>t.maxLength||/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/.test(e))&&c("".concat(n," has invalid text.")),"string"==typeof e&&t.pattern&&!new RegExp(t.pattern).test(e)&&c("".concat(n," has invalid text.")),Array.isArray(e)&&((t.minItems&&e.length<t.minItems||t.maxItems&&e.length>t.maxItems||t.uniqueItems&&new Set(e.map(e=>JSON.stringify(e))).size!==e.length)&&c("".concat(n," has an invalid number of items.")),e.forEach((e,a)=>u(e,t.items,r,"".concat(n,"[").concat(a,"]")))),s(e)&&((t.required||[]).forEach(t=>{l(e,t)||c("".concat(n,".").concat(t," is required."))}),Object.keys(e).forEach(a=>{l(t.properties||{},a)?u(e[a],t.properties[a],r,"".concat(n,".").concat(a)):!1===t.additionalProperties&&c("".concat(n,".").concat(a," is not supported."))}))}const m=e=>["scatter","bubble"].includes(e.chartType),d=e=>{l(o.metrics,e)||c("Select a supported observation metric.");const t=o.metrics[e],r=t.label,n=t.unit;return"".concat(r," (").concat(n,")")};function p(e,t){let r=-1/0,n=1/0,a=!0,i=!0;return e.filter(e=>e.field===t).forEach(e=>{const o=["gte","gt"].includes(e.operator),s=["gt","lt"].includes(e.operator),l=e.value+("releaseYear"===t&&s?o?1:-1:0),c="releaseYear"===t||!s;o&&(l>r||l===r&&!c)&&(r=l,a=c),!o&&(l<n||l===n&&!c)&&(n=l,i=c)}),{from:r,to:n,include_lower:a,include_upper:i}}function h(e){u(e,o.specSchema);const t=JSON.parse(JSON.stringify(e)),r=o.dimensions[t.dimension],n=m(t),i=a(a({},o.presentationDefaults),t.presentation);!["line","area","mixed"].includes(t.chartType)||r.ordered&&"vertical"===t.orientation&&"labelAsc"===t.sort||c("Line, area and mixed charts require an ordered year or numeric dimension, vertical orientation, and ascending labels."),n||!r.integer||Number.isInteger(t.interval)||c("Count histograms require a whole-number bin width of at least 1."),("area"===t.chartType||"mixed"===t.chartType&&i.seriesTypes.includes("area"))&&"linear"!==t.scale&&c("Area charts require a linear scale for their zero baseline."),["pie","doughnut"].includes(t.chartType)&&(r.overlapping||1!==t.series.length||t.cumulative||"linear"!==t.scale)&&c("Pie and doughnut charts require a single non-overlapping series, linear scale, and non-cumulative values."),["radar","polarArea"].includes(t.chartType)&&("linear"!==t.scale||t.cumulative||t.topN>("radar"===t.chartType?20:30))&&c("Radar and polar-area charts require a linear scale, non-cumulative values and a bounded category limit (20 for radar, 30 for polar area)."),"polarArea"===t.chartType&&1!==t.series.length&&c("Polar-area charts require one series. Use radar or grouped bars to compare cohorts."),"mixed"===t.chartType?(i.seriesTypes.length!==t.series.length||new Set(i.seriesTypes).size<2)&&c("Mixed charts require a drawing type for every series and at least two different types."):i.seriesTypes.length&&c("Per-series drawing types are only supported for mixed charts."),n?(t.observations||c("Scatter and bubble charts require paired entry observations."),t.observations.limit*t.series.length>500&&c("Select at most 500 entry observations across all cohorts."),("count"!==t.measure||t.cumulative||"vertical"!==t.orientation)&&c("Observation charts require count mode, vertical orientation and non-cumulative values."),("bubble"===t.chartType&&!t.observations.size||"scatter"===t.chartType&&null!==t.observations.size)&&c("Bubble charts require a size metric; scatter charts require a null size metric.")):null!=t.observations&&c("Entry observations are only supported for scatter and bubble charts."),n||"linear"===i.xScale&&null===i.xMin&&null===i.xMax||c("Numeric X-axis scales and bounds are only supported for observation charts.");for(const e of["x","y"]){const r=i["".concat(e,"Min")],n=i["".concat(e,"Max")];null!==r&&null!==n&&r>=n&&c("An axis minimum must be less than its maximum."),"logarithmic"===("x"===e?i.xScale:t.scale)&&[r,n].some(e=>null!==e&&e<=0)&&c("Logarithmic axis bounds must be positive.")}return!t.cumulative||"releaseYear"===t.dimension&&"labelAsc"===t.sort||c("Cumulative charts require release year in chronological order."),"percent"===t.measure&&"linear"!==t.scale&&c("Percentages require a linear scale."),new Set(t.series.map(e=>e.label)).size!==t.series.length&&c("Give each comparison series a different label."),[t.filters,...t.series.map(e=>e.filters)].forEach(e=>e.forEach(e=>{const t=o.filters[e.field];t.operators.includes(e.operator)||c("Unsupported operator for ".concat(t.label,".")),"in"===e.operator?(Array.isArray(e.value)||c("".concat(t.label," requires a list.")),e.value.forEach(e=>{"taxonomy"===t.kind?(!Number.isInteger(e)||e<=0)&&c("Taxonomy IDs must be positive integers."):("string"!=typeof e||t.values&&!t.values.includes(e)||"identifier"===t.kind&&!/^[A-Z0-9]{1,10}$/.test(e))&&c("Invalid value for ".concat(t.label,"."))})):("number"!=typeof e.value||e.value<t.minimum||e.value>t.maximum||("year"===t.kind||t.integer)&&!Number.isInteger(e.value))&&c("Invalid range for ".concat(t.label,"."))})),t.series.forEach(e=>{const r=[...t.filters,...e.filters];Object.keys(o.filters).filter(e=>["number","year"].includes(o.filters[e].kind)).forEach(e=>{const t=p(r,e);(t.from>t.to||t.from===t.to&&(!t.include_lower||!t.include_upper))&&c("The ".concat(e," lower bound exceeds its upper bound or defines an empty interval."))}),!n&&"integrativeInput"===t.dimension&&r.some(e=>"methodology"===e.field&&!e.value.includes("integrative"))&&c("Integrative input charts cannot exclude integrative structures.")}),"stacked"===i.stacking&&(!["bar","line","area","mixed"].includes(t.chartType)||t.series.length<2||"count"!==t.measure||"linear"!==t.scale||t.cumulative||!function(e){const t=e.series.map(t=>[...e.filters,...t.filters]),r=e=>e.filter(e=>"methodology"===e.field).reduce((e,t)=>e.filter(e=>t.value.includes(e)),o.filters.methodology.values);return t.every((e,n)=>t.slice(n+1).every(t=>{if(!r(e).some(e=>r(t).includes(e)))return!0;const n=p(e,"releaseYear"),a=p(t,"releaseYear");return n.to<a.from||a.to<n.from}))}(t))&&c("Stacking requires count values, a linear scale, non-cumulative values and provably disjoint cohorts. Use grouped series for populations that may overlap."),t}function g(e){const t=h(e);return a(a({},o.presentationDefaults),{},{colors:[],seriesTypes:[],borderWidth:["line","area","radar","mixed"].includes(t.chartType)?2:1},t.presentation)}function b(e){const t=o.filters[e.field];let r=e.value;return"year"===t.kind&&(r="".concat(r,"-").concat(["gte","lt"].includes(e.operator)?"01-01":"12-31")),"taxonomy"===t.kind&&(r=r.map(String)),{type:"terminal",service:"text",parameters:{attribute:t.attribute,operator:{in:"in",gte:"greater_or_equal",lte:"less_or_equal",gt:"greater",lt:"less"}[e.operator],value:r}}}function y(e){const t=new Set;return e.flatMap(r=>{const n=o.filters[r.field];if(!["number","year"].includes(n.kind))return[b(r)];if(t.has(r.field))return[];t.add(r.field);const i=p(e,r.field),s=i.from,l=i.to,c=i.include_lower,u=i.include_upper;return Number.isFinite(s)&&Number.isFinite(l)?[{type:"terminal",service:"text",parameters:{attribute:n.attribute,operator:"range",value:{from:"year"===n.kind?"".concat(s,"-01-01"):s,to:"year"===n.kind?"".concat(l,"-12-31"):l,include_lower:c,include_upper:u}}}]:[b(a(a({},r),{},{operator:Number.isFinite(s)?c?"gte":"gt":u?"lte":"lt",value:Number.isFinite(s)?s:l}))]})}function v(e){const t=h(e);return m(t)||c("Observation requests require a scatter or bubble chart."),t.series.map(e=>{const r=[...t.filters,...e.filters],n={return_type:"entry",request_options:{results_content_type:["experimental"],paginate:{start:0,rows:t.observations.limit},sort:[{sort_by:"rcsb_accession_info.initial_release_date",direction:"desc"},{sort_by:"rcsb_entry_container_identifiers.entry_id",direction:"asc"}]}};return r.length&&(n.query={type:"group",logical_operator:"and",nodes:y(r).map(e=>({type:"group",logical_operator:"and",nodes:[e]}))}),n})}const f=e=>"string"==typeof e&&/^(?:[0-9][A-Z0-9]{3}|PDB_[A-Z0-9]{8})$/.test(e);function E(e,t){const r=o.metrics[t].dataField.split(".").reduce((e,t)=>s(e)?e[t]:void 0,e);if("releaseYear"===t){if("string"!=typeof r||!/^\d{4}-\d{2}-\d{2}(?:T|$)/.test(r)||!Number.isFinite(Date.parse(r)))return null;if(new Date(r.slice(0,10)).toISOString().slice(0,10)!==r.slice(0,10))return null;const e=new Date(r).getUTCFullYear();return e>=1971&&e<=2100?e:null}if("resolution"===t){if(!Array.isArray(r)||r.some(e=>null!==e&&("number"!=typeof e||!Number.isFinite(e))))return null;const e=r.filter(e=>e>0);return e.length?Math.min(...e):null}return"number"!=typeof r||!Number.isFinite(r)||r<0||r>Number.MAX_SAFE_INTEGER?null:"molecularWeight"===t||Number.isSafeInteger(r)?r:null}function w(e){const t=h(e);if(m(t))return v(t);const r=o.dimensions[t.dimension],n={name:"chart",aggregation_type:r.aggregation,attribute:r.attribute,min_interval_population:1};return"terms"===r.aggregation&&(n.max_num_intervals=1e3),"date_histogram"===r.aggregation&&(n.interval="year"),"histogram"===r.aggregation&&(n.interval=t.interval),t.series.map(e=>{const a=[...t.filters,...e.filters,...r.requiredFilter?[r.requiredFilter]:[]],i={return_type:"entry",request_options:{results_content_type:["experimental"],paginate:{start:0,rows:0},facets:[n]}};return a.length&&(i.query={type:"group",logical_operator:"and",nodes:y(a).map(e=>({type:"group",logical_operator:"and",nodes:[e]}))}),i})}function x(e){return"".concat(o.filters[e.field].label," ").concat({in:"is any of",gte:"≥",lte:"≤",gt:">",lt:"<"}[e.operator]," ").concat(Array.isArray(e.value)?e.value.join(", "):e.value)}function S(e){const t=[],r=m(e),n=a(a({},o.presentationDefaults),e.presentation);return r?(t.push("Points pair recorded measurements from the same PDB entry. Entry-level population filters may match different entities or reported values in that entry."),t.push("Each cohort selects up to ".concat(e.observations.limit," newest matching entries, ordered by initial release date descending and entry ID ascending. This is not a random or representative sample.")),Object.values(e.observations).includes("resolution")&&t.push("Resolution is the minimum positive reported combined resolution per entry, not an average or necessarily the value satisfying a resolution population filter. Entries without the required measurements are omitted, never assigned zero."),e.observations.size&&t.push("Bubble area is proportional to the recorded size metric. Its raw value and units are retained in the table and exports.")):o.dimensions[e.dimension].overlapping&&t.push("An entry may occur in more than one category. Bucket counts must not be summed as a unique entry total."),e.series.length>1&&"stacked"!==n.stacking&&t.push("Comparison cohorts may overlap; each is counted independently."),r||"sourceOrganism"!==e.dimension||t.push("Source organisms are those recorded for any matching entry; they are not expression hosts. All source types are included."),r||"releaseYear"!==e.dimension||t.push("Counts describe the current archive by initial release year, not historical archive snapshots. The current year is incomplete."),e.cumulative&&t.push("Cumulative values begin at the earliest year included by the filters."),"area"===e.chartType&&"stacked"!==n.stacking&&t.push("Area series use a zero baseline and are not stacked; overlapping cohorts are counted independently."),("logarithmic"===e.scale||r&&"logarithmic"===n.xScale)&&t.push("Zero values are omitted from the logarithmic chart; the table retains them."),"percent"===e.measure&&t.push("The denominator is every matching entry in that series, including entries missing the chart attribute."),"stacked"===n.stacking&&t.push("Stacked cohorts have disjoint entry populations. Stack totals describe only the included cohorts, not necessarily all matching archive entries."),["radar","polarArea"].includes(e.chartType)&&t.push("Radial values compare category magnitudes; they do not imply a complete, non-overlapping parts-of-whole partition."),["xMin","xMax","yMin","yMax"].some(e=>null!==n[e])&&t.push("Explicit axis bounds may hide values outside the visible chart. The table and exports retain all retrieved data."),t}e.exports={catalog:o,validateSchema:u,validateChartSpec:h,getChartPresentation:g,buildChartRequests:w,buildChartDrilldownRequest:function(e,t,r){var n;const a=h(e);m(a)&&c("Inspect observation points by their PDB entry identifier, not an aggregation bucket."),(!Number.isInteger(r)||r<0||r>=a.series.length)&&c("Select a valid chart series."),("string"!=typeof t||!t.trim()||t.length>300||/[\u0000-\u001f\u007f]/.test(t))&&c("Select a valid chart category.");const i=o.dimensions[a.dimension],s={attribute:i.attribute,operator:"exact_match",value:t};if("releaseYear"===a.dimension){(!/^\d{4}$/.test(t)||Number(t)<o.filters.releaseYear.minimum||Number(t)>o.filters.releaseYear.maximum)&&c("Select a valid release year.");const e="".concat(Number(t)+1,"-01-01");s.operator=a.cumulative?"less":"range",s.value=a.cumulative?e:{from:"".concat(t,"-01-01"),to:e,include_lower:!0,include_upper:!1}}else if("histogram"===i.aggregation){const e=Number(t);(!/^(?:0|[1-9]\d*)(?:\.\d+)?$/.test(t)||!Number.isFinite(e)||e<0||e>o.filters[a.dimension].maximum||Math.abs(e/a.interval-Math.round(e/a.interval))>1e-8)&&c("Select a valid numeric interval."),s.operator="range",s.value={from:e,to:Number((e+a.interval).toPrecision(12)),include_lower:!0,include_upper:!1}}return{return_type:"entry",query:{type:"group",logical_operator:"and",nodes:[...(null===(n=w(a)[r].query)||void 0===n?void 0:n.nodes)||[],{type:"group",logical_operator:"and",nodes:[{type:"terminal",service:"text",parameters:s}]}]},request_options:{results_content_type:["experimental"],paginate:{start:0,rows:25}}}},describeFilter:x,describeChart:function(e){return h(e),m(e)?"".concat(d(e.observations.y)," versus ").concat(d(e.observations.x)).concat(e.observations.size?"; bubble area: ".concat(d(e.observations.size)):"","; ").concat(e.chartType," chart; up to ").concat(e.observations.limit," newest entries per cohort."):"".concat(e.cumulative?"Cumulative ":"").concat("count"===e.measure?"PDB entry counts":"Percentage of matching PDB entries"," by ").concat(o.dimensions[e.dimension].label.toLowerCase(),"; ").concat(e.chartType," chart; ").concat(e.series.length," ").concat(1===e.series.length?"series":"comparison series",".")},chartWarnings:S,chartChanges:function(e,t){return e?(h(e),h(t),[...new Set([...Object.keys(e),...Object.keys(t)])].filter(r=>JSON.stringify(e[r])!==JSON.stringify(t[r])).flatMap(r=>{if("presentation"===r){const r=g(e),n=g(t),a={palette:"Color palette",legend:"Legend",grid:"Grid lines",lineStyle:"Line style",pointRadius:"Point radius",borderWidth:"Border width",barRadius:"Bar corner radius",doughnutCutout:"Doughnut cutout",colors:"Series colors",fillOpacity:"Fill opacity",pointStyle:"Point shape",lineDash:"Line pattern",barWidth:"Bar width",tickRotation:"Tick rotation",fontSize:"Font size",height:"Chart height",radialStartAngle:"Radial start angle",xScale:"X-axis scale",xMin:"X-axis minimum",xMax:"X-axis maximum",yMin:"Value-axis minimum",yMax:"Value-axis maximum",reverseX:"Reverse X axis",reverseY:"Reverse value axis",seriesTypes:"Series drawing types",stacking:"Stacking"},i=(e,t)=>"grid"===e?t?"shown":"hidden":"doughnutCutout"===e?"".concat(t,"%"):Array.isArray(t)?t.join(", ")||"automatic":null===t?"automatic":String(t);return Object.keys(n).filter(e=>JSON.stringify(r[e])!==JSON.stringify(n[e])).map(e=>"".concat(a[e],": ").concat(i(e,r[e])," → ").concat(i(e,n[e]),"."))}return"observations"===r?t.observations?"Measurements: ".concat(d(t.observations.x),", ").concat(d(t.observations.y)).concat(t.observations.size?"; size: ".concat(d(t.observations.size)):"","; up to ").concat(t.observations.limit," entries per cohort."):"Use entry-count aggregations.":"filters"===r?"Filters: ".concat(t.filters.length?t.filters.map(x).join("; "):"none","."):"series"===r?"Series: ".concat(t.series.map(e=>"".concat(e.label).concat(e.filters.length?" (".concat(e.filters.map(x).join("; "),")"):"")).join("; "),"."):"".concat(r,": ").concat(String(e[r])," → ").concat(String(t[r]))})):["Create a new chart."]},formatChartData:function(e,t){const r=h(e);m(r)&&c("Paired entry records are required for an observation chart."),Array.isArray(t)&&t.length===r.series.length||c("A response is required for every chart series.");const n=o.dimensions[r.dimension];let i=!1;const l=t.map((e,t)=>{var a;(!s(e)||!Number.isInteger(e.total_count)||e.total_count<0)&&c("The Search API did not return a valid entry count.");const l=null===(a=e.facets)||void 0===a||null===(a=a.find(e=>"chart"===e.name))||void 0===a?void 0:a.buckets;Array.isArray(l)||0===e.total_count||c("The Search API did not return the requested chart aggregation."),(l||[]).length>=1e3&&(i=!0);const u=new Map;return(l||[]).forEach(t=>{(!Number.isInteger(t.population)||t.population<0||t.population>e.total_count||!["string","number"].includes(typeof t.label)||String(t.label).length>300)&&c("The Search API returned an invalid chart bucket.");let a=String(t.label);if("releaseYear"===r.dimension){const e=a.match(/\d{4}/);e||c("The Search API returned an invalid release year."),a=e[0]}"histogram"===n.aggregation&&((!a.trim()||!Number.isFinite(Number(a))||Number(a)<0||Number(a)>o.filters[r.dimension].maximum||n.integer&&!Number.isInteger(Number(a)))&&c("The Search API returned an invalid numeric interval."),a=String(Number(Number(a).toPrecision(12))),Math.abs(Number(a)/r.interval-Math.round(Number(a)/r.interval))>1e-8&&c("The Search API returned a numeric interval outside the requested bin grid.")),u.has(a)&&c("The Search API returned duplicate chart buckets."),u.set(a,t.population)}),{label:r.series[t].label,total:e.total_count,values:u}});let u=[...new Set(l.flatMap(e=>[...e.values.keys()]))];const d=u.every(e=>Number.isFinite(Number(e)));if(u.sort((e,t)=>d?Number(e)-Number(t):e.localeCompare(t)),"releaseYear"===r.dimension&&u.length){const e=Number(u[0]),t=Number(u[u.length-1]);t-e>200&&c("The Search API returned an unsupported year range."),u=Array.from({length:t-e+1},(t,r)=>String(e+r))}if("histogram"===n.aggregation&&u.length){const e=Number(u[0]),t=Math.round((Number(u[u.length-1])-e)/r.interval)+1;t>1e3&&c("This histogram exceeds 1,000 bins. Increase the bin width or narrow the numeric range."),u=Array.from({length:t},(t,n)=>String(Number((e+n*r.interval).toPrecision(12))))}const p=u.map(e=>({label:e,counts:l.map(t=>t.values.get(e)||0)}));if(r.cumulative){const e=l.map(()=>0);p.forEach(t=>{t.counts=t.counts.map((t,r)=>e[r]+=t)})}"countDesc"===r.sort&&p.sort((e,t)=>t.counts.reduce((e,t)=>e+t,0)-e.counts.reduce((e,t)=>e+t,0)||e.label.localeCompare(t.label));const g=!n.ordered,b=(g?p.slice(0,r.topN):p).map(e=>a(a({},e),{},{values:e.counts.map((e,t)=>"percent"===r.measure?l[t].total?100*e/l[t].total:0:e)}));("radar"===r.chartType&&b.length>20||"polarArea"===r.chartType&&b.length>30)&&c("This radial chart has too many categories. Narrow the population or choose a bar chart.");const y=S(r);return g&&p.length>b.length&&y.push("Showing ".concat(b.length," of ").concat(p.length).concat(i?"+":""," categories returned. Omitted categories are not combined into an invented “Other” count.")),i&&y.push("The category aggregation reached its 1,000-bucket limit. Narrow the filters for a more complete category listing."),["pie","doughnut"].includes(r.chartType)&&(i||b.length!==p.length)&&c("A pie or doughnut chart must show all categories. Increase the category limit or use a bar chart."),["pie","doughnut"].includes(r.chartType)&&b.reduce((e,t)=>e+t.counts[0],0)!==l[0].total&&c("A pie or doughnut chart requires complete, non-overlapping categories covering every matching entry. Use a bar chart for this population."),{rows:b,series:l.map(e=>({label:e.label,total:e.total})),warnings:y,retrievedAt:(new Date).toISOString(),categoryCount:p.length}},isObservationChart:m,chartMetricLabel:d,buildObservationRequests:v,buildObservationDataRequest:function(e){return(!Array.isArray(e)||e.length>500||e.some(e=>!f(e))||new Set(e).size!==e.length)&&c("Select at most 500 unique, valid PDB entry identifiers."),{query:"query ChartObservations($ids: [String!]!) { entries(entry_ids: $ids) { rcsb_id rcsb_accession_info { initial_release_date } rcsb_entry_info { resolution_combined molecular_weight deposited_atom_count deposited_polymer_monomer_count deposited_polymer_entity_instance_count polymer_entity_count } } }",variables:{ids:[...e]}}},formatObservationData:function(e,t,r){const n=h(e);m(n)||c("Observation data requires a scatter or bubble chart."),(!Array.isArray(t)||t.length!==n.series.length||!Array.isArray(r)||r.length>500)&&c("A bounded entry response is required for every observation cohort.");const i=new Set,o=t.map(e=>{(!s(e)||!Number.isSafeInteger(e.total_count)||e.total_count<0)&&c("The Search API did not return a valid observation count.");const t=void 0===e.result_set&&0===e.total_count?[]:e.result_set;(!Array.isArray(t)||t.length>Math.min(e.total_count,n.observations.limit))&&c("The Search API did not return a bounded observation selection.");const r=t.map(e=>(s(e)&&f(e.identifier)||c("The Search API returned an invalid PDB entry identifier."),i.add(e.identifier),e.identifier));return new Set(r).size!==r.length&&c("The Search API returned duplicate observation identifiers within a cohort."),r}),l=new Map;for(const e of r)null!==e&&(s(e)&&f(e.rcsb_id)&&i.has(e.rcsb_id)||c("The Data API returned an entry outside the validated observation selection."),l.has(e.rcsb_id)&&c("The Data API returned duplicate observation records."),(null!=e.rcsb_entry_info&&!s(e.rcsb_entry_info)||null!=e.rcsb_accession_info&&!s(e.rcsb_accession_info))&&c("The Data API returned malformed entry measurements."),l.set(e.rcsb_id,e));const u=[],d=n.series.map((e,r)=>{const i=u.length;for(const e of o[r]){const t=l.get(e);if(!t)continue;const i=E(t,n.observations.x),o=E(t,n.observations.y),s=n.observations.size?E(t,n.observations.size):void 0;null!==i&&null!==o&&null!==s&&u.push(a({entryId:e,seriesIndex:r,x:i,y:o},void 0===s?{}:{size:s}))}return{label:e.label,total:t[r].total_count,selected:o[r].length,omitted:o[r].length-(u.length-i)}}),p=S(n);for(const e of d)e.total>e.selected&&p.push("".concat(e.label,": selected ").concat(e.selected," of ").concat(e.total," matching entries; values do not describe the full matching population.")),e.omitted&&p.push("".concat(e.label,": omitted ").concat(e.omitted," selected entries with missing, unavailable or invalid measurements; no values were imputed."));return{kind:"records",rows:[],points:u,selectedEntryIds:o,series:d,warnings:p,retrievedAt:(new Date).toISOString(),categoryCount:0}}}},489(e,t,r){"use strict";r.r(t),r.d(t,{default:()=>de});var n=r(9711),a=r(4062),i=r(8354),o=r(2917),s=r(5411),l=r(5042);const c=l.YrT,u=l.cO3,m=l.i5c,d=l.VSk,p=l.yGN,h=l.a4x,g=l.QPV,b=l.vQY;var y=r(9281),v=r(8596);function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function E(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach(function(t){w(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function w(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const x=e=>{const t=String(e);return'"'.concat((/^[\s]*[=+@-]|^[\t\r\n]/.test(t)?"'".concat(t):t).replace(/"/g,'""'),'"')};function S(e,t,r){const n=URL.createObjectURL(new Blob([e],{type:r})),a=document.createElement("a");a.href=n,a.download=t,a.click(),setTimeout(()=>URL.revokeObjectURL(n),0)}var _=r(8804),A=r(6619),C=r(9806);function O(e,t,r){const n=[];let a="";for(const i of t.split(/\s+/)){const t=a?"".concat(a," ").concat(i):i;for(a&&e.measureText(t).width>r?(n.push(a),a=i):a=t;e.measureText(a).width>r&&a.length>1;){let t=a.length-1;for(;t>1&&e.measureText(a.slice(0,t)).width>r;)t--;n.push(a.slice(0,t)),a=a.slice(t)}}return a.trim()&&n.push(a.trim()),n}function k(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const a=document.createElement("canvas"),i=a.getContext("2d");if(!i)throw new Error("PNG export is not supported in this browser.");const o=e.width/(e.clientWidth||e.width),s=Math.round(20*o),l=Math.max(e.width,Math.round(400*o)),c=l-2*s;i.font="600 ".concat(18*o,"px sans-serif");const u=O(i,t.title,c);i.font="".concat(11*o,"px sans-serif");const m=O(i,function(e,t,r){const n=new Date(t.retrievedAt).toISOString().slice(0,10),a=r?" ".concat(r):"";if("records"!==t.kind)return"Source: RCSB PDB Search API · Retrieved ".concat(n," · Released PDB entries only.").concat(a);if(!e.observations)throw new Error("PNG export requires the observation metrics for record data.");const i=e=>{const t=v.catalog.metrics[e];if(!t)throw new Error("PNG export encountered an unsupported observation metric.");return"".concat(t.label," (").concat(t.unit,")")},o="X: ".concat(i(e.observations.x),"; Y: ").concat(i(e.observations.y)).concat(e.observations.size?"; Size: ".concat(i(e.observations.size)):"","."),s=t.series.map((e,r)=>{const n=(t.points||[]).filter(e=>e.seriesIndex===r).length,a=void 0===e.selected?"":" from ".concat(e.selected," selected"),i=void 0===e.omitted?"":"; ".concat(e.omitted," omitted for missing or unusable metric values");return"".concat(e.label,": ").concat(n," usable ").concat(1===n?"point":"points").concat(a," of ").concat(e.total," matching entries").concat(i,".")}).join(" ");return"Source: RCSB PDB Search + Data APIs · Retrieved ".concat(n," · Released PDB entries only. ").concat(o," Retrieved dataset: ").concat(s," Selection: newest releases first, entry ID tie-break; bounded, non-random, not representative.").concat(a)}(t,r,n),c),d=25*u.length*o,p=16*m.length*o;a.width=l,a.height=Math.ceil(e.height+d+p+4*s),i.fillStyle="#ffffff",i.fillRect(0,0,a.width,a.height),i.fillStyle="#243746",i.font="600 ".concat(18*o,"px sans-serif"),i.textBaseline="top",u.forEach((e,t)=>i.fillText(e,s,s+25*t*o));const h=2*s+d;return i.drawImage(e,(l-e.width)/2,h),i.fillStyle="#526675",i.font="".concat(11*o,"px sans-serif"),m.forEach((t,r)=>i.fillText(t,s,h+e.height+s+16*r*o)),a.toDataURL("image/png",1)}var N=r(2329);function P(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,i,o,s=[],l=!0,c=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return I(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?I(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function D(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?T(Object(r),!0).forEach(function(t){j(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function j(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const R={bar:"Bar",line:"Line",area:"Area",pie:"Pie",doughnut:"Doughnut",radar:"Radar",polarArea:"Polar area",mixed:"Mixed bar / line",scatter:"Scatter",bubble:"Bubble"},z={accessible:["#0072b2","#e69f00","#009e73","#cc79a7","#56b4e9","#d55e00","#f0e442","#000000"],warm:["#b83b32","#e77932","#a54f73","#d4a02e","#7c3e58","#dc6b68","#914b28","#f0bb6a"],cool:["#286f9e","#279c95","#625d9d","#68a6c1","#365f73","#758eaf","#397f64","#9abcc7"],monochrome:["#253f56","#49657b","#6f879a","#8da1b1","#b1c0cc","#334e65","#5b758a","#8196a7"]},M=e=>["pie","doughnut"].includes(e.chartType),q=e=>["radar","polarArea"].includes(e.chartType),L=e=>"bar"===e.chartType&&"horizontal"===e.orientation?"y":"x",B=e=>M(e)||q(e)?[]:(0,v.isObservationChart)(e)?["x","y"]:[L(e)],F=(e,t)=>{const r=v.catalog.dimensions[e.dimension],n=r.unit;return"histogram"===r.aggregation?"".concat(t,"–").concat(Number((Number(t)+e.interval).toPrecision(12))).concat(n?" ".concat(n):"resolution"===e.dimension?" Å":""):t},Y=e=>e.toLocaleString(void 0,{maximumFractionDigits:6}),$=(e,t)=>{var r;return(0,v.isObservationChart)(e)?(null===(r=t.points)||void 0===r?void 0:r.length)||0:t.rows.length},U=(e,t)=>(e.points||[]).filter(e=>e.seriesIndex===t);function X(e,t){if((0,v.isObservationChart)(e)&&t!==e.chartType)throw new Error("Changing observation type requires a new preview with explicit metrics.");const r=D({},e.presentation);return"mixed"===t&&"mixed"!==e.chartType&&(r.seriesTypes=e.series.map((e,t)=>t?"line":"bar")),"mixed"!==t&&delete r.seriesTypes,!["bar","line","area","mixed"].includes(t)&&r.stacking&&(r.stacking="grouped"),(0,v.validateChartSpec)(D(D(D(D({},e),{},{chartType:t},Object.keys(r).length?{presentation:r}:e.presentation?{presentation:{}}:{}),["line","area","mixed","radar","polarArea"].includes(t)?{orientation:"vertical"}:{}),["pie","doughnut","area","radar","polarArea"].includes(t)?{scale:"linear"}:{}))}function W(e,t){return(0,v.isObservationChart)(e)?[e.chartType]:Object.keys(R).filter(r=>{if(["scatter","bubble"].includes(r))return!1;try{const n=X(e,r);return!("radar"===r&&t.rows.length>20||"polarArea"===r&&t.rows.length>30)&&(!M(n)||1===t.series.length&&t.rows.length>0&&t.categoryCount===t.rows.length&&t.rows.length<1e3&&t.rows.reduce((e,t)=>e+t.counts[0],0)===t.series[0].total&&t.series[0].total>0)}catch(e){return!1}})}function V(e,t){var r;const n=(0,v.getChartPresentation)(e),a=null!==(r=n.colors)&&void 0!==r&&r.length?n.colors:"default"===n.palette?t:z[n.palette];return a.length?a:z.accessible}function J(e,t){const r=e.observations[t],n="x"===t?e.categoryLabel:e.valueLabel,a=v.catalog.metrics[r].unit;return"".concat(n||v.catalog.metrics[r].label).concat(a&&!(n||"").includes(a)?" (".concat(a,")"):"")}function Z(e){const t=e.ticks.filter(e=>void 0!==e.label&&null!==e.label&&""!==e.label);if(t.length<3||e.min<=0||e.max<=e.min)return;const r=e.getUserBounds(),n=e.isHorizontal(),a=(0,N.a0)(e.options.ticks.font),i=n?e.width:e.height,o=e.ctx;o.save(),o.font=a.string;for(const l of[[t[0],t[1]],[t[t.length-1],t[t.length-2]]]){var s=P(l,2);const t=s[0],c=s[1];(r.minDefined&&t.value===r.min||r.maxDefined&&t.value===r.max)&&(Math.abs(Math.log(t.value/c.value)/Math.log(e.max/e.min))*i<(n?(o.measureText(String(t.label)).width+o.measureText(String(c.label)).width)/2:a.lineHeight)+4&&(t.label=""))}o.restore()}function G(){return G=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},G.apply(null,arguments)}function H(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function K(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?H(Object(r),!0).forEach(function(t){Q(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):H(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Q(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ee(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,i,o,s=[],l=!0,c=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return te(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?te(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}A.t1.register(A.PP,A.kc,A.OJ,A.pr,A.A6,A.ZT,A.P$,A.ju,A.h9,A.G5,A.Pz,A.Jb,A.E8,A.No,A.Bs,A.FN,A.m_,A.s$);const re={bar:_.yP,line:_.N1,area:_.N1,pie:_.Fq,doughnut:_.nu,radar:_.Vd,polarArea:_.O5,mixed:_.t1,scatter:_.Xl,bubble:_.Zh},ne=[A.dN,C.Ay];function ae(e){let t=e.label,r=e.value,a=e.onCommit,i=e.numeric,o=void 0!==i&&i,l=e.nullable,c=void 0!==l&&l,u=e.min,m=e.max,d=e.step;const p=ee((0,n.useState)(null==r?"":String(r)),2),h=p[0],g=p[1];return(0,n.useEffect)(()=>g(null==r?"":String(r)),[r]),n.createElement("label",null,t,n.createElement(s.A.Control,{size:"sm",type:o?"number":"text",value:h,min:u,max:m,step:d,placeholder:c?"Automatic":void 0,onChange:e=>g(e.target.value),onBlur:()=>{const e=o?""===h.trim()?c?null:NaN:Number(h):h;e!==r&&a(e)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),e.currentTarget.blur())}}))}function ie(e){var t,r;let o=e.spec,l=e.data,c=e.preview,u=void 0!==c&&c,m=e.onSpecChange,d=e.disabled,p=void 0!==d&&d,f=e.readOnly,E=void 0!==f&&f;const w=(0,y.t)().settings,_=(0,n.useRef)(null),C=ee((0,n.useState)(!1),2),O=C[0],P=C[1],I=ee((0,n.useState)(o),2),T=I[0],j=I[1],z=ee((0,n.useState)(""),2),H=z[0],Q=z[1],te=ee((0,n.useState)(0),2),ie=te[0],oe=te[1],se=ee((0,n.useState)(null),2),le=se[0],ce=se[1],ue=ee((0,n.useState)(""),2),me=ue[0],de=ue[1],pe=ee((0,n.useState)(0),2),he=pe[0],ge=pe[1],be=ee((0,n.useState)(null),2),ye=be[0],ve=be[1],fe=(0,n.useRef)({active:!1,suppressClick:!1});(0,n.useEffect)(()=>{j(o),Q("")},[o]),(0,n.useEffect)(()=>{ce(null),de(""),ge(0)},[l]);const Ee=(0,v.getChartPresentation)(T),we=(0,v.isObservationChart)(T),xe=M(T),Se=q(T),_e=T.categoryLabel||v.catalog.dimensions[T.dimension].label,Ae=!we&&"y"===L(T),Ce=B(T),Oe=$(T,l),ke=Ce.length>0&&Oe>1,Ne=["line","area","mixed","radar"].includes(T.chartType),Pe=["bar","mixed"].includes(T.chartType),Ie=Ne||we,Te=JSON.stringify([T.chartType,T.orientation,T.scale,T.dimension,T.observations,l.retrievedAt,Ee.xScale,Ee.xMin,Ee.xMax,Ee.yMin,Ee.yMax,Ee.reverseX,Ee.reverseY,Ee.stacking,Ee.seriesTypes]),De=(null==ye?void 0:ye.key)===Te?ye.bounds:null;(0,n.useEffect)(()=>{ve(null),fe.current={active:!1,suppressClick:!1}},[Te]);const je=e=>{if(!p&&!E)try{const t=(0,v.validateChartSpec)(e(T));if(!W(t,l).includes(t.chartType))throw new Error("This chart type is not compatible with the retrieved data and counting rules.");null==m||m(t),j(t),Q("")}catch(e){Q(e instanceof Error?e.message:"This chart setting is not supported.")}},Re=e=>je(t=>K(K({},t),{},{presentation:K(K({},t.presentation),e)})),ze=function(e,t,r,a){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];return n.createElement(ae,{key:t,label:e,value:Ee[t],numeric:!0,nullable:o,min:r,max:a,step:i,onCommit:e=>Re({[t]:e})})},Me=(e,t,r)=>n.createElement("label",null,e,n.createElement(s.A.Select,{size:"sm",value:String(Ee[t]),onChange:e=>Re({[t]:e.target.value})},r.map(e=>n.createElement("option",{key:e,value:e},e[0].toUpperCase()+e.slice(1))))),qe=(e,t)=>n.createElement("label",{className:"ai-chart-grid-toggle"},n.createElement("input",{type:"checkbox",checked:Ee[t],onChange:e=>Re({[t]:e.target.checked})})," ",e),Le=(e,t)=>{const r=we?U(l,t).length:l.rows.length;e<0||e>=r||t<0||t>=l.series.length||(ce({row:e,series:t}),de(String(e)),ge(t))},Be=e=>{var t;if(e!==_.current)return;const r={};Ce.forEach(t=>{var n;const a=null===(n=e.scales)||void 0===n?void 0:n[t];a&&(r[t]={min:a.min,max:a.max})}),ve(null!==(t=e.isZoomedOrPanned)&&void 0!==t&&t.call(e)?{bounds:r,key:Te}:null)},Fe=function(e,t,r){const n=(0,v.getChartPresentation)(e),a=V(e,r),i=(0,v.isObservationChart)(e),o=Math.max(0,...(t.points||[]).map(e=>e.size||0));return D(D({},i?{}:{labels:t.rows.map(t=>F(e,t.label))}),{},{datasets:t.series.map((r,s)=>{var l;const c=a[s%a.length],u="mixed"===e.chartType?n.seriesTypes[s]:e.chartType,m="area"===u,d=m||"radar"===e.chartType||i;return D(D({},"mixed"===e.chartType?{type:"area"===u?"line":u,order:"bar"===u?1:0}:{}),{},{label:r.label,data:i?U(t,s).map(t=>D({x:"logarithmic"===n.xScale&&0===t.x?null:t.x,y:"logarithmic"===e.scale&&0===t.y?null:t.y,entryId:t.entryId,size:t.size},"bubble"===e.chartType?{r:o?4*n.pointRadius*Math.sqrt((t.size||0)/o):0}:{})):t.rows.map(t=>"logarithmic"===e.scale&&0===t.values[s]?null:t.values[s]),backgroundColor:M(e)||"polarArea"===e.chartType?t.rows.map((e,t)=>a[t%a.length]):d?(0,N.c)(c).alpha(n.fillOpacity).rgbString():c,borderColor:c,borderWidth:n.borderWidth,borderRadius:n.barRadius,barPercentage:n.barWidth,categoryPercentage:.8,pointRadius:void 0===(null===(l=e.presentation)||void 0===l?void 0:l.pointRadius)&&t.rows.length>40?1:n.pointRadius,pointStyle:n.pointStyle,borderDash:"dashed"===n.lineDash?[8,4]:"dotted"===n.lineDash?[2,3]:[],pointHitRadius:8,pointHoverRadius:Math.max(4,n.pointRadius+1),tension:"smooth"===n.lineStyle?.15:0,stepped:"stepped"===n.lineStyle,fill:m?"stacked"===n.stacking?"stack":"origin":"radar"===e.chartType},"stacked"===n.stacking?{stack:"entries"}:{})})})}(T,l,w.colorScheme),Ye=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=(0,v.getChartPresentation)(e),a=L(e),i="x"===a?"y":"x",o=e.categoryLabel||v.catalog.dimensions[e.dimension].label,s=e.valueLabel||("percent"===e.measure?"Matching PDB entries (%)":"Number of PDB entries"),l=M(e),c=q(e),u=(0,v.isObservationChart)(e),m=B(e).length>0&&$(e,t)>1,d=e=>{var t;let n=e.chart;return null===(t=r.onGestureComplete)||void 0===t?void 0:t.call(r,n)},p=(e,t)=>D(D({},null!=e?{min:e}:{}),null!=t?{max:t}:{}),h=(e,t,r)=>D({type:e,reverse:r,beginAtZero:!u&&"linear"===e,grid:{display:n.grid},title:{display:!0,text:t,font:{size:n.fontSize}},ticks:D(D({},"linear"===e?{includeBounds:!1}:{}),{},{font:{size:n.fontSize}})},"logarithmic"===e?{afterUpdate:Z}:{}),g=l?void 0:c?{r:D({type:"radialLinear",beginAtZero:!0,reverse:n.reverseY,startAngle:n.radialStartAngle,grid:{display:n.grid},angleLines:{display:n.grid},pointLabels:{font:{size:n.fontSize}},ticks:{z:1,font:{size:n.fontSize}}},p(n.yMin,n.yMax))}:u?{x:D(D({},h(n.xScale,J(e,"x"),n.reverseX)),p(n.xMin,n.xMax)),y:D(D({},h(e.scale,J(e,"y"),n.reverseY)),p(n.yMin,n.yMax))}:{[i]:D(D(D({},h(e.scale,s,n.reverseY)),p(n.yMin,n.yMax)),{},{stacked:"stacked"===n.stacking}),[a]:D(D({},h("category",o,n.reverseX)),{},{stacked:"stacked"===n.stacking,ticks:{autoSkip:"x"===a,minRotation:n.tickRotation,maxRotation:n.tickRotation,font:{size:n.fontSize}}})};return D(D(D(D(D({responsive:!0,maintainAspectRatio:!1,animation:!1},u||c||l?{}:{indexAxis:a}),{},{onClick:r.onSelect},"doughnut"===e.chartType?{cutout:"".concat(n.doughnutCutout,"%")}:{}),l?{rotation:n.radialStartAngle}:{}),"polarArea"===e.chartType?{startAngle:n.radialStartAngle}:{}),{},{plugins:D({legend:{display:"hidden"!==n.legend&&("auto"!==n.legend||l||"polarArea"===e.chartType||t.series.length>1),position:"auto"===n.legend||"hidden"===n.legend?"bottom":n.legend,labels:D({font:{size:n.fontSize}},"mixed"===e.chartType?{sort:(e,t)=>e.datasetIndex-t.datasetIndex}:{})},tooltip:{callbacks:D(D({},u?{title:e=>{var t;return(null===(t=e[0])||void 0===t?void 0:t.raw.entryId)||""}}:{}),{},{label:t=>u?["".concat(t.dataset.label),"".concat((0,v.chartMetricLabel)(e.observations.x),": ").concat(Y(t.raw.x)),"".concat((0,v.chartMetricLabel)(e.observations.y),": ").concat(Y(t.raw.y)),...e.observations.size?["".concat((0,v.chartMetricLabel)(e.observations.size),": ").concat(Y(t.raw.size))]:[]]:"".concat(t.dataset.label,": ").concat(Number(t.raw).toLocaleString(void 0,{maximumFractionDigits:2})).concat("percent"===e.measure?"%":" entries")})}},m?{zoom:{limits:u?{x:{min:"original",max:"original"},y:{min:"original",max:"original"}}:{[a]:{min:0,max:t.rows.length-1,minRange:1}},pan:{enabled:!0,mode:u?"xy":a,modifierKey:"shift",threshold:10,onPanStart:r.onGestureStart,onPanComplete:d},zoom:{mode:u?"xy":a,wheel:{enabled:!0,modifierKey:"ctrl",speed:.1},pinch:{enabled:!0},drag:{enabled:!1},onZoomStart:r.onGestureStart,onZoomComplete:d}}}:{})},g?{scales:g}:{})}(T,l,{onSelect:(e,t,r)=>{var n,a,i;fe.current.active||fe.current.suppressClick||null!==(n=r.isZoomingOrPanning)&&void 0!==n&&n.call(r)||null!==(a=e.native)&&void 0!==a&&a.ctrlKey||null!==(i=e.native)&&void 0!==i&&i.shiftKey||t.length&&Le(t[0].index,t[0].datasetIndex)},onGestureStart:()=>{fe.current={active:!0,suppressClick:!0}},onGestureComplete:e=>{fe.current.active=!1,Be(e)}});De&&Ce.forEach(e=>{De[e]&&Object.assign(Ye.scales[e],De[e])});const $e=e=>{_.current&&(e?_.current.zoom(Object.fromEntries(Ce.map(t=>[t,e])),"none"):_.current.resetZoom("none"),Be(_.current))};let Ue=null,Xe="";try{le&&(Ue=function(e,t,r,n){if(!Number.isInteger(r)||!Number.isInteger(n)||r<0||n<0||n>=t.series.length)return null;const a=t.series[n];if((0,v.isObservationChart)(e)){const e=U(t,n)[r];return e?{kind:"record",label:e.entryId,series:a.label,point:e,href:"/structure/".concat(encodeURIComponent(e.entryId))}:null}const i=t.rows[r];if(!i)return null;const o=(0,v.buildChartDrilldownRequest)(e,i.label,n);return{kind:"aggregate",label:"".concat(e.cumulative?"Through ":"").concat(F(e,i.label)),series:a.label,count:i.counts[n],value:i.values[n],total:a.total,href:"/search?request=".concat(encodeURIComponent(JSON.stringify(o)))}}(T,l,le.row,le.series))}catch(e){Xe=e instanceof Error?e.message:"Matching structures are not available for this value."}const We=function(e,t){var r;if("bubble"!==e.chartType||null===(r=e.observations)||void 0===r||!r.size)return"";const n=Math.max(0,...(t.points||[]).map(e=>e.size||0)),a=4*(0,v.getChartPresentation)(e).pointRadius;return"Bubble area is proportional to ".concat((0,v.chartMetricLabel)(e.observations.size),"; ").concat(Y(n)," maps to a ").concat(a," px radius. Zero size has zero area.")}(T,l),Ve=()=>({hiddenSeries:l.series.filter((e,t)=>{var r,n;return!1===(null===(r=_.current)||void 0===r||null===(n=r.isDatasetVisible)||void 0===n?void 0:n.call(r,t))}).map(e=>e.label),hiddenCategories:xe||"polarArea"===T.chartType?l.rows.filter((e,t)=>{var r,n;return!1===(null===(r=_.current)||void 0===r||null===(n=r.getDataVisibility)||void 0===n?void 0:n.call(r,t))}).map(e=>F(T,e.label)):[]}),Je=re[T.chartType],Ze=xe||"polarArea"===T.chartType?[]:Se?[A.dN]:ne,Ge=we?U(l,he).map(e=>e.entryId):l.rows.map(e=>F(T,e.label)),He=l.series.map(()=>0),Ke=(l.points||[]).map(e=>({point:e,index:He[e.seriesIndex]++})),Qe=V(T,w.colorScheme),et=xe||"polarArea"===T.chartType,tt=et&&l.rows.length>8,rt=et?l.rows.slice(0,8).map((e,t)=>tt?"Palette color "+(t+1)+" (repeats)":F(T,e.label)):l.series.map(e=>e.label),nt=(0,v.buildChartRequests)(T),at=[...new Set((l.selectedEntryIds||[]).flat())],it=we&&at.length?[(0,v.buildObservationDataRequest)(at)]:void 0;return n.createElement("section",{className:"ai-chart-result"+(u?" ai-chart-preview":""),"aria-label":u?"Proposed chart preview":"Applied chart"},n.createElement("div",{className:"ai-chart-result-heading"},n.createElement("div",null,n.createElement("div",{className:"ai-chart-eyebrow"},u?"Proposed chart · not yet applied":"Applied chart"),n.createElement("h2",null,T.title)),n.createElement(a.A,{size:"sm",variant:"outline-secondary",onClick:()=>{P(!O),ve(null)}},O?n.createElement(b,null):n.createElement(g,null)," ",O?"Chart":"Data table")),we?n.createElement("div",{className:"ai-chart-observations"},n.createElement("p",null,n.createElement("strong",null,"Entry observations · bounded selection, not a random sample")),l.series.map((e,t)=>{var r,a;return n.createElement("p",{key:e.label},n.createElement("strong",null,U(l,t).length.toLocaleString()," plotted")," · ",null===(r=e.selected)||void 0===r?void 0:r.toLocaleString()," selected of ",e.total.toLocaleString()," matching entries · ",e.label,". ",null===(a=e.omitted)||void 0===a?void 0:a.toLocaleString()," selected entries omitted for missing or invalid metrics.")}),n.createElement("p",null,"X: ",(0,v.chartMetricLabel)(T.observations.x),". Y: ",(0,v.chartMetricLabel)(T.observations.y),".",T.observations.size?" Size: "+(0,v.chartMetricLabel)(T.observations.size)+".":""),We&&n.createElement("p",null,We)):n.createElement("div",{className:"ai-chart-totals"},l.series.map(e=>n.createElement("span",{key:e.label},n.createElement("strong",null,e.total.toLocaleString())," matching entries · ",e.label))),n.createElement("details",{className:"ai-chart-customize"},n.createElement("summary",null,"Customize chart"),n.createElement("fieldset",{disabled:p||E,key:ie},n.createElement("details",{className:"ai-chart-control-group",open:!0},n.createElement("summary",null,"Chart"),n.createElement("div",{className:"ai-chart-style-grid"},n.createElement("label",null,"Chart type",n.createElement(s.A.Select,{size:"sm",value:T.chartType,onChange:e=>je(t=>X(t,e.target.value))},W(T,l).map(e=>n.createElement("option",{key:e,value:e},R[e])))),"bar"===T.chartType&&n.createElement("label",null,"Orientation",n.createElement(s.A.Select,{size:"sm",value:T.orientation,onChange:e=>je(t=>K(K({},t),{},{orientation:e.target.value}))},n.createElement("option",{value:"vertical"},"Vertical"),n.createElement("option",{value:"horizontal"},"Horizontal"))),["bar","line","area","mixed"].includes(T.chartType)&&l.series.length>1&&Me("Series layout","stacking",["grouped","stacked"]),"mixed"===T.chartType&&l.series.map((e,t)=>n.createElement("label",{key:e.label},e.label+" type",n.createElement(s.A.Select,{size:"sm",value:Ee.seriesTypes[t],onChange:e=>Re({seriesTypes:Ee.seriesTypes.map((r,n)=>n===t?e.target.value:r)})},["bar","line","area"].map(e=>n.createElement("option",{key:e,value:e},R[e]))))),ze("Chart height (px)","height",280,800,20)),we&&n.createElement("p",null,"Change the observation type or metrics by requesting a new preview.")),n.createElement("details",{className:"ai-chart-control-group"},n.createElement("summary",null,"Labels and axes"),n.createElement("div",{className:"ai-chart-style-grid"},n.createElement(ae,{label:"Chart title",value:T.title,onCommit:e=>je(t=>K(K({},t),{},{title:e}))}),!xe&&!Se&&n.createElement(n.Fragment,null,n.createElement(ae,{label:we?"X-axis title":"Category-axis title",value:T.categoryLabel,onCommit:e=>je(t=>K(K({},t),{},{categoryLabel:e}))}),n.createElement(ae,{label:we?"Y-axis title":"Value-axis title",value:T.valueLabel,onCommit:e=>je(t=>K(K({},t),{},{valueLabel:e}))})),Me("Legend","legend",["auto","top","bottom","left","right","hidden"]),ze("Font size (px)","fontSize",10,20),!xe&&qe("Show grid lines","grid"),Se&&qe("Reverse radial values","reverseY"),!xe&&!Se&&n.createElement(n.Fragment,null,n.createElement("label",null,we?"Y-axis scale":"Value scale",n.createElement(s.A.Select,{size:"sm",value:T.scale,onChange:e=>je(t=>K(K({},t),{},{scale:e.target.value}))},n.createElement("option",{value:"linear"},"Linear"),n.createElement("option",{value:"logarithmic",disabled:!we&&("percent"===T.measure||"area"===T.chartType)||"stacked"===Ee.stacking},"Logarithmic"))),we&&Me("X-axis scale","xScale",["linear","logarithmic"]),!we&&ze("Category label rotation (°)","tickRotation",0,90),qe(we?"Reverse X axis":"Reverse categories","reverseX"),qe(we?"Reverse Y axis":"Reverse values","reverseY")),!xe&&n.createElement(n.Fragment,null,ze(we?"Y minimum":"Value minimum","yMin",void 0,void 0,.1,!0),ze(we?"Y maximum":"Value maximum","yMax",void 0,void 0,.1,!0)),we&&n.createElement(n.Fragment,null,ze("X minimum","xMin",void 0,void 0,.1,!0),ze("X maximum","xMax",void 0,void 0,.1,!0))),n.createElement("p",null,"Axis bounds affect the view only. Blank bounds use the data range; exports retain the full retrieved data.")),n.createElement("details",{className:"ai-chart-control-group"},n.createElement("summary",null,"Appearance"),n.createElement("div",{className:"ai-chart-style-grid"},n.createElement("label",null,"Color palette",n.createElement(s.A.Select,{size:"sm",value:Ee.palette,onChange:e=>{var t;return Re(K({palette:e.target.value},null!==(t=T.presentation)&&void 0!==t&&null!==(t=t.colors)&&void 0!==t&&t.length?{colors:[]}:{}))}},["default","accessible","warm","cool","monochrome"].map(e=>n.createElement("option",{key:e,value:e},e[0].toUpperCase()+e.slice(1))))),ze("Border width","borderWidth",1,5),(Ne||we)&&ze("Fill opacity","fillOpacity",0,1,.05),Ne&&n.createElement(n.Fragment,null,Me("Line style","lineStyle",["straight","smooth","stepped"]),Me("Line pattern","lineDash",["solid","dashed","dotted"])),Ie&&n.createElement(n.Fragment,null,ze("bubble"===T.chartType?"Bubble radius scale (×4 px)":"Point radius","pointRadius",0,8),"bubble"!==T.chartType&&Me("Point shape","pointStyle",["circle","rect","triangle","cross"])),Pe&&n.createElement(n.Fragment,null,ze("Bar corner radius","barRadius",0,12),ze("Bar width","barWidth",.1,1,.1)),"doughnut"===T.chartType&&ze("Doughnut hole (%)","doughnutCutout",20,85),(Se||xe)&&ze("Start angle (°)","radialStartAngle",0,360)),n.createElement("div",{className:"ai-chart-colors"},rt.map((e,t)=>n.createElement("label",{key:e,title:e},e,n.createElement("input",{type:"color","aria-label":tt?e:"Color for "+e,value:Qe[t%Qe.length],onChange:e=>{const r=Array.from({length:Math.max(rt.length,Ee.colors.length)},(e,t)=>Ee.colors[t]||Qe[t%Qe.length]);r[t]=e.target.value,Re({colors:r})}}))))),n.createElement(a.A,{size:"sm",variant:"outline-secondary",onClick:()=>{je(e=>{var t;return K(K({},e),{},{presentation:"mixed"===e.chartType?{seriesTypes:null===(t=e.presentation)||void 0===t?void 0:t.seriesTypes}:{}})}),oe(e=>e+1)}},"Reset appearance")),n.createElement("p",null,E?"Customize the active preview or discard it before changing this previous chart.":p?"Chart settings are paused while your request is running.":"Changes update this chart immediately without an AI request. Available chart types follow the data’s counting and ordering rules.")),H&&n.createElement(i.A,{variant:"danger"},H),!O&&ke&&n.createElement("div",{className:"ai-chart-zoom"},n.createElement(a.A,{size:"sm",variant:"outline-secondary",onClick:()=>$e(1.4)},"Zoom in"),n.createElement(a.A,{size:"sm",variant:"outline-secondary",onClick:()=>$e(.7)},"Zoom out"),n.createElement(a.A,{size:"sm",variant:"outline-secondary",onClick:()=>$e(),disabled:!De},"Reset zoom"),n.createElement("small",null,"Ctrl + wheel or pinch to zoom ",we?"both numeric axes":"categories",". Shift + drag to pan. Values and totals do not change.")),Oe?O?n.createElement("div",{className:"ai-chart-table"},we?n.createElement("table",{className:"table table-striped table-sm"},n.createElement("caption",null,"Paired metrics from the selected PDB entries. Missing values are omitted, not replaced with zero."),n.createElement("thead",null,n.createElement("tr",null,n.createElement("th",{scope:"col"},"PDB entry"),n.createElement("th",{scope:"col"},"Series"),n.createElement("th",{scope:"col"},(0,v.chartMetricLabel)(T.observations.x)),n.createElement("th",{scope:"col"},(0,v.chartMetricLabel)(T.observations.y)),T.observations.size&&n.createElement("th",{scope:"col"},(0,v.chartMetricLabel)(T.observations.size)))),n.createElement("tbody",null,Ke.map(e=>{let t=e.point,r=e.index;return n.createElement("tr",{key:t.seriesIndex+":"+t.entryId},n.createElement("th",{scope:"row"},n.createElement("button",{className:"ai-chart-cell",onClick:()=>Le(r,t.seriesIndex)},t.entryId)),n.createElement("td",null,l.series[t.seriesIndex].label),n.createElement("td",null,Y(t.x)),n.createElement("td",null,Y(t.y)),T.observations.size&&n.createElement("td",null,Y(t.size)))}))):n.createElement("table",{className:"table table-striped table-sm"},n.createElement("caption",null,"Live PDB entry counts. ","percent"===T.measure?"Percentages use each series total as the denominator.":""," Select a value to inspect matching structures."),n.createElement("thead",null,n.createElement("tr",null,n.createElement("th",{scope:"col"},_e),l.series.map(e=>n.createElement("th",{scope:"col",key:e.label},e.label)))),n.createElement("tbody",null,l.rows.map((e,t)=>n.createElement("tr",{key:e.label},n.createElement("th",{scope:"row"},F(T,e.label)),e.values.map((r,a)=>n.createElement("td",{key:a},n.createElement("button",{type:"button",className:"ai-chart-cell","aria-label":"Inspect "+F(T,e.label)+", "+l.series[a].label,onClick:()=>Le(t,a)},r.toLocaleString(void 0,{maximumFractionDigits:2}),"percent"===T.measure?"% ("+e.counts[a].toLocaleString()+" entries)":"")))))))):n.createElement("div",{onPointerDownCapture:e=>{fe.current.active||e.ctrlKey||e.shiftKey||(fe.current.suppressClick=!1)},style:{height:null!==(t=null===(r=T.presentation)||void 0===r?void 0:r.height)&&void 0!==t?t:Ae?Math.min(800,Math.max(340,25*l.rows.length+100)):Ee.height}},n.createElement(Je,G({key:Te},"mixed"===T.chartType?{type:"bar"}:{},{ref:_,data:Fe,options:Ye,plugins:Ze}))):n.createElement("div",{className:"ai-chart-empty"},we?"None of the selected entries have all required measurements. Broaden filters or change measurements.":"No entries have chart values for these filters. Refine the request to broaden the population."),Oe>0&&n.createElement("div",{className:"ai-chart-inspect"},n.createElement("p",null,we?"Click a point or choose an entry to inspect its exact recorded metrics.":"Click a chart value or choose a category to inspect its PDB entries."),n.createElement("div",{className:"ai-chart-inspect-controls"},n.createElement("label",null,we?"Inspect entry":"Inspect category",n.createElement(s.A.Select,{size:"sm",value:me,onChange:e=>{de(e.target.value),e.target.value?Le(Number(e.target.value),he):ce(null)}},n.createElement("option",{value:""},we?"Choose an entry…":"Choose a category…"),Ge.map((e,t)=>n.createElement("option",{key:e,value:t},e)))),l.series.length>1&&n.createElement("label",null,"Inspect series",n.createElement(s.A.Select,{size:"sm",value:he,onChange:e=>{const t=Number(e.target.value);ge(t),we?(de(""),ce(null)):me&&Le(Number(me),t)}},l.series.map((e,t)=>n.createElement("option",{key:e.label,value:t},e.label))))),Ue&&n.createElement("div",{className:"ai-chart-selection",role:"status"},n.createElement("strong",null,Ue.label),"record"===Ue.kind?n.createElement(n.Fragment,null,n.createElement("p",null,Ue.series),n.createElement("dl",null,n.createElement("dt",null,(0,v.chartMetricLabel)(T.observations.x)),n.createElement("dd",null,Y(Ue.point.x)),n.createElement("dt",null,(0,v.chartMetricLabel)(T.observations.y)),n.createElement("dd",null,Y(Ue.point.y)),T.observations.size&&n.createElement(n.Fragment,null,n.createElement("dt",null,(0,v.chartMetricLabel)(T.observations.size)),n.createElement("dd",null,Y(Ue.point.size))))):n.createElement("p",null,Ue.series,": ",Ue.count.toLocaleString()," matching PDB entries","percent"===T.measure?" ("+Ue.value.toLocaleString(void 0,{maximumFractionDigits:2})+"% of "+Ue.total.toLocaleString()+" matching entries)":"",".","histogram"===v.catalog.dimensions[T.dimension].aggregation?" This bin includes its lower bound and excludes its upper bound.":""),n.createElement("a",{href:Ue.href,target:"_blank",rel:"noopener noreferrer"},we?"View PDB entry":"View matching structures")),Xe&&n.createElement(i.A,{variant:"warning"},Xe)),n.createElement("div",{className:"ai-chart-exports"},n.createElement("div",{className:"ai-chart-export-row"},n.createElement(a.A,{size:"sm",variant:"outline-secondary",onClick:()=>S(function(e,t){return(0,v.isObservationChart)(e)?[["PDB ID","Cohort",...[e.observations.x,e.observations.y,...e.observations.size?[e.observations.size]:[]].map(e=>"".concat(v.catalog.metrics[e].label).concat(v.catalog.metrics[e].unit?" (".concat(v.catalog.metrics[e].unit,")"):"")),"Total matching entries","Selected newest entries","Selected entries omitted for missing values","Retrieved at"],...(t.points||[]).map(r=>{const n=t.series[r.seriesIndex];return[r.entryId,n.label,r.x,r.y,...e.observations.size?[r.size]:[],n.total,n.selected,n.omitted,t.retrievedAt]})].map(e=>e.map(x).join(",")).join("\r\n"):[[e.categoryLabel||"Category",...t.series.flatMap(t=>["".concat(t.label,": entry count"),..."percent"===e.measure?["".concat(t.label,": percent of ").concat(t.total," matching entries")]:[]])],...t.rows.map(t=>[t.label,...t.counts.flatMap((r,n)=>[r,..."percent"===e.measure?[t.values[n]]:[]])])].map(e=>e.map(x).join(",")).join("\r\n")}(T,l),"pdb-chart-data.csv","text/csv;charset=utf-8")},n.createElement(h,null)," CSV"),n.createElement(a.A,{size:"sm",variant:"outline-secondary",onClick:()=>S(JSON.stringify(K(K({chart:T,data:l,searchRequests:nt},it?{dataRequests:it}:{}),{},{view:K({categoryAxis:we||xe||Se?null:L(T),bounds:we?De:(null==De?void 0:De[L(T)])||null},Ve())}),null,2),"pdb-chart.json","application/json")},n.createElement(h,null)," Chart + data JSON"),!O&&Oe>0&&n.createElement(a.A,{size:"sm",variant:"outline-secondary",onClick:()=>{if(_.current)try{const e=Ve(),t=e.hiddenSeries.length+e.hiddenCategories.length,r=[De?"Zoomed view; full retrieved data available in CSV/JSON.":"",t?t+" series or categories hidden in this view; full retrieved data available in CSV/JSON.":"",We].filter(Boolean).join(" "),n=document.createElement("a");n.href=r?k(_.current.canvas,T,l,r):k(_.current.canvas,T,l),n.download="pdb-chart.png",n.click()}catch(e){Q(e instanceof Error?e.message:"PNG export failed.")}}},n.createElement(h,null)," PNG"),n.createElement("span",null,"Retrieved ",new Date(l.retrievedAt).toLocaleString())),n.createElement("p",{className:"ai-chart-export-scope"},"PNG captures the visible chart view. CSV and JSON include the full ",we?"retrieved observations, not the entire matching population":"data",".")),n.createElement("details",{className:"ai-chart-provenance"},n.createElement("summary",null,"Data source, filters, and ",we?"selection":"counting"," rules"),n.createElement("p",null,"Live ",n.createElement("a",{href:"https://search.rcsb.org/#faceted-queries",target:"_blank",rel:"noopener noreferrer"},"RCSB PDB Search API"),we&&n.createElement(n.Fragment,null," and ",n.createElement("a",{href:"https://data.rcsb.org/",target:"_blank",rel:"noopener noreferrer"},"Data API")),". Released PDB entries only; computed models excluded. ",we?"Paired metrics come from the same entry. The bounded selection is ordered by newest release, then entry ID; it is not representative random sampling. Missing or invalid metric values are omitted.":"Missing attribute values are not a category."),n.createElement("p",null,T.filters.length?T.filters.map(v.describeFilter).join("; "):"No population filters."),T.series.map(e=>n.createElement("p",{key:e.label},n.createElement("strong",null,e.label,":")," ",e.filters.length?e.filters.map(v.describeFilter).join("; "):"No additional cohort filters.")),l.warnings.length>0&&n.createElement("ul",null,l.warnings.map(e=>n.createElement("li",{key:e},e))),we&&!at.length&&n.createElement("p",null,"No Data API request was needed because no entries were selected."),n.createElement("details",null,n.createElement("summary",null,we?"Reproducible Search and Data API requests":"Reproducible Search API requests"),n.createElement("pre",null,JSON.stringify(it?{searchRequests:nt,dataRequests:it}:nt,null,2)))))}function oe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function se(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?oe(Object(r),!0).forEach(function(t){le(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oe(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function le(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ce(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,i,o,s=[],l=!0,c=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw a}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ue(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ue(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ue(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const me=[{title:"Track growth by experimental method",prompt:"Compare cumulative PDB growth since 2000 for X-ray diffraction, electron microscopy, and solution NMR as an area chart."},{title:"Compare entry measurements",prompt:"Make a scatter plot of minimum reported resolution versus deposited molecular weight for the 200 most recently released X-ray structures. Label both axes with their units."},{title:"Investigate integrative structures",prompt:"Chart the input data types used in integrative PDB structures."},{title:"Explore resolution distributions",prompt:"Show X-ray structure resolution from 0.5 to 4 angstroms as a vertical bar histogram with 0.5 angstrom bins."},{title:"Build a bubble chart",prompt:"For the 150 most recently released X-ray structures, plot minimum reported resolution on x and deposited molecular weight on y. Size the bubbles by total deposited polymer monomers and use a cool palette."}];function de(){const e=function(e){const t=e.aiCommands||("undefined"!=typeof window?window.__RCSB_AI_COMMANDS__:void 0);return t&&"function"==typeof t.execute&&"function"==typeof t.getStatus?t:void 0}((0,y.t)().settings.config),t=ce((0,n.useState)(null),2),r=t[0],l=t[1],h=ce((0,n.useState)([]),2),g=h[0],b=h[1],f=ce((0,n.useState)(""),2),w=f[0],x=f[1],S=ce((0,n.useState)(null),2),_=S[0],A=S[1],C=ce((0,n.useState)(null),2),O=C[0],k=C[1],N=ce((0,n.useState)([]),2),P=N[0],I=N[1],T=ce((0,n.useState)(!1),2),D=T[0],j=T[1],R=ce((0,n.useState)("Interpreting your chart request…"),2),z=R[0],M=R[1],q=ce((0,n.useState)(""),2),L=q[0],B=q[1],F=(0,n.useRef)(null),Y=(0,n.useRef)(0),$=(0,n.useRef)(null),U=(0,n.useRef)(null),X=(0,n.useRef)(null);(0,n.useEffect)(()=>{var t;let r=!0;const n=e=>{if(!r)return;const t=JSON.stringify([e.connected,e.provider,e.model,e.connectionId]);var n;null!==X.current&&t!==X.current&&(Y.current+=1,null===(n=F.current)||void 0===n||n.abort(),F.current=null,j(!1),A(null),I([]),B(e.connected?"Your AI connection or model changed. Prepare a new preview before applying it.":"Reconnect your AI provider in AI Settings. Your applied chart has not changed.")),X.current=t,l(e)},a=()=>null==e?void 0:e.getStatus().then(n).catch(()=>n({connected:!1})),i=null==e||null===(t=e.subscribe)||void 0===t?void 0:t.call(e,n);return a(),window.addEventListener("focus",a),()=>{var e;r=!1,null==i||i(),window.removeEventListener("focus",a),Y.current+=1,null===(e=F.current)||void 0===e||e.abort()}},[e]),(0,n.useEffect)(()=>{var e,t;null===(e=$.current)||void 0===e||null===(t=e.scrollTo)||void 0===t||t.call(e,{top:g.length?$.current.scrollHeight:0,behavior:g.length?"smooth":"auto"})},[g,D,P]);const W=async function(){const t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:w).trim();if(!t||t.length>4e3||D||F.current||!e||null==r||!r.connected)return;const n=++Y.current,a=new AbortController;F.current=a;const i=[...g,{role:"user",content:t}].slice(-15);b(i),x(""),I([]),B(""),j(!0),M("Interpreting your chart request…");try{const t=i.map(e=>({role:e.role,content:e.modelContent||e.content})),r=function(e){var t,r;if(!e||!e.ok||!["ready","clarification"].includes(e.status)||"string"!=typeof e.message)throw new Error("The AI service returned an incomplete chart response. Your current chart has not changed.");if("clarification"===e.status){if(!Array.isArray(e.questions)||e.questions.length>4||e.questions.some(e=>"string"!=typeof e.question||e.options&&(!Array.isArray(e.options)||e.options.length>8||e.options.some(e=>"string"!=typeof e))))throw new Error("The AI service returned an invalid clarification. Please rephrase your request.");return e}if("configureChart"!==(null===(t=e.command)||void 0===t?void 0:t.action))throw new Error("The AI service returned an unsupported command.");const n=(0,v.validateChartSpec)(e.command.spec),a=null===(r=e.preview)||void 0===r?void 0:r.chartData;if(!a||!Array.isArray(a.rows)||a.rows.length>1e3||!Array.isArray(a.series)||a.series.length!==n.series.length||!Array.isArray(a.warnings)||a.warnings.length>20||a.warnings.some(e=>"string"!=typeof e||e.length>1e3)||!Number.isInteger(a.categoryCount)||a.categoryCount<a.rows.length||!Number.isFinite(Date.parse(a.retrievedAt)))throw new Error("Live chart data was not returned. Your current chart has not changed.");if(a.series.some((e,t)=>!e||e.label!==n.series[t].label||!Number.isInteger(e.total)||e.total<0))throw new Error("Live chart data did not pass validation. Your current chart has not changed.");if((0,v.isObservationChart)(n))!function(e,t){const r=()=>new Error("Paired PDB entry measurements did not pass validation. Your current chart has not changed."),n=e=>"string"==typeof e&&/^(?:[0-9][A-Z0-9]{3}|PDB_[A-Z0-9]{8})$/.test(e);if("records"!==t.kind||t.rows.length||0!==t.categoryCount||!Array.isArray(t.points)||t.points.length>500||!Array.isArray(t.selectedEntryIds)||t.selectedEntryIds.length!==t.series.length||t.selectedEntryIds.some((r,a)=>!Array.isArray(r)||r.length!==t.series[a].selected||r.length>e.observations.limit||r.some(e=>!n(e))||new Set(r).size!==r.length))throw r();const a=new Set,i=t.series.map(()=>0);for(const o of t.points){if(!o||!n(o.entryId)||!Number.isInteger(o.seriesIndex)||o.seriesIndex<0||o.seriesIndex>=t.series.length||!t.selectedEntryIds[o.seriesIndex].includes(o.entryId)||!Number.isFinite(o.x)||o.x<0||!Number.isFinite(o.y)||o.y<0||("bubble"===e.chartType?!Number.isFinite(o.size)||o.size<0:void 0!==o.size))throw r();const s="".concat(o.seriesIndex,":").concat(o.entryId);if(a.has(s))throw r();a.add(s),i[o.seriesIndex]+=1}if(t.series.some((t,r)=>!Number.isInteger(t.selected)||t.selected<0||t.selected>Math.min(t.total,e.observations.limit)||!Number.isInteger(t.omitted)||t.omitted<0||t.selected!==i[r]+t.omitted))throw r()}(n,a);else{if("records"===a.kind||void 0!==a.points||void 0!==a.selectedEntryIds||a.rows.some(e=>!e||"string"!=typeof e.label||!Array.isArray(e.counts)||e.counts.length!==a.series.length||!Array.isArray(e.values)||e.values.length!==a.series.length||e.counts.some(e=>!Number.isInteger(e)||e<0)||e.values.some(e=>!Number.isFinite(e)||e<0)))throw new Error("Live chart data did not pass validation. Your current chart has not changed.");if(new Set(a.rows.map(e=>e.label)).size!==a.rows.length||a.rows.some(e=>e.counts.some((t,r)=>t>a.series[r].total||Math.abs(e.values[r]-("percent"===n.measure?a.series[r].total?100*t/a.series[r].total:0:t))>1e-6)))throw new Error("Chart values do not match the validated entry counts.")}return E(E({},e),{},{command:{action:"configureChart",spec:n}})}(await e.execute({action:"configureChart",messages:t,context:{currentChart:(null==O?void 0:O.command.spec)||null,pendingChart:(null==_?void 0:_.command.spec)||null},previousCommand:(null==_?void 0:_.command)||(null==O?void 0:O.command)||null},{signal:a.signal,onProgress:e=>{if(n!==Y.current||a.signal.aborted)return;const t={planning:"Interpreting your chart request…",lookup:"Looking up PDB metadata…",building:"Preparing the chart specification…",validating:"Validating the chart and loading live PDB data…"};t[e]&&M(t[e])}}));if(n!==Y.current||a.signal.aborted)return;const o=function(e){if("clarification"!==e.status)return e.message;const t=(e.questions||[]).map((e,t)=>{var r;return"Question ".concat(t+1,": ").concat(e.question)+(null!==(r=e.options)&&void 0!==r&&r.length?"\nSuggested replies (not selected):\n".concat(e.options.map(e=>"- ".concat(e)).join("\n")):"")});return[e.message,...t].join("\n\n")}(r);if(o.length>4e3)throw new Error("The AI response was too long to keep in this conversation. Please try again.");b([...i,{role:"assistant",content:r.message,modelContent:o}]),I(r.questions||[]),"ready"===r.status&&A({command:r.command,data:r.preview.chartData,preview:r.preview})}catch(e){if(n!==Y.current||a.signal.aborted)return;B(e instanceof Error?e.message:"The chart could not be prepared. Your current chart has not changed.")}finally{n===Y.current&&(j(!1),F.current=null)}},V=()=>{var e;Y.current+=1,null===(e=F.current)||void 0===e||e.abort(),F.current=null,j(!1),B("Request cancelled. Your current chart and previous proposal have not changed.")},J=(null==e?void 0:e.settingsUrl)||"/search/ai-settings",Z=Boolean(e&&(null==r?void 0:r.connected)),G=_||O,H=_?(0,v.chartChanges)((null==O?void 0:O.command.spec)||null,_.command.spec):[];return n.createElement("article",{className:"ai-chart-workspace"},n.createElement("header",{className:"ai-chart-page-heading"},n.createElement("div",null,n.createElement("h1",null,"AI Powered Chart Builder"),n.createElement("p",null,"Describe a question. Review a chart grounded in live PDB data.")),n.createElement(a.A,{variant:"outline-secondary",href:J},n.createElement(d,null)," AI Settings")),!Z&&n.createElement(i.A,{variant:"info",className:"ai-chart-connect"},e&&null===r?"Checking your AI connection…":n.createElement(n.Fragment,null,"Connect a provider in ",n.createElement("a",{href:J},"AI Settings")," to create and refine charts. The chart builder uses the same connection as the AI Query Builder."),!e&&n.createElement("div",{className:"small mt-1"},"AI commands are available when this app is hosted in a configured Sierra environment.")),n.createElement("div",{className:"ai-chart-layout"},n.createElement("section",{className:"ai-chart-chat","aria-label":"Chart conversation"},n.createElement("div",{className:"ai-chart-panel-heading"},n.createElement("strong",null,"Build a chart"),n.createElement(a.A,{variant:"link",size:"sm",onClick:()=>{var e;V(),b([]),A(null),k(null),I([]),x(""),B(""),null===(e=U.current)||void 0===e||e.focus()},disabled:!g.length&&!O},n.createElement(u,null)," Start over")),n.createElement("div",{ref:$,className:"ai-chart-conversation","aria-live":"polite",role:"region","aria-label":"Chart conversation and examples",tabIndex:0},!g.length&&n.createElement(n.Fragment,null,n.createElement("p",{className:"ai-chart-welcome"},"What would you like to learn about the PDB archive?"),n.createElement("p",{className:"ai-chart-muted"},"Compare PDB populations, follow release trends, explore distributions, or plot paired entry measurements. Start with an example or describe a chart."),n.createElement("div",{className:"ai-chart-examples"},me.map(e=>n.createElement("button",{key:e.title,onClick:()=>{var t;x(e.prompt),null===(t=U.current)||void 0===t||t.focus()}},n.createElement("strong",null,e.title),n.createElement("span",null,e.prompt))))),g.map((e,t)=>n.createElement("div",{key:t,className:"ai-chart-message ai-chart-message-".concat(e.role)},n.createElement("span",{className:"visually-hidden"},"user"===e.role?"You":"AI",": "),e.content)),P.map((e,t)=>{var r;return n.createElement("div",{key:t,className:"ai-chart-question"},n.createElement("strong",null,e.question),n.createElement("div",null,null===(r=e.options)||void 0===r?void 0:r.map(t=>n.createElement(a.A,{key:t,size:"sm",variant:"outline-primary",disabled:D||!Z,onClick:()=>W("".concat(e.question,"\n").concat(t))},t))))}),D&&n.createElement("div",{role:"status",className:"ai-chart-wait"},n.createElement(o.A,{animation:"border",size:"sm"}),n.createElement("span",null,z))),L&&n.createElement(i.A,{variant:"danger",className:"m-3 mb-0",dismissible:!0,onClose:()=>B("")},L),n.createElement(s.A,{className:"ai-chart-composer",onSubmit:e=>{e.preventDefault(),W()}},n.createElement(s.A.Label,{htmlFor:"ai-chart-prompt"},G?"Refine this chart":"Describe your chart"),n.createElement(s.A.Control,{as:"textarea",id:"ai-chart-prompt",ref:U,rows:3,maxLength:4e3,value:w,onChange:e=>x(e.target.value),placeholder:G?"Try “make it an area chart”, “use a cool palette”, or “hide the gridlines”…":"For example, compare X-ray and cryo-EM structure releases over time…",disabled:D}),n.createElement("div",{className:"ai-chart-composer-actions"},n.createElement("span",null,(null==r?void 0:r.model)||"Your connected AI model"),D?n.createElement(a.A,{variant:"outline-secondary",onClick:V},n.createElement(p,null)," Cancel"):n.createElement(a.A,{type:"submit",disabled:!Z||!w.trim()},n.createElement(m,null)," Build Chart")))),n.createElement("div",{className:"ai-chart-canvas"},_&&n.createElement("div",{className:"ai-chart-review"},n.createElement("div",null,n.createElement("strong",null,"Review before applying"),n.createElement("p",null,(0,v.describeChart)(_.command.spec))),H.length?n.createElement("ul",null,H.map(e=>n.createElement("li",{key:e},e))):n.createElement("p",null,"No chart settings changed."),_.data.warnings.length>0&&n.createElement("details",null,n.createElement("summary",null,_.data.warnings.length," data ",1===_.data.warnings.length?"note":"notes"),n.createElement("ul",null,_.data.warnings.map(e=>n.createElement("li",{key:e},e)))),n.createElement("div",{className:"ai-chart-review-actions"},n.createElement(a.A,{disabled:D,onClick:()=>{k(_),A(null)}},n.createElement(c,null)," Apply chart"),n.createElement(a.A,{variant:"outline-secondary",disabled:D,onClick:()=>A(null)},"Discard proposal"))),G?n.createElement(ie,{key:"".concat(G.data.retrievedAt,"-").concat(Boolean(_)),spec:G.command.spec,data:G.data,preview:Boolean(_),onSpecChange:e=>{if(G&&!D&&!F.current)try{const t=(0,v.validateChartSpec)(se(se({},G.command.spec),{},{chartType:e.chartType,orientation:e.orientation,scale:e.scale,title:e.title,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,presentation:e.presentation||{}})),r=new Set((0,v.chartWarnings)(G.command.spec)),n=[...new Set([...G.data.warnings.filter(e=>!r.has(e)),...(0,v.chartWarnings)(t)])],a=se(se({},G.data),{},{warnings:n}),i={command:{action:"configureChart",spec:t},data:a,preview:se(se({},G.preview),{},{summary:(0,v.describeChart)(t),changes:(0,v.chartChanges)((null==O?void 0:O.command.spec)||null,t),warnings:n,chartData:a})};_?A(i):k(i),B("")}catch(e){B(e instanceof Error?e.message:"Those chart settings are not compatible with this data.")}},disabled:D}):n.createElement("div",{className:"ai-chart-placeholder"},n.createElement("p",null,"A validated preview will appear here. Nothing is applied until you choose Apply chart.")),O&&_&&n.createElement("details",{className:"ai-chart-previous"},n.createElement("summary",null,"View currently applied chart"),n.createElement(ie,{spec:O.command.spec,data:O.data,readOnly:!0})))))}},3482(e){"use strict";e.exports=JSON.parse('{"version":1,"action":"configureChart","name":"AI Powered Chart Builder","checkedAt":"2026-09-15","sources":["https://search.rcsb.org/#faceted-queries","https://search.rcsb.org/rcsbsearch/v2/metadata/schema","https://data.rcsb.org/","https://data.rcsb.org/graphql"],"countingRules":["Aggregation values are live counts of released PDB entries, not polymer entities, atoms, chains, downloads, citations, or unique sequences. Scatter and bubble points instead pair catalog measurements from the same identified entry. Computed models are excluded.","Categories may overlap when an entry has multiple methods, organisms, polymer types, input datasets, or resolution values. Do not sum overlapping buckets to claim a unique total.","Percentages use all matching entries in each cohort as the denominator, including entries missing the chart attribute. They are not normalized to the displayed top categories.","All filters are entry-level requirements. An organism and ligand filter may match different entities in the same entry. Do not promise same-chain, binding-site, or same-entity relationships.","Lower and upper bounds on one numeric or date attribute are combined into one interval, preserving strict gt/lt and inclusive gte/lte boundaries. At least one value must satisfy both bounds; different reported resolutions cannot satisfy opposite ends of the interval.","Cumulative release-year counts start at the selected lower release-year bound, not necessarily the beginning of the archive. Current-year counts are incomplete.","Line, area and mixed charts require an ordered dimension, ascending labels and vertical orientation. Area series require a linear scale. Stacking requires provably disjoint cohorts; different organisms, methods or resolutions alone do not prove disjoint entry populations. Doughnut charts follow the same complete, non-overlapping partition rules as pie charts.","Presentation settings change appearance only. They cannot change chart counts, filters, aggregation attributes, or destinations. Use only supported palettes, hexadecimal colors and bounded drawing controls, never scripts, callbacks or plugins.","Selecting a bucket searches matching entries, keeping every global and cohort filter. The clicked bucket is an independent requirement: in a multi-valued entry, the value in the bucket may differ from the value satisfying a population filter. Resolution buckets use one half-open interval including the lower bound and excluding the upper bound.","Comparisons use up to four explicit named cohorts with independent additional filters; cohorts may overlap. Never fabricate counts or arbitrary Search API attributes.","Ask a clarification when a request needs unsupported statistics, ambiguous units or entity relationships, or an unknown organism taxon. Preserve the existing chart and filters during refinement unless the user requests a change.","Radar compares the same measure across at most 20 categories. Polar area compares magnitudes across at most 30 categories and is not a parts-of-whole chart. Both use a linear radial scale.","Scatter and bubble use entry observations, never independently paired aggregation buckets. Each cohort selects the newest matching entries with an ID tie-break, at most 500 selected records across cohorts. This is a bounded, non-random selection, not a representative sample or an archive-wide correlation.","Missing, invalid or unavailable observation values are omitted, never replaced with zero. Resolution is the minimum positive reported combined resolution for that entry, not an average or a method-specific value. Entry-level filters need not select the same reported resolution used by a point.","Bubble size is a third catalog metric from the same entry; the renderer maps it to proportional area. Raw size values and units remain available in the table and exports. No averages, medians, fitted trends or inferred scientific relationships are supported."],"dimensions":{"releaseYear":{"label":"Release year","attribute":"rcsb_accession_info.initial_release_date","aggregation":"date_histogram","interval":"year","ordered":true,"overlapping":false},"method":{"label":"Experimental method","attribute":"exptl.method","aggregation":"terms","ordered":false,"overlapping":true},"sourceOrganism":{"label":"Source organism","attribute":"rcsb_entity_source_organism.ncbi_scientific_name","aggregation":"terms","ordered":false,"overlapping":true},"resolution":{"label":"Resolution (Å)","unit":"Å","attribute":"rcsb_entry_info.resolution_combined","aggregation":"histogram","ordered":true,"overlapping":true,"defaultInterval":0.5},"molecularWeight":{"label":"Deposited molecular mass (kDa)","unit":"kDa","attribute":"rcsb_entry_info.molecular_weight","aggregation":"histogram","ordered":true,"overlapping":false,"defaultInterval":10},"atomCount":{"label":"Deposited heavy-atom count","unit":"atoms","attribute":"rcsb_entry_info.deposited_atom_count","aggregation":"histogram","ordered":true,"overlapping":false,"integer":true,"defaultInterval":1000},"monomerCount":{"label":"Deposited polymer monomer count","unit":"monomers","attribute":"rcsb_entry_info.deposited_polymer_monomer_count","aggregation":"histogram","ordered":true,"overlapping":false,"integer":true,"defaultInterval":100},"chainCount":{"label":"Deposited polymer-chain count","unit":"chains","attribute":"rcsb_entry_info.deposited_polymer_entity_instance_count","aggregation":"histogram","ordered":true,"overlapping":false,"integer":true,"defaultInterval":1},"polymerEntityCount":{"label":"Distinct polymer-entity count","unit":"entities","attribute":"rcsb_entry_info.polymer_entity_count","aggregation":"histogram","ordered":true,"overlapping":false,"integer":true,"defaultInterval":1},"polymerType":{"label":"Polymer type","attribute":"entity_poly.rcsb_entity_polymer_type","aggregation":"terms","ordered":false,"overlapping":true},"integrativeInput":{"label":"Integrative input data type","attribute":"rcsb_ihm_dataset_list.name","aggregation":"terms","ordered":false,"overlapping":true,"requiredFilter":{"field":"methodology","operator":"in","value":["integrative"]}},"methodology":{"label":"Structure determination methodology","attribute":"rcsb_entry_info.structure_determination_methodology","aggregation":"terms","ordered":false,"overlapping":false}},"filters":{"releaseYear":{"label":"Release year","attribute":"rcsb_accession_info.initial_release_date","kind":"year","operators":["gte","lte","gt","lt"],"minimum":1971,"maximum":2100},"method":{"label":"Experimental method","attribute":"exptl.method","kind":"enum","operators":["in"],"values":["X-RAY DIFFRACTION","ELECTRON MICROSCOPY","SOLUTION NMR","SOLID-STATE NMR","NEUTRON DIFFRACTION","ELECTRON CRYSTALLOGRAPHY","FIBER DIFFRACTION","POWDER DIFFRACTION","SOLUTION SCATTERING","INFRARED SPECTROSCOPY","EPR","FLUORESCENCE TRANSFER"]},"resolution":{"label":"Resolution (Å)","attribute":"rcsb_entry_info.resolution_combined","kind":"number","operators":["gte","lte","gt","lt"],"minimum":0.01,"maximum":1000},"molecularWeight":{"label":"Deposited molecular mass (kDa)","attribute":"rcsb_entry_info.molecular_weight","kind":"number","operators":["gte","lte","gt","lt"],"minimum":0,"maximum":1000000000},"atomCount":{"label":"Deposited heavy-atom count","attribute":"rcsb_entry_info.deposited_atom_count","kind":"number","integer":true,"operators":["gte","lte","gt","lt"],"minimum":0,"maximum":1000000000000},"monomerCount":{"label":"Deposited polymer monomer count","attribute":"rcsb_entry_info.deposited_polymer_monomer_count","kind":"number","integer":true,"operators":["gte","lte","gt","lt"],"minimum":0,"maximum":1000000000000},"chainCount":{"label":"Deposited polymer-chain count","attribute":"rcsb_entry_info.deposited_polymer_entity_instance_count","kind":"number","integer":true,"operators":["gte","lte","gt","lt"],"minimum":0,"maximum":1000000000},"polymerEntityCount":{"label":"Distinct polymer-entity count","attribute":"rcsb_entry_info.polymer_entity_count","kind":"number","integer":true,"operators":["gte","lte","gt","lt"],"minimum":0,"maximum":1000000000},"sourceTaxonomy":{"label":"Source organism NCBI taxonomy ID (including descendants)","attribute":"rcsb_entity_source_organism.taxonomy_lineage.id","kind":"taxonomy","operators":["in"]},"sourceOrganism":{"label":"Exact source organism scientific name","attribute":"rcsb_entity_source_organism.ncbi_scientific_name","kind":"text","operators":["in"]},"ligand":{"label":"Non-polymer chemical component ID present in entry","attribute":"rcsb_nonpolymer_entity.rcsb_nonpolymer_comp_id","kind":"identifier","operators":["in"]},"polymerType":{"label":"Polymer type present in entry","attribute":"entity_poly.rcsb_entity_polymer_type","kind":"enum","operators":["in"],"values":["Protein","DNA","RNA","NA-hybrid","Other"]},"methodology":{"label":"Structure determination methodology","attribute":"rcsb_entry_info.structure_determination_methodology","kind":"enum","operators":["in"],"values":["experimental","integrative"]}},"metrics":{"resolution":{"label":"Minimum reported resolution","unit":"Å","attribute":"rcsb_entry_info.resolution_combined","dataField":"rcsb_entry_info.resolution_combined","description":"Minimum positive combined experimental resolution reported for the entry. Multiple methods can report multiple values; this is not their average or necessarily the value satisfying a population filter."},"molecularWeight":{"label":"Deposited molecular mass","unit":"kDa","attribute":"rcsb_entry_info.molecular_weight","dataField":"rcsb_entry_info.molecular_weight","description":"Molecular mass of polymer and non-polymer entities in the deposited entry, excluding solvent; not the mass of a selected polymer or biological assembly."},"atomCount":{"label":"Deposited heavy-atom count","unit":"atoms","attribute":"rcsb_entry_info.deposited_atom_count","dataField":"rcsb_entry_info.deposited_atom_count","description":"Number of heavy-atom coordinate records per deposited structure model."},"monomerCount":{"label":"Deposited polymer monomer count","unit":"monomers","attribute":"rcsb_entry_info.deposited_polymer_monomer_count","dataField":"rcsb_entry_info.deposited_polymer_monomer_count","description":"Total polymer monomers across sample polymer instances per deposited structure model, including unmodeled monomers; not a single-chain sequence length."},"chainCount":{"label":"Deposited polymer-chain count","unit":"chains","attribute":"rcsb_entry_info.deposited_polymer_entity_instance_count","dataField":"rcsb_entry_info.deposited_polymer_entity_instance_count","description":"Number of polymer entity instances per deposited structure model; not the number of distinct polymer entities or biological assembly chains."},"polymerEntityCount":{"label":"Distinct polymer-entity count","unit":"entities","attribute":"rcsb_entry_info.polymer_entity_count","dataField":"rcsb_entry_info.polymer_entity_count","description":"Number of chemically distinct polymer entities in the entry, not copies of those entities."},"releaseYear":{"label":"Initial release year","unit":"year","attribute":"rcsb_accession_info.initial_release_date","dataField":"rcsb_accession_info.initial_release_date","description":"UTC calendar year of the entry\'s initial PDB release, not deposition or latest revision."}},"knownTaxa":{"human":9606,"mouse":10090,"Escherichia coli":562,"Saccharomyces cerevisiae":4932},"presentationDefaults":{"palette":"default","legend":"auto","grid":true,"lineStyle":"smooth","pointRadius":3,"borderWidth":1,"barRadius":0,"doughnutCutout":60,"colors":[],"fillOpacity":0.25,"pointStyle":"circle","lineDash":"solid","barWidth":0.8,"tickRotation":55,"fontSize":12,"height":400,"radialStartAngle":0,"xScale":"linear","xMin":null,"xMax":null,"yMin":null,"yMax":null,"reverseX":false,"reverseY":false,"seriesTypes":[],"stacking":"grouped"},"specSchema":{"type":"object","additionalProperties":false,"required":["version","title","categoryLabel","valueLabel","dimension","chartType","measure","scale","orientation","sort","topN","interval","cumulative","filters","series"],"properties":{"version":{"type":"integer","enum":[1]},"title":{"type":"string","minLength":1,"maxLength":140},"categoryLabel":{"type":"string","maxLength":100},"valueLabel":{"type":"string","maxLength":100},"dimension":{"type":"string","enum":["releaseYear","method","sourceOrganism","resolution","polymerType","integrativeInput","methodology","molecularWeight","atomCount","monomerCount","chainCount","polymerEntityCount"]},"chartType":{"type":"string","enum":["bar","line","area","pie","doughnut","radar","polarArea","mixed","scatter","bubble"]},"measure":{"type":"string","enum":["count","percent"]},"scale":{"type":"string","enum":["linear","logarithmic"]},"orientation":{"type":"string","enum":["vertical","horizontal"]},"sort":{"type":"string","enum":["labelAsc","countDesc"]},"topN":{"type":"integer","minimum":1,"maximum":60},"interval":{"type":"number","minimum":0.1,"maximum":100000},"cumulative":{"type":"boolean"},"presentation":{"$ref":"#/$defs/presentation"},"observations":{"anyOf":[{"type":"null"},{"type":"object","additionalProperties":false,"required":["x","y","size","limit"],"properties":{"x":{"$ref":"#/$defs/metric"},"y":{"$ref":"#/$defs/metric"},"size":{"anyOf":[{"type":"null"},{"$ref":"#/$defs/metric"}]},"limit":{"type":"integer","minimum":1,"maximum":500}}}]},"filters":{"type":"array","maxItems":12,"items":{"$ref":"#/$defs/filter"}},"series":{"type":"array","minItems":1,"maxItems":4,"items":{"type":"object","additionalProperties":false,"required":["label","filters"],"properties":{"label":{"type":"string","minLength":1,"maxLength":80},"filters":{"type":"array","maxItems":8,"items":{"$ref":"#/$defs/filter"}}}}}},"$defs":{"metric":{"type":"string","enum":["resolution","molecularWeight","atomCount","monomerCount","chainCount","polymerEntityCount","releaseYear"]},"axisBound":{"anyOf":[{"type":"number","minimum":-1000000000000,"maximum":1000000000000},{"type":"null"}]},"presentation":{"type":"object","additionalProperties":false,"properties":{"palette":{"type":"string","enum":["default","accessible","warm","cool","monochrome"]},"legend":{"type":"string","enum":["auto","top","bottom","left","right","hidden"]},"grid":{"type":"boolean"},"lineStyle":{"type":"string","enum":["straight","smooth","stepped"]},"pointRadius":{"type":"integer","minimum":0,"maximum":8},"borderWidth":{"type":"integer","minimum":1,"maximum":5},"barRadius":{"type":"integer","minimum":0,"maximum":12},"doughnutCutout":{"type":"integer","minimum":20,"maximum":85},"colors":{"type":"array","maxItems":8,"items":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"}},"fillOpacity":{"type":"number","minimum":0,"maximum":1},"pointStyle":{"type":"string","enum":["circle","rect","triangle","cross"]},"lineDash":{"type":"string","enum":["solid","dashed","dotted"]},"barWidth":{"type":"number","minimum":0.1,"maximum":1},"tickRotation":{"type":"integer","minimum":0,"maximum":90},"fontSize":{"type":"integer","minimum":10,"maximum":20},"height":{"type":"integer","minimum":280,"maximum":800},"radialStartAngle":{"type":"number","minimum":0,"maximum":360},"xScale":{"type":"string","enum":["linear","logarithmic"]},"xMin":{"$ref":"#/$defs/axisBound"},"xMax":{"$ref":"#/$defs/axisBound"},"yMin":{"$ref":"#/$defs/axisBound"},"yMax":{"$ref":"#/$defs/axisBound"},"reverseX":{"type":"boolean"},"reverseY":{"type":"boolean"},"seriesTypes":{"type":"array","maxItems":4,"items":{"type":"string","enum":["bar","line","area"]}},"stacking":{"type":"string","enum":["grouped","stacked"]}}},"filter":{"type":"object","additionalProperties":false,"required":["field","operator","value"],"properties":{"field":{"type":"string","enum":["releaseYear","method","resolution","sourceTaxonomy","sourceOrganism","ligand","polymerType","methodology","molecularWeight","atomCount","monomerCount","chainCount","polymerEntityCount"]},"operator":{"type":"string","enum":["in","gte","lte","gt","lt"]},"value":{"anyOf":[{"type":"number"},{"type":"array","minItems":1,"maxItems":10,"uniqueItems":true,"items":{"anyOf":[{"type":"string","minLength":1,"maxLength":120},{"type":"integer","minimum":1,"maximum":999999999}]}}]}}}}}}')}}]);