(function(e){function t(t){for(var i,r,o=t[0],c=t[1],l=t[2],h=0,d=[];h0&&i.push("".concat(a,"=").concat(n.join(","))):"object"===Object(j["a"])(n)?i.push(e(n,a)):i.push("".concat(a,"=").concat(n)))}return i=i.filter(function(e){return!!e}),i.join("&")},w=(s("55dd"),s("6b54"),function(e,t){Object.keys(e).forEach(function(s){var i=e[s];t(s,i)})}),k=function(){function e(t,s,i,a,n){Object(v["a"])(this,e),this.schema=t,this.resource=s,this.selectedRow=null,this.json=i,this.includeHash=n,this._buildRows(a),this._buildRelationships(),this._buildHeaders(),this._buildCSS()}return Object(m["a"])(e,[{key:"formattedJSON",value:function(){var e={},t=this.rows;return this.selectedRow&&(t=[this.selectedRow]),t=t.map(function(e){var t={};return w(e.attrs,function(e,s){t[e]=s.value}),w(e.relationships,function(e,s){t[e]=s.formattedJSON().data}),t}),e.data=t,e}},{key:"_buildRows",value:function(e){var t=this;Array.isArray(e)||(e=[e]),this.rows=e.map(function(e){return t.buildRow(t.resource,e)})}},{key:"_buildHeaders",value:function(){var e=[];this.rows.length>0&&this.rows.forEach(function(t){Object.keys(t.attrs).forEach(function(t){-1===e.indexOf(t)&&e.push(t)})}),this.headers=e}},{key:"_buildCSS",value:function(){var e=this.rows.map(function(e){return e.attrs.id.value.toString().length}),t=e.sort()[e.length-1];this.css="columns-".concat(this.headers.length," id-length-").concat(t)}},{key:"_resourceAttributes",value:function(){var e=this;if(this.resource.polymorphic){var t=this.resource.attributes;return this.resource.children.forEach(function(s){var i=e.schema.getResource(s);t=Object.assign({},t,i.attributes)}),t}return this.resource.attributes}},{key:"_resourceRelationships",value:function(){var e=this;if(this.resource.polymorphic){var t=this.resource.relationships||{};return this.resource.children.forEach(function(s){var i=e.schema.getResource(s);t=Object.assign({},t,i.relationships)}),t}return this.resource.relationships}},{key:"_buildRowAttributes",value:function(e,t){var s=this,i={id:{value:t.id,type:this._resourceAttributes().id.type}};return e.polymorphic&&(i._type={value:t.type,type:"string"}),w(t.attributes,function(e,t){var a=s._resourceAttributes()[e].type,n=Object(y["a"])({},e,{value:t,type:a});Object.assign(i,n)}),i}},{key:"_buildRelationshipNode",value:function(e){var t=this.json.data;Array.isArray(t)||(t=[t]),t=t.concat(this.json.included);var s=t.filter(function(t){return t.type===e.type&&t.id===e.id})[0];return s}},{key:"_eachRelationship",value:function(e,t,s){var i=this,a=t.relationships||{};w(a,function(e,t){var a=i.includeHash[e];if(a){var n=i._resourceRelationships()[e],r=i.schema.json.resources.filter(function(e){return e.name===n.resource})[0];"polymorphic_belongs_to"===n.type&&(r={polymorphic:!0,children:n.resources});var o=t.data,c=[];o?(Array.isArray(o)||(o=[o]),o.forEach(function(e){c.push(i._buildRelationshipNode(e))}),s(e,r,c,a)):s(e,r,[])}})}},{key:"_buildRelationships",value:function(){var t=this;this.rows.forEach(function(s){s.relationships={},t._eachRelationship(s.schemaResource,s.jsonResource,function(i,a,n,r){s.relationships[i]=new e(t.schema,a,t.json,n,r)}),s.hasRelationships=Object.keys(s.relationships).length>0})}},{key:"buildRow",value:function(e,t){var s=this._buildRowAttributes(e,t),i={attrs:s,schemaResource:e,jsonResource:t};return i}}]),e}(),R=s("c1df"),q=s.n(R),C=function(){function e(t,s,i,a){Object(v["a"])(this,e),this.resource=s,this.endpoint=i,this.ready=!1,this.sorts=[{name:null,dir:"asc"}],this.filters=[{name:null,operator:"eq",error:null}],this.data={},this.headers=[],this.url=null,this.urlWithDomain=null,this.page={},this.relationships={},this.fields={},this.relationshipPath=a,this.editingRelationship=!1,this.schema=t,this.endpointIdParam=null,this.error=null,this.hasRawError=!1,this.possibleRelationships=this.derivePossibleRelationships(),this.isShowRoute()&&(this.filters=[{name:"id",operator:"eq",required:!0,error:null}])}return Object(m["a"])(e,[{key:"derivePossibleRelationships",value:function(){var e=this;if(this.resource.polymorphic){var t=Object.assign({},this.resource.relationships);return this.resource.children.forEach(function(s){var i=e.schema.getResource(s);Object.assign(t,i.relationships)}),t}return this.resource.relationships}},{key:"isShowRoute",value:function(){return this.endpoint&&this.endpoint.includes("#show")}},{key:"hasFilterValue",value:function(e){var t=this.filters.filter(function(t){return t.name===e})[0];return!(!t||!t.value)}},{key:"generateParams",value:function(){var e={};return Object.assign(e,{filter:this.filterParams()}),Object.assign(e,{sort:this.sortParams().join(",")}),Object.assign(e,{page:this.paginationParams()}),Object.assign(e,{include:this.includes().join(",")}),Object.assign(e,{fields:this.fieldParams()}),e}},{key:"generateUrl",value:function(){var e=this.generateParams(),t=this.endpoint.split("#"),s=Object(p["a"])(t,2),i=s[0],a=(s[1],_(e));return this.endpointIdParam&&(i="".concat(i,"/").concat(this.endpointIdParam)),a.length>0&&(i="".concat(i,"?").concat(a)),i}},{key:"generateCurl",value:function(){var e=this.urlWithDomain,t=e.split("?"),s=Object(p["a"])(t,2),i=s[0],a=s[1];return e=i,"undefined"!=a&&(e="".concat(e,"?").concat(a)),"curl -g -H 'Content-Type: application/json' '".concat(e,"'")}},{key:"fire",value:function(){var e=Object(f["a"])(regeneratorRuntime.mark(function e(){var t,s,i,a,n;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return this.url=this.generateUrl(),this.urlWithDomain="".concat(window.location.origin).concat(this.url),t=new Headers,t.append("pragma","no-cache"),t.append("cache-control","no-cache"),{method:"GET",headers:t},s=new Request(this.url),e.next=9,fetch(s);case 9:return e.next=11,e.sent.json();case 11:this.json=e.sent,this.ready=!0,this.hasRawError=!1,this.error=null,this.json.errors?(i=this.json.errors[0],a=i.detail,n=i.meta.__raw_error__,n&&(a=n.message,this.hasRawError=!0),this.error=a):this.data=new k(this.schema,this.resource,this.json,this.json.data,this.includeHash());case 16:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"filterParams",value:function(){var e=this,t={};return this.filters.forEach(function(s){if(s.name)if("id"===s.name&&e.isShowRoute())e.endpointIdParam=s.value;else{var i={};"datetime"===e.resource.filters[s.name].type?i[s.operator]=q()(s.value,"M/D/YYYY h:mma").toISOString():i[s.operator]=s.value;var a=s.name;e.relationshipPath&&(a="".concat(e.relationshipPath,".").concat(a)),t[a]=i}}),Object.keys(this.relationships).forEach(function(s){var i=e.relationships[s],a=i.filterParams();Object.assign(t,a)}),t}},{key:"sortParams",value:function(){var e=this,t=[];return this.sorts.forEach(function(s){if(s.name){var i=s.name;e.relationshipPath&&(i="".concat(e.relationshipPath,".").concat(i)),"desc"==s.dir&&(i="-".concat(i)),t.push(i)}}),Object.keys(this.relationships).forEach(function(s){var i=e.relationships[s];i.sortParams().forEach(function(e){t.push(e)})}),t}},{key:"paginationParams",value:function(){var e=this,t={};return Object.keys(this.page).forEach(function(s){var i=s;e.relationshipPath&&(i="".concat(e.relationshipPath,".").concat(i)),t[i]=e.page[s]}),Object.keys(this.relationships).forEach(function(s){var i=e.relationships[s];Object.assign(t,i.paginationParams())}),t}},{key:"includes",value:function(){var e=this,t=[];return Object.keys(this.relationships).forEach(function(s){var i=e.relationships[s];i.includes().forEach(function(e){t.push(e)})}),0===t.length&&t.push(this.relationshipPath),t}},{key:"includeHash",value:function(){var e={};return this.includes().forEach(function(t){if(t){var s=t.split(".").reverse(),i=Object(g["a"])(s),a=i[0],n=i.slice(1);Object.assign(e,n.reduce(function(e,t){return Object(y["a"])({},t,e)},Object(y["a"])({},a,{})))}}),e}},{key:"fieldParams",value:function(){var e=this,t={},s=Object.keys(this.fields);return s.length>0&&(t[this.resource.type]=s.join(",")),Object.keys(this.relationships).forEach(function(s){var i=e.relationships[s];Object.assign(t,i.fieldParams())}),t}}]),e}(),O=function(){var e,t=this,s=t.$createElement,i=t._self._c||s;return i("div",{staticClass:"resource-form"},[i("form",{staticClass:"config",on:{submit:function(e){e.preventDefault(),t.$emit("submit")}}},[t.isRelationship?t._e():i("button",{staticClass:"btn btn-primary",staticStyle:{display:"none"},attrs:{type:"hidden"}},[t._v("Submit")]),i("div",{staticClass:"query-inputs",class:{hide:t.query.editingRelationship}},[i("div",{staticClass:"section filters first form-group"},[i("label",[t._v("Filters")]),i("a",{staticClass:"add",on:{click:t.addFilter}},[t._v("Add +")]),i("transition-group",{attrs:{name:"form-input-section"}},t._l(t.query.filters,function(e,s){return i("div",{key:s,staticClass:"form-group filter",class:{error:e.error}},[i("div",{staticClass:"clearfix form-group"},[i("select",{directives:[{name:"model",rawName:"v-model",value:e.name,expression:"filter.name"}],staticClass:"filter-name col-8 float-left form-control",on:{change:function(s){var i=Array.prototype.filter.call(s.target.options,function(e){return e.selected}).map(function(e){var t="_value"in e?e._value:e.value;return t});t.$set(e,"name",s.target.multiple?i:i[0])}}},[i("option",{attrs:{disabled:"",value:"null"}},[t._v("Choose")]),t._l(t.query.resource.filters,function(e,s){return i("option",{key:s},[t._v("\n "+t._s(s)+"\n ")])})],2),e.name?i("select",{directives:[{name:"model",rawName:"v-model",value:e.operator,expression:"filter.operator"}],staticClass:"col-3 float-left form-control",on:{change:function(s){var i=Array.prototype.filter.call(s.target.options,function(e){return e.selected}).map(function(e){var t="_value"in e?e._value:e.value;return t});t.$set(e,"operator",s.target.multiple?i:i[0])}}},t._l(t.query.resource.filters[e.name].operators,function(e){return i("option",{key:e},[t._v("\n "+t._s(e)+"\n ")])})):i("select",{staticClass:"col-3 float-left form-control"},[i("option",{attrs:{selected:"",disabled:""}},[t._v("eq")])])]),i("div",{staticClass:"clearfix"},[e.name&&"boolean"===t.query.resource.filters[e.name].type?i("div",{staticClass:"boolean-toggle"},[i("input",{directives:[{name:"model",rawName:"v-model",value:e.value,expression:"filter.value"}],staticClass:"ios-toggle",attrs:{type:"checkbox",name:e.name,id:e.name},domProps:{checked:Array.isArray(e.value)?t._i(e.value,null)>-1:e.value},on:{change:function(s){var i=e.value,a=s.target,n=!!a.checked;if(Array.isArray(i)){var r=null,o=t._i(i,r);a.checked?o<0&&t.$set(e,"value",i.concat([r])):o>-1&&t.$set(e,"value",i.slice(0,o).concat(i.slice(o+1)))}else t.$set(e,"value",n)}}}),i("label",{staticClass:"checkbox-label",attrs:{for:e.name,"data-off":"off","data-on":"on"}})]):e.name&&t.query.resource.filters[e.name].allow?i("div",[i("select",{directives:[{name:"model",rawName:"v-model",value:e.value,expression:"filter.value"}],staticClass:"filter-value form-control col-10 float-left",on:{change:function(s){var i=Array.prototype.filter.call(s.target.options,function(e){return e.selected}).map(function(e){var t="_value"in e?e._value:e.value;return t});t.$set(e,"value",s.target.multiple?i:i[0])}}},[i("option",{attrs:{disabled:"",value:"undefined"}},[t._v("Choose")]),t._l(t.query.resource.filters[e.name].allow,function(e){return i("option",{key:e},[t._v("\n "+t._s(e)+"\n ")])})],2)]):e.name&&"date"===t.query.resource.filters[e.name].type?i("div",[i("input",{directives:[{name:"model",rawName:"v-model",value:e.value,expression:"filter.value"}],staticClass:"filter-value float-left col-10 form-control",attrs:{type:"text",placeholder:"M/D/YYYY"},domProps:{value:e.value},on:{input:function(s){s.target.composing||t.$set(e,"value",s.target.value)}}})]):e.name&&"datetime"===t.query.resource.filters[e.name].type?i("div",[i("input",{directives:[{name:"model",rawName:"v-model",value:e.value,expression:"filter.value"}],staticClass:"filter-value float-left col-10 form-control",attrs:{type:"text",placeholder:"M/D/YYYY h:mma"},domProps:{value:e.value},on:{input:function(s){s.target.composing||t.$set(e,"value",s.target.value)}}})]):i("div",[i("input",{directives:[{name:"model",rawName:"v-model",value:e.value,expression:"filter.value"}],staticClass:"filter-value float-left col-10 form-control",attrs:{type:"text",placeholder:"Enter Filter Value Here"},domProps:{value:e.value},on:{input:function(s){s.target.composing||t.$set(e,"value",s.target.value)}}})]),i("a",{staticClass:"remove col-1",on:{click:function(s){t.removeFilter(e)}}},[t._v("x")])]),e.required?i("div",{staticClass:"required-filter text-muted"},[t._v("\n Required\n ")]):t._e()])}))],1),i("div",{staticClass:"section sorts form-group"},[i("label",[t._v("Sorts")]),i("a",{staticClass:"add",on:{click:t.addSort}},[t._v("Add +")]),i("transition-group",{attrs:{name:"form-input-section"}},t._l(t.query.sorts,function(e,s){return i("div",{key:s,staticClass:"form-group clearfix"},[i("select",{directives:[{name:"model",rawName:"v-model",value:e.name,expression:"sort.name"}],staticClass:"filter-name col-7 float-left form-control",on:{change:function(s){var i=Array.prototype.filter.call(s.target.options,function(e){return e.selected}).map(function(e){var t="_value"in e?e._value:e.value;return t});t.$set(e,"name",s.target.multiple?i:i[0])}}},[i("option",{attrs:{disabled:"",value:"null"}},[t._v("Choose")]),t._l(t.query.resource.sorts,function(e,s){return i("option",{key:s},[t._v("\n "+t._s(s)+"\n ")])})],2),i("select",{directives:[{name:"model",rawName:"v-model",value:e.dir,expression:"sort.dir"}],staticClass:"col-3 float-left form-control",on:{change:function(s){var i=Array.prototype.filter.call(s.target.options,function(e){return e.selected}).map(function(e){var t="_value"in e?e._value:e.value;return t});t.$set(e,"dir",s.target.multiple?i:i[0])}}},[i("option",{attrs:{selected:""}},[t._v("asc")]),i("option",[t._v("desc")])]),i("a",{staticClass:"remove col-1",on:{click:function(s){t.removeSort(e)}}},[t._v("x")])])}))],1),i("div",{staticClass:"section form-pagination form-group"},[i("label",[t._v("Pagination")]),t.isShowAction||!t.isRelationship?i("div",{staticClass:"form-group clearfix"},[i("input",{directives:[{name:"model",rawName:"v-model",value:t.query.page.number,expression:"query.page.number"}],staticClass:"col-5 float-left form-control",attrs:{type:"number",placeholder:"Number"},domProps:{value:t.query.page.number},on:{input:function(e){e.target.composing||t.$set(t.query.page,"number",e.target.value)}}}),i("input",{directives:[{name:"model",rawName:"v-model",value:t.query.page.size,expression:"query.page.size"}],staticClass:"col-5 float-left size form-control",attrs:{type:"number",placeholder:"Size"},domProps:{value:t.query.page.size},on:{input:function(e){e.target.composing||t.$set(t.query.page,"size",e.target.value)}}}),i("a",{staticClass:"remove col-1",on:{click:function(e){t.removePagination()}}},[t._v("x")])]):i("div",{staticClass:"form-group clearfix text-muted"},[t._v("\n Only #show supports nested pagination\n ")])])]),i("div",{staticClass:"relationships section form-group",class:(e={"editing-subrelationship":t.query.editingRelationship,nested:t.query.editingRelationship&&t.isRelationship,"active-subrelationship":t.isActiveSubrelationship,"inactive-subrelationship":!t.isActiveSubrelationship},e["depth-"+t.depth]=!0,e)},[t.query.editingRelationship&&t.isRelationship?t._e():i("label",[t._v("Relationships")]),t._l(t.query.possibleRelationships,function(e,s){return i("div",{key:s,staticClass:"relationship clearfix",class:(a={selected:t.query.relationships[s],hide:t.query.editingRelationship&&t.query.editingRelationship!=t.query.relationships[s]},a["depth-"+t.depth]=!0,a)},[i("a",{staticClass:"toggle clearfix",on:{click:function(i){t.toggleRelationship(s,e)}}},[i("div",{staticClass:"float-left name"},[t._v(t._s(s))]),t.isActiveSubrelationship?i("span",[t.query.relationships[s]?i("div",{staticClass:"badge badge-pill badge-info"},[t._v("✓")]):t._e()]):t._e()]),t.query.relationships[s]?i("a",{staticClass:"remove-field",on:{click:function(e){t.removeRelationship(s)}}},[t._v("Remove")]):t._e()]);var a})],2),t._l(t.query.relationships,function(e,s){return i("div",{key:s},[t.query.relationships[s]?i("div",{class:{hidden:t.query.editingRelationship!=t.query.relationships[s]}},[i("resource-form",{attrs:{query:t.query.relationships[s],schema:t.schema,"is-relationship":!0,isShowAction:t.isShowAction,depth:t.depth+1},on:{editRelationship:t.onSubrelationshipEdit,doneEditRelationship:t.onSubrelationshipDoneEdit}})],1):t._e()])}),i("div",{staticClass:"fields section form-group",class:{hide:t.query.editingRelationship}},[i("label",[t._v("Fields")]),t._l(t.query.resource.attributes,function(e,s){return e.readable&&"id"!=s?i("div",{key:s,staticClass:"field clearfix",class:{selected:t.query.fields[s]}},[i("a",{staticClass:"toggle clearfix",on:{click:function(i){t.toggleField(s,e)}}},[i("span",{staticClass:"name"},[t._v(t._s(s))]),t.query.fields[s]?i("span",{staticClass:"badge badge-pill badge-info"},[t._v("✓")]):t._e()])]):t._e()})],2)],2)])},x=[],S=i["a"].extend({name:"resource-form",props:["query","isShowAction","isRelationship","schema","depth"],data:function(){return{subRelationshipNames:[],isActiveSubrelationship:!1}},created:function(){},computed:{},methods:{addFilter:function(){this.query.filters.push({name:null,operator:"eq",error:null})},removeFilter:function(e){if(e.required)e.value=null;else{var t=this.query.filters.indexOf(e);this.query.filters.splice(t,1),this.query.filters.length<1&&this.addFilter()}},addSort:function(){this.query.sorts.push({name:null,dir:"asc",delete:!1})},removeSort:function(e){var t=this.query.sorts.indexOf(e);this.query.sorts.splice(t,1),0===this.query.sorts.length&&this.addSort()},removePagination:function(){this.query.page={number:null,size:null}},selectRelationship:function(e,t){var s=this,i=this.schema.getResource(t.resource);if("polymorphic_belongs_to"===t.type){var a={};t.resources.forEach(function(e){var t=s.schema.getResource(e);Object.assign(a,t.relationships)}),i={polymorphic:!0,children:t.resources,relationships:a}}var n=e;this.query.relationshipPath&&(n="".concat(this.query.relationshipPath,".").concat(e));var r=new C(this.schema,i,null,n);this.$set(this.query.relationships,e,r)},removeRelationship:function(e){this.$delete(this.query.relationships,e),this.doneEditingRelationship(e)},toggleRelationship:function(e,t){this.query.editingRelationship?this.doneEditingRelationship(e):this.query.relationships[e]?this.editRelationship(e,this.query.relationships[e]):this.selectRelationship(e,t)},editRelationship:function(e,t){this.$emit("editRelationship",e),this.query.editingRelationship=t,this.isActiveSubrelationship=!0},doneEditingRelationship:function(e){this.query.editingRelationship=!1,this.isActiveSubrelationship=!1,this.$emit("doneEditRelationship",e)},toggleField:function(e){this.query.fields[e]?this.$delete(this.query.fields,e):this.$set(this.query.fields,e,!0)},onSubrelationshipEdit:function(e){this.isActiveSubrelationship=!1},onSubrelationshipDoneEdit:function(e){this.isActiveSubrelationship=!0}}}),E=S,A=(s("fd6a"),Object(r["a"])(E,O,x,!1,null,"c7fe1220",null));A.options.__file="ResourceForm.vue";var P=A.exports,T=function(){var e,t=this,s=t.$createElement,i=t._self._c||s;return i("div",{staticClass:"data-table",class:{inactive:!t.active}},[i("div",{staticClass:"contents"},[t.label?i("div",{staticClass:"relationship-label"},[i("span",{staticClass:"arrow"},[t._v("↳")]),t._v(" "+t._s(t.label)+"\n ")]):t._e(),t.object.rows.length>0?i("div",{staticClass:"clearfix view-as-json"},[i("a",{on:{click:function(e){t.jsonView(t.object)}}},[t._v("View as JSON")])]):t._e(),t.object.rows.length>0?i("div",{staticClass:"table-wrapper"},[i("table",{staticClass:"results table table-hover table-borderless",class:(e={"has-selection":t.object.selectedRow,"is-sub-table":t.isSubTable},e[t.object.css]=!0,e)},[i("thead",[i("tr",t._l(t.object.headers,function(e){return i("th",{key:e},[t._v("\n "+t._s(e)+"\n ")])}))]),i("tbody",t._l(t.object.rows,function(e){return i("tr",{key:e.attrs.id.value,staticClass:"data-row",class:{selected:t.object.selectedRow===e,"has-relationships":e.hasRelationships},on:{click:function(s){t.toggleRow(e)}}},t._l(e.attrs,function(e,s){return i("td",{key:s,class:(a={},a["type-"+e.type]=!0,a)},[i("div",{staticClass:"td-contents"},["datetime"==e.type?i("div",[t._v("\n "+t._s(t._f("dateTimeType")(e.value))+"\n ")]):"date"==e.type?i("div",[t._v("\n "+t._s(t._f("dateType")(e.value))+"\n ")]):i("div",[t._v("\n "+t._s(e.value)+"\n ")])])]);var a}))}))])]):i("div",{staticClass:"card"},[t._v("\n No Data\n ")]),i("transition",{attrs:{name:"relationship-table"}},[0===t.depth&&t.isShowAction||t.object.selectedRow?i("span",t._l(t.relationships,function(e,s){return i("data-table",{key:s,attrs:{label:s,object:e,isSubTable:!0,depth:t.depth+1,isShowAction:t.isShowAction},on:{rowClick:t.onSubRowClick}})})):t._e()])],1)])},$=[],z=new i["a"],N=z,D=i["a"].extend({name:"data-table",props:["object","depth","label","isShowAction","isSubTable"],data:function(){return{active:!0}},computed:{relationships:function(){return this.isShowAction&&0===this.depth?this.object.rows[0].relationships:this.object.selectedRow.relationships}},methods:{jsonView:function(e){N.$emit("modalToggle",e.formattedJSON())},toggleRow:function(e){this.object.selectedRow?this.object.selectedRow=null:(this.active=!0,this.object.selectedRow=e)},onSubRowClick:function(e){this.active=!e}}}),Y=D,F=(s("9e92"),Object(r["a"])(Y,T,$,!1,null,"2f86ad40",null));F.options.__file="DataTable.vue";var M=F.exports,H=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"endpoints",class:{"has-selection":e.selection}},[s("input",{directives:[{name:"model",rawName:"v-model",value:e.query,expression:"query"}],staticClass:"form-control search",attrs:{type:"search",placeholder:"Search"},domProps:{value:e.query},on:{input:function(t){t.target.composing||(e.query=t.target.value)}}}),e._l(e.filteredEndpoints,function(t){return s("a",{key:t,staticClass:"endpoint",class:{selected:e.selection===t}},[s("div",{staticClass:"path",on:{click:function(s){e.toggle(t)}}},[e.selection===t?s("span",[e._v("« ")]):e._e(),e._v("\n "+e._s(e._f("endpointDisplay")(t))+"\n ")]),e.selection===t?s("span",[e._t("default")],2):e._e()])})],2)},I=[],U=i["a"].extend({name:"endpoint-list",props:["endpoints"],data:function(){return{selection:null,query:null}},filters:{endpointDisplay:function(e){var t=e.split("/");return t[t.length-1]}},computed:{filteredEndpoints:function(){var e=this,t=this.endpoints.filter(function(e){return e.includes("#index")||e.includes("#show")});return this.query?t.filter(function(t){return t.includes(e.query)}):t}},methods:{toggle:function(e){this.selection?this.selection=null:this.selection=e,this.$emit("toggle",this.selection)}}}),L=U,J=(s("3956"),Object(r["a"])(L,H,I,!1,null,"a79b1f96",null));J.options.__file="EndpointList.vue";var V=J.exports,W=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"url-bar"},[e.query&&e.query.endpoint?s("form",{staticClass:"query clearfix"},[s("input",{attrs:{id:"copy-url",type:"hidden"},domProps:{value:e.schema.json.base_url+e.query.url}}),s("input",{directives:[{name:"model",rawName:"v-model",value:e.query.url,expression:"query.url"}],staticClass:"form-control url",class:{firing:e.firing},attrs:{type:"text",placeholder:"URL"},domProps:{value:e.query.url},on:{input:[function(t){t.target.composing||e.$set(e.query,"url",t.target.value)},e.buildQueryObject]}}),s("div",{staticClass:"btn-group url-controls"},[s("a",{staticClass:"btn btn-secondary",attrs:{title:"Copy"},on:{click:function(t){e.copyUrl()}}},[s("i",{staticClass:"fas fa-copy"})]),s("a",{staticClass:"btn btn-secondary",attrs:{href:e.query.urlWithDomain,target:"_blank",title:"Open in new tab"}},[s("i",{staticClass:"fas fa-external-link-alt"})]),s("a",{staticClass:"btn btn-secondary",attrs:{title:"Copy as Curl"},on:{click:function(t){e.copyAsCurl()}}},[s("i",{staticClass:"fas fa-copyright"})])])]):e._e()])},G=[],B=function(e){},Q=i["a"].extend({name:"url-bar",props:["schema","query","firing"],data:function(){return{}},computed:{},methods:{copyUrl:function(){navigator["clipboard"].writeText(this.query.urlWithDomain)},copyAsCurl:function(){navigator["clipboard"].writeText(this.query.generateCurl())},buildQueryObject:function(){B(this.query)}}}),K=Q,X=(s("64c3"),Object(r["a"])(K,W,G,!1,null,"79f5869a",null));X.options.__file="UrlBar.vue";var Z=X.exports,ee=[{name:"results"},{name:"raw"},{name:"debug"}],te=i["a"].extend({name:"vandal",components:{EndpointList:V,DataTable:M,ResourceForm:P,UrlBar:Z},data:function(){return{schema:null,query:null,currentTab:ee[0],creating:!0,isLoading:!1,path:null,resource:null,modalIsOpen:!1,modalContent:null,firing:!1,resetting:!1}},created:function(){var e=this;this.fetchSchema();var t=function(){e.creating=!1};setTimeout(t,1e3),N.$on("modalToggle",this.onModalToggle)},computed:{isShowAction:function(){if(this.query)return this.query.endpoint.includes("#show")}},methods:{onModalToggle:function(e){this.modalContent=e,this.modalIsOpen=!this.modalIsOpen},toggleEndpoint:function(e){e?(this.resource=this.schema.resourceFor(e),this.reset(e,!1)):(this.resource=null,this.query=null)},fetchSchema:function(){var e=Object(f["a"])(regeneratorRuntime.mark(function e(){var t,s,i,a;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return t=new Headers,t.append("pragma","no-cache"),t.append("cache-control","no-cache"),{method:"GET",headers:t},s=document.querySelector("meta[name='schema']").getAttribute("content"),i=new Request(s),e.next=8,fetch(i);case 8:return e.next=10,e.sent.json();case 10:return a=e.sent,this.schema=new b(a),this.schema._processRemoteResources(),e.abrupt("return",this.schema);case 14:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}(),reset:function(e){var t=this,s=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];s&&(this.resetting=!0),this.query=new C(this.schema,this.resource,e);var i=function(){t.resetting=!1};s&&setTimeout(i,100)},fetch:function(){var e=Object(f["a"])(regeneratorRuntime.mark(function e(){var t,s,i,a=this;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:if(!this.validate()){e.next=12;break}return this.firing=!0,t=function(){a.firing=!1},setTimeout(t,100),this.isLoading=!0,s=Date.now(),e.next=8,this.query.fire();case 8:return i=Date.now(),e.next=11,this.stall(100-(i-s));case 11:this.isLoading=!1;case 12:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}(),validate:function(){if(this.isShowAction){var e=this.query.filters.filter(function(e){return"id"===e.name})[0];return e.value?(e.error=!1,!0):(this["tempSet"](e,"error",!0,1e3),!1)}return!0},tab:function(e){this.currentTab=ee[e]},stall:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3e3;return new Promise(function(t){return setTimeout(t,e)})}}}),se=te,ie=(s("73b3"),Object(r["a"])(se,h,d,!1,null,null,null));ie.options.__file="All.vue";var ae=ie.exports;i["a"].use(u["a"]);var ne=new u["a"]({base:"",routes:[{path:"/",name:"vandal",component:ae}]}),re=s("998c");i["a"].use(re),i["a"].config.productionTip=!1,i["a"].mixin({methods:{tempSet:function(e,t,s,i){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,n=e[t];null!==a&&(n=a),e[t]=s;var r=function(){e[t]=n};setTimeout(r,i)}}}),i["a"].filter("dateTimeType",function(e){if(e)return q()(String(e)).format("M/D/YYYY h:mma")}),i["a"].filter("dateType",function(e){if(e)return q()(String(e)).format("M/D/YYYY")}),new i["a"]({router:ne,render:function(e){return e(l)}}).$mount("#app")},fd6a:function(e,t,s){"use strict";var i=s("0bab"),a=s.n(i);a.a}}); //# sourceMappingURL=app.d38ac258.js.map