Skip to content

Instantly share code, notes, and snippets.

@gistlyn gistlyn/_init.ss
Last active May 24, 2020

Embed
What would you like to do?
Studio
{{
var AppSvgs = {
'action/home.svg': 'home',
'action/bug_report.svg': 'debug',
'hardware/cast.svg': 'connect',
'hardware/security.svg': 'auth',
'toggle/check_box.svg': 'check_box_on',
'toggle/check_box_outline_blank.svg': 'check_box_off',
'navigation/double_arrow.svg': 'play',
'navigation/first_page.svg': 'chevron-first',
'navigation/last_page.svg': 'chevron-last',
'navigation/expand_more.svg': 'chevron-down',
'navigation/chevron_left.svg': 'chevron-left',
'navigation/chevron_right.svg': 'chevron-right',
'navigation/expand_less.svg': 'chevron-up',
'navigation/close.svg': 'close',
'action/find_in_page.svg': 'db',
'action/delete.svg': 'delete',
'action/dns.svg': 'dns',
'action/done.svg': 'done',
'action/help_outline.svg': 'help',
'action/history.svg': 'history',
'image/edit.svg': 'update',
'content/add.svg': 'create',
'content/remove.svg': 'remove',
'content/remove_circle.svg': 'remove_circle',
'content/save_alt.svg': 'save',
'content/block.svg': 'block',
'content/content_copy.svg': 'copy',
'content/clear.svg': 'clear',
'content/filter_list.svg': 'filter',
}
}}
```code
#each AppSvgs
`/lib/svg/material/${it.Key}` |> svgAddFile(it.Value,'app')
/each
```
{{#svg fields app}}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="black" width="48px" height="48px">
<path d="M0 0h24v24H0V0z" fill="none"/>
<path d="M4 5v13h17V5H4zm10 2v9h-3V7h3zM6 7h3v9H6V7zm13 9h-3V7h3v9z" fill="#ffffff"/>
</svg>
{{/svg}}
{{#svg lock app}}
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
<g fill="none">
<path d="M0 0h24v24H0V0z"/>
<path d="M0 0h24v24H0V0z" opacity=".87"/>
</g>
<path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zM9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9V6zm9 14H6V10h12v10zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z" fill="#ffffff"/>
</svg>
{{/svg}}
{{#svg external-link app}}
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>
<polyline points="15 3 21 3 21 9"/>
<line x1="10" y1="14" x2="21" y2="3"/>
</svg>
{{/svg}}
{{#svg loading app}}
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
x="0px" y="0px" width="24px" height="30px" viewBox="0 0 24 30" style="enable-background:new 0 0 50 50" xml:space="preserve">
<rect x="0" y="10" width="4" height="10" fill="#333" opacity="0.2">
<animate attributeName="opacity" attributeType="XML" values="0.2; 1; .2" begin="0s" dur="0.6s" repeatCount="indefinite" />
<animate attributeName="height" attributeType="XML" values="10; 20; 10" begin="0s" dur="0.6s" repeatCount="indefinite" />
<animate attributeName="y" attributeType="XML" values="10; 5; 10" begin="0s" dur="0.6s" repeatCount="indefinite" />
</rect>
<rect x="8" y="10" width="4" height="10" fill="#333" opacity="0.2">
<animate attributeName="opacity" attributeType="XML" values="0.2; 1; .2" begin="0.15s" dur="0.6s" repeatCount="indefinite" />
<animate attributeName="height" attributeType="XML" values="10; 20; 10" begin="0.15s" dur="0.6s" repeatCount="indefinite" />
<animate attributeName="y" attributeType="XML" values="10; 5; 10" begin="0.15s" dur="0.6s" repeatCount="indefinite" />
</rect>
<rect x="16" y="10" width="4" height="10" fill="#333" opacity="0.2">
<animate attributeName="opacity" attributeType="XML" values="0.2; 1; .2" begin="0.3s" dur="0.6s" repeatCount="indefinite" />
<animate attributeName="height" attributeType="XML" values="10; 20; 10" begin="0.3s" dur="0.6s" repeatCount="indefinite" />
<animate attributeName="y" attributeType="XML" values="10; 5; 10" begin="0.3s" dur="0.6s" repeatCount="indefinite" />
</rect>
</svg>
{{/svg}}
{{#svg logo app}}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#ffffff" width="48px" height="48px">
<path d="M18 4l2 4h-3l-2-4h-2l2 4h-3l-2-4H8l2 4H7L5 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4h-4z"/>
<path d="M0 0h24v24H0z" fill="none"/>
</svg>
{{/svg}}
{{#svg excel app}}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48px" height="48px">
<path fill="#4CAF50" d="M41,10H25v28h16c0.553,0,1-0.447,1-1V11C42,10.447,41.553,10,41,10z"/>
<path fill="#FFF" d="M32 15H39V18H32zM32 25H39V28H32zM32 30H39V33H32zM32 20H39V23H32zM25 15H30V18H25zM25 25H30V28H25zM25 30H30V33H25zM25 20H30V23H25z"/>
<path fill="#2E7D32" d="M27 42L6 38 6 10 27 6z"/>
<path fill="#FFF" d="M19.129,31l-2.411-4.561c-0.092-0.171-0.186-0.483-0.284-0.938h-0.037c-0.046,0.215-0.154,0.541-0.324,0.979L13.652,31H9.895l4.462-7.001L10.274,17h3.837l2.001,4.196c0.156,0.331,0.296,0.725,0.42,1.179h0.04c0.078-0.271,0.224-0.68,0.439-1.22L19.237,17h3.515l-4.199,6.939l4.316,7.059h-3.74V31z"/>
</svg>
{{/svg}}
{{htmlError}}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link href="/metadata/svg/servicestack.svg?fill=%23000" rel="icon">
<link rel="stylesheet" href="/lib/css/bootstrap/bootstrap.css">
<title>{{ title ?? 'Studio' }}</title>
</head>
<body>
{{ 'buttons' |> cssIncludes }}
{{ 'svg-auth,app' |> cssIncludes |> svgFill('#212529') }}
{{#if fileExists('/bundle.css') }}
<link rel="stylesheet" href="/bundle.css">
{{else}}
{{ 'content:/src/css/' |> bundleCss({ minify:false, cache:false, out:'/app.bundle.css' }) }}
{{/if}}
<style>
{{ {
'.home-link': ['home','#4183B8'],
'.first-link': ['chevron-first','#4183B8'],
'.left-link': ['chevron-left','#4183B8'],
'.right-link': ['chevron-right','#4183B8'],
'.last-link': ['chevron-last','#4183B8'],
'.db-link': ['db','#4183B8'],
'.lock-link': ['lock','#4183B8'],
'.save-link': ['save','#4183B8'],
'.help-muted': ['help','#999'],
'.history-muted': ['history','#999'],
'.bool-off-muted': ['check_box_off','#999'],
'.bool-on-muted': ['check_box_on','#999'],
'.db-dark': ['db','#6c757d'],
'.lock-dark': ['lock','#6c757d'],
'.auth-warning': ['auth','#ffc107'],
'.done-success': ['done','#28a745'],
'.block-danger': ['block','#dc3545'],
} |> toList |> map => `${it.Key} { ${it.Value[0].svgBackgroundImageCss(it.Value[1])} }` |> joinln |> raw }}
.text-close::after { content:'\00D7'; }
</style>
<i hidden>{{ '/js/hot-fileloader.js' |> ifDebugIncludeScript }}</i>
<script>
CONFIG = {
debug: {{ debugMode |> json }},
desktop: {{ desktopInfo |> json }},
hasExcel:{{ (isWin ? typeofProgId('Excel.Application') != null : false) |> json }},
connect: {{ connect |> json }},
nav: {{ 'GetNavItems' |> execService |> json }},
auth: {{ 'Authenticate' |> execService({ ifErrorReturn: "null" }) |> json }}
}
</script>
<noscript>You need to enable JavaScript to run this app.</noscript>
{{page}}
{{ [
`/lib/js/vue/vue.min.js`,
`/lib/js/vue-router/vue-router.min.js`,
`/lib/js/vue-class-component/vue-class-component.min.js`,
`/lib/js/vue-property-decorator/vue-property-decorator.min.js`,
`/lib/js/@servicestack/desktop/servicestack-desktop.min.js`,
`/lib/js/@servicestack/client/servicestack-client.min.js`,
`/lib/js/@servicestack/vue/servicestack-vue.min.js`,
] |> map => `<script src="${it}"></script>` |> joinln |> raw }}
<script>
var ALIASES = {
'vue': { default: Vue },
'vue-router': { default: VueRouter },
'vue-class-component': VueClassComponent,
'vue-property-decorator': VuePropertyDecorator,
'@servicestack/vue': ServiceStackVue
};
var global = window;
window.exports = {};
window.require = function(name) {
return ALIASES[name] || exports[name] || window[name] || exports;
};
Object.assign(window, window["@servicestack/desktop"], window["@servicestack/client"]);
</script>
{{#if fileExists('/bundle.js') }}
<script src="/bundle.js"></script>
{{else}}
{{ [
'content:/src/components/',
'content:/src/shared/',
'content:/src/',
] |> bundleJs({ minify:false, cache:false, iife:true, out:`/app.bundle.js` }) }}
{{/if}}
{{ scripts |> raw }}
{{initError |> htmlError}}
{{htmlError}}
</body>
</html>
name Studio
port 5002
debug false
CefConfig {}
appName studio
description Admin UI for managing ServiceStack Instances (v5.9+)
tags servicestack
publish https://gist.github.com/gistlyn/d8e7a56027ed6ec3060d9a9896931909
.grid-layout{display:grid;width:100vw;height:100vh;grid-column-gap:5px;grid-template-columns:300px 4fr 1fr;grid-template-rows:80px auto 20%;grid-template-areas:"head head head" "nav main main" "nav foot foot"}.grid-layout.collapse-footer{grid-template-areas:"head head head" "nav main main" "nav main main"}.grid-layout.collapse-footer #footer{display:none}header{background:#fff;grid-area:head;display:grid;grid-template-columns:auto auto;grid-template-areas:"breadcrumb auth"}#auth{padding:5px 5px 0 0;text-align:right}.site-breadcrumbs{padding-left:0;height:80px}nav{background:#fff;grid-area:nav;padding:0 2px 0 10px;overflow-x:hidden;overflow-y:auto;display:grid;grid-template-rows:40px auto;grid-template-areas:"filter" "sidebar"}#nav-filter{grid-area:filter;margin:2px 0 0 0}#sidebar{grid-area:sidebar;overflow-x:hidden;overflow-y:scroll}main{background:#fff;grid-area:main;padding:2px;grid-row-gap:5px;overflow:auto;display:grid;grid-template-rows:40px auto;grid-template-areas:"query" "results"}#validation main{grid-template-areas:"results" "results"}.query-form{grid-area:query}.main-container{grid-area:results;overflow-y:scroll}footer{grid-column:foot;overflow-x:hidden;overflow-y:scroll}#footer{border:1px solid #eee}.collapse-footer #footer .text-close{display:none}
::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-thumb{background-color:#f1f1f1}.navbar{border-radius:0;background:#4183b8 !important}a{color:#4183b8}a:hover{text-decoration:none}.sq-xs{width:12px;height:12px}.sq-sm{width:14px;height:14px}.sq-md{width:18px;height:18px}.sq-lg{width:24px;height:24px}.sq-2x{width:32px;height:32px}.sq-3x{width:48px;height:48px}.sq-4x{width:64px;height:64px}.sq-5x{width:80px;height:80px}.sq-6x{width:96px;height:96px}.sq-7x{width:112px;height:112px}.sq-8x{width:128px;height:128px}.sq-9x{width:144px;height:144px}.sq-10x{width:160px;height:160px}.sq-11x{width:180px;height:180px}.sq-12x{width:204px;height:204px}.sq-13x{width:232px;height:232px}.sq-14x{width:264px;height:264px}.form-check.form-control{padding-left:1.75rem;height:auto}span.nav-link{cursor:pointer}.fade-in{animation:fadein 2s;-moz-animation:fadein 2s;-webkit-animation:fadein 2s;-o-animation:fadein 2s}.fadein-5s{animation:fadein 5s;-moz-animation:fadein 5s;-webkit-animation:fadein 5s;-o-animation:fadein 5s}@keyframes fadein{from{opacity:0}to{opacity:1}}@-moz-keyframes fadein{from{opacity:0}to{opacity:1}}@-webkit-keyframes fadein{from{opacity:0}to{opacity:1}}@-o-keyframes fadein{from{opacity:0;}to{opacity:1;}}#debug-links{position:absolute;bottom:1em;right:1em}#desktop input[type=number]{width:100px}#sig{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;width:100%;text-align:center;color:#7f8c8d;font-size:.85rem;z-index:1}.result{margin:10px;color:#349268}.site small{color:#999}.site .actions{padding-left:1em}.stacktrace{background:#f1f1f1;padding:1em;margin:1em 0 .5em 0;border-radius:5px;border:1px solid #ccc;white-space:pre-wrap}#authModal{width:760px;height:670px;top:250px;left:50%;margin-left:-350px}#authModal .modal-dialog{max-width:700px;max-height:600px}#authModal .modal-body{padding:0}#authModal iframe{width:700px;height:600px;border:none}#eventsModal{right:10px}.custom-select{min-width:130px}.nav-query .nav-link{padding:.4rem 1rem;cursor:pointer}.nav-query .nav-link:hover{color:rgba(255,255,255,.8) !important}.site-breadcrumbs .breadcrumb{background:none}.site-breadcrumbs .breadcrumb-item+.breadcrumb-item::before{color:#ddd}.results-none{color:#6c757d}table.results{border:1px solid #eee;background:#fefefe}table.results thead tr{background:#eee}table.results th{text-align:left;color:#757575;font-size:13px;line-height:18px;border-bottom:1px solid #e0e0e0;padding:5px;overflow:hidden;white-space:nowrap}table.results td{color:#212121;font-size:12px;padding:5px;max-width:300px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}th .modal-content,td .modal-content{font-size:1rem}table.results .filters td{padding:0 1px;margin:0}.filters input{min-width:50px;width:100%;font-size:11px}.noselect{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.auth{color:#aaa;pointer-events:none;background-size:22px 22px;background-position:center right;background-repeat:no-repeat;display:block}.lnk-help{width:20px;height:20px;float:right;margin:-1em .25em 0 0;background-size:18px 18px;background-position:center right;background-repeat:no-repeat;display:block}.has-auth .auth a{pointer-events:auto;color:#4183b8}.svg-btn,.btn-link,.th-link{cursor:pointer;user-select:none}.btn-link{text-decoration:none}.results td{background:#f9f9f9}td.partial{border:1px dashed #ccc;background:#fff;cursor:default}table.results td.editing{background:#fff3cd;padding:0}.modal-mini .close{margin-top:-10px;margin-left:-5px}.modal-inline{display:block;position:absolute}.modal-inline .modal-dialog{min-width:500px;margin:-12px 0 0 -31px;white-space:normal}.results tr.selected td{background:#ffffe0}.results tr.selected td.selected{background:#6495ed;color:#fff}.modal-dialog{color:#212121;text-align:left}::placeholder{color:#aaa !important}.disabled.md{font-size:1rem}.disabled.lg{font-size:1.25rem}.confirm-delete{position:absolute}.confirm-delete .form-check-input{margin:10px 0 0 -10px}.confirm-delete .form-check-label{font-size:1rem;margin:0 .5em;user-select:none;cursor:pointer}#sidebar .selected{font-weight:bold}.close,.text-close{user-select:none}.text-close{cursor:pointer;font-size:1.5em;color:#999}.text-close:hover{color:#666}#footer .text-close{position:fixed;right:10px;margin:-10px 0 0 0}#output-group{position:absolute;right:0;bottom:0;background:#fff}#output-group .btn{border-radius:0}.log-entry,.log-entry h4,.log-entry dl{font-size:13px;line-height:22px}.log-entry{padding:5px 20px 5px 5px}.log-entry h4,.log-entry dl,.log-entry dt,.log-entry dd,dl.h-kvp,ul.event{margin:0;padding:0}.log-entry i{font-style:normal}.log-entry h4 i{display:inline-block;background:#f1f1f1;width:60px;padding:0 5px;border:1px solid #f1f1f1}.log-entry h4 b{display:inline-block;padding:0 10px;border:1px solid #f1f1f1}.log-entry .body{border:1px solid #f1f1f1;padding:0 0 4px 0;margin:-2px 0 0 0}dl.v-kvp{vertical-align:top;border:1px solid #f1f1f1;display:inline-block;margin:4px 0 0 4px}dl.v-kvp>dt{border-bottom:1px solid #f1f1f1;font-weight:normal;background:#f1f1f1}dl.v-kvp>dt,dl.v-kvp>dd{padding:1px 4px;max-width:400px;overflow:hidden;text-overflow:ellipsis}dl.v-kvp.log-response,dl.v-kvp.log-response>dt,dl.v-kvp.log-response>dd,dl.v-kvp.log-response .jsonviewer dd{max-width:none}dl.v-kvp.log-response>dt{cursor:pointer;user-select:none}dl.h-kvp{border:1px solid #f8f9fa;display:inline-block;height:31px}dl.h-kvp>dt,dl.h-kvp>dd{margin:0;padding:.25em .5em;line-height:22px;display:inline-block;max-width:400px;overflow:hidden;text-overflow:ellipsis}dl.h-kvp>dt{border-right:1px solid #f8f9fa;background:#f8f9fa}.rule dl{min-width:300px}.rule dl>dt{min-width:83px}.rule button{vertical-align:top}ul.event,ul.event li{display:inline-block}li.by span,li.on span{padding-left:.5em}li.by b,li.on b{padding-left:.25em}li.on b{font-weight:normal}li.by b i,li.on b i{font-weight:normal;color:#aaa;font-style:normal}.event-line{white-space:nowrap;overflow-x:hidden}.event.summary{cursor:pointer}.event.summary b{font-weight:normal}.event.summary li.on b{font-weight:normal;color:#aaa}.event-detail{margin:0 0 5px 22px}.event .type{min-width:56px}.event .ip{border:1px solid #f1f1f1;padding:0 5px 0 0;margin:2px 0 0 5px}.event .ip span{background:#f1f1f1;padding:1px 5px;margin:0 5px 0 0}.ellipsis{max-width:200px;text-overflow:ellipsis}#validation-rules{width:100%;max-width:900px}#validation-rules th{font-size:1.4em;font-weight:normal;padding:0 0 .5em 0}#validation-rules th,#validation-rules td{width:50%;vertical-align:top}.type-rule{margin-bottom:10px}.datamodel-nav .router-link-exact-active{font-weight:bold}.invalid-feedback{font-size:inherit}.btn-compact.btn-sm{padding:.1rem .4rem}.jsonviewer .ib{display:inline-block}.jsonviewer table{border-collapse:collapse;border:solid 1px #ccc;clear:left}.jsonviewer th{text-align:left;padding:4px 8px;text-shadow:#fff 1px 1px -1px;background:#f1f1f1;white-space:nowrap;font-weight:bold}.jsonviewer td{padding:8px 8px 0 8px;vertical-align:top;line-height:18px}.jsonviewer dl{margin:0;clear:left}.jsonviewer dt{font-weight:bold;width:160px;clear:left;float:left;display:block;white-space:nowrap;line-height:26px}.jsonviewer dd{display:block;float:left;line-height:26px;max-width:600px;margin:0}.jsonviewer dl dl dt{font-weight:bold}.jsonviewer hr{display:none}.jsonviewer td dl HR{display:block;padding:0;clear:left;border:none}.jsonviewer td dl{padding:4px;margin:0;height:100%;max-width:700px}.jsonviewer dl td dl dt{padding:2px;margin:0 10px 0 0;font-weight:bold;width:120px;overflow:hidden;clear:left;float:left;display:block}.jsonviewer dl td dl dd{margin:0;padding:2px;display:block;float:left}.jsonviewer tbody>tr:last-child>td{padding:8px}
(function(){
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u};Object.defineProperty(exports,"__esModule",{value:!0});var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),AuthModal=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.loading=!1,t.responseStatus=null,t}return __extends(t,n),Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.app&&this.app.plugins.auth},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"providerUrl",{get:function(){return this.provider?this.app.app.baseUrl+"/auth/"+this.provider:this.app.app.baseUrl+"/auth?noredirect"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"displayUrl",{get:function(){return shared_1.splitOnFirst(this.providerUrl,"?")[0]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"url",{get:function(){var n=this.app.app.baseUrl,t=this.provider?"/"+this.provider+("?continue="+encodeURIComponent("/auth")+"&"):"?";return n+"/auth"+t+"noredirect"},enumerable:!0,configurable:!0}),t.prototype.mounted=function(){var n=this,t=document.querySelector("#auth-frame");window.addEventListener("message",function(i){var r,u;i.source==((r=t)===null||r===void 0?void 0:r.contentWindow)&&((u=i.data)===null||u===void 0?void 0:u.copy)&&n.$emit("done",i.data.copy)})},__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"slug",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"provider",void 0),__decorate([vue_property_decorator_1.Component({template:'<div v-if="enabled" id="authModal" class="modal" tabindex="-1" role="dialog" style="display:block">\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <div v-if="url">\n <h5 class="modal-title">\n Session for <a :href="providerUrl" target="_blank">{{displayUrl}}<\/a>\n <\/h5>\n <\/div>\n <button type="button" class="close" data-dismiss="modal" aria-label="Close" @click="$emit(\'done\')">\n <span aria-hidden="true">&times;<\/span>\n <\/button>\n <\/div>\n <div class="modal-body">\n <iframe id="auth-frame" v-if="url" :src="url" />\n <\/div>\n <\/div>\n <\/div>\n <\/div>'})],t)}(vue_property_decorator_1.Vue);exports.AuthModal=AuthModal;exports.default=AuthModal;vue_property_decorator_1.Vue.component("auth-modal",AuthModal);
})();
(function(){
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u},__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e};Object.defineProperty(exports,"__esModule",{value:!0});var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),dtos_1=require("../../shared/dtos"),AuthSecret=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.loading=!1,t.responseStatus=null,t.token="",t}return __extends(t,n),Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.app&&shared_1.store.hasPlugin(this.slug,"auth")},enumerable:!0,configurable:!0}),t.prototype.submit=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.exec(this,function(){return __awaiter(n,void 0,void 0,function(){var n;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.client.post(new dtos_1.SiteAuthenticate({slug:this.slug,provider:"authsecret",accessToken:this.token}))];case 1:return n=t.sent(),shared_1.bus.$emit("appSession",{slug:this.slug,result:n}),this.$emit("done"),[2]}})})})];case 1:return t.sent(),[2]}})})},__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"slug",void 0),__decorate([vue_property_decorator_1.Component({template:'<div v-if="enabled">\n <form ref="form" @submit.prevent="submit" :class="{ error:responseStatus, loading }" >\n <div class="form-group">\n <error-summary except="token" :responseStatus="responseStatus" />\n <\/div>\n <div class="form-group">\n <v-input id="token" type="password" v-model="token" placeholder="AuthSecret" \n help="The configured AdminAuthSecret" :responseStatus="responseStatus" />\n <a href="https://docs.servicestack.net/debugging#authsecret" class="lnk-help help-muted" target="_blank" title="help"><\/a> \n <\/div>\n <div class="form-group">\n <button type="submit" class="btn btn-lg btn-outline-primary">Login<\/button>\n <\/div>\n <\/form>\n <\/div>'})],t)}(vue_property_decorator_1.Vue);exports.AuthSecret=AuthSecret;exports.default=AuthSecret;vue_property_decorator_1.Vue.component("auth-secret",AuthSecret);
})();
(function(){
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u},__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e};Object.defineProperty(exports,"__esModule",{value:!0});var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),dtos_1=require("../../shared/dtos"),BearerToken=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.loading=!1,t.responseStatus=null,t.token="",t}return __extends(t,n),Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.app&&shared_1.store.hasPlugin(this.slug,"auth")},enumerable:!0,configurable:!0}),t.prototype.submit=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.exec(this,function(){return __awaiter(n,void 0,void 0,function(){var n;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.client.post(new dtos_1.SiteAuthenticate({slug:this.slug,provider:"bearer",accessToken:this.token}))];case 1:return n=t.sent(),shared_1.bus.$emit("appSession",{slug:this.slug,result:n}),this.$emit("done"),[2]}})})})];case 1:return t.sent(),[2]}})})},__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"slug",void 0),__decorate([vue_property_decorator_1.Component({template:'<div v-if="enabled">\n <form ref="form" @submit.prevent="submit" :class="{ error:responseStatus, loading }" >\n <div class="form-group">\n <error-summary except="token" :responseStatus="responseStatus" />\n <\/div>\n <div class="form-group">\n <v-input id="token" v-model="token" placeholder="Bearer Token" :responseStatus="responseStatus" \n help="Any BearerToken Auth Providers, e.g. JWT or API Key" />\n <\/div>\n <div class="form-group">\n <button type="submit" class="btn btn-lg btn-outline-primary">Login<\/button>\n <\/div>\n <\/form>\n <\/div>'})],t)}(vue_property_decorator_1.Vue);exports.BearerToken=BearerToken;exports.default=BearerToken;vue_property_decorator_1.Vue.component("bearer-token",BearerToken);
})();
(function(){
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u},__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e};Object.defineProperty(exports,"__esModule",{value:!0});var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),dtos_1=require("../../shared/dtos"),Credentials=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.loading=!1,t.responseStatus=null,t.userName="",t.password="",t}return __extends(t,n),Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.app&&shared_1.store.hasPlugin(this.slug,"auth")},enumerable:!0,configurable:!0}),t.prototype.submit=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.exec(this,function(){return __awaiter(n,void 0,void 0,function(){var n;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.client.post(new dtos_1.SiteAuthenticate({slug:this.slug,provider:"credentials",userName:this.userName,password:this.password,rememberMe:!0}))];case 1:return n=t.sent(),shared_1.bus.$emit("appSession",{slug:this.slug,result:n}),this.$emit("done"),[2]}})})})];case 1:return t.sent(),[2]}})})},__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"slug",void 0),__decorate([vue_property_decorator_1.Component({template:'<div v-if="enabled">\n <form ref="form" @submit.prevent="submit" :class="{ error:responseStatus, loading }" >\n <div class="form-group">\n <error-summary except="userName,password" :responseStatus="responseStatus" />\n <\/div>\n <div class="form-group">\n <v-input id="userName" v-model="userName" placeholder="Username" :responseStatus="responseStatus" \n help="Username or Email you signed up with" />\n <\/div>\n <div class="form-group">\n <v-input type="password" id="password" v-model="password" placeholder="Password" :responseStatus="responseStatus" />\n <\/div>\n <div class="form-group">\n <button type="submit" class="btn btn-lg btn-outline-primary">Login<\/button>\n <\/div>\n <\/form>\n <\/div>'})],t)}(vue_property_decorator_1.Vue);exports.Credentials=Credentials;exports.default=Credentials;vue_property_decorator_1.Vue.component("credentials",Credentials);
})();
(function(){
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u},__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e};Object.defineProperty(exports,"__esModule",{value:!0});var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),dtos_1=require("../../shared/dtos"),router_1=require("../../shared/router"),Auth=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.loading=!1,t.responseStatus=null,t.showAuthDialog=!1,t.showUserPopup=!1,t.tab="",t.userName="",t.password="",t.rememberMe=!0,t}return __extends(t,n),Object.defineProperty(t.prototype,"store",{get:function(){return shared_1.store},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"site",{get:function(){return shared_1.store.getSite(this.slug)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"appInfo",{get:function(){return shared_1.store.getApp(this.slug).app},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.app&&shared_1.store.hasPlugin(this.slug,"auth")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"plugin",{get:function(){var n;if((n=this.app)!==null&&n!==void 0)return n.plugins.auth},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"session",{get:function(){return shared_1.store.getSession(this.slug)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"prefsDirty",{get:function(){return shared_1.store.isDirty(this.slug)},enumerable:!0,configurable:!0}),t.prototype.goto=function(n){switch(n){case"autoquery":this.$router.push(router_1.autoQueryRoute(this.slug,this.op?{op:this.op}:null));break;case"validation":this.$router.push(router_1.validationRoute(this.slug,this.op?{op:this.op}:null))}},Object.defineProperty(t.prototype,"authProviders",{get:function(){var n;return((n=this.plugin)===null||n===void 0?void 0:n.authProviders)||[]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tabActive",{get:function(){var n;if((n=this.authProviders[0])!==null&&n!==void 0)return n.name},enumerable:!0,configurable:!0}),t.prototype.activeTab=function(n){var t;return this.tab?this.tab==n:((t=this.authProviders[0])===null||t===void 0?void 0:t.type)==n},t.prototype.hasProvider=function(n){return this.authProviders.some(function(t){return t.name==n})},Object.defineProperty(t.prototype,"hasBearer",{get:function(){return this.authProviders.some(function(n){return n.type=="Bearer"})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasOAuth",{get:function(){return this.authProviders.some(function(n){return n.type=="oauth"})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"oauthProviders",{get:function(){return this.authProviders.filter(function(n){return n.type=="oauth"})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasSession",{get:function(){return this.authProviders.some(function(n){return n.type=="session"||n.type=="credentials"||n.type=="oauth"})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasAuthSecret",{get:function(){return this.plugin.hasAuthSecret},enumerable:!0,configurable:!0}),t.prototype.modalKeyDown=function(n){if(this.showAuthDialog&&n.key=="Escape"){this.showAuthDialog=!1;return}if(n.ctrlKey&&n.key==="s"){this.savePrefs();n.preventDefault();return}},t.prototype.beforeDestroy=function(){window.removeEventListener("keydown",this.modalKeyDown)},t.prototype.mounted=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(t){switch(t.label){case 0:return window.addEventListener("keydown",this.modalKeyDown),shared_1.bus.$on("signin",function(){shared_1.log("signin",n.session);n.session||(n.showAuthDialog=!0)}),[4,shared_1.exec(this,function(){return __awaiter(n,void 0,void 0,function(){var n,t;return __generator(this,function(i){switch(i.label){case 0:if(!(this.app&&!this.session))return[3,4];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,shared_1.client.post(new dtos_1.SiteAuthenticate({slug:this.slug}))];case 2:return n=i.sent(),shared_1.bus.$emit("appSession",{slug:this.slug,result:n}),[3,4];case 3:t=i.sent();shared_1.bus.$emit("appSession",{slug:this.slug,result:null});throw t;case 4:return[2]}})})})];case 1:return t.sent(),[2]}})})},t.prototype.savePrefs=function(){var n=this;this.loading=!0;setTimeout(function(){return n.loading=!1},300);shared_1.bus.$emit("savePrefs",{slug:this.slug})},t.prototype.logout=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.exec(this,function(){return __awaiter(n,void 0,void 0,function(){var t,n=this;return __generator(this,function(i){switch(i.label){case 0:return[4,shared_1.client.post(new dtos_1.SiteAuthenticate({slug:this.slug,provider:"logout"}))];case 1:return t=i.sent(),shared_1.bus.$emit("savePrefs",{slug:this.slug,callback:function(){shared_1.bus.$emit("signout",{slug:n.slug});n.showUserPopup=!1}}),[2]}})})})];case 1:return t.sent(),[2]}})})},__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"slug",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"feature",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"op",void 0),__decorate([vue_property_decorator_1.Component({template:'<div v-if="enabled">\n <button v-if="!session && !loading" @click="showAuthDialog=true" class="btn btn-outline-primary">\n Sign In\n <\/button>\n <span v-if="session">\n \n <div class="btn-group" role="group">\n <button v-if="feature != \'autoquery\'" class="btn btn-light btn-sm" @click="goto(\'autoquery\')"\n title="Go to AutoQuery"><i class="db-link svg-lg"/><\/button>\n <button v-if="feature != \'validation\'" class="btn btn-light btn-sm" @click="goto(\'validation\')"\n title="Go to Validation"><i class="lock-link svg-lg"/><\/button>\n <button v-if="prefsDirty || loading" @click="savePrefs()" title="Save Preferences" \n class="btn btn-light btn-sm"><i :class="(loading ? \'svg-loading\' : \'save-link\') + \' svg-lg\'" /><\/button> \n <div class="btn-group" role="group">\n <button @click="showUserPopup=!showUserPopup" id="btnGroupDrop1" type="button" class="btn btn-light dropdown-toggle">\n <img v-if="session.profileUrl" :src="session.profileUrl" class="sq-lg mr-1 mb-1">\n <i v-else class="svg-auth svg-2x mb-1" />\n {{session.displayName || session.userName || session.email}}\n <\/button>\n <div :class="[\'dropdown-menu\',{show:showUserPopup}]" style="top:45px;left:auto">\n <a class="dropdown-item" href="javascript:void(0)" @click="logout()">Sign Out<\/a>\n <\/div> \n <\/div>\n <\/div>\n \n <\/span>\n <div v-if="showAuthDialog" id="signInModal" class="modal" tabindex="-1" role="dialog" \n :style="{ display:showAuthDialog?\'block\':\'none\', background:\'rgba(0,0,0,.25)\'}">\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title">Sign into {{ appInfo.serviceName }}<\/h5>\n <button type="button" class="close" data-dismiss="modal" aria-label="Close" @click="showAuthDialog=false">\n <span aria-hidden="true">&times;<\/span>\n <\/button>\n <\/div>\n <div class="modal-body">\n <ul class="nav nav-pills mb-3" id="pills-tab" role="tablist">\n <li class="nav-item" v-if="hasProvider(\'credentials\')" @click="tab=\'credentials\'">\n <span :class="[\'nav-link\', {active:activeTab(\'credentials\')}]">Credentials<\/span>\n <\/li>\n <li class="nav-item" v-if="hasOAuth" @click="tab=\'oauth\'">\n <span :class="[\'nav-link\', {active:activeTab(\'oauth\')}]">OAuth<\/span>\n <\/li>\n <li class="nav-item" v-if="hasBearer" @click="tab=\'Bearer\'">\n <span :class="[\'nav-link\', {active:activeTab(\'Bearer\')}]">Token<\/span>\n <\/li>\n <li class="nav-item" v-if="hasSession" @click="tab=\'session\'">\n <span :class="[\'nav-link\', {active:activeTab(\'session\')}]">Session<\/span>\n <\/li>\n <li class="nav-item" v-if="hasAuthSecret" @click="tab=\'authsecret\'">\n <span :class="[\'nav-link\', {active:activeTab(\'authsecret\')}]">AuthSecret<\/span>\n <\/li>\n <\/ul>\n <div class="tab-content" id="pills-tabContent">\n <div v-if="hasProvider(\'credentials\')" :class="[\'tab-pane\', {active:activeTab(\'credentials\')}]" id="pills-credentials" role="tabpanel">\n <credentials :slug="slug" @done="showAuthDialog=false" />\n <\/div>\n <div v-if="hasOAuth" :class="[\'tab-pane\', {active:activeTab(\'oauth\')}]" id="pills-oauth" role="tabpanel">\n <oauth-secret :slug="slug" :providers="oauthProviders" @done="showAuthDialog=false" />\n <\/div>\n <div v-if="hasBearer" :class="[\'tab-pane\', {active:activeTab(\'Bearer\')}]" id="pills-bearer" role="tabpanel">\n <bearer-token :slug="slug" @done="showAuthDialog=false" />\n <\/div>\n <div v-if="hasSession" :class="[\'tab-pane\', {active:activeTab(\'session\')}]" id="pills-session" role="tabpanel">\n <session-id :slug="slug" @done="showAuthDialog=false" />\n <\/div>\n <div v-if="hasAuthSecret" :class="[\'tab-pane\', {active:activeTab(\'authsecret\')}]" id="pills-authsecret" role="tabpanel">\n <auth-secret :slug="slug" @done="showAuthDialog=false" />\n <\/div>\n <\/div>\n <\/div>\n <\/div>\n <\/div>\n <\/div> \n <\/div>'})],t)}(vue_property_decorator_1.Vue);exports.Auth=Auth;exports.default=Auth;vue_property_decorator_1.Vue.component("auth",Auth);
})();
(function(){
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u},__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e},__spreadArrays=this&&this.__spreadArrays||function(){for(var i=0,n=0,r=arguments.length;n<r;n++)i+=arguments[n].length;for(var u=Array(i),f=0,n=0;n<r;n++)for(var e=arguments[n],t=0,o=e.length;t<o;t++,f++)u[f]=e[t];return u};Object.defineProperty(exports,"__esModule",{value:!0});var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),dtos_1=require("../../shared/dtos"),desktop_1=require("@servicestack/desktop"),OAuthSecret=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.loading=!1,t.responseStatus=null,t.showOAuthModal="",t.tab="session",t.tokenProvider="session",t.selectedProvider="session",t.token="",t.sessionId="",t.originalClip="",t.monitorClip=!1,t}return __extends(t,n),Object.defineProperty(t.prototype,"authProviders",{get:function(){return __spreadArrays([{name:"session"}],this.providers.filter(function(n){return n.type=="oauth"}))},enumerable:!0,configurable:!0}),t.prototype.showProvider=function(n){return __awaiter(this,void 0,void 0,function(){var t,i;return __generator(this,function(r){switch(r.label){case 0:return this.monitorClip=!1,this.tokenProvider=n,t=n=="session"?"/auth?noredirect&copy=session":"/auth/"+n+"?continue="+encodeURIComponent("/auth?noredirect&copy=session,"+n),[4,shared_1.openUrl(this.app.app.baseUrl+t)];case 1:return(r.sent(),!shared_1.store.desktop)?[3,4]:(this.selectedProvider=this.tokenProvider,this.monitorClip=!0,i=this,[4,desktop_1.clipboard()]);case 2:return i.originalClip=r.sent(),shared_1.log("monitorClipboard originalClip: "+this.originalClip),[4,this.monitorClipboard()];case 3:r.sent();r.label=4;case 4:return[2]}})})},t.prototype.monitorClipboard=function(){return __awaiter(this,void 0,void 0,function(){var n,t,i=this;return __generator(this,function(r){switch(r.label){case 0:return[4,desktop_1.clipboard()];case 1:return(n=r.sent(),!(n&&n!=this.originalClip))?[3,4]:(this.monitorClip=!1,n.length<25?(this.selectedProvider="session",this.sessionId=n):(this.selectedProvider=this.tokenProvider,this.token=n),[4,desktop_1.windowSendToForeground()]);case 2:return t=r.sent(),shared_1.log("monitorClipboard copy detected: '"+n+"', sendToForeground: "+t),[4,this.submit()];case 3:r.sent();r.label=4;case 4:return this.monitorClip&&setTimeout(function(){return i.monitorClipboard()},200),[2]}})})},Object.defineProperty(t.prototype,"oauthModalProvider",{get:function(){return this.showOAuthModal==="session"?"":this.showOAuthModal},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"includesOAuthTokens",{get:function(){return this.app.plugins.auth.includesOAuthTokens},enumerable:!0,configurable:!0}),t.prototype.activeTab=function(n){return this.tab==n},Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.app&&this.app.plugins.auth},enumerable:!0,configurable:!0}),t.prototype.modalDone=function(n){n&&Object.keys(n).length==1&&(this.tokenProvider=Object.keys(n)[0],this.token=n[this.tokenProvider],this.tokenProvider==="sessionid"&&(this.tokenProvider="session"));this.showOAuthModal=""},t.prototype.submit=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(t){switch(t.label){case 0:return(this.monitorClip=!1,!this.sessionId&&!this.token)?[2]:[4,shared_1.exec(this,function(){return __awaiter(n,void 0,void 0,function(){var n;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.client.post(new dtos_1.SiteAuthenticate({slug:this.slug,provider:this.selectedProvider,accessToken:this.selectedProvider=="session"?this.sessionId:this.token}))];case 1:return n=t.sent(),shared_1.bus.$emit("appSession",{slug:this.slug,result:n}),this.$emit("done"),[2]}})})})];case 1:return t.sent(),[2]}})})},__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"slug",void 0),__decorate([vue_property_decorator_1.Prop({"default":[]})],t.prototype,"providers",void 0),__decorate([vue_property_decorator_1.Component({template:'<div v-if="enabled">\n <form ref="form" @submit.prevent="" :class="{ error:responseStatus, loading }" >\n <div class="form-group">\n <error-summary except="token" :responseStatus="responseStatus" />\n <\/div>\n <div class="form-group">\n <p class="text-muted">\n 1. Sign In\n <\/p>\n <div class="mb-3">\n <button v-for="x in authProviders" class="btn btn-outline-primary btn-sm mr-1" @click="showProvider(x.name)">{{x.name}}<\/button>\n <\/div>\n \n <auth-modal v-if="showOAuthModal" :slug="slug" :provider="oauthModalProvider" @done="modalDone" />\n \n <p class="text-muted">\n 2. Copy Session Id \n <span v-if="includesOAuthTokens">or OAuth AccessToken<\/span>\n <\/p>\n \n <ul class="nav nav-pills mb-3" id="pills-tab" role="tablist">\n <li class="nav-item btn-outline-secondary" @click="selectedProvider=\'session\'">\n <span :class="[\'nav-link\',\'btn-outline-secondary\', {active:selectedProvider==\'session\'}]">sessionId<\/span>\n <\/li>\n <li v-if="tokenProvider != \'session\'" class="nav-item btn-outline-secondary" @click="selectedProvider=tokenProvider">\n <span :class="[\'nav-link\',\'btn-outline-secondary\', {active:selectedProvider==tokenProvider}]">{{tokenProvider}}<\/span>\n <\/li>\n <\/ul>\n <div class="tab-content">\n <div :class="[\'tab-pane\', {active:selectedProvider==\'session\'}]" role="tabpanel">\n <div class="form-group">\n <v-input id="sessionId" v-model="sessionId" placeholder="Session Id" :responseStatus="responseStatus" />\n <\/div>\n <\/div>\n <div v-if="tokenProvider != \'session\'" :class="[\'tab-pane\', {active:selectedProvider==tokenProvider}]" role="tabpanel">\n <div class="form-group">\n <v-input id="token" v-model="token" placeholder="Token" :responseStatus="responseStatus" />\n <\/div>\n <\/div>\n <div class="form-group">\n <button class="btn btn-lg btn-outline-primary" @click="submit" :disabled="loading">Login<\/button>\n <i v-if="loading" class="svg-loading svg-lg ml-2"><\/i>\n <\/div>\n <\/div>\n \n <\/div>\n <\/form>\n <\/div>'})],t)}(vue_property_decorator_1.Vue);exports.OAuthSecret=OAuthSecret;exports.default=OAuthSecret;vue_property_decorator_1.Vue.component("oauth-secret",OAuthSecret);
})();
(function(){
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u},__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e};Object.defineProperty(exports,"__esModule",{value:!0});var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),dtos_1=require("../../shared/dtos"),SessionId=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.showSessionModal=!1,t.loading=!1,t.responseStatus=null,t.token="",t}return __extends(t,n),Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.app&&shared_1.store.hasPlugin(this.slug,"auth")},enumerable:!0,configurable:!0}),t.prototype.modalDone=function(n){this.token=n&&n.sessionid||"";this.showSessionModal=!1},t.prototype.submit=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.exec(this,function(){return __awaiter(n,void 0,void 0,function(){var n;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.client.post(new dtos_1.SiteAuthenticate({slug:this.slug,provider:"session",accessToken:this.token}))];case 1:return n=t.sent(),shared_1.bus.$emit("appSession",{slug:this.slug,result:n}),this.$emit("done"),[2]}})})})];case 1:return t.sent(),[2]}})})},__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"slug",void 0),__decorate([vue_property_decorator_1.Prop({"default":!1})],t.prototype,"hideViewSession",void 0),__decorate([vue_property_decorator_1.Component({template:'<div v-if="enabled">\n <form ref="form" @submit.prevent="submit" :class="{ error:responseStatus, loading }" >\n <div class="form-group">\n <error-summary except="token" :responseStatus="responseStatus" />\n <\/div>\n <div class="form-group">\n <span v-if="!hideViewSession" class="btn btn-sm btn-outline-primary mb-2" @click="showSessionModal=!showSessionModal">session<\/span>\n <auth-modal v-if="showSessionModal" :slug="slug" @done="modalDone" />\n <v-input id="token" v-model="token" placeholder="Session Id" :responseStatus="responseStatus" \n help="Copy your Authenticated Session Id" />\n <\/div>\n <div class="form-group">\n <button type="submit" class="btn btn-lg btn-outline-primary">Login<\/button>\n <\/div>\n <\/form>\n <\/div>'})],t)}(vue_property_decorator_1.Vue);exports.SessionId=SessionId;exports.default=SessionId;vue_property_decorator_1.Vue.component("session-id",SessionId);
})();
(function(){
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u},__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e};Object.defineProperty(exports,"__esModule",{value:!0});var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),dtos_1=require("../../shared/dtos"),CreateModal=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.value="",t.model={},t.loading=!1,t.responseStatus=null,t}return __extends(t,n),Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.app&&this.app.plugins.autoQuery},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this.op.request.properties.length>10?"md":"lg"},enumerable:!0,configurable:!0}),t.prototype.mounted=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(){return shared_1.log("CreateModal.mounted()"),this.type.properties.forEach(function(t){n.$set(n.model,t.name,shared_1.defaultValue(t))}),this.$nextTick(function(){var n;(n=document.querySelector("#createModal input:first-child"))===null||n===void 0?void 0:n.select()}),[2]})})},t.prototype.submit=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.exec(this,function(){return __awaiter(n,void 0,void 0,function(){var n,t;return __generator(this,function(i){switch(i.label){case 0:shared_1.log("CreateModal.submit()",this);n=[];for(t in this.model)n.push(t),n.push(this.model[t]);return[4,shared_1.postSiteInvoke(new dtos_1.SiteInvoke({slug:this.slug,request:this.op.request.name,args:n}))];case 1:return i.sent(),this.$emit("done",this.model),[2]}})})})];case 1:return t.sent(),[2]}})})},__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"slug",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"op",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"type",void 0),__decorate([vue_property_decorator_1.Component({template:'<div id="createModal" class="modal-inline" tabindex="-1" role="dialog" @keyup.esc="$emit(\'done\')">\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title">\n New {{type.name}}\n <\/h5>\n <button type="button" class="close" data-dismiss="modal" aria-label="Close" @click="$emit(\'done\')">\n <span aria-hidden="true">&times;<\/span>\n <\/button>\n <\/div>\n <div class="modal-body">\n <form @submit.prevent="submit" :class="{ error:responseStatus, loading }" >\n <div class="form-group">\n <error-summary :except="type.properties.map(x => x.name)" :responseStatus="responseStatus" />\n <\/div> \n <div v-for="f in op.request.properties" :key="f.name" class="form-group">\n <v-input type="text" :id="f.name" v-model="model[f.name]" :placeholder="f.name" :responseStatus="responseStatus" \n :inputClass="[\'form-control-\' + size]" :help="f.name" /> \n <\/div>\n <div class="form-group text-right">\n <span class="btn btn-link" @click="$emit(\'done\')">Close<\/span>\n <button type="submit" class="btn btn-primary">Create {{type.name}}<\/button>\n <\/div>\n <\/form>\n <\/div>\n <\/div>\n <\/div>\n<\/div>'})],t)}(vue_property_decorator_1.Vue);exports.CreateModal=CreateModal;exports.default=CreateModal;vue_property_decorator_1.Vue.component("create-modal",CreateModal);
})();
(function(){
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u},__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e};Object.defineProperty(exports,"__esModule",{value:!0});var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),dtos_1=require("../../shared/dtos"),client_1=require("@servicestack/client"),EditModal=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.value="",t.model={},t.confirmDelete=!1,t.loading=!1,t.responseStatus=null,t}return __extends(t,n),Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.app&&this.app.plugins.autoQuery},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var n;return((n=this.updateOp||this.deleteOp)===null||n===void 0?void 0:n.request.properties.length)>10?"md":"lg"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"labelButton",{get:function(){return this.type.name.length<=13?"Update "+this.type.name:"Update"},enumerable:!0,configurable:!0}),t.prototype.fieldValue=function(n){return shared_1.editValue(n,this.model[n.name])},t.prototype.mounted=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(){return shared_1.log("CreateModal.mounted()"),this.type.properties.forEach(function(t){n.$set(n.model,t.name,shared_1.editValue(t,client_1.getField(n.row,t.name)))}),this.$nextTick(function(){var n;(n=document.querySelector("#createModal input:first-child"))===null||n===void 0?void 0:n.select()}),[2]})})},t.prototype.deleteRow=function(){return __awaiter(this,void 0,void 0,function(){var n,t,i=this;return __generator(this,function(r){switch(r.label){case 0:return n=this.type.properties.find(function(n){return n.isPrimaryKey}),t=n&&client_1.getField(this.row,n.name),[4,shared_1.exec(this,function(){return __awaiter(i,void 0,void 0,function(){var i;return __generator(this,function(r){switch(r.label){case 0:if(shared_1.log("EditModal.deleteRow()"),!t)throw{errorCode:"InvalidState",message:"Could not resolve Primary Key"};return i=[n.name,t],[4,shared_1.deleteSiteInvoke(new dtos_1.SiteInvoke({slug:this.slug,request:this.deleteOp.request.name,args:i}))];case 1:return r.sent(),this.$emit("done",this.model),[2]}})})})];case 1:return r.sent(),[2]}})})},t.prototype.submit=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.exec(this,function(){return __awaiter(n,void 0,void 0,function(){var n,t;return __generator(this,function(i){switch(i.label){case 0:shared_1.log("EditModal.submit()",this);n=[];for(t in this.model)n.push(t),n.push(this.model[t]);return[4,shared_1.postSiteInvoke(new dtos_1.SiteInvoke({slug:this.slug,request:this.updateOp.request.name,args:n}))];case 1:return i.sent(),this.$emit("done",this.model),[2]}})})})];case 1:return t.sent(),[2]}})})},__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"slug",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"updateOp",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"deleteOp",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"type",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"field",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"row",void 0),__decorate([vue_property_decorator_1.Component({template:'<div id="editModal" class="modal-inline" tabindex="-1" role="dialog" @keyup.esc="$emit(\'done\')" title="">\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title">\n Edit {{type.name}}\n <\/h5>\n <button type="button" class="close" data-dismiss="modal" aria-label="Close" @click="$emit(\'done\')">\n <span aria-hidden="true">&times;<\/span>\n <\/button>\n <\/div>\n <div class="modal-body">\n <form @submit.prevent="submit" :class="{ error:responseStatus, loading }" >\n <div class="form-group">\n <error-summary :except="type.properties.map(x => x.name)" :responseStatus="responseStatus" />\n <\/div> \n <div v-for="f in type.properties" :key="f.name" class="form-group">\n <span v-if="!updateOp || f.isPrimaryKey" :class="[\'disabled\',size,\'ml-2\']">{{fieldValue(f)}}<\/span>\n <v-input v-else type="text" :id="f.name" v-model="model[f.name]" :placeholder="f.name" :responseStatus="responseStatus" \n :inputClass="[\'form-control-\' + size]" :help="f.name" /> \n <\/div>\n <div class="form-group text-right">\n <span class="btn btn-link" @click="$emit(\'done\')">close<\/span>\n <button type="submit" class="btn btn-primary">{{labelButton}}<\/button>\n <\/div>\n <div v-if="deleteOp" class="confirm-delete" style="margin:-54px 0 0 20px">\n <input id="chkDelete" type="checkbox" class="form-check-input" @change="confirmDelete=!confirmDelete"/> \n <label for="chkDelete" class="form-check-label">confirm<\/label>\n <button class="btn btn-danger " @click.prevent="confirmDelete && deleteRow()" :disabled="!confirmDelete">Delete<\/button>\n <\/div>\n <\/form>\n <\/div>\n <\/div>\n <\/div>\n<\/div>'})],t)}(vue_property_decorator_1.Vue);exports.EditModal=EditModal;exports.default=EditModal;vue_property_decorator_1.Vue.component("edit-modal",EditModal);
})();
(function(){
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u},__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e};Object.defineProperty(exports,"__esModule",{value:!0});var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),dtos_1=require("../../shared/dtos"),client_1=require("@servicestack/client"),EventsModal=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.results=[],t.expandIds=[],t.loading=!1,t.responseStatus=null,t}return __extends(t,n),Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"plugin",{get:function(){var n;if((n=this.app)!==null&&n!==void 0)return n.plugins.autoQuery},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){var n;return this.plugin.crudEventsServices&&shared_1.store.hasRole(this.slug,(n=this.plugin)===null||n===void 0?void 0:n.accessRole)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pk",{get:function(){return this.type.properties.find(function(n){return n.isPrimaryKey})},enumerable:!0,configurable:!0}),t.prototype.dateFmt=function(n){return client_1.dateFmt(client_1.toDate(n))+" "+client_1.timeFmt12(client_1.toDate(n))},t.prototype.expanded=function(n){return this.expandIds.indexOf(n)>=0},t.prototype.toggle=function(n){this.expanded(n)?this.expandIds=this.expandIds.filter(function(t){return t!=n}):this.expandIds.push(n)},t.prototype.mounted=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(t){switch(t.label){case 0:return this.enabled?(shared_1.log("EventsModal.mounted()",this.slug,this.type.name,this.id),[4,shared_1.exec(this,function(){return __awaiter(n,void 0,void 0,function(){var n,t;return __generator(this,function(i){switch(i.label){case 0:return[4,shared_1.getSiteInvoke(new dtos_1.SiteInvoke({slug:this.slug,request:"GetCrudEvents",args:["model",this.type.name,"modelId",this.id]}))];case 1:return n=i.sent(),t=JSON.parse(n),this.results=t.results.reverse(),[2]}})})})]):[2];case 1:return t.sent(),[2]}})})},__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"slug",void 0),__decorate([vue_property_decorator_1.Prop()],t.prototype,"type",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"id",void 0),__decorate([vue_property_decorator_1.Component({template:'<div v-if="enabled" id="eventsModal" class="modal-inline" tabindex="-1" role="dialog" @keyup.esc="$emit(\'done\')">\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-header">\n <h5 class="modal-title">\n {{type.name}} Events\n <\/h5>\n <button type="button" class="close" data-dismiss="modal" aria-label="Close" @click="$emit(\'done\')">\n <span aria-hidden="true">&times;<\/span>\n <\/button>\n <\/div>\n <div class="modal-body">\n <error-summary :responseStatus="responseStatus" />\n <dl class="h-kvp mb-3">\n <dt>{{pk.name}}<\/dt>\n <dd>{{id}}<\/dd>\n <\/dl>\n <div v-for="x in results" :key="x.id" class="event-line">\n <i v-if="!expanded(x.id)" class="svg svg-chevron-right svg-btn svg-md" title="expand" @click="toggle(x.id)"><\/i>\n <i v-else class="svg svg-chevron-down svg-btn svg-md" title="collapse" @click="toggle(x.id)"><\/i>\n <ul class="event summary" @click="toggle(x.id)">\n <li class="type">{{x.eventType | upper}}<\/li>\n <li class="by"><b><i>[{{x.userAuthId}}]<\/i> {{x.userAuthName}}<\/b><\/li>\n <li class="on"><b :title="dateFmt(x.eventDate)">{{dateFmt(x.eventDate)}}<\/b><\/li>\n <\/ul>\n <div v-if="expanded(x.id)" class="event-detail">\n <ul class="event">\n <li class="op">{{x.requestType}}<\/li>\n <li class="ip"><span>ip<\/span>{{x.remoteIp}}<\/li>\n <\/ul>\n <jsonviewer :json="x.requestBody"/>\n <\/div>\n <\/div>\n <\/div>\n <\/div>\n <\/div>\n<\/div>'})],t)}(vue_property_decorator_1.Vue);exports.EventsModal=EventsModal;exports.default=EventsModal;vue_property_decorator_1.Vue.component("events-modal",EventsModal);
})();
(function(){
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u},__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e},__spreadArrays=this&&this.__spreadArrays||function(){for(var i=0,n=0,r=arguments.length;n<r;n++)i+=arguments[n].length;for(var u=Array(i),f=0,n=0;n<r;n++)for(var e=arguments[n],t=0,o=e.length;t<o;t++,f++)u[f]=e[t];return u};Object.defineProperty(exports,"__esModule",{value:!0});var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),dtos_1=require("../../shared/dtos"),client_1=require("@servicestack/client"),desktop_1=require("@servicestack/desktop"),AutoQuery=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.txtFilter="",t.showSelectColumns=!1,t.searchField="",t.searchType="",t.searchText="",t.skip=0,t.take=100,t.orderBy="",t.filters={},t.fields=[],t.resetPulse=!1,t.total=null,t.responseJson="",t.response=null,t.results=[],t.eventIds=null,t.loading=!1,t.responseStatus=null,t}return __extends(t,n),Object.defineProperty(t.prototype,"store",{get:function(){return shared_1.store},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"slug",{get:function(){return this.$route.params.slug},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"op",{get:function(){return this.$route.query.op},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"windowStyles",{get:function(){return shared_1.collapsed(this.slug,"footer")?"collapse-footer":""},enumerable:!0,configurable:!0}),t.prototype.onUrlChange=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(n){switch(n.label){case 0:return[4,this.restore()];case 1:return n.sent(),[2]}})})},t.prototype.resetQuery=function(){var n,t;return __awaiter(this,void 0,void 0,function(){var i;return __generator(this,function(r){switch(r.label){case 0:return i=(n=this.model)===null||n===void 0?void 0:n.properties.find(function(n){return n.isPrimaryKey}),this.searchField=this.$route.query.field||((t=i)===null||t===void 0?void 0:t.name)||"",this.searchType=this.$route.query.type||"%",this.searchText=this.$route.query.q||"",this.skip=this.$route.query.skip&&parseInt(this.$route.query.skip)||0,this.take=this.$route.query.take&&parseInt(this.$route.query.take)||100,this.orderBy=this.$route.query.orderBy||"",this.fields=this.$route.query.fields&&this.$route.query.fields.split(",")||[],this.filters={},this.resetPulse=!this.resetPulse,[4,this.search()];case 1:return r.sent(),[2]}})})},t.prototype.restore=function(){var n,t,i,r,u,f,e,o,s,h,c;return __awaiter(this,void 0,void 0,function(){var a,l;return __generator(this,function(v){switch(v.label){case 0:return shared_1.log("reset",this.op,this.modelRef,this.model),this.responseStatus=null,this.responseJson="",a=(n=this.model)===null||n===void 0?void 0:n.properties.find(function(n){return n.isPrimaryKey}),l=((t=shared_1.store.getAppPrefs(this.slug))===null||t===void 0?void 0:t.query[this.op])||{},this.searchField=this.$route.query.field||((i=l)===null||i===void 0?void 0:i.searchField)||((r=a)===null||r===void 0?void 0:r.name)||"",this.searchType=this.$route.query.type||((u=l)===null||u===void 0?void 0:u.searchType)||"%",this.searchText=this.$route.query.q||((f=l)===null||f===void 0?void 0:f.searchText)||"",this.skip=this.$route.query.skip&&parseInt(this.$route.query.skip)||((e=l)===null||e===void 0?void 0:e.skip)||0,this.take=this.$route.query.take&&parseInt(this.$route.query.take)||((o=l)===null||o===void 0?void 0:o.take)||100,this.orderBy=this.$route.query.orderBy||((s=l)===null||s===void 0?void 0:s.orderBy)||"",this.fields=this.$route.query.fields&&this.$route.query.fields.split(",")||((h=l)===null||h===void 0?void 0:h.fields)||[],this.filters=((c=l)===null||c===void 0?void 0:c.filters)||{},[4,this.search()];case 1:return v.sent(),[2]}})})},Object.defineProperty(t.prototype,"site",{get:function(){return shared_1.store.getSite(this.slug)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"api",{get:function(){var n;if((n=this.app)!==null&&n!==void 0)return n.api},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"plugin",{get:function(){var n;if((n=shared_1.store.getApp(this.slug))!==null&&n!==void 0)return n.plugins.autoQuery},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.app&&shared_1.store.hasPlugin(this.slug,"autoquery")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"enableEvents",{get:function(){var n;return((n=this.plugin)===null||n===void 0?void 0:n.crudEventsServices)&&this.store.hasRole(this.slug,this.plugin.accessRole)},enumerable:!0,configurable:!0}),t.prototype.min=function(n,t){return Math.min(n,t)},Object.defineProperty(t.prototype,"dirty",{get:function(){return this.hasSelectedCondition||this.skip||this.orderBy||Object.keys(this.filters).length>0||this.fields.length>0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"modelRef",{get:function(){var i=this,n,t;if((t=(n=this.api)===null||n===void 0?void 0:n.operations.find(function(n){return n.request.name===i.$route.query.op}))!==null&&t!==void 0)return t.dataModel},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"model",{get:function(){return shared_1.store.getType(this.slug,this.modelRef)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"modelProps",{get:function(){var n;return __spreadArrays([{key:"",value:"Columns..."}],((n=this.model)===null||n===void 0?void 0:n.properties.map(function(n){return{key:n.name,value:n.name}}))||[])},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"columns",{get:function(){var n;if((n=this.model)!==null&&n!==void 0)return n.properties.map(function(n){return{columnName:n.name,dataType:n.typeNamespace?n.typeNamespace+"."+n.type:n.type}})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"viewerConventions",{get:function(){var n;return __spreadArrays([{key:"",value:"Filters..."}],((n=this.plugin)===null||n===void 0?void 0:n.viewerConventions.map(function(n){return{key:n.value,value:n.name}}))||[])},enumerable:!0,configurable:!0}),t.prototype.matchesType=function(n,t){return shared_1.matchesType(n,t)},t.prototype.typeKey=function(n){return(n.namespace||"")+"."+n.name},Object.defineProperty(t.prototype,"operations",{get:function(){var t=this,n;return this.app?((n=this.api)===null||n===void 0?void 0:n.operations.filter(function(n){return shared_1.matchesType(n.dataModel,t.modelRef)}))||[]:[]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"queryOps",{get:function(){return this.operations.filter(shared_1.isQuery)},enumerable:!0,configurable:!0}),t.prototype.filterOperations=function(n){var u=this,t;if(!this.app)return[];var i=[],f=shared_1.store.appTypes[this.slug],r={},e=this.txtFilter.toLowerCase();return(t=this.api)===null||t===void 0?void 0:t.operations.forEach(function(t){var o,s;t.dataModel&&((o=u.typeKey(t.request),r[o])||(r[o]=!0,s=f[o],s?s.name.toLowerCase().indexOf(e)>=0&&(!n||n(t,s))&&i.push(t):console.warn("Type does not exist",t.dataModel)))}),i.sort(function(n,t){return n.dataModel.name.localeCompare(t.dataModel.name)}),i},Object.defineProperty(t.prototype,"autoQueryTables",{get:function(){return this.filterOperations(function(n){return shared_1.isQuery(n)})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"accessibleAutoQueryTables",{get:function(){var n=this;return this.filterOperations(function(t){return shared_1.isQuery(t)&&shared_1.canAccess(n.slug,t)})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"crudOperations",{get:function(){var n=this;return this.filterOperations(function(t){return shared_1.isCrud(t)&&shared_1.matchesType(t.dataModel,n.modelRef)})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"canQuery",{get:function(){var n=this;return this.accessibleAutoQueryTables.some(function(t){return n.op==t.request.name})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasSelectedCondition",{get:function(){return this.searchField&&this.searchType&&this.searchText},enumerable:!0,configurable:!0}),t.prototype.mounted=function(){return __awaiter(this,void 0,void 0,function(){var n=this;return __generator(this,function(t){switch(t.label){case 0:return[4,shared_1.loadSite(this.slug)];case 1:return t.sent(),[4,this.restore()];case 2:return t.sent(),shared_1.bus.$on("signedin",function(){n.restore()}),[2]}})})},t.prototype.submit=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(n){switch(n.label){case 0:return(shared_1.log("submit",this.hasSelectedCondition),!this.hasSelectedCondition)?[2]:[4,this.search()];case 1:return[2,n.sent()]}})})},t.prototype.search=function(){return __awaiter(this,void 0,void 0,function(){var n,t=this;return __generator(this,function(i){switch(i.label){case 0:return this.op?this.canQuery?(n=shared_1.toInvokeArgs(this.searchArgs()),[4,shared_1.exec(this,function(){return __awaiter(t,void 0,void 0,function(){var t,i;return __generator(this,function(r){switch(r.label){case 0:return t=new dtos_1.SiteInvoke({slug:this.slug,request:this.op,args:n}),shared_1.log("siteInvoke",t),i=this,[4,shared_1.getSiteInvoke(t)];case 1:return i.responseJson=r.sent(),this.response=JSON.parse(this.responseJson),this.results=this.response&&(this.response.results||this.response.Results),this.total=this.response&&this.response.total,shared_1.bus.$emit("appPrefs",{slug:this.slug,request:this.op,query:this.query}),[4,this.loadEvents()];case 2:return r.sent(),[2]}})})})]):[2]:[2];case 1:return i.sent(),[2]}})})},t.prototype.openCsv=function(){return __awaiter(this,void 0,void 0,function(){var n,t,i=this;return __generator(this,function(r){switch(r.label){case 0:return n=this.searchArgs().filter(function(n){return!n.take}),n.push({jsconfig:"edv"}),t=shared_1.toInvokeArgs(n),[4,shared_1.exec(this,function(){return __awaiter(i,void 0,void 0,function(){var n,i,r;return __generator(this,function(u){switch(u.label){case 0:return n=new dtos_1.SiteInvoke({slug:this.slug,request:this.op,args:t}),i=shared_1.client.createUrlFromDto("GET",n).replace("/json/","/csv/"),shared_1.log("openCsv",n,i),r=desktop_1.desktopSaveDownloadUrl(this.op+"-"+shared_1.dateFmtHMS()+".csv",i)+"?open=true",shared_1.store.hasExcel&&(r+="&start=excel"),[4,fetch(r)];case 1:return u.sent(),[2]}})})})];case 1:return r.sent(),[2]}})})},t.prototype.loadEvents=function(){var n;return __awaiter(this,void 0,void 0,function(){var t,i,u,r,f;return __generator(this,function(e){switch(e.label){case 0:return this.enableEvents?(t=(n=this.model)===null||n===void 0?void 0:n.properties.find(function(n){return n.isPrimaryKey}),i=t!=null?this.results.map(function(n){return client_1.getField(n,t.name)}).filter(function(n){return n!=null}):[],i.length==0)?[2]:(u=i.join(","),[4,shared_1.postSiteInvoke(new dtos_1.SiteInvoke({slug:this.slug,request:"CheckCrudEvents",args:["model",this.model.name,"ids",u]}))]):[2];case 1:return r=e.sent(),shared_1.log("loadEvents",r),f=JSON.parse(r),this.eventIds=f.results,[2]}})})},t.prototype.isValidCondition=function(){return this.searchField&&this.searchType&&this.searchText&&(this.searchType.toLowerCase()!=="between"||this.searchText.indexOf(",")>0&&this.searchText.indexOf(",")<this.searchText.length-1)},Object.defineProperty(t.prototype,"query",{get:function(){return{searchField:this.searchField,searchType:this.searchType,searchText:this.searchText,skip:this.skip,take:this.take,orderBy:this.orderBy,filters:this.filters,fields:this.fields}},enumerable:!0,configurable:!0}),t.prototype.searchArgs=function(){var t,u=this,i,n=[],r,f;return n.push({include:"total"}),this.fields.length>0&&n.push({fields:this.fields.join(",")}),Object.keys(this.filters).length>0&&Object.keys(this.filters).forEach(function(t){var r,f,e,o,s,h,c,l,a,v,y,p,w,i=u.filters[t];i=="=null"?n.push((r={},r[t+"IsNull"]="",r)):i=="!=null"?n.push((f={},f[t+"IsNotNull"]="",f)):i.startsWith("<=")?n.push((e={},e[t+"<"]=i.substring(2),e)):i.startsWith(">=")?n.push((o={},o[">"+t]=i.substring(2),o)):i.startsWith("<>")||i.startsWith("!=")?n.push((s={},s[t+"!"]=i.substring(2),s)):i.startsWith("<")?n.push((h={},h["<"+t]=i.substring(1),h)):i.startsWith(">")?n.push((c={},c[t+">"]=i.substring(1),c)):i.endsWith(",")?n.push((l={},l[t+"In"]=i.substring(0,i.length-1),l)):i.startsWith("%")&&i.endsWith("%")?n.push((a={},a[t+"Contains"]=i.substring(1,i.length-1),a)):i.startsWith("%")?n.push((v={},v[t+"EndsWith"]=i.substring(1),v)):i.endsWith("%")?n.push((y={},y[t+"StartsWith"]=i.substring(0,i.length-1),y)):i.startsWith("=")?n.push((p={},p[t]=i.substring(1),p)):n.push((w={},w[t]=i,w))}),this.orderBy&&n.push({orderBy:this.orderBy}),this.skip&&n.push({skip:""+this.skip}),this.take&&n.push({take:""+this.take}),r=(i=this.plugin)===null||i===void 0?void 0:i.viewerConventions.find(function(n){return n.value===u.searchType}),r&&(f=r.value.replace("%",this.searchField),n.push((t={},t[f]=this.searchText,t))),n},t.prototype.handleError=function(n){this.responseStatus=n},t.prototype.handleSelectColumns=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(n){switch(n.label){case 0:return this.showSelectColumns=!1,[4,this.search()];case 1:return n.sent(),[2]}})})},t.prototype.viewNext=function(n){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(i){switch(i.label){case 0:return(this.skip+=n,typeof this.total!="number")?[2]:(t=Math.floor(this.total/100)*100,this.skip>t&&(this.skip=t),this.skip<0&&(this.skip=0),[4,this.search()]);case 1:return i.sent(),[2]}})})},t.prototype.setOrderBy=function(n){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return this.orderBy=this.orderBy==n?"-"+n:this.orderBy=="-"+n?"":n,[4,this.search()];case 1:return t.sent(),[2]}})})},t.prototype.filterSearch=function(n){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(t){switch(t.label){case 0:return shared_1.log("filterSearch",n),this.filters=n,[4,this.search()];case 1:return t.sent(),[2]}})})},__decorate([vue_property_decorator_1.Prop({"default":""})],t.prototype,"name",void 0),__decorate([vue_property_decorator_1.Watch("$route",{immediate:!0,deep:!0})],t.prototype,"onUrlChange",null),__decorate([vue_property_decorator_1.Component({template:'<section v-if="enabled" id="autoquery" :class="[\'grid-layout\',windowStyles]">\n\n <header id="header">\n <h1 v-if="site">\n <nav class="site-breadcrumbs">\n <ol class="breadcrumb">\n <li class="breadcrumb-item">\n <router-link to="/"><i class="home-link svg-3x mb-1" title="home" /><\/router-link>\n <\/li>\n <li :class="[\'breadcrumb-item\',{active:!model}]">\n <img v-if="site.iconUrl" :src="site.iconUrl" class="sq-3x mb-1">\n <i v-else class="svg db-dark svg-3x mb-1" \n /><router-link v-if="model" to="?">{{site.name}}<\/router-link> \n <span v-else>{{site.name}}<\/span>\n <\/li>\n <li v-if="model" class="breadcrumb-item active">{{$route.query.op}}<\/li>\n <li v-if="loading"><i class="svg-loading svg-lg ml-2 mb-1" title="loading..." /><\/li>\n <\/ol>\n <\/nav>\n <\/h1>\n <h1 v-else-if="loading">\n <i class="fab fa-loading"><\/i>\n Loading...\n <\/h1>\n <div v-else-if="responseStatus">\n <error-summary :responseStatus="responseStatus" />\n <router-link to="/">&lt; back to sites<\/router-link>\n <\/div>\n <auth id="auth" v-if="site && app" :slug="slug" feature="autoquery" :op="op" /> \n <\/header>\n \n <nav v-if="app" id="left">\n <div id="nav-filter">\n <i v-if="txtFilter" class="text-close" style="position:absolute;margin:0 0 0 265px;" title="clear" @click="txtFilter=\'\'"><\/i>\n <v-input v-model="txtFilter" id="txtFilter" placeholder="filter" inputClass="form-control" />\n <\/div>\n <div id="sidebar" class="">\n <div class="pl-2">\n <div v-for="op in accessibleAutoQueryTables" :key="typeKey(op.request)" \n :class="[\'datamodel\',{selected:matchesType(op.dataModel,model)}]" :title="op.dataModel?.name">\n <router-link :to="{ query: { op:op.request.name } }">{{op.dataModel?.name}}<\/router-link>\n <\/div>\n <\/div>\n <\/div>\n <\/nav>\n \n <main v-if="app">\n <div v-if="model && canQuery" class="query-form">\n <div class="tab-content" id="v-pills-tabContent">\n <div class="tab-pane fade show active" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab">\n <form class="form-inline" @submit.prevent="submit">\n <table>\n <tr>\n <td>\n <v-select id="listColumns" :values="modelProps" :value="searchField" :responseStatus="responseStatus"\n v-model="searchField" selectClass="custom-select">\n <\/v-select>\n <\/td>\n <td>\n <v-select id="listFilters" :values="viewerConventions" :value="searchType" :responseStatus="responseStatus"\n v-model="searchType" selectClass="custom-select mx-2">\n <\/v-select> \n <\/td>\n <td>\n <v-input v-model="searchText" placeholder="value" class="" inputClass="form-control" />\n <\/td>\n <td>\n <button type="submit" :disabled="!hasSelectedCondition" class="btn btn-outline-primary ml-1" title="Search">\n Search\n <\/button>\n <\/td>\n <td>\n <i v-if="dirty" class="text-close ml-2" style="line-height:.5em" title="reset query" @click="resetQuery()"/>\n <\/td>\n <\/tr>\n <\/table>\n <\/form>\n <\/div>\n <\/div>\n <\/div>\n <div v-if="model && response && !responseStatus" class="main-container">\n <div v-if="showSelectColumns">\n <select-columns :columns="columns" v-model="fields" @done="handleSelectColumns($event)" />\n <\/div>\n <div v-if="!loading" class="main-query">\n <span class="btn svg svg-fields svg-2x" title="View Columns" @click="showSelectColumns=!showSelectColumns"><\/span>\n <button class="btn first-link svg-2x" :disabled="skip==0" title="<< first" @click="viewNext(-total)"><\/button>\n <button class="btn left-link svg-2x" :disabled="skip==0" title="< previous" @click="viewNext(-100)"><\/button>\n <button class="btn right-link svg-2x" :disabled="results.length < take" title="next >" @click="viewNext(100)"><\/button>\n <button class="btn last-link svg-2x" :disabled="results.length < take" title="last >>" @click="viewNext(total)"><\/button>\n <span class="px-1 results-label">Showing Results {{skip+1}} - {{min(skip + results.length,total)}} <span v-if="total!=null">of {{total}}<\/span><\/span>\n <button class="btn btn-outline-success btn-sm btn-compact" @click="openCsv()" \n :title="store.hasExcel ? \'Open in Excel\' : \'Open CSV\'"><i class="svg-md svg-excel"><\/i>{{store.hasExcel ? \'excel\' : \'csv\' }}<\/button>\n <\/div>\n <results :slug="slug" :results="results" :defaultFilters="filters" :fields="fields" :orderBy="orderBy" :type="model" \n :crud="crudOperations" :eventIds="eventIds" :resetPulse="resetPulse"\n @orderBy="setOrderBy($event)" @refresh="restore()" @filterSearch="filterSearch($event)" />\n <\/div>\n <div v-else-if="responseStatus"><error-view :responseStatus="responseStatus" class="mt-5" /><\/div>\n <\/main>\n \n <Footer v-if="app" :slug="slug"/>\n \n <\/section>\n <no-plugin v-else :slug="slug" plugin="autoquery" />'})],t)}(vue_property_decorator_1.Vue);exports.AutoQuery=AutoQuery;exports.default=AutoQuery;vue_property_decorator_1.Vue.component("autoquery",AutoQuery);
})();
(function(){
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u},__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e};Object.defineProperty(exports,"__esModule",{value:!0});var vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),client_1=require("@servicestack/client"),PartialModal=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.value="",t.loading=!1,t.responseStatus=null,t}return __extends(t,n),Object.defineProperty(t.prototype,"app",{get:function(){return shared_1.store.getApp(this.slug)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"enabled",{get:function(){return this.app&&this.app.plugins.autoQuery},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"modalStyle",{get:function(){return{display:"block",top:this.y-10+"px",left:this.x-20+"px",position:"absolute"}},enumerable:!0,configurable:!0}),t.prototype.modalKeyDown=function(n){n.key=="Escape"&&this.$emit("done")},t.prototype.beforeDestroy=function(){window.removeEventListener("keydown",this.modalKeyDown)},Object.defineProperty(t.prototype,"origValue",{get:function(){return client_1.getField(this.row,this.field)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dirty",{get:function(){return this.value!=this.origValue},enumerable:!0,configurable:!0}),t.prototype.mounted=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(){return window.addEventListener("keydown",this.modalKeyDown),this.value=this.origValue,shared_1.log("PartialModal.mounted()"),[2]})})},t.prototype.submit=function(){this.dirty&&(shared_1.log("saving...",this.value,this.dirty),this.$emit("done",this.value))},__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"slug",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"type",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"row",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"field",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"x",void 0),__decorate([vue_property_decorator_1.Prop({"default":null})],t.prototype,"y",void 0),__decorate([vue_property_decorator_1.Component({template:'<div id="partialModal" class="modal-mini" tabindex="-1" role="dialog" :style="modalStyle">\n <div class="modal-dialog" role="document">\n <div class="modal-content">\n <div class="modal-body">\n <button type="button" class="close" data-dismiss="modal" aria-label="Close" @click="$emit(\'done\')">\n <span aria-hidden="true">&times;<\/span>\n <\/button>\n <form @submit.prevent="submit">\n <v-input v-model="value" :label="field" inputClass="md" />\n <i v-if="dirty" class="svg done-success svg-md svg-btn" title="save" @click="submit()" style="float:right;margin:-27px 5px 0 0;"/>\n <\/form>\n <\/div>\n <\/div>\n <\/div>\n<\/div>'})],t)}(vue_property_decorator_1.Vue);exports.PartialModal=PartialModal;exports.default=PartialModal;vue_property_decorator_1.Vue.component("partial-modal",PartialModal);
})();
(function(){
"use strict";var __extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__decorate=this&&this.__decorate||function(n,t,i,r){var f=arguments.length,u=f<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,i):r,e,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,t,i,r);else for(o=n.length-1;o>=0;o--)(e=n[o])&&(u=(f<3?e(u):f>3?e(t,i,u):e(t,i))||u);return f>3&&u&&Object.defineProperty(t,i,u),u},__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e},Results;Object.defineProperty(exports,"__esModule",{value:!0});var vue_1=require("vue"),vue_property_decorator_1=require("vue-property-decorator"),shared_1=require("../../shared"),dtos_1=require("../../shared/dtos"),client_1=require("@servicestack/client"),FormatString=function(n){function t(){return n!==null&&n.apply(this,arguments)||this}return __extends(t,n),Object.defineProperty(t.prototype,"lower",{get:function(){return(""+this.value).toLowerCase()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isUrl",{get:function(){return typeof this.value=="string"&&this.value.startsWith("http")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"url",{get:function(){return typeof this.value=="string"&&this.value.substring(this.value.indexOf("://")+3)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"format",{get:function(){return typeof this.value=="string"&&this.value.startsWith("/Date(")?client_1.toDateFmt(this.value):this.value},enumerable:!0,configurable:!0}),__decorate([vue_property_decorator_1.Prop({"default":""})],t.prototype,"value",void 0),__decorate([vue_property_decorator_1.Component({template:'<a v-if="isUrl" :href="value" target="_blank">{{url}}<\/a>\n <i v-else-if="lower == \'false\'" class="svg svg-md bool-off-muted"><\/i>\n <i v-else-if="lower == \'true\'" class="svg svg-md bool-on-muted"><\/i>\n <span v-else>{{format}}<\/span>\n'})],t)}(vue_1.default);vue_1.default.component("format",FormatString);Results=function(n){function t(){var t=n!==null&&n.apply(this,arguments)||this;return t.filters={},t.loading=!1,t.responseStatus=null,t.showCreate=!1,t.showEvents=!1,t.editingValue="",t.editingRow=null,t.editingField=null,t.selectedField=null,t.cancelBlur=!1,t}return __extends(t,n),t.prototype.onUrlChange=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(){return this.resetEdit(),this.show(),[2]})})},Object.defineProperty(t.prototype,"bus",{get:function(){return shared_1.bus},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"store",{get:function(){return shared_1.store},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"session",{get:function(){return shared_1.store.getSession(this.slug)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"plugin",{get:function(){return shared_1.store.getApp(this.slug).plugins.autoQuery},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"authPlugin",{get:function(){return shared_1.store.getApp(this.slug).plugins.auth},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasFilters",{get:function(){return Object.keys(this.filters).length>0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"enableEvents",{get:function(){var n;return this.plugin.crudEventsServices&&shared_1.store.hasRole(this.slug,(n=this.plugin)===null||n===void 0?void 0:n.accessRole)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fieldNames",{get:function(){var t=this,n=this.type.properties.map(function(n){return n.name});return this.fields.length>0&&(n=n.filter(function(n){return t.fields.indexOf(n)>=0})),n},enumerable:!0,configurable:!0}),t.prototype.show=function(n,t){this.selectedField=null;this.showCreate=!1;this.showEvents=!1;this.editingRow=null;n==="Create"?this.showCreate=!0:n=="Edit"&&typeof t=="number"?this.editingRow=t:n=="Events"&&typeof t=="number"&&(this.selectedField=[t,this.fieldNames.length-1],this.showEvents=!0)},t.prototype.handleDone=function(n,t){shared_1.log("handleDone",n,t);this.showCreate=!1;this.showEvents=!1;this.editingRow=null;t&&this.$emit("refresh")},Object.defineProperty(t.prototype,"createOp",{get:function(){var n=this;return this.crud.find(function(t){return shared_1.canAccess(n.slug,t)&&t.request.implements.some(function(n){return n.name=="ICreateDb`1"})})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"updateOp",{get:function(){var n=this;return this.crud.find(function(t){return shared_1.canAccess(n.slug,t)&&t.request.implements.some(function(n){return n.name=="IUpdateDb`1"})})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"deleteOp",{get:function(){var n=this;return this.crud.find(function(t){return shared_1.canAccess(n.slug,t)&&t.request.implements.some(function(n){return n.name=="IDeleteDb`1"})})},enumerable:!0,configurable:!0}),t.prototype.isPartialField=function(n){return this.partialFields.indexOf(n)>=0},Object.defineProperty(t.prototype,"partialFields",{get:function(){var n=this,t=this.crud.filter(function(t){return shared_1.canAccess(n.slug,t)&&t.request.implements.some(function(n){return n.name=="IPatchDb`1"})}).map(function(t){return shared_1.store.getType(n.slug,t.dataModel)}).map(function(n){var t;if((t=n)!==null&&t!==void 0)return t.properties.filter(function(n){return!n.isPrimaryKey}).map(function(n){return n.name})}).reduce(function(n,t){var i;if((i=n)!==null&&i!==void 0)return i.concat(t||[])},[]);return t||[]},enumerable:!0,configurable:!0}),t.prototype.hasAccessibleCrud=function(n){var t=this,i=n.map(function(n){return"I"+n+"Db`1"});return this.crud.some(function(n){var r;return shared_1.canAccess(t.slug,n)&&((r=n.request.implements)===null||r===void 0?void 0:r.some(function(n){return i.indexOf(n.name)>=0}))})},t.prototype.hasCrud=function(n){var t=n.map(function(n){return"I"+n+"Db`1"});return this.crud.some(function(n){var i;if((i=n.request.implements)!==null&&i!==void 0)return i.some(function(n){return t.indexOf(n.name)>=0})})},t.prototype.humanize=function(n){return client_1.humanize(n)},t.prototype.renderValue=function(n){return Array.isArray(n)?n.join(", "):typeof n=="undefined"?"":typeof n=="object"?JSON.stringify(n):n+""},Object.defineProperty(t.prototype,"createLabel",{get:function(){return"New "+this.type.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"updateLabel",{get:function(){return"Edit "+this.type.name},enumerable:!0,configurable:!0}),t.prototype.getField=function(n,t){return client_1.getField(n,t)},Object.defineProperty(t.prototype,"canCreate",{get:function(){return!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"canUpdate",{get:function(){return!1},enumerable:!0,configurable:!0}),t.prototype.getId=function(n){return shared_1.getId(this.type,n)},t.prototype.hasEvent=function(n){var t=""+shared_1.getId(this.type,n);return t&&this.eventIds&&this.eventIds.indexOf(t)>=0},t.prototype.moveSelected=function(n,t){var u,i,r;this.selectedField&&((u=document.activeElement)===null||u===void 0?void 0:u.tagName)!="INPUT"&&(n!=0&&(i=this.selectedField[0],this.$set(this.selectedField,0,i+n>=this.results.length?0:i+n<0?this.results.length-1:i+n)),t!=0&&(r=this.selectedField[1],this.$set(this.selectedField,1,r+t>=this.fieldNames.length?0:r+t<0?this.fieldNames.length-1:r+t)),typeof this.editingRow=="number"&&(this.editingRow=this.selectedField[0]),this.showEvents&&!this.hasEvent(this.results[this.selectedField[0]])&&(this.showEvents=!1))},t.prototype.onKeyDown=function(n){var t;if(n.key=="Escape")this.resetEdit(),this.show("");else if(this.selectedField){if((t=document.activeElement)===null||t===void 0?void 0:t.form)return;this.editingField||n.key!="Enter"?n.key=="ArrowUp"?this.moveSelected(-1,0):n.key=="ArrowDown"?this.moveSelected(1,0):n.key=="ArrowLeft"?this.moveSelected(0,-1):n.key=="ArrowRight"?this.moveSelected(0,1):n.key=="Home"?(this.$set(this.selectedField,1,0),this.focusSelected(),n.preventDefault()):n.key=="End"&&(this.$set(this.selectedField,1,this.fieldNames.length-1),this.focusSelected(),n.preventDefault()):this.editField(this.selectedField[0],this.selectedField[1])}},t.prototype.focusSelected=function(){this.$nextTick(function(){var n;if((n=document.querySelector(".results td.selected"))!==null&&n!==void 0)return n.scrollIntoView()})},t.prototype.beforeDestroy=function(){window.removeEventListener("keydown",this.onKeyDown)},t.prototype.mounted=function(){window.addEventListener("keydown",this.onKeyDown);shared_1.log("Results.mounted()")},t.prototype.updated=function(){this.filters=this.defaultFilters},t.prototype.isEditingRow=function(n){return this.editingRow===n},t.prototype.isEditingField=function(n,t){return this.editingField&&this.editingField[0]===n&&this.editingField[1]===t},Object.defineProperty(t.prototype,"dirty",{get:function(){return this.editingField&&this.editingValue!=client_1.getField(this.results[this.editingField[0]],this.fieldNames[this.editingField[1]])},enumerable:!0,configurable:!0}),t.prototype.selectedRow=function(n){return this.selectedField&&this.selectedField[0]==n},t.prototype.selectedCell=function(n,t)