graphiql-explorer
Version:
Interactive explorer plugin for GraphiQL.
1 lines • 445 kB
JavaScript
!function(f){"object"==typeof exports&&"undefined"!=typeof module?module.exports=f():"function"==typeof define&&define.amd?define([],f):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).GraphiQLExplorer=f()}(function(){return function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);throw(f=new Error("Cannot find module '"+i+"'")).code="MODULE_NOT_FOUND",f}c=n[i]={exports:{}},e[i][0].call(c.exports,function(r){return o(e[i][1][r]||r)},c,c.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}({1:[function(require,module,exports){!function(global){!function(){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_slicedToArray=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,a=!1,i=void 0;try{for(var o,l=e[Symbol.iterator]();!(r=(o=l.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,i=e}finally{try{!r&&l.return&&l.return()}finally{if(a)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_createClass=function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t};function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}exports.defaultValue=defaultValue;var React=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_graphql=require("graphql");function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)}var defaultColors={keyword:"#B11A04",def:"#D2054E",property:"#1F61A0",qualifier:"#1C92A9",attribute:"#8B2BB9",number:"#2882F9",string:"#D64292",builtin:"#D47509",string2:"#0B7FC7",variable:"#397D13",atom:"#CA9800"},defaultArrowOpen=React.createElement("svg",{width:"12",height:"9"},React.createElement("path",{fill:"#666",d:"M 0 2 L 9 2 L 4.5 7.5 z"})),defaultArrowClosed=React.createElement("svg",{width:"12",height:"9"},React.createElement("path",{fill:"#666",d:"M 0 0 L 0 9 L 5.5 4.5 z"})),defaultCheckboxChecked=React.createElement("svg",{style:{marginRight:"3px",marginLeft:"-3px"},width:"12",height:"12",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement("path",{d:"M16 0H2C0.9 0 0 0.9 0 2V16C0 17.1 0.9 18 2 18H16C17.1 18 18 17.1 18 16V2C18 0.9 17.1 0 16 0ZM16 16H2V2H16V16ZM14.99 6L13.58 4.58L6.99 11.17L4.41 8.6L2.99 10.01L6.99 14L14.99 6Z",fill:"#666"})),defaultCheckboxUnchecked=React.createElement("svg",{style:{marginRight:"3px",marginLeft:"-3px"},width:"12",height:"12",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement("path",{d:"M16 2V16H2V2H16ZM16 0H2C0.9 0 0 0.9 0 2V16C0 17.1 0.9 18 2 18H16C17.1 18 18 17.1 18 16V2C18 0.9 17.1 0 16 0Z",fill:"#CCC"}));function Checkbox(e){return e.checked?e.styleConfig.checkboxChecked:e.styleConfig.checkboxUnchecked}function defaultGetDefaultFieldNames(e){var t=e.getFields();if(t.id)return e=["id"],t.email?e.push("email"):t.name&&e.push("name"),e;if(t.edges)return["edges"];if(t.node)return["node"];if(t.nodes)return["nodes"];var r=[];return Object.keys(t).forEach(function(e){(0,_graphql.isLeafType)(t[e].type)&&r.push(e)}),r.length?r.slice(0,2):["__typename"]}function isRequiredArgument(e){return(0,_graphql.isNonNullType)(e.type)&&void 0===e.defaultValue}function unwrapInputType(e){for(var t=e;(0,_graphql.isWrappingType)(t);)t=t.ofType;return t}function coerceArgValue(e,t){if("string"!=typeof t&&"VariableDefinition"===t.kind)return t.variable;if((0,_graphql.isScalarType)(e))try{switch(e.name){case"String":return{kind:"StringValue",value:String(e.parseValue(t))};case"Float":return{kind:"FloatValue",value:String(e.parseValue(parseFloat(t)))};case"Int":return{kind:"IntValue",value:String(e.parseValue(parseInt(t,10)))};case"Boolean":try{var n=JSON.parse(t);return"boolean"==typeof n?{kind:"BooleanValue",value:n}:{kind:"BooleanValue",value:!1}}catch(e){return{kind:"BooleanValue",value:!1}}default:return{kind:"StringValue",value:String(e.parseValue(t))}}}catch(e){return console.error("error coercing arg value",e,t),{kind:"StringValue",value:t}}else try{var r=e.parseValue(t);return r?{kind:"EnumValue",value:String(r)}:{kind:"EnumValue",value:e.getValues()[0].name}}catch(t){return{kind:"EnumValue",value:e.getValues()[0].name}}}_inherits(t,React.PureComponent),_createClass(t,[{key:"render",value:function(){var e=this.props,t=e.arg,e=e.parentField,r=this._getArgSelection();return React.createElement(AbstractArgView,{argValue:r?r.value:null,arg:t,parentField:e,addArg:this._addArg,removeArg:this._removeArg,setArgFields:this._modifyChildFields,setArgValue:this._setArgValue,getDefaultScalarArgValue:this.props.getDefaultScalarArgValue,makeDefaultArg:this.props.makeDefaultArg,onRunOperation:this.props.onRunOperation,styleConfig:this.props.styleConfig,onCommit:this.props.onCommit,definition:this.props.definition})}}]);var InputArgView=t;function t(){var e,r;_classCallCheck(this,t);for(var a=arguments.length,i=Array(a),o=0;o<a;o++)i[o]=arguments[o];return e=r=_possibleConstructorReturn(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),r._getArgSelection=function(){return r.props.selection.fields.find(function(e){return e.name.value===r.props.arg.name})},r._removeArg=function(){var e=r.props.selection,t=r._getArgSelection();r._previousArgSelection=t,r.props.modifyFields(e.fields.filter(function(e){return e!==t}),!0)},r._addArg=function(){var p,e=r.props,t=e.selection,n=e.arg,a=e.getDefaultScalarArgValue,i=e.parentField,e=e.makeDefaultArg,l=unwrapInputType(n.type),s=null;if(r._previousArgSelection?s=r._previousArgSelection:(0,_graphql.isInputObjectType)(l)?(p=l.getFields(),s={kind:"ObjectField",name:{kind:"Name",value:n.name},value:{kind:"ObjectValue",fields:defaultInputObjectFields(a,e,i,Object.keys(p).map(function(e){return p[e]}))}}):(0,_graphql.isLeafType)(l)&&(s={kind:"ObjectField",name:{kind:"Name",value:n.name},value:a(i,n,l)}),s)return r.props.modifyFields([].concat(_toConsumableArray(t.fields||[]),[s]),!0);console.error("Unable to add arg for argType",l)},r._setArgValue=function(e,t){var n=!1,a=!1,i=!1;try{"VariableDefinition"===e.kind?a=!0:null==e?n=!0:"string"==typeof e.kind&&(i=!0)}catch(e){}var o=r.props.selection,l=r._getArgSelection();if(l){var u,s=unwrapInputType(r.props.arg.type);if((0,_graphql.isLeafType)(s)||a||n||i)return u=a=void 0,null==e?u=null:!e.target&&e.kind&&"VariableDefinition"===e.kind?u=(a=e).variable:"string"==typeof e.kind?u=e:e.target&&"string"==typeof e.target.value&&(a=e.target.value,u=coerceArgValue(s,a)),r.props.modifyFields((o.fields||[]).map(function(e){return e===l?_extends({},e,{value:u}):e}),t);console.warn("Unable to handle non leaf types in InputArgView.setArgValue",e)}else console.error("missing arg selection when setting arg value")},r._modifyChildFields=function(e){return r.props.modifyFields(r.props.selection.fields.map(function(t){return t.name.value===r.props.arg.name?_extends({},t,{value:{kind:"ObjectValue",fields:e}}):t}),!0)},_possibleConstructorReturn(r,e)}function defaultValue(e){if((0,_graphql.isEnumType)(e))return{kind:"EnumValue",value:e.getValues()[0].name};switch(e.name){case"String":return{kind:"StringValue",value:""};case"Float":return{kind:"FloatValue",value:"1.5"};case"Int":return{kind:"IntValue",value:"10"};case"Boolean":return{kind:"BooleanValue",value:!1};default:return{kind:"StringValue",value:""}}}function defaultGetDefaultScalarArgValue(e,t,n){return defaultValue(n)}var ArgView=function(){function t(){var e,r;_classCallCheck(this,t);for(var a=arguments.length,i=Array(a),o=0;o<a;o++)i[o]=arguments[o];return e=r=_possibleConstructorReturn(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),r._getArgSelection=function(){return(r.props.selection.arguments||[]).find(function(e){return e.name.value===r.props.arg.name})},r._removeArg=function(e){var t=r.props.selection,n=r._getArgSelection();return r._previousArgSelection=n,r.props.modifyArguments((t.arguments||[]).filter(function(e){return e!==n}),e)},r._addArg=function(e){var u,t=r.props,n=t.selection,a=t.getDefaultScalarArgValue,i=t.makeDefaultArg,o=t.parentField,t=t.arg,s=unwrapInputType(t.type),p=null;return r._previousArgSelection?p=r._previousArgSelection:(0,_graphql.isInputObjectType)(s)?(u=s.getFields(),p={kind:"Argument",name:{kind:"Name",value:t.name},value:{kind:"ObjectValue",fields:defaultInputObjectFields(a,i,o,Object.keys(u).map(function(e){return u[e]}))}}):(0,_graphql.isLeafType)(s)&&(p={kind:"Argument",name:{kind:"Name",value:t.name},value:a(o,t,s)}),p?r.props.modifyArguments([].concat(_toConsumableArray(n.arguments||[]),[p]),e):(console.error("Unable to add arg for argType",s),null)},r._setArgValue=function(e,t){var n=!1,a=!1,i=!1;try{"VariableDefinition"===e.kind?a=!0:null==e?n=!0:"string"==typeof e.kind&&(i=!0)}catch(e){}var o=r.props.selection,l=r._getArgSelection();if(l||a){var u,s=unwrapInputType(r.props.arg.type);if((0,_graphql.isLeafType)(s)||a||n||i)return u=a=void 0,null==e?u=null:e.target&&"string"==typeof e.target.value?(a=e.target.value,u=coerceArgValue(s,a)):e.target||"VariableDefinition"!==e.kind?"string"==typeof e.kind&&(u=e):u=(a=e).variable,r.props.modifyArguments((o.arguments||[]).map(function(e){return e===l?_extends({},e,{value:u}):e}),t);console.warn("Unable to handle non leaf types in ArgView._setArgValue")}else console.error("missing arg selection when setting arg value")},r._setArgFields=function(e,t){var n=r.props.selection,a=r._getArgSelection();if(a)return r.props.modifyArguments((n.arguments||[]).map(function(t){return t===a?_extends({},t,{value:{kind:"ObjectValue",fields:e}}):t}),t);console.error("missing arg selection when setting arg value")},_possibleConstructorReturn(r,e)}return _inherits(t,React.PureComponent),_createClass(t,[{key:"render",value:function(){var e=this.props,t=e.arg,e=e.parentField,r=this._getArgSelection();return React.createElement(AbstractArgView,{argValue:r?r.value:null,arg:t,parentField:e,addArg:this._addArg,removeArg:this._removeArg,setArgFields:this._setArgFields,setArgValue:this._setArgValue,getDefaultScalarArgValue:this.props.getDefaultScalarArgValue,makeDefaultArg:this.props.makeDefaultArg,onRunOperation:this.props.onRunOperation,styleConfig:this.props.styleConfig,onCommit:this.props.onCommit,definition:this.props.definition})}}]),t}();var ScalarInput=function(){function t(){var e,r;_classCallCheck(this,t);for(var a=arguments.length,i=Array(a),o=0;o<a;o++)i[o]=arguments[o];return e=r=_possibleConstructorReturn(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),r._handleChange=function(e){r.props.setArgValue(e,!0)},_possibleConstructorReturn(r,e)}return _inherits(t,React.PureComponent),_createClass(t,[{key:"componentDidMount",value:function(){var e=this._ref,t=document.activeElement;!e||!t||t instanceof HTMLTextAreaElement||(e.focus(),e.setSelectionRange(0,e.value.length))}},{key:"render",value:function(){var e=this,t=this.props,n=t.arg,r=t.argValue,t=t.styleConfig,n=unwrapInputType(n.type),r="string"==typeof r.value?r.value:"",t="StringValue"===this.props.argValue.kind?t.colors.string:t.colors.number;return React.createElement("span",{style:{color:t}},"String"===n.name?'"':"",React.createElement("input",{style:{border:"none",borderBottom:"1px solid #888",outline:"none",width:Math.max(1,Math.min(15,r.length))+"ch",color:t},ref:function(t){e._ref=t},type:"text",onChange:this._handleChange,value:r}),"String"===n.name?'"':"")}}]),t}(),AbstractArgView=function(){function t(){var n,e;_classCallCheck(this,t);for(var a=arguments.length,i=Array(a),o=0;o<a;o++)i[o]=arguments[o];return n=e=_possibleConstructorReturn(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),e.state={displayArgActions:!1},_possibleConstructorReturn(e,n)}return _inherits(t,React.PureComponent),_createClass(t,[{key:"render",value:function(){var l,e=this,t=this.props,n=t.argValue,r=t.arg,t=t.styleConfig,i=unwrapInputType(r.type),o=null,p=(n&&("Variable"===n.kind?o=React.createElement("span",{style:{color:t.colors.variable}},"$",n.name.value):(0,_graphql.isScalarType)(i)?o="Boolean"===i.name?React.createElement("select",{style:{color:t.colors.builtin},onChange:this.props.setArgValue,value:"BooleanValue"===n.kind?n.value:void 0},React.createElement("option",{key:"true",value:"true"},"true"),React.createElement("option",{key:"false",value:"false"},"false")):React.createElement(ScalarInput,{setArgValue:this.props.setArgValue,arg:r,argValue:n,onRunOperation:this.props.onRunOperation,styleConfig:this.props.styleConfig}):(0,_graphql.isEnumType)(i)?"EnumValue"===n.kind?o=React.createElement("select",{style:{backgroundColor:"white",color:t.colors.string2},onChange:this.props.setArgValue,value:n.value},i.getValues().map(function(e){return React.createElement("option",{key:e.name,value:e.name},e.name)})):console.error("arg mismatch between arg and selection",i,n):(0,_graphql.isInputObjectType)(i)&&("ObjectValue"===n.kind?(l=i.getFields(),o=React.createElement("div",{style:{marginLeft:16}},Object.keys(l).sort().map(function(t){return React.createElement(InputArgView,{key:t,arg:l[t],parentField:e.props.parentField,selection:n,modifyFields:e.props.setArgFields,getDefaultScalarArgValue:e.props.getDefaultScalarArgValue,makeDefaultArg:e.props.makeDefaultArg,onRunOperation:e.props.onRunOperation,styleConfig:e.props.styleConfig,onCommit:e.props.onCommit,definition:e.props.definition})}))):console.error("arg mismatch between arg and selection",i,n))),n&&"Variable"===n.kind),u=this.state.displayArgActions?React.createElement("button",{type:"submit",className:"toolbar-button",title:p?"Remove the variable":"Extract the current value into a GraphQL variable",onClick:function(t){t.preventDefault(),t.stopPropagation(),(p?function(){var t,o,l,p,s,r;n&&n.name&&n.name.value&&(t=n.name.value,(r=(e.props.definition.variableDefinitions||[]).find(function(e){return e.variable.name.value===t}))&&(r=r.defaultValue,!(r=e.props.setArgValue(r,{commit:!1}))||(o=r.definitions.find(function(t){return t.name.value===e.props.definition.name.value}))&&((l=0,_graphql.visit)(o,{Variable:function(e){e.name.value===t&&(l+=1)}}),s=o.variableDefinitions||[],l<2&&(s=s.filter(function(e){return e.variable.name.value!==t})),p=_extends({},o,{variableDefinitions:s}),s=r.definitions.map(function(e){return o===e?p:e}),r=_extends({},r,{definitions:s}),e.props.onCommit(r))))}:function(){var c,m,u,y,t=r.name,a=(e.props.definition.variableDefinitions||[]).filter(function(e){return e.variable.name.value.startsWith(t)}).length,a=0<a?""+t+a:t,o=r.type.toString(),a={kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:a}},type:(0,_graphql.parseType)(o),directives:[]},o=void 0,p={},d=(o=null!=n?(u=(0,_graphql.visit)(n,{Variable:function(t){var n,t=t.name.value,a=(n=t,(e.props.definition.variableDefinitions||[]).find(function(e){return e.variable.name.value===n}));if(p[t]=p[t]+1||1,a)return a.defaultValue}}),c="NonNullType"===a.type.kind?_extends({},a,{type:a.type.type}):a,_extends({},c,{defaultValue:u})):a,Object.entries(p).filter(function(e){e=_slicedToArray(e,2);return e[0],e[1]<2}).map(function(e){var e=_slicedToArray(e,2),n=e[0];return e[1],n}));!o||(c=e.props.setArgValue(o,!1))&&(m=c.definitions.find(function(t){return!!(t.operation&&t.name&&t.name.value&&e.props.definition.name&&e.props.definition.name.value)&&t.name.value===e.props.definition.name.value}),u=[].concat(_toConsumableArray(m.variableDefinitions||[]),[o]).filter(function(e){return-1===d.indexOf(e.variable.name.value)}),y=_extends({},m,{variableDefinitions:u}),a=c.definitions.map(function(e){return m===e?y:e}),o=_extends({},c,{definitions:a}),e.props.onCommit(o))})()},style:t.styles.actionButtonStyle},React.createElement("span",{style:{color:t.colors.variable}},"$")):null;return React.createElement("div",{style:{cursor:"pointer",minHeight:"16px",WebkitUserSelect:"none",userSelect:"none"},"data-arg-name":r.name,"data-arg-type":i.name,className:"graphiql-explorer-"+r.name},React.createElement("span",{style:{cursor:"pointer"},onClick:function(t){var r=!n;r?e.props.addArg(!0):e.props.removeArg(!0),e.setState({displayArgActions:r})}},(0,_graphql.isInputObjectType)(i)?React.createElement("span",null,n?this.props.styleConfig.arrowOpen:this.props.styleConfig.arrowClosed):React.createElement(Checkbox,{checked:!!n,styleConfig:this.props.styleConfig}),React.createElement("span",{style:{color:t.colors.attribute},title:r.description,onMouseEnter:function(){null!=n&&e.setState({displayArgActions:!0})},onMouseLeave:function(){return e.setState({displayArgActions:!1})}},r.name,isRequiredArgument(r)?"*":"",": ",u," ")," "),o||React.createElement("span",null)," ")}}]),t}(),AbstractView=function(){function t(){var e,r;_classCallCheck(this,t);for(var a=arguments.length,i=Array(a),o=0;o<a;o++)i[o]=arguments[o];return e=r=_possibleConstructorReturn(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),r._addFragment=function(){r.props.modifySelections([].concat(_toConsumableArray(r.props.selections),[r._previousSelection||{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:r.props.implementingType.name}},selectionSet:{kind:"SelectionSet",selections:r.props.getDefaultFieldNames(r.props.implementingType).map(function(e){return{kind:"Field",name:{kind:"Name",value:e}}})}}]))},r._removeFragment=function(){var e=r._getSelection();r._previousSelection=e,r.props.modifySelections(r.props.selections.filter(function(t){return t!==e}))},r._getSelection=function(){var e=r.props.selections.find(function(e){return"InlineFragment"===e.kind&&e.typeCondition&&r.props.implementingType.name===e.typeCondition.name.value});return e?"InlineFragment"===e.kind?e:void 0:null},r._modifyChildSelections=function(e,t){var n=r._getSelection();return r.props.modifySelections(r.props.selections.map(function(t){return t===n?{directives:t.directives,kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:r.props.implementingType.name}},selectionSet:{kind:"SelectionSet",selections:e}}:t}),t)},_possibleConstructorReturn(r,e)}return _inherits(t,React.PureComponent),_createClass(t,[{key:"render",value:function(){var e=this,t=this.props,n=t.implementingType,r=t.schema,a=t.getDefaultFieldNames,t=t.styleConfig,o=this._getSelection(),l=n.getFields(),s=o&&o.selectionSet?o.selectionSet.selections:[];return React.createElement("div",{className:"graphiql-explorer-"+n.name},React.createElement("span",{style:{cursor:"pointer"},onClick:o?this._removeFragment:this._addFragment},React.createElement(Checkbox,{checked:!!o,styleConfig:this.props.styleConfig}),React.createElement("span",{style:{color:t.colors.atom}},this.props.implementingType.name)),o?React.createElement("div",{style:{marginLeft:16}},Object.keys(l).sort().map(function(t){return React.createElement(FieldView,{key:t,field:l[t],selections:s,modifySelections:e._modifyChildSelections,schema:r,getDefaultFieldNames:a,getDefaultScalarArgValue:e.props.getDefaultScalarArgValue,makeDefaultArg:e.props.makeDefaultArg,onRunOperation:e.props.onRunOperation,onCommit:e.props.onCommit,styleConfig:e.props.styleConfig,definition:e.props.definition,availableFragments:e.props.availableFragments})})):null)}}]),t}(),FragmentView=function(){function t(){var e,r;_classCallCheck(this,t);for(var a=arguments.length,i=Array(a),o=0;o<a;o++)i[o]=arguments[o];return e=r=_possibleConstructorReturn(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),r._addFragment=function(){r.props.modifySelections([].concat(_toConsumableArray(r.props.selections),[r._previousSelection||{kind:"FragmentSpread",name:r.props.fragment.name}]))},r._removeFragment=function(){var e=r._getSelection();r._previousSelection=e,r.props.modifySelections(r.props.selections.filter(function(e){return!("FragmentSpread"===e.kind&&e.name.value===r.props.fragment.name.value)}))},r._getSelection=function(){return r.props.selections.find(function(e){return"FragmentSpread"===e.kind&&e.name.value===r.props.fragment.name.value})},_possibleConstructorReturn(r,e)}return _inherits(t,React.PureComponent),_createClass(t,[{key:"render",value:function(){var e=this.props.styleConfig,t=this._getSelection();return React.createElement("div",{className:"graphiql-explorer-"+this.props.fragment.name.value},React.createElement("span",{style:{cursor:"pointer"},onClick:t?this._removeFragment:this._addFragment},React.createElement(Checkbox,{checked:!!t,styleConfig:this.props.styleConfig}),React.createElement("span",{style:{color:e.colors.def},className:"graphiql-explorer-"+this.props.fragment.name.value},this.props.fragment.name.value)))}}]),t}();function defaultInputObjectFields(e,t,n,r){var a=[],i=!0,o=!1,l=void 0;try{for(var s,p=r[Symbol.iterator]();!(i=(s=p.next()).done);i=!0){var c,u=s.value;((0,_graphql.isRequiredInputField)(u)||t&&t(n,u))&&(c=unwrapInputType(u.type),(0,_graphql.isInputObjectType)(c)?function(){var r=c.getFields();a.push({kind:"ObjectField",name:{kind:"Name",value:u.name},value:{kind:"ObjectValue",fields:defaultInputObjectFields(e,t,n,Object.keys(r).map(function(e){return r[e]}))}})}():(0,_graphql.isLeafType)(c)&&a.push({kind:"ObjectField",name:{kind:"Name",value:u.name},value:e(n,u,c)}))}}catch(e){o=!0,l=e}finally{try{!i&&p.return&&p.return()}finally{if(o)throw l}}return a}function defaultArgs(e,t,n){var r=[],a=!0,i=!1,o=void 0;try{for(var l,s=n.args[Symbol.iterator]();!(a=(l=s.next()).done);a=!0){var u,p=l.value;(isRequiredArgument(p)||t&&t(n,p))&&(u=unwrapInputType(p.type),(0,_graphql.isInputObjectType)(u)?function(){var a=u.getFields();r.push({kind:"Argument",name:{kind:"Name",value:p.name},value:{kind:"ObjectValue",fields:defaultInputObjectFields(e,t,n,Object.keys(a).map(function(e){return a[e]}))}})}():(0,_graphql.isLeafType)(u)&&r.push({kind:"Argument",name:{kind:"Name",value:p.name},value:e(n,p,u)}))}}catch(e){i=!0,o=e}finally{try{!a&&s.return&&s.return()}finally{if(i)throw o}}return r}var FieldView=function(){function t(){var e,r;_classCallCheck(this,t);for(var a=arguments.length,i=Array(a),o=0;o<a;o++)i[o]=arguments[o];return e=r=_possibleConstructorReturn(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),r.state={displayFieldActions:!1},r._addAllFieldsToSelections=function(e){e={kind:"SelectionSet",selections:e?Object.keys(e).map(function(e){return{kind:"Field",name:{kind:"Name",value:e},arguments:[]}}):[]},e=[].concat(_toConsumableArray(r.props.selections.filter(function(e){return"InlineFragment"===e.kind||e.name.value!==r.props.field.name})),[{kind:"Field",name:{kind:"Name",value:r.props.field.name},arguments:defaultArgs(r.props.getDefaultScalarArgValue,r.props.makeDefaultArg,r.props.field),selectionSet:e}]);r.props.modifySelections(e)},r._addFieldToSelections=function(e){var t=[].concat(_toConsumableArray(r.props.selections),[r._previousSelection||{kind:"Field",name:{kind:"Name",value:r.props.field.name},arguments:defaultArgs(r.props.getDefaultScalarArgValue,r.props.makeDefaultArg,r.props.field)}]);r.props.modifySelections(t)},r._handleUpdateSelections=function(e){var t;r._getSelection()&&!e.altKey?r._removeFieldFromSelections():(t=(0,_graphql.getNamedType)(r.props.field.type),(t=(0,_graphql.isObjectType)(t)&&t.getFields())&&e.altKey?r._addAllFieldsToSelections(t):r._addFieldToSelections(t))},r._removeFieldFromSelections=function(){var e=r._getSelection();r._previousSelection=e,r.props.modifySelections(r.props.selections.filter(function(t){return t!==e}))},r._getSelection=function(){var e=r.props.selections.find(function(e){return"Field"===e.kind&&r.props.field.name===e.name.value});return e?"Field"===e.kind?e:void 0:null},r._setArguments=function(e,t){var n=r._getSelection();if(n)return r.props.modifySelections(r.props.selections.map(function(t){return t===n?{alias:n.alias,arguments:e,directives:n.directives,kind:"Field",name:n.name,selectionSet:n.selectionSet}:t}),t);console.error("Missing selection when setting arguments",e)},r._modifyChildSelections=function(e,t){return r.props.modifySelections(r.props.selections.map(function(t){if("Field"!==t.kind||r.props.field.name!==t.name.value)return t;if("Field"!==t.kind)throw new Error("invalid selection");return{alias:t.alias,arguments:t.arguments,directives:t.directives,kind:"Field",name:t.name,selectionSet:{kind:"SelectionSet",selections:e}}}),t)},_possibleConstructorReturn(r,e)}return _inherits(t,React.PureComponent),_createClass(t,[{key:"render",value:function(){var f,m,e=this,n=this.props,r=n.field,a=n.schema,i=n.getDefaultFieldNames,n=n.styleConfig,l=this._getSelection(),s=function(e){for(var t=e;(0,_graphql.isWrappingType)(t);)t=t.ofType;return t}(r.type),p=r.args.sort(function(e,t){return e.name.localeCompare(t.name)}),u="graphiql-explorer-node graphiql-explorer-"+r.name,c=(r.isDeprecated&&(u+=" graphiql-explorer-deprecated"),(0,_graphql.isObjectType)(s)||(0,_graphql.isInterfaceType)(s)||(0,_graphql.isUnionType)(s)?this.props.availableFragments&&this.props.availableFragments[s.name]:null),u=React.createElement("div",{className:u},React.createElement("span",{title:r.description,style:{cursor:"pointer",display:"inline-flex",alignItems:"center",minHeight:"16px",WebkitUserSelect:"none",userSelect:"none"},"data-field-name":r.name,"data-field-type":s.name,onClick:this._handleUpdateSelections,onMouseEnter:function(){(0,_graphql.isObjectType)(s)&&l&&l.selectionSet&&0<l.selectionSet.selections.filter(function(e){return"FragmentSpread"!==e.kind}).length&&e.setState({displayFieldActions:!0})},onMouseLeave:function(){return e.setState({displayFieldActions:!1})}},(0,_graphql.isObjectType)(s)?React.createElement("span",null,l?this.props.styleConfig.arrowOpen:this.props.styleConfig.arrowClosed):null,(0,_graphql.isObjectType)(s)?null:React.createElement(Checkbox,{checked:!!l,styleConfig:this.props.styleConfig}),React.createElement("span",{style:{color:n.colors.property},className:"graphiql-explorer-field-view"},r.name),this.state.displayFieldActions?React.createElement("button",{type:"submit",className:"toolbar-button",title:"Extract selections into a new reusable fragment",onClick:function(t){t.preventDefault(),t.stopPropagation();var n=s.name+"Fragment",t=(c||[]).filter(function(e){return e.name.value.startsWith(n)}).length,t=(0<t&&(n=""+n+t),l&&l.selectionSet?l.selectionSet.selections:[]),i=[{kind:"FragmentSpread",name:{kind:"Name",value:n},directives:[]}],t={kind:"FragmentDefinition",name:{kind:"Name",value:n},typeCondition:{kind:"NamedType",name:{kind:"Name",value:s.name}},directives:[],selectionSet:{kind:"SelectionSet",selections:t}},i=e._modifyChildSelections(i,!1);i?(i=_extends({},i,{definitions:[].concat(_toConsumableArray(i.definitions),[t])}),e.props.onCommit(i)):console.warn("Unable to complete extractFragment operation")},style:_extends({},n.styles.actionButtonStyle)},React.createElement("span",null,"…")):null),l&&p.length?React.createElement("div",{style:{marginLeft:16},className:"graphiql-explorer-graphql-arguments"},p.map(function(t){return React.createElement(ArgView,{key:t.name,parentField:r,arg:t,selection:l,modifyArguments:e._setArguments,getDefaultScalarArgValue:e.props.getDefaultScalarArgValue,makeDefaultArg:e.props.makeDefaultArg,onRunOperation:e.props.onRunOperation,styleConfig:e.props.styleConfig,onCommit:e.props.onCommit,definition:e.props.definition})})):null);return l&&((0,_graphql.isObjectType)(s)||(0,_graphql.isInterfaceType)(s)||(0,_graphql.isUnionType)(s))?(f=(0,_graphql.isUnionType)(s)?{}:s.getFields(),m=l&&l.selectionSet?l.selectionSet.selections:[],React.createElement("div",{className:"graphiql-explorer-"+r.name},u,React.createElement("div",{style:{marginLeft:16}},c?c.map(function(t){var n=a.getType(t.typeCondition.name.value),r=t.name.value;return n?React.createElement(FragmentView,{key:r,fragment:t,selections:m,modifySelections:e._modifyChildSelections,schema:a,styleConfig:e.props.styleConfig,onCommit:e.props.onCommit}):null}):null,Object.keys(f).sort().map(function(n){return React.createElement(t,{key:n,field:f[n],selections:m,modifySelections:e._modifyChildSelections,schema:a,getDefaultFieldNames:i,getDefaultScalarArgValue:e.props.getDefaultScalarArgValue,makeDefaultArg:e.props.makeDefaultArg,onRunOperation:e.props.onRunOperation,styleConfig:e.props.styleConfig,onCommit:e.props.onCommit,definition:e.props.definition,availableFragments:e.props.availableFragments})}),(0,_graphql.isInterfaceType)(s)||(0,_graphql.isUnionType)(s)?a.getPossibleTypes(s).map(function(t){return React.createElement(AbstractView,{key:t.name,implementingType:t,selections:m,modifySelections:e._modifyChildSelections,schema:a,getDefaultFieldNames:i,getDefaultScalarArgValue:e.props.getDefaultScalarArgValue,makeDefaultArg:e.props.makeDefaultArg,onRunOperation:e.props.onRunOperation,styleConfig:e.props.styleConfig,onCommit:e.props.onCommit,definition:e.props.definition})}):null))):u}}]),t}();var DEFAULT_DOCUMENT={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",variableDefinitions:[],name:{kind:"Name",value:"MyQuery"},directives:[],selectionSet:{kind:"SelectionSet",selections:[]}}]},parseQueryMemoize=null;function memoizeParseQuery(e){if(parseQueryMemoize&&parseQueryMemoize[0]===e)return parseQueryMemoize[1];var t=function(e){try{return e.trim()?(0,_graphql.parse)(e,{noLocation:!0}):null}catch(e){return new Error(e)}}(e);return t?t instanceof Error?parseQueryMemoize?parseQueryMemoize[1]:DEFAULT_DOCUMENT:(parseQueryMemoize=[e,t],t):DEFAULT_DOCUMENT}var defaultStyles={buttonStyle:{fontSize:"1.2em",padding:"0px",backgroundColor:"white",border:"none",margin:"5px 0px",height:"40px",width:"100%",display:"block",maxWidth:"none"},actionButtonStyle:{padding:"0px",backgroundColor:"white",border:"none",margin:"0px",maxWidth:"none",height:"15px",width:"15px",display:"inline-block",fontSize:"smaller"},explorerActionsStyle:{margin:"4px -8px -8px",paddingLeft:"8px",bottom:"0px",width:"100%",textAlign:"center",background:"none",borderTop:"none",borderBottom:"none"}},RootView=function(){function t(){var e,r;_classCallCheck(this,t);for(var a=arguments.length,i=Array(a),o=0;o<a;o++)i[o]=arguments[o];return e=r=_possibleConstructorReturn(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),r.state={newOperationType:"query",displayTitleActions:!1},r._modifySelections=function(e,t){var n=r.props.definition,a=void 0;return"FragmentDefinition"===(n=0===n.selectionSet.selections.length&&r._previousOperationDef?r._previousOperationDef:n).kind?a=_extends({},n,{selectionSet:_extends({},n.selectionSet,{selections:e})}):"OperationDefinition"===n.kind&&(0===(e=e.filter(function(e){return!("Field"===e.kind&&"__typename"===e.name.value)})).length&&(e=[{kind:"Field",name:{kind:"Name",value:"__typename ## Placeholder value"}}]),a=_extends({},n,{selectionSet:_extends({},n.selectionSet,{selections:e})})),r.props.onEdit(a,t)},r._onOperationRename=function(e){return r.props.onOperationRename(e.target.value)},r._handlePotentialRun=function(e){!function(e){return e.ctrlKey&&"Enter"===e.key}(e)||"FragmentDefinition"===r.props.definition.kind||r.props.onRunOperation(r.props.name)},r._rootViewElId=function(){var e=r.props;return e.operationType+"-"+(e.name||"unknown")},_possibleConstructorReturn(r,e)}return _inherits(t,React.PureComponent),_createClass(t,[{key:"componentDidMount",value:function(){var e=this._rootViewElId();this.props.onMount(e)}},{key:"render",value:function(){var e=this,t=this.props,n=t.operationType,r=t.definition,a=t.schema,i=t.getDefaultFieldNames,t=t.styleConfig,l=this._rootViewElId(),s=this.props.fields||{},p=r.selectionSet.selections,r=this.props.name||capitalize(n)+" Name";return React.createElement("div",{id:l,tabIndex:"0",onKeyDown:this._handlePotentialRun,style:{borderBottom:this.props.isLast?"none":"1px solid #d6d6d6",marginBottom:"0em",paddingBottom:"1em"}},React.createElement("div",{style:{color:t.colors.keyword,paddingBottom:4},className:"graphiql-operation-title-bar",onMouseEnter:function(){return e.setState({displayTitleActions:!0})},onMouseLeave:function(){return e.setState({displayTitleActions:!1})}},n," ",React.createElement("span",{style:{color:t.colors.def}},React.createElement("input",{style:{color:t.colors.def,border:"none",borderBottom:"1px solid #888",outline:"none",width:Math.max(4,r.length)+"ch"},autoComplete:"false",placeholder:capitalize(n)+" Name",value:this.props.name,onKeyDown:this._handlePotentialRun,onChange:this._onOperationRename})),this.props.onTypeName?React.createElement("span",null,React.createElement("br",null),"on "+this.props.onTypeName):"",this.state.displayTitleActions?React.createElement(React.Fragment,null,React.createElement("button",{type:"submit",className:"toolbar-button",onClick:function(){return e.props.onOperationDestroy()},style:_extends({},t.styles.actionButtonStyle)},React.createElement("span",null,"✕")),React.createElement("button",{type:"submit",className:"toolbar-button",onClick:function(){return e.props.onOperationClone()},style:_extends({},t.styles.actionButtonStyle)},React.createElement("span",null,"⎘"))):""),Object.keys(s).sort().map(function(t){return React.createElement(FieldView,{key:t,field:s[t],selections:p,modifySelections:e._modifySelections,schema:a,getDefaultFieldNames:i,getDefaultScalarArgValue:e.props.getDefaultScalarArgValue,makeDefaultArg:e.props.makeDefaultArg,onRunOperation:e.props.onRunOperation,styleConfig:e.props.styleConfig,onCommit:e.props.onCommit,definition:e.props.definition,availableFragments:e.props.availableFragments})}))}}]),t}();function Attribution(){return React.createElement("div",{style:{fontFamily:"sans-serif",display:"flex",flexDirection:"column",alignItems:"center",margin:"1em",marginTop:0,flexGrow:1,justifyContent:"flex-end"}},React.createElement("div",{style:{borderTop:"1px solid #d6d6d6",paddingTop:"1em",width:"100%",textAlign:"center"}},"GraphiQL Explorer by ",React.createElement("a",{href:"https://www.onegraph.com"},"OneGraph")),React.createElement("div",null,"Contribute on"," ",React.createElement("a",{href:"https://github.com/OneGraph/graphiql-explorer"},"GitHub")))}var Explorer=function(){function t(){var e,r;_classCallCheck(this,t);for(var a=arguments.length,i=Array(a),o=0;o<a;o++)i[o]=arguments[o];return e=r=_possibleConstructorReturn(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),r.state={newOperationType:"query",operation:null,operationToScrollTo:null},r._resetScroll=function(){var e=r._ref;e&&(e.scrollLeft=0)},r._onEdit=function(e){return r.props.onEdit(e)},r._setAddOperationType=function(e){r.setState({newOperationType:e})},r._handleRootViewMount=function(e){!r.state.operationToScrollTo||r.state.operationToScrollTo!==e||(e=document.querySelector(".graphiql-explorer-root #"+e))&&e.scrollIntoView()},_possibleConstructorReturn(r,e)}return _inherits(t,React.PureComponent),_createClass(t,[{key:"componentDidMount",value:function(){this._resetScroll()}},{key:"render",value:function(){var e=this,t=this.props,n=t.schema,r=t.query,a=t.makeDefaultArg;if(!n)return React.createElement("div",{style:{fontFamily:"sans-serif"},className:"error-container"},"No Schema Available");var i={colors:this.props.colors||defaultColors,checkboxChecked:this.props.checkboxChecked||defaultCheckboxChecked,checkboxUnchecked:this.props.checkboxUnchecked||defaultCheckboxUnchecked,arrowClosed:this.props.arrowClosed||defaultArrowClosed,arrowOpen:this.props.arrowOpen||defaultArrowOpen,styles:this.props.styles?_extends({},defaultStyles,this.props.styles):defaultStyles},t=n.getQueryType(),l=n.getMutationType(),s=n.getSubscriptionType();if(!t&&!l&&!s)return React.createElement("div",null,"Missing query type");var p=t&&t.getFields(),u=l&&l.getFields(),c=s&&s.getFields(),d=memoizeParseQuery(r),f=this.props.getDefaultFieldNames||defaultGetDefaultFieldNames,m=this.props.getDefaultScalarArgValue||defaultGetDefaultScalarArgValue,t=d.definitions.map(function(e){return"FragmentDefinition"===e.kind||"OperationDefinition"===e.kind?e:null}).filter(Boolean),y=0===t.length?DEFAULT_DOCUMENT.definitions:t,l=[p?React.createElement("option",{key:"query",className:"toolbar-button",style:i.styles.buttonStyle,type:"link",value:"query"},"Query"):null,u?React.createElement("option",{key:"mutation",className:"toolbar-button",style:i.styles.buttonStyle,type:"link",value:"mutation"},"Mutation"):null,c?React.createElement("option",{key:"subscription",className:"toolbar-button",style:i.styles.buttonStyle,type:"link",value:"subscription"},"Subscription"):null].filter(Boolean),s=0===l.length||this.props.hideActions?null:React.createElement("div",{style:{minHeight:"50px",maxHeight:"50px",overflow:"none"}},React.createElement("form",{className:"variable-editor-title graphiql-explorer-actions",style:_extends({},i.styles.explorerActionsStyle,{display:"flex",flexDirection:"row",alignItems:"center",borderTop:"1px solid rgb(214, 214, 214)"}),onSubmit:function(e){return e.preventDefault()}},React.createElement("span",{style:{display:"inline-block",flexGrow:"0",textAlign:"right"}},"Add new"," "),React.createElement("select",{onChange:function(t){return e._setAddOperationType(t.target.value)},value:this.state.newOperationType,style:{flexGrow:"2"}},l),React.createElement("button",{type:"submit",className:"toolbar-button",onClick:function(){return e.state.newOperationType?(t=e.state.newOperationType,n=d.definitions,n=(r=1===d.definitions.length&&d.definitions[0]===DEFAULT_DOCUMENT.definitions[0])?[]:n.filter(function(e){return"OperationDefinition"===e.kind&&e.operation===t}),n="My"+capitalize(t)+(0===n.length?"":n.length+1),o={kind:"OperationDefinition",operation:t,name:{kind:"Name",value:n},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__typename # Placeholder value",loc:null},arguments:[],directives:[],selectionSet:null,loc:null}],loc:null},loc:null},r=r?[o]:[].concat(_toConsumableArray(d.definitions),[o]),o=_extends({},d,{definitions:r}),e.setState({operationToScrollTo:t+"-"+n}),void e.props.onEdit((0,_graphql.print)(o))):null;var t,n,r,o},style:_extends({},i.styles.buttonStyle,{height:"22px",width:"22px"})},React.createElement("span",null,"+")))),r=this.props.externalFragments&&this.props.externalFragments.reduce(function(e,t){var n,r;return"FragmentDefinition"===t.kind?(r=e[n=t.typeCondition.name.value]||[],r=[].concat(_toConsumableArray(r),[t]).sort(function(e,t){return e.name.value.localeCompare(t.name.value)}),_extends({},e,_defineProperty({},n,r))):e},{}),t=y.reduce(function(e,t){var n,r;return"FragmentDefinition"===t.kind?(r=e[n=t.typeCondition.name.value]||[],r=[].concat(_toConsumableArray(r),[t]).sort(function(e,t){return e.name.value.localeCompare(t.name.value)}),_extends({},e,_defineProperty({},n,r))):e},{}),k=_extends({},t,r),l=this.props.showAttribution?React.createElement(Attribution,null):null;return React.createElement("div",{ref:function(t){e._ref=t},style:{fontSize:12,textOverflow:"ellipsis",whiteSpace:"nowrap",margin:0,padding:8,fontFamily:'Consolas, Inconsolata, "Droid Sans Mono", Monaco, monospace',display:"flex",flexDirection:"column",height:"100%"},className:"graphiql-explorer-root"},React.createElement("div",{style:{flexGrow:"1",overflow:"scroll"}},y.map(function(t,r){function _(t){t=(0,_graphql.print)(t),e.props.onEdit(t)}var o=t&&t.name&&t.name.value,l="FragmentDefinition"===t.kind?"fragment":t&&t.operation||"query",s="FragmentDefinition"===t.kind&&"NamedType"===t.typeCondition.kind&&n.getType(t.typeCondition.name.value),s=s instanceof _graphql.GraphQLObjectType?s.getFields():null,s="query"===l?p:"mutation"===l?u:"subscription"===l?c:"FragmentDefinition"===t.kind?s:null,v="FragmentDefinition"===t.kind?t.typeCondition.name.value:null;return React.createElement(RootView,{key:r,isLast:r===y.length-1,fields:s,operationType:l,name:o,definition:t,onOperationRename:function(n){i=_extends({},r=t,{name:null==n||""===n?null:{kind:"Name",value:n,loc:void 0}}),n=d.definitions.map(function(e){return r===e?i:e});var r,i,n=_extends({},d,{definitions:n});e.props.onEdit((0,_graphql.print)(n))},onOperationDestroy:function(){n=t,r=d.definitions.filter(function(e){return n!==e});var n,r=_extends({},d,{definitions:r});e.props.onEdit((0,_graphql.print)(r))},onOperationClone:function(){var n=function(t){var n="FragmentDefinition"===t.kind?"fragment":t.operation,r=(t.name&&t.name.value||"")+"Copy",t=_extends({},t,{name:{kind:"Name",value:r,loc:void 0}}),i=d.definitions,i=[].concat(_toConsumableArray(i),[t]);return e.setState({operationToScrollTo:n+"-"+r}),_extends({},d,{definitions:i})}(t);e.props.onEdit((0,_graphql.print)(n))},onTypeName:v,onMount:e._handleRootViewMount,onCommit:_,onEdit:function(e,n){var a,n="object"!==(void 0===n?"undefined":_typeof(n))||void 0===n.commit||n.commit;return e?(a=_extends({},d,{definitions:d.definitions.map(function(n){return n===t?e:n})}),n&&_(a),a):d},schema:n,getDefaultFieldNames:f,getDefaultScalarArgValue:m,makeDefaultArg:a,onRunOperation:function(){e.props.onRunOperation&&e.props.onRunOperation(o)},styleConfig:i,availableFragments:k})}),l),s)}}]),t}(),ErrorBoundary=(Explorer.defaultProps={getDefaultFieldNames:defaultGetDefaultFieldNames,getDefaultScalarArgValue:defaultGetDefaultScalarArgValue},function(){function t(){var n,e;_classCallCheck(this,t);for(var a=arguments.length,i=Array(a),o=0;o<a;o++)i[o]=arguments[o];return n=e=_possibleConstructorReturn(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),e.state={hasError:!1,error:null,errorInfo:null},_possibleConstructorReturn(e,n)}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidCatch",value:function(e,t){this.setState({hasError:!0,error:e,errorInfo:t}),console.error("Error in component",e,t)}},{key:"render",value:function(){return this.state.hasError?React.createElement("div",{style:{padding:18,fontFamily:"sans-serif"}},React.createElement("div",null,"Something went wrong"),React.createElement("details",{style:{whiteSpace:"pre-wrap"}},this.state.error?this.state.error.toString():null,React.createElement("br",null),this.state.errorInfo?this.state.errorInfo.componentStack:null)):this.props.children}}]),t}()),ExplorerWrapper=function(){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,React.PureComponent),_createClass(t,[{key:"render",value:function(){return React.createElement("div",{className:"docExplorerWrap",style:{height:"100%",width:this.props.width,minWidth:this.props.width,zIndex:7,display:this.props.explorerIsOpen?"flex":"none",flexDirection:"column",overflow:"hidden"}},React.createElement("div",{className:"doc-explorer-title-bar"},React.createElement("div",{className:"doc-explorer-title"},this.props.title),React.createElement("div",{className:"doc-explorer-rhs"},React.createElement("div",{className:"docExplorerHide",onClick:this.props.onToggleExplorer},"✕"))),React.createElement("div",{className:"doc-explorer-contents",style:{padding:"0px",overflowY:"unset"}},React.createElement(ErrorBoundary,null,React.createElement(Explorer,this.props))))}}]),t}();ExplorerWrapper.defaultValue=defaultValue,ExplorerWrapper.defaultProps={width:320,title:"Explorer"},exports.default=ExplorerWrapper}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{graphql:13}],2:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Explorer=void 0;var require=require("./Explorer"),require=(require=require)&&require.__esModule?require:{default:require};exports.Explorer=require.default,exports.default=require.default},{"./Explorer":1}],3:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GraphQLError=GraphQLError;var _printError=require("./printError"),_location=require("../language/location");function GraphQLError(message,nodes,source,positions,path,originalError,extensions){var _locations,nodes=Array.isArray(nodes)?0!==nodes.length?nodes:void 0:nodes?[nodes]:void 0,_source=source,node=(!source&&nodes&&(_source=(node=nodes[0])&&node.loc&&node.loc.source),positions),positions=((node=!node&&nodes?nodes.reduce(function(list,node){return node.loc&&list.push(node.loc.start),list},[]):node)&&0===node.length&&(node=void 0),positions&&source?_locations=positions.map(function(pos){return(0,_location.getLocation)(source,pos)}):nodes&&(_locations=nodes.reduce(function(list,node){return node.loc&&list.push((0,_location.getLocation)(node.loc.source,node.loc.start)),list},[])),extensions||originalError&&originalError.extensions);Object.defineProperties(this,{message:{value:message,enumerable:!0,writable:!0},locations:{value:_locations||void 0,enumerable:Boolean(_locations)},path:{value:path||void 0,enumerable:Boolean(path)},nodes:{value:nodes||void 0},source:{value:_source||void 0},positions:{value:node||void 0},originalError:{value:originalError},extensions:{value:positions||void 0,enumerable:Boolean(positions)}}),originalError&&originalError.stack?Object.defineProperty(this,"stack",{value:originalError.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,GraphQLError):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}GraphQLError.prototype=Object.create(Error.prototype,{constructor:{value:GraphQLError},name:{value:"GraphQLError"},toString:{value:function(){return(0,_printError.printError)(this)}}})},{"../language/location":39,"./printError":7}],4:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.formatError=function(error){error||(0,_invariant.default)(0,"Received null or undefined error.");var message=error.message||"An unknown error occurred.",locations=error.locations,path=error.path,error=error.extensions;return error?{message:message,locations:locations,path:path,extensions:error}:{message:message,locations:locations,path:path}};var _invariant=(exports=require("../jsutils/invariant"))&&exports.__esModule?exports:{default:exports}},{"../jsutils/invariant":19}],5:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"GraphQLError",{enumerable:!0,get:function(){return _GraphQLError.GraphQLError}}),Object.defineProperty(exports,"syntaxError",{enumerable:!0,get:function(){return _syntaxError.syntaxError}}),Object.defineProperty(exports,"locatedError",{enumerable:!0,get:function(){return _locatedError.locatedError}}),Object.defineProperty(exports,"printError",{enumerable:!0,get:function(){return _printError.printError}}),Object.defineProperty(exports,"formatError",{enumerable:!0,get:function(){return _formatError.formatError}});var _GraphQLError=require("./GraphQLError"),_syntaxError=require("./syntaxError"),_locatedError=require("./locatedError"),_printError=require("./printError"),_formatError=require("./formatError")},{"./GraphQLError":3,"./formatError":4,"./locatedError":6,"./printError":7,"./syntaxError":8}],6:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.locatedError=function(originalError,nodes,path){if(originalError&&Array.isArray(originalError.path))return originalError;return new _GraphQLError.GraphQLError(originalError&&originalError.message,originalError&&originalError.nodes||nodes,originalError&&originalError.source,originalError&&originalError.positions,path,originalError)};var _GraphQLError=require("./GraphQLError")},{"./GraphQLError":3}],7:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.printError=function(error){var printedLocations=[];if(error.nodes){var _iteratorNormalCompletion=!0,_didIteratorError=!1,_iteratorError=void 0;try{for(var _step,_iterator=error.nodes[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=!0){var node=_step.value;node.loc&&printedLocations.push(highlightSourceAtLocation(node.loc.source,(0,_location.getLocation)(node.loc.source,node.loc.start)))}}catch(err){_didIteratorError=!0,_iteratorError=err}finally{try{_iteratorNormalCompletion||null==_iterator.return||_iterator.return()}finally{if(_didIteratorError)throw _it