diff --git a/README.md b/README.md index f76ccfb..d77e043 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ This project aims to provide a user interface for your private docker registry v2. There is no default registry on this UI, you should add your own with the UI. You can manage more than one registry server. -All registry will be stored in the [local storage](https://en.wikipedia.org/wiki/Web_storage#Local_and_session_storage) of your browser. +All registries will be stored in the [local storage](https://en.wikipedia.org/wiki/Web_storage#Local_and_session_storage) of your browser. -This web user interface use [Riot](https://github.com/Riot/riot) the react-like user interface micro-library and [riot-mui](https://github.com/kysonic/riot-mui) components. +This web user interface uses [Riot](https://github.com/Riot/riot) the react-like user interface micro-library and [riot-mui](https://github.com/kysonic/riot-mui) components. ## [GitHub Page](https://joxit.github.io/docker-registry-ui) and [Live Demo](https://joxit.github.io/docker-registry-ui/demo/) @@ -18,7 +18,7 @@ This web user interface use [Riot](https://github.com/Riot/riot) the react-like - List all your repositories/images. - List all tags for a repository/image - Sort the tag list -- One interface for many registry +- One interface for many registries - Use a secured docker registry - Share your docker registry with query parameter `url` (e.g. `https://joxit.github.io/docker-registry-ui/demo?url=https://registry.example.com`) @@ -49,7 +49,7 @@ The docker contains the source code and a node webserver in order to serve the d You can get the image in three ways -From sources with this command : +From sources with this command: ```sh git clone https://github.com/Joxit/docker-registry-ui.git @@ -57,14 +57,14 @@ docker build -t joxit/docker-registry-ui docker-registry-ui docker build -t joxit/docker-registry-ui -f docker-registry-ui/Dockerfile.static docker-registry-ui ``` -Or build with the url : +Or build with the url: ```sh docker build -t joxit/docker-registry-ui github.com/Joxit/docker-registry-ui docker build -t joxit/docker-registry-ui -f Dockerfile.static github.com/Joxit/docker-registry-ui ``` -Or pull the image from [docker hub](https://hub.docker.com/r/joxit/docker-registry-ui/) : +Or pull the image from [docker hub](https://hub.docker.com/r/joxit/docker-registry-ui/): ```sh docker pull joxit/docker-registry-ui @@ -73,7 +73,7 @@ docker pull joxit/docker-registry-ui:static #### Run the docker -To run the docker and see the website on your 80 port, try this : +To run the docker and see the website on your 80 port, try this: ```sh docker run -d -p 80:80 joxit/docker-registry-ui @@ -94,11 +94,11 @@ docker run -d -p 80:80 -e URL=http://127.0.0.1:5000 -e DELETE_IMAGES=true joxit/ Your server should be configured to accept CORS. -If your docker registry does not need credentials, you will need to send this HEADER : +If your docker registry does not need credentials, you will need to send this HEADER: Access-Control-Allow-Origin: '*' -If your docker registry need credentials, you will need to send these HEADERS : +If your docker registry need credentials, you will need to send these HEADERS: ```yml http: @@ -110,7 +110,7 @@ http: ## Using delete -For deleting images, you need to activate the delete feature in your registry : +For deleting images, you need to activate the delete feature in your registry: ```yml storage: @@ -118,7 +118,7 @@ storage: enabled: true ``` -And you need to add these HEADERS : +And you need to add these HEADERS: ```yml http: diff --git a/demo/index.html b/demo/index.html index 1da604b..8c84f88 100644 --- a/demo/index.html +++ b/demo/index.html @@ -26,32 +26,7 @@ - -
-
-
- Docker Registry UI - -
-
-
-
- -
-
- - - - -
+ diff --git a/dist/index.html b/dist/index.html index 1824c89..72f68b3 100644 --- a/dist/index.html +++ b/dist/index.html @@ -13,4 +13,4 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . --->Docker Registry UI
Docker Registry UI
\ No newline at end of file +-->Docker Registry UI \ No newline at end of file diff --git a/dist/scripts/script.js b/dist/scripts/script.js index 90ce058..85cf0b6 100644 --- a/dist/scripts/script.js +++ b/dist/scripts/script.js @@ -15,4 +15,4 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -function Http(){this.oReq=new XMLHttpRequest,this.oReq.hasHeader=Http.hasHeader,this._events={},this._headers={}}Http.prototype.addEventListener=function(e,t){this._events[e]=t;var r=this;switch(e){case"loadend":r.oReq.addEventListener("loadend",function(){if(401==this.status){var e=new XMLHttpRequest;e.open(r._method,r._url);for(key in r._events)e.addEventListener(key,r._events[key]);for(key in r._headers)e.setRequestHeader(key,r._headers[key]);e.withCredentials=!0,e.hasHeader=Http.hasHeader,e.send()}else t.bind(this)()});break;case"load":r.oReq.addEventListener("load",function(){401!==this.status&&t.bind(this)()});break;default:r.oReq.addEventListener(e,function(){t.bind(this)()})}},Http.prototype.setRequestHeader=function(e,t){this.oReq.setRequestHeader(e,t),this._headers[e]=t},Http.prototype.open=function(e,t){this._method=e,this._url=t,this.oReq.open(e,t)},Http.prototype.send=function(){this.oReq.send()},Http.hasHeader=function(e){return this.getAllResponseHeaders().split("\n").some(function(t){return new RegExp("^"+e+":","i").test(t)})};var registryUI={};registryUI.URL_QUERY_PARAM_REGEX=/[&?]url=/,registryUI.URL_PARAM_REGEX=/^url=/,registryUI.url=function(){if(!registryUI._url){var e=registryUI.getUrlQueryParam();if(e)try{return registryUI._url=registryUI.decodeURI(e),registryUI._url}catch(e){console.log(e)}registryUI._url=registryUI.getRegistryServer(0)}return registryUI._url},registryUI.getRegistryServer=function(e){try{var t=JSON.parse(localStorage.getItem("registryServer"));if(t instanceof Array)return isNaN(e)?t.map(function(e){return e.trim().replace(/\/*$/,"")}):t[e]}catch(e){}return isNaN(e)?[]:""},registryUI.addServer=function(e){var t=registryUI.getRegistryServer();e=e.trim().replace(/\/*$/,"");var r=t.indexOf(e);r==-1&&(t.push(e),registryUI._url||registryUI.updateHistory(e),localStorage.setItem("registryServer",JSON.stringify(t)))},registryUI.changeServer=function(e){var t=registryUI.getRegistryServer();e=e.trim().replace(/\/*$/,"");var r=t.indexOf(e);r!=-1&&(t.splice(r,1),t=[e].concat(t),registryUI.updateHistory(e),localStorage.setItem("registryServer",JSON.stringify(t)))},registryUI.removeServer=function(e){var t=registryUI.getRegistryServer();e=e.trim().replace(/\/*$/,"");var r=t.indexOf(e);r!=-1&&(t.splice(r,1),localStorage.setItem("registryServer",JSON.stringify(t)))},registryUI.updateHistory=function(e){history.pushState(null,"","?url="+registryUI.encodeURI(e)+window.location.hash),registryUI._url=e},registryUI.getUrlQueryParam=function(){var e=window.location.search;if(registryUI.URL_QUERY_PARAM_REGEX.test(e)){var t=e.split(/^\?|&/).find(function(e){return e&®istryUI.URL_PARAM_REGEX.test(e)});return t?t.replace(registryUI.URL_PARAM_REGEX,""):t}},registryUI.encodeURI=function(e){return e.indexOf("&")<0?window.encodeURIComponent(e):btoa(e)},registryUI.decodeURI=function(e){return e.startsWith("http")?window.decodeURIComponent(e):atob(e)},registryUI.isImageRemoveActivated=!0,registryUI.catalog={},registryUI.taglist={},riot.mount("add"),riot.mount("change"),riot.mount("remove"),riot.mount("menu"),riot.mount("app"); \ No newline at end of file +function Http(){this.oReq=new XMLHttpRequest,this.oReq.hasHeader=Http.hasHeader,this._events={},this._headers={}}Http.prototype.addEventListener=function(e,r){this._events[e]=r;var t=this;switch(e){case"loadend":t.oReq.addEventListener("loadend",function(){if(401==this.status){var e=new XMLHttpRequest;e.open(t._method,t._url);for(key in t._events)e.addEventListener(key,t._events[key]);for(key in t._headers)e.setRequestHeader(key,t._headers[key]);e.withCredentials=!0,e.hasHeader=Http.hasHeader,e.send()}else r.bind(this)()});break;case"load":t.oReq.addEventListener("load",function(){401!==this.status&&r.bind(this)()});break;default:t.oReq.addEventListener(e,function(){r.bind(this)()})}},Http.prototype.setRequestHeader=function(e,r){this.oReq.setRequestHeader(e,r),this._headers[e]=r},Http.prototype.open=function(e,r){this._method=e,this._url=r,this.oReq.open(e,r)},Http.prototype.send=function(){this.oReq.send()},Http.hasHeader=function(e){return this.getAllResponseHeaders().split("\n").some(function(r){return new RegExp("^"+e+":","i").test(r)})};var registryUI={};registryUI.URL_QUERY_PARAM_REGEX=/[&?]url=/,registryUI.URL_PARAM_REGEX=/^url=/,registryUI.url=function(e){if(!registryUI._url){var r=registryUI.getUrlQueryParam();if(r)try{return registryUI._url=registryUI.decodeURI(r),registryUI._url}catch(e){console.log(e)}registryUI._url=registryUI.getRegistryServer(0)}return registryUI._url},registryUI.getRegistryServer=function(e){try{var r=JSON.parse(localStorage.getItem("registryServer"));if(r instanceof Array)return isNaN(e)?r.map(function(e){return e.trim().replace(/\/*$/,"")}):r[e]}catch(e){}return isNaN(e)?[]:""},registryUI.addServer=function(e){var r=registryUI.getRegistryServer();e=e.trim().replace(/\/*$/,"");var t=r.indexOf(e);t==-1&&(r.push(e),registryUI._url||registryUI.updateHistory(e),localStorage.setItem("registryServer",JSON.stringify(r)))},registryUI.changeServer=function(e){var r=registryUI.getRegistryServer();e=e.trim().replace(/\/*$/,"");var t=r.indexOf(e);t!=-1&&(r.splice(t,1),r=[e].concat(r),registryUI.updateHistory(e),localStorage.setItem("registryServer",JSON.stringify(r)))},registryUI.removeServer=function(e){var r=registryUI.getRegistryServer();e=e.trim().replace(/\/*$/,"");var t=r.indexOf(e);t!=-1&&(r.splice(t,1),localStorage.setItem("registryServer",JSON.stringify(r)),e==registryUI.url()&&(registryUI.updateHistory(registryUI.getRegistryServer(0)),rg.router.go("home")))},registryUI.updateHistory=function(e){history.pushState(null,"",(e?"?url="+registryUI.encodeURI(e):"?")+window.location.hash),registryUI._url=e},registryUI.getUrlQueryParam=function(){var e=window.location.search;if(registryUI.URL_QUERY_PARAM_REGEX.test(e)){var r=e.split(/^\?|&/).find(function(e){return e&®istryUI.URL_PARAM_REGEX.test(e)});return r?r.replace(registryUI.URL_PARAM_REGEX,""):r}},registryUI.encodeURI=function(e){return e.indexOf("&")<0?window.encodeURIComponent(e):btoa(e)},registryUI.decodeURI=function(e){return e.startsWith("http")?window.decodeURIComponent(e):atob(e)},registryUI.isImageRemoveActivated=!0,registryUI.catalog={},registryUI.taglist={},riot.mount("*"); \ No newline at end of file diff --git a/dist/scripts/tags-static.js b/dist/scripts/tags-static.js index 99961f2..462f831 100644 --- a/dist/scripts/tags-static.js +++ b/dist/scripts/tags-static.js @@ -15,4 +15,4 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -riot.tag2("catalog",'

Repositories of {registryUI.url()}

  • send {item}
',"","",function(t){registryUI.catalog.instance=this,this.mixin("rg.router"),registryUI.catalog.display=function(){var t=new Http;registryUI.catalog.createSnackbar=function(t){var e=document.querySelector("#error-snackbar");registryUI.catalog.error=t;var r={message:registryUI.catalog.error,timeout:1e5,actionHandler:function(){e.classList.remove("mdl-snackbar--active")},actionText:"Undo"};e.MaterialSnackbar.showSnackbar(r)},t.addEventListener("load",function(){200==this.status?(registryUI.catalog.repositories=JSON.parse(this.responseText).repositories||[],registryUI.catalog.repositories.sort()):404==this.status?registryUI.catalog.createSnackbar("Server not found"):registryUI.catalog.createSnackbar(this.responseText)}),t.addEventListener("error",function(){registryUI.catalog.createSnackbar("An error occured")}),t.addEventListener("loadend",function(){registryUI.catalog.loadend=!0,registryUI.catalog.instance.update()}),t.open("GET",registryUI.url()+"/v2/_catalog"),t.send()},this.on("updated",function(){componentHandler.upgradeElements(this["catalog-tag"])}),registryUI.catalog.go=function(t){rg.router.go("taglist",{repository:t.split("/")[0],image:t.split("/")[1]})},registryUI.catalog.display()}),riot.tag2("app"," ","","",function(t){this.mixin("rg.router"),this.router.add({name:"home",url:""}),this.router.add({name:"taglist",url:"/taglist/:repository/:image"}),this.router.on("go",t=>{switch(t.name){case"taglist":registryUI.taglist.display&&(registryUI.taglist.loadend=!1,registryUI.taglist.display());break;case"home":registryUI.catalog.display&&(registryUI.catalog.loadend=!1,registryUI.catalog.display())}}),this.router.start()}),riot.tag2("taglist",'
arrow_back

Tags of {registryUI.url() + \'/\' + registryUI.taglist.name}

Repository Tag
{registryUI.taglist.name} {item}
',"","",function(t){registryUI.taglist.instance=this,registryUI.taglist.display=function(){if(rg.router.current&&"taglist"==rg.router.current.name){name=rg.router.current.params.repository+(rg.router.current.params.image?"/"+rg.router.current.params.image:"");var t=new Http;registryUI.taglist.name=name,registryUI.taglist.instance.update(),registryUI.taglist.createSnackbar=function(t){var e=document.querySelector("#error-snackbar");registryUI.taglist.error=t;var r={message:registryUI.taglist.error,timeout:1e5,actionHandler:function(){e.classList.remove("mdl-snackbar--active")},actionText:"Undo"};e.MaterialSnackbar.showSnackbar(r)},t.addEventListener("load",function(){200==this.status?(registryUI.taglist.tags=JSON.parse(this.responseText).tags||[],registryUI.taglist.tags.sort()):404==this.status?registryUI.taglist.createSnackbar("Server not found"):registryUI.taglist.createSnackbar(this.responseText)}),t.addEventListener("error",function(){registryUI.taglist.createSnackbar("An error occured")}),t.addEventListener("loadend",function(){registryUI.taglist.loadend=!0,registryUI.taglist.instance.update()}),t.open("GET",registryUI.url()+"/v2/"+name+"/tags/list"),t.send(),registryUI.taglist.asc=!0}},registryUI.taglist.display(),registryUI.taglist.instance.update(),this.on("updated",function(){componentHandler.upgradeElements(this["taglist-tag"])}),registryUI.taglist.reverse=function(){registryUI.taglist.asc?(registryUI.taglist.tags.reverse(),registryUI.taglist.asc=!1):(registryUI.taglist.tags.sort(),registryUI.taglist.asc=!0),registryUI.taglist.instance.update()},registryUI.taglist.back=function(){rg.router.go("home")},registryUI.taglist.refresh=function(){rg.router.go(rg.router.current.name,rg.router.current.params)}}),riot.tag2("remove-image",' delete ',"","",function(t){registryUI.removeImage=registryUI.removeImage||{},registryUI.removeImage.update=this.update,registryUI.removeImage.remove=function(t,e){var r=new Http;r.addEventListener("loadend",function(){if(registryUI.taglist.refresh(),200==this.status){if(!this.hasHeader("Docker-Content-Digest"))return void registryUI.taglist.createSnackbar("You need to add Access-Control-Expose-Headers: ['Docker-Content-Digest'] in your server configuration.");var r=this.getResponseHeader("Docker-Content-Digest"),a=new Http;a.addEventListener("loadend",function(){200==this.status||202==this.status?(registryUI.taglist.refresh(),registryUI.taglist.createSnackbar("Deleting "+t+":"+e+" image. Run `registry garbage-collect config.yml` on your registry")):404==this.status?registryUI.taglist.createSnackbar("Digest not found"):registryUI.taglist.createSnackbar(this.responseText)}),a.open("DELETE",registryUI.url()+"/v2/"+t+"/manifests/"+r),a.setRequestHeader("Accept","application/vnd.docker.distribution.manifest.v2+json"),a.addEventListener("error",function(){registryUI.taglist.createSnackbar("An error occurred when deleting image. Check if your server accept DELETE methods Access-Control-Allow-Methods: ['DELETE'].")}),a.send()}else 404==this.status?registryUI.taglist.createSnackbar("Manifest for"+t+":"+e+"not found"):registryUI.taglist.createSnackbar(this.responseText)}),r.open("HEAD",registryUI.url()+"/v2/"+t+"/manifests/"+e),r.setRequestHeader("Accept","application/vnd.docker.distribution.manifest.v2+json"),r.send()}}); \ No newline at end of file +riot.tag2("catalog",'

Repositories of {registryUI.url()}

  • send {item}
',"","",function(t){registryUI.catalog.instance=this,this.mixin("rg.router"),registryUI.catalog.display=function(){var t=new Http;t.addEventListener("load",function(){registryUI.catalog.repositories=[],200==this.status?(registryUI.catalog.repositories=JSON.parse(this.responseText).repositories||[],registryUI.catalog.repositories.sort()):404==this.status?registryUI.snackbar("Server not found",!0):registryUI.snackbar(this.responseText)}),t.addEventListener("error",function(){registryUI.snackbar("An error occured",!0),registryUI.catalog.repositories=[]}),t.addEventListener("loadend",function(){registryUI.catalog.loadend=!0,registryUI.catalog.instance.update()}),t.open("GET",registryUI.url()+"/v2/_catalog"),t.send()},registryUI.catalog.go=function(t){rg.router.go("taglist",{repository:t.split("/")[0],image:t.split("/")[1]})},registryUI.catalog.display()}),riot.tag2("app",'
',"","",function(t){this.mixin("rg.router"),this.router.add({name:"home",url:""}),this.router.add({name:"taglist",url:"/taglist/:repository/:image"}),this.router.on("go",t=>{switch(t.name){case"taglist":registryUI.taglist.display&&(registryUI.taglist.loadend=!1,registryUI.taglist.display());break;case"home":registryUI.catalog.display&&(registryUI.catalog.loadend=!1,registryUI.catalog.display())}}),registryUI.appTag=this,registryUI.snackbar=function(t,r){registryUI.appTag.tags["material-snackbar"].addToast({message:t,isError:r})},registryUI.errorSnackbar=function(t){return registryUI.snackbar(t,!0)},this.router.start()}),riot.tag2("taglist",'
arrow_back

Tags of {registryUI.url() + \'/\' + registryUI.taglist.name}

Repository Tag
{registryUI.taglist.name} {item}
',"","",function(t){registryUI.taglist.instance=this,registryUI.taglist.display=function(){if(rg.router.current&&"taglist"==rg.router.current.name){name=rg.router.current.params.repository+(rg.router.current.params.image?"/"+rg.router.current.params.image:"");var t=new Http;registryUI.taglist.name=name,registryUI.taglist.instance.update(),t.addEventListener("load",function(){registryUI.taglist.tags=[],200==this.status?(registryUI.taglist.tags=JSON.parse(this.responseText).tags||[],registryUI.taglist.tags.sort()):404==this.status?registryUI.snackbar("Server not found",!0):registryUI.snackbar(this.responseText,!0)}),t.addEventListener("error",function(){registryUI.snackbar("An error occured",!0),registryUI.taglist.tags=[]}),t.addEventListener("loadend",function(){registryUI.taglist.loadend=!0,registryUI.taglist.instance.update()}),t.open("GET",registryUI.url()+"/v2/"+name+"/tags/list"),t.send(),registryUI.taglist.asc=!0}},registryUI.taglist.display(),registryUI.taglist.instance.update(),registryUI.taglist.reverse=function(){registryUI.taglist.asc?(registryUI.taglist.tags.reverse(),registryUI.taglist.asc=!1):(registryUI.taglist.tags.sort(),registryUI.taglist.asc=!0),registryUI.taglist.instance.update()},registryUI.taglist.back=function(){rg.router.go("home")},registryUI.taglist.refresh=function(){rg.router.go(rg.router.current.name,rg.router.current.params)}}),riot.tag2("remove-image",' delete ',"","",function(t){registryUI.removeImage=registryUI.removeImage||{},registryUI.removeImage.update=this.update,registryUI.removeImage.remove=function(t,r){var e=new Http;e.addEventListener("loadend",function(){if(registryUI.taglist.refresh(),200==this.status){if(!this.hasHeader("Docker-Content-Digest"))return void registryUI.errorSnackbar("You need to add Access-Control-Expose-Headers: ['Docker-Content-Digest'] in your server configuration.");var e=this.getResponseHeader("Docker-Content-Digest"),a=new Http;a.addEventListener("loadend",function(){200==this.status||202==this.status?(registryUI.taglist.refresh(),registryUI.snackbar("Deleting "+t+":"+r+" image. Run `registry garbage-collect config.yml` on your registry")):404==this.status?registryUI.errorSnackbar("Digest not found"):registryUI.snackbar(this.responseText)}),a.open("DELETE",registryUI.url()+"/v2/"+t+"/manifests/"+e),a.setRequestHeader("Accept","application/vnd.docker.distribution.manifest.v2+json"),a.addEventListener("error",function(){registryUI.errorSnackbar("An error occurred when deleting image. Check if your server accept DELETE methods Access-Control-Allow-Methods: ['DELETE'].")}),a.send()}else 404==this.status?registryUI.errorSnackbar("Manifest for "+t+":"+r+" not found"):registryUI.snackbar(this.responseText)}),e.open("HEAD",registryUI.url()+"/v2/"+t+"/manifests/"+r),e.setRequestHeader("Accept","application/vnd.docker.distribution.manifest.v2+json"),e.send()}}); \ No newline at end of file diff --git a/dist/scripts/tags.js b/dist/scripts/tags.js index 175fcad..b1ec06b 100644 --- a/dist/scripts/tags.js +++ b/dist/scripts/tags.js @@ -15,4 +15,4 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -riot.tag2("add",'

Add your Server ?

',"","",function(e){registryUI.addTag=registryUI.addTag||{},registryUI.addTag.update=this.update,this.on("updated",function(){componentHandler.upgradeElements(this["add-server-dialog"]),registryUI.addTag.dialog=registryUI.addTag.dialog||document.querySelector("#add-server-dialog"),registryUI.addTag.addServer=registryUI.addTag.tileServerList||registryUI.addTag.dialog.querySelector("#add-server-input"),registryUI.addTag.dialog.showModal||dialogPolyfill.registerDialog(registryUI.addTag.dialog),this["add-server-input"].onkeyup=function(e){13==e.keyCode&®istryUI.addTag.add()}}),registryUI.addTag.show=function(){registryUI.addTag.dialog.showModal()},registryUI.addTag.add=function(){registryUI.addTag.addServer.value&®istryUI.addTag.addServer.value.length>0&®istryUI.addServer(registryUI.addTag.addServer.value),registryUI.addTag.addServer.value="",rg.router.go("home"),registryUI.addTag.dialog.close()},registryUI.addTag.close=function(){registryUI.addTag.addServer.value="",registryUI.addTag.dialog.close()},registryUI.addTag.update()}),riot.tag2("app"," ","","",function(e){this.mixin("rg.router"),this.router.add({name:"home",url:""}),this.router.add({name:"taglist",url:"/taglist/:repository/:image"}),this.router.on("go",e=>{switch(e.name){case"taglist":registryUI.taglist.display&&(registryUI.taglist.loadend=!1,registryUI.taglist.display());break;case"home":registryUI.catalog.display&&(registryUI.catalog.loadend=!1,registryUI.catalog.display())}}),this.router.start()}),riot.tag2("catalog",'

Repositories of {registryUI.url()}

  • send {item}
',"","",function(e){registryUI.catalog.instance=this,this.mixin("rg.router"),registryUI.catalog.display=function(){var e=new Http;registryUI.catalog.createSnackbar=function(e){var t=document.querySelector("#error-snackbar");registryUI.catalog.error=e;var r={message:registryUI.catalog.error,timeout:1e5,actionHandler:function(){t.classList.remove("mdl-snackbar--active")},actionText:"Undo"};t.MaterialSnackbar.showSnackbar(r)},e.addEventListener("load",function(){200==this.status?(registryUI.catalog.repositories=JSON.parse(this.responseText).repositories||[],registryUI.catalog.repositories.sort()):404==this.status?registryUI.catalog.createSnackbar("Server not found"):registryUI.catalog.createSnackbar(this.responseText)}),e.addEventListener("error",function(){registryUI.catalog.createSnackbar("An error occured")}),e.addEventListener("loadend",function(){registryUI.catalog.loadend=!0,registryUI.catalog.instance.update()}),e.open("GET",registryUI.url()+"/v2/_catalog"),e.send()},this.on("updated",function(){componentHandler.upgradeElements(this["catalog-tag"])}),registryUI.catalog.go=function(e){rg.router.go("taglist",{repository:e.split("/")[0],image:e.split("/")[1]})},registryUI.catalog.display()}),riot.tag2("change",'

Change your Server ?

',"","",function(e){registryUI.changeTag=registryUI.changeTag||{},registryUI.changeTag.update=this.update,this.on("updated",function(){componentHandler.upgradeElements(this["change-server-dialog"]),registryUI.changeTag.dialog=registryUI.changeTag.dialog||document.querySelector("#change-server-dialog"),registryUI.changeTag.serverList=registryUI.changeTag.serverList||registryUI.changeTag.dialog.querySelector("#server-list"),registryUI.changeTag.dialog.showModal||dialogPolyfill.registerDialog(registryUI.changeTag.dialog),this["server-list"].onkeyup=function(e){13==e.keyCode&®istryUI.changeTag.change()}}),registryUI.changeTag.show=function(){registryUI.changeTag.update(),registryUI.changeTag.serverList.value=registryUI.url(),registryUI.changeTag.dialog.showModal()},registryUI.changeTag.change=function(){registryUI.changeTag.serverList.value&®istryUI.changeTag.serverList.value.length>0&®istryUI.changeServer(registryUI.changeTag.serverList.value),registryUI.changeTag.serverList.value="",rg.router.go("home"),registryUI.changeTag.dialog.close()},registryUI.changeTag.close=function(){registryUI.changeTag.dialog.close()}}),riot.tag2("menu",'
  • Add URL
  • Change URL
  • Remove URL
',"","",function(e){registryUI.menuTag=registryUI.menuTag||{},registryUI.menuTag.update=this.update,this.on("updated",function(){componentHandler.upgradeElements(this["card-menu"])}),registryUI.menuTag.update()}),riot.tag2("remove-image",' delete ',"","",function(e){registryUI.removeImage=registryUI.removeImage||{},registryUI.removeImage.update=this.update,registryUI.removeImage.remove=function(e,t){var r=new Http;r.addEventListener("loadend",function(){if(registryUI.taglist.refresh(),200==this.status){if(!this.hasHeader("Docker-Content-Digest"))return void registryUI.taglist.createSnackbar("You need to add Access-Control-Expose-Headers: ['Docker-Content-Digest'] in your server configuration.");var r=this.getResponseHeader("Docker-Content-Digest"),a=new Http;a.addEventListener("loadend",function(){200==this.status||202==this.status?(registryUI.taglist.refresh(),registryUI.taglist.createSnackbar("Deleting "+e+":"+t+" image. Run `registry garbage-collect config.yml` on your registry")):404==this.status?registryUI.taglist.createSnackbar("Digest not found"):registryUI.taglist.createSnackbar(this.responseText)}),a.open("DELETE",registryUI.url()+"/v2/"+e+"/manifests/"+r),a.setRequestHeader("Accept","application/vnd.docker.distribution.manifest.v2+json"),a.addEventListener("error",function(){registryUI.taglist.createSnackbar("An error occurred when deleting image. Check if your server accept DELETE methods Access-Control-Allow-Methods: ['DELETE'].")}),a.send()}else 404==this.status?registryUI.taglist.createSnackbar("Manifest for"+e+":"+t+"not found"):registryUI.taglist.createSnackbar(this.responseText)}),r.open("HEAD",registryUI.url()+"/v2/"+e+"/manifests/"+t),r.setRequestHeader("Accept","application/vnd.docker.distribution.manifest.v2+json"),r.send()}}),riot.tag2("remove",'

Remove your Registry Server ?

',"","",function(e){registryUI.removeTag=registryUI.removeTag||{},registryUI.removeTag.update=this.update,registryUI.removeTag.removeUrl=function(e){registryUI.removeServer(e),registryUI.removeTag.update()},registryUI.removeTag.close=function(){registryUI.removeTag.dialog.close(),registryUI.removeTag.update()},registryUI.removeTag.show=function(){registryUI.removeTag.update(),registryUI.removeTag.dialog.showModal()},this.on("updated",function(){registryUI.removeTag.dialog=this["remove-server-dialog"],registryUI.removeTag.dialog.showModal||dialogPolyfill.registerDialog(registryUI.removeTag.dialog)})}),riot.tag2("taglist",'
arrow_back

Tags of {registryUI.url() + \'/\' + registryUI.taglist.name}

Repository Tag
{registryUI.taglist.name} {item}
',"","",function(e){registryUI.taglist.instance=this,registryUI.taglist.display=function(){if(rg.router.current&&"taglist"==rg.router.current.name){name=rg.router.current.params.repository+(rg.router.current.params.image?"/"+rg.router.current.params.image:"");var e=new Http;registryUI.taglist.name=name,registryUI.taglist.instance.update(),registryUI.taglist.createSnackbar=function(e){var t=document.querySelector("#error-snackbar");registryUI.taglist.error=e;var r={message:registryUI.taglist.error,timeout:1e5,actionHandler:function(){t.classList.remove("mdl-snackbar--active")},actionText:"Undo"};t.MaterialSnackbar.showSnackbar(r)},e.addEventListener("load",function(){200==this.status?(registryUI.taglist.tags=JSON.parse(this.responseText).tags||[],registryUI.taglist.tags.sort()):404==this.status?registryUI.taglist.createSnackbar("Server not found"):registryUI.taglist.createSnackbar(this.responseText)}),e.addEventListener("error",function(){registryUI.taglist.createSnackbar("An error occured")}),e.addEventListener("loadend",function(){registryUI.taglist.loadend=!0,registryUI.taglist.instance.update()}),e.open("GET",registryUI.url()+"/v2/"+name+"/tags/list"),e.send(),registryUI.taglist.asc=!0}},registryUI.taglist.display(),registryUI.taglist.instance.update(),this.on("updated",function(){componentHandler.upgradeElements(this["taglist-tag"])}),registryUI.taglist.reverse=function(){registryUI.taglist.asc?(registryUI.taglist.tags.reverse(),registryUI.taglist.asc=!1):(registryUI.taglist.tags.sort(),registryUI.taglist.asc=!0),registryUI.taglist.instance.update()},registryUI.taglist.back=function(){rg.router.go("home")},registryUI.taglist.refresh=function(){rg.router.go(rg.router.current.name,rg.router.current.params)}}); \ No newline at end of file +riot.tag2("add",'
Add your Server ?
Write your URL without /v2
Add Cancel
',"","",function(e){registryUI.addTag=registryUI.addTag||{},this.one("mount",function(){registryUI.addTag.dialog=this.tags["material-popup"],registryUI.addTag.dialog.getAddServer=function(){return this.tags["material-input"]?this.tags["material-input"].value:""}}),registryUI.addTag.onkeyup=function(e){13==e.keyCode&®istryUI.addTag.add()},registryUI.addTag.show=function(){registryUI.addTag.dialog.open()},registryUI.addTag.add=function(){registryUI.addTag.dialog.getAddServer().length>0&®istryUI.addServer(registryUI.addTag.dialog.getAddServer()),rg.router.go("home"),registryUI.addTag.close()},registryUI.addTag.close=function(){registryUI.addTag.dialog.tags["material-input"].value="",registryUI.addTag.dialog.close()}}),riot.tag2("app",'
',"","",function(e){this.mixin("rg.router"),this.router.add({name:"home",url:""}),this.router.add({name:"taglist",url:"/taglist/:repository/:image"}),this.router.on("go",e=>{switch(e.name){case"taglist":registryUI.taglist.display&&(registryUI.taglist.loadend=!1,registryUI.taglist.display());break;case"home":registryUI.catalog.display&&(registryUI.catalog.loadend=!1,registryUI.catalog.display())}}),registryUI.appTag=this,registryUI.snackbar=function(e,r){registryUI.appTag.tags["material-snackbar"].addToast({message:e,isError:r})},registryUI.errorSnackbar=function(e){return registryUI.snackbar(e,!0)},this.router.start()}),riot.tag2("catalog",'

Repositories of {registryUI.url()}

  • send {item}
',"","",function(e){registryUI.catalog.instance=this,this.mixin("rg.router"),registryUI.catalog.display=function(){var e=new Http;e.addEventListener("load",function(){registryUI.catalog.repositories=[],200==this.status?(registryUI.catalog.repositories=JSON.parse(this.responseText).repositories||[],registryUI.catalog.repositories.sort()):404==this.status?registryUI.snackbar("Server not found",!0):registryUI.snackbar(this.responseText)}),e.addEventListener("error",function(){registryUI.snackbar("An error occured",!0),registryUI.catalog.repositories=[]}),e.addEventListener("loadend",function(){registryUI.catalog.loadend=!0,registryUI.catalog.instance.update()}),e.open("GET",registryUI.url()+"/v2/_catalog"),e.send()},registryUI.catalog.go=function(e){rg.router.go("taglist",{repository:e.split("/")[0],image:e.split("/")[1]})},registryUI.catalog.display()}),riot.tag2("change",'
Change your Server ?
Change Cancel
',"","",function(e){registryUI.changeTag=registryUI.changeTag||{},this.one("mount",function(){registryUI.changeTag.dialog=this.tags["material-popup"],registryUI.changeTag.dialog.getServerUrl=function(){return this.refs["server-list"]?this.refs["server-list"].value:""},registryUI.changeTag.dialog.on("updated",function(){this.refs["server-list"]&&(this.refs["server-list"].value=registryUI.url())})}),registryUI.changeTag.show=function(){registryUI.changeTag.dialog.open()},registryUI.changeTag.change=function(){registryUI.changeTag.dialog.getServerUrl().length>0&®istryUI.changeServer(registryUI.changeTag.dialog.getServerUrl()),rg.router.go("home"),registryUI.changeTag.dialog.close()},registryUI.changeTag.close=function(){registryUI.changeTag.dialog.close()}}),riot.tag2("menu",' more_vert

Add URL

Change URL

Remove URL

',"","",function(e){registryUI.menuTag=registryUI.menuTag||{},registryUI.menuTag.update=this.update,this.one("mount",function(e){var r=this;registryUI.menuTag.close=function(){r.tags["material-dropdown"].close(),r.update()},registryUI.menuTag.isOpen=function(){return r.tags["material-dropdown"].opened},registryUI.menuTag.toggle=function(){r.tags["material-dropdown"].opened?r.tags["material-dropdown"].close():r.tags["material-dropdown"].open(),r.update()}})}),riot.tag2("remove-image",' delete ',"","",function(e){registryUI.removeImage=registryUI.removeImage||{},registryUI.removeImage.update=this.update,registryUI.removeImage.remove=function(e,r){var t=new Http;t.addEventListener("loadend",function(){if(registryUI.taglist.refresh(),200==this.status){if(!this.hasHeader("Docker-Content-Digest"))return void registryUI.errorSnackbar("You need to add Access-Control-Expose-Headers: ['Docker-Content-Digest'] in your server configuration.");var t=this.getResponseHeader("Docker-Content-Digest"),a=new Http;a.addEventListener("loadend",function(){200==this.status||202==this.status?(registryUI.taglist.refresh(),registryUI.snackbar("Deleting "+e+":"+r+" image. Run `registry garbage-collect config.yml` on your registry")):404==this.status?registryUI.errorSnackbar("Digest not found"):registryUI.snackbar(this.responseText)}),a.open("DELETE",registryUI.url()+"/v2/"+e+"/manifests/"+t),a.setRequestHeader("Accept","application/vnd.docker.distribution.manifest.v2+json"),a.addEventListener("error",function(){registryUI.errorSnackbar("An error occurred when deleting image. Check if your server accept DELETE methods Access-Control-Allow-Methods: ['DELETE'].")}),a.send()}else 404==this.status?registryUI.errorSnackbar("Manifest for "+e+":"+r+" not found"):registryUI.snackbar(this.responseText)}),t.open("HEAD",registryUI.url()+"/v2/"+e+"/manifests/"+r),t.setRequestHeader("Accept","application/vnd.docker.distribution.manifest.v2+json"),t.send()}}),riot.tag2("remove",'
Remove your Registry Server ?
Close
',"","",function(e){registryUI.removeTag=registryUI.removeTag||{},registryUI.removeTag.update=this.update,registryUI.removeTag.removeUrl=function(e){registryUI.removeServer(e),registryUI.removeTag.close()},registryUI.removeTag.close=function(){registryUI.removeTag.dialog.close(),registryUI.removeTag.update()},registryUI.removeTag.show=function(){registryUI.removeTag.dialog.open()},this.one("mount",function(){registryUI.removeTag.dialog=this.tags["material-popup"]})}),riot.tag2("taglist",'
arrow_back

Tags of {registryUI.url() + \'/\' + registryUI.taglist.name}

Repository Tag
{registryUI.taglist.name} {item}
',"","",function(e){registryUI.taglist.instance=this,registryUI.taglist.display=function(){if(rg.router.current&&"taglist"==rg.router.current.name){name=rg.router.current.params.repository+(rg.router.current.params.image?"/"+rg.router.current.params.image:"");var e=new Http;registryUI.taglist.name=name,registryUI.taglist.instance.update(),e.addEventListener("load",function(){registryUI.taglist.tags=[],200==this.status?(registryUI.taglist.tags=JSON.parse(this.responseText).tags||[],registryUI.taglist.tags.sort()):404==this.status?registryUI.snackbar("Server not found",!0):registryUI.snackbar(this.responseText,!0)}),e.addEventListener("error",function(){registryUI.snackbar("An error occured",!0),registryUI.taglist.tags=[]}),e.addEventListener("loadend",function(){registryUI.taglist.loadend=!0,registryUI.taglist.instance.update()}),e.open("GET",registryUI.url()+"/v2/"+name+"/tags/list"),e.send(),registryUI.taglist.asc=!0}},registryUI.taglist.display(),registryUI.taglist.instance.update(),registryUI.taglist.reverse=function(){registryUI.taglist.asc?(registryUI.taglist.tags.reverse(),registryUI.taglist.asc=!1):(registryUI.taglist.tags.sort(),registryUI.taglist.asc=!0),registryUI.taglist.instance.update()},registryUI.taglist.back=function(){rg.router.go("home")},registryUI.taglist.refresh=function(){rg.router.go(rg.router.current.name,rg.router.current.params)}}); \ No newline at end of file diff --git a/dist/scripts/vendor.js b/dist/scripts/vendor.js index 2577a86..bfa522b 100644 --- a/dist/scripts/vendor.js +++ b/dist/scripts/vendor.js @@ -1,752 +1,5 @@ -/* Riot v2.6.8, @license MIT */ -!function(e,t){"use strict";function n(e,t,n){var r={};return r[e.key]=t,e.pos&&(r[e.pos]=n),r}function r(e,t){for(var n,r=t.length,o=e.length;r>o;)n=t[--r],t.splice(r,1),n.unmount()}function o(e,t){Object.keys(e.tags).forEach(function(n){var r=e.tags[n];I(r)?m(r,function(e){N(e,n,t)}):N(r,n,t)})}function i(e,t,n){var r,o=e._root;for(e._virts=[];o;)r=o.nextSibling,n?t.insertBefore(o,n._root):t.appendChild(o),e._virts.push(o),o=r}function a(e,t,n,r){for(var o,i=e._root,a=0;a0}),e)},enumerable:!1,writable:!1,configurable:!1},off:{value:function(r,o){return"*"!=r||o?t(r,function(e,t){if(o)for(var r,i=n[e],a=0;r=i&&i[a];++a)r==o&&i.splice(a--,1);else delete n[e]}):n={},e},enumerable:!1,writable:!1,configurable:!1},one:{value:function(t,n){function r(){e.off(t,r),n.apply(e,arguments)}return e.on(t,r)},enumerable:!1,writable:!1,configurable:!1},trigger:{value:function(o){for(var i,a=arguments.length-1,u=new Array(a),s=0;s1?/{[\S\s]*?}/:h[4],t),t[5]=n(e.length>3?/\\({|})/g:h[5],t),t[6]=n(h[6],t),t[7]=RegExp("\\\\("+t[3]+")|([[({])|("+t[3]+")|"+l,c),t[8]=e,t}function o(e){return e instanceof RegExp?u(e):x[e]}function i(e){(e||(e=m))!==x[8]&&(x=r(e),u=e===m?t:n,x[9]=u(h[9])),v=e}function a(e){var t;e=e||{},t=e.brackets,Object.defineProperty(e,"brackets",{set:i,get:function(){return v},enumerable:!0}),s=e,i(t)}var u,s,c="g",f=/"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'/g,l=f.source+"|"+/(?:\breturn\s+|(?:[$\w\)\]]|\+\+|--)\s*(\/)(?![*\/]))/.source+"|"+/\/(?=[^*\/])[^[\/\\]*(?:(?:\[(?:\\.|[^\]\\]*)*\]|\\.)[^[\/\\]*)*?(\/)[gim]*/.source,p=RegExp("[\\x00-\\x1F<>a-zA-Z0-9'\",;\\\\]"),d=/(?=[[\]()*+?.^$|])/g,g={"(":RegExp("([()])|"+l,c),"[":RegExp("([[\\]])|"+l,c),"{":RegExp("([{}])|"+l,c)},m="{ }",h=["{","}","{","}",/{[^}]*}/,/\\([{}])/g,/\\({)|{/g,RegExp("\\\\(})|([[({])|(})|"+l,c),m,/^\s*{\^?\s*([$\w]+)(?:\s*,\s*(\S+))?\s+in\s+(\S.*)\s*}/,/(^|[^\\]){=[\S\s]*?}/],v=void 0,x=[];return o.split=function(e,t,n){function r(e){t||i?s.push(e&&e.replace(n[5],"$1")):s.push(e)}n||(n=x);var o,i,a,u,s=[],c=n[6];for(i=a=c.lastIndex=0;o=c.exec(e);){if(u=o.index,i){if(o[2]){c.lastIndex=function(e,t,n){var r,o=g[t];for(o.lastIndex=n,n=1;(r=o.exec(e))&&(!r[1]||(r[1]===t?++n:--n)););return n?e.length:o.lastIndex}(e,o[2],c.lastIndex);continue}if(!o[3])continue}o[1]||(r(e.slice(a,u)),a=c.lastIndex,c=n[6+(i^=1)],c.lastIndex=a)}return e&&a2||r[0]){var o,a,u=[];for(o=a=0;o2&&!t?s+(n.push(e)-1)+"~":e}).replace(/\s+/g," ").trim().replace(/\ ?([[\({},?\.:])\ ?/g,"$1")){for(var r,o=[],i=0;e&&(r=e.match(c))&&!r.index;){var u,l,p=/,|([[{(])|$/g;for(e=RegExp.rightContext,u=r[2]?n[r[2]].slice(1,-1).trim().replace(/\s+/g," "):r[1];l=(r=p.exec(e))[1];)!function(t,n){var r,o=1,i=d[t];for(i.lastIndex=n.lastIndex;r=i.exec(e);)if(r[0]===t)++o;else if(!--o)break;n.lastIndex=o?e.length:i.lastIndex}(l,p);l=e.slice(0,r.index),e=RegExp.rightContext,o[i++]=a(l,1,u)}e=i?i>1?"["+o.join(",")+'].join(" ").trim()':o[0]:a(e,t)}return e}function a(e,t,n){var r;return e=e.replace(m,function(e,t,n,o,i){return n&&(o=r?0:o+e.length,"this"!==n&&"global"!==n&&"window"!==n?(e=t+'("'+n+g+n,o&&(r="."===(i=i[o])||"("===i||"["===i)):o&&(r=!h.test(i.slice(o)))),e}),r&&(e="try{return "+e+"}catch(e){E(e,this)}"),n?e=(r?"function(){"+e+"}.call(this)":"("+e+")")+'?"'+n+'":""':t&&(e="function(v){"+(r?e.replace("return ","v="):"v=("+e+")")+';return v||v===0?v:""}.call(this)'),e}var u={};t.haveRaw=ge.hasRaw,t.hasExpr=ge.hasExpr,t.loopKeys=ge.loopKeys,t.clearCache=function(){u={}},t.errorHandler=null;var s=String.fromCharCode(8279),c=/^(?:(-?[_A-Za-z\xA0-\xFF][-\w\xA0-\xFF]*)|\u2057(\d+)~):/,f=RegExp(ge.S_QBLOCKS,"g"),l=/\u2057/g,p=/\u2057(\d+)~/g,d={"(":/[()]/g,"[":/[[\]]/g,"{":/[{}]/g},g='"in this?this:'+("object"!=typeof e?"global":"window")+").",m=/[,{][\$\w]+(?=:)|(^ *|[^$\w\.{])(?!(?:typeof|true|false|null|undefined|in|instanceof|is(?:Finite|NaN)|void|NaN|new|Date|RegExp|Math)(?![$\w]))([$_A-Za-z][$\w]*)/g,h=/^(?=(\.[$\w]+))\1(?:[^.[(]|$)/;return t.version=ge.version="v2.4.2",t}(),he=function(){function e(e,r,o){var i=e&&e.match(/^\s*<([-\w]+)/),a=i&&i[1].toLowerCase(),u=D("div",o&&b(a));return e=n(e,r),s.test(a)?u=t(u,e,a):x(u,e),u.stub=!0,u}function t(e,t,n){var r="o"===n[0],o=r?"select>":"table>";if(e.innerHTML="<"+o+t.trim()+"|>([\S\s]*?)<\/yield\s*>|>)/gi,i=/]*)['"]\s*>([\S\s]*?)<\/yield\s*>/gi,a=/|>([\S\s]*?)<\/yield\s*>)/gi,u={tr:"tbody",th:"tr",td:"tr",col:"colgroup"},s=pe&&pe<10?ce:/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?)$/;return e}(),ve=function(t){if(!e)return{add:function(){},inject:function(){}};var n=function(){var e=D("style");O(e,"type","text/css");var t=B("style[type=riot]");return t?(t.id&&(e.id=t.id),t.parentNode.replaceChild(e,t)):document.getElementsByTagName("head")[0].appendChild(e),e}(),r=n.styleSheet,o="";return Object.defineProperty(t,"styleNode",{value:n,writable:!0}),{add:function(e){o+=e},inject:function(){o&&(r?r.cssText+=o:n.innerHTML+=o,o="")}}}(Q),xe=function(e){var t=e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame;if(!t||/iP(ad|hone|od).*OS 6/.test(e.navigator.userAgent)){var n=0;t=function(e){var t=Date.now(),r=Math.max(16-(t-n),0);setTimeout(function(){e(n=t+r)},r)}}return t}(e||{});Q.util={brackets:ge,tmpl:me},Q.mixin=function(){var e={},t=e[Y]={},n=0;return function(r,o,i){if(y(r))return void Q.mixin("__unnamed_"+n++,r,!0);var a=i?t:e;if(!o){if(typeof a[r]===ie)throw new Error("Unregistered mixin: "+r);return a[r]}h(o)?(R(o.prototype,a[r]||{}),a[r]=o):a[r]=R(a[r]||{},o)}}(),Q.tag=function(e,t,n,r,o){return h(r)&&(o=r,/^[\w\-]+\s?=/.test(n)?(r=n,n=""):r=""),n&&(h(n)?o=n:ve.add(n)),e=e.toLowerCase(),J[e]={name:e,tmpl:t,attrs:r,fn:o},e},Q.tag2=function(e,t,n,r,o){return n&&ve.add(n),J[e]={name:e,tmpl:t,attrs:r,fn:o},e},Q.mount=function(e,t,n){function r(e){var t="";return m(e,function(e){/[^-\w]/.test(e)||(e=e.trim().toLowerCase(),t+=",["+ne+'="'+e+'"],['+te+'="'+e+'"]')}),t}function o(){var e=Object.keys(J);return e+r(e)}function i(e){if(e.tagName){var r=C(e,ne)||C(e,te);t&&r!==t&&(r=t,O(e,ne,t),O(e,te,t));var o=U(e,r||e.tagName.toLowerCase(),n);o&&s.push(o)}else e.length&&m(e,i)}var a,u,s=[];if(ve.inject(),y(t)&&(n=t,t=0),typeof e===re?("*"===e?e=u=o():e+=r(e.split(/, */)),a=e?q(e):[]):a=e,"*"===t){if(t=u||o(),a.tagName)a=q(t,a);else{var c=[];m(a,function(e){c.push(q(t,e))}),a=c}t=0}return i(a),s},Q.update=function(){return m(X,function(e){e.update()})},Q.vdom=X,Q.Tag=l;var be=function(e){function t(t){var n=e[t];if(n)return n;throw new Error('Parser "'+t+'" not loaded.')}function n(e){var t=e.split(".");if(2!==t.length)throw new Error("Bad format for parsers._req");var n=i[t[0]][t[1]];if(n)return n;throw new Error('Parser "'+e+'" not found.')}function r(e,t){if(t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function o(e,n,o,i){return o=r({pretty:!0,filename:i,doctype:"html"},o),t(e).render(n,o)}var i={};return i.html={jade:function(e,t,n){return console.log('DEPRECATION WARNING: jade was renamed "pug" - The jade parser will be removed in riot@3.0.0!'),o("jade",e,t,n)},pug:function(e,t,n){return o("pug",e,t,n)}},i.css={less:function(e,n,o,i){var a;return o=r({sync:!0,syncImport:!0,filename:i},o),t("less").render(n,o,function(e,t){if(e)throw e;a=t.css}),a}},i.js={es6:function(e,n){return n=r({blacklist:["useStrict","strict","react"],sourceMaps:!1,comments:!1},n),t("babel").transform(e,n).code},babel:function(e,n,o){return t("babel").transform(e,r({filename:o},n)).code},buble:function(e,n,o){return n=r({source:o,modules:!1},n),t("buble").transform(e,n).code},coffee:function(e,n){return t("CoffeeScript").compile(e,r({bare:!0},n))},livescript:function(e,n){return t("livescript").compile(e,r({bare:!0,header:!1},n))},typescript:function(e,n){return t("typescript")(e,n)},none:function(e){return e}},i.js.javascript=i.js.none,i.js.coffeescript=i.js.coffee,i._req=n,i.utils={extend:r},i}(e||global);Q.parsers=be;var ye=function(){function e(e){var t,n=N;for(~e.indexOf("\r")&&(e=e.replace(/\r\n?/g,"\n")),n.lastIndex=0;t=n.exec(e);)"<"===t[0][0]&&(e=RegExp.leftContext+RegExp.rightContext,n.lastIndex=t[3]+1);return e}function t(e,t){var n,r,o,i=[];for(E.lastIndex=0,e=e.replace(/\s+/g," ");n=E.exec(e);){var a=n[1].toLowerCase(),u=n[2];u?(u[0]!==q&&(u=q+(u[0]===B?u.slice(1,-1):u)+q),"type"===a&&I.test(u)?r=u:(F.test(u)&&("value"===a?o=1:M.test(a)?a="__"+a:~T.indexOf(a)&&(a="riot-"+a)),i.push(a+"="+u))):i.push(a)}return r&&(o&&(r=q+t._bp[0]+B+r.slice(1,-1)+B+t._bp[1]+q),i.push("type="+r)),i.join(" ")}function n(e,t,n){var r=n._bp;if(e&&r[4].test(e)){for(var o,i=t.expr&&(t.parser||t.type)?u:0,a=ge.split(e,0,r),s=1;s"}),!o.whitespace){var a=[];/]/.test(e)&&(e=e.replace(A,function(e){return a.push(e),""})),e=e.trim().replace(/\s+/g," "),a.length&&(e=e.replace(/\u0002/g,function(){return a.shift()}))}return o.compact&&(e=e.replace(j,"><$1")),r(e,i).replace(k,"")}function i(t,n,r){return Array.isArray(n)?(r=n,n={}):(r||(r=[]),n||(n={})),r._bp=ge.array(n.brackets),o(e(t),n,r)}function a(e){var t,n,r,o,i=[],a=RegExp;for(~e.indexOf("/")&&(e=function(e,t,n){for(t.lastIndex=0;n=t.exec(e);)"/"!==n[0][0]||n[1]||n[2]||(e=a.leftContext+" "+a.rightContext,t.lastIndex=n[3]+1);return e}(e,Z));t=e.match(z);)i.push(a.leftContext),e=a.rightContext,r=function(e,t){var n,r=1;for(t.lastIndex=0;r&&(n=t.exec(e));)"{"===n[0]?++r:"}"===n[0]&&--r;return r?e.length:t.lastIndex}(e,K),o=t[1],n=!/^(?:if|while|for|switch|catch|function)$/.test(o),o=n?t[0].replace(o,"this."+o+" = function"):t[0],i.push(o,e.slice(0,r)),e=e.slice(r),n&&!/^\s*.\s*bind\b/.test(e)&&i.push(".bind(this)");return i.length?i.join("")+e:e}function u(e,t,n,r,o){return/\S/.test(e)?(n||(n=t.type),(t.parser||n&&be._req("js."+n,!0)||a)(e,r,o).replace(/\r\n?/g,"\n").replace(k,"")):""}function s(e,t,n,r){return"string"==typeof t&&(r=n,n=t,t={}),n&&"object"==typeof n&&(r=n,n=""),r||(r={}),u(e,t||{},n,r.parserOptions,r.url)}function c(e,t){return t.replace(G,function(t,n,r){return r?(r=r.replace(/[^,]+/g,function(t){var n=t.trim();return n&&"from"!==n&&"to"!==n&&"%"!==n.slice(-1)?n=n.indexOf(":scope")<0?e+" "+n+',[riot-tag="'+e+'"] '+n+',[data-is="'+e+'"] '+n:n.replace(":scope",e)+","+n.replace(":scope",'[riot-tag="'+e+'"]')+","+n.replace(":scope",'[data-is="'+e+'"]'):t}),n?n+" "+r:r):t})}function f(e,t,n,r){var o=(r||(r={})).scoped;if(n)if("scoped-css"===n)o=!0;else if("css"!==n){var i=be._req("css."+n,!0);e=i(t,e,r.parserOpts||{},r.url)}if(e=e.replace(ge.R_MLCOMMS,"").replace(/\s+/g," ").trim(),o){if(!t)throw new Error("Can not parse scoped CSS without a tagName");e=c(t,e)}return e}function l(e,t,n){return t&&"object"==typeof t?(n=t,t=""):n||(n={}),f(e,n.tagName,t,n)}function p(e,t){return e?(e=B+e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")+B,t&&~e.indexOf("\n")?e.replace(/\n/g,"\\n"):e):"''"}function d(e,t,n,r,o,i,a){var u=a.debug?",\n ":", ",s="});";return o&&"\n"!==o.slice(-1)&&(s="\n"+s),i+"riot.tag2('"+e+B+u+p(t,1)+u+p(n)+u+p(r)+", function(opts) {\n"+o+s}function g(e){if(/<[-\w]/.test(e))for(var t,n=e.lastIndexOf("<"),r=e.length;~n;){if(t=e.slice(n,r).match(X))return n+=t.index+t[0].length,t=e.slice(0,n),"<-/>\n"===t.slice(-5)&&(t=t.slice(0,-5)),[t,e.slice(n)];r=n,n=e.lastIndexOf("<",n-1)}return["",e]}function m(e){if(e){var t=e.match(U);if(t=t&&(t[2]||t[3]))return t.replace("text/","")}return""}function h(e,t){if(e){var n=e.match(RegExp("\\s"+t+W,"i"));if(n=n&&n[1])return/^['"]/.test(n)?n.slice(1,-1):n}return""}function v(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'")}function x(e){var t=v(h(e,"options"));return t?JSON.parse(t):null}function b(e,t,n,r){var o=m(n),i=h(n,"src"),a=C({},t.parserOptions.js);return!i&&u(e,t,o,C(a,x(n)),r)}function y(e,t,n,r,o){var i=C({},t.parserOptions.style),a={parserOpts:C(i,x(n)),scoped:n&&/\sscoped(\s|=|$)/i.test(n),url:r};return f(e,o,m(n)||t.style,a)}function w(e,t,n,r){return be._req("html."+n,!0)(e,r,t)}function _(i,a,s){var c,f=[],l={template:{},js:{},style:{}};a||(a={}),a.parserOptions=C(l,a.parserOptions||{}),c=a.exclude?function(e){return a.exclude.indexOf(e)<0}:function(){return 1},s||(s="");var p=ge.array(a.brackets);return a.template&&(i=w(i,s,a.template,a.parserOptions.template)),i=e(i).replace(J,function(e,i,l,m,h,v){var x="",w="",_="",C="",O=[];if(O._bp=p,l=l.toLowerCase(),m=m&&c("attribs")?r(t(n(m,a,O),O),O):"",(h||(h=v))&&/\S/.test(h))if(v)c("html")&&(_=o(v,a,O));else{h=h.replace(RegExp("^"+i,"gm"),""),h=h.replace(ee,function(e,t,n){return c("css")&&(w+=(w?" ":"")+y(n,a,t,s,l)),""}),h=h.replace(Y,function(e,t,n){if(c("js")){var r=b(n,a,t,s);r&&(x+=(x?"\n":"")+r)}return""});var S=g(h.replace(k,""));c("html")&&(_=o(S[0],a,O)),c("js")&&(h=u(S[1],a,null,null,s),h&&(x+=(x?"\n":"")+h),x=x.replace($,function(e){return C+=e.trim()+"\n",""}))}return x=/\S/.test(x)?x.replace(/\n{3,}/g,"\n\n"):"",a.entities?(f.push({tagName:l,html:_,css:w,attribs:m,js:x,imports:C}),""):d(l,_,w,m,x,C,a)}),a.entities?f:i}var C=be.utils.extend,O=/"[^"\n\\]*(?:\\[\S\s][^"\n\\]*)*"|'[^'\n\\]*(?:\\[\S\s][^'\n\\]*)*'/.source,S=ge.R_STRINGS.source,E=/ *([-\w:\xA0-\xFF]+) ?(?:= ?('[^']*'|"[^"]*"|\S+))?/g,N=RegExp(//.source+"|"+O,"g"),L=/<(-?[A-Za-z][-\w\xA0-\xFF]*)(?:\s+([^"'\/>]*(?:(?:"[^"]*"|'[^']*'|\/[^>])[^'"\/>]*)*)|\s*)(\/?)>/g,j=/>[ \t]+<(-?[A-Za-z]|\/[-A-Za-z])/g,M=RegExp("^(?:disabled|checked|readonly|required|allowfullscreen|auto(?:focus|play)|compact|controls|default|formnovalidate|hidden|ismap|itemscope|loop|multiple|muted|no(?:resize|shade|validate|wrap)?|open|reversed|seamless|selected|sortable|truespeed|typemustmatch)$"),T=["style","src","d"],R=/^(?:input|img|br|wbr|hr|area|base|col|embed|keygen|link|meta|param|source|track)$/,A=/]*|"[^"]*")*)?>([\S\s]+?)<\/pre\s*>/gi,I=/^"(?:number|date(?:time)?|time|month|email|color)\b/i,$=/^\s*import(?:(?:\s|[^\s'"])*)['|"].*\n?/gm,k=/[ \t]+$/gm,F=V(/@#\d/,"x01"),P=V(/@#(\d+)/g,"x01"),H="#",D="⁗",q='"',B="'",z=/^[ \t]*([$_A-Za-z][$\w]*)\s*\([^()]*\)\s*{/m,K=RegExp("[{}]|"+ge.S_QBLOCKS,"g"),Z=RegExp(ge.R_MLCOMMS.source+"|//[^\r\n]*|"+ge.S_QBLOCKS,"g"),G=RegExp("([{}]|^)[ ;]*([^@ ;{}][^{}]*)(?={)|"+O,"g"),U=/\stype\s*=\s*(?:(['"])(.+?)\1|(\S+))/i,W="\\s*=\\s*("+S+"|{[^}]+}|\\S+)",X=/\/>\n|^<(?:\/?-?[A-Za-z][-\w\xA0-\xFF]*\s*|-?[A-Za-z][-\w\xA0-\xFF]*\s+[-\w:\xA0-\xFF][\S\s]*?)>\n/,J=RegExp(/^([ \t]*)<(-?[A-Za-z][-\w\xA0-\xFF]*)(?:\s+([^'"\/>]+(?:(?:@|\/[^>])[^'"\/>]*)*)|\s*)?(?:\/>|>[ \t]*\n?([\S\s]*)^\1<\/\2\s*>|>(.*)<\/\2\s*>)/.source.replace("@",S),"gim"),Y=/]*)?>\n?([\S\s]*?)<\/script\s*>/gi,ee=/]*)?>\n?([\S\s]*?)<\/style\s*>/gi;return Q.util.compiler={compile:_,html:i,css:l,js:s,version:"v2.5.7"},_}();Q.compile=function(){function e(e,t,n){var r=new XMLHttpRequest;r.onreadystatechange=function(){4===r.readyState&&(200===r.status||!r.status&&r.responseText.length)&&t(r.responseText,n,e)},r.open("GET",e,!0),r.send("")}function n(e,t){if(typeof e===re){var n=D("script"),r=document.documentElement;t&&(e+="\n//# sourceURL="+t+".js"),n.text=e,r.appendChild(n),r.removeChild(n)}}function r(t,r){function a(){o.trigger("ready"),i=!0,t&&t()}function u(e,t,r){n(ye(e,t,r),r),--c||a()}var s=q('script[type="riot/tag"]'),c=s.length;if(c)for(var f=0;fr;)n--,V.apply(t[n],[t,n])}function V(e,t){e.splice(t,1),this.unmount(),he(this.parent,this,this.__.tagName,!0)}function U(e){var n=this;t(Object.keys(this.tags),function(t){ue.apply(n.tags[t],[t,e])})}function B(e,t,n){n?ye.apply(this,[e,t]):T(e,this.root,t.root)}function z(e,t,n){n?ve.apply(this,[e,t]):T(e,this.root,t.root)}function F(e,t){t?ve.call(this,e):e.appendChild(this.root)}function D(e,t,n,r){return e?r?ut(e,n):t[e]:t}function K(e,r,i){var o,s=typeof E(e,ke)!==Pe||O(e,ke),u=E(e,Ie),l=!!u&&ut.hasExpr(u),c=pe(e),p=Ne[c],d=e.parentNode,g=_(),m=se(e),v=E(e,Ae),x=[],b=e.innerHTML,w=!Ne[c],N="VIRTUAL"===e.tagName,C=[];return O(e,Le),O(e,Ie),i=ut.loopKeys(i),i.isLoop=!0,v&&O(e,Ae),d.insertBefore(g,e),d.removeChild(e),i.update=function(){i.value=ut(i.val,r);var d=i.value,_=y(),O=!h(d)&&!f(d),E=g.parentNode,j=[];E&&(O?d=(o=d||!1)?Object.keys(d).map(function(e){return $(i,d[e],e)}):[]:o=!1,v&&(d=d.filter(function(e,t){return i.key&&!O?!!ut(v,$(i,e,t,r)):!!ut(v,a(Object.create(r),e))})),t(d,function(t,a){var f=!o&&i.key?$(i,t,a):t,h=D(u,t,f,l),g=s&&typeof t===$e&&!o,v=C.indexOf(h),y=-1===v,O=!y&&g?v:a,T=x[O],A=a>=C.length,L=g&&y||!g&&!T;L?((T=ae(p,{parent:r,isLoop:!0,isAnonymous:w,tagName:c,root:e.cloneNode(w),item:f,index:a},b)).mount(),A?F.apply(T,[_||E,N]):z.apply(T,[E,x[a],N]),A||C.splice(a,0,f),x.splice(a,0,T),m&&de(r.tags,c,T,!0)):O!==a&&g&&((u||n(d,C[O]))&&(B.apply(T,[E,x[a],N]),x.splice(a,0,x.splice(O,1)[0]),C.splice(a,0,C.splice(O,1)[0])),i.pos&&(T[i.pos]=a),!m&&T.tags&&U.call(T,a)),T.__.item=f,T.__.index=a,T.__.parent=r,j[a]=h,L||T.update(f)}),H(d,x),C=j.slice(),E.insertBefore(_,g))},i.unmount=function(){t(x,function(e){e.unmount()})},i}function q(e,t,n){var r=this;L(e,function(t,i){var o,a,s,u=t.nodeType,l=i.parent;if(!n&&t===e)return{parent:l};if(3===u&&"STYLE"!==t.parentNode.tagName&&ut.hasExpr(t.nodeValue)&&l.children.push({dom:t,expr:t.nodeValue}),1!==u)return i;var c="VIRTUAL"===t.tagName;if(o=E(t,Le))return c&&j(t,"loopVirtual",!0),l.children.push(K(t,r,o)),!1;if(o=E(t,Ae))return l.children.push(Object.create(ft).init(t,r,o)),!1;if((a=E(t,Te))&&ut.hasExpr(a))return l.children.push({isRtag:!0,expr:a,dom:t,attrs:[].slice.call(t.attributes)}),!1;if(s=se(t),c&&(E(t,"virtualized")&&t.parentElement.removeChild(t),s||E(t,"virtualized")||E(t,"loopVirtual")||(s={tmpl:t.outerHTML})),s&&(t!==e||n)){if(!c||E(t,Te))return l.children.push(le(s,{root:t,parent:r},t.innerHTML,r)),!1;j(t,"virtualized",!0);var f=ae({tmpl:t.outerHTML},{root:t,parent:r},t.innerHTML);l.children.push(f)}return W.apply(r,[t,t.attributes,function(e,t){t&&l.children.push(t)}]),{parent:l}},{parent:{children:t}})}function W(e,r,i){var o=this;t(r,function(t){if(!t)return!1;var r,a=t.name,u=s(a);n(je,a)&&e.tagName.toLowerCase()!==Oe?r=Object.create(pt).init(e,o,a,t.value):ut.hasExpr(t.value)&&(r={dom:e,expr:t.value,attr:a,bool:u}),i(t,r)})}function Z(e,t,n){var r="o"===n[0],i=r?"select>":"table>";if(e.innerHTML="<"+i+t.trim()+"=0&&/\s/.test(e[t]););return t}var t="[{(,;:?=|&!^~>%*/",n=["case","default","do","else","in","instanceof","prefix","return","typeof","void","yield"],r=n.reduce(function(e,t){return e+t.slice(-1)},""),i=/^\/(?=[^*>/])[^[/\\]*(?:(?:\\.|\[(?:\\.|[^\]\\]*)*\])[^[\\/]*)*?\/[gimuy]*/,o=/[$\w]/;return function(a,s){var u=/.*/g,l=u.lastIndex=s++,c=u.exec(a)[0].match(i);if(c){var f=l+c[0].length,p=a[l=e(a,l)];if(l<0||~t.indexOf(p))return f;if("."===p)"."===a[l-1]&&(s=f);else if("+"===p||"-"===p)(a[--l]!==p||(l=e(a,l))<0||!o.test(a[l]))&&(s=f);else if(~r.indexOf(p)){for(var d=l+1;--l>=0&&o.test(a[l]););~n.indexOf(a.slice(l+1,d))&&(s=f)}}return s}}(),st=function(e){function t(e){return e}function n(e,t){return t||(t=_),new RegExp(e.source.replace(/{/g,t[2]).replace(/}/g,t[3]),e.global?u:"")}function r(e){if(e===m)return v;var t=e.split(" ");if(2!==t.length||p.test(e))throw new Error('Unsupported brackets "'+e+'"');return t=t.concat(e.replace(d,"\\").split(" ")),t[4]=n(t[1].length>1?/{[\S\s]*?}/:v[4],t),t[5]=n(e.length>3?/\\({|})/g:v[5],t),t[6]=n(v[6],t),t[7]=RegExp("\\\\("+t[3]+")|([[({])|("+t[3]+")|"+h,u),t[8]=e,t}function i(e){return e instanceof RegExp?a(e):_[e]}function o(e){(e||(e=m))!==_[8]&&(_=r(e),a=e===m?t:n,_[9]=a(v[9])),y=e}var a,s,u="g",l=/\/\*[^*]*\*+(?:[^*\/][^*]*\*+)*\//g,c=/"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'|`[^`\\]*(?:\\[\S\s][^`\\]*)*`/g,f=c.source+"|"+/(?:\breturn\s+|(?:[$\w\)\]]|\+\+|--)\s*(\/)(?![*\/]))/.source+"|"+/\/(?=[^*\/])[^[\/\\]*(?:(?:\[(?:\\.|[^\]\\]*)*\]|\\.)[^[\/\\]*)*?([^<]\/)[gim]*/.source,p=RegExp("[\\x00-\\x1F<>a-zA-Z0-9'\",;\\\\]"),d=/(?=[[\]()*+?.^$|])/g,h=c.source+"|"+/(\/)(?![*\/])/.source,g={"(":RegExp("([()])|"+h,u),"[":RegExp("([[\\]])|"+h,u),"{":RegExp("([{}])|"+h,u)},m="{ }",v=["{","}","{","}",/{[^}]*}/,/\\([{}])/g,/\\({)|{/g,RegExp("\\\\(})|([[({])|(})|"+h,u),m,/^\s*{\^?\s*([$\w]+)(?:\s*,\s*(\S+))?\s+in\s+(\S.*)\s*}/,/(^|[^\\]){=[\S\s]*?}/],y=void 0,_=[];return i.split=function(e,t,n){function r(e){h&&(e=h+e,h=""),t||a?f.push(e&&e.replace(n[5],"$1")):f.push(e)}function i(n,r,i){return i&&(r=at(e,n)),t&&r>n+2&&(l="⁗"+d.length+"~",d.push(e.slice(n,r)),h+=e.slice(s,n)+l,s=r),r}n||(n=_);var o,a,s,u,l,c,f=[],p=n[6],d=[],h="";for(a=s=p.lastIndex=0;o=p.exec(e);){if(c=p.lastIndex,u=o.index,a){if(o[2]){var m=o[2],v=g[m],y=1;for(v.lastIndex=c;o=v.exec(e);)if(o[1]){if(o[1]===m)++y;else if(!--y)break}else v.lastIndex=i(o.index,v.lastIndex,o[2]);p.lastIndex=y?e.length:v.lastIndex;continue}if(!o[3]){p.lastIndex=i(u,c,o[4]);continue}}o[1]||(r(e.slice(s,u)),s=p.lastIndex,(p=n[6+(a^=1)]).lastIndex=s)}return e&&s %s",t.riotData.tagName||"Unknown tag",this.tmpl),console.log(this.data))}function n(e){var t=r(e);return"try{return "!==t.slice(0,11)&&(t="return "+t),new Function("E",t+";")}function r(e){var t,n=st.split(e.replace(s,'"'),1),r=n.qblocks;if(n.length>2||n[0]){var o,a,l=[];for(o=a=0;o1?"["+i.join(",")+'].join(" ").trim()':i[0]:o(e,t)}return e}function o(e,t,n){var r;return e=e.replace(p,function(e,t,n,i,o){return n&&(i=r?0:i+e.length,"this"!==n&&"global"!==n&&"window"!==n?(e=t+'("'+n+f+n,i&&(r="."===(o=o[i])||"("===o||"["===o)):i&&(r=!d.test(o.slice(i)))),e}),r&&(e="try{return "+e+"}catch(e){E(e,this)}"),n?e=(r?"function(){"+e+"}.call(this)":"("+e+")")+'?"'+n+'":""':t&&(e="function(v){"+(r?e.replace("return ","v="):"v=("+e+")")+';return v||v===0?v:""}.call(this)'),e}var a={};e.hasExpr=st.hasExpr,e.loopKeys=st.loopKeys,e.clearCache=function(){a={}},e.errorHandler=null;var s=/\u2057/g,u=/\u2057(\d+)~/g,l=/^(?:(-?[_A-Za-z\xA0-\xFF][-\w\xA0-\xFF]*)|\u2057(\d+)~):/,c={"(":/[()]/g,"[":/[[\]]/g,"{":/[{}]/g},f='"in this?this:'+("object"!=typeof window?"global":"window")+").",p=/[,{][\$\w]+(?=:)|(^ *|[^$\w\.{])(?!(?:typeof|true|false|null|undefined|in|instanceof|is(?:Finite|NaN)|void|NaN|new|Date|RegExp|Math)(?![$\w]))([$_A-Za-z][$\w]*)/g,d=/^(?=(\.[$\w]+))\1(?:[^.[(]|$)/;return e.version=st.version="v3.0.8",e}(),lt=function(e){e=e||{};var t={},n=Array.prototype.slice;return Object.defineProperties(e,{on:{value:function(n,r){return"function"==typeof r&&(t[n]=t[n]||[]).push(r),e},enumerable:!1,writable:!1,configurable:!1},off:{value:function(n,r){if("*"!=n||r)if(r)for(var i,o=t[n],a=0;i=o&&o[a];++a)i==r&&o.splice(a--,1);else delete t[n];else t={};return e},enumerable:!1,writable:!1,configurable:!1},one:{value:function(t,n){function r(){e.off(t,r),n.apply(e,arguments)}return e.on(t,r)},enumerable:!1,writable:!1,configurable:!1},trigger:{value:function(r){var i,o,a,s=arguments,u=arguments.length-1,l=new Array(u);for(a=0;a|>([\S\s]*?)<\/yield\s*>|>)/gi,gt=/]*)['"]\s*>([\S\s]*?)<\/yield\s*>/gi,mt=/|>([\S\s]*?)<\/yield\s*>)/gi,vt={tr:"tbody",th:"tr",td:"tr",col:"colgroup"},yt=Qe&&Qe<10?De:Ke,_t="div",xt="svg",bt={},wt=bt[Ce]={},Nt=0,Ot=Object.freeze({Tag:J,tag:X,tag2:Y,mount:ee,mixin:te,update:ne,unregister:re,version:"v3.7.3"}),Ct=Object.freeze({getTag:se,moveChildTag:ue,initChildTag:le,getImmediateCustomParentTag:ce,unmountAll:fe,getTagName:pe,arrayishAdd:de,arrayishRemove:he,mountTo:ge,makeReplaceVirtual:me,makeVirtual:ve,moveVirtual:ye,selectTags:_e}),Et=ct,jt={tmpl:ut,brackets:st,styleManager:ot,vdom:we,styleNode:ot.styleNode,dom:tt,check:et,misc:Ye,tags:Ct},Tt=J,At=X,Lt=Y,kt=ee,Mt=te,St=ne,It=re,Rt=lt,Pt=a({},Ot,{observable:lt,settings:Et,util:jt});e.settings=Et,e.util=jt,e.Tag=Tt,e.tag=At,e.tag2=Lt,e.mount=kt,e.mixin=Mt,e.update=St,e.unregister=It,e.version="v3.7.3",e.observable=Rt,e.default=Pt,Object.defineProperty(e,"__esModule",{value:!0})}); "use strict";var _extends=Object.assign||function(r){for(var t=1;t>>0,i=arguments[1],a=0;n>a;a++)if(t=e[a],r.call(i,t,a,e))return t;return void 0});var r=[];var t={hash:"#!",add:function u(n){if(!n||!n.name){throw"Please specify a state name";return}var i=e(n);if(i)i=n;else{if(n.url&&n.url[0]=="/")n.url=n.url.substr(1);r.push(n)}t.trigger("add",i);return this},remove:function f(e){var n=undefined;r=r.filter(function(r){if(r.name!=e)return r;else n=r});t.trigger("remove",n);return this},go:function s(r,n,i){if(!t.active||!r)return;var o=e(r);if(!o){throw"State '"+r+"' has not been configured";return}if(n)o.params=n;var u=r.split(".");u=u.map(function(r,t){if(t>0){return u.slice(0,t).join(".")+"."+r}else{return r}});u.forEach(function(r,t){if(t from the passed element. - * - * @param {Element} el to search from - * @return {HTMLDialogElement} dialog found - */ - function findNearestDialog(el) { - while (el) { - if (el.localName === 'dialog') { - return /** @type {HTMLDialogElement} */ (el); - } - el = el.parentElement; - } - return null; - } - - /** - * Blur the specified element, as long as it's not the HTML body element. - * This works around an IE9/10 bug - blurring the body causes Windows to - * blur the whole application. - * - * @param {Element} el to blur - */ - function safeBlur(el) { - if (el && el.blur && el !== document.body) { - el.blur(); - } - } - - /** - * @param {!NodeList} nodeList to search - * @param {Node} node to find - * @return {boolean} whether node is inside nodeList - */ - function inNodeList(nodeList, node) { - for (var i = 0; i < nodeList.length; ++i) { - if (nodeList[i] === node) { - return true; - } - } - return false; - } - - /** - * @param {HTMLFormElement} el to check - * @return {boolean} whether this form has method="dialog" - */ - function isFormMethodDialog(el) { - if (!el || !el.hasAttribute('method')) { - return false; - } - return el.getAttribute('method').toLowerCase() === 'dialog'; - } - - /** - * @param {!HTMLDialogElement} dialog to upgrade - * @constructor - */ - function dialogPolyfillInfo(dialog) { - this.dialog_ = dialog; - this.replacedStyleTop_ = false; - this.openAsModal_ = false; - - // Set a11y role. Browsers that support dialog implicitly know this already. - if (!dialog.hasAttribute('role')) { - dialog.setAttribute('role', 'dialog'); - } - - dialog.show = this.show.bind(this); - dialog.showModal = this.showModal.bind(this); - dialog.close = this.close.bind(this); - - if (!('returnValue' in dialog)) { - dialog.returnValue = ''; - } - - if ('MutationObserver' in window) { - var mo = new MutationObserver(this.maybeHideModal.bind(this)); - mo.observe(dialog, {attributes: true, attributeFilter: ['open']}); - } else { - // IE10 and below support. Note that DOMNodeRemoved etc fire _before_ removal. They also - // seem to fire even if the element was removed as part of a parent removal. Use the removed - // events to force downgrade (useful if removed/immediately added). - var removed = false; - var cb = function() { - removed ? this.downgradeModal() : this.maybeHideModal(); - removed = false; - }.bind(this); - var timeout; - var delayModel = function(ev) { - if (ev.target !== dialog) { return; } // not for a child element - var cand = 'DOMNodeRemoved'; - removed |= (ev.type.substr(0, cand.length) === cand); - window.clearTimeout(timeout); - timeout = window.setTimeout(cb, 0); - }; - ['DOMAttrModified', 'DOMNodeRemoved', 'DOMNodeRemovedFromDocument'].forEach(function(name) { - dialog.addEventListener(name, delayModel); - }); - } - // Note that the DOM is observed inside DialogManager while any dialog - // is being displayed as a modal, to catch modal removal from the DOM. - - Object.defineProperty(dialog, 'open', { - set: this.setOpen.bind(this), - get: dialog.hasAttribute.bind(dialog, 'open') - }); - - this.backdrop_ = document.createElement('div'); - this.backdrop_.className = 'backdrop'; - this.backdrop_.addEventListener('click', this.backdropClick_.bind(this)); - } - - dialogPolyfillInfo.prototype = { - - get dialog() { - return this.dialog_; - }, - - /** - * Maybe remove this dialog from the modal top layer. This is called when - * a modal dialog may no longer be tenable, e.g., when the dialog is no - * longer open or is no longer part of the DOM. - */ - maybeHideModal: function() { - if (this.dialog_.hasAttribute('open') && document.body.contains(this.dialog_)) { return; } - this.downgradeModal(); - }, - - /** - * Remove this dialog from the modal top layer, leaving it as a non-modal. - */ - downgradeModal: function() { - if (!this.openAsModal_) { return; } - this.openAsModal_ = false; - this.dialog_.style.zIndex = ''; - - // This won't match the native exactly because if the user set top on a centered - // polyfill dialog, that top gets thrown away when the dialog is closed. Not sure it's - // possible to polyfill this perfectly. - if (this.replacedStyleTop_) { - this.dialog_.style.top = ''; - this.replacedStyleTop_ = false; - } - - // Clear the backdrop and remove from the manager. - this.backdrop_.parentNode && this.backdrop_.parentNode.removeChild(this.backdrop_); - dialogPolyfill.dm.removeDialog(this); - }, - - /** - * @param {boolean} value whether to open or close this dialog - */ - setOpen: function(value) { - if (value) { - this.dialog_.hasAttribute('open') || this.dialog_.setAttribute('open', ''); - } else { - this.dialog_.removeAttribute('open'); - this.maybeHideModal(); // nb. redundant with MutationObserver - } - }, - - /** - * Handles clicks on the fake .backdrop element, redirecting them as if - * they were on the dialog itself. - * - * @param {!Event} e to redirect - */ - backdropClick_: function(e) { - if (!this.dialog_.hasAttribute('tabindex')) { - // Clicking on the backdrop should move the implicit cursor, even if dialog cannot be - // focused. Create a fake thing to focus on. If the backdrop was _before_ the dialog, this - // would not be needed - clicks would move the implicit cursor there. - var fake = document.createElement('div'); - this.dialog_.insertBefore(fake, this.dialog_.firstChild); - fake.tabIndex = -1; - fake.focus(); - this.dialog_.removeChild(fake); - } else { - this.dialog_.focus(); - } - - var redirectedEvent = document.createEvent('MouseEvents'); - redirectedEvent.initMouseEvent(e.type, e.bubbles, e.cancelable, window, - e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey, - e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget); - this.dialog_.dispatchEvent(redirectedEvent); - e.stopPropagation(); - }, - - /** - * Focuses on the first focusable element within the dialog. This will always blur the current - * focus, even if nothing within the dialog is found. - */ - focus_: function() { - // Find element with `autofocus` attribute, or fall back to the first form/tabindex control. - var target = this.dialog_.querySelector('[autofocus]:not([disabled])'); - if (!target && this.dialog_.tabIndex >= 0) { - target = this.dialog_; - } - if (!target) { - // Note that this is 'any focusable area'. This list is probably not exhaustive, but the - // alternative involves stepping through and trying to focus everything. - var opts = ['button', 'input', 'keygen', 'select', 'textarea']; - var query = opts.map(function(el) { - return el + ':not([disabled])'; - }); - // TODO(samthor): tabindex values that are not numeric are not focusable. - query.push('[tabindex]:not([disabled]):not([tabindex=""])'); // tabindex != "", not disabled - target = this.dialog_.querySelector(query.join(', ')); - } - safeBlur(document.activeElement); - target && target.focus(); - }, - - /** - * Sets the zIndex for the backdrop and dialog. - * - * @param {number} dialogZ - * @param {number} backdropZ - */ - updateZIndex: function(dialogZ, backdropZ) { - if (dialogZ < backdropZ) { - throw new Error('dialogZ should never be < backdropZ'); - } - this.dialog_.style.zIndex = dialogZ; - this.backdrop_.style.zIndex = backdropZ; - }, - - /** - * Shows the dialog. If the dialog is already open, this does nothing. - */ - show: function() { - if (!this.dialog_.open) { - this.setOpen(true); - this.focus_(); - } - }, - - /** - * Show this dialog modally. - */ - showModal: function() { - if (this.dialog_.hasAttribute('open')) { - throw new Error('Failed to execute \'showModal\' on dialog: The element is already open, and therefore cannot be opened modally.'); - } - if (!document.body.contains(this.dialog_)) { - throw new Error('Failed to execute \'showModal\' on dialog: The element is not in a Document.'); - } - if (!dialogPolyfill.dm.pushDialog(this)) { - throw new Error('Failed to execute \'showModal\' on dialog: There are too many open modal dialogs.'); - } - - if (createsStackingContext(this.dialog_.parentElement)) { - console.warn('A dialog is being shown inside a stacking context. ' + - 'This may cause it to be unusable. For more information, see this link: ' + - 'https://github.com/GoogleChrome/dialog-polyfill/#stacking-context'); - } - - this.setOpen(true); - this.openAsModal_ = true; - - // Optionally center vertically, relative to the current viewport. - if (dialogPolyfill.needsCentering(this.dialog_)) { - dialogPolyfill.reposition(this.dialog_); - this.replacedStyleTop_ = true; - } else { - this.replacedStyleTop_ = false; - } - - // Insert backdrop. - this.dialog_.parentNode.insertBefore(this.backdrop_, this.dialog_.nextSibling); - - // Focus on whatever inside the dialog. - this.focus_(); - }, - - /** - * Closes this HTMLDialogElement. This is optional vs clearing the open - * attribute, however this fires a 'close' event. - * - * @param {string=} opt_returnValue to use as the returnValue - */ - close: function(opt_returnValue) { - if (!this.dialog_.hasAttribute('open')) { - throw new Error('Failed to execute \'close\' on dialog: The element does not have an \'open\' attribute, and therefore cannot be closed.'); - } - this.setOpen(false); - - // Leave returnValue untouched in case it was set directly on the element - if (opt_returnValue !== undefined) { - this.dialog_.returnValue = opt_returnValue; - } - - // Triggering "close" event for any attached listeners on the . - var closeEvent = new supportCustomEvent('close', { - bubbles: false, - cancelable: false - }); - this.dialog_.dispatchEvent(closeEvent); - } - - }; - - var dialogPolyfill = {}; - - dialogPolyfill.reposition = function(element) { - var scrollTop = document.body.scrollTop || document.documentElement.scrollTop; - var topValue = scrollTop + (window.innerHeight - element.offsetHeight) / 2; - element.style.top = Math.max(scrollTop, topValue) + 'px'; - }; - - dialogPolyfill.isInlinePositionSetByStylesheet = function(element) { - for (var i = 0; i < document.styleSheets.length; ++i) { - var styleSheet = document.styleSheets[i]; - var cssRules = null; - // Some browsers throw on cssRules. - try { - cssRules = styleSheet.cssRules; - } catch (e) {} - if (!cssRules) { continue; } - for (var j = 0; j < cssRules.length; ++j) { - var rule = cssRules[j]; - var selectedNodes = null; - // Ignore errors on invalid selector texts. - try { - selectedNodes = document.querySelectorAll(rule.selectorText); - } catch(e) {} - if (!selectedNodes || !inNodeList(selectedNodes, element)) { - continue; - } - var cssTop = rule.style.getPropertyValue('top'); - var cssBottom = rule.style.getPropertyValue('bottom'); - if ((cssTop && cssTop !== 'auto') || (cssBottom && cssBottom !== 'auto')) { - return true; - } - } - } - return false; - }; - - dialogPolyfill.needsCentering = function(dialog) { - var computedStyle = window.getComputedStyle(dialog); - if (computedStyle.position !== 'absolute') { - return false; - } - - // We must determine whether the top/bottom specified value is non-auto. In - // WebKit/Blink, checking computedStyle.top == 'auto' is sufficient, but - // Firefox returns the used value. So we do this crazy thing instead: check - // the inline style and then go through CSS rules. - if ((dialog.style.top !== 'auto' && dialog.style.top !== '') || - (dialog.style.bottom !== 'auto' && dialog.style.bottom !== '')) { - return false; - } - return !dialogPolyfill.isInlinePositionSetByStylesheet(dialog); - }; - - /** - * @param {!Element} element to force upgrade - */ - dialogPolyfill.forceRegisterDialog = function(element) { - if (window.HTMLDialogElement || element.showModal) { - console.warn('This browser already supports , the polyfill ' + - 'may not work correctly', element); - } - if (element.localName !== 'dialog') { - throw new Error('Failed to register dialog: The element is not a dialog.'); - } - new dialogPolyfillInfo(/** @type {!HTMLDialogElement} */ (element)); - }; - - /** - * @param {!Element} element to upgrade, if necessary - */ - dialogPolyfill.registerDialog = function(element) { - if (!element.showModal) { - dialogPolyfill.forceRegisterDialog(element); - } - }; - - /** - * @constructor - */ - dialogPolyfill.DialogManager = function() { - /** @type {!Array} */ - this.pendingDialogStack = []; - - var checkDOM = this.checkDOM_.bind(this); - - // The overlay is used to simulate how a modal dialog blocks the document. - // The blocking dialog is positioned on top of the overlay, and the rest of - // the dialogs on the pending dialog stack are positioned below it. In the - // actual implementation, the modal dialog stacking is controlled by the - // top layer, where z-index has no effect. - this.overlay = document.createElement('div'); - this.overlay.className = '_dialog_overlay'; - this.overlay.addEventListener('click', function(e) { - this.forwardTab_ = undefined; - e.stopPropagation(); - checkDOM([]); // sanity-check DOM - }.bind(this)); - - this.handleKey_ = this.handleKey_.bind(this); - this.handleFocus_ = this.handleFocus_.bind(this); - - this.zIndexLow_ = 100000; - this.zIndexHigh_ = 100000 + 150; - - this.forwardTab_ = undefined; - - if ('MutationObserver' in window) { - this.mo_ = new MutationObserver(function(records) { - var removed = []; - records.forEach(function(rec) { - for (var i = 0, c; c = rec.removedNodes[i]; ++i) { - if (!(c instanceof Element)) { - continue; - } else if (c.localName === 'dialog') { - removed.push(c); - } - removed = removed.concat(c.querySelectorAll('dialog')); - } - }); - removed.length && checkDOM(removed); - }); - } - }; - - /** - * Called on the first modal dialog being shown. Adds the overlay and related - * handlers. - */ - dialogPolyfill.DialogManager.prototype.blockDocument = function() { - document.documentElement.addEventListener('focus', this.handleFocus_, true); - document.addEventListener('keydown', this.handleKey_); - this.mo_ && this.mo_.observe(document, {childList: true, subtree: true}); - }; - - /** - * Called on the first modal dialog being removed, i.e., when no more modal - * dialogs are visible. - */ - dialogPolyfill.DialogManager.prototype.unblockDocument = function() { - document.documentElement.removeEventListener('focus', this.handleFocus_, true); - document.removeEventListener('keydown', this.handleKey_); - this.mo_ && this.mo_.disconnect(); - }; - - /** - * Updates the stacking of all known dialogs. - */ - dialogPolyfill.DialogManager.prototype.updateStacking = function() { - var zIndex = this.zIndexHigh_; - - for (var i = 0, dpi; dpi = this.pendingDialogStack[i]; ++i) { - dpi.updateZIndex(--zIndex, --zIndex); - if (i === 0) { - this.overlay.style.zIndex = --zIndex; - } - } - - // Make the overlay a sibling of the dialog itself. - var last = this.pendingDialogStack[0]; - if (last) { - var p = last.dialog.parentNode || document.body; - p.appendChild(this.overlay); - } else if (this.overlay.parentNode) { - this.overlay.parentNode.removeChild(this.overlay); - } - }; - - /** - * @param {Element} candidate to check if contained or is the top-most modal dialog - * @return {boolean} whether candidate is contained in top dialog - */ - dialogPolyfill.DialogManager.prototype.containedByTopDialog_ = function(candidate) { - while (candidate = findNearestDialog(candidate)) { - for (var i = 0, dpi; dpi = this.pendingDialogStack[i]; ++i) { - if (dpi.dialog === candidate) { - return i === 0; // only valid if top-most - } - } - candidate = candidate.parentElement; - } - return false; - }; - - dialogPolyfill.DialogManager.prototype.handleFocus_ = function(event) { - if (this.containedByTopDialog_(event.target)) { return; } - - event.preventDefault(); - event.stopPropagation(); - safeBlur(/** @type {Element} */ (event.target)); - - if (this.forwardTab_ === undefined) { return; } // move focus only from a tab key - - var dpi = this.pendingDialogStack[0]; - var dialog = dpi.dialog; - var position = dialog.compareDocumentPosition(event.target); - if (position & Node.DOCUMENT_POSITION_PRECEDING) { - if (this.forwardTab_) { // forward - dpi.focus_(); - } else { // backwards - document.documentElement.focus(); - } - } else { - // TODO: Focus after the dialog, is ignored. - } - - return false; - }; - - dialogPolyfill.DialogManager.prototype.handleKey_ = function(event) { - this.forwardTab_ = undefined; - if (event.keyCode === 27) { - event.preventDefault(); - event.stopPropagation(); - var cancelEvent = new supportCustomEvent('cancel', { - bubbles: false, - cancelable: true - }); - var dpi = this.pendingDialogStack[0]; - if (dpi && dpi.dialog.dispatchEvent(cancelEvent)) { - dpi.dialog.close(); - } - } else if (event.keyCode === 9) { - this.forwardTab_ = !event.shiftKey; - } - }; - - /** - * Finds and downgrades any known modal dialogs that are no longer displayed. Dialogs that are - * removed and immediately readded don't stay modal, they become normal. - * - * @param {!Array} removed that have definitely been removed - */ - dialogPolyfill.DialogManager.prototype.checkDOM_ = function(removed) { - // This operates on a clone because it may cause it to change. Each change also calls - // updateStacking, which only actually needs to happen once. But who removes many modal dialogs - // at a time?! - var clone = this.pendingDialogStack.slice(); - clone.forEach(function(dpi) { - if (removed.indexOf(dpi.dialog) !== -1) { - dpi.downgradeModal(); - } else { - dpi.maybeHideModal(); - } - }); - }; - - /** - * @param {!dialogPolyfillInfo} dpi - * @return {boolean} whether the dialog was allowed - */ - dialogPolyfill.DialogManager.prototype.pushDialog = function(dpi) { - var allowed = (this.zIndexHigh_ - this.zIndexLow_) / 2 - 1; - if (this.pendingDialogStack.length >= allowed) { - return false; - } - if (this.pendingDialogStack.unshift(dpi) === 1) { - this.blockDocument(); - } - this.updateStacking(); - return true; - }; - - /** - * @param {!dialogPolyfillInfo} dpi - */ - dialogPolyfill.DialogManager.prototype.removeDialog = function(dpi) { - var index = this.pendingDialogStack.indexOf(dpi); - if (index === -1) { return; } - - this.pendingDialogStack.splice(index, 1); - if (this.pendingDialogStack.length === 0) { - this.unblockDocument(); - } - this.updateStacking(); - }; - - dialogPolyfill.dm = new dialogPolyfill.DialogManager(); - dialogPolyfill.formSubmitter = null; - dialogPolyfill.useValue = null; - - /** - * Installs global handlers, such as click listers and native method overrides. These are needed - * even if a no dialog is registered, as they deal with
. - */ - if (window.HTMLDialogElement === undefined) { - - /** - * If HTMLFormElement translates method="DIALOG" into 'get', then replace the descriptor with - * one that returns the correct value. - */ - var testForm = document.createElement('form'); - testForm.setAttribute('method', 'dialog'); - if (testForm.method !== 'dialog') { - var methodDescriptor = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, 'method'); - if (methodDescriptor) { - // TODO: older iOS and older PhantomJS fail to return the descriptor here - var realGet = methodDescriptor.get; - methodDescriptor.get = function() { - if (isFormMethodDialog(this)) { - return 'dialog'; - } - return realGet.call(this); - }; - var realSet = methodDescriptor.set; - methodDescriptor.set = function(v) { - if (typeof v === 'string' && v.toLowerCase() === 'dialog') { - return this.setAttribute('method', v); - } - return realSet.call(this, v); - }; - Object.defineProperty(HTMLFormElement.prototype, 'method', methodDescriptor); - } - } - - /** - * Global 'click' handler, to capture the or