diff --git a/_site/2017/05/25/post63.html b/_site/2017/05/25/post63.html new file mode 100644 index 00000000..b8cdc4ba --- /dev/null +++ b/_site/2017/05/25/post63.html @@ -0,0 +1,357 @@ + + + + + + + + +Site tags | Blockstack + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+ + + + +
+
+
+ +

Site tags

+ + + +
+ +

http://localhost:4000/assets/posts/

+ +

/2017/05/25/post63.html

+ +

Musce libero nunc, dignissim quis turpis quis, semper vehicula dolor. Suspendisse tincidunt consequat quam, ac posuere leo dapibus id. Cras fringilla convallis elit, at eleifend mi interam.

+ +

Nulla non sollicitudin. Morbi sit amet laoreet ipsum, vel pretium mi. Morbi varius, tellus in accumsan blandit, elit ligula eleifend velit, luctus mattis ante nulla condimentum nulla. Etiam vestibulum risus vel arcu elementum eleifend. Cras at dolor eget urna varius faucibus tempus in elit.

+ +

Image Lightbox Example

+

Nunc porta malesuada porta. Etiam tristique vestibulum dolor at ultricies. Proin hendrerit sapien sed erat fermentum, at commodo velit consectetur.

+ +
+ + + + Alt for image +
+ +
+
+
Image in lightbox
+
+ +

Etiam vestibulum risus vel arcu elementum eleifend. Cras at dolor eget urna varius faucibus tempus in elit. Cras a dui imperdiet, tempus metus quis, pharetra turpis. Phasellus at massa sit amet ante semper fermentum sed eget lectus. Quisque id dictum magna, et dapibus turpis.

+ +

Example Of Code Block

+

In accumsan lacus ac neque maximus dictum. Phasellus eleifend leo id mattis bibendum. Curabitur et purus turpis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;

+ +
<head>
+  <meta charset="utf-8">
+  <meta http-equiv="X-UA-Compatible" content="IE=edge">
+  <meta name="viewport" content="width=device-width, initial-scale=1">
+  <link rel="stylesheet" href="/assets/css/main.css">
+  <link rel="shortcut icon" type="image/png" href="/assets/img/favicon.png" >
+  <script src="/assets/js/main.js"></script>
+</head>
+
+
+ +

Text and Quote

+

Cras at dolor eget urna varius faucibus tempus in elit. Cras a dui imperdiet, tempus metus quis, pharetra turpis. Phasellus at massa sit amet ante semper fermentum sed eget lectus. Quisque id dictum magna turpis.

+ +
+

Etiam vestibulum risus vel arcu elementum eleifend. Cras at dolor eget urna varius faucibus tempus in elit. Cras a dui imperdiet

+
+ +

In accumsan lacus ac neque maximus dictum. Phasellus eleifend leo id mattis bibendum. Curabitur et purus turpis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;

+ +

Etiam in fermentum mi. Sed et tempor felis, eu aliquet nisi. Nam eget ullamcorper arcu. Nunc porttitor nisl a dolor blandit, eget consequat sem maximus. Phasellus lacinia quam porta orci malesuada, vel tincidunt.

+ + + +
+ +
+ +
+
+
+ +
+
+ +
+
+
+ + + +
+ + + +
+
+ + +
+
+ + + + + + + +
+
+ + + + + + + + + + + + + + diff --git a/_site/404.html b/_site/404.html new file mode 100644 index 00000000..cec4df66 --- /dev/null +++ b/_site/404.html @@ -0,0 +1,264 @@ + + + + + + + + +Feeling Lost | Blockstack + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+ + + + +
+
+ +
+ +

Feeling Lost

+ +
+

The page you are looking for cannot be found. Please navigate to homepage.

+ +
+ +
+ +
+
+ + +
+
+ + + + + + + +
+
+ + + + + + + + + + + + + + diff --git a/_site/README.md b/_site/README.md new file mode 100644 index 00000000..0f4a93e4 --- /dev/null +++ b/_site/README.md @@ -0,0 +1,351 @@ +# Docs is a premium documentation Jekyll theme + +Desk was developed by [Ivan Chromjak](https://ivanchromjak.com) for [jekyll.plus](https://jekyll.plus/), theme [live demo](https://docs.jekyll.plus/) available. + +## Features + +* Contact form +* Live Search +* Responsive videos +* Image lightbox +* Google maps +* Github avatar +* Changelog page +* Contact form (FormSpree) +* Pre-built pages +* Disqus comments for posts +* Configurable home page header images +* Optimised for [GitHub](https://pages.github.com/) pages +* RSS feed +* SEO tags +* Google Analytics + + +## Installation + +Install the dependencies with [Bundler](http://bundler.io/): + +```bash +bundle install +``` + +Run the following to generate your site: +```bash +bundle exec jekyll serve +``` + +You can find more on [Deployment Methods](https://jekyllrb.com/docs/deployment-methods/) page on Jekyll website. + +## Setup + +### Site and author details +Add your site and author details in `_config.yml`: +```yaml +# Site title and description +title: Docs - Documentation Jekyll Theme +description: Documentation Jekyll theme. + +# Site base hostname & protocol, e.g. http://example.com +url: "https://docs.jekyll.plus" + +# Site logo, image or text +brand: + image: touch-icon.svg # e.g. logo.png, upload logo image file to /assets/img/ folder + text: Docs # if the above "logo:" image variable is not set, this text logo is displayed instead + +# Default author settings +author: + name: John Smith + github: PressApps # Github username for avatar + +# Author settings, displayed on post and doc pages if front matter references author name e.g. author: peter +authors: + peter: + name: Peter Brown + github: PressApps # Github username for avatar + +# Social icons displayed in footer +social: + email: + website: + facebook: https://www.facebook.com/ + flickr: + dribbble: + github: + googleplus: + instagram: https://www.instagram.com/ + linkedin: + pinterest: + twitter: https://twitter.com/ + vimeo: https://vimeo.com/ + youtube: + +# Twitter share button +twitter_username: + +``` + +### Navigation Bar +Set in the main navigation links in `_data/navigation_header.yml`: +```yaml +- title: About + url: /about/ +``` + +### Footer + +Edit copyright notice in `_config.yml`: +```yaml +footer: + copyright: +``` + +Set in the navigation links in `_data/navigation_footer.yml`: +```yaml +- title: About + url: /about/ +``` + +### Enabling comments (via Disqus) + +Optionally, if you have a Disqus account, you can tell Jekyll to use it to show a comments section below each post. To enable it, add the following lines to your Jekyll site: + +```yaml +disqus: + shortname: my_disqus_shortname +``` + +You can find out more about Disqus' shortnames [here](https://help.disqus.com/customer/portal/articles/466208). + +Comments are enabled by default and will only appear in production, i.e., `JEKYLL_ENV=production`. If you don't want to display comments for a particular post you can disable them by adding `comments: false` to that post's YAML Front Matter. + +### Google Analytics + +To enable Google Anaytics, add the following lines to your Jekyll site: + +```yaml + google_analytics: UA-NNNNNNNN-N +``` + +Google Analytics will only appear in production, i.e., `JEKYLL_ENV=production` + +### Google Map + +To display Google map on contact page, add the following in your page content, replacing latitude, longitude and zoom values: + +```yaml +{% include map.html latitude="40.6700" longitude="-73.9400" zoom="16" %} +``` + +### Contact Form (via FormSpree) + +Submit the form and confirm your email address at [FormSpree](https://formspree.io/). Then add the following lines to contact page YAML Front Matter, replacing the email address: + +```yaml +formspree: + email: my_name@gmail.com + redirect: /thanks/ +``` + +### Update favicon + +You can find the current favicon (favicon.png) inside the theme `/assets/img/` directory, just replace it with your new favicon. + +## Posts + +To create a new post, you can create a new markdown file inside the `_posts` directory by following the recommended file naming format: +``` +YEAR-MONTH-DAY-title.MARKUP +``` +Where `YEAR` is a four-digit number, `MONTH` and `DAY` are both two-digit numbers, and `MARKUP` is the file extension representing the format used in the file. For example, the following are examples of valid post filenames: + +``` +2011-12-31-new-years-eve-is-awesome.md +2012-09-12-how-to-write-a-blog.md +``` + +Post requires front matter, everything in between the first and second --- are part of the YAML Front Matter, and everything after the second --- will be rendered with Markdown and show up as “Content”. +The following is a post file with different configurations you can add as example: + +```yaml +--- +layout: post +title: How To Travel On Low Budget +--- +``` + +You can rebuild the site in many different ways, but the most common way is to run `bundle exec jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated. + +To keep things more organized, add post images to `/assets/posts/` directory, and add theme images to `/assets/img/` directory. + +### Adding images +To add an image to a post or page use the following codes: +Local image from `/assets/posts/` directory: +```yaml +{% include image.html img="girl.jpg" alt="Alt for image" caption="Girl on a rock" %} +``` +External wide image with lightbox: +```yaml +{% include image.html img="https://source.unsplash.com/TT-ROxWj9nA.jpg" lightbox="true" alt="Alt for image" caption="Image in lightbox" %} +``` + +### Adding table of contents +Add the following code at the top of the post: +``` +#### Sections in this article +{:.no_toc} +* TOC +{:toc} +``` +`{:.no_toc}` excludes the `#### Sections in this article` title from indexing in table of contents + +### Responsive Videos +Embed local videos: +```html + +``` +Embed YouTube videos: +```html + +``` + +To create a draft post, create the post file under the `_drafts` directory, and you can find more information in [Working with Drafts](https://jekyllrb.com/docs/drafts/). + +## Home Page + +To create a home page, just create a `index.md` file inside the root directory. The following is a YAML Front Matter example for a page: + +```yaml +--- +layout: home +hero: + title: How Can We Help? # hero section settings + subtitle: Search or browse in depth articles and videos on everything Jekyll, from basic theme setup and hosting to customisation and development + image: imac.svg # display small image above title + search: true # enable search +categories: + columns: 3 # number of category columns; 1, 2, 3, 4 + title: Browse Topics + subtitle: Get your answers fast, jump to most popular documentation content +featured: # featured docs section settings + title: Popular Articles + tag: featured # tag used to populate featured section on home page +section: # display page content + title: Need More? + subtitle: This section displays optional page content lorem ipsum +cta: # call to action section + title: Didn't find an answer to your question? + subtitle: Get in touch with us for details on additional services and custom work pricing + button_text: Contact Us + button_url: /contact/ +--- +``` + +Home page category boxes are added in `_data/navigation_home.yml`, e.g.: +```yml +- title: Getting Started + desc: Get your account up and running in just few easy steps + icon: settings + doc: usage + +- title: Account and Billing + desc: Managing your account, creating new users and exporting data + icon: credit-card + doc: drafts +``` + +All available icons can be found [here](https://getuikit.com/docs/icon#library). + +## Docs + +To create a document post, just create a new page inside the root directory and add the following code in content: +``` +{% include faqs.html %} +``` + +Create new doc post entries in `_docs` folder, similar to creating posts, but with following front matter settings: + +```yml +--- +layout: doc +title: Category hosting Setting up new domain and page +subtitle: This is optional doc subtitle +tags: featured development +author: peter +--- +``` + +Sidebar navigation on docs post can edited in `_data/navigation_docs.yml`: + +```yml +- title: Getting Started # Section title + docs: + - home # Doc file name from _docs folder + - quickstart + - installation + - windows +``` + +## Changelog page + +Create new page with the following front matter: + +```yml +--- +layout: changelog +title: Changelog +permalink: /changelog/ +--- +``` + +Changelog enties are added in `_data/changelog.yml`: + +```yml +- title: Version 0.6.0 + label: + date: Aug 15, 2017 + list: + - Added style support for radio and checkbox in Firefox + - Removed class from Section component +``` + + +## Customization + +To modify the primary color, open `/_sass/theme/variables.scss` and replace the color values e.g.: + +```scss +// Main content +$color-main: #0F1214; +``` + +Further style customisation can be done in the following files: +``` +/_sass/theme/mixins.scss +/_sass/theme/variables.scss +/assets/css/main.scss +``` + +## Development + +Install [UIkit](https://getuikit.com/) font end framework dependency via Npm: +```bash +npm install +``` +Enable live browser reload with the following: +```bash +bundle exec jekyll s --livereload +``` + +## Credits and Sources + +- Google analytics https://www.google.com/analytics/ +- Google maps https://www.google.com/maps +- UIkit front end framework https://getuikit.com/ +- Jekyll CML https://jekyllrb.com/ + +## Support +Customer support is provided through our Envato profile page [contact form](https://themeforest.net/user/pressapps) for up to six months from the purchase date and is provided Monday to Friday during the business week. We aim to answer all support requests daily, most are handled within 48h. diff --git a/_site/android/images/app-flow.png b/_site/android/images/app-flow.png new file mode 100644 index 00000000..fa8b85a3 Binary files /dev/null and b/_site/android/images/app-flow.png differ diff --git a/_site/android/images/blockstack-install.png b/_site/android/images/blockstack-install.png new file mode 100644 index 00000000..5e4d6256 Binary files /dev/null and b/_site/android/images/blockstack-install.png differ diff --git a/_site/android/images/blockstack-signin.png b/_site/android/images/blockstack-signin.png new file mode 100644 index 00000000..081d5050 Binary files /dev/null and b/_site/android/images/blockstack-signin.png differ diff --git a/_site/android/images/chrome-prompt.png b/_site/android/images/chrome-prompt.png new file mode 100644 index 00000000..f60822ab Binary files /dev/null and b/_site/android/images/chrome-prompt.png differ diff --git a/_site/android/images/configure-activity.png b/_site/android/images/configure-activity.png new file mode 100644 index 00000000..1be7edf5 Binary files /dev/null and b/_site/android/images/configure-activity.png differ diff --git a/_site/android/images/create-restore.png b/_site/android/images/create-restore.png new file mode 100644 index 00000000..914b26e5 Binary files /dev/null and b/_site/android/images/create-restore.png differ diff --git a/_site/android/images/final-app.png b/_site/android/images/final-app.png new file mode 100644 index 00000000..01f62b83 Binary files /dev/null and b/_site/android/images/final-app.png differ diff --git a/_site/android/images/hello-andriod-1.png b/_site/android/images/hello-andriod-1.png new file mode 100644 index 00000000..c3680a2d Binary files /dev/null and b/_site/android/images/hello-andriod-1.png differ diff --git a/_site/android/images/initial-build.png b/_site/android/images/initial-build.png new file mode 100644 index 00000000..601f3e8a Binary files /dev/null and b/_site/android/images/initial-build.png differ diff --git a/_site/android/images/new-interface.png b/_site/android/images/new-interface.png new file mode 100644 index 00000000..d434f9bb Binary files /dev/null and b/_site/android/images/new-interface.png differ diff --git a/_site/android/images/oreo-api.png b/_site/android/images/oreo-api.png new file mode 100644 index 00000000..1de35691 Binary files /dev/null and b/_site/android/images/oreo-api.png differ diff --git a/_site/android/images/running-app.png b/_site/android/images/running-app.png new file mode 100644 index 00000000..9838c05f Binary files /dev/null and b/_site/android/images/running-app.png differ diff --git a/_site/android/images/select-hdw.png b/_site/android/images/select-hdw.png new file mode 100644 index 00000000..2eaccb4f Binary files /dev/null and b/_site/android/images/select-hdw.png differ diff --git a/_site/android/images/studio-download.png b/_site/android/images/studio-download.png new file mode 100644 index 00000000..8dc73142 Binary files /dev/null and b/_site/android/images/studio-download.png differ diff --git a/_site/android/images/sync-project.png b/_site/android/images/sync-project.png new file mode 100644 index 00000000..b5e5c141 Binary files /dev/null and b/_site/android/images/sync-project.png differ diff --git a/_site/android/images/sync-success.png b/_site/android/images/sync-success.png new file mode 100644 index 00000000..62ae3f5d Binary files /dev/null and b/_site/android/images/sync-success.png differ diff --git a/_site/android/tutorial.html b/_site/android/tutorial.html new file mode 100644 index 00000000..e4be7127 --- /dev/null +++ b/_site/android/tutorial.html @@ -0,0 +1,1232 @@ + + + + + + + + +Blockstack Android SDK Tutorial (Pre-release) | Blockstack + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+ + + + +
+
+
+ + + +
+ +
+ +

Blockstack Android SDK Tutorial (Pre-release)

+ + + + + +
+ +

This tutorial is written for readers who are new to either or both Blockstack +and Android to create a decentralized application. It contains the following +content:

+ + + +

This tutorial was extensively tested using Android Studio 3.1 on a MacBook Air +running High Sierra 10.13.4. If your environment is different, you may encounter +slight or even major discrepancies when performing the procedures in this +tutorial. Please join the Blockstack community +Slack and post questions or comments to +the #support channel.

+ +

Finally, this tutorial is written for all levels from the beginner to the most +experienced. For best results, beginners should follow the guide as written. It +is expected that the fast or furiously brilliant will skip ahead and improvise +on this material at will. Fair journey one and all.

+ +

If you prefer, you can skip working through the tutorial all together. Instead, +you can download the final project code and import it +into Android Studio to review it.

+ +

Understand the sample application flow

+ +

When complete, the sample application is a simple hello-world display. It is +intended for user on an Android phone.

+ +

+ +

Only users with an existing blockstack.id can run your +final sample application. When complete, users interact with the sample +application by doing the following:

+ +

+ +

Set up your environment

+ +

This sample application has two code bases, a BlockStack hello-blockstack +application and a hello-andriod Android application. Before you start +developing the sample, there are a few elements you need in your environment.

+ +

Install Android Studio

+ +

If you are an experienced Android developer and already have an Android +development environment on your workstation, you can use that and skip this +step. However, you will need to adjust the remaining instructions for your +environment.

+ +

Follow the installation instructions to download and Android Studio +3.1 for your operating system. +Depending on your network connection, this can take between 15-30 minutes.

+ +

+ +

Do you have npm?

+ +

The Blockstack code in this tutorial relies on the npm dependency manager. +Before you begin, verify you have installed npm using the which command to +verify.

+ +
$ which npm
+/usr/local/bin/npm
+
+
+ +

If you don’t find npm in your system, install +it.

+ +

Install the Blockstack test rig

+ +

Users interact with Blockstack-enabled applications through a web browser. You +can BlockStack in test mode, on localhost or you can interact with completed +apps through the Blockstack webapp which is available at +[https://browser.blockstack.org/].

+ +

If you have already installed Blockstack for testing locally and have an +existing Blockstack ID, skip this section. Otherwise, continue onto install +BlockStack.

+ +
    +
  1. +

    Go to Blockstack

    + +

    +
  2. +
  3. +

    Install the version appropriate for your operating system.

    +
  4. +
+ +

Use npm to install Yeoman and the Blockstack App Generator

+ +

You use npm to install Yeoman. Yeoman is a generic scaffolding system that +helps users rapidly start new projects and streamline the maintenance of +existing projects.

+ +
    +
  1. +

    Install Yeoman.

    + +
     npm install -g yo
    +
    +
    +
  2. +
  3. +

    Install the Blockstack application generator.

    + +
     npm install -g generator-blockstack
    +
    +
    +
  4. +
+ +

Build the Blockstack hello-world

+ +

In this section, you build a Blockstack hello-world application. Then, you +modify the hello-world to interact with the Android app via a redirect.

+ +

Generate and launch your hello-blockstack application

+ +

In this section, you build an initial React.js application called +hello-blockstack.

+ +
    +
  1. +

    Create a hello-blockstack directory.

    + +
     mkdir hello-blockstack
    +
    +
    +
  2. +
  3. +

    Change into your new directory.

    + +
     cd hello-blockstack
    +
    +
    +
  4. +
  5. +

    Use Yeoman and the Blockstack application generator to create your initial hello-blockstack application.

    + +
     yo blockstack:react
    +
    +
    + +

    You should see several interactive prompts.

    + +
     $ yo blockstack:react
    + ==========================================================================
    + We are constantly looking for ways to make yo better!
    + May we anonymously report usage statistics to improve the tool over time?
    + More info: https://github.com/yeoman/insight & http://yeoman.io
    + ========================================================================== No
    +
    +      _-----_     ╭──────────────────────────╮
    +     |       |    │      Welcome to the      │
    +     |--(o)--|    │      Blockstack app      │
    +     ---------    │        generator!        │
    +     ( _U_ )      ╰──────────────────────────╯
    +     /___A___\   /
    +      |  ~  |
    +    __'.___.'__
    +         |°  Y
    +
    + ? Are you ready to build a Blockstack app in React? (Y/n)
    +
    +
    +
  6. +
  7. +

    Respond to the prompts to populate the initial app.

    + +

    After the process completes successfully, you see a prompt similar to the following:

    + +
     [fsevents] Success:
    + "/Users/theuser/repos/hello-blockstack/node_modules/fsevents/lib/binding/Release/node-v59-darwin-x64/fse.node"
    + is installed via remote npm notice created a lockfile as package-lock.json.
    + You should commit this file. added 1060 packages in 26.901s
    +
    +
    +
  8. +
  9. +

    Run the initial application.

    + +
     $ npm start
    +
    + > hello-blockstack@0.0.0 start /Users/moxiegirl/repos/hello-blockstack
    + > webpack-dev-server
    +
    + Project is running at http://localhost:8080/
    + webpack output is served from /
    + 404s will fallback to /index.html
    + Hash: 4d2312ba236a4b95dc3a
    + Version: webpack 2.7.0
    + Time: 2969ms
    +                                  Asset       Size  Chunks                    Chunk Names
    + ....
    +   Child html-webpack-plugin for "index.html":
    +      chunk    {0} index.html 541 kB [entry] [rendered]
    +          [0] ./~/lodash/lodash.js 540 kB {0} [built]
    +          [1] ./~/html-webpack-plugin/lib/loader.js!./src/index.html 533 bytes {0} [built]
    +          [2] (webpack)/buildin/global.js 509 bytes {0} [built]
    +          [3] (webpack)/buildin/module.js 517 bytes {0} [built]
    +  webpack: Compiled successfully.
    +
    +
    + +

    The system opens a browser displaying your running application.

    + +

    + +

    At this point, the browser is running a Blockstack server on your local host. +This is for testing your applications only.

    +
  10. +
  11. +

    Choose Sign in with Blockstack

    + +

    The system displays a prompt allowing you to create a new Blockstack ID or restore an existing one.

    + +

    +
  12. +
  13. +

    Follow the prompts appropriate to your situation.

    + +

    If you are restoring an existing ID, you may see a prompt about your user + being nameless, ignore it. At this point you have only a single application + on your test server. So, you should see this single application, with your + own blockstack.id display name, once you are signed in:

    + +

    +
  14. +
+ +

Add a redirect end point to your application

+ +

When a user opens the webapp from the Blockstack browser on an Android phone, +you want the web app to redirect the user to your Android application. The work +you do here will allow it.

+ +
    +
  1. +

    From the terminal command line, change directory to the root of your sample +application directory.

    +
  2. +
  3. +

    Use the touch command to add a redirect endpoint to your application.

    + +

    This endpoint on the web version of your app will redirect Android users back + to your mobile app.

    + +
     $ touch public/redirect.html
    +
    +
    +
  4. +
  5. +

    Open redirect.html and add code to the endpoint.

    + +
     <!DOCTYPE html>
    + <html>
    + <head>
    +   <title>Hello, Blockstack!</title>
    +   <script>
    +   function getParameterByName(name) {
    +     var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
    +     return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
    +   }
    +
    +   var authResponse = getParameterByName('authResponse')
    +   window.location="myblockstackapp:" + authResponse
    +   </script>
    + <body>
    + </body>
    + </html>
    +
    +
    + +

    Blockstack apps are identified by their domain names. The endpoint will + receive a get request with the query parameter authResponse=XXXX and + should redirect the browser to myblockstackapp:XXXX.

    + +

    myblockstackapp: is custom protocol handler. The handler should be unique + to your application. Your app’s web-based authentication uses this handler + to redirect the user back to your Android app. Later, you’ll add a reference + to this handler in your Android application.

    +
  6. +
  7. Close and save the redirect.html file.
  8. +
  9. Ensure your Blockstack compiles successfully.
  10. +
+ +

Create the hello-android project

+ +

In this section, you’ll create an Android application in Android Studio. You’ll +run the application in the emulator to test it.

+ +

Create a simple project

+ +

In this section, you create an inital project. You’ll validate the application’s +iniatial state by creating an emulator to run it in. Open Android Studio and do the following:

+ +
    +
  1. +

    Open Android Studio and choose Start a new Andriod Studio project.

    + +

    If studio is already started, choose File > New > New Project.

    +
  2. +
  3. +

    Enter these fields in the Create Android Project page.

    + + + + + + + + + + + + + + + + + + +
    Application Namehello-android
    Company domainUSERNAME.example.com
    Project location/Users/USERNAME/AndroidStudioProjects/helloandroid
    Include Kotlin supportSet (checked)
    +
  4. +
  5. Press Next to display Target Android Devices.
  6. +
  7. Check Phone and Tablet.
  8. +
  9. Choose API 27: Andriod 8.1 (Oreo) for the target version.
  10. +
  11. Press Next.
  12. +
  13. Choose Empty Activity and press Next.
  14. +
  15. +

    Leave the Configure Activity dialog with its defaults.

    + +

    +
  16. +
  17. +

    Press Finish.

    + +

    Android studio builds your initial project. This can take a bit the first time you do it.

    + +

    +
  18. +
+ +

Run the app in an emulator

+ +

In this section, you run the appliation and create an emulator when prompted.

+ +
    +
  1. +

    Once the project is imported into studio, click the app module in the Project window.

    +
  2. +
  3. +

    Then, select Run > Run (or click the green arrow in the toolbar).

    + +

    Studio prompts you to Select Deployment Target.

    +
  4. +
  5. +

    Choose Create New Virtual Device and press OK.

    + +

    Studio prompts you to Select Hardware.

    +
  6. +
  7. +

    Choose a Phone running Pixel XL.

    + +

    + +

    Studio prompts you for a system image.

    +
  8. +
  9. +

    Choose Oreo which is API level 27 and press Next.

    + +

    + +

    Studio asks you to verify your new emulator configuration.

    +
  10. +
  11. +

    Press Finish.

    + +

    The emulation takes a moment to build. Then, studio launches the emulation and opens your application.

    + +

    +
  12. +
+ +

Configure your application with the Blockstack SDK

+ +

Now that you have created your initial project and verified it running in an emulator, you are ready to begin configuring the application for use with Blockstack.

+ +
    +
  1. In studio, open the AndroidManifest.xml file.
  2. +
  3. +

    Add an <intent-filter> with the custom handler for Blockstack.

    + +
     <intent-filter>
    +   <action android:name="android.intent.action.VIEW" />
    +   <category android:name="android.intent.category.DEFAULT" />
    +   <category android:name="android.intent.category.BROWSABLE" />
    +   <data android:scheme="myblockstackapp" />
    +  </intent-filter>
    +
    +
  4. +
  5. Open the Project’s build.gradle file.
  6. +
  7. +

    Add the Jitpack repository maven { url 'https://jitpack.io' } to the repositories section.

    + +

    When you finish, that section looks like this:

    + +
     allprojects {
    +   repositories {
    +       google()
    +       jcenter()
    +       maven { url 'https://jitpack.io' }
    +   }
    + }
    +
    +
  8. +
  9. Open the Module build.gradle file.
  10. +
  11. +

    Set the defaultConfig minSdkVersion to 19.

    + +

    When you are done, you should see (within your own username not moxiegirl):

    + +
    android {
    +    compileSdkVersion 27
    +        defaultConfig {
    +            applicationId "com.example.moxiegirl.hello_android"
    +            minSdkVersion 19
    +            targetSdkVersion 27
    +            versionCode 1
    +            versionName "1.0"
    +            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    +        }
    +   ...
    +}
    +
    +
  12. +
  13. +

    Below this, add the Blockstack Android SDK dependency to your project’s dependencies list:

    + +

    When you are done you should see:

    + +
     dependencies {
    +     implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    +     implementation 'com.android.support:appcompat-v7:27.1.0'
    +     implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    +     testImplementation 'junit:junit:4.12'
    +     androidTestImplementation 'com.android.support.test:runner:1.0.2'
    +     androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    +     implementation 'com.github.blockstack:blockstack-android:0.3.0'
    + }
    +
    +
    + +

    NOTE: Ignore the warning on the appcompat` dependencies.

    +
  14. +
  15. +

    Sync your project.

    + +

    + +

    Be sure to check the sync completed successfully.

    + +

    +
  16. +
  17. +

    Run your app in the emulator.

    + +

    You’ve made a lot of changes, make sure the emulator is still running +correctly.

    +
  18. +
+ +

Add a simple interface

+ +
    +
  1. +

    Open the app/res/layout/activity_main.xml file.

    + +

    The activity_main.xml file defines the graphical elements. Some elements are required before you can functionality to your MainActivity.kt code.

    +
  2. +
  3. +

    Replace the entire content of the file with the following code:

    + +

    The new interface includes a BlockstackSignInButton which is provided by +the SDK. This SDK includes a themed “Sign in with Blockstack” button +(BlockstackSignInButton). You use this button in your here with the +org.blockstack.android.sdk.ui.BlockstackSignInButton class.

    + +
     <?xml version="1.0" encoding="utf-8"?>
    + <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    + xmlns:app="http://schemas.android.com/apk/res-auto"
    + xmlns:tools="http://schemas.android.com/tools"
    + android:layout_width="match_parent"
    + android:layout_height="match_parent"
    + tools:context=".MainActivity">
    +
    + <org.blockstack.android.sdk.ui.BlockstackSignInButton
    +     android:id="@+id/signInButton"
    +     android:layout_width="307dp"
    +     android:layout_height="45dp"
    +     android:layout_margin="4dp"
    +     android:layout_marginEnd="185dp"
    +     android:layout_marginStart="39dp"
    +     app:layout_constraintEnd_toEndOf="parent"
    +     app:layout_constraintStart_toStartOf="parent"
    +     tools:layout_editor_absoluteY="16dp" />
    +
    + <TextView
    +     android:id="@+id/userDataTextView"
    +     android:layout_width="370dp"
    +     android:layout_height="27dp"
    +     tools:layout_editor_absoluteX="6dp"
    +     tools:layout_editor_absoluteY="70dp" />
    +
    + </android
    +
    + +

    This codes adds a button and some text to your application.

    +
  4. +
  5. +

    Choose Run > Apply changes.

    +
  6. +
  7. +

    Choose Run > Run app in the emulator.

    + +

    The emulator now contains a new interface with a button:

    + +

    +
  8. +
+ +

Add session & authentication code

+ +
    +
  1. Open the MainActivity.kt file.
  2. +
  3. +

    Add some additional imports to the top below the android.os.Bundle import.

    + +

    When you are done, your imports should appear as follows:

    + +
    
    + import android.support.v7.app.AppCompatActivity
    + import android.os.Bundle
    +
    + import android.support.v7.app.AppCompatActivity
    + import android.view.View
    + import kotlinx.android.synthetic.main.activity_main.*
    + import org.blockstack.android.sdk.BlockstackSession
    + import org.blockstack.android.sdk.Scope
    + import org.blockstack.android.sdk.UserData
    + import java.net.URI
    +
    +
    +
  4. +
  5. +

    Add a variable for the Blockstack session before onCreate.

    + +
    class MainActivity : AppCompatActivity() {
    +
    + private var _blockstackSession: BlockstackSession? = null
    +
    +
    + override fun onCreate(savedInstanceState: Bundle?) {
    +     super.onCreate(savedInstanceState)
    +     setContentView(R.layout.activity_main)
    +   }
    + }
    +
    +
    +
  6. +
  7. +

    Replae the existing the onCreate function with the following:

    + +
     override fun onCreate(savedInstanceState: Bundle?) {
    +     super.onCreate(savedInstanceState)
    +     setContentView(R.layout.activity_main)
    +
    +     signInButton.isEnabled = false
    +
    +     val appDomain = URI("https://flamboyant-darwin-d11c17.netlify.com")
    +     val redirectURI = URI("${appDomain}/redirect")
    +     val manifestURI = URI("${appDomain}/manifest.json")
    +     val scopes = arrayOf(Scope.StoreWrite)
    +
    + val config = java.net.URI("https://flamboyant-darwin-d11c17.netlify.com").run {
    +         org.blockstack.android.sdk.BlockstackConfig(
    +                 this,
    +                 redirectURI,
    +                 manifestURI,
    +                 scopes
    +     }
    +
    +     _blockstackSession = BlockstackSession(this, config,
    +             onLoadedCallback = {
    +                 signInButton.isEnabled = true
    +             })
    +
    +
    +     signInButton.setOnClickListener { view: View ->
    +         blockstackSession().redirectUserToSignIn { userData ->
    +             if (userData.hasValue) {
    +                 runOnUiThread {
    +                     onSignIn(userData.value!!)
    +                 }
    +             }
    +         }
    +     }
    +     if (intent?.action == Intent.ACTION_VIEW) {
    +         // handle the redirect from sign in
    +         handleAuthResponse(intent)
    +     }
    + }
    +
    +
    + +

    This new onCreate does several things:

    + +
      +
    • Define the initial state for the signInButton.
    • +
    • Supply authentication information for connecting to your Blockstack app: appDomain, redirectURI, manifestURI and scopes
    • +
    • Add a listener for the button click.
    • +
    + +

    Notice that the application in this example is a URI you have not set up. + Registering and application name takes time, so in time’s interest you’ll + use an existing app that is identical to the hello-world you created + earlier. For a produciton verison, you’ll need to replace appDomain, + redirectURI, manifestURI and scopes with values appropriate for your + app.

    +
  8. +
  9. +

    Add a private function to reflect when a user successfully signs in.

    + +
     private fun onSignIn(userData: UserData) {
    + 		userDataTextView.text = "Signed in as ${userData.decentralizedID}"
    +
    + 		signInButton.isEnabled = false
    +
    + }
    +
    +
    +
  10. +
  11. +

    Handle sign in requests with an onNewIntent function if the activity was already opened when signing in

    + +

    Retrieve the authentication token from the custom protocol handler call and + send it to the Blockstack session.

    + +
     override fun onNewIntent(intent: Intent?) {
    +   super.onNewIntent(intent)
    +
    +   if (intent?.action == Intent.ACTION_VIEW) {
    +       handleAuthResponse(intent)
    +   }
    + }
    +
    +
    +
  12. +
  13. +

    Create a handler for the authentication response.

    + +
     private fun handleAuthResponse(intent: Intent) {
    +    val response = intent.dataString
    +    if (response != null) {
    +        val authResponseTokens = response.split(':')
    +
    +        if (authResponseTokens.size > 1) {
    +            val authResponse = authResponseTokens[1]
    +
    +            blockstackSession().handlePendingSignIn(authResponse, { userData ->
    +                if (userData.hasValue) {
    +                   // The user is now signed in!
    +                   runOnUiThread {
    +                      onSignIn(userData.value!!)
    +                   }
    +                }
    +            })
    +        }
    +    }
    + }
    +
    +
    +
  14. +
  15. +

    Add the convenience method to access the blockstack session.

    + +
     fun blockstackSession() : BlockstackSession {
    +   val session = _blockstackSession
    +    if(session != null) {
    +       return session
    +    } else {
    +     throw IllegalStateException("No session.")
    +   }
    + }
    +
    +
    +
  16. +
  17. +

    Verify your final MainActivity.kt code looks like this:

    + +
     class MainActivity : AppCompatActivity() {
    +
    +     private var _blockstackSession: BlockstackSession? = null
    +
    +
    +     override fun onCreate(savedInstanceState: Bundle?) {
    +         super.onCreate(savedInstanceState)
    +         setContentView(R.layout.activity_main)
    +
    +         signInButton.isEnabled = false
    +
    +         val appDomain = URI("https://flamboyant-darwin-d11c17.netlify.com")
    +         val redirectURI = URI("${appDomain}/redirect")
    +         val manifestURI = URI("${appDomain}/manifest.json")
    +         val scopes = arrayOf(Scope.StoreWrite)
    +
    +         _blockstackSession = BlockstackSession(this, appDomain, redirectURI, manifestURI, scopes,
    +                 onLoadedCallback = {signInButton.isEnabled = true
    +                 })
    +
    +
    +         signInButton.setOnClickListener { view: View ->
    +             blockstackSession().redirectUserToSignIn { userData ->
    +                 if (userData.hasValue) {
    +                     runOnUiThread {
    +                         onSignIn(userData)
    +                     }
    +                 }
    +             }
    +         }
    +         if (intent?.action == Intent.ACTION_VIEW) {
    +             handleAuthResponse(intent)
    +         }
    +     }
    +
    +     private fun onSignIn(userData: UserData) {
    +         userDataTextView.text = "Signed in as ${userData.decentralizedID}"
    +
    +         signInButton.isEnabled = false
    +
    +     }
    +
    +     override fun onNewIntent(intent: Intent?) {
    +         super.onNewIntent(intent)
    +
    +         if (intent?.action == Intent.ACTION_VIEW) {
    +             handleAuthResponse(intent)
    +         }
    +     }
    +
    +     private fun handleAuthResponse(intent: Intent) {
    +         val response = intent.dataString
    +         if (response != null) {
    +             val authResponseTokens = response.split(':')
    +
    +             if (authResponseTokens.size > 1) {
    +                 val authResponse = authResponseTokens[1]
    +
    +                 blockstackSession().handlePendingSignIn(authResponse, { userData ->
    +                     if (userData.hasValue) {
    +                         // The user is now signed in!
    +                         runOnUiThread {
    +                             onSignIn(userData.value!!)
    +                         }
    +                     }
    +                 })
    +             }
    +         }
    +     }
    +
    +     fun blockstackSession() : BlockstackSession {
    +         val session = _blockstackSession
    +         if(session != null) {
    +             return session
    +         } else {
    +             throw IllegalStateException("No session.")
    +         }
    +     }
    +
    +
    + }
    +
    +
    +
  18. +
+ +

Run the final app in the emulator

+ +
    +
  1. Choose Run > Apply changes.
  2. +
  3. Choose Run > Run app in the emulator.
  4. +
  5. +

    When you see the application open, choose Sign in with Blockstack.

    + +

    The system prompts you how to open.

    + +

    +
  6. +
  7. Choose Chrome and click ALWAYS.
  8. +
  9. +

    Move through the rest of the Chrome prompts.

    + +

    The system presents you with your final application.

    + +

    +
  10. +
  11. Work through the Blockstack prompts to login.
  12. +
+ +

Where to go next

+ +

Congratulations, you’ve completed your Android app using the new, pre-release +Blockstack Android SDK. Thank you for trying this pre-release. Please let us +know about your experience by tweeting to +@blockstack.

+ +

Learn more about Blockstack by trying another tutorial.

+ + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Related Articles

+ + + + + +
    + +
+
+ + + +
+ + + +
+ +
+
+ + +
+
+ + + + + + + +
+
+ + + + + + + + + + + + + + diff --git a/_site/assets/css/main.css b/_site/assets/css/main.css new file mode 100644 index 00000000..a7790286 --- /dev/null +++ b/_site/assets/css/main.css @@ -0,0 +1 @@ +/*! system-font.css v2.0.2 | CC0-1.0 License | github.com/jonathantneal/system-font-css */@font-face{font-family:system-ui;font-style:normal;font-weight:300;src:local(".SFNSText-Light"),local(".HelveticaNeueDeskInterface-Light"),local(".LucidaGrandeUI"),local("Segoe UI Light"),local("Ubuntu Light"),local("Roboto-Light"),local("DroidSans"),local("Tahoma")}@font-face{font-family:system-ui;font-style:italic;font-weight:300;src:local(".SFNSText-LightItalic"),local(".HelveticaNeueDeskInterface-Italic"),local(".LucidaGrandeUI"),local("Segoe UI Light Italic"),local("Ubuntu Light Italic"),local("Roboto-LightItalic"),local("DroidSans"),local("Tahoma")}@font-face{font-family:system-ui;font-style:normal;font-weight:400;src:local(".SFNSText-Regular"),local(".HelveticaNeueDeskInterface-Regular"),local(".LucidaGrandeUI"),local("Segoe UI"),local("Ubuntu"),local("Roboto-Regular"),local("DroidSans"),local("Tahoma")}@font-face{font-family:system-ui;font-style:italic;font-weight:400;src:local(".SFNSText-Italic"),local(".HelveticaNeueDeskInterface-Italic"),local(".LucidaGrandeUI"),local("Segoe UI Italic"),local("Ubuntu Italic"),local("Roboto-Italic"),local("DroidSans"),local("Tahoma")}@font-face{font-family:system-ui;font-style:normal;font-weight:500;src:local(".SFNSText-Medium"),local(".HelveticaNeueDeskInterface-MediumP4"),local(".LucidaGrandeUI"),local("Segoe UI Semibold"),local("Ubuntu Medium"),local("Roboto-Medium"),local("DroidSans-Bold"),local("Tahoma Bold")}@font-face{font-family:system-ui;font-style:italic;font-weight:500;src:local(".SFNSText-MediumItalic"),local(".HelveticaNeueDeskInterface-MediumItalicP4"),local(".LucidaGrandeUI"),local("Segoe UI Semibold Italic"),local("Ubuntu Medium Italic"),local("Roboto-MediumItalic"),local("DroidSans-Bold"),local("Tahoma Bold")}@font-face{font-family:system-ui;font-style:normal;font-weight:700;src:local(".SFNSText-Bold"),local(".HelveticaNeueDeskInterface-Bold"),local(".LucidaGrandeUI"),local("Segoe UI Bold"),local("Ubuntu Bold"),local("Roboto-Bold"),local("DroidSans-Bold"),local("Tahoma Bold")}@font-face{font-family:system-ui;font-style:italic;font-weight:700;src:local(".SFNSText-BoldItalic"),local(".HelveticaNeueDeskInterface-BoldItalic"),local(".LucidaGrandeUI"),local("Segoe UI Bold Italic"),local("Ubuntu Bold Italic"),local("Roboto-BoldItalic"),local("DroidSans-Bold"),local("Tahoma Bold")}.sidebar-fixed-width{width:260px}.sidebar-docs{width:220px;padding-right:40px;top:112px;bottom:70px;overflow-y:scroll;overflow-x:hidden}.sidebar-docs>h5{margin:15px 0 0}.sidebar-docs>h5:first-child{margin-top:17px}@media (min-width: 1200px){.sidebar-fixed-width{width:360px}.sidebar-docs{width:290px;padding-right:70px}}ul.doc-nav{padding-left:14px;margin-top:5px}.doc-nav>li.uk-active>a{position:relative}.doc-nav>li.uk-active>a:before{content:"";position:absolute;top:15px;left:-14px;width:7px;border-top:1px solid #0F1214}.hero-image img{max-width:200px;max-height:75px}.button-cta:nth-child(2n),.button-cta:nth-child(3n){margin-top:20px}.heading-hero-2{font-size:1.875rem}@media (min-width: 640px){.heading-hero-2{font-size:1.375rem}}@media (min-width: 960px){.heading-hero-2{font-size:1.75rem}}.list-featured>li:first-child{margin-top:20px}@media (min-width: 640px){.tm-timeline{box-sizing:border-box;position:relative}.tm-timeline *{box-sizing:border-box}.tm-timeline:before{content:'';position:absolute;top:0;left:calc(30% - 2px);bottom:0;width:4px;background:#0F1214}.tm-timeline:after{content:"";display:table;clear:both}.tm-timeline-entry{clear:both;text-align:left;position:relative}.tm-timeline-entry+.tm-timeline-entry{margin-top:70px}.tm-timeline-entry:after{display:block;content:"";clear:both}.tm-timeline-entry .tm-timeline-time{float:left;width:30%;padding-right:70px;text-align:right;position:relative}.tm-timeline-entry .tm-timeline-time:before{content:'';position:absolute;width:20px;height:20px;border:4px solid #0F1214;background-color:#fff;border-radius:100%;top:0;right:-14px;z-index:99}.tm-timeline-entry .tm-timeline-time h5{margin:3px 0 0}.tm-timeline-entry .tm-timeline-body{float:right;width:70%;padding-left:70px;margin-top:-2px}.tm-timeline-entry .tm-timeline-body h3{margin:0 0 15px}.tm-timeline-entry .tm-timeline-body h3 span{font-size:.7rem;margin-bottom:4px;padding:0 5px}}html{font-family:system-ui;font-size:16px;font-weight:normal;line-height:1.5;-webkit-text-size-adjust:100%;background:#fff;color:#0F1214;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}body{margin:0}a{-webkit-text-decoration-skip:objects}a:active,a:hover{outline:none}a,.uk-link{color:#7a838a;text-decoration:none;cursor:pointer}a:hover,.uk-link:hover{color:#000;text-decoration:underline}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}:not(pre)>code,:not(pre)>kbd,:not(pre)>samp{font-family:Consolas,monaco,monospace;font-size:.875rem;color:#f0506e;white-space:nowrap;padding:2px 6px;background:#f8f8f8}em{color:#f0506e}ins{background:#ffd;color:#666;text-decoration:none}mark{background:#ffd;color:#666}q{font-style:italic}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}audio,canvas,iframe,img,svg,video{vertical-align:middle}audio,canvas,img,video{max-width:100%;height:auto;box-sizing:border-box}svg:not(:root){overflow:hidden}p,ul,ol,dl,pre,address,fieldset,figure{margin:0 0 20px 0}*+p,*+ul,*+ol,*+dl,*+pre,*+address,*+fieldset,*+figure{margin-top:20px}h1,.uk-h1,h2,.uk-h2,h3,.uk-h3,h4,.uk-h4,h5,.uk-h5,h6,.uk-h6{margin:0 0 20px 0;font-family:system-ui;font-weight:bold;color:#0F1214;text-transform:none}*+h1,*+.uk-h1,*+h2,*+.uk-h2,*+h3,*+.uk-h3,*+h4,*+.uk-h4,*+h5,*+.uk-h5,*+h6,*+.uk-h6{margin-top:50px}h1,.uk-h1{font-size:1.875rem;line-height:1.2}h2,.uk-h2{font-size:1.625rem;line-height:1.4}h3,.uk-h3{font-size:1.375rem;line-height:1.4}h4,.uk-h4{font-size:1.125rem;line-height:1.4}h5,.uk-h5{font-size:16px;line-height:1.4}h6,.uk-h6{font-size:.875rem;line-height:1.4}ul,ol{padding-left:30px}ul>li>ul,ul>li>ol,ol>li>ol,ol>li>ul{margin:0}dt{font-weight:bold}dd{margin-left:0}hr,.uk-hr{box-sizing:content-box;height:0;overflow:visible;text-align:inherit;margin:0 0 20px 0;border:0;border-top:1px solid #e7e8e9}*+hr,*+.uk-hr{margin-top:20px}address{font-style:normal}blockquote{margin:0 0 20px 0;font-size:1.125rem;line-height:1.5;font-style:italic;color:#333}*+blockquote{margin-top:20px}blockquote p:last-of-type{margin-bottom:0}blockquote footer{margin-top:10px;font-size:.875rem;line-height:1.5;color:#666}blockquote footer::before{content:"— "}pre{font:.875rem / 1.5 Consolas,monaco,monospace;color:#666;-moz-tab-size:4;tab-size:4;overflow:auto;padding:10px;border:1px solid #c4c7ca;border-radius:3px;background:#fff}pre code{font-family:Consolas,monaco,monospace}::-moz-selection{background:#39f;color:#fff;text-shadow:none}::selection{background:#39f;color:#fff;text-shadow:none}details,main{display:block}summary{display:list-item}template{display:none}iframe{border:0}a,area,button,input,label,select,summary,textarea{touch-action:manipulation}.var-media-s::before{content:"640px"}.var-media-m::before{content:"960px"}.var-media-l::before{content:"1200px"}.var-media-xl::before{content:"1600px"}input[type="submit" i]{-webkit-appearance:none}a.uk-link-muted,.uk-link-muted a{color:#7a838a}a.uk-link-muted:hover,.uk-link-muted a:hover{color:#0F1214}a.uk-link-text:not(:hover),.uk-link-text a:not(:hover){color:inherit}a.uk-link-text:hover,.uk-link-text a:hover{color:#7a838a}a.uk-link-heading:not(:hover),.uk-link-heading a:not(:hover){color:inherit}a.uk-link-heading:hover,.uk-link-heading a:hover{color:#0F1214;text-decoration:none}a.uk-link-reset,a.uk-link-reset:hover,.uk-link-reset a,.uk-link-reset a:hover{color:inherit !important;text-decoration:none !important}.uk-heading-primary{font-size:1.875rem;line-height:1.2}@media (min-width: 960px){.uk-heading-primary{font-size:3.75rem;line-height:1.1}}.uk-heading-hero{font-size:2.375rem;line-height:1.3;font-weight:bold}@media (min-width: 640px){.uk-heading-hero{font-size:2.9375rem;line-height:1.3}}@media (min-width: 960px){.uk-heading-hero{font-size:3.625rem;line-height:1.4}}.uk-heading-divider{padding-bottom:10px;border-bottom:1px solid #c4c7ca}.uk-heading-bullet{position:relative}.uk-heading-bullet::before{content:"";display:inline-block;position:relative;top:calc(-0.1 * 1em);vertical-align:middle;height:.9em;margin-right:10px;border-left:5px solid #c4c7ca}.uk-heading-line{overflow:hidden}.uk-heading-line>*{display:inline-block;position:relative}.uk-heading-line>::before,.uk-heading-line>::after{content:"";position:absolute;top:calc(50% - (1px / 2));width:2000px;border-bottom:1px solid #c4c7ca}.uk-heading-line>::before{right:100%;margin-right:.6em}.uk-heading-line>::after{left:100%;margin-left:.6em}[class*='uk-divider']{border:none;margin-bottom:20px}*+[class*='uk-divider']{margin-top:20px}.uk-divider-icon{position:relative;height:20px;background-image:url("data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Ccircle%20fill%3D%22none%22%20stroke%3D%22%23c4c7ca%22%20stroke-width%3D%222%22%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%227%22%20%2F%3E%0A%3C%2Fsvg%3E%0A");background-repeat:no-repeat;background-position:50% 50%}.uk-divider-icon::before,.uk-divider-icon::after{content:"";position:absolute;top:50%;max-width:calc(50% - (50px / 2));border-bottom:1px solid #c4c7ca}.uk-divider-icon::before{right:calc(50% + (50px / 2));width:100%}.uk-divider-icon::after{left:calc(50% + (50px / 2));width:100%}.uk-divider-small{line-height:0}.uk-divider-small::after{content:"";display:inline-block;width:100px;max-width:100%;border-top:1px solid #c4c7ca;vertical-align:top}.uk-list{padding:0;list-style:none}.uk-list>li::before,.uk-list>li::after{content:"";display:table}.uk-list>li::after{clear:both}.uk-list>li>:last-child{margin-bottom:0}.uk-list ul{margin:0;padding-left:30px;list-style:none}.uk-list>li:nth-child(n+2),.uk-list>li>ul{margin-top:10px}.uk-list-divider>li:nth-child(n+2){margin-top:10px;padding-top:10px;border-top:1px solid #c4c7ca}.uk-list-striped>li{padding:10px 10px}.uk-list-striped>li:nth-of-type(odd){border-top:1px solid #c4c7ca;border-bottom:1px solid #c4c7ca}.uk-list-striped>li:nth-of-type(odd){background:#f8f8f8}.uk-list-striped>li:nth-child(n+2){margin-top:0}.uk-list-bullet>li{position:relative;padding-left:calc(1.5em + 10px)}.uk-list-bullet>li::before{content:"";position:absolute;top:0;left:0;width:1.5em;height:1.5em;background-image:url("data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%226%22%20height%3D%226%22%20viewBox%3D%220%200%206%206%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Ccircle%20fill%3D%22%23666%22%20cx%3D%223%22%20cy%3D%223%22%20r%3D%223%22%20%2F%3E%0A%3C%2Fsvg%3E");background-repeat:no-repeat;background-position:50% 50%;float:left}.uk-list-large>li:nth-child(n+2),.uk-list-large>li>ul{margin-top:20px}.uk-list-large.uk-list-divider>li:nth-child(n+2){margin-top:20px;padding-top:20px}.uk-list-large.uk-list-striped>li{padding:20px 10px}.uk-list-large.uk-list-striped>li:nth-of-type(odd){border-top:1px solid #c4c7ca;border-bottom:1px solid #c4c7ca}.uk-list-large.uk-list-striped>li:nth-child(n+2){margin-top:0}.uk-list{margin:0}.uk-icon{margin:0;border:none;border-radius:0;overflow:visible;font:inherit;color:inherit;text-transform:none;padding:0;background-color:transparent;display:inline-block;fill:currentcolor;line-height:0}button.uk-icon:not(:disabled){cursor:pointer}.uk-icon::-moz-focus-inner{border:0;padding:0}.uk-icon [fill*='#']:not(.uk-preserve),.uk-icon [FILL*='#']:not(.uk-preserve){fill:currentcolor}.uk-icon [stroke*='#']:not(.uk-preserve),.uk-icon [STROKE*='#']:not(.uk-preserve){stroke:currentcolor}.uk-icon>*{transform:translate(0, 0)}.uk-icon-image{width:20px;height:20px;background-position:50% 50%;background-repeat:no-repeat;background-size:contain;vertical-align:middle}.uk-icon-link{color:#7a838a}.uk-icon-link:hover,.uk-icon-link:focus{color:#666;outline:none}.uk-icon-link:active,.uk-active>.uk-icon-link{color:#595959}.uk-icon-button{box-sizing:border-box;width:36px;height:36px;border-radius:500px;background:#f8f8f8;color:#7a838a;vertical-align:middle;display:inline-flex;justify-content:center;align-items:center;transition:0.1s ease-in-out;transition-property:color,background-color}.uk-icon-button:hover,.uk-icon-button:focus{background-color:#ebebeb;color:#666;outline:none}.uk-icon-button:active,.uk-active>.uk-icon-button{background-color:#dfdfdf;color:#666}.uk-input,.uk-select,.uk-textarea,.uk-radio,.uk-checkbox{box-sizing:border-box;margin:0;border-radius:0;font:inherit}.uk-input{overflow:visible}.uk-select{text-transform:none}.uk-select optgroup{font:inherit;font-weight:bold}.uk-textarea{overflow:auto}.uk-input[type="search"]::-webkit-search-cancel-button,.uk-input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}.uk-input[type="number"]::-webkit-inner-spin-button,.uk-input[type="number"]::-webkit-outer-spin-button{height:auto}.uk-input::-moz-placeholder,.uk-textarea::-moz-placeholder{opacity:1}.uk-radio:not(:disabled),.uk-checkbox:not(:disabled){cursor:pointer}.uk-fieldset{border:none;margin:0;padding:0}.uk-input,.uk-textarea{-webkit-appearance:none}.uk-input,.uk-select,.uk-textarea{max-width:100%;width:100%;border:0 none;padding:0 10px;background:#fff;color:#666;border:solid 1px #c4c7ca}.uk-input,.uk-select:not([multiple]):not([size]){height:40px;vertical-align:middle;display:inline-block}.uk-input:not(input),.uk-select:not(select){line-height:38px}.uk-select[multiple],.uk-select[size],.uk-textarea{padding-top:4px;padding-bottom:4px;vertical-align:top}.uk-input:focus,.uk-select:focus,.uk-textarea:focus{outline:none;background-color:#fff;color:#666;border-color:#0F1214}.uk-input:disabled,.uk-select:disabled,.uk-textarea:disabled{background-color:#f8f8f8;color:#7a838a;border-color:#c4c7ca}.uk-input:-ms-input-placeholder{color:#7a838a !important}.uk-input::placeholder{color:#7a838a}.uk-textarea:-ms-input-placeholder{color:#7a838a !important}.uk-textarea::placeholder{color:#7a838a}.uk-form-small{font-size:.875rem}.uk-form-small:not(textarea):not([multiple]):not([size]){height:30px;padding-left:8px;padding-right:8px}.uk-form-small:not(select):not(input):not(textarea){line-height:28px}.uk-form-large{font-size:1.125rem}.uk-form-large:not(textarea):not([multiple]):not([size]){height:55px;padding-left:12px;padding-right:12px}.uk-form-large:not(select):not(input):not(textarea){line-height:53px}.uk-form-danger,.uk-form-danger:focus{color:#f0506e;border-color:#f0506e}.uk-form-success,.uk-form-success:focus{color:#32d296;border-color:#32d296}.uk-form-blank{background:none;border-color:transparent}.uk-form-blank:focus{border-color:#c4c7ca;border-style:dashed}input.uk-form-width-xsmall{width:50px}select.uk-form-width-xsmall{width:75px}.uk-form-width-small{width:130px}.uk-form-width-medium{width:200px}.uk-form-width-large{width:500px}.uk-select:not([multiple]):not([size]){-webkit-appearance:none;-moz-appearance:none;padding-right:20px;background-image:url("data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2224%22%20height%3D%2216%22%20viewBox%3D%220%200%2024%2016%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Cpolygon%20fill%3D%22%23666%22%20points%3D%2212%201%209%206%2015%206%22%20%2F%3E%0A%20%20%20%20%3Cpolygon%20fill%3D%22%23666%22%20points%3D%2212%2013%209%208%2015%208%22%20%2F%3E%0A%3C%2Fsvg%3E%0A");background-repeat:no-repeat;background-position:100% 50%}.uk-select:not([multiple]):not([size])::-ms-expand{display:none}.uk-select:not([multiple]):not([size]):disabled{background-image:url("data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2224%22%20height%3D%2216%22%20viewBox%3D%220%200%2024%2016%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Cpolygon%20fill%3D%22%237a838a%22%20points%3D%2212%201%209%206%2015%206%22%20%2F%3E%0A%20%20%20%20%3Cpolygon%20fill%3D%22%237a838a%22%20points%3D%2212%2013%209%208%2015%208%22%20%2F%3E%0A%3C%2Fsvg%3E%0A")}.uk-radio,.uk-checkbox{display:inline-block;height:16px;width:16px;overflow:hidden;margin-top:-4px;vertical-align:middle;-webkit-appearance:none;-moz-appearance:none;background-color:transparent;background-repeat:no-repeat;background-position:50% 50%;border:1px solid #a9aeb2;transition:0.2s ease-in-out;transition-property:background-color, border}.uk-radio{border-radius:50%}.uk-radio:focus,.uk-checkbox:focus{outline:none;border-color:#0F1214}.uk-radio:checked,.uk-checkbox:checked,.uk-checkbox:indeterminate{background-color:#0F1214;border-color:transparent}.uk-radio:checked:focus,.uk-checkbox:checked:focus,.uk-checkbox:indeterminate:focus{background-color:#000}.uk-radio:checked{background-image:url("data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Ccircle%20fill%3D%22%23fff%22%20cx%3D%228%22%20cy%3D%228%22%20r%3D%222%22%20%2F%3E%0A%3C%2Fsvg%3E")}.uk-checkbox:checked{background-image:url("data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2214%22%20height%3D%2211%22%20viewBox%3D%220%200%2014%2011%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Cpolygon%20fill%3D%22%23fff%22%20points%3D%2212%201%205%207.5%202%205%201%205.5%205%2010%2013%201.5%22%20%2F%3E%0A%3C%2Fsvg%3E%0A")}.uk-checkbox:indeterminate{background-image:url("data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Crect%20fill%3D%22%23fff%22%20x%3D%223%22%20y%3D%228%22%20width%3D%2210%22%20height%3D%221%22%20%2F%3E%0A%3C%2Fsvg%3E")}.uk-radio:disabled,.uk-checkbox:disabled{background-color:#f8f8f8;border-color:#c4c7ca}.uk-radio:disabled:checked{background-image:url("data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Ccircle%20fill%3D%22%237a838a%22%20cx%3D%228%22%20cy%3D%228%22%20r%3D%222%22%20%2F%3E%0A%3C%2Fsvg%3E")}.uk-checkbox:disabled:checked{background-image:url("data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2214%22%20height%3D%2211%22%20viewBox%3D%220%200%2014%2011%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Cpolygon%20fill%3D%22%237a838a%22%20points%3D%2212%201%205%207.5%202%205%201%205.5%205%2010%2013%201.5%22%20%2F%3E%0A%3C%2Fsvg%3E%0A")}.uk-checkbox:disabled:indeterminate{background-image:url("data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Crect%20fill%3D%22%237a838a%22%20x%3D%223%22%20y%3D%228%22%20width%3D%2210%22%20height%3D%221%22%20%2F%3E%0A%3C%2Fsvg%3E")}.uk-legend{width:100%;color:inherit;padding:0;font-size:1.375rem;line-height:1.4}.uk-form-custom{display:inline-block;position:relative;max-width:100%;vertical-align:middle}.uk-form-custom select,.uk-form-custom input[type="file"]{position:absolute;top:0;z-index:1;width:100%;height:100%;left:0;-webkit-appearance:none;opacity:0;cursor:pointer}.uk-form-custom input[type="file"]{font-size:500px;overflow:hidden}.uk-form-label{color:#333;font-size:.875rem}.uk-form-stacked .uk-form-label{display:block;margin-bottom:5px}@media (max-width: 959px){.uk-form-horizontal .uk-form-label{display:block;margin-bottom:5px}}@media (min-width: 960px){.uk-form-horizontal .uk-form-label{width:200px;margin-top:7px;float:left}.uk-form-horizontal .uk-form-controls{margin-left:215px}.uk-form-horizontal .uk-form-controls-text{padding-top:7px}}.uk-form-icon{position:absolute;top:0;bottom:0;left:0;width:40px;display:inline-flex;justify-content:center;align-items:center;color:#7a838a}.uk-form-icon:hover{color:#666}.uk-form-icon:not(a):not(button):not(input){pointer-events:none}.uk-form-icon:not(.uk-form-icon-flip)+.uk-input{padding-left:40px !important}.uk-form-icon-flip{right:0;left:auto}.uk-form-icon-flip+.uk-input{padding-right:40px !important}.uk-button{margin:0;border:none;border-radius:0;overflow:visible;font:inherit;color:inherit;text-transform:none;display:inline-block;box-sizing:border-box;padding:0 30px;vertical-align:middle;font-size:.875rem;line-height:38px;text-align:center;text-decoration:none;border-radius:5px}.uk-button:not(:disabled){cursor:pointer}.uk-button::-moz-focus-inner{border:0;padding:0}.uk-button:hover{text-decoration:none}.uk-button:focus{outline:none}.uk-button-default{background-color:transparent;color:#333;border:1px solid #c4c7ca}.uk-button-default:hover,.uk-button-default:focus{background-color:transparent;color:#333;border-color:#8e949a}.uk-button-default:active,.uk-button-default.uk-active{background-color:transparent;color:#333;border-color:#747b81}.uk-button-primary{background-color:#0F1214;color:#fff;border:1px solid transparent}.uk-button-primary:hover,.uk-button-primary:focus{background-color:#000;color:#fff}.uk-button-primary:active,.uk-button-primary.uk-active{background-color:#000;color:#fff}.uk-button-secondary{background-color:#222;color:#fff;border:1px solid transparent}.uk-button-secondary:hover,.uk-button-secondary:focus{background-color:#151515;color:#fff}.uk-button-secondary:active,.uk-button-secondary.uk-active{background-color:#090909;color:#fff}.uk-button-danger{background-color:#f0506e;color:#fff;border:1px solid transparent}.uk-button-danger:hover,.uk-button-danger:focus{background-color:#ee395b;color:#fff}.uk-button-danger:active,.uk-button-danger.uk-active{background-color:#ec2147;color:#fff}.uk-button-default:disabled,.uk-button-primary:disabled,.uk-button-secondary:disabled,.uk-button-danger:disabled{background-color:transparent;color:#7a838a;border-color:#c4c7ca}.uk-button-small{padding:0 15px;line-height:28px;font-size:.875rem}.uk-button-large{padding:0 40px;line-height:53px;font-size:.875rem}.uk-button-text{padding:0;line-height:1.5;background:none;color:#333;position:relative}.uk-button-text::before{content:"";position:absolute;bottom:0;left:0;right:100%;border-bottom:1px solid #333;transition:right 0.3s ease-out}.uk-button-text:hover,.uk-button-text:focus{color:#333}.uk-button-text:hover::before,.uk-button-text:focus::before{right:0}.uk-button-text:disabled{color:#7a838a}.uk-button-text:disabled::before{display:none}.uk-button-link{padding:0;line-height:1.5;background:none;color:#7a838a}.uk-button-link:hover,.uk-button-link:focus{color:#000;text-decoration:underline}.uk-button-link:disabled{color:#7a838a;text-decoration:none}.uk-button-group{display:inline-flex;vertical-align:middle;position:relative}.uk-button-group>.uk-button:nth-child(n+2),.uk-button-group>div:nth-child(n+2) .uk-button{margin-left:-1px}.uk-button-group .uk-button:hover,.uk-button-group .uk-button:focus,.uk-button-group .uk-button:active,.uk-button-group .uk-button.uk-active{position:relative;z-index:1}.uk-section{box-sizing:border-box;padding-top:40px;padding-bottom:40px}@media (min-width: 960px){.uk-section{padding-top:15px;padding-bottom:15px}}.uk-section::before,.uk-section::after{content:"";display:table}.uk-section::after{clear:both}.uk-section>:last-child{margin-bottom:0}.uk-section-xsmall{padding-top:20px;padding-bottom:20px}.uk-section-small{padding-top:40px;padding-bottom:40px}.uk-section-large{padding-top:70px;padding-bottom:70px}@media (min-width: 960px){.uk-section-large{padding-top:140px;padding-bottom:140px}}.uk-section-xlarge{padding-top:140px;padding-bottom:140px}@media (min-width: 960px){.uk-section-xlarge{padding-top:210px;padding-bottom:210px}}.uk-section-default{background:#fff}.uk-section-muted{background:#f8f8f8}.uk-section-primary{background:#0F1214}.uk-section-secondary{background:#222}.uk-container{box-sizing:content-box;max-width:1100px;margin-left:auto;margin-right:auto;padding-left:15px;padding-right:15px}@media (min-width: 640px){.uk-container{padding-left:30px;padding-right:30px}}@media (min-width: 960px){.uk-container{padding-left:40px;padding-right:40px}}.uk-container::before,.uk-container::after{content:"";display:table}.uk-container::after{clear:both}.uk-container>:last-child{margin-bottom:0}.uk-container .uk-container{padding-left:0;padding-right:0}.uk-container-small{max-width:800px}.uk-container-large{max-width:1600px}.uk-container-expand{max-width:none}.uk-grid{display:flex;flex-wrap:wrap;margin:0;padding:0;list-style:none}.uk-grid>*{margin:0}.uk-grid>*>:last-child{margin-bottom:0}.uk-grid{margin-left:-30px}.uk-grid>*{padding-left:30px}.uk-grid+.uk-grid,.uk-grid>.uk-grid-margin,*+.uk-grid-margin{margin-top:30px}@media (min-width: 1200px){.uk-grid{margin-left:-40px}.uk-grid>*{padding-left:40px}.uk-grid+.uk-grid,.uk-grid>.uk-grid-margin,*+.uk-grid-margin{margin-top:40px}}.uk-grid-small{margin-left:-15px}.uk-grid-small>*{padding-left:15px}.uk-grid+.uk-grid-small,.uk-grid-small>.uk-grid-margin,*+.uk-grid-margin-small{margin-top:15px}.uk-grid-medium{margin-left:-30px}.uk-grid-medium>*{padding-left:30px}.uk-grid+.uk-grid-medium,.uk-grid-medium>.uk-grid-margin,*+.uk-grid-margin-medium{margin-top:30px}.uk-grid-large{margin-left:-40px}.uk-grid-large>*{padding-left:40px}.uk-grid+.uk-grid-large,.uk-grid-large>.uk-grid-margin,*+.uk-grid-margin-large{margin-top:40px}@media (min-width: 1200px){.uk-grid-large{margin-left:-70px}.uk-grid-large>*{padding-left:70px}.uk-grid+.uk-grid-large,.uk-grid-large>.uk-grid-margin,*+.uk-grid-margin-large{margin-top:70px}}.uk-grid-collapse{margin-left:0}.uk-grid-collapse>*{padding-left:0}.uk-grid+.uk-grid-collapse,.uk-grid-collapse>.uk-grid-margin{margin-top:0}.uk-grid-divider>*{position:relative}.uk-grid-divider>:not(.uk-first-column)::before{content:"";position:absolute;top:0;bottom:0;border-left:1px solid #c4c7ca}.uk-grid-divider.uk-grid-stack>.uk-grid-margin::before{content:"";position:absolute;left:0;right:0;border-top:1px solid #c4c7ca}.uk-grid-divider{margin-left:-60px}.uk-grid-divider>*{padding-left:60px}.uk-grid-divider>:not(.uk-first-column)::before{left:30px}.uk-grid-divider.uk-grid-stack>.uk-grid-margin{margin-top:60px}.uk-grid-divider.uk-grid-stack>.uk-grid-margin::before{top:-30px;left:60px}@media (min-width: 1200px){.uk-grid-divider{margin-left:-80px}.uk-grid-divider>*{padding-left:80px}.uk-grid-divider>:not(.uk-first-column)::before{left:40px}.uk-grid-divider.uk-grid-stack>.uk-grid-margin{margin-top:80px}.uk-grid-divider.uk-grid-stack>.uk-grid-margin::before{top:-40px;left:80px}}.uk-grid-divider.uk-grid-small{margin-left:-30px}.uk-grid-divider.uk-grid-small>*{padding-left:30px}.uk-grid-divider.uk-grid-small>:not(.uk-first-column)::before{left:15px}.uk-grid-divider.uk-grid-small.uk-grid-stack>.uk-grid-margin{margin-top:30px}.uk-grid-divider.uk-grid-small.uk-grid-stack>.uk-grid-margin::before{top:-15px;left:30px}.uk-grid-divider.uk-grid-medium{margin-left:-60px}.uk-grid-divider.uk-grid-medium>*{padding-left:60px}.uk-grid-divider.uk-grid-medium>:not(.uk-first-column)::before{left:30px}.uk-grid-divider.uk-grid-medium.uk-grid-stack>.uk-grid-margin{margin-top:60px}.uk-grid-divider.uk-grid-medium.uk-grid-stack>.uk-grid-margin::before{top:-30px;left:60px}.uk-grid-divider.uk-grid-large{margin-left:-80px}.uk-grid-divider.uk-grid-large>*{padding-left:80px}.uk-grid-divider.uk-grid-large>:not(.uk-first-column)::before{left:40px}.uk-grid-divider.uk-grid-large.uk-grid-stack>.uk-grid-margin{margin-top:80px}.uk-grid-divider.uk-grid-large.uk-grid-stack>.uk-grid-margin::before{top:-40px;left:80px}@media (min-width: 1200px){.uk-grid-divider.uk-grid-large{margin-left:-140px}.uk-grid-divider.uk-grid-large>*{padding-left:140px}.uk-grid-divider.uk-grid-large>:not(.uk-first-column)::before{left:70px}.uk-grid-divider.uk-grid-large.uk-grid-stack>.uk-grid-margin{margin-top:140px}.uk-grid-divider.uk-grid-large.uk-grid-stack>.uk-grid-margin::before{top:-70px;left:140px}}.uk-grid-match>*,.uk-grid-item-match{display:flex;flex-wrap:wrap}.uk-grid-match>*>:not([class*='uk-width']),.uk-grid-item-match>:not([class*='uk-width']){box-sizing:border-box;width:100%;flex:auto}.uk-tile{position:relative;box-sizing:border-box;padding-left:15px;padding-right:15px;padding-top:40px;padding-bottom:40px}@media (min-width: 640px){.uk-tile{padding-left:30px;padding-right:30px}}@media (min-width: 960px){.uk-tile{padding-left:40px;padding-right:40px;padding-top:70px;padding-bottom:70px}}.uk-tile::before,.uk-tile::after{content:"";display:table}.uk-tile::after{clear:both}.uk-tile>:last-child{margin-bottom:0}.uk-tile-xsmall{padding-top:20px;padding-bottom:20px}.uk-tile-small{padding-top:40px;padding-bottom:40px}.uk-tile-large{padding-top:70px;padding-bottom:70px}@media (min-width: 960px){.uk-tile-large{padding-top:140px;padding-bottom:140px}}.uk-tile-xlarge{padding-top:140px;padding-bottom:140px}@media (min-width: 960px){.uk-tile-xlarge{padding-top:210px;padding-bottom:210px}}.uk-tile-default{background:#fff}.uk-tile-muted{background:#f8f8f8}.uk-tile-primary{background:#0F1214}.uk-tile-secondary{background:#222}.uk-card{position:relative;box-sizing:border-box;border:solid 1px #dfe1e2}.uk-card:hover{border-color:#a9aeb2}.uk-card-body{padding:30px 30px}.uk-card-body>p{font-size:.875rem}.uk-card-body>span{color:#0F1214}.uk-card-header{padding:15px 30px}.uk-card-footer{padding:15px 30px}@media (min-width: 1200px){.uk-card-body{padding:40px 40px}.uk-card-header{padding:20px 40px}.uk-card-footer{padding:20px 40px}}.uk-card-body::before,.uk-card-body::after,.uk-card-header::before,.uk-card-header::after,.uk-card-footer::before,.uk-card-footer::after{content:"";display:table}.uk-card-body::after,.uk-card-header::after,.uk-card-footer::after{clear:both}.uk-card-body>:last-child,.uk-card-header>:last-child,.uk-card-footer>:last-child{margin-bottom:0}.uk-card-title{font-size:1.375rem;line-height:1.4;font-size:1.125rem}.uk-card-badge{position:absolute;top:30px;right:30px;z-index:1}.uk-card-badge:first-child+*{margin-top:0}.uk-card-hover:not(.uk-card-default):not(.uk-card-primary):not(.uk-card-secondary):hover{background:#fff;box-shadow:0 14px 25px rgba(0,0,0,0.16)}.uk-card-default{background:#fff;color:#666;box-shadow:0 5px 15px rgba(0,0,0,0.08)}.uk-card-default .uk-card-title{color:#333}.uk-card-default.uk-card-hover:hover{background-color:#fff;box-shadow:0 14px 25px rgba(0,0,0,0.16)}.uk-card-default .uk-card-header{border-bottom:1px solid #c4c7ca}.uk-card-default .uk-card-footer{border-top:1px solid #c4c7ca}.uk-card-primary{background:#0F1214;color:#fff;box-shadow:0 5px 15px rgba(0,0,0,0.08)}.uk-card-primary .uk-card-title{color:#fff}.uk-card-primary.uk-card-hover:hover{background-color:#0F1214;box-shadow:0 14px 25px rgba(0,0,0,0.16)}.uk-card-secondary{background:#222;color:#fff;box-shadow:0 5px 15px rgba(0,0,0,0.08)}.uk-card-secondary .uk-card-title{color:#fff}.uk-card-secondary.uk-card-hover:hover{background-color:#222;box-shadow:0 14px 25px rgba(0,0,0,0.16)}.uk-card-small.uk-card-body,.uk-card-small .uk-card-body{padding:25px 25px}.uk-card-small .uk-card-header{padding:13px 20px}.uk-card-small .uk-card-footer{padding:13px 20px}@media (min-width: 1200px){.uk-card-large.uk-card-body,.uk-card-large .uk-card-body{padding:70px 70px}.uk-card-large .uk-card-header{padding:35px 70px}.uk-card-large .uk-card-footer{padding:35px 70px}}.uk-position-cover{z-index:1}.card-category h3:nth-child(2n){margin-top:0 !important}.card-post .uk-card-header{padding-top:40px;padding-bottom:0}.card-post .uk-card-body{padding-top:20px;padding-bottom:20px}.card-post .uk-card-footer{padding-bottom:32px;padding-top:0}.uk-close{color:#7a838a;transition:0.1s ease-in-out;transition-property:color, opacity}.uk-close:hover,.uk-close:focus{color:#666;outline:none}.uk-totop{padding:5px;color:#7a838a;transition:color 0.1s ease-in-out}.uk-totop:hover,.uk-totop:focus{color:#666;outline:none}.uk-totop:active{color:#333}.uk-label{display:inline-block;padding:0 10px;background:#0F1214;line-height:1.5;font-size:.875rem;color:#fff;vertical-align:middle;white-space:nowrap;border-radius:2px;text-transform:uppercase}.uk-label-success{background-color:#32d296;color:#fff}.uk-label-warning{background-color:#faa05a;color:#fff}.uk-label-danger{background-color:#f0506e;color:#fff}.uk-overlay{padding:30px 30px}.uk-overlay>:last-child{margin-bottom:0}.uk-overlay-default{background:rgba(255,255,255,0.8)}.uk-overlay-primary{background:rgba(34,34,34,0.8)}.uk-article figure,.uk-article .uk-slideshow{margin-top:44px;margin-bottom:60px}.uk-article figure img+div .uk-overlay-icon{color:rgba(255,255,255,0)}.uk-article figure img:hover+div .uk-overlay-icon{color:#fff}.uk-article figure figcaption{margin-left:0}.uk-article figure figcaption span{padding-right:20px;margin-bottom:-43px;margin-top:20px;border-right:solid 2px #7a838a;font-style:italic;font-size:0.8rem;line-height:1.8}.uk-article blockquote{border-left:solid 2px #7a838a;padding-left:20px;line-height:1.7;margin-top:40px;margin-bottom:40px}.uk-article .highlight,.uk-article .highlighter-rouge{margin-top:40px;margin-bottom:40px}.uk-article::before,.uk-article::after{content:"";display:table}.uk-article::after{clear:both}.uk-article>:last-child{margin-bottom:0}.uk-article+.uk-article{margin-top:70px}.uk-article-title{font-size:1.875rem;line-height:1.4;margin-bottom:20px}.uk-article-meta{font-size:.8125rem;line-height:1.3;color:#7a838a}.uk-article-meta a{color:#7a838a}.uk-article-meta a:hover{color:#0F1214}.uk-article-meta .avatar{margin-right:10px;float:left}.article-content{line-height:1.8}.avatar{border-radius:50%}.paginate-post .uk-text-small{line-height:1.75}.uk-search{display:inline-block;position:relative;max-width:100%;margin:0}.uk-search-input::-webkit-search-cancel-button,.uk-search-input::-webkit-search-decoration{-webkit-appearance:none}.uk-search-input::-moz-placeholder{opacity:1}.uk-search-input{box-sizing:border-box;margin:0;border-radius:0;font:inherit;overflow:visible;-webkit-appearance:none;vertical-align:middle;width:100%;border:none;color:#666}.uk-search-input:focus{outline:none}.uk-search-input:-ms-input-placeholder{color:#7a838a !important}.uk-search-input::placeholder{color:#7a838a}.uk-search-icon:focus{outline:none}.uk-search .uk-search-icon{position:absolute;top:0;bottom:0;left:0;display:inline-flex;justify-content:center;align-items:center;color:#7a838a}.uk-search .uk-search-icon:hover{color:#7a838a}.uk-search .uk-search-icon:not(a):not(button):not(input){pointer-events:none}.uk-search .uk-search-icon-flip{right:0;left:auto}.uk-search-default{width:180px}.uk-search-default .uk-search-input{height:40px;padding-left:6px;padding-right:6px;background:transparent;border:1px solid #9ca1a6}.uk-search-default .uk-search-input:focus{background-color:transparent}.uk-search-default .uk-search-icon{width:40px}.uk-search-default .uk-search-icon:not(.uk-search-icon-flip)+.uk-search-input{padding-left:40px}.uk-search-default .uk-search-icon-flip+.uk-search-input{padding-right:40px}.uk-search-navbar{width:400px}.uk-search-navbar .uk-search-input{height:40px;background:transparent;font-size:1.375rem}.uk-search-navbar .uk-search-icon{width:40px}.uk-search-navbar .uk-search-icon:not(.uk-search-icon-flip)+.uk-search-input{padding-left:40px}.uk-search-navbar .uk-search-icon-flip+.uk-search-input{padding-right:40px}.uk-search-large{width:500px}.uk-search-large .uk-search-input{height:80px;background:transparent;font-size:1.875rem}.uk-search-large .uk-search-icon{width:80px}.uk-search-large .uk-search-icon:not(.uk-search-icon-flip)+.uk-search-input{padding-left:80px}.uk-search-large .uk-search-icon-flip+.uk-search-input{padding-right:80px}.uk-search-toggle{color:#7a838a}.uk-search-toggle:hover,.uk-search-toggle:focus{color:#666}.uk-nav,.uk-nav ul{margin:0;padding:0;list-style:none}.uk-nav li>a{display:block;text-decoration:none}.uk-nav li>a:focus{outline:none}.uk-nav>li>a{padding:5px 0}ul.uk-nav-sub{padding:5px 0 5px 15px}.uk-nav-sub ul{padding-left:15px}.uk-nav-sub a{padding:2px 0}.uk-nav-parent-icon>.uk-parent>a::after{content:"";width:1.5em;height:1.5em;float:right;background-image:url("data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2214%22%20height%3D%2214%22%20viewBox%3D%220%200%2014%2014%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Cpolyline%20fill%3D%22none%22%20stroke%3D%22%23666%22%20stroke-width%3D%221.1%22%20points%3D%2210%201%204%207%2010%2013%22%20%2F%3E%0A%3C%2Fsvg%3E");background-repeat:no-repeat;background-position:50% 50%}.uk-nav-parent-icon>.uk-parent.uk-open>a::after{background-image:url("data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2214%22%20height%3D%2214%22%20viewBox%3D%220%200%2014%2014%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%20%20%3Cpolyline%20fill%3D%22none%22%20stroke%3D%22%23666%22%20stroke-width%3D%221.1%22%20points%3D%221%204%207%2010%2013%204%22%20%2F%3E%0A%3C%2Fsvg%3E")}.uk-nav-header{padding:5px 0;text-transform:uppercase;font-size:.875rem}.uk-nav-header:not(:first-child){margin-top:20px}.uk-nav-divider{margin:5px 0}.uk-nav-default{font-size:.875rem}.uk-nav-default>li>a{color:#7a838a}.uk-nav-default>li>a:hover,.uk-nav-default>li>a:focus{color:#666}.uk-nav-default>li.uk-active>a{color:#333}.uk-nav-default .uk-nav-header{color:#333}.uk-nav-default .uk-nav-divider{border-top:1px solid #c4c7ca}.uk-nav-default .uk-nav-sub a{color:#7a838a}.uk-nav-default .uk-nav-sub a:hover,.uk-nav-default .uk-nav-sub a:focus{color:#666}.uk-nav-primary>li>a{font-size:1.375rem;line-height:1.5;color:#7a838a}.uk-nav-primary>li>a:hover,.uk-nav-primary>li>a:focus{color:#666}.uk-nav-primary>li.uk-active>a{color:#333}.uk-nav-primary .uk-nav-header{color:#333}.uk-nav-primary .uk-nav-divider{border-top:1px solid #c4c7ca}.uk-nav-primary .uk-nav-sub a{color:#7a838a}.uk-nav-primary .uk-nav-sub a:hover,.uk-nav-primary .uk-nav-sub a:focus{color:#666}.uk-nav-center{text-align:center}.uk-nav-center .uk-nav-sub,.uk-nav-center .uk-nav-sub ul{padding-left:0}.uk-nav-center.uk-nav-parent-icon>.uk-parent>a::after{position:absolute}.uk-navbar{display:flex;position:relative;font-weight:500}.uk-navbar .uk-drop{width:360px}.uk-navbar .uk-search-navbar .uk-search-input{height:50px;font-size:1.0625rem;padding-left:1.1875rem;background:#fff}.uk-navbar-container:not(.uk-navbar-transparent){background:#fff}.uk-navbar-container>::before,.uk-navbar-container>::after{display:none !important}.uk-navbar-left,.uk-navbar-right,.uk-navbar-center,.uk-navbar-center-left>*,.uk-navbar-center-right>*{display:flex;align-items:center}.uk-navbar-right{margin-left:auto}.uk-navbar-center:only-child{margin-left:auto;margin-right:auto;position:relative}.uk-navbar-center:not(:only-child){position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);z-index:990}.uk-navbar-center:not(:only-child) .uk-navbar-nav>li>a,.uk-navbar-center:not(:only-child) .uk-navbar-item,.uk-navbar-center:not(:only-child) .uk-navbar-toggle{white-space:nowrap}.uk-navbar-center-left,.uk-navbar-center-right{position:absolute;top:0}.uk-navbar-center-left{right:100%}.uk-navbar-center-right{left:100%}[class*='uk-navbar-center-'] .uk-navbar-nav>li>a,[class*='uk-navbar-center-'] .uk-navbar-item,[class*='uk-navbar-center-'] .uk-navbar-toggle{white-space:nowrap}.uk-navbar-nav{display:flex;margin:0;padding:0;list-style:none}.uk-navbar-left,.uk-navbar-right,.uk-navbar-center:only-child{flex-wrap:wrap}.uk-navbar-nav>li>a,.uk-navbar-item,.uk-navbar-toggle{display:flex;justify-content:center;align-items:center;box-sizing:border-box;height:80px;padding:0 15px;font-size:.875rem;font-family:system-ui;text-decoration:none}.uk-navbar-nav>li>a{color:#7a838a;text-transform:none;transition:0.1s ease-in-out;transition-property:color, background-color}.uk-navbar-nav>li:hover>a,.uk-navbar-nav>li>a:focus,.uk-navbar-nav>li>a.uk-open{color:#0F1214;outline:none}.uk-navbar-nav>li>a:active{color:#333}.uk-navbar-nav>li.uk-active>a{color:#0F1214}.uk-navbar-item{color:#666}.uk-navbar-toggle{color:#7a838a}.uk-navbar-toggle:hover,.uk-navbar-toggle:focus,.uk-navbar-toggle.uk-open{color:#0F1214;outline:none;text-decoration:none}.uk-navbar-subtitle{font-size:.875rem}.uk-navbar-dropdown{display:none;position:absolute;z-index:1020;box-sizing:border-box;width:200px;padding:25px;background:#fff;color:#666;box-shadow:0 5px 12px rgba(0,0,0,0.15)}.uk-navbar-dropdown.uk-open{display:block}[class*='uk-navbar-dropdown-top']{margin-top:-15px}[class*='uk-navbar-dropdown-bottom']{margin-top:15px}[class*='uk-navbar-dropdown-left']{margin-left:-15px}[class*='uk-navbar-dropdown-right']{margin-left:15px}.uk-navbar-dropdown-grid{margin-left:-50px}.uk-navbar-dropdown-grid>*{padding-left:50px}.uk-navbar-dropdown-grid>.uk-grid-margin{margin-top:50px}.uk-navbar-dropdown-stack .uk-navbar-dropdown-grid>*{width:100% !important}.uk-navbar-dropdown-width-2:not(.uk-navbar-dropdown-stack){width:400px}.uk-navbar-dropdown-width-3:not(.uk-navbar-dropdown-stack){width:600px}.uk-navbar-dropdown-width-4:not(.uk-navbar-dropdown-stack){width:800px}.uk-navbar-dropdown-width-5:not(.uk-navbar-dropdown-stack){width:1000px}.uk-navbar-dropdown-dropbar{margin-top:0;margin-bottom:0;box-shadow:none}.uk-navbar-dropdown-nav{font-size:.875rem}.uk-navbar-dropdown-nav>li>a{color:#7a838a}.uk-navbar-dropdown-nav>li>a:hover,.uk-navbar-dropdown-nav>li>a:focus{color:#666}.uk-navbar-dropdown-nav>li.uk-active>a{color:#333}.uk-navbar-dropdown-nav .uk-nav-header{color:#333}.uk-navbar-dropdown-nav .uk-nav-divider{border-top:1px solid #c4c7ca}.uk-navbar-dropdown-nav .uk-nav-sub a{color:#7a838a}.uk-navbar-dropdown-nav .uk-nav-sub a:hover,.uk-navbar-dropdown-nav .uk-nav-sub a:focus{color:#666}.uk-navbar-dropbar{background:#fff}.uk-navbar-dropbar-slide{position:absolute;z-index:980;left:0;right:0;box-shadow:0 5px 7px rgba(0,0,0,0.05)}.uk-navbar-container>.uk-container .uk-navbar-left{margin-left:-15px;margin-right:-15px}.uk-navbar-container>.uk-container .uk-navbar-right{margin-right:-15px}.uk-navbar-dropdown-grid>*{position:relative}.uk-navbar-dropdown-grid>:not(.uk-first-column)::before{content:"";position:absolute;top:0;bottom:0;left:25px;border-left:1px solid #c4c7ca}.uk-navbar-dropdown-grid.uk-grid-stack>.uk-grid-margin::before{content:"";position:absolute;top:-25px;left:50px;right:0;border-top:1px solid #c4c7ca}.uk-subnav{display:flex;flex-wrap:wrap;margin-left:-20px;padding:0;list-style:none}.uk-subnav>*{flex:none;padding-left:20px;position:relative}.uk-subnav>*>:first-child{display:block;color:#7a838a;font-size:.875rem;text-transform:none;transition:0.1s ease-in-out;transition-property:color, background-color}.uk-subnav>*>a:hover,.uk-subnav>*>a:focus{color:#0F1214;text-decoration:none;outline:none}.uk-subnav>.uk-active>a{color:#333}.uk-subnav-divider>*{display:flex;align-items:center}.uk-subnav-divider>:nth-child(n+2):not(.uk-first-column)::before{content:"";height:1.5em;margin-left:0px;margin-right:20px;border-left:1px solid #c4c7ca}.uk-subnav-pill>*>:first-child{padding:5px 10px;background:transparent;color:#7a838a}.uk-subnav-pill>*>a:hover,.uk-subnav-pill>*>a:focus{background-color:#f8f8f8;color:#666}.uk-subnav-pill>*>a:active{background-color:#f8f8f8;color:#666}.uk-subnav-pill>.uk-active>a{background-color:#0F1214;color:#fff}.uk-subnav>.uk-disabled>a{color:#7a838a}.uk-pagination{display:flex;flex-wrap:wrap;margin-left:-20px;padding:0;list-style:none}.uk-pagination>*{flex:none;padding-left:20px;position:relative}.uk-pagination>*>*{display:block;color:#0F1214;transition:color 0.1s ease-in-out}.uk-pagination>*>:hover,.uk-pagination>*>:focus{color:#0F1214;text-decoration:none}.uk-pagination>.uk-active>*{color:#666}.uk-pagination>.uk-disabled>*{color:#7a838a}.uk-drop{display:none;position:absolute;z-index:1020;box-sizing:border-box;width:300px}.uk-drop.uk-open{display:block}[class*='uk-drop-top']{margin-top:-20px}[class*='uk-drop-bottom']{margin-top:20px}[class*='uk-drop-left']{margin-left:-20px}[class*='uk-drop-right']{margin-left:20px}.uk-drop-stack .uk-drop-grid>*{width:100% !important}.uk-dropdown{display:none;position:absolute;z-index:1020;box-sizing:border-box;min-width:200px;padding:25px;background:#fff;color:#666;box-shadow:0 5px 12px rgba(0,0,0,0.15)}.uk-dropdown.uk-open{display:block}.uk-dropdown-nav{white-space:nowrap;font-size:.875rem}.uk-dropdown-nav>li>a{color:#7a838a}.uk-dropdown-nav>li>a:hover,.uk-dropdown-nav>li>a:focus,.uk-dropdown-nav>li.uk-active>a{color:#666}.uk-dropdown-nav .uk-nav-header{color:#333}.uk-dropdown-nav .uk-nav-divider{border-top:1px solid #c4c7ca}.uk-dropdown-nav .uk-nav-sub a{color:#7a838a}.uk-dropdown-nav .uk-nav-sub a:hover,.uk-dropdown-nav .uk-nav-sub a:focus{color:#666}[class*='uk-dropdown-top']{margin-top:-10px}[class*='uk-dropdown-bottom']{margin-top:10px}[class*='uk-dropdown-left']{margin-left:-10px}[class*='uk-dropdown-right']{margin-left:10px}.uk-dropdown-stack .uk-dropdown-grid>*{width:100% !important}.uk-lightbox{display:none;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1010;background:#000;opacity:0;transition:opacity 0.15s linear}.uk-lightbox.uk-open{display:block;opacity:1}.uk-lightbox-page{overflow:hidden}.uk-lightbox-items>*{position:absolute;top:0;right:0;bottom:0;left:0;display:none;justify-content:center;align-items:center;color:rgba(255,255,255,0.7);will-change:transform, opacity}.uk-lightbox-items>*>*{max-width:100vw;max-height:100vh}.uk-lightbox-items>*>:not(iframe){width:auto;height:auto}.uk-lightbox-items>.uk-active{display:flex}.uk-lightbox-toolbar{padding:10px 10px;background:rgba(0,0,0,0.3);color:rgba(255,255,255,0.7)}.uk-lightbox-toolbar *{color:rgba(255,255,255,0.7)}.uk-lightbox-toolbar-icon{padding:5px;color:rgba(255,255,255,0.7)}.uk-lightbox-toolbar-icon:hover{color:#fff}.uk-lightbox-button{box-sizing:border-box;width:50px;height:50px;background:rgba(0,0,0,0.3);color:rgba(255,255,255,0.7);display:inline-flex;justify-content:center;align-items:center}.uk-lightbox-button:hover{color:#fff}.uk-lightbox-iframe{width:80%;height:80%}.uk-slideshow{-webkit-tap-highlight-color:transparent}.uk-slideshow-items{position:relative;z-index:0;margin:0;padding:0;list-style:none;overflow:hidden;-webkit-touch-callout:none}.uk-slideshow-items>*{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;will-change:transform, opacity;touch-action:pan-y}.uk-slideshow-items>:not(.uk-active){display:none}.uk-sticky-fixed{z-index:980;box-sizing:border-box;margin:0 !important;-webkit-backface-visibility:hidden;backface-visibility:hidden}.uk-sticky[class*='uk-animation-']{animation-duration:.2s}.uk-sticky.uk-animation-reverse{animation-duration:.2s}.uk-offcanvas{display:none;position:fixed;top:0;bottom:0;left:0;z-index:1000}.uk-offcanvas-flip .uk-offcanvas{right:0;left:auto}.uk-offcanvas-bar{position:absolute;top:0;bottom:0;left:0;box-sizing:border-box;width:270px;padding:20px 20px;background:#fff;overflow-y:auto;-webkit-overflow-scrolling:touch;transform:translateX(-100%);font-weight:500}@media (min-width: 960px){.uk-offcanvas-bar{width:350px;padding:40px 40px}}.uk-offcanvas-flip .uk-offcanvas-bar{left:auto;right:0;transform:translateX(100%)}.uk-open>.uk-offcanvas-bar{transform:translateX(0)}.uk-offcanvas-bar-animation{transition:transform 0.3s ease-out}.uk-offcanvas-reveal{position:absolute;top:0;bottom:0;left:0;width:0;overflow:hidden;transition:width 0.3s ease-out}.uk-offcanvas-reveal .uk-offcanvas-bar{transform:translateX(0)}.uk-open>.uk-offcanvas-reveal{width:270px}@media (min-width: 960px){.uk-open>.uk-offcanvas-reveal{width:350px}}.uk-offcanvas-flip .uk-offcanvas-reveal{right:0;left:auto}.uk-offcanvas-close{position:absolute;z-index:1000;top:20px;right:20px;padding:5px}.uk-offcanvas-overlay{width:100vw;touch-action:none}.uk-offcanvas-overlay::before{content:"";position:absolute;top:0;bottom:0;left:0;right:0;background:rgba(0,0,0,0.1);opacity:0;transition:opacity 0.15s linear}.uk-offcanvas-overlay.uk-open::before{opacity:1}.uk-offcanvas-page,.uk-offcanvas-container{overflow-x:hidden}.uk-offcanvas-container-overlay{overflow:hidden}.uk-offcanvas-container .uk-offcanvas-content{position:relative;left:0;transition:left 0.3s ease-out;-webkit-overflow-scrolling:touch}.uk-offcanvas-overlay .uk-offcanvas-content{overflow-y:hidden}:not(.uk-offcanvas-flip)>.uk-offcanvas-content-animation{left:270px}.uk-offcanvas-flip>.uk-offcanvas-content-animation{left:-270px}@media (min-width: 960px){:not(.uk-offcanvas-flip)>.uk-offcanvas-content-animation{left:350px}.uk-offcanvas-flip>.uk-offcanvas-content-animation{left:-350px}}[class*='uk-animation-']{animation-duration:.5s;animation-timing-function:ease-out;animation-fill-mode:both}.uk-animation-reverse{animation-direction:reverse;animation-timing-function:ease-in}.uk-animation-fade{animation-name:uk-fade;animation-duration:.8s;animation-timing-function:linear}.uk-animation-scale-up{animation-name:uk-fade-scale-02}.uk-animation-scale-down{animation-name:uk-fade-scale-18}.uk-animation-slide-top{animation-name:uk-fade-top}.uk-animation-slide-bottom{animation-name:uk-fade-bottom}.uk-animation-slide-left{animation-name:uk-fade-left}.uk-animation-slide-right{animation-name:uk-fade-right}.uk-animation-slide-top-small{animation-name:uk-fade-top-small}.uk-animation-slide-bottom-small{animation-name:uk-fade-bottom-small}.uk-animation-slide-left-small{animation-name:uk-fade-left-small}.uk-animation-slide-right-small{animation-name:uk-fade-right-small}.uk-animation-slide-top-medium{animation-name:uk-fade-top-medium}.uk-animation-slide-bottom-medium{animation-name:uk-fade-bottom-medium}.uk-animation-slide-left-medium{animation-name:uk-fade-left-medium}.uk-animation-slide-right-medium{animation-name:uk-fade-right-medium}.uk-animation-kenburns{animation-name:uk-scale-kenburns;animation-duration:15s}.uk-animation-shake{animation-name:uk-shake}.uk-animation-fast{animation-duration:.1s}.uk-animation-toggle:not(:hover):not(.uk-hover) [class*='uk-animation-']{animation-name:none}@keyframes uk-fade{0%{opacity:0}100%{opacity:1}}@keyframes uk-fade-top{0%{opacity:0;transform:translateY(-100%)}100%{opacity:1;transform:translateY(0)}}@keyframes uk-fade-bottom{0%{opacity:0;transform:translateY(100%)}100%{opacity:1;transform:translateY(0)}}@keyframes uk-fade-left{0%{opacity:0;transform:translateX(-100%)}100%{opacity:1;transform:translateX(0)}}@keyframes uk-fade-right{0%{opacity:0;transform:translateX(100%)}100%{opacity:1;transform:translateX(0)}}@keyframes uk-fade-top-small{0%{opacity:0;transform:translateY(-10px)}100%{opacity:1;transform:translateY(0)}}@keyframes uk-fade-bottom-small{0%{opacity:0;transform:translateY(10px)}100%{opacity:1;transform:translateY(0)}}@keyframes uk-fade-left-small{0%{opacity:0;transform:translateX(-10px)}100%{opacity:1;transform:translateX(0)}}@keyframes uk-fade-right-small{0%{opacity:0;transform:translateX(10px)}100%{opacity:1;transform:translateX(0)}}@keyframes uk-fade-top-medium{0%{opacity:0;transform:translateY(-50px)}100%{opacity:1;transform:translateY(0)}}@keyframes uk-fade-bottom-medium{0%{opacity:0;transform:translateY(50px)}100%{opacity:1;transform:translateY(0)}}@keyframes uk-fade-left-medium{0%{opacity:0;transform:translateX(-50px)}100%{opacity:1;transform:translateX(0)}}@keyframes uk-fade-right-medium{0%{opacity:0;transform:translateX(50px)}100%{opacity:1;transform:translateX(0)}}@keyframes uk-fade-scale-02{0%{opacity:0;transform:scale(0.2)}100%{opacity:1;transform:scale(1)}}@keyframes uk-fade-scale-18{0%{opacity:0;transform:scale(1.8)}100%{opacity:1;transform:scale(1)}}@keyframes uk-scale-kenburns{0%{transform:scale(1)}100%{transform:scale(1.2)}}@keyframes uk-shake{0%, 100%{transform:translateX(0)}10%{transform:translateX(-9px)}20%{transform:translateX(8px)}30%{transform:translateX(-7px)}40%{transform:translateX(6px)}50%{transform:translateX(-5px)}60%{transform:translateX(4px)}70%{transform:translateX(-3px)}80%{transform:translateX(2px)}90%{transform:translateX(-1px)}}[class*='uk-child-width']>*{box-sizing:border-box;width:100%}.uk-child-width-1-2>*{width:50%}.uk-child-width-1-3>*{width:calc(100% * 1 / 3.001)}.uk-child-width-1-4>*{width:25%}.uk-child-width-1-5>*{width:20%}.uk-child-width-1-6>*{width:calc(100% * 1 / 6.001)}.uk-child-width-auto>*{width:auto}.uk-child-width-expand>*{width:1px}.uk-child-width-expand>:not([class*='uk-width']){flex:1;min-width:0;flex-basis:1px}@media (min-width: 640px){.uk-child-width-1-1\@s>*{width:100%}.uk-child-width-1-2\@s>*{width:50%}.uk-child-width-1-3\@s>*{width:calc(100% * 1 / 3.001)}.uk-child-width-1-4\@s>*{width:25%}.uk-child-width-1-5\@s>*{width:20%}.uk-child-width-1-6\@s>*{width:calc(100% * 1 / 6.001)}.uk-child-width-auto\@s>*{width:auto}.uk-child-width-expand\@s>*{width:1px}.uk-child-width-expand\@s>:not([class*='uk-width']){flex:1;min-width:0;flex-basis:1px}}@media (min-width: 960px){.uk-child-width-1-1\@m>*{width:100%}.uk-child-width-1-2\@m>*{width:50%}.uk-child-width-1-3\@m>*{width:calc(100% * 1 / 3.001)}.uk-child-width-1-4\@m>*{width:25%}.uk-child-width-1-5\@m>*{width:20%}.uk-child-width-1-6\@m>*{width:calc(100% * 1 / 6.001)}.uk-child-width-auto\@m>*{width:auto}.uk-child-width-expand\@m>*{width:1px}.uk-child-width-expand\@m>:not([class*='uk-width']){flex:1;min-width:0;flex-basis:1px}}@media (min-width: 1200px){.uk-child-width-1-1\@l>*{width:100%}.uk-child-width-1-2\@l>*{width:50%}.uk-child-width-1-3\@l>*{width:calc(100% * 1 / 3.001)}.uk-child-width-1-4\@l>*{width:25%}.uk-child-width-1-5\@l>*{width:20%}.uk-child-width-1-6\@l>*{width:calc(100% * 1 / 6.001)}.uk-child-width-auto\@l>*{width:auto}.uk-child-width-expand\@l>*{width:1px}.uk-child-width-expand\@l>:not([class*='uk-width']){flex:1;min-width:0;flex-basis:1px}}@media (min-width: 1600px){.uk-child-width-1-1\@xl>*{width:100%}.uk-child-width-1-2\@xl>*{width:50%}.uk-child-width-1-3\@xl>*{width:calc(100% * 1 / 3.001)}.uk-child-width-1-4\@xl>*{width:25%}.uk-child-width-1-5\@xl>*{width:20%}.uk-child-width-1-6\@xl>*{width:calc(100% * 1 / 6.001)}.uk-child-width-auto\@xl>*{width:auto}.uk-child-width-expand\@xl>*{width:1px}.uk-child-width-expand\@xl>:not([class*='uk-width']){flex:1;min-width:0;flex-basis:1px}}[class*='uk-width']{box-sizing:border-box;width:100%;max-width:100%}.uk-width-1-2{width:50%}.uk-width-1-3{width:calc(100% * 1 / 3.001)}.uk-width-2-3{width:calc(100% * 2 / 3.001)}.uk-width-1-4{width:25%}.uk-width-3-4{width:75%}.uk-width-1-5{width:20%}.uk-width-2-5{width:40%}.uk-width-3-5{width:60%}.uk-width-4-5{width:80%}.uk-width-1-6{width:calc(100% * 1 / 6.001)}.uk-width-5-6{width:calc(100% * 5 / 6.001)}.uk-width-small{width:150px}.uk-width-medium{width:300px}.uk-width-large{width:450px}.uk-width-xlarge{width:600px}.uk-width-xxlarge{width:750px}.uk-width-auto{width:auto}.uk-width-expand{width:1px;flex:1;min-width:0;flex-basis:1px}@media (min-width: 640px){.uk-width-1-1\@s{width:100%}.uk-width-1-2\@s{width:50%}.uk-width-1-3\@s{width:calc(100% * 1 / 3.001)}.uk-width-2-3\@s{width:calc(100% * 2 / 3.001)}.uk-width-1-4\@s{width:25%}.uk-width-3-4\@s{width:75%}.uk-width-1-5\@s{width:20%}.uk-width-2-5\@s{width:40%}.uk-width-3-5\@s{width:60%}.uk-width-4-5\@s{width:80%}.uk-width-1-6\@s{width:calc(100% * 1 / 6.001)}.uk-width-5-6\@s{width:calc(100% * 5 / 6.001)}.uk-width-small\@s{width:150px}.uk-width-medium\@s{width:300px}.uk-width-large\@s{width:450px}.uk-width-xlarge\@s{width:600px}.uk-width-xxlarge\@s{width:750px}.uk-width-auto\@s{width:auto}.uk-width-expand\@s{width:1px;flex:1;min-width:0;flex-basis:1px}}@media (min-width: 960px){.uk-width-1-1\@m{width:100%}.uk-width-1-2\@m{width:50%}.uk-width-1-3\@m{width:calc(100% * 1 / 3.001)}.uk-width-2-3\@m{width:calc(100% * 2 / 3.001)}.uk-width-1-4\@m{width:25%}.uk-width-3-4\@m{width:75%}.uk-width-1-5\@m{width:20%}.uk-width-2-5\@m{width:40%}.uk-width-3-5\@m{width:60%}.uk-width-4-5\@m{width:80%}.uk-width-1-6\@m{width:calc(100% * 1 / 6.001)}.uk-width-5-6\@m{width:calc(100% * 5 / 6.001)}.uk-width-small\@m{width:150px}.uk-width-medium\@m{width:300px}.uk-width-large\@m{width:450px}.uk-width-xlarge\@m{width:600px}.uk-width-xxlarge\@m{width:750px}.uk-width-auto\@m{width:auto}.uk-width-expand\@m{width:1px;flex:1;min-width:0;flex-basis:1px}}@media (min-width: 1200px){.uk-width-1-1\@l{width:100%}.uk-width-1-2\@l{width:50%}.uk-width-1-3\@l{width:calc(100% * 1 / 3.001)}.uk-width-2-3\@l{width:calc(100% * 2 / 3.001)}.uk-width-1-4\@l{width:25%}.uk-width-3-4\@l{width:75%}.uk-width-1-5\@l{width:20%}.uk-width-2-5\@l{width:40%}.uk-width-3-5\@l{width:60%}.uk-width-4-5\@l{width:80%}.uk-width-1-6\@l{width:calc(100% * 1 / 6.001)}.uk-width-5-6\@l{width:calc(100% * 5 / 6.001)}.uk-width-small\@l{width:150px}.uk-width-medium\@l{width:300px}.uk-width-large\@l{width:450px}.uk-width-xlarge\@l{width:600px}.uk-width-xxlarge\@l{width:750px}.uk-width-auto\@l{width:auto}.uk-width-expand\@l{width:1px;flex:1;min-width:0;flex-basis:1px}}@media (min-width: 1600px){.uk-width-1-1\@xl{width:100%}.uk-width-1-2\@xl{width:50%}.uk-width-1-3\@xl{width:calc(100% * 1 / 3.001)}.uk-width-2-3\@xl{width:calc(100% * 2 / 3.001)}.uk-width-1-4\@xl{width:25%}.uk-width-3-4\@xl{width:75%}.uk-width-1-5\@xl{width:20%}.uk-width-2-5\@xl{width:40%}.uk-width-3-5\@xl{width:60%}.uk-width-4-5\@xl{width:80%}.uk-width-1-6\@xl{width:calc(100% * 1 / 6.001)}.uk-width-5-6\@xl{width:calc(100% * 5 / 6.001)}.uk-width-small\@xl{width:150px}.uk-width-medium\@xl{width:300px}.uk-width-large\@xl{width:450px}.uk-width-xlarge\@xl{width:600px}.uk-width-xxlarge\@xl{width:750px}.uk-width-auto\@xl{width:auto}.uk-width-expand\@xl{width:1px;flex:1;min-width:0;flex-basis:1px}}.uk-text-lead{font-size:1.125rem;line-height:1.5;color:#333}.uk-text-meta{font-size:.875rem;line-height:1.4;color:#7a838a}.uk-text-meta a{color:#7a838a}.uk-text-meta a:hover{color:#666;text-decoration:none}.uk-text-small{font-size:.875rem;line-height:1.5}.uk-text-large{font-size:1.375rem;line-height:1.5}.uk-text-bold{font-weight:bolder}.uk-text-uppercase{text-transform:uppercase !important}.uk-text-capitalize{text-transform:capitalize !important}.uk-text-lowercase{text-transform:lowercase !important}.uk-text-muted{color:#7a838a !important}.uk-text-primary{color:#0F1214 !important}.uk-text-success{color:#32d296 !important}.uk-text-warning{color:#faa05a !important}.uk-text-danger{color:#f0506e !important}.uk-text-background{-webkit-background-clip:text;-webkit-text-fill-color:transparent;display:inline-block;color:#0F1214 !important}@supports (-webkit-background-clip: text){.uk-text-background{background-color:#0F1214}}.uk-text-left{text-align:left !important}.uk-text-right{text-align:right !important}.uk-text-center{text-align:center !important}.uk-text-justify{text-align:justify !important}@media (min-width: 640px){.uk-text-left\@s{text-align:left !important}.uk-text-right\@s{text-align:right !important}.uk-text-center\@s{text-align:center !important}}@media (min-width: 960px){.uk-text-left\@m{text-align:left !important}.uk-text-right\@m{text-align:right !important}.uk-text-center\@m{text-align:center !important}}@media (min-width: 1200px){.uk-text-left\@l{text-align:left !important}.uk-text-right\@l{text-align:right !important}.uk-text-center\@l{text-align:center !important}}@media (min-width: 1600px){.uk-text-left\@xl{text-align:left !important}.uk-text-right\@xl{text-align:right !important}.uk-text-center\@xl{text-align:center !important}}.uk-text-top{vertical-align:top !important}.uk-text-middle{vertical-align:middle !important}.uk-text-bottom{vertical-align:bottom !important}.uk-text-baseline{vertical-align:baseline !important}.uk-text-nowrap{white-space:nowrap}.uk-text-truncate{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}th.uk-text-truncate,td.uk-text-truncate{max-width:0}.uk-text-break{overflow-wrap:break-word;word-wrap:break-word;-ms-hyphens:auto;-webkit-hyphens:auto;hyphens:auto}th.uk-text-break,td.uk-text-break{word-break:break-all}[class*='uk-column-']{column-gap:30px}@media (min-width: 1200px){[class*='uk-column-']{column-gap:40px}}[class*='uk-column-'] img{transform:translate3d(0, 0, 0)}.uk-column-divider{column-rule:1px solid #c4c7ca;column-gap:60px}@media (min-width: 1200px){.uk-column-divider{column-gap:80px}}.uk-column-1-2{column-count:2}.uk-column-1-3{column-count:3}.uk-column-1-4{column-count:4}.uk-column-1-5{column-count:5}.uk-column-1-6{column-count:6}@media (min-width: 640px){.uk-column-1-2\@s{column-count:2}.uk-column-1-3\@s{column-count:3}.uk-column-1-4\@s{column-count:4}.uk-column-1-5\@s{column-count:5}.uk-column-1-6\@s{column-count:6}}@media (min-width: 960px){.uk-column-1-2\@m{column-count:2}.uk-column-1-3\@m{column-count:3}.uk-column-1-4\@m{column-count:4}.uk-column-1-5\@m{column-count:5}.uk-column-1-6\@m{column-count:6}}@media (min-width: 1200px){.uk-column-1-2\@l{column-count:2}.uk-column-1-3\@l{column-count:3}.uk-column-1-4\@l{column-count:4}.uk-column-1-5\@l{column-count:5}.uk-column-1-6\@l{column-count:6}}@media (min-width: 1600px){.uk-column-1-2\@xl{column-count:2}.uk-column-1-3\@xl{column-count:3}.uk-column-1-4\@xl{column-count:4}.uk-column-1-5\@xl{column-count:5}.uk-column-1-6\@xl{column-count:6}}.uk-column-span{column-span:all}.uk-cover{max-width:none;position:absolute;left:50%;top:50%;transform:translate(-50%, -50%)}iframe.uk-cover{pointer-events:none}.uk-cover-container{overflow:hidden;position:relative}[class*='uk-align']{display:block;margin-bottom:30px}*+[class*='uk-align']{margin-top:30px}.uk-align-center{margin-left:auto;margin-right:auto}.uk-align-left{margin-top:0;margin-right:30px;float:left}.uk-align-right{margin-top:0;margin-left:30px;float:right}@media (min-width: 640px){.uk-align-left\@s{margin-top:0;margin-right:30px;float:left}.uk-align-right\@s{margin-top:0;margin-left:30px;float:right}}@media (min-width: 960px){.uk-align-left\@m{margin-top:0;margin-right:30px;float:left}.uk-align-right\@m{margin-top:0;margin-left:30px;float:right}}@media (min-width: 1200px){.uk-align-left\@l{margin-top:0;float:left}.uk-align-right\@l{margin-top:0;float:right}.uk-align-left,.uk-align-left\@s,.uk-align-left\@m,.uk-align-left\@l{margin-right:40px}.uk-align-right,.uk-align-right\@s,.uk-align-right\@m,.uk-align-right\@l{margin-left:40px}}@media (min-width: 1600px){.uk-align-left\@xl{margin-top:0;margin-right:40px;float:left}.uk-align-right\@xl{margin-top:0;margin-left:40px;float:right}}.uk-panel{position:relative;box-sizing:border-box}.uk-panel::before,.uk-panel::after{content:"";display:table}.uk-panel::after{clear:both}.uk-panel>:last-child{margin-bottom:0}.uk-panel-scrollable{height:170px;padding:10px;border:1px solid #c4c7ca;overflow:auto;-webkit-overflow-scrolling:touch;resize:both}.uk-clearfix::before{content:"";display:table-cell}.uk-clearfix::after{content:"";display:table;clear:both}.uk-float-left{float:left}.uk-float-right{float:right}[class*='uk-float-']{max-width:100%}.uk-overflow-hidden{overflow:hidden}.uk-overflow-auto{overflow:auto;-webkit-overflow-scrolling:touch}.uk-overflow-auto>:last-child{margin-bottom:0}.uk-resize{resize:both}.uk-resize-vertical{resize:vertical}.uk-display-block{display:block !important}.uk-display-inline{display:inline !important}.uk-display-inline-block{display:inline-block !important}[class*='uk-inline']{display:inline-block;position:relative;max-width:100%;vertical-align:middle;-webkit-backface-visibility:hidden}.uk-inline-clip{overflow:hidden}[class*='uk-height']{box-sizing:border-box}.uk-height-1-1{height:100%}.uk-height-viewport{min-height:100vh}.uk-height-small{height:150px}.uk-height-medium{height:300px}.uk-height-large{height:450px}.uk-height-max-small{max-height:150px}.uk-height-max-medium{max-height:300px}.uk-height-max-large{max-height:450px}.uk-preserve-width,.uk-preserve-width audio,.uk-preserve-width canvas,.uk-preserve-width img,.uk-preserve-width svg,.uk-preserve-width video{max-width:none}.uk-responsive-width,.uk-responsive-height{box-sizing:border-box}.uk-responsive-width{max-width:100% !important;height:auto}.uk-responsive-height{max-height:100%;width:auto;max-width:none}.uk-border-circle{border-radius:50%}.uk-border-rounded{border-radius:5px}.uk-inline-clip[class*='uk-border-']{-webkit-transform:translateZ(0)}.uk-box-shadow-small{box-shadow:0 2px 8px rgba(0,0,0,0.08)}.uk-box-shadow-medium{box-shadow:0 5px 15px rgba(0,0,0,0.08)}.uk-box-shadow-large{box-shadow:0 14px 25px rgba(0,0,0,0.16)}.uk-box-shadow-xlarge{box-shadow:0 28px 50px rgba(0,0,0,0.16)}[class*='uk-box-shadow-hover']{transition:box-shadow .1s ease-in-out}.uk-box-shadow-hover-small:hover{box-shadow:0 2px 8px rgba(0,0,0,0.08)}.uk-box-shadow-hover-medium:hover{box-shadow:0 5px 15px rgba(0,0,0,0.08)}.uk-box-shadow-hover-large:hover{box-shadow:0 14px 25px rgba(0,0,0,0.16)}.uk-box-shadow-hover-xlarge:hover{box-shadow:0 28px 50px rgba(0,0,0,0.16)}@supports (filter: blur(0)){.uk-box-shadow-bottom{display:inline-block;position:relative;max-width:100%;vertical-align:middle}.uk-box-shadow-bottom::before{content:'';position:absolute;bottom:-30px;left:0;right:0;height:30px;border-radius:100%;background:#444;filter:blur(20px)}.uk-box-shadow-bottom>*{position:relative}}.uk-dropcap::first-letter,.uk-dropcap>p:first-of-type::first-letter{display:block;margin-right:10px;float:left;font-size:4.5em;line-height:1;margin-bottom:-2px}.uk-leader{overflow:hidden}.uk-leader-fill::after{display:inline-block;margin-left:15px;width:0;content:attr(data-fill);white-space:nowrap}.uk-leader-fill.uk-leader-hide::after{display:none}.var-leader-fill:before{content:"."}.uk-logo{font-size:1.375rem;font-family:system-ui;color:#666;text-decoration:none}.uk-logo:hover,.uk-logo:focus{color:#666;outline:none;text-decoration:none}.uk-logo-inverse{display:none}.uk-svg,.uk-svg:not(.uk-preserve) [fill*='#']:not(.uk-preserve),.uk-svg:not(.uk-preserve) [FILL*='#']:not(.uk-preserve){fill:currentcolor}.uk-svg:not(.uk-preserve) [stroke*='#']:not(.uk-preserve),.uk-svg:not(.uk-preserve) [STROKE*='#']:not(.uk-preserve){stroke:currentcolor}.uk-svg{transform:translate(0, 0)}.uk-disabled{pointer-events:none}.uk-drag,.uk-drag *{cursor:move}.uk-drag iframe{pointer-events:none}.uk-dragover{box-shadow:0 0 20px rgba(100,100,100,0.3)}.uk-blend-multiply{mix-blend-mode:multiply}.uk-blend-screen{mix-blend-mode:screen}.uk-blend-overlay{mix-blend-mode:overlay}.uk-blend-darken{mix-blend-mode:darken}.uk-blend-lighten{mix-blend-mode:lighten}.uk-blend-color-dodge{mix-blend-mode:color-dodge}.uk-blend-color-burn{mix-blend-mode:color-burn}.uk-blend-hard-light{mix-blend-mode:hard-light}.uk-blend-soft-light{mix-blend-mode:soft-light}.uk-blend-difference{mix-blend-mode:difference}.uk-blend-exclusion{mix-blend-mode:exclusion}.uk-blend-hue{mix-blend-mode:hue}.uk-blend-saturation{mix-blend-mode:saturation}.uk-blend-color{mix-blend-mode:color}.uk-blend-luminosity{mix-blend-mode:luminosity}.uk-transform-center{transform:translate(-50%, -50%)}.uk-transform-origin-top-left{transform-origin:0 0}.uk-transform-origin-top-center{transform-origin:50% 0}.uk-transform-origin-top-right{transform-origin:100% 0}.uk-transform-origin-center-left{transform-origin:0 50%}.uk-transform-origin-center-right{transform-origin:100% 50%}.uk-transform-origin-bottom-left{transform-origin:0 100%}.uk-transform-origin-bottom-center{transform-origin:50% 100%}.uk-transform-origin-bottom-right{transform-origin:100% 100%}.remove-underline,.remove-underline:hover{text-decoration:none}.link-dark{color:#0F1214 !important}.uk-container.uk-container-xsmall{max-width:700px}.hvr-forward{display:inline-block;vertical-align:middle;-webkit-transform:perspective(1px) translateZ(0);transform:perspective(1px) translateZ(0);box-shadow:0 0 1px transparent;-webkit-transition-duration:0.3s;transition-duration:0.3s;-webkit-transition-property:transform;transition-property:transform}.hvr-forward:active,.hvr-forward:focus,.hvr-forward:hover{-webkit-transform:translateX(6px);transform:translateX(6px)}.hvr-back{display:inline-block;vertical-align:middle;-webkit-transform:perspective(1px) translateZ(0);transform:perspective(1px) translateZ(0);box-shadow:0 0 1px transparent;-webkit-transition-duration:0.3s;transition-duration:0.3s;-webkit-transition-property:transform;transition-property:transform}.hvr-back:hover,.hvr-back:focus,.hvr-back:active{-webkit-transform:translateX(-6px);transform:translateX(-6px)}.social-networks{margin-top:70px}header .uk-logo{color:#0F1214}header .uk-logo:hover{color:#0F1214}.section-title{margin-bottom:40px}.section-title ~ .section-title{margin-top:40px}@media (min-width: 960px){.section-title ~ .section-title{margin-top:70px}}.section-hero .searchBox{max-width:550px;margin:60px auto 0 auto}.section-hero .searchBox .uk-search-input{height:50px;border-radius:50px;color:#7a838a;font-style:normal}.section-hero .searchBox .uk-search-input:focus{background:#ffffff}.section-hero .searchBox .uk-search-icon{width:50px;color:#7a838a}footer .uk-subnav>.uk-active>a{color:#7a838a}#markdown-toc{padding:0 0 0 20px;border-left:solid 2px #7a838a;list-style:none;margin-bottom:40px}#markdown-toc>li>:last-child{margin-bottom:0}#markdown-toc ul{margin:0;padding-left:20px;list-style:none}#markdown-toc>li:nth-child(n+2),#markdown-toc>li>ul{margin-top:5px}#markdown-toc a{color:#7a838a}.uk-article-content .no_toc{margin-top:40px;margin-bottom:40px}#searchBox-results,#searchBox-results{margin:10px 0 0 0;z-index:1}#searchBox-results li,#searchBox-results li{margin:0;padding:20px 25px 0;background:#fff;line-height:1.4;border-left:solid 1px #c4c7ca;border-right:solid 1px #c4c7ca}#searchBox-results li:first-child,#searchBox-results li:first-child{border-top-left-radius:5px;border-top-right-radius:5px;border-top:solid 1px #c4c7ca}#searchBox-results li:last-child,#searchBox-results li:last-child{border-bottom-left-radius:5px;border-bottom-right-radius:5px;padding-bottom:25px;border-bottom:solid 1px #c4c7ca}#searchBox-results li a:hover,#searchBox-results li a:hover{text-decoration:none}.uk-flex{display:flex}.uk-flex-inline{display:inline-flex}.uk-flex::before,.uk-flex::after,.uk-flex-inline::before,.uk-flex-inline::after{display:none}.uk-flex-left{justify-content:flex-start}.uk-flex-center{justify-content:center}.uk-flex-right{justify-content:flex-end}.uk-flex-between{justify-content:space-between}.uk-flex-around{justify-content:space-around}@media (min-width: 640px){.uk-flex-left\@s{justify-content:flex-start}.uk-flex-center\@s{justify-content:center}.uk-flex-right\@s{justify-content:flex-end}.uk-flex-between\@s{justify-content:space-between}.uk-flex-around\@s{justify-content:space-around}}@media (min-width: 960px){.uk-flex-left\@m{justify-content:flex-start}.uk-flex-center\@m{justify-content:center}.uk-flex-right\@m{justify-content:flex-end}.uk-flex-between\@m{justify-content:space-between}.uk-flex-around\@m{justify-content:space-around}}@media (min-width: 1200px){.uk-flex-left\@l{justify-content:flex-start}.uk-flex-center\@l{justify-content:center}.uk-flex-right\@l{justify-content:flex-end}.uk-flex-between\@l{justify-content:space-between}.uk-flex-around\@l{justify-content:space-around}}@media (min-width: 1600px){.uk-flex-left\@xl{justify-content:flex-start}.uk-flex-center\@xl{justify-content:center}.uk-flex-right\@xl{justify-content:flex-end}.uk-flex-between\@xl{justify-content:space-between}.uk-flex-around\@xl{justify-content:space-around}}.uk-flex-stretch{align-items:stretch}.uk-flex-top{align-items:flex-start}.uk-flex-middle{align-items:center}.uk-flex-bottom{align-items:flex-end}.uk-flex-row{flex-direction:row}.uk-flex-row-reverse{flex-direction:row-reverse}.uk-flex-column{flex-direction:column}.uk-flex-column-reverse{flex-direction:column-reverse}.uk-flex-nowrap{flex-wrap:nowrap}.uk-flex-wrap{flex-wrap:wrap}.uk-flex-wrap-reverse{flex-wrap:wrap-reverse}.uk-flex-wrap-stretch{align-content:stretch}.uk-flex-wrap-top{align-content:flex-start}.uk-flex-wrap-middle{align-content:center}.uk-flex-wrap-bottom{align-content:flex-end}.uk-flex-wrap-between{align-content:space-between}.uk-flex-wrap-around{align-content:space-around}.uk-flex-first{order:-1}.uk-flex-last{order:99}@media (min-width: 640px){.uk-flex-first\@s{order:-1}.uk-flex-last\@s{order:99}}@media (min-width: 960px){.uk-flex-first\@m{order:-1}.uk-flex-last\@m{order:99}}@media (min-width: 1200px){.uk-flex-first\@l{order:-1}.uk-flex-last\@l{order:99}}@media (min-width: 1600px){.uk-flex-first\@xl{order:-1}.uk-flex-last\@xl{order:99}}.uk-flex-none{flex:none}.uk-flex-auto{flex:auto}.uk-flex-1{flex:1}.uk-margin{margin-bottom:20px}*+.uk-margin{margin-top:20px !important}.uk-margin-top{margin-top:20px !important}.uk-margin-bottom{margin-bottom:20px !important}.uk-margin-left{margin-left:20px !important}.uk-margin-right{margin-right:20px !important}.uk-margin-small{margin-bottom:10px}*+.uk-margin-small{margin-top:10px !important}.uk-margin-small-top{margin-top:10px !important}.uk-margin-small-bottom{margin-bottom:10px !important}.uk-margin-small-left{margin-left:10px !important}.uk-margin-small-right{margin-right:10px !important}.uk-margin-medium{margin-bottom:40px}*+.uk-margin-medium{margin-top:40px !important}.uk-margin-medium-top{margin-top:40px !important}.uk-margin-medium-bottom{margin-bottom:40px !important}.uk-margin-medium-left{margin-left:40px !important}.uk-margin-medium-right{margin-right:40px !important}.uk-margin-large{margin-bottom:40px}*+.uk-margin-large{margin-top:40px !important}.uk-margin-large-top{margin-top:40px !important}.uk-margin-large-bottom{margin-bottom:40px !important}.uk-margin-large-left{margin-left:40px !important}.uk-margin-large-right{margin-right:40px !important}@media (min-width: 1200px){.uk-margin-large{margin-bottom:70px}*+.uk-margin-large{margin-top:70px !important}.uk-margin-large-top{margin-top:70px !important}.uk-margin-large-bottom{margin-bottom:70px !important}.uk-margin-large-left{margin-left:70px !important}.uk-margin-large-right{margin-right:70px !important}}.uk-margin-xlarge{margin-bottom:70px}*+.uk-margin-xlarge{margin-top:70px !important}.uk-margin-xlarge-top{margin-top:70px !important}.uk-margin-xlarge-bottom{margin-bottom:70px !important}.uk-margin-xlarge-left{margin-left:70px !important}.uk-margin-xlarge-right{margin-right:70px !important}@media (min-width: 1200px){.uk-margin-xlarge{margin-bottom:140px}*+.uk-margin-xlarge{margin-top:140px !important}.uk-margin-xlarge-top{margin-top:140px !important}.uk-margin-xlarge-bottom{margin-bottom:140px !important}.uk-margin-xlarge-left{margin-left:140px !important}.uk-margin-xlarge-right{margin-right:140px !important}}.uk-margin-remove{margin:0 !important}.uk-margin-remove-top{margin-top:0 !important}.uk-margin-remove-bottom{margin-bottom:0 !important}.uk-margin-remove-left{margin-left:0 !important}.uk-margin-remove-right{margin-right:0 !important}.uk-margin-remove-vertical{margin-top:0 !important;margin-bottom:0 !important}.uk-margin-remove-adjacent+*{margin-top:0 !important}.uk-margin-auto{margin-left:auto !important;margin-right:auto !important}.uk-margin-auto-top{margin-top:auto !important}.uk-margin-auto-bottom{margin-bottom:auto !important}.uk-margin-auto-left{margin-left:auto !important}.uk-margin-auto-right{margin-right:auto !important}.uk-margin-auto-vertical{margin-top:auto !important;margin-bottom:auto !important}.uk-padding{padding:30px}@media (min-width: 1200px){.uk-padding{padding:40px}}.uk-padding-small{padding:15px}.uk-padding-large{padding:30px}@media (min-width: 1200px){.uk-padding-large{padding:70px}}.uk-padding-remove{padding:0 !important}.uk-padding-remove-top{padding-top:0 !important}.uk-padding-remove-bottom{padding-bottom:0 !important}.uk-padding-remove-left{padding-left:0 !important}.uk-padding-remove-right{padding-right:0 !important}.uk-padding-remove-vertical{padding-top:0 !important;padding-bottom:0 !important}.uk-padding-remove-horizontal{padding-left:0 !important;padding-right:0 !important}[class*='uk-position-top'],[class*='uk-position-bottom'],[class*='uk-position-left'],[class*='uk-position-right'],[class*='uk-position-center']{position:absolute !important}.uk-position-top{top:0;left:0;right:0}.uk-position-bottom{bottom:0;left:0;right:0}.uk-position-left{top:0;bottom:0;left:0}.uk-position-right{top:0;bottom:0;right:0}.uk-position-top-left{top:0;left:0}.uk-position-top-right{top:0;right:0}.uk-position-bottom-left{bottom:0;left:0}.uk-position-bottom-right{bottom:0;right:0}.uk-position-center{top:50%;left:50%;transform:translate(-50%, -50%);display:table;width:-moz-max-content;max-width:100%;box-sizing:border-box}[class*='uk-position-center-left'],[class*='uk-position-center-right']{top:50%;transform:translateY(-50%)}.uk-position-center-left{left:0}.uk-position-center-right{right:0}.uk-position-center-left-out{right:100%;width:max-content}.uk-position-center-right-out{left:100%;width:max-content}.uk-position-top-center,.uk-position-bottom-center{left:50%;transform:translateX(-50%);display:table;width:-moz-max-content;max-width:100%;box-sizing:border-box}.uk-position-top-center{top:0}.uk-position-bottom-center{bottom:0}.uk-position-cover{position:absolute;top:0;bottom:0;left:0;right:0}.uk-position-relative{position:relative !important}.uk-position-absolute{position:absolute !important}.uk-position-fixed{position:fixed !important}.uk-position-z-index{z-index:1}.uk-position-small{margin:15px}.uk-position-small.uk-position-center{transform:translate(-50%, -50%) translate(-15px, -15px)}.uk-position-small[class*='uk-position-center-left'],.uk-position-small[class*='uk-position-center-right']{transform:translateY(-50%) translateY(-15px)}.uk-position-small.uk-position-top-center,.uk-position-small.uk-position-bottom-center{transform:translateX(-50%) translateX(-15px)}.uk-position-medium{margin:30px}.uk-position-medium.uk-position-center{transform:translate(-50%, -50%) translate(-30px, -30px)}.uk-position-medium[class*='uk-position-center-left'],.uk-position-medium[class*='uk-position-center-right']{transform:translateY(-50%) translateY(-30px)}.uk-position-medium.uk-position-top-center,.uk-position-medium.uk-position-bottom-center{transform:translateX(-50%) translateX(-30px)}.uk-position-large{margin:30px}.uk-position-large.uk-position-center{transform:translate(-50%, -50%) translate(-30px, -30px)}.uk-position-large[class*='uk-position-center-left'],.uk-position-large[class*='uk-position-center-right']{transform:translateY(-50%) translateY(-30px)}.uk-position-large.uk-position-top-center,.uk-position-large.uk-position-bottom-center{transform:translateX(-50%) translateX(-30px)}@media (min-width: 1200px){.uk-position-large{margin:50px}.uk-position-large.uk-position-center{transform:translate(-50%, -50%) translate(-50px, -50px)}.uk-position-large[class*='uk-position-center-left'],.uk-position-large[class*='uk-position-center-right']{transform:translateY(-50%) translateY(-50px)}.uk-position-large.uk-position-top-center,.uk-position-large.uk-position-bottom-center{transform:translateX(-50%) translateX(-50px)}}[hidden],.uk-hidden{display:none !important}@media (min-width: 640px){.uk-hidden\@s{display:none !important}}@media (min-width: 960px){.uk-hidden\@m{display:none !important}}@media (min-width: 1200px){.uk-hidden\@l{display:none !important}}@media (min-width: 1600px){.uk-hidden\@xl{display:none !important}}@media (max-width: 639px){.uk-visible\@s{display:none !important}}@media (max-width: 959px){.uk-visible\@m{display:none !important}}@media (max-width: 1199px){.uk-visible\@l{display:none !important}}@media (max-width: 1599px){.uk-visible\@xl{display:none !important}}.uk-invisible{visibility:hidden !important}.uk-visible-toggle:not(:hover):not(.uk-hover) .uk-hidden-hover:not(:focus){position:absolute !important;width:0 !important;height:0 !important;padding:0 !important;margin:0 !important;overflow:hidden !important}.uk-visible-toggle:not(:hover):not(.uk-hover) .uk-invisible-hover:not(:focus){opacity:0 !important}@media (pointer: coarse){.uk-hidden-touch{display:none !important}}.uk-hidden-notouch{display:none !important}@media (pointer: coarse){.uk-hidden-notouch{display:block !important}}@media print{*,*::before,*::after{background:transparent !important;color:black !important;box-shadow:none !important;text-shadow:none !important}a,a:visited{text-decoration:underline}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}}.highlight,.highlighter-rouge{background-color:#F7F8FA;color:#5A6575;border:none}.highlight .lineno{color:#B1B8C4}.highlight .c{color:#B1B8C4}.highlight .err{color:#5A6575}.highlight .g{color:#5A6575}.highlight .k{color:#25BEA1}.highlight .l{color:#5A6575}.highlight .n{color:#5A6575}.highlight .o{color:#25BEA1}.highlight .x{color:#FBBC09}.highlight .p{color:#25BEA1}.highlight .cm{color:#B1B8C4}.highlight .cp{color:#25BEA1}.highlight .c1{color:#B1B8C4}.highlight .cs{color:#25BEA1}.highlight .gd{color:#E56134}.highlight .ge{color:#5A6575;font-style:italic}.highlight .gr{color:#9961C9}.highlight .gh{color:#FBBC09}.highlight .gi{color:#25BEA1}.highlight .go{color:#5A6575}.highlight .gp{color:#FBBC09}.highlight .gs{color:#5A6575;font-weight:bold}.highlight .gu{color:#FBBC09}.highlight .gt{color:#5A6575}.highlight .kc{color:#FBBC09}.highlight .kd{color:#11A0F3}.highlight .kn{color:#25BEA1}.highlight .kp{color:#25BEA1}.highlight .kr{color:#11A0F3}.highlight .kt{color:#9961C9}.highlight .ld{color:#5A6575}.highlight .m{color:#E56134}.highlight .s{color:#E56134}.highlight .na{color:#5A6575}.highlight .nb{color:#5A6575}.highlight .nc{color:#11A0F3}.highlight .no{color:#5A6575}.highlight .nd{color:#11A0F3}.highlight .ni{color:#FBBC09}.highlight .ne{color:#FBBC09}.highlight .nf{color:#11A0F3}.highlight .nl{color:#5A6575}.highlight .nn{color:#5A6575}.highlight .nx{color:#5A6575}.highlight .py{color:#5A6575}.highlight .nt{color:#11A0F3}.highlight .nv{color:#5A6575}.highlight .ow{color:#25BEA1}.highlight .w{color:#5A6575}.highlight .mf{color:#E56134}.highlight .mh{color:#E56134}.highlight .mi{color:#E56134}.highlight .mo{color:#E56134}.highlight .sb{color:#B1B8C4}.highlight .sc{color:#E56134}.highlight .sd{color:#5A6575}.highlight .s2{color:#E56134}.highlight .se{color:#FBBC09}.highlight .sh{color:#5A6575}.highlight .si{color:#E56134}.highlight .sx{color:#E56134}.highlight .sr{color:#9961C9}.highlight .s1{color:#E56134}.highlight .ss{color:#E56134}.highlight .bp{color:#11A0F3}.highlight .vc{color:#11A0F3}.highlight .vg{color:#11A0F3}.highlight .vi{color:#11A0F3}.highlight .il{color:#E56134} diff --git a/_site/assets/img/favicon.png b/_site/assets/img/favicon.png new file mode 100644 index 00000000..09d6ca94 Binary files /dev/null and b/_site/assets/img/favicon.png differ diff --git a/_site/assets/img/location.svg b/_site/assets/img/location.svg new file mode 100644 index 00000000..e71e58b0 --- /dev/null +++ b/_site/assets/img/location.svg @@ -0,0 +1,13 @@ + + + + location-dark + Created with Sketch. + + + + + + + + \ No newline at end of file diff --git a/_site/assets/img/touch-icon.png b/_site/assets/img/touch-icon.png new file mode 100644 index 00000000..243615bb Binary files /dev/null and b/_site/assets/img/touch-icon.png differ diff --git a/_site/assets/js/custom.js b/_site/assets/js/custom.js new file mode 100644 index 00000000..d123eb35 --- /dev/null +++ b/_site/assets/js/custom.js @@ -0,0 +1 @@ +// Custom scripts diff --git a/_site/assets/js/main.js b/_site/assets/js/main.js new file mode 100644 index 00000000..031cf722 --- /dev/null +++ b/_site/assets/js/main.js @@ -0,0 +1,8772 @@ +(function(global, factory) { + typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define("uikit", factory) : global.UIkit = factory(); +})(this, function() { + "use strict"; + function bind(fn, context) { + return function(a) { + var l = arguments.length; + return l ? l > 1 ? fn.apply(context, arguments) : fn.call(context, a) : fn.call(context); + }; + } + var ref = Object.prototype; + var hasOwnProperty = ref.hasOwnProperty; + function hasOwn(obj, key) { + return hasOwnProperty.call(obj, key); + } + var hyphenateRe = /([a-z\d])([A-Z])/g; + function hyphenate(str) { + return str.replace(hyphenateRe, "$1-$2").toLowerCase(); + } + var camelizeRE = /-(\w)/g; + function camelize(str) { + return str.replace(camelizeRE, toUpper); + } + function toUpper(_, c) { + return c ? c.toUpperCase() : ""; + } + function ucfirst(str) { + return str.length ? toUpper(null, str.charAt(0)) + str.slice(1) : ""; + } + var strPrototype = String.prototype; + var startsWithFn = strPrototype.startsWith || function(search) { + return this.lastIndexOf(search, 0) === 0; + }; + function startsWith(str, search) { + return startsWithFn.call(str, search); + } + var endsWithFn = strPrototype.endsWith || function(search) { + return this.substr(-search.length) === search; + }; + function endsWith(str, search) { + return endsWithFn.call(str, search); + } + var includesFn = function(search) { + return ~this.indexOf(search); + }; + var includesStr = strPrototype.includes || includesFn; + var includesArray = Array.prototype.includes || includesFn; + function includes(obj, search) { + return obj && (isString(obj) ? includesStr : includesArray).call(obj, search); + } + var isArray = Array.isArray; + function isFunction(obj) { + return typeof obj === "function"; + } + function isObject(obj) { + return obj !== null && typeof obj === "object"; + } + function isPlainObject(obj) { + return isObject(obj) && Object.getPrototypeOf(obj) === Object.prototype; + } + function isWindow(obj) { + return isObject(obj) && obj === obj.window; + } + function isDocument(obj) { + return isObject(obj) && obj.nodeType === 9; + } + function isJQuery(obj) { + return isObject(obj) && !!obj.jquery; + } + function isNode(element) { + return element instanceof Node || isObject(element) && element.nodeType === 1; + } + function isNodeCollection(element) { + return element instanceof NodeList || element instanceof HTMLCollection; + } + function isBoolean(value) { + return typeof value === "boolean"; + } + function isString(value) { + return typeof value === "string"; + } + function isNumber(value) { + return typeof value === "number"; + } + function isNumeric(value) { + return isNumber(value) || isString(value) && !isNaN(value - parseFloat(value)); + } + function isUndefined(value) { + return value === void 0; + } + function toBoolean(value) { + return isBoolean(value) ? value : value === "true" || value === "1" || value === "" ? true : value === "false" || value === "0" ? false : value; + } + function toNumber(value) { + var number = Number(value); + return !isNaN(number) ? number : false; + } + function toFloat(value) { + return parseFloat(value) || 0; + } + function toNode(element) { + return isNode(element) || isWindow(element) || isDocument(element) ? element : isNodeCollection(element) || isJQuery(element) ? element[0] : isArray(element) ? toNode(element[0]) : null; + } + var arrayProto = Array.prototype; + function toNodes(element) { + return isNode(element) ? [ element ] : isNodeCollection(element) ? arrayProto.slice.call(element) : isArray(element) ? element.map(toNode).filter(Boolean) : isJQuery(element) ? element.toArray() : []; + } + function toList(value) { + return isArray(value) ? value : isString(value) ? value.split(/,(?![^(]*\))/).map(function(value) { + return isNumeric(value) ? toNumber(value) : toBoolean(value.trim()); + }) : [ value ]; + } + function toMs(time) { + return !time ? 0 : endsWith(time, "ms") ? toFloat(time) : toFloat(time) * 1e3; + } + function swap(value, a, b) { + return value.replace(new RegExp(a + "|" + b, "mg"), function(match) { + return match === a ? b : a; + }); + } + var assign = Object.assign || function(target) { + var args = [], len = arguments.length - 1; + while (len-- > 0) args[len] = arguments[len + 1]; + target = Object(target); + for (var i = 0; i < args.length; i++) { + var source = args[i]; + if (source !== null) { + for (var key in source) { + if (hasOwn(source, key)) { + target[key] = source[key]; + } + } + } + } + return target; + }; + function each(obj, cb) { + for (var key in obj) { + if (cb.call(obj[key], obj[key], key) === false) { + break; + } + } + } + function sortBy(collection, prop) { + return collection.sort(function(a, b) { + return a[prop] - b[prop]; + }); + } + function clamp(number, min, max) { + if (min === void 0) min = 0; + if (max === void 0) max = 1; + return Math.min(Math.max(number, min), max); + } + function noop() {} + function intersectRect(r1, r2) { + return r1.left <= r2.right && r2.left <= r1.right && r1.top <= r2.bottom && r2.top <= r1.bottom; + } + function pointInRect(point, rect) { + return intersectRect({ + top: point.y, + bottom: point.y, + left: point.x, + right: point.x + }, rect); + } + var Dimensions = { + ratio: function ratio(dimensions, prop, value) { + var obj; + var aProp = prop === "width" ? "height" : "width"; + return obj = {}, obj[aProp] = Math.round(value * dimensions[aProp] / dimensions[prop]), + obj[prop] = value, obj; + }, + contain: function contain(dimensions, maxDimensions) { + var this$1 = this; + dimensions = assign({}, dimensions); + each(dimensions, function(_, prop) { + return dimensions = dimensions[prop] > maxDimensions[prop] ? this$1.ratio(dimensions, prop, maxDimensions[prop]) : dimensions; + }); + return dimensions; + }, + cover: function cover(dimensions, maxDimensions) { + var this$1 = this; + dimensions = this.contain(dimensions, maxDimensions); + each(dimensions, function(_, prop) { + return dimensions = dimensions[prop] < maxDimensions[prop] ? this$1.ratio(dimensions, prop, maxDimensions[prop]) : dimensions; + }); + return dimensions; + } + }; + function attr(element, name, value) { + if (isObject(name)) { + for (var key in name) { + attr(element, key, name[key]); + } + return; + } + if (isUndefined(value)) { + element = toNode(element); + return element && element.getAttribute(name); + } else { + toNodes(element).forEach(function(element) { + if (isFunction(value)) { + value = value.call(element, attr(element, name)); + } + if (value === null) { + removeAttr(element, name); + } else { + element.setAttribute(name, value); + } + }); + } + } + function hasAttr(element, name) { + return toNodes(element).some(function(element) { + return element.hasAttribute(name); + }); + } + function removeAttr(element, name) { + element = toNodes(element); + name.split(" ").forEach(function(name) { + return element.forEach(function(element) { + return element.removeAttribute(name); + }); + }); + } + function filterAttr(element, attribute, pattern, replacement) { + attr(element, attribute, function(value) { + return value ? value.replace(pattern, replacement) : value; + }); + } + function data(element, attribute) { + for (var i = 0, attrs = [ attribute, "data-" + attribute ]; i < attrs.length; i++) { + if (hasAttr(element, attrs[i])) { + return attr(element, attrs[i]); + } + } + } + function query(selector, context) { + return toNode(selector) || find(selector, isContextSelector(selector) ? context : document); + } + function queryAll(selector, context) { + var nodes = toNodes(selector); + return nodes.length && nodes || findAll(selector, isContextSelector(selector) ? context : document); + } + function find(selector, context) { + return toNode(_query(selector, context, "querySelector")); + } + function findAll(selector, context) { + return toNodes(_query(selector, context, "querySelectorAll")); + } + function _query(selector, context, queryFn) { + if (context === void 0) context = document; + if (!selector || !isString(selector)) { + return null; + } + selector = selector.replace(contextSanitizeRe, "$1 *"); + var removes; + if (isContextSelector(selector)) { + removes = []; + selector = selector.split(",").map(function(selector, i) { + var ctx = context; + selector = selector.trim(); + if (selector[0] === "!") { + var selectors = selector.substr(1).trim().split(" "); + ctx = closest(context.parentNode, selectors[0]); + selector = selectors.slice(1).join(" "); + } + if (!ctx) { + return null; + } + if (!ctx.id) { + ctx.id = "uk-" + Date.now() + i; + removes.push(function() { + return removeAttr(ctx, "id"); + }); + } + return "#" + escape(ctx.id) + " " + selector; + }).filter(Boolean).join(","); + context = document; + } + try { + return context[queryFn](selector); + } catch (e) { + return null; + } finally { + removes && removes.forEach(function(remove) { + return remove(); + }); + } + } + var contextSelectorRe = /(^|,)\s*[!>+~]/; + var contextSanitizeRe = /([!>+~])(?=\s+[!>+~]|\s*$)/g; + function isContextSelector(selector) { + return isString(selector) && selector.match(contextSelectorRe); + } + var elProto = Element.prototype; + var matchesFn = elProto.matches || elProto.webkitMatchesSelector || elProto.msMatchesSelector; + function matches(element, selector) { + return toNodes(element).some(function(element) { + return matchesFn.call(element, selector); + }); + } + var closestFn = elProto.closest || function(selector) { + var ancestor = this; + do { + if (matches(ancestor, selector)) { + return ancestor; + } + ancestor = ancestor.parentNode; + } while (ancestor && ancestor.nodeType === 1); + }; + function closest(element, selector) { + if (startsWith(selector, ">")) { + selector = selector.slice(1); + } + return isNode(element) ? element.parentNode && closestFn.call(element, selector) : toNodes(element).map(function(element) { + return element.parentNode && closestFn.call(element, selector); + }).filter(Boolean); + } + function parents(element, selector) { + var elements = []; + var parent = toNode(element).parentNode; + while (parent && parent.nodeType === 1) { + if (matches(parent, selector)) { + elements.push(parent); + } + parent = parent.parentNode; + } + return elements; + } + var escapeFn = window.CSS && CSS.escape || function(css) { + return css.replace(/([^\x7f-\uFFFF\w-])/g, function(match) { + return "\\" + match; + }); + }; + function escape(css) { + return isString(css) ? escapeFn.call(null, css) : ""; + } + var voidElements = { + area: true, + base: true, + br: true, + col: true, + embed: true, + hr: true, + img: true, + input: true, + keygen: true, + link: true, + menuitem: true, + meta: true, + param: true, + source: true, + track: true, + wbr: true + }; + function isVoidElement(element) { + return toNodes(element).some(function(element) { + return voidElements[element.tagName.toLowerCase()]; + }); + } + function isVisible(element) { + return toNodes(element).some(function(element) { + return element.offsetHeight || element.getBoundingClientRect().height; + }); + } + var selInput = "input,select,textarea,button"; + function isInput(element) { + return toNodes(element).some(function(element) { + return matches(element, selInput); + }); + } + function filter(element, selector) { + return toNodes(element).filter(function(element) { + return matches(element, selector); + }); + } + function within(element, selector) { + return !isString(selector) ? element === selector || (isDocument(selector) ? selector.documentElement : toNode(selector)).contains(toNode(element)) : matches(element, selector) || closest(element, selector); + } + function on() { + var args = [], len = arguments.length; + while (len--) args[len] = arguments[len]; + var ref = getArgs(args); + var target = ref[0]; + var type = ref[1]; + var selector = ref[2]; + var listener = ref[3]; + var useCapture = ref[4]; + target = toEventTarget(target); + if (selector) { + listener = delegate(target, selector, listener); + } + if (listener.length > 1) { + listener = detail(listener); + } + type.split(" ").forEach(function(type) { + return target && target.addEventListener(type, listener, useCapture); + }); + return function() { + return off(target, type, listener, useCapture); + }; + } + function off(target, type, listener, useCapture) { + if (useCapture === void 0) useCapture = false; + target = toEventTarget(target); + target && type.split(" ").forEach(function(type) { + return target.removeEventListener(type, listener, useCapture); + }); + } + function once() { + var args = [], len = arguments.length; + while (len--) args[len] = arguments[len]; + var ref = getArgs(args); + var element = ref[0]; + var type = ref[1]; + var selector = ref[2]; + var listener = ref[3]; + var useCapture = ref[4]; + var condition = ref[5]; + var off = on(element, type, selector, function(e) { + var result = !condition || condition(e); + if (result) { + off(); + listener(e, result); + } + }, useCapture); + return off; + } + function trigger(target, event, detail) { + return toEventTargets(target).reduce(function(notCanceled, target) { + return notCanceled && target.dispatchEvent(createEvent(event, true, true, detail)); + }, true); + } + function createEvent(e, bubbles, cancelable, detail) { + if (bubbles === void 0) bubbles = true; + if (cancelable === void 0) cancelable = false; + if (isString(e)) { + var event = document.createEvent("CustomEvent"); + event.initCustomEvent(e, bubbles, cancelable, detail); + e = event; + } + return e; + } + function getArgs(args) { + if (isString(args[0])) { + args[0] = find(args[0]); + } + if (isFunction(args[2])) { + args.splice(2, 0, false); + } + return args; + } + function delegate(element, selector, listener) { + var this$1 = this; + return function(e) { + var target = e.target; + var current = selector[0] === ">" ? findAll(selector, element).reverse().filter(function(element) { + return within(target, element); + })[0] : closest(target, selector); + if (current) { + e.delegate = element; + e.current = current; + listener.call(this$1, e); + } + }; + } + function detail(listener) { + return function(e) { + return isArray(e.detail) ? listener.apply(listener, [ e ].concat(e.detail)) : listener(e); + }; + } + function isEventTarget(target) { + return "EventTarget" in window ? target instanceof EventTarget : target && "addEventListener" in target; + } + function toEventTarget(target) { + return isEventTarget(target) ? target : toNode(target); + } + function toEventTargets(target) { + return isEventTarget(target) ? [ target ] : isArray(target) ? target.map(toEventTarget).filter(Boolean) : toNodes(target); + } + function preventClick() { + var timer = setTimeout(once(document, "click", function(e) { + e.preventDefault(); + e.stopImmediatePropagation(); + clearTimeout(timer); + }, true)); + trigger(document, "touchcancel"); + } + var Promise = "Promise" in window ? window.Promise : PromiseFn; + var Deferred = function Deferred() { + var this$1 = this; + this.promise = new Promise(function(resolve, reject) { + this$1.reject = reject; + this$1.resolve = resolve; + }); + }; + var RESOLVED = 0; + var REJECTED = 1; + var PENDING = 2; + var async = "setImmediate" in window ? setImmediate : setTimeout; + function PromiseFn(executor) { + this.state = PENDING; + this.value = undefined; + this.deferred = []; + var promise = this; + try { + executor(function(x) { + promise.resolve(x); + }, function(r) { + promise.reject(r); + }); + } catch (e) { + promise.reject(e); + } + } + PromiseFn.reject = function(r) { + return new PromiseFn(function(resolve, reject) { + reject(r); + }); + }; + PromiseFn.resolve = function(x) { + return new PromiseFn(function(resolve, reject) { + resolve(x); + }); + }; + PromiseFn.all = function all(iterable) { + return new PromiseFn(function(resolve, reject) { + var result = []; + var count = 0; + if (iterable.length === 0) { + resolve(result); + } + function resolver(i) { + return function(x) { + result[i] = x; + count += 1; + if (count === iterable.length) { + resolve(result); + } + }; + } + for (var i = 0; i < iterable.length; i += 1) { + PromiseFn.resolve(iterable[i]).then(resolver(i), reject); + } + }); + }; + PromiseFn.race = function race(iterable) { + return new PromiseFn(function(resolve, reject) { + for (var i = 0; i < iterable.length; i += 1) { + PromiseFn.resolve(iterable[i]).then(resolve, reject); + } + }); + }; + var p = PromiseFn.prototype; + p.resolve = function resolve(x) { + var promise = this; + if (promise.state === PENDING) { + if (x === promise) { + throw new TypeError("Promise settled with itself."); + } + var called = false; + try { + var then = x && x.then; + if (x !== null && isObject(x) && isFunction(then)) { + then.call(x, function(x) { + if (!called) { + promise.resolve(x); + } + called = true; + }, function(r) { + if (!called) { + promise.reject(r); + } + called = true; + }); + return; + } + } catch (e) { + if (!called) { + promise.reject(e); + } + return; + } + promise.state = RESOLVED; + promise.value = x; + promise.notify(); + } + }; + p.reject = function reject(reason) { + var promise = this; + if (promise.state === PENDING) { + if (reason === promise) { + throw new TypeError("Promise settled with itself."); + } + promise.state = REJECTED; + promise.value = reason; + promise.notify(); + } + }; + p.notify = function notify() { + var this$1 = this; + async(function() { + if (this$1.state !== PENDING) { + while (this$1.deferred.length) { + var ref = this$1.deferred.shift(); + var onResolved = ref[0]; + var onRejected = ref[1]; + var resolve = ref[2]; + var reject = ref[3]; + try { + if (this$1.state === RESOLVED) { + if (isFunction(onResolved)) { + resolve(onResolved.call(undefined, this$1.value)); + } else { + resolve(this$1.value); + } + } else if (this$1.state === REJECTED) { + if (isFunction(onRejected)) { + resolve(onRejected.call(undefined, this$1.value)); + } else { + reject(this$1.value); + } + } + } catch (e) { + reject(e); + } + } + } + }); + }; + p.then = function then(onResolved, onRejected) { + var this$1 = this; + return new PromiseFn(function(resolve, reject) { + this$1.deferred.push([ onResolved, onRejected, resolve, reject ]); + this$1.notify(); + }); + }; + p.catch = function(onRejected) { + return this.then(undefined, onRejected); + }; + function ajax(url, options) { + return new Promise(function(resolve, reject) { + var env = assign({ + data: null, + method: "GET", + headers: {}, + xhr: new XMLHttpRequest(), + beforeSend: noop, + responseType: "" + }, options); + env.beforeSend(env); + var xhr = env.xhr; + for (var prop in env) { + if (prop in xhr) { + try { + xhr[prop] = env[prop]; + } catch (e) {} + } + } + xhr.open(env.method.toUpperCase(), url); + for (var header in env.headers) { + xhr.setRequestHeader(header, env.headers[header]); + } + on(xhr, "load", function() { + if (xhr.status === 0 || xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) { + resolve(xhr); + } else { + reject(assign(Error(xhr.statusText), { + xhr: xhr, + status: xhr.status + })); + } + }); + on(xhr, "error", function() { + return reject(assign(Error("Network Error"), { + xhr: xhr + })); + }); + on(xhr, "timeout", function() { + return reject(assign(Error("Network Timeout"), { + xhr: xhr + })); + }); + xhr.send(env.data); + }); + } + function getImage(src) { + return new Promise(function(resolve, reject) { + var img = new Image(); + img.onerror = reject; + img.onload = function() { + return resolve(img); + }; + img.src = src; + }); + } + function isReady() { + return document.readyState === "complete" || document.readyState !== "loading" && !document.documentElement.doScroll; + } + function ready(fn) { + if (isReady()) { + fn(); + return; + } + var handle = function() { + unbind1(); + unbind2(); + fn(); + }; + var unbind1 = on(document, "DOMContentLoaded", handle); + var unbind2 = on(window, "load", handle); + } + function index(element, ref) { + return ref ? toNodes(element).indexOf(toNode(ref)) : toNodes((element = toNode(element)) && element.parentNode.children).indexOf(element); + } + function getIndex(i, elements, current, finite) { + if (current === void 0) current = 0; + if (finite === void 0) finite = false; + elements = toNodes(elements); + var length = elements.length; + i = isNumeric(i) ? toNumber(i) : i === "next" ? current + 1 : i === "previous" ? current - 1 : index(elements, i); + if (finite) { + return clamp(i, 0, length - 1); + } + i %= length; + return i < 0 ? i + length : i; + } + function empty(element) { + element = toNode(element); + element.innerHTML = ""; + return element; + } + function html(parent, html) { + parent = toNode(parent); + return isUndefined(html) ? parent.innerHTML : append(parent.hasChildNodes() ? empty(parent) : parent, html); + } + function prepend(parent, element) { + parent = toNode(parent); + if (!parent.hasChildNodes()) { + return append(parent, element); + } else { + return insertNodes(element, function(element) { + return parent.insertBefore(element, parent.firstChild); + }); + } + } + function append(parent, element) { + parent = toNode(parent); + return insertNodes(element, function(element) { + return parent.appendChild(element); + }); + } + function before(ref, element) { + ref = toNode(ref); + return insertNodes(element, function(element) { + return ref.parentNode.insertBefore(element, ref); + }); + } + function after(ref, element) { + ref = toNode(ref); + return insertNodes(element, function(element) { + return ref.nextSibling ? before(ref.nextSibling, element) : append(ref.parentNode, element); + }); + } + function insertNodes(element, fn) { + element = isString(element) ? fragment(element) : element; + return element ? "length" in element ? toNodes(element).map(fn) : fn(element) : null; + } + function remove(element) { + toNodes(element).map(function(element) { + return element.parentNode && element.parentNode.removeChild(element); + }); + } + function wrapAll(element, structure) { + structure = toNode(before(element, structure)); + while (structure.firstChild) { + structure = structure.firstChild; + } + append(structure, element); + return structure; + } + function wrapInner(element, structure) { + return toNodes(toNodes(element).map(function(element) { + return element.hasChildNodes ? wrapAll(toNodes(element.childNodes), structure) : append(element, structure); + })); + } + function unwrap(element) { + toNodes(element).map(function(element) { + return element.parentNode; + }).filter(function(value, index, self) { + return self.indexOf(value) === index; + }).forEach(function(parent) { + before(parent, parent.childNodes); + remove(parent); + }); + } + var fragmentRE = /^\s*<(\w+|!)[^>]*>/; + var singleTagRE = /^<(\w+)\s*\/?>(?:<\/\1>)?$/; + function fragment(html) { + var matches = singleTagRE.exec(html); + if (matches) { + return document.createElement(matches[1]); + } + var container = document.createElement("div"); + if (fragmentRE.test(html)) { + container.insertAdjacentHTML("beforeend", html.trim()); + } else { + container.textContent = html; + } + return container.childNodes.length > 1 ? toNodes(container.childNodes) : container.firstChild; + } + function apply(node, fn) { + if (!node || node.nodeType !== 1) { + return; + } + fn(node); + node = node.firstElementChild; + while (node) { + apply(node, fn); + node = node.nextElementSibling; + } + } + function addClass(element) { + var args = [], len = arguments.length - 1; + while (len-- > 0) args[len] = arguments[len + 1]; + apply$1(element, args, "add"); + } + function removeClass(element) { + var args = [], len = arguments.length - 1; + while (len-- > 0) args[len] = arguments[len + 1]; + apply$1(element, args, "remove"); + } + function removeClasses(element, cls) { + filterAttr(element, "class", new RegExp("(^|\\s)" + cls + "(?!\\S)", "g"), ""); + } + function replaceClass(element) { + var args = [], len = arguments.length - 1; + while (len-- > 0) args[len] = arguments[len + 1]; + args[0] && removeClass(element, args[0]); + args[1] && addClass(element, args[1]); + } + function hasClass(element, cls) { + return toNodes(element).some(function(element) { + return element.classList.contains(cls); + }); + } + function toggleClass(element) { + var args = [], len = arguments.length - 1; + while (len-- > 0) args[len] = arguments[len + 1]; + if (!args.length) { + return; + } + args = getArgs$1(args); + var force = !isString(args[args.length - 1]) ? args.pop() : []; + args = args.filter(Boolean); + toNodes(element).forEach(function(ref) { + var classList = ref.classList; + for (var i = 0; i < args.length; i++) { + supports.Force ? classList.toggle.apply(classList, [ args[i] ].concat(force)) : classList[(!isUndefined(force) ? force : !classList.contains(args[i])) ? "add" : "remove"](args[i]); + } + }); + } + function apply$1(element, args, fn) { + args = getArgs$1(args).filter(Boolean); + args.length && toNodes(element).forEach(function(ref) { + var classList = ref.classList; + supports.Multiple ? classList[fn].apply(classList, args) : args.forEach(function(cls) { + return classList[fn](cls); + }); + }); + } + function getArgs$1(args) { + return args.reduce(function(args, arg) { + return args.concat.call(args, isString(arg) && includes(arg, " ") ? arg.trim().split(" ") : arg); + }, []); + } + var supports = {}; + (function() { + var list = document.createElement("_").classList; + if (list) { + list.add("a", "b"); + list.toggle("c", false); + supports.Multiple = list.contains("b"); + supports.Force = !list.contains("c"); + } + list = null; + })(); + var cssNumber = { + "animation-iteration-count": true, + "column-count": true, + "fill-opacity": true, + "flex-grow": true, + "flex-shrink": true, + "font-weight": true, + "line-height": true, + opacity: true, + order: true, + orphans: true, + widows: true, + "z-index": true, + zoom: true + }; + function css(element, property, value) { + return toNodes(element).map(function(element) { + if (isString(property)) { + property = propName(property); + if (isUndefined(value)) { + return getStyle(element, property); + } else if (!value && value !== 0) { + element.style.removeProperty(property); + } else { + element.style[property] = isNumeric(value) && !cssNumber[property] ? value + "px" : value; + } + } else if (isArray(property)) { + var styles = getStyles(element); + return property.reduce(function(props, property) { + props[property] = styles[propName(property)]; + return props; + }, {}); + } else if (isObject(property)) { + each(property, function(value, property) { + return css(element, property, value); + }); + } + return element; + })[0]; + } + function getStyles(element, pseudoElt) { + element = toNode(element); + return element.ownerDocument.defaultView.getComputedStyle(element, pseudoElt); + } + function getStyle(element, property, pseudoElt) { + return getStyles(element, pseudoElt)[property]; + } + var vars = {}; + function getCssVar(name) { + if (!(name in vars)) { + var element = append(document.documentElement, document.createElement("div")); + addClass(element, "var-" + name); + try { + vars[name] = getStyle(element, "content", ":before").replace(/^["'](.*)["']$/, "$1"); + vars[name] = JSON.parse(vars[name]); + } catch (e) {} + document.documentElement.removeChild(element); + } + return vars[name]; + } + var cssProps = {}; + function propName(name) { + var ret = cssProps[name]; + if (!ret) { + ret = cssProps[name] = vendorPropName(name) || name; + } + return ret; + } + var cssPrefixes = [ "webkit", "moz", "ms" ]; + var ref$1 = document.createElement("_"); + var style = ref$1.style; + function vendorPropName(name) { + name = hyphenate(name); + if (name in style) { + return name; + } + var i = cssPrefixes.length, prefixedName; + while (i--) { + prefixedName = "-" + cssPrefixes[i] + "-" + name; + if (prefixedName in style) { + return prefixedName; + } + } + } + function transition(element, props, duration, timing) { + if (duration === void 0) duration = 400; + if (timing === void 0) timing = "linear"; + return Promise.all(toNodes(element).map(function(element) { + return new Promise(function(resolve, reject) { + for (var name in props) { + var value = css(element, name); + if (value === "") { + css(element, name, value); + } + } + var timer = setTimeout(function() { + return trigger(element, "transitionend"); + }, duration); + once(element, "transitionend transitioncanceled", function(ref) { + var type = ref.type; + clearTimeout(timer); + removeClass(element, "uk-transition"); + css(element, { + "transition-property": "", + "transition-duration": "", + "transition-timing-function": "" + }); + type === "transitioncanceled" ? reject() : resolve(); + }, false, function(ref) { + var target = ref.target; + return element === target; + }); + addClass(element, "uk-transition"); + css(element, assign({ + "transition-property": Object.keys(props).map(propName).join(","), + "transition-duration": duration + "ms", + "transition-timing-function": timing + }, props)); + }); + })); + } + var Transition = { + start: transition, + stop: function stop(element) { + trigger(element, "transitionend"); + return Promise.resolve(); + }, + cancel: function cancel(element) { + trigger(element, "transitioncanceled"); + }, + inProgress: function inProgress(element) { + return hasClass(element, "uk-transition"); + } + }; + var animationPrefix = "uk-animation-"; + var clsCancelAnimation = "uk-cancel-animation"; + function animate(element, animation, duration, origin, out) { + var arguments$1 = arguments; + if (duration === void 0) duration = 200; + return Promise.all(toNodes(element).map(function(element) { + return new Promise(function(resolve, reject) { + if (hasClass(element, clsCancelAnimation)) { + requestAnimationFrame(function() { + return Promise.resolve().then(function() { + return animate.apply(void 0, arguments$1).then(resolve, reject); + }); + }); + return; + } + var cls = animation + " " + animationPrefix + (out ? "leave" : "enter"); + if (startsWith(animation, animationPrefix)) { + if (origin) { + cls += " uk-transform-origin-" + origin; + } + if (out) { + cls += " " + animationPrefix + "reverse"; + } + } + reset(); + once(element, "animationend animationcancel", function(ref) { + var type = ref.type; + var hasReset = false; + if (type === "animationcancel") { + reject(); + reset(); + } else { + resolve(); + Promise.resolve().then(function() { + hasReset = true; + reset(); + }); + } + requestAnimationFrame(function() { + if (!hasReset) { + addClass(element, clsCancelAnimation); + requestAnimationFrame(function() { + return removeClass(element, clsCancelAnimation); + }); + } + }); + }, false, function(ref) { + var target = ref.target; + return element === target; + }); + css(element, "animationDuration", duration + "ms"); + addClass(element, cls); + function reset() { + css(element, "animationDuration", ""); + removeClasses(element, animationPrefix + "\\S*"); + } + }); + })); + } + var inProgress = new RegExp(animationPrefix + "(enter|leave)"); + var Animation = { + in: function in$1(element, animation, duration, origin) { + return animate(element, animation, duration, origin, false); + }, + out: function out(element, animation, duration, origin) { + return animate(element, animation, duration, origin, true); + }, + inProgress: function inProgress$1(element) { + return inProgress.test(attr(element, "class")); + }, + cancel: function cancel(element) { + trigger(element, "animationcancel"); + } + }; + function $(selector, context) { + return !isString(selector) ? toNode(selector) : isHtml(selector) ? toNode(fragment(selector)) : find(selector, context); + } + function $$(selector, context) { + return !isString(selector) ? toNodes(selector) : isHtml(selector) ? toNodes(fragment(selector)) : findAll(selector, context); + } + function isHtml(str) { + return str[0] === "<" || str.match(/^\s* boundary[alignFlip]) { + var centerOffset = dim[prop] / 2; + var centerTargetOffset = targetAttach[dir] === "center" ? -targetDim[prop] / 2 : 0; + elAttach[dir] === "center" && (apply(centerOffset, centerTargetOffset) || apply(-centerOffset, -centerTargetOffset)) || apply(elemOffset, targetOffset); + } + function apply(elemOffset, targetOffset) { + var newVal = position[align] + elemOffset + targetOffset - elOffset[dir] * 2; + if (newVal >= boundary[align] && newVal + dim[prop] <= boundary[alignFlip]) { + position[align] = newVal; + [ "element", "target" ].forEach(function(el) { + flipped[el][dir] = !elemOffset ? flipped[el][dir] : flipped[el][dir] === dirs[prop][1] ? dirs[prop][2] : dirs[prop][1]; + }); + return true; + } + } + }); + } + offset(element, position); + return flipped; + } + function offset(element, coordinates) { + element = toNode(element); + if (coordinates) { + var currentOffset = offset(element); + var pos = css(element, "position"); + [ "left", "top" ].forEach(function(prop) { + if (prop in coordinates) { + var value = css(element, prop); + element.style[prop] = coordinates[prop] - currentOffset[prop] + toFloat(pos === "absolute" && value === "auto" ? position(element)[prop] : value) + "px"; + } + }); + return; + } + return getDimensions(element); + } + function getDimensions(element) { + element = toNode(element); + var ref = window$1(element); + var top = ref.pageYOffset; + var left = ref.pageXOffset; + if (isWindow(element)) { + var height = element.innerHeight; + var width = element.innerWidth; + return { + top: top, + left: left, + height: height, + width: width, + bottom: top + height, + right: left + width + }; + } + var display = false; + if (!isVisible(element)) { + display = element.style.display; + element.style.display = "block"; + } + var rect = element.getBoundingClientRect(); + if (display !== false) { + element.style.display = display; + } + return { + height: rect.height, + width: rect.width, + top: rect.top + top, + left: rect.left + left, + bottom: rect.bottom + top, + right: rect.right + left + }; + } + function position(element) { + element = toNode(element); + var parent = offsetParent(element); + var parentOffset = parent === docEl(element) ? { + top: 0, + left: 0 + } : offset(parent); + var ref = [ "top", "left" ].reduce(function(props, prop) { + var propName$$1 = ucfirst(prop); + props[prop] -= parentOffset[prop] + (toFloat(css(element, "margin" + propName$$1)) || 0) + (toFloat(css(parent, "border" + propName$$1 + "Width")) || 0); + return props; + }, offset(element)); + var top = ref.top; + var left = ref.left; + return { + top: top, + left: left + }; + } + function offsetParent(element) { + var parent = toNode(element).offsetParent; + while (parent && css(parent, "position") === "static") { + parent = parent.offsetParent; + } + return parent || docEl(element); + } + var height = dimension("height"); + var width = dimension("width"); + function dimension(prop) { + var propName$$1 = ucfirst(prop); + return function(element, value) { + element = toNode(element); + if (isUndefined(value)) { + if (isWindow(element)) { + return element["inner" + propName$$1]; + } + if (isDocument(element)) { + var doc = element.documentElement; + return Math.max(doc["offset" + propName$$1], doc["scroll" + propName$$1]); + } + value = css(element, prop); + value = value === "auto" ? element["offset" + propName$$1] : toFloat(value) || 0; + return value - boxModelAdjust(prop, element); + } else { + css(element, prop, !value && value !== 0 ? "" : +value + boxModelAdjust(prop, element) + "px"); + } + }; + } + function boxModelAdjust(prop, element) { + return css(element, "boxSizing") === "border-box" ? dirs[prop].slice(1).map(ucfirst).reduce(function(value, prop) { + return value + toFloat(css(element, "padding" + prop)) + toFloat(css(element, "border" + prop + "Width")); + }, 0) : 0; + } + function moveTo(position, attach, dim, factor) { + each(dirs, function(ref, prop) { + var dir = ref[0]; + var align = ref[1]; + var alignFlip = ref[2]; + if (attach[dir] === alignFlip) { + position[align] += dim[prop] * factor; + } else if (attach[dir] === "center") { + position[align] += dim[prop] * factor / 2; + } + }); + } + function getPos(pos) { + var x = /left|center|right/; + var y = /top|center|bottom/; + pos = (pos || "").split(" "); + if (pos.length === 1) { + pos = x.test(pos[0]) ? pos.concat([ "center" ]) : y.test(pos[0]) ? [ "center" ].concat(pos) : [ "center", "center" ]; + } + return { + x: x.test(pos[0]) ? pos[0] : "center", + y: y.test(pos[1]) ? pos[1] : "center" + }; + } + function getOffsets(offsets, width, height) { + var ref = (offsets || "").split(" "); + var x = ref[0]; + var y = ref[1]; + return { + x: x ? toFloat(x) * (endsWith(x, "%") ? width / 100 : 1) : 0, + y: y ? toFloat(y) * (endsWith(y, "%") ? height / 100 : 1) : 0 + }; + } + function flipPosition(pos) { + switch (pos) { + case "left": + return "right"; + + case "right": + return "left"; + + case "top": + return "bottom"; + + case "bottom": + return "top"; + + default: + return pos; + } + } + function isInView(element, top, left) { + if (top === void 0) top = 0; + if (left === void 0) left = 0; + element = toNode(element); + var win = window$1(element); + return isVisible(element) && intersectRect(element.getBoundingClientRect(), { + top: top, + left: left, + bottom: top + height(win), + right: left + width(win) + }); + } + function scrolledOver(element) { + if (!isVisible(element)) { + return 0; + } + element = toNode(element); + var win = window$1(element); + var doc = document$1(element); + var elHeight = element.offsetHeight; + var top = positionTop(element); + var vp = height(win); + var vh = vp + Math.min(0, top - vp); + var diff = Math.max(0, vp - (height(doc) - (top + elHeight))); + return clamp((vh + win.pageYOffset - top) / ((vh + (elHeight - (diff < vp ? diff : 0))) / 100) / 100); + } + function positionTop(element) { + var top = 0; + do { + top += element.offsetTop; + } while (element = element.offsetParent); + return top; + } + function window$1(element) { + return isWindow(element) ? element : document$1(element).defaultView; + } + function document$1(element) { + return toNode(element).ownerDocument; + } + function docEl(element) { + return document$1(element).documentElement; + } + var isRtl = attr(document.documentElement, "dir") === "rtl"; + var hasTouchEvents = "ontouchstart" in window; + var hasPointerEvents = window.PointerEvent; + var hasTouch = hasTouchEvents || window.DocumentTouch && document instanceof DocumentTouch || navigator.maxTouchPoints; + var pointerDown = !hasTouch ? "mousedown" : "mousedown " + (hasTouchEvents ? "touchstart" : "pointerdown"); + var pointerMove = !hasTouch ? "mousemove" : "mousemove " + (hasTouchEvents ? "touchmove" : "pointermove"); + var pointerUp = !hasTouch ? "mouseup" : "mouseup " + (hasTouchEvents ? "touchend" : "pointerup"); + var pointerEnter = hasTouch && hasPointerEvents ? "pointerenter" : "mouseenter"; + var pointerLeave = hasTouch && hasPointerEvents ? "pointerleave" : "mouseleave"; + var fastdom = { + reads: [], + writes: [], + read: function read(task) { + this.reads.push(task); + scheduleFlush(); + return task; + }, + write: function write(task) { + this.writes.push(task); + scheduleFlush(); + return task; + }, + clear: function clear(task) { + return remove$1(this.reads, task) || remove$1(this.writes, task); + }, + flush: function flush() { + runTasks(this.reads); + runTasks(this.writes.splice(0, this.writes.length)); + this.scheduled = false; + if (this.reads.length || this.writes.length) { + scheduleFlush(); + } + } + }; + function scheduleFlush() { + if (!fastdom.scheduled) { + fastdom.scheduled = true; + requestAnimationFrame(fastdom.flush.bind(fastdom)); + } + } + function runTasks(tasks) { + var task; + while (task = tasks.shift()) { + task(); + } + } + function remove$1(array, item) { + var index = array.indexOf(item); + return !!~index && !!array.splice(index, 1); + } + function MouseTracker() {} + MouseTracker.prototype = { + positions: [], + position: null, + init: function init() { + var this$1 = this; + this.positions = []; + this.position = null; + var ticking = false; + this.unbind = on(document, "mousemove", function(e) { + if (ticking) { + return; + } + setTimeout(function() { + var time = Date.now(); + var ref = this$1.positions; + var length = ref.length; + if (length && time - this$1.positions[length - 1].time > 100) { + this$1.positions.splice(0, length); + } + this$1.positions.push({ + time: time, + x: e.pageX, + y: e.pageY + }); + if (this$1.positions.length > 5) { + this$1.positions.shift(); + } + ticking = false; + }, 5); + ticking = true; + }); + }, + cancel: function cancel() { + if (this.unbind) { + this.unbind(); + } + }, + movesTo: function movesTo(target) { + if (this.positions.length < 2) { + return false; + } + var p = offset(target); + var position$$1 = this.positions[this.positions.length - 1]; + var ref = this.positions; + var prevPos = ref[0]; + if (p.left <= position$$1.x && position$$1.x <= p.right && p.top <= position$$1.y && position$$1.y <= p.bottom) { + return false; + } + var points = [ [ { + x: p.left, + y: p.top + }, { + x: p.right, + y: p.bottom + } ], [ { + x: p.right, + y: p.top + }, { + x: p.left, + y: p.bottom + } ] ]; + if (p.right <= position$$1.x) {} else if (p.left >= position$$1.x) { + points[0].reverse(); + points[1].reverse(); + } else if (p.bottom <= position$$1.y) { + points[0].reverse(); + } else if (p.top >= position$$1.y) { + points[1].reverse(); + } + return !!points.reduce(function(result, point) { + return result + (slope(prevPos, point[0]) < slope(position$$1, point[0]) && slope(prevPos, point[1]) > slope(position$$1, point[1])); + }, 0); + } + }; + function slope(a, b) { + return (b.y - a.y) / (b.x - a.x); + } + var strats = {}; + strats.args = strats.events = strats.init = strats.created = strats.beforeConnect = strats.connected = strats.ready = strats.beforeDisconnect = strats.disconnected = strats.destroy = function(parentVal, childVal) { + parentVal = parentVal && !isArray(parentVal) ? [ parentVal ] : parentVal; + return childVal ? parentVal ? parentVal.concat(childVal) : isArray(childVal) ? childVal : [ childVal ] : parentVal; + }; + strats.update = function(parentVal, childVal) { + return strats.args(parentVal, isFunction(childVal) ? { + read: childVal + } : childVal); + }; + strats.props = function(parentVal, childVal) { + if (isArray(childVal)) { + childVal = childVal.reduce(function(value, key) { + value[key] = String; + return value; + }, {}); + } + return strats.methods(parentVal, childVal); + }; + strats.computed = strats.defaults = strats.methods = function(parentVal, childVal) { + return childVal ? parentVal ? assign({}, parentVal, childVal) : childVal : parentVal; + }; + var defaultStrat = function(parentVal, childVal) { + return isUndefined(childVal) ? parentVal : childVal; + }; + function mergeOptions(parent, child) { + var options = {}; + if (child.mixins) { + for (var i = 0, l = child.mixins.length; i < l; i++) { + parent = mergeOptions(parent, child.mixins[i]); + } + } + for (var key in parent) { + mergeKey(key); + } + for (var key$1 in child) { + if (!hasOwn(parent, key$1)) { + mergeKey(key$1); + } + } + function mergeKey(key) { + options[key] = (strats[key] || defaultStrat)(parent[key], child[key]); + } + return options; + } + var id = 0; + var Player = function Player(el) { + this.id = ++id; + this.el = toNode(el); + }; + Player.prototype.isVideo = function isVideo() { + return this.isYoutube() || this.isVimeo() || this.isHTML5(); + }; + Player.prototype.isHTML5 = function isHTML5() { + return this.el.tagName === "VIDEO"; + }; + Player.prototype.isIFrame = function isIFrame() { + return this.el.tagName === "IFRAME"; + }; + Player.prototype.isYoutube = function isYoutube() { + return this.isIFrame() && !!this.el.src.match(/\/\/.*?youtube(-nocookie)?\.[a-z]+\/(watch\?v=[^&\s]+|embed)|youtu\.be\/.*/); + }; + Player.prototype.isVimeo = function isVimeo() { + return this.isIFrame() && !!this.el.src.match(/vimeo\.com\/video\/.*/); + }; + Player.prototype.enableApi = function enableApi() { + var this$1 = this; + if (this.ready) { + return this.ready; + } + var youtube = this.isYoutube(); + var vimeo = this.isVimeo(); + var poller; + if (youtube || vimeo) { + return this.ready = new Promise(function(resolve) { + once(this$1.el, "load", function() { + if (youtube) { + var listener = function() { + return post(this$1.el, { + event: "listening", + id: this$1.id + }); + }; + poller = setInterval(listener, 100); + listener(); + } + }); + listen(function(data$$1) { + return youtube && data$$1.id === this$1.id && data$$1.event === "onReady" || vimeo && Number(data$$1.player_id) === this$1.id; + }).then(function() { + resolve(); + poller && clearInterval(poller); + }); + attr(this$1.el, "src", "" + this$1.el.src + (includes(this$1.el.src, "?") ? "&" : "?") + (youtube ? "enablejsapi=1" : "api=1&player_id=" + this$1.id)); + }); + } + return Promise.resolve(); + }; + Player.prototype.play = function play() { + var this$1 = this; + if (!this.isVideo()) { + return; + } + if (this.isIFrame()) { + this.enableApi().then(function() { + return post(this$1.el, { + func: "playVideo", + method: "play" + }); + }); + } else if (this.isHTML5()) { + try { + var promise = this.el.play(); + if (promise) { + promise.catch(noop); + } + } catch (e) {} + } + }; + Player.prototype.pause = function pause() { + var this$1 = this; + if (!this.isVideo()) { + return; + } + if (this.isIFrame()) { + this.enableApi().then(function() { + return post(this$1.el, { + func: "pauseVideo", + method: "pause" + }); + }); + } else if (this.isHTML5()) { + this.el.pause(); + } + }; + Player.prototype.mute = function mute() { + var this$1 = this; + if (!this.isVideo()) { + return; + } + if (this.isIFrame()) { + this.enableApi().then(function() { + return post(this$1.el, { + func: "mute", + method: "setVolume", + value: 0 + }); + }); + } else if (this.isHTML5()) { + this.el.muted = true; + attr(this.el, "muted", ""); + } + }; + function post(el, cmd) { + try { + el.contentWindow.postMessage(JSON.stringify(assign({ + event: "command" + }, cmd)), "*"); + } catch (e) {} + } + function listen(cb) { + return new Promise(function(resolve) { + once(window, "message", function(_, data$$1) { + return resolve(data$$1); + }, false, function(ref) { + var data$$1 = ref.data; + if (!data$$1 || !isString(data$$1)) { + return; + } + try { + data$$1 = JSON.parse(data$$1); + } catch (e) { + return; + } + return data$$1 && cb(data$$1); + }); + }); + } + var touch = {}; + var clickTimeout; + var swipeTimeout; + var tapTimeout; + var clicked; + function swipeDirection(ref) { + var x1 = ref.x1; + var x2 = ref.x2; + var y1 = ref.y1; + var y2 = ref.y2; + return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? x1 - x2 > 0 ? "Left" : "Right" : y1 - y2 > 0 ? "Up" : "Down"; + } + function cancelAll() { + clickTimeout && clearTimeout(clickTimeout); + swipeTimeout && clearTimeout(swipeTimeout); + tapTimeout && clearTimeout(tapTimeout); + clickTimeout = swipeTimeout = tapTimeout = null; + touch = {}; + } + ready(function() { + on(document, "click", function() { + return clicked = true; + }, true); + on(document, pointerDown, function(e) { + var target = e.target; + var ref = getPos$1(e); + var x = ref.x; + var y = ref.y; + var now = Date.now(); + var type = getType(e.type); + if (touch.type && touch.type !== type) { + return; + } + touch.el = "tagName" in target ? target : target.parentNode; + clickTimeout && clearTimeout(clickTimeout); + touch.x1 = x; + touch.y1 = y; + if (touch.last && now - touch.last <= 250) { + touch = {}; + } + touch.type = type; + touch.last = now; + clicked = e.button > 0; + }); + on(document, pointerMove, function(e) { + if (e.defaultPrevented) { + return; + } + var ref = getPos$1(e); + var x = ref.x; + var y = ref.y; + touch.x2 = x; + touch.y2 = y; + }); + on(document, pointerUp, function(ref) { + var type = ref.type; + var target = ref.target; + if (touch.type !== getType(type)) { + return; + } + if (touch.x2 && Math.abs(touch.x1 - touch.x2) > 30 || touch.y2 && Math.abs(touch.y1 - touch.y2) > 30) { + swipeTimeout = setTimeout(function() { + if (touch.el) { + trigger(touch.el, "swipe"); + trigger(touch.el, "swipe" + swipeDirection(touch)); + } + touch = {}; + }); + } else if ("last" in touch) { + tapTimeout = setTimeout(function() { + return trigger(touch.el, "tap"); + }); + if (touch.el && type !== "mouseup" && within(target, touch.el)) { + clickTimeout = setTimeout(function() { + clickTimeout = null; + if (touch.el && !clicked) { + trigger(touch.el, "click"); + } + touch = {}; + }, 350); + } + } else { + touch = {}; + } + }); + on(document, "touchcancel", cancelAll); + on(window, "scroll", cancelAll); + }); + var touching = false; + on(document, "touchstart", function() { + return touching = true; + }, true); + on(document, "click", function() { + touching = false; + }); + on(document, "touchcancel", function() { + return touching = false; + }, true); + function isTouch(e) { + return touching || e.pointerType === "touch"; + } + function getPos$1(e) { + var touches = e.touches; + var changedTouches = e.changedTouches; + var ref = touches && touches[0] || changedTouches && changedTouches[0] || e; + var x = ref.pageX; + var y = ref.pageY; + return { + x: x, + y: y + }; + } + function getType(type) { + return type.slice(0, 5); + } + var util = Object.freeze({ + ajax: ajax, + getImage: getImage, + transition: transition, + Transition: Transition, + animate: animate, + Animation: Animation, + attr: attr, + hasAttr: hasAttr, + removeAttr: removeAttr, + filterAttr: filterAttr, + data: data, + addClass: addClass, + removeClass: removeClass, + removeClasses: removeClasses, + replaceClass: replaceClass, + hasClass: hasClass, + toggleClass: toggleClass, + $: $, + $$: $$, + positionAt: positionAt, + offset: offset, + position: position, + height: height, + width: width, + flipPosition: flipPosition, + isInView: isInView, + scrolledOver: scrolledOver, + isReady: isReady, + ready: ready, + index: index, + getIndex: getIndex, + empty: empty, + html: html, + prepend: prepend, + append: append, + before: before, + after: after, + remove: remove, + wrapAll: wrapAll, + wrapInner: wrapInner, + unwrap: unwrap, + fragment: fragment, + apply: apply, + isRtl: isRtl, + hasTouch: hasTouch, + pointerDown: pointerDown, + pointerMove: pointerMove, + pointerUp: pointerUp, + pointerEnter: pointerEnter, + pointerLeave: pointerLeave, + on: on, + off: off, + once: once, + trigger: trigger, + createEvent: createEvent, + toEventTargets: toEventTargets, + preventClick: preventClick, + fastdom: fastdom, + isVoidElement: isVoidElement, + isVisible: isVisible, + selInput: selInput, + isInput: isInput, + filter: filter, + within: within, + bind: bind, + hasOwn: hasOwn, + hyphenate: hyphenate, + camelize: camelize, + ucfirst: ucfirst, + startsWith: startsWith, + endsWith: endsWith, + includes: includes, + isArray: isArray, + isFunction: isFunction, + isObject: isObject, + isPlainObject: isPlainObject, + isWindow: isWindow, + isDocument: isDocument, + isJQuery: isJQuery, + isNode: isNode, + isNodeCollection: isNodeCollection, + isBoolean: isBoolean, + isString: isString, + isNumber: isNumber, + isNumeric: isNumeric, + isUndefined: isUndefined, + toBoolean: toBoolean, + toNumber: toNumber, + toFloat: toFloat, + toNode: toNode, + toNodes: toNodes, + toList: toList, + toMs: toMs, + swap: swap, + assign: assign, + each: each, + sortBy: sortBy, + clamp: clamp, + noop: noop, + intersectRect: intersectRect, + pointInRect: pointInRect, + Dimensions: Dimensions, + MouseTracker: MouseTracker, + mergeOptions: mergeOptions, + Player: Player, + Promise: Promise, + Deferred: Deferred, + query: query, + queryAll: queryAll, + find: find, + findAll: findAll, + matches: matches, + closest: closest, + parents: parents, + escape: escape, + css: css, + getStyles: getStyles, + getStyle: getStyle, + getCssVar: getCssVar, + propName: propName, + isTouch: isTouch, + getPos: getPos$1 + }); + function componentAPI(UIkit) { + var DATA = UIkit.data; + UIkit.components = {}; + UIkit.component = function(id, options) { + var name = camelize(id); + if (isPlainObject(options)) { + options.name = name; + options = UIkit.extend(options); + } else if (isUndefined(options)) { + return UIkit.components[name]; + } else { + options.options.name = name; + } + UIkit.components[name] = options; + UIkit[name] = function(element, data) { + var i = arguments.length, argsArray = Array(i); + while (i--) argsArray[i] = arguments[i]; + if (isPlainObject(element)) { + return new UIkit.components[name]({ + data: element + }); + } + if (UIkit.components[name].options.functional) { + return new UIkit.components[name]({ + data: [].concat(argsArray) + }); + } + return element && element.nodeType ? init(element) : $$(element).map(init)[0]; + function init(element) { + var cmp = UIkit.getComponent(element, name); + if (cmp && data) { + cmp.$reset(data); + } + return cmp || new UIkit.components[name]({ + el: element, + data: data || {} + }); + } + }; + if (UIkit._initialized && !options.options.functional) { + fastdom.read(function() { + return UIkit[name]("[uk-" + id + "],[data-uk-" + id + "]"); + }); + } + return UIkit.components[name]; + }; + UIkit.getComponents = function(element) { + return element && element[DATA] || {}; + }; + UIkit.getComponent = function(element, name) { + return UIkit.getComponents(element)[name]; + }; + UIkit.connect = function(node) { + if (node[DATA]) { + for (var name in node[DATA]) { + node[DATA][name]._callConnected(); + } + } + for (var i = 0; i < node.attributes.length; i++) { + var name$1 = getComponentName(node.attributes[i].name); + if (name$1 && name$1 in UIkit.components) { + UIkit[name$1](node); + } + } + }; + UIkit.disconnect = function(node) { + for (var name in node[DATA]) { + node[DATA][name]._callDisconnected(); + } + }; + } + function getComponentName(attribute) { + return startsWith(attribute, "uk-") || startsWith(attribute, "data-uk-") ? camelize(attribute.replace("data-uk-", "").replace("uk-", "")) : false; + } + function boot(UIkit) { + var connect = UIkit.connect; + var disconnect = UIkit.disconnect; + if (!("MutationObserver" in window)) { + return; + } + if (document.body) { + init(); + } else { + new MutationObserver(function() { + if (document.body) { + this.disconnect(); + init(); + } + }).observe(document, { + childList: true, + subtree: true + }); + } + function init() { + apply(document.body, connect); + fastdom.flush(); + new MutationObserver(function(mutations) { + return mutations.forEach(applyMutation); + }).observe(document, { + childList: true, + subtree: true, + characterData: true, + attributes: true + }); + UIkit._initialized = true; + } + function applyMutation(mutation) { + var target = mutation.target; + var type = mutation.type; + var update = type !== "attributes" ? applyChildList(mutation) : applyAttribute(mutation); + update && UIkit.update(target); + } + function applyAttribute(ref) { + var target = ref.target; + var attributeName = ref.attributeName; + if (attributeName === "href") { + return true; + } + var name = getComponentName(attributeName); + if (!name || !(name in UIkit.components)) { + return; + } + if (hasAttr(target, attributeName)) { + UIkit[name](target); + return true; + } + var component = UIkit.getComponent(target, name); + if (component) { + component.$destroy(); + return true; + } + } + function applyChildList(ref) { + var addedNodes = ref.addedNodes; + var removedNodes = ref.removedNodes; + for (var i = 0; i < addedNodes.length; i++) { + apply(addedNodes[i], connect); + } + for (var i$1 = 0; i$1 < removedNodes.length; i$1++) { + apply(removedNodes[i$1], disconnect); + } + return true; + } + function apply(node, fn) { + if (node.nodeType !== 1 || hasAttr(node, "uk-no-boot")) { + return; + } + fn(node); + node = node.firstElementChild; + while (node) { + var next = node.nextElementSibling; + apply(node, fn); + node = next; + } + } + } + function globalAPI(UIkit) { + var DATA = UIkit.data; + UIkit.use = function(plugin) { + if (plugin.installed) { + return; + } + plugin.call(null, this); + plugin.installed = true; + return this; + }; + UIkit.mixin = function(mixin, component) { + component = (isString(component) ? UIkit.components[component] : component) || this; + mixin = mergeOptions({}, mixin); + mixin.mixins = component.options.mixins; + delete component.options.mixins; + component.options = mergeOptions(mixin, component.options); + }; + UIkit.extend = function(options) { + options = options || {}; + var Super = this; + var Sub = function UIkitComponent(options) { + this._init(options); + }; + Sub.prototype = Object.create(Super.prototype); + Sub.prototype.constructor = Sub; + Sub.options = mergeOptions(Super.options, options); + Sub["super"] = Super; + Sub.extend = Super.extend; + return Sub; + }; + UIkit.update = function(element, e) { + e = createEvent(e || "update"); + element = element ? toNode(element) : document.body; + apply(element, function(element) { + return update(element[DATA], e); + }); + while (element && element.parentNode) { + update(element.parentNode[DATA], e); + element = element.parentNode; + } + }; + var container; + Object.defineProperty(UIkit, "container", { + get: function get() { + return container || document.body; + }, + set: function set(element) { + container = $(element); + } + }); + function update(data, e) { + if (!data) { + return; + } + for (var name in data) { + if (data[name]._isReady) { + data[name]._callUpdate(e); + } + } + } + } + function hooksAPI(UIkit) { + UIkit.prototype._callHook = function(hook) { + var this$1 = this; + var handlers = this.$options[hook]; + if (handlers) { + handlers.forEach(function(handler) { + return handler.call(this$1); + }); + } + }; + UIkit.prototype._callConnected = function() { + var this$1 = this; + if (this._connected) { + return; + } + this._data = {}; + this._callHook("beforeConnect"); + this._connected = true; + this._initEvents(); + this._initObserver(); + this._callHook("connected"); + if (!this._isReady) { + ready(function() { + return this$1._callReady(); + }); + } + this._callUpdate(); + }; + UIkit.prototype._callDisconnected = function() { + if (!this._connected) { + return; + } + this._callHook("beforeDisconnect"); + if (this._observer) { + this._observer.disconnect(); + this._observer = null; + } + this._unbindEvents(); + this._callHook("disconnected"); + this._connected = false; + }; + UIkit.prototype._callReady = function() { + if (this._isReady) { + return; + } + this._isReady = true; + this._callHook("ready"); + this._resetComputeds(); + this._callUpdate(); + }; + UIkit.prototype._callUpdate = function(e) { + var this$1 = this; + e = createEvent(e || "update"); + var type = e.type; + if (includes([ "update", "load", "resize" ], type)) { + this._resetComputeds(); + } + var updates = this.$options.update; + var ref = this._frames; + var reads = ref.reads; + var writes = ref.writes; + if (!updates) { + return; + } + updates.forEach(function(ref, i) { + var read = ref.read; + var write = ref.write; + var events = ref.events; + if (type !== "update" && !includes(events, type)) { + return; + } + if (read && !includes(fastdom.reads, reads[i])) { + reads[i] = fastdom.read(function() { + var result = read.call(this$1, this$1._data, e); + if (result === false && write) { + fastdom.clear(writes[i]); + delete writes[i]; + } else if (isPlainObject(result)) { + assign(this$1._data, result); + } + delete reads[i]; + }); + } + if (write && !includes(fastdom.writes, writes[i])) { + writes[i] = fastdom.write(function() { + write.call(this$1, this$1._data, e); + delete writes[i]; + }); + } + }); + }; + } + function stateAPI(UIkit) { + var uid = 0; + UIkit.prototype.props = {}; + UIkit.prototype._init = function(options) { + options = options || {}; + options = this.$options = mergeOptions(this.constructor.options, options, this); + this.$el = null; + this.$name = UIkit.prefix + hyphenate(this.$options.name); + this.$props = {}; + this._frames = { + reads: {}, + writes: {} + }; + this._events = []; + this._uid = uid++; + this._initData(); + this._initMethods(); + this._initComputeds(); + this._callHook("created"); + if (options.el) { + this.$mount(options.el); + } + }; + UIkit.prototype._initData = function() { + var this$1 = this; + var ref = this.$options; + var defaults = ref.defaults; + var data$$1 = ref.data; + if (data$$1 === void 0) data$$1 = {}; + var args = ref.args; + if (args === void 0) args = []; + var props = ref.props; + if (props === void 0) props = {}; + var el = ref.el; + if (args.length && isArray(data$$1)) { + data$$1 = data$$1.slice(0, args.length).reduce(function(data$$1, value, index) { + if (isPlainObject(value)) { + assign(data$$1, value); + } else { + data$$1[args[index]] = value; + } + return data$$1; + }, {}); + } + for (var key in assign({}, defaults, props)) { + this$1.$props[key] = this$1[key] = hasOwn(data$$1, key) && !isUndefined(data$$1[key]) ? coerce(props[key], data$$1[key], el) : defaults ? defaults[key] && isArray(defaults[key]) ? defaults[key].concat() : defaults[key] : null; + } + }; + UIkit.prototype._initMethods = function() { + var this$1 = this; + var ref = this.$options; + var methods = ref.methods; + if (methods) { + for (var key in methods) { + this$1[key] = bind(methods[key], this$1); + } + } + }; + UIkit.prototype._initComputeds = function() { + var this$1 = this; + var ref = this.$options; + var computed = ref.computed; + this._resetComputeds(); + if (computed) { + for (var key in computed) { + registerComputed(this$1, key, computed[key]); + } + } + }; + UIkit.prototype._resetComputeds = function() { + this._computeds = {}; + }; + UIkit.prototype._initProps = function(props) { + var this$1 = this; + var key; + this._resetComputeds(); + props = props || getProps(this.$options, this.$name); + for (key in props) { + if (!isUndefined(props[key])) { + this$1.$props[key] = props[key]; + } + } + var exclude = [ this.$options.computed, this.$options.methods ]; + for (key in this$1.$props) { + if (key in props && notIn(exclude, key)) { + this$1[key] = this$1.$props[key]; + } + } + }; + UIkit.prototype._initEvents = function() { + var this$1 = this; + var ref = this.$options; + var events = ref.events; + if (events) { + events.forEach(function(event) { + if (!hasOwn(event, "handler")) { + for (var key in event) { + registerEvent(this$1, event[key], key); + } + } else { + registerEvent(this$1, event); + } + }); + } + }; + UIkit.prototype._unbindEvents = function() { + this._events.forEach(function(unbind) { + return unbind(); + }); + this._events = []; + }; + UIkit.prototype._initObserver = function() { + var this$1 = this; + var ref = this.$options; + var attrs = ref.attrs; + var props = ref.props; + var el = ref.el; + if (this._observer || !props || !attrs) { + return; + } + attrs = isArray(attrs) ? attrs : Object.keys(props).map(function(key) { + return hyphenate(key); + }); + this._observer = new MutationObserver(function() { + var data$$1 = getProps(this$1.$options, this$1.$name); + if (attrs.some(function(key) { + return !isUndefined(data$$1[key]) && data$$1[key] !== this$1.$props[key]; + })) { + this$1.$reset(data$$1); + } + }); + this._observer.observe(el, { + attributes: true, + attributeFilter: attrs.concat([ this.$name, "data-" + this.$name ]) + }); + }; + function getProps(opts, name) { + var data$$1 = {}; + var args = opts.args; + if (args === void 0) args = []; + var props = opts.props; + if (props === void 0) props = {}; + var el = opts.el; + if (!props) { + return data$$1; + } + for (var key in props) { + var prop = hyphenate(key); + if (hasAttr(el, prop)) { + var value = coerce(props[key], attr(el, prop), el); + if (prop === "target" && (!value || startsWith(value, "_"))) { + continue; + } + data$$1[key] = value; + } + } + var options = parseOptions(data(el, name), args); + for (var key$1 in options) { + var prop$1 = camelize(key$1); + if (props[prop$1] !== undefined) { + data$$1[prop$1] = coerce(props[prop$1], options[key$1], el); + } + } + return data$$1; + } + function parseOptions(options, args) { + var obj; + if (args === void 0) args = []; + try { + return !options ? {} : startsWith(options, "{") ? JSON.parse(options) : args.length && !includes(options, ":") ? (obj = {}, + obj[args[0]] = options, obj) : options.split(";").reduce(function(options, option) { + var ref = option.split(/:(.+)/); + var key = ref[0]; + var value = ref[1]; + if (key && value) { + options[key.trim()] = value.trim(); + } + return options; + }, {}); + } catch (e) { + return {}; + } + } + function registerComputed(component, key, cb) { + Object.defineProperty(component, key, { + enumerable: true, + get: function get() { + var _computeds = component._computeds; + var $props = component.$props; + var $el = component.$el; + if (!hasOwn(_computeds, key)) { + _computeds[key] = cb.call(component, $props, $el); + } + return _computeds[key]; + }, + set: function set(value) { + component._computeds[key] = value; + } + }); + } + function registerEvent(component, event, key) { + if (!isPlainObject(event)) { + event = { + name: key, + handler: event + }; + } + var name = event.name; + var el = event.el; + var handler = event.handler; + var capture = event.capture; + var delegate = event.delegate; + var filter = event.filter; + var self = event.self; + el = isFunction(el) ? el.call(component) : el || component.$el; + if (isArray(el)) { + el.forEach(function(el) { + return registerEvent(component, assign({}, event, { + el: el + }), key); + }); + return; + } + if (!el || filter && !filter.call(component)) { + return; + } + handler = detail(isString(handler) ? component[handler] : bind(handler, component)); + if (self) { + handler = selfFilter(handler); + } + component._events.push(on(el, name, !delegate ? null : isString(delegate) ? delegate : delegate.call(component), handler, capture)); + } + function selfFilter(handler) { + return function selfHandler(e) { + if (e.target === e.currentTarget || e.target === e.current) { + return handler.call(null, e); + } + }; + } + function notIn(options, key) { + return options.every(function(arr) { + return !arr || !hasOwn(arr, key); + }); + } + function detail(listener) { + return function(e) { + return isArray(e.detail) ? listener.apply(void 0, [ e ].concat(e.detail)) : listener(e); + }; + } + function coerce(type, value, context) { + if (type === Boolean) { + return toBoolean(value); + } else if (type === Number) { + return toNumber(value); + } else if (type === "query") { + return query(value, context); + } else if (type === "list") { + return toList(value); + } else if (type === "media") { + return toMedia(value); + } + return type ? type(value) : value; + } + function toMedia(value) { + if (isString(value)) { + if (value[0] === "@") { + var name = "media-" + value.substr(1); + value = toFloat(getCssVar(name)); + } else if (isNaN(value)) { + return value; + } + } + return value && !isNaN(value) ? "(min-width: " + value + "px)" : false; + } + } + function instanceAPI(UIkit) { + var DATA = UIkit.data; + UIkit.prototype.$mount = function(el) { + var ref = this.$options; + var name = ref.name; + if (!el[DATA]) { + el[DATA] = {}; + } + if (el[DATA][name]) { + return; + } + el[DATA][name] = this; + this.$el = this.$options.el = this.$options.el || el; + this._initProps(); + this._callHook("init"); + if (within(el, document)) { + this._callConnected(); + } + }; + UIkit.prototype.$emit = function(e) { + this._callUpdate(e); + }; + UIkit.prototype.$reset = function(data) { + this._callDisconnected(); + this._initProps(data); + this._callConnected(); + }; + UIkit.prototype.$destroy = function(removeEl) { + if (removeEl === void 0) removeEl = false; + var ref = this.$options; + var el = ref.el; + var name = ref.name; + if (el) { + this._callDisconnected(); + } + this._callHook("destroy"); + if (!el || !el[DATA]) { + return; + } + delete el[DATA][name]; + if (!Object.keys(el[DATA]).length) { + delete el[DATA]; + } + if (removeEl) { + remove(this.$el); + } + }; + } + var UIkit$2 = function(options) { + this._init(options); + }; + UIkit$2.util = util; + UIkit$2.data = "__uikit__"; + UIkit$2.prefix = "uk-"; + UIkit$2.options = {}; + globalAPI(UIkit$2); + hooksAPI(UIkit$2); + stateAPI(UIkit$2); + instanceAPI(UIkit$2); + componentAPI(UIkit$2); + var Class = { + init: function init() { + addClass(this.$el, this.$name); + } + }; + var Container = { + props: { + container: Boolean + }, + defaults: { + container: true + }, + computed: { + container: function container(ref) { + var container = ref.container; + return container === true && UIkit$2.container || container && $(container); + } + } + }; + var Togglable = { + props: { + cls: Boolean, + animation: "list", + duration: Number, + origin: String, + transition: String, + queued: Boolean + }, + defaults: { + cls: false, + animation: [ false ], + duration: 200, + origin: false, + transition: "linear", + queued: false, + initProps: { + overflow: "", + height: "", + paddingTop: "", + paddingBottom: "", + marginTop: "", + marginBottom: "" + }, + hideProps: { + overflow: "hidden", + height: 0, + paddingTop: 0, + paddingBottom: 0, + marginTop: 0, + marginBottom: 0 + } + }, + computed: { + hasAnimation: function hasAnimation(ref) { + var animation = ref.animation; + return !!animation[0]; + }, + hasTransition: function hasTransition(ref) { + var animation = ref.animation; + return this.hasAnimation && animation[0] === true; + } + }, + methods: { + toggleElement: function toggleElement(targets, show, animate) { + var this$1 = this; + return new Promise(function(resolve) { + targets = toNodes(targets); + var all = function(targets) { + return Promise.all(targets.map(function(el) { + return this$1._toggleElement(el, show, animate); + })); + }; + var toggled = targets.filter(function(el) { + return this$1.isToggled(el); + }); + var untoggled = targets.filter(function(el) { + return !includes(toggled, el); + }); + var p; + if (!this$1.queued || !isUndefined(animate) || !isUndefined(show) || !this$1.hasAnimation || targets.length < 2) { + p = all(untoggled.concat(toggled)); + } else { + var body = document.body; + var scroll = body.scrollTop; + var el = toggled[0]; + var inProgress = Animation.inProgress(el) && hasClass(el, "uk-animation-leave") || Transition.inProgress(el) && el.style.height === "0px"; + p = all(toggled); + if (!inProgress) { + p = p.then(function() { + var p = all(untoggled); + body.scrollTop = scroll; + return p; + }); + } + } + p.then(resolve, noop); + }); + }, + toggleNow: function toggleNow(targets, show) { + var this$1 = this; + return new Promise(function(resolve) { + return Promise.all(toNodes(targets).map(function(el) { + return this$1._toggleElement(el, show, false); + })).then(resolve, noop); + }); + }, + isToggled: function isToggled(el) { + var nodes = toNodes(el || this.$el); + return this.cls ? hasClass(nodes, this.cls.split(" ")[0]) : !hasAttr(nodes, "hidden"); + }, + updateAria: function updateAria(el) { + if (this.cls === false) { + attr(el, "aria-hidden", !this.isToggled(el)); + } + }, + _toggleElement: function _toggleElement(el, show, animate) { + var this$1 = this; + show = isBoolean(show) ? show : Animation.inProgress(el) ? hasClass(el, "uk-animation-leave") : Transition.inProgress(el) ? el.style.height === "0px" : !this.isToggled(el); + if (!trigger(el, "before" + (show ? "show" : "hide"), [ this ])) { + return Promise.reject(); + } + var promise = (animate === false || !this.hasAnimation ? this._toggleImmediate : this.hasTransition ? this._toggleHeight : this._toggleAnimation)(el, show); + trigger(el, show ? "show" : "hide", [ this ]); + return promise.then(function() { + trigger(el, show ? "shown" : "hidden", [ this$1 ]); + trigger(el, "resize"); + }); + }, + _toggle: function _toggle(el, toggled) { + if (!el) { + return; + } + var changed; + if (this.cls) { + changed = includes(this.cls, " ") || Boolean(toggled) !== hasClass(el, this.cls); + changed && toggleClass(el, this.cls, includes(this.cls, " ") ? undefined : toggled); + } else { + changed = Boolean(toggled) === hasAttr(el, "hidden"); + changed && attr(el, "hidden", !toggled ? "" : null); + } + $$("[autofocus]", el).some(function(el) { + return isVisible(el) && (el.focus() || true); + }); + this.updateAria(el); + changed && trigger(el, "resize"); + }, + _toggleImmediate: function _toggleImmediate(el, show) { + this._toggle(el, show); + return Promise.resolve(); + }, + _toggleHeight: function _toggleHeight(el, show) { + var this$1 = this; + var inProgress = Transition.inProgress(el); + var inner = el.hasChildNodes ? toFloat(css(el.firstElementChild, "marginTop")) + toFloat(css(el.lastElementChild, "marginBottom")) : 0; + var currentHeight = isVisible(el) ? height(el) + (inProgress ? 0 : inner) : 0; + Transition.cancel(el); + if (!this.isToggled(el)) { + this._toggle(el, true); + } + height(el, ""); + fastdom.flush(); + var endHeight = height(el) + (inProgress ? 0 : inner); + height(el, currentHeight); + return (show ? Transition.start(el, assign({}, this.initProps, { + overflow: "hidden", + height: endHeight + }), Math.round(this.duration * (1 - currentHeight / endHeight)), this.transition) : Transition.start(el, this.hideProps, Math.round(this.duration * (currentHeight / endHeight)), this.transition).then(function() { + return this$1._toggle(el, false); + })).then(function() { + return css(el, this$1.initProps); + }); + }, + _toggleAnimation: function _toggleAnimation(el, show) { + var this$1 = this; + Animation.cancel(el); + if (show) { + this._toggle(el, true); + return Animation.in(el, this.animation[0], this.duration, this.origin); + } + return Animation.out(el, this.animation[1] || this.animation[0], this.duration, this.origin).then(function() { + return this$1._toggle(el, false); + }); + } + } + }; + var active; + var Modal = { + mixins: [ Class, Container, Togglable ], + props: { + selPanel: String, + selClose: String, + escClose: Boolean, + bgClose: Boolean, + stack: Boolean + }, + defaults: { + cls: "uk-open", + escClose: true, + bgClose: true, + overlay: true, + stack: false + }, + computed: { + panel: function panel(ref, $el) { + var selPanel = ref.selPanel; + return $(selPanel, $el); + }, + transitionElement: function transitionElement() { + return this.panel; + }, + transitionDuration: function transitionDuration() { + return toMs(css(this.transitionElement, "transitionDuration")); + } + }, + events: [ { + name: "click", + delegate: function delegate() { + return this.selClose; + }, + handler: function handler(e) { + e.preventDefault(); + this.hide(); + } + }, { + name: "toggle", + self: true, + handler: function handler(e) { + if (e.defaultPrevented) { + return; + } + e.preventDefault(); + this.toggle(); + } + }, { + name: "beforeshow", + self: true, + handler: function handler(e) { + var prev = active && active !== this && active; + active = this; + if (prev) { + if (this.stack) { + this.prev = prev; + } else { + prev.hide().then(this.show); + e.preventDefault(); + return; + } + } + registerEvents(); + } + }, { + name: "beforehide", + self: true, + handler: function handler() { + active = active && active !== this && active || this.prev; + if (!active) { + deregisterEvents(); + } + } + }, { + name: "show", + self: true, + handler: function handler() { + if (!hasClass(document.documentElement, this.clsPage)) { + this.scrollbarWidth = width(window) - width(document); + css(document.body, "overflowY", this.scrollbarWidth && this.overlay ? "scroll" : ""); + } + addClass(document.documentElement, this.clsPage); + } + }, { + name: "hidden", + self: true, + handler: function handler() { + var this$1 = this; + var found; + var ref = this; + var prev = ref.prev; + while (prev) { + if (prev.clsPage === this$1.clsPage) { + found = true; + break; + } + prev = prev.prev; + } + if (!found) { + removeClass(document.documentElement, this.clsPage); + } + !this.prev && css(document.body, "overflowY", ""); + } + } ], + methods: { + toggle: function toggle() { + return this.isToggled() ? this.hide() : this.show(); + }, + show: function show() { + if (this.isToggled()) { + return; + } + if (this.container && this.$el.parentNode !== this.container) { + append(this.container, this.$el); + this._callConnected(); + } + return this.toggleNow(this.$el, true); + }, + hide: function hide() { + if (this.isToggled()) { + return this.toggleNow(this.$el, false); + } + }, + getActive: function getActive() { + return active; + }, + _toggleImmediate: function _toggleImmediate(el, show) { + var this$1 = this; + return new Promise(function(resolve) { + return requestAnimationFrame(function() { + this$1._toggle(el, show); + if (this$1.transitionDuration) { + once(this$1.transitionElement, "transitionend", resolve, false, function(e) { + return e.target === this$1.transitionElement; + }); + } else { + resolve(); + } + }); + }); + } + } + }; + var events; + function registerEvents() { + if (events) { + return; + } + events = [ on(document, "click", function(ref) { + var target = ref.target; + var defaultPrevented = ref.defaultPrevented; + if (active && active.bgClose && !defaultPrevented && (!active.overlay || within(target, active.$el)) && (!active.panel || !within(target, active.panel))) { + active.hide(); + } + }), on(document, "keydown", function(e) { + if (e.keyCode === 27 && active && active.escClose) { + e.preventDefault(); + active.hide(); + } + }) ]; + } + function deregisterEvents() { + events && events.forEach(function(unbind) { + return unbind(); + }); + events = null; + } + var Position = { + props: { + pos: String, + offset: null, + flip: Boolean, + clsPos: String + }, + defaults: { + pos: "bottom-" + (!isRtl ? "left" : "right"), + flip: true, + offset: false, + clsPos: "" + }, + computed: { + pos: function pos(ref) { + var pos = ref.pos; + return (pos + (!includes(pos, "-") ? "-center" : "")).split("-"); + }, + dir: function dir() { + return this.pos[0]; + }, + align: function align() { + return this.pos[1]; + } + }, + methods: { + positionAt: function positionAt$1(element, target, boundary) { + removeClasses(element, this.clsPos + "-(top|bottom|left|right)(-[a-z]+)?"); + css(element, { + top: "", + left: "" + }); + var node; + var ref = this; + var offset$$1 = ref.offset; + offset$$1 = isNumeric(offset$$1) ? offset$$1 : (node = $(offset$$1)) ? offset(node)[axis === "x" ? "left" : "top"] - offset(target)[axis === "x" ? "right" : "bottom"] : 0; + var axis = this.getAxis(); + var ref$1 = positionAt(element, target, axis === "x" ? flipPosition(this.dir) + " " + this.align : this.align + " " + flipPosition(this.dir), axis === "x" ? this.dir + " " + this.align : this.align + " " + this.dir, axis === "x" ? "" + (this.dir === "left" ? -offset$$1 : offset$$1) : " " + (this.dir === "top" ? -offset$$1 : offset$$1), null, this.flip, boundary).target; + var x = ref$1.x; + var y = ref$1.y; + this.dir = axis === "x" ? x : y; + this.align = axis === "x" ? y : x; + toggleClass(element, this.clsPos + "-" + this.dir + "-" + this.align, this.offset === false); + }, + getAxis: function getAxis() { + return this.dir === "top" || this.dir === "bottom" ? "y" : "x"; + } + } + }; + function mixin(UIkit) { + UIkit.mixin.class = Class; + UIkit.mixin.container = Container; + UIkit.mixin.modal = Modal; + UIkit.mixin.position = Position; + UIkit.mixin.togglable = Togglable; + } + function Accordion(UIkit) { + UIkit.component("accordion", { + mixins: [ Class, Togglable ], + props: { + targets: String, + active: null, + collapsible: Boolean, + multiple: Boolean, + toggle: String, + content: String, + transition: String + }, + defaults: { + targets: "> *", + active: false, + animation: [ true ], + collapsible: true, + multiple: false, + clsOpen: "uk-open", + toggle: "> .uk-accordion-title", + content: "> .uk-accordion-content", + transition: "ease" + }, + computed: { + items: function items(ref, $el) { + var targets = ref.targets; + return $$(targets, $el); + } + }, + events: [ { + name: "click", + delegate: function delegate() { + return this.targets + " " + this.$props.toggle; + }, + handler: function handler(e) { + e.preventDefault(); + this.toggle(index($$(this.targets + " " + this.$props.toggle, this.$el), e.current)); + } + } ], + connected: function connected() { + if (this.active === false) { + return; + } + var active = this.items[Number(this.active)]; + if (active && !hasClass(active, this.clsOpen)) { + this.toggle(active, false); + } + }, + update: function update() { + var this$1 = this; + this.items.forEach(function(el) { + return this$1._toggleImmediate($(this$1.content, el), hasClass(el, this$1.clsOpen)); + }); + var active = !this.collapsible && !hasClass(this.items, this.clsOpen) && this.items[0]; + if (active) { + this.toggle(active, false); + } + }, + methods: { + toggle: function toggle(item, animate) { + var this$1 = this; + var index = getIndex(item, this.items); + var active = filter(this.items, "." + this.clsOpen); + item = this.items[index]; + item && [ item ].concat(!this.multiple && !includes(active, item) && active || []).forEach(function(el) { + var isItem = el === item; + var state = isItem && !hasClass(el, this$1.clsOpen); + if (!state && isItem && !this$1.collapsible && active.length < 2) { + return; + } + toggleClass(el, this$1.clsOpen, state); + var content = el._wrapper ? el._wrapper.firstElementChild : $(this$1.content, el); + if (!el._wrapper) { + el._wrapper = wrapAll(content, "
"); + attr(el._wrapper, "hidden", state ? "" : null); + } + this$1._toggleImmediate(content, true); + this$1.toggleElement(el._wrapper, state, animate).then(function() { + if (hasClass(el, this$1.clsOpen) === state) { + if (!state) { + this$1._toggleImmediate(content, false); + } + el._wrapper = null; + unwrap(content); + } + }); + }); + } + } + }); + } + function Alert(UIkit) { + UIkit.component("alert", { + attrs: true, + mixins: [ Class, Togglable ], + args: "animation", + props: { + close: String + }, + defaults: { + animation: [ true ], + selClose: ".uk-alert-close", + duration: 150, + hideProps: assign({ + opacity: 0 + }, Togglable.defaults.hideProps) + }, + events: [ { + name: "click", + delegate: function delegate() { + return this.selClose; + }, + handler: function handler(e) { + e.preventDefault(); + this.close(); + } + } ], + methods: { + close: function close() { + var this$1 = this; + this.toggleElement(this.$el).then(function() { + return this$1.$destroy(true); + }); + } + } + }); + } + function Core(UIkit) { + ready(function() { + var scroll = 0; + var started = 0; + on(window, "load resize", function(e) { + return UIkit.update(null, e); + }); + on(window, "scroll", function(e) { + e.dir = scroll <= window.pageYOffset ? "down" : "up"; + e.scrollY = scroll = window.pageYOffset; + UIkit.update(null, e); + }); + on(document, "animationstart", function(ref) { + var target = ref.target; + if ((css(target, "animationName") || "").match(/^uk-.*(left|right)/)) { + started++; + css(document.body, "overflowX", "hidden"); + setTimeout(function() { + if (!--started) { + css(document.body, "overflowX", ""); + } + }, toMs(css(target, "animationDuration")) + 100); + } + }, true); + if (!hasTouch) { + return; + } + var cls = "uk-hover"; + on(document, "tap", function(ref) { + var target = ref.target; + return $$("." + cls).forEach(function(el) { + return !within(target, el) && removeClass(el, cls); + }); + }); + Object.defineProperty(UIkit, "hoverSelector", { + set: function set(selector) { + on(document, "tap", selector, function(ref) { + var current = ref.current; + return addClass(current, cls); + }); + } + }); + UIkit.hoverSelector = ".uk-animation-toggle, .uk-transition-toggle, [uk-hover]"; + }); + } + function Cover(UIkit) { + UIkit.component("cover", { + mixins: [ Class, UIkit.components.video.options ], + props: { + width: Number, + height: Number + }, + defaults: { + automute: true + }, + update: { + write: function write() { + var el = this.$el; + if (!isVisible(el)) { + return; + } + var ref = el.parentNode; + var height = ref.offsetHeight; + var width = ref.offsetWidth; + css(css(el, { + width: "", + height: "" + }), Dimensions.cover({ + width: this.width || el.clientWidth, + height: this.height || el.clientHeight + }, { + width: width + (width % 2 ? 1 : 0), + height: height + (height % 2 ? 1 : 0) + })); + }, + events: [ "load", "resize" ] + }, + events: { + loadedmetadata: function loadedmetadata() { + this.$emit(); + } + } + }); + } + function Drop(UIkit) { + var active; + UIkit.component("drop", { + mixins: [ Position, Togglable ], + args: "pos", + props: { + mode: "list", + toggle: Boolean, + boundary: "query", + boundaryAlign: Boolean, + delayShow: Number, + delayHide: Number, + clsDrop: String + }, + defaults: { + mode: [ "click", "hover" ], + toggle: true, + boundary: window, + boundaryAlign: false, + delayShow: 0, + delayHide: 800, + clsDrop: false, + hoverIdle: 200, + animation: [ "uk-animation-fade" ], + cls: "uk-open" + }, + computed: { + clsDrop: function clsDrop(ref) { + var clsDrop = ref.clsDrop; + return clsDrop || "uk-" + this.$options.name; + }, + clsPos: function clsPos() { + return this.clsDrop; + } + }, + init: function init() { + this.tracker = new MouseTracker(); + addClass(this.$el, this.clsDrop); + }, + connected: function connected() { + var ref = this.$props; + var toggle = ref.toggle; + this.toggle = toggle && UIkit.toggle(isString(toggle) ? query(toggle, this.$el) : this.$el.previousElementSibling, { + target: this.$el, + mode: this.mode + }); + this.updateAria(this.$el); + }, + events: [ { + name: "click", + delegate: function delegate() { + return "." + this.clsDrop + "-close"; + }, + handler: function handler(e) { + e.preventDefault(); + this.hide(false); + } + }, { + name: "click", + delegate: function delegate() { + return 'a[href^="#"]'; + }, + handler: function handler(e) { + if (e.defaultPrevented) { + return; + } + var id = e.target.hash; + if (!id) { + e.preventDefault(); + } + if (!id || !within(id, this.$el)) { + this.hide(false); + } + } + }, { + name: "beforescroll", + handler: function handler() { + this.hide(false); + } + }, { + name: "toggle", + self: true, + handler: function handler(e, toggle) { + e.preventDefault(); + if (this.isToggled()) { + this.hide(false); + } else { + this.show(toggle, false); + } + } + }, { + name: pointerEnter, + filter: function filter() { + return includes(this.mode, "hover"); + }, + handler: function handler(e) { + if (isTouch(e)) { + return; + } + if (active && active !== this && active.toggle && includes(active.toggle.mode, "hover") && !within(e.target, active.toggle.$el) && !pointInRect({ + x: e.pageX, + y: e.pageY + }, offset(active.$el))) { + active.hide(false); + } + e.preventDefault(); + this.show(this.toggle); + } + }, { + name: "toggleshow", + handler: function handler(e, toggle) { + if (toggle && !includes(toggle.target, this.$el)) { + return; + } + e.preventDefault(); + this.show(toggle || this.toggle); + } + }, { + name: "togglehide " + pointerLeave, + handler: function handler(e, toggle) { + if (isTouch(e) || toggle && !includes(toggle.target, this.$el)) { + return; + } + e.preventDefault(); + if (this.toggle && includes(this.toggle.mode, "hover")) { + this.hide(); + } + } + }, { + name: "beforeshow", + self: true, + handler: function handler() { + this.clearTimers(); + Animation.cancel(this.$el); + this.position(); + } + }, { + name: "show", + self: true, + handler: function handler() { + this.tracker.init(); + if (this.toggle) { + addClass(this.toggle.$el, this.cls); + attr(this.toggle.$el, "aria-expanded", "true"); + } + registerEvent(); + } + }, { + name: "beforehide", + self: true, + handler: function handler() { + this.clearTimers(); + } + }, { + name: "hide", + handler: function handler(ref) { + var target = ref.target; + if (this.$el !== target) { + active = active === null && within(target, this.$el) && this.isToggled() ? this : active; + return; + } + active = this.isActive() ? null : active; + if (this.toggle) { + removeClass(this.toggle.$el, this.cls); + attr(this.toggle.$el, "aria-expanded", "false"); + this.toggle.$el.blur(); + $$("a, button", this.toggle.$el).forEach(function(el) { + return el.blur(); + }); + } + this.tracker.cancel(); + } + } ], + update: { + write: function write() { + if (this.isToggled() && !Animation.inProgress(this.$el)) { + this.position(); + } + }, + events: [ "resize" ] + }, + methods: { + show: function show(toggle, delay) { + var this$1 = this; + if (delay === void 0) delay = true; + var show = function() { + return !this$1.isToggled() && this$1.toggleElement(this$1.$el, true); + }; + var tryShow = function() { + this$1.toggle = toggle || this$1.toggle; + this$1.clearTimers(); + if (this$1.isActive()) { + return; + } else if (delay && active && active !== this$1 && active.isDelaying) { + this$1.showTimer = setTimeout(this$1.show, 10); + return; + } else if (this$1.isParentOf(active)) { + if (active.hideTimer) { + active.hide(false); + } else { + return; + } + } else if (active && !this$1.isChildOf(active) && !this$1.isParentOf(active)) { + var prev; + while (active && active !== prev && !this$1.isChildOf(active)) { + prev = active; + active.hide(false); + } + } + if (delay && this$1.delayShow) { + this$1.showTimer = setTimeout(show, this$1.delayShow); + } else { + show(); + } + active = this$1; + }; + if (toggle && this.toggle && toggle.$el !== this.toggle.$el) { + once(this.$el, "hide", tryShow); + this.hide(false); + } else { + tryShow(); + } + }, + hide: function hide(delay) { + var this$1 = this; + if (delay === void 0) delay = true; + var hide = function() { + return this$1.toggleNow(this$1.$el, false); + }; + this.clearTimers(); + this.isDelaying = this.tracker.movesTo(this.$el); + if (delay && this.isDelaying) { + this.hideTimer = setTimeout(this.hide, this.hoverIdle); + } else if (delay && this.delayHide) { + this.hideTimer = setTimeout(hide, this.delayHide); + } else { + hide(); + } + }, + clearTimers: function clearTimers() { + clearTimeout(this.showTimer); + clearTimeout(this.hideTimer); + this.showTimer = null; + this.hideTimer = null; + this.isDelaying = false; + }, + isActive: function isActive() { + return active === this; + }, + isChildOf: function isChildOf(drop) { + return drop && drop !== this && within(this.$el, drop.$el); + }, + isParentOf: function isParentOf(drop) { + return drop && drop !== this && within(drop.$el, this.$el); + }, + position: function position() { + removeClasses(this.$el, this.clsDrop + "-(stack|boundary)"); + css(this.$el, { + top: "", + left: "", + display: "block" + }); + toggleClass(this.$el, this.clsDrop + "-boundary", this.boundaryAlign); + var boundary = offset(this.boundary); + var alignTo = this.boundaryAlign ? boundary : offset(this.toggle.$el); + if (this.align === "justify") { + var prop = this.getAxis() === "y" ? "width" : "height"; + css(this.$el, prop, alignTo[prop]); + } else if (this.$el.offsetWidth > Math.max(boundary.right - alignTo.left, alignTo.right - boundary.left)) { + addClass(this.$el, this.clsDrop + "-stack"); + } + this.positionAt(this.$el, this.boundaryAlign ? this.boundary : this.toggle.$el, this.boundary); + css(this.$el, "display", ""); + } + } + }); + UIkit.drop.getActive = function() { + return active; + }; + var registered; + function registerEvent() { + if (registered) { + return; + } + registered = true; + on(document, "click", function(ref) { + var target = ref.target; + var defaultPrevented = ref.defaultPrevented; + var prev; + if (defaultPrevented) { + return; + } + while (active && active !== prev && !within(target, active.$el) && !(active.toggle && within(target, active.toggle.$el))) { + prev = active; + active.hide(false); + } + }); + } + } + function Dropdown(UIkit) { + UIkit.component("dropdown", UIkit.components.drop.extend({ + name: "dropdown" + })); + } + function FormCustom(UIkit) { + UIkit.component("form-custom", { + mixins: [ Class ], + args: "target", + props: { + target: Boolean + }, + defaults: { + target: false + }, + computed: { + input: function input(_, $el) { + return $(selInput, $el); + }, + state: function state() { + return this.input.nextElementSibling; + }, + target: function target(ref, $el) { + var target = ref.target; + return target && (target === true && this.input.parentNode === $el && this.input.nextElementSibling || query(target, $el)); + } + }, + update: function update() { + var ref = this; + var target = ref.target; + var input = ref.input; + if (!target) { + return; + } + var option; + target[isInput(target) ? "value" : "textContent"] = input.files && input.files[0] ? input.files[0].name : matches(input, "select") && (option = $$("option", input).filter(function(el) { + return el.selected; + })[0]) ? option.textContent : input.value; + }, + events: [ { + name: "focusin focusout mouseenter mouseleave", + delegate: selInput, + handler: function handler(ref) { + var type = ref.type; + var current = ref.current; + if (current === this.input) { + toggleClass(this.state, "uk-" + (includes(type, "focus") ? "focus" : "hover"), includes([ "focusin", "mouseenter" ], type)); + } + } + }, { + name: "change", + handler: function handler() { + this.$emit(); + } + } ] + }); + } + function Gif(UIkit) { + UIkit.component("gif", { + update: { + read: function read(data) { + var inview = isInView(this.$el); + if (!inview || data.isInView === inview) { + return false; + } + data.isInView = inview; + }, + write: function write() { + this.$el.src = this.$el.src; + }, + events: [ "scroll", "load", "resize" ] + } + }); + } + function Grid(UIkit) { + UIkit.component("grid", UIkit.components.margin.extend({ + mixins: [ Class ], + name: "grid", + defaults: { + margin: "uk-grid-margin", + clsStack: "uk-grid-stack" + }, + update: { + write: function write(ref) { + var stacks = ref.stacks; + toggleClass(this.$el, this.clsStack, stacks); + }, + events: [ "load", "resize" ] + } + })); + } + function HeightMatch(UIkit) { + UIkit.component("height-match", { + args: "target", + props: { + target: String, + row: Boolean + }, + defaults: { + target: "> *", + row: true + }, + computed: { + elements: function elements(ref, $el) { + var target = ref.target; + return $$(target, $el); + } + }, + update: { + read: function read() { + var this$1 = this; + var lastOffset = false; + css(this.elements, "minHeight", ""); + return { + rows: !this.row ? [ this.match(this.elements) ] : this.elements.reduce(function(rows, el) { + if (lastOffset !== el.offsetTop) { + rows.push([ el ]); + } else { + rows[rows.length - 1].push(el); + } + lastOffset = el.offsetTop; + return rows; + }, []).map(function(elements) { + return this$1.match(elements); + }) + }; + }, + write: function write(ref) { + var rows = ref.rows; + rows.forEach(function(ref) { + var height = ref.height; + var elements = ref.elements; + return css(elements, "minHeight", height); + }); + }, + events: [ "load", "resize" ] + }, + methods: { + match: function match(elements) { + if (elements.length < 2) { + return {}; + } + var heights = []; + var max = 0; + elements.forEach(function(el) { + var style, hidden; + if (!isVisible(el)) { + style = attr(el, "style"); + hidden = attr(el, "hidden"); + attr(el, { + style: (style || "") + ";display:block !important;", + hidden: null + }); + } + max = Math.max(max, el.offsetHeight); + heights.push(el.offsetHeight); + if (!isUndefined(style)) { + attr(el, { + style: style, + hidden: hidden + }); + } + }); + elements = elements.filter(function(el, i) { + return heights[i] < max; + }); + return { + height: max, + elements: elements + }; + } + } + }); + } + function HeightViewport(UIkit) { + UIkit.component("height-viewport", { + props: { + expand: Boolean, + offsetTop: Boolean, + offsetBottom: Boolean, + minHeight: Number + }, + defaults: { + expand: false, + offsetTop: false, + offsetBottom: false, + minHeight: 0 + }, + update: { + write: function write() { + css(this.$el, "boxSizing", "border-box"); + var viewport = height(window); + var minHeight, offsetTop = 0; + if (this.expand) { + css(this.$el, { + height: "", + minHeight: "" + }); + var diff = viewport - offsetHeight(document.documentElement); + if (diff > 0) { + minHeight = offsetHeight(this.$el) + diff; + } + } else { + var ref = offset(this.$el); + var top = ref.top; + if (top < viewport / 2 && this.offsetTop) { + offsetTop += top; + } + if (this.offsetBottom === true) { + offsetTop += offsetHeight(this.$el.nextElementSibling); + } else if (isNumeric(this.offsetBottom)) { + offsetTop += viewport / 100 * this.offsetBottom; + } else if (this.offsetBottom && endsWith(this.offsetBottom, "px")) { + offsetTop += toFloat(this.offsetBottom); + } else if (isString(this.offsetBottom)) { + offsetTop += offsetHeight(query(this.offsetBottom, this.$el)); + } + minHeight = offsetTop ? "calc(100vh - " + offsetTop + "px)" : "100vh"; + } + if (!minHeight) { + return; + } + css(this.$el, { + height: "", + minHeight: minHeight + }); + var elHeight = this.$el.offsetHeight; + if (this.minHeight && this.minHeight > elHeight) { + css(this.$el, "minHeight", this.minHeight); + } + if (viewport - offsetTop >= elHeight) { + css(this.$el, "height", minHeight); + } + }, + events: [ "load", "resize" ] + } + }); + function offsetHeight(el) { + return el && el.offsetHeight || 0; + } + } + var closeIcon = ''; + var closeLarge = ''; + var marker = ''; + var navbarToggleIcon = ''; + var overlayIcon = ''; + var paginationNext = ''; + var paginationPrevious = ''; + var searchIcon = ''; + var searchLarge = ''; + var searchNavbar = ''; + var slidenavNext = ''; + var slidenavNextLarge = ''; + var slidenavPrevious = ''; + var slidenavPreviousLarge = ''; + var spinner = ''; + var totop = ''; + function Icon(UIkit) { + var parsed = {}; + var icons = { + spinner: spinner, + totop: totop, + marker: marker, + "close-icon": closeIcon, + "close-large": closeLarge, + "navbar-toggle-icon": navbarToggleIcon, + "overlay-icon": overlayIcon, + "pagination-next": paginationNext, + "pagination-previous": paginationPrevious, + "search-icon": searchIcon, + "search-large": searchLarge, + "search-navbar": searchNavbar, + "slidenav-next": slidenavNext, + "slidenav-next-large": slidenavNextLarge, + "slidenav-previous": slidenavPrevious, + "slidenav-previous-large": slidenavPreviousLarge + }; + UIkit.component("icon", UIkit.components.svg.extend({ + attrs: [ "icon", "ratio" ], + mixins: [ Class ], + name: "icon", + args: "icon", + props: [ "icon" ], + defaults: { + exclude: [ "id", "style", "class", "src", "icon" ] + }, + init: function init() { + addClass(this.$el, "uk-icon"); + if (isRtl) { + this.icon = swap(swap(this.icon, "left", "right"), "previous", "next"); + } + }, + methods: { + getSvg: function getSvg() { + var icon = getIcon(this.icon); + if (!icon) { + return Promise.reject("Icon not found."); + } + return Promise.resolve(icon); + } + } + })); + [ "marker", "navbar-toggle-icon", "overlay-icon", "pagination-previous", "pagination-next", "totop" ].forEach(function(name) { + return registerComponent(name); + }); + [ "slidenav-previous", "slidenav-next" ].forEach(function(name) { + return registerComponent(name, { + init: function init() { + addClass(this.$el, "uk-slidenav"); + if (hasClass(this.$el, "uk-slidenav-large")) { + this.icon += "-large"; + } + } + }); + }); + registerComponent("search-icon", { + init: function init() { + if (hasClass(this.$el, "uk-search-icon") && parents(this.$el, ".uk-search-large").length) { + this.icon = "search-large"; + } else if (parents(this.$el, ".uk-search-navbar").length) { + this.icon = "search-navbar"; + } + } + }); + registerComponent("close", { + init: function init() { + this.icon = "close-" + (hasClass(this.$el, "uk-close-large") ? "large" : "icon"); + } + }); + registerComponent("spinner", { + connected: function connected() { + var this$1 = this; + this.svg.then(function(svg) { + return this$1.ratio !== 1 && css($("circle", svg), "stroke-width", 1 / this$1.ratio); + }, noop); + } + }); + UIkit.icon.add = function(added) { + Object.keys(added).forEach(function(name) { + icons[name] = added[name]; + delete parsed[name]; + }); + if (UIkit._initialized) { + apply(document.body, function(el) { + var icon = UIkit.getComponent(el, "icon"); + if (icon) { + icon.$reset(); + } + }); + } + }; + function registerComponent(name, mixin$$1) { + UIkit.component(name, UIkit.components.icon.extend({ + name: name, + mixins: mixin$$1 ? [ mixin$$1 ] : [], + defaults: { + icon: name + } + })); + } + function getIcon(icon) { + if (!icons[icon]) { + return null; + } + if (!parsed[icon]) { + parsed[icon] = $(icons[icon].trim()); + } + return parsed[icon]; + } + } + function Leader(UIkit) { + UIkit.component("leader", { + mixins: [ Class ], + props: { + fill: String, + media: "media" + }, + defaults: { + fill: "", + media: false, + clsWrapper: "uk-leader-fill", + clsHide: "uk-leader-hide", + attrFill: "data-fill" + }, + computed: { + fill: function fill(ref) { + var fill = ref.fill; + return fill || getCssVar("leader-fill"); + } + }, + connected: function connected() { + var assign; + assign = wrapInner(this.$el, ''), this.wrapper = assign[0]; + }, + disconnected: function disconnected() { + unwrap(this.wrapper.childNodes); + }, + update: [ { + read: function read(ref) { + var changed = ref.changed; + var width = ref.width; + var prev = width; + width = Math.floor(this.$el.offsetWidth / 2); + return { + width: width, + changed: changed || prev !== width, + hide: this.media && !window.matchMedia(this.media).matches + }; + }, + write: function write(data) { + toggleClass(this.wrapper, this.clsHide, data.hide); + if (data.changed) { + data.changed = false; + attr(this.wrapper, this.attrFill, new Array(data.width).join(this.fill)); + } + }, + events: [ "load", "resize" ] + } ] + }); + } + function Margin(UIkit) { + UIkit.component("margin", { + props: { + margin: String, + firstColumn: Boolean + }, + defaults: { + margin: "uk-margin-small-top", + firstColumn: "uk-first-column" + }, + update: { + read: function read(data) { + var items = this.$el.children; + if (!items.length || !isVisible(this.$el)) { + return data.rows = false; + } + data.stacks = true; + var rows = [ [] ]; + for (var i = 0; i < items.length; i++) { + var el = items[i]; + var dim = el.getBoundingClientRect(); + if (!dim.height) { + continue; + } + for (var j = rows.length - 1; j >= 0; j--) { + var row = rows[j]; + if (!row[0]) { + row.push(el); + break; + } + var leftDim = row[0].getBoundingClientRect(); + if (dim.top >= Math.floor(leftDim.bottom)) { + rows.push([ el ]); + break; + } + if (Math.floor(dim.bottom) > leftDim.top) { + data.stacks = false; + if (dim.left < leftDim.left && !isRtl) { + row.unshift(el); + break; + } + row.push(el); + break; + } + if (j === 0) { + rows.unshift([ el ]); + break; + } + } + } + data.rows = rows; + }, + write: function write(ref) { + var this$1 = this; + var rows = ref.rows; + rows.forEach(function(row, i) { + return row.forEach(function(el, j) { + toggleClass(el, this$1.margin, i !== 0); + toggleClass(el, this$1.firstColumn, j === 0); + }); + }); + }, + events: [ "load", "resize" ] + } + }); + } + function Modal$1(UIkit) { + UIkit.component("modal", { + mixins: [ Modal ], + defaults: { + clsPage: "uk-modal-page", + selPanel: ".uk-modal-dialog", + selClose: ".uk-modal-close, .uk-modal-close-default, .uk-modal-close-outside, .uk-modal-close-full" + }, + events: [ { + name: "show", + self: true, + handler: function handler() { + if (hasClass(this.panel, "uk-margin-auto-vertical")) { + addClass(this.$el, "uk-flex"); + } else { + css(this.$el, "display", "block"); + } + height(this.$el); + } + }, { + name: "hidden", + self: true, + handler: function handler() { + css(this.$el, "display", ""); + removeClass(this.$el, "uk-flex"); + } + } ] + }); + UIkit.component("overflow-auto", { + mixins: [ Class ], + computed: { + modal: function modal(_, $el) { + return closest($el, ".uk-modal"); + }, + panel: function panel(_, $el) { + return closest($el, ".uk-modal-dialog"); + } + }, + connected: function connected() { + css(this.$el, "minHeight", 150); + }, + update: { + write: function write() { + if (!this.panel || !this.modal) { + return; + } + var current = css(this.$el, "maxHeight"); + css(css(this.$el, "maxHeight", 150), "maxHeight", Math.max(150, 150 + height(this.modal) - this.panel.offsetHeight)); + if (current !== css(this.$el, "maxHeight")) { + trigger(this.$el, "resize"); + } + }, + events: [ "load", "resize" ] + } + }); + UIkit.modal.dialog = function(content, options) { + var dialog = UIkit.modal('
' + content + "
", options); + dialog.show(); + on(dialog.$el, "hidden", function(ref) { + var target = ref.target; + var currentTarget = ref.currentTarget; + if (target === currentTarget) { + dialog.$destroy(true); + } + }); + return dialog; + }; + UIkit.modal.alert = function(message, options) { + options = assign({ + bgClose: false, + escClose: false, + labels: UIkit.modal.labels + }, options); + return new Promise(function(resolve) { + return on(UIkit.modal.dialog('
' + (isString(message) ? message : html(message)) + '
", options).$el, "hide", resolve); + }); + }; + UIkit.modal.confirm = function(message, options) { + options = assign({ + bgClose: false, + escClose: true, + labels: UIkit.modal.labels + }, options); + return new Promise(function(resolve, reject) { + var confirm = UIkit.modal.dialog('
' + (isString(message) ? message : html(message)) + '
", options); + var resolved = false; + on(confirm.$el, "submit", "form", function(e) { + e.preventDefault(); + resolve(); + resolved = true; + confirm.hide(); + }); + on(confirm.$el, "hide", function() { + if (!resolved) { + reject(); + } + }); + }); + }; + UIkit.modal.prompt = function(message, value, options) { + options = assign({ + bgClose: false, + escClose: true, + labels: UIkit.modal.labels + }, options); + return new Promise(function(resolve) { + var prompt = UIkit.modal.dialog('
", options), input = $("input", prompt.$el); + input.value = value; + var resolved = false; + on(prompt.$el, "submit", "form", function(e) { + e.preventDefault(); + resolve(input.value); + resolved = true; + prompt.hide(); + }); + on(prompt.$el, "hide", function() { + if (!resolved) { + resolve(null); + } + }); + }); + }; + UIkit.modal.labels = { + ok: "Ok", + cancel: "Cancel" + }; + } + function Nav(UIkit) { + UIkit.component("nav", UIkit.components.accordion.extend({ + name: "nav", + defaults: { + targets: "> .uk-parent", + toggle: "> a", + content: "> ul" + } + })); + } + function Navbar(UIkit) { + UIkit.component("navbar", { + mixins: [ Class ], + props: { + dropdown: String, + mode: "list", + align: String, + offset: Number, + boundary: Boolean, + boundaryAlign: Boolean, + clsDrop: String, + delayShow: Number, + delayHide: Number, + dropbar: Boolean, + dropbarMode: String, + dropbarAnchor: "query", + duration: Number + }, + defaults: { + dropdown: ".uk-navbar-nav > li", + align: !isRtl ? "left" : "right", + clsDrop: "uk-navbar-dropdown", + mode: undefined, + offset: undefined, + delayShow: undefined, + delayHide: undefined, + boundaryAlign: undefined, + flip: "x", + boundary: true, + dropbar: false, + dropbarMode: "slide", + dropbarAnchor: false, + duration: 200 + }, + computed: { + boundary: function boundary(ref, $el) { + var boundary = ref.boundary; + var boundaryAlign = ref.boundaryAlign; + return boundary === true || boundaryAlign ? $el : boundary; + }, + pos: function pos(ref) { + var align = ref.align; + return "bottom-" + align; + } + }, + beforeConnect: function beforeConnect() { + var ref = this.$props; + var dropbar = ref.dropbar; + this.dropbar = dropbar && (isString(dropbar) && query(dropbar, this.$el) || $("
")); + if (this.dropbar) { + addClass(this.dropbar, "uk-navbar-dropbar"); + if (this.dropbarMode === "slide") { + addClass(this.dropbar, "uk-navbar-dropbar-slide"); + } + } + }, + disconnected: function disconnected() { + this.dropbar && remove(this.dropbar); + }, + update: function update() { + UIkit.drop($$(this.dropdown + " ." + this.clsDrop, this.$el).filter(function(el) { + return !UIkit.getComponent(el, "drop") && !UIkit.getComponent(el, "dropdown"); + }), assign({}, this.$props, { + boundary: this.boundary, + pos: this.pos, + offset: this.dropbar || this.offset + })); + }, + events: [ { + name: "mouseover", + delegate: function delegate() { + return this.dropdown; + }, + handler: function handler(ref) { + var current = ref.current; + var active = this.getActive(); + if (active && active.toggle && !within(active.toggle.$el, current) && !active.tracker.movesTo(active.$el)) { + active.hide(false); + } + } + }, { + name: "mouseleave", + el: function el() { + return this.dropbar; + }, + handler: function handler() { + var active = this.getActive(); + if (active && !matches(this.dropbar, ":hover")) { + active.hide(); + } + } + }, { + name: "beforeshow", + capture: true, + filter: function filter() { + return this.dropbar; + }, + handler: function handler() { + if (!this.dropbar.parentNode) { + after(this.dropbarAnchor || this.$el, this.dropbar); + } + } + }, { + name: "show", + capture: true, + filter: function filter() { + return this.dropbar; + }, + handler: function handler(_, drop) { + var $el = drop.$el; + var dir = drop.dir; + this.clsDrop && addClass($el, this.clsDrop + "-dropbar"); + if (dir === "bottom") { + this.transitionTo($el.offsetHeight + toFloat(css($el, "marginTop")) + toFloat(css($el, "marginBottom")), $el); + } + } + }, { + name: "beforehide", + filter: function filter() { + return this.dropbar; + }, + handler: function handler(e, ref) { + var $el = ref.$el; + var active = this.getActive(); + if (matches(this.dropbar, ":hover") && active && active.$el === $el) { + e.preventDefault(); + } + } + }, { + name: "hide", + filter: function filter() { + return this.dropbar; + }, + handler: function handler(_, ref) { + var $el = ref.$el; + var active = this.getActive(); + if (!active || active && active.$el === $el) { + this.transitionTo(0); + } + } + } ], + methods: { + getActive: function getActive() { + var active = UIkit.drop.getActive(); + return active && includes(active.mode, "hover") && within(active.toggle.$el, this.$el) && active; + }, + transitionTo: function transitionTo(newHeight, el) { + var ref = this; + var dropbar = ref.dropbar; + var oldHeight = isVisible(dropbar) ? height(dropbar) : 0; + el = oldHeight < newHeight && el; + css(el, { + height: oldHeight, + overflow: "hidden" + }); + height(dropbar, oldHeight); + Transition.cancel([ el, dropbar ]); + return Transition.start([ el, dropbar ], { + height: newHeight + }, this.duration).catch(noop).then(function() { + return css(el, { + height: "", + overflow: "" + }); + }); + } + } + }); + } + var scroll; + function Offcanvas(UIkit) { + UIkit.component("offcanvas", { + mixins: [ Modal ], + args: "mode", + props: { + content: String, + mode: String, + flip: Boolean, + overlay: Boolean + }, + defaults: { + content: ".uk-offcanvas-content", + mode: "slide", + flip: false, + overlay: false, + clsPage: "uk-offcanvas-page", + clsContainer: "uk-offcanvas-container", + selPanel: ".uk-offcanvas-bar", + clsFlip: "uk-offcanvas-flip", + clsContent: "uk-offcanvas-content", + clsContentAnimation: "uk-offcanvas-content-animation", + clsSidebarAnimation: "uk-offcanvas-bar-animation", + clsMode: "uk-offcanvas", + clsOverlay: "uk-offcanvas-overlay", + selClose: ".uk-offcanvas-close" + }, + computed: { + content: function content(ref) { + var content = ref.content; + return $(content) || document.body; + }, + clsFlip: function clsFlip(ref) { + var flip = ref.flip; + var clsFlip = ref.clsFlip; + return flip ? clsFlip : ""; + }, + clsOverlay: function clsOverlay(ref) { + var overlay = ref.overlay; + var clsOverlay = ref.clsOverlay; + return overlay ? clsOverlay : ""; + }, + clsMode: function clsMode(ref) { + var mode = ref.mode; + var clsMode = ref.clsMode; + return clsMode + "-" + mode; + }, + clsSidebarAnimation: function clsSidebarAnimation(ref) { + var mode = ref.mode; + var clsSidebarAnimation = ref.clsSidebarAnimation; + return mode === "none" || mode === "reveal" ? "" : clsSidebarAnimation; + }, + clsContentAnimation: function clsContentAnimation(ref) { + var mode = ref.mode; + var clsContentAnimation = ref.clsContentAnimation; + return mode !== "push" && mode !== "reveal" ? "" : clsContentAnimation; + }, + transitionElement: function transitionElement(ref) { + var mode = ref.mode; + return mode === "reveal" ? this.panel.parentNode : this.panel; + } + }, + update: { + write: function write() { + if (this.getActive() === this) { + if (this.overlay || this.clsContentAnimation) { + width(this.content, width(window) - this.scrollbarWidth); + } + if (this.overlay) { + height(this.content, height(window)); + if (scroll) { + this.content.scrollTop = scroll.y; + } + } + } + }, + events: [ "resize" ] + }, + events: [ { + name: "click", + delegate: function delegate() { + return 'a[href^="#"]'; + }, + handler: function handler(ref) { + var current = ref.current; + if (current.hash && $(current.hash, this.content)) { + scroll = null; + this.hide(); + } + } + }, { + name: "beforescroll", + filter: function filter() { + return this.overlay; + }, + handler: function handler(e, scroll, target) { + if (scroll && target && this.isToggled() && $(target, this.content)) { + once(this.$el, "hidden", function() { + return scroll.scrollTo(target); + }); + e.preventDefault(); + } + } + }, { + name: "show", + self: true, + handler: function handler() { + scroll = scroll || { + x: window.pageXOffset, + y: window.pageYOffset + }; + if (this.mode === "reveal" && !hasClass(this.panel, this.clsMode)) { + wrapAll(this.panel, "
"); + addClass(this.panel.parentNode, this.clsMode); + } + css(document.documentElement, "overflowY", (!this.clsContentAnimation || this.flip) && this.scrollbarWidth && this.overlay ? "scroll" : ""); + addClass(document.body, this.clsContainer, this.clsFlip, this.clsOverlay); + height(document.body); + addClass(this.content, this.clsContentAnimation); + addClass(this.panel, this.clsSidebarAnimation, this.mode !== "reveal" ? this.clsMode : ""); + addClass(this.$el, this.clsOverlay); + css(this.$el, "display", "block"); + height(this.$el); + } + }, { + name: "hide", + self: true, + handler: function handler() { + removeClass(this.content, this.clsContentAnimation); + var active = this.getActive(); + if (this.mode === "none" || active && active !== this && active !== this.prev) { + trigger(this.panel, "transitionend"); + } + } + }, { + name: "hidden", + self: true, + handler: function handler() { + if (this.mode === "reveal") { + unwrap(this.panel); + } + if (!this.overlay) { + scroll = { + x: window.pageXOffset, + y: window.pageYOffset + }; + } else if (!scroll) { + var ref = this.content; + var x = ref.scrollLeft; + var y = ref.scrollTop; + scroll = { + x: x, + y: y + }; + } + removeClass(this.panel, this.clsSidebarAnimation, this.clsMode); + removeClass(this.$el, this.clsOverlay); + css(this.$el, "display", ""); + removeClass(document.body, this.clsContainer, this.clsFlip, this.clsOverlay); + document.body.scrollTop = scroll.y; + css(document.documentElement, "overflowY", ""); + width(this.content, ""); + height(this.content, ""); + window.scrollTo(scroll.x, scroll.y); + scroll = null; + } + }, { + name: "swipeLeft swipeRight", + handler: function handler(e) { + if (this.isToggled() && isTouch(e) && (e.type === "swipeLeft" && !this.flip || e.type === "swipeRight" && this.flip)) { + this.hide(); + } + } + } ] + }); + } + function Responsive(UIkit) { + UIkit.component("responsive", { + props: [ "width", "height" ], + init: function init() { + addClass(this.$el, "uk-responsive-width"); + }, + update: { + read: function read() { + return isVisible(this.$el) && this.width && this.height ? { + width: width(this.$el.parentNode), + height: this.height + } : false; + }, + write: function write(dim) { + height(this.$el, Dimensions.contain({ + height: this.height, + width: this.width + }, dim).height); + }, + events: [ "load", "resize" ] + } + }); + } + function Scroll(UIkit) { + UIkit.component("scroll", { + props: { + duration: Number, + offset: Number + }, + defaults: { + duration: 1e3, + offset: 0 + }, + methods: { + scrollTo: function scrollTo(el) { + var this$1 = this; + el = el && $(el) || document.body; + var docHeight = height(document); + var winHeight = height(window); + var target = offset(el).top - this.offset; + if (target + winHeight > docHeight) { + target = docHeight - winHeight; + } + if (!trigger(this.$el, "beforescroll", [ this, el ])) { + return; + } + var start = Date.now(); + var startY = window.pageYOffset; + var step = function() { + var currentY = startY + (target - startY) * ease(clamp((Date.now() - start) / this$1.duration)); + window.scrollTo(window.pageXOffset, currentY); + if (currentY !== target) { + requestAnimationFrame(step); + } else { + trigger(this$1.$el, "scrolled", [ this$1, el ]); + } + }; + step(); + } + }, + events: { + click: function click(e) { + if (e.defaultPrevented) { + return; + } + e.preventDefault(); + this.scrollTo(escape(this.$el.hash).substr(1)); + } + } + }); + function ease(k) { + return .5 * (1 - Math.cos(Math.PI * k)); + } + } + function Scrollspy(UIkit) { + UIkit.component("scrollspy", { + args: "cls", + props: { + cls: "list", + target: String, + hidden: Boolean, + offsetTop: Number, + offsetLeft: Number, + repeat: Boolean, + delay: Number + }, + defaults: { + cls: [], + target: false, + hidden: true, + offsetTop: 0, + offsetLeft: 0, + repeat: false, + delay: 0, + inViewClass: "uk-scrollspy-inview" + }, + computed: { + elements: function elements(ref, $el) { + var target = ref.target; + return target ? $$(target, $el) : [ $el ]; + } + }, + update: [ { + write: function write() { + if (this.hidden) { + css(filter(this.elements, ":not(." + this.inViewClass + ")"), "visibility", "hidden"); + } + } + }, { + read: function read(els) { + var this$1 = this; + if (!UIkit._initialized) { + if (document.readyState === "complete") { + requestAnimationFrame(function() { + return this$1.$emit(); + }); + } + return false; + } + this.elements.forEach(function(el, i) { + var elData = els[i]; + if (!elData || elData.el !== el) { + var cls = data(el, "uk-scrollspy-class"); + elData = { + el: el, + toggles: cls && cls.split(",") || this$1.cls + }; + } + elData.show = isInView(el, this$1.offsetTop, this$1.offsetLeft); + els[i] = elData; + }); + }, + write: function write(els) { + var this$1 = this; + var index = this.elements.length === 1 ? 1 : 0; + this.elements.forEach(function(el, i) { + var elData = els[i]; + var cls = elData.toggles[i] || elData.toggles[0]; + if (elData.show && !elData.inview && !elData.timer) { + var show = function() { + css(el, "visibility", ""); + addClass(el, this$1.inViewClass); + toggleClass(el, cls); + trigger(el, "inview"); + UIkit.update(el); + elData.inview = true; + delete elData.timer; + }; + if (this$1.delay && index) { + elData.timer = setTimeout(show, this$1.delay * index); + } else { + show(); + } + index++; + } else if (!elData.show && elData.inview && this$1.repeat) { + if (elData.timer) { + clearTimeout(elData.timer); + delete elData.timer; + } + css(el, "visibility", this$1.hidden ? "hidden" : ""); + removeClass(el, this$1.inViewClass); + toggleClass(el, cls); + trigger(el, "outview"); + UIkit.update(el); + elData.inview = false; + } + }); + }, + events: [ "scroll", "load", "resize" ] + } ] + }); + } + function ScrollspyNav(UIkit) { + UIkit.component("scrollspy-nav", { + props: { + cls: String, + closest: String, + scroll: Boolean, + overflow: Boolean, + offset: Number + }, + defaults: { + cls: "uk-active", + closest: false, + scroll: false, + overflow: true, + offset: 0 + }, + computed: { + links: function links(_, $el) { + return $$('a[href^="#"]', $el).filter(function(el) { + return el.hash; + }); + }, + elements: function elements() { + return this.closest ? closest(this.links, this.closest) : this.links; + }, + targets: function targets() { + return $$(this.links.map(function(el) { + return el.hash; + }).join(",")); + } + }, + update: [ { + read: function read() { + if (this.scroll) { + UIkit.scroll(this.links, { + offset: this.offset || 0 + }); + } + } + }, { + read: function read(data) { + var this$1 = this; + var scroll = window.pageYOffset + this.offset + 1; + var max = height(document) - height(window) + this.offset; + data.active = false; + this.targets.every(function(el, i) { + var ref = offset(el); + var top = ref.top; + var last = i + 1 === this$1.targets.length; + if (!this$1.overflow && (i === 0 && top > scroll || last && top + el.offsetTop < scroll)) { + return false; + } + if (!last && offset(this$1.targets[i + 1]).top <= scroll) { + return true; + } + if (scroll >= max) { + for (var j = this$1.targets.length - 1; j > i; j--) { + if (isInView(this$1.targets[j])) { + el = this$1.targets[j]; + break; + } + } + } + return !(data.active = $(filter(this$1.links, '[href="#' + el.id + '"]'))); + }); + }, + write: function write(ref) { + var active = ref.active; + this.links.forEach(function(el) { + return el.blur(); + }); + removeClass(this.elements, this.cls); + if (active) { + trigger(this.$el, "active", [ active, addClass(this.closest ? closest(active, this.closest) : active, this.cls) ]); + } + }, + events: [ "scroll", "load", "resize" ] + } ] + }); + } + function Sticky(UIkit) { + UIkit.component("sticky", { + mixins: [ Class ], + attrs: true, + props: { + top: null, + bottom: Boolean, + offset: Number, + animation: String, + clsActive: String, + clsInactive: String, + clsFixed: String, + clsBelow: String, + selTarget: String, + widthElement: "query", + showOnUp: Boolean, + media: "media", + target: Number + }, + defaults: { + top: 0, + bottom: false, + offset: 0, + animation: "", + clsActive: "uk-active", + clsInactive: "", + clsFixed: "uk-sticky-fixed", + clsBelow: "uk-sticky-below", + selTarget: "", + widthElement: false, + showOnUp: false, + media: false, + target: false + }, + computed: { + selTarget: function selTarget(ref, $el) { + var selTarget = ref.selTarget; + return selTarget && $(selTarget, $el) || $el; + } + }, + connected: function connected() { + this.placeholder = $('
'); + this.widthElement = this.$props.widthElement || this.placeholder; + if (!this.isActive) { + this.hide(); + } + }, + disconnected: function disconnected() { + if (this.isActive) { + this.isActive = false; + this.hide(); + removeClass(this.selTarget, this.clsInactive); + } + remove(this.placeholder); + this.placeholder = null; + this.widthElement = null; + }, + ready: function ready() { + var this$1 = this; + if (!(this.target && location.hash && window.pageYOffset > 0)) { + return; + } + var target = $(location.hash); + if (target) { + fastdom.read(function() { + var ref = offset(target); + var top = ref.top; + var elTop = offset(this$1.$el).top; + var elHeight = this$1.$el.offsetHeight; + if (elTop + elHeight >= top && elTop <= top + target.offsetHeight) { + window.scrollTo(0, top - elHeight - this$1.target - this$1.offset); + } + }); + } + }, + events: [ { + name: "active", + self: true, + handler: function handler() { + replaceClass(this.selTarget, this.clsInactive, this.clsActive); + } + }, { + name: "inactive", + self: true, + handler: function handler() { + replaceClass(this.selTarget, this.clsActive, this.clsInactive); + } + } ], + update: [ { + write: function write() { + var ref = this; + var placeholder = ref.placeholder; + var outerHeight = (this.isActive ? placeholder : this.$el).offsetHeight; + css(placeholder, assign({ + height: css(this.$el, "position") !== "absolute" ? outerHeight : "" + }, css(this.$el, [ "marginTop", "marginBottom", "marginLeft", "marginRight" ]))); + if (!within(placeholder, document)) { + after(this.$el, placeholder); + attr(placeholder, "hidden", ""); + } + attr(this.widthElement, "hidden", null); + this.width = this.widthElement.offsetWidth; + attr(this.widthElement, "hidden", this.isActive ? null : ""); + this.topOffset = offset(this.isActive ? placeholder : this.$el).top; + this.bottomOffset = this.topOffset + outerHeight; + var bottom = parseProp("bottom", this); + this.top = Math.max(toFloat(parseProp("top", this)), this.topOffset) - this.offset; + this.bottom = bottom && bottom - outerHeight; + this.inactive = this.media && !window.matchMedia(this.media).matches; + if (this.isActive) { + this.update(); + } + }, + events: [ "load", "resize" ] + }, { + read: function read(_, ref) { + var scrollY = ref.scrollY; + if (scrollY === void 0) scrollY = window.pageYOffset; + return { + scroll: this.scroll = scrollY, + visible: isVisible(this.$el) + }; + }, + write: function write(ref, ref$1) { + var this$1 = this; + var visible = ref.visible; + var scroll = ref.scroll; + if (ref$1 === void 0) ref$1 = {}; + var dir = ref$1.dir; + if (scroll < 0 || !visible || this.disabled || this.showOnUp && !dir) { + return; + } + if (this.inactive || scroll < this.top || this.showOnUp && (scroll <= this.top || dir === "down" || dir === "up" && !this.isActive && scroll <= this.bottomOffset)) { + if (!this.isActive) { + return; + } + this.isActive = false; + if (this.animation && scroll > this.topOffset) { + Animation.cancel(this.$el); + Animation.out(this.$el, this.animation).then(function() { + return this$1.hide(); + }, noop); + } else { + this.hide(); + } + } else if (this.isActive) { + this.update(); + } else if (this.animation) { + Animation.cancel(this.$el); + this.show(); + Animation.in(this.$el, this.animation).catch(noop); + } else { + this.show(); + } + }, + events: [ "scroll" ] + } ], + methods: { + show: function show() { + this.isActive = true; + this.update(); + attr(this.placeholder, "hidden", null); + }, + hide: function hide() { + if (!this.isActive || hasClass(this.selTarget, this.clsActive)) { + trigger(this.$el, "inactive"); + } + removeClass(this.$el, this.clsFixed, this.clsBelow); + css(this.$el, { + position: "", + top: "", + width: "" + }); + attr(this.placeholder, "hidden", ""); + }, + update: function update() { + var active = this.top !== 0 || this.scroll > this.top; + var top = Math.max(0, this.offset); + if (this.bottom && this.scroll > this.bottom - this.offset) { + top = this.bottom - this.scroll; + } + css(this.$el, { + position: "fixed", + top: top + "px", + width: this.width + }); + if (hasClass(this.selTarget, this.clsActive)) { + if (!active) { + trigger(this.$el, "inactive"); + } + } else if (active) { + trigger(this.$el, "active"); + } + toggleClass(this.$el, this.clsBelow, this.scroll > this.bottomOffset); + addClass(this.$el, this.clsFixed); + } + } + }); + function parseProp(prop, ref) { + var $props = ref.$props; + var $el = ref.$el; + var propOffset = ref[prop + "Offset"]; + var value = $props[prop]; + if (!value) { + return; + } + if (isNumeric(value)) { + return propOffset + toFloat(value); + } else if (isString(value) && value.match(/^-?\d+vh$/)) { + return height(window) * toFloat(value) / 100; + } else { + var el = value === true ? $el.parentNode : query(value, $el); + if (el) { + return offset(el).top + el.offsetHeight; + } + } + } + } + var svgs = {}; + function Svg(UIkit) { + UIkit.component("svg", { + attrs: true, + props: { + id: String, + icon: String, + src: String, + style: String, + width: Number, + height: Number, + ratio: Number, + class: String + }, + defaults: { + ratio: 1, + id: false, + exclude: [ "src" ], + class: "" + }, + init: function init() { + this.class += " uk-svg"; + }, + connected: function connected() { + var this$1 = this; + if (!this.icon && includes(this.src, "#")) { + var parts = this.src.split("#"); + if (parts.length > 1) { + var assign; + assign = parts, this.src = assign[0], this.icon = assign[1]; + } + } + this.svg = this.getSvg().then(function(svg) { + var el; + if (isString(svg)) { + if (this$1.icon && includes(svg, "/g; + var symbols = {}; + function parseSymbols(svg, icon) { + if (!symbols[svg]) { + symbols[svg] = {}; + var match; + while (match = symbolRe.exec(svg)) { + symbols[svg][match[3]] = '"; + } + } + return symbols[svg][icon]; + } + } + function Switcher(UIkit) { + UIkit.component("switcher", { + mixins: [ Togglable ], + args: "connect", + props: { + connect: String, + toggle: String, + active: Number, + swiping: Boolean + }, + defaults: { + connect: "~.uk-switcher", + toggle: "> *", + active: 0, + swiping: true, + cls: "uk-active", + clsContainer: "uk-switcher", + attrItem: "uk-switcher-item", + queued: true + }, + computed: { + connects: function connects(ref, $el) { + var connect = ref.connect; + return queryAll(connect, $el); + }, + toggles: function toggles(ref, $el) { + var toggle = ref.toggle; + return $$(toggle, $el); + } + }, + events: [ { + name: "click", + delegate: function delegate() { + return this.toggle + ":not(.uk-disabled)"; + }, + handler: function handler(e) { + e.preventDefault(); + this.show(e.current); + } + }, { + name: "click", + el: function el() { + return this.connects; + }, + delegate: function delegate() { + return "[" + this.attrItem + "],[data-" + this.attrItem + "]"; + }, + handler: function handler(e) { + e.preventDefault(); + this.show(data(e.current, this.attrItem)); + } + }, { + name: "swipeRight swipeLeft", + filter: function filter() { + return this.swiping; + }, + el: function el() { + return this.connects; + }, + handler: function handler(e) { + if (!isTouch(e)) { + return; + } + e.preventDefault(); + if (!window.getSelection().toString()) { + this.show(e.type === "swipeLeft" ? "next" : "previous"); + } + } + } ], + update: function update() { + var this$1 = this; + this.connects.forEach(function(list) { + return this$1.updateAria(list.children); + }); + this.show(filter(this.toggles, "." + this.cls)[0] || this.toggles[this.active] || this.toggles[0]); + }, + methods: { + show: function show(item) { + var this$1 = this; + var ref = this.toggles; + var length = ref.length; + var prev = !!this.connects.length && index(filter(this.connects[0].children, "." + this.cls)[0]); + var hasPrev = prev >= 0; + var dir = item === "previous" ? -1 : 1; + var toggle, next = getIndex(item, this.toggles, prev); + for (var i = 0; i < length; i++, next = (next + dir + length) % length) { + if (!matches(this$1.toggles[next], ".uk-disabled, [disabled]")) { + toggle = this$1.toggles[next]; + break; + } + } + if (!toggle || prev >= 0 && hasClass(toggle, this.cls) || prev === next) { + return; + } + removeClass(this.toggles, this.cls); + attr(this.toggles, "aria-expanded", false); + addClass(toggle, this.cls); + attr(toggle, "aria-expanded", true); + this.connects.forEach(function(list) { + if (!hasPrev) { + this$1.toggleNow(list.children[next]); + } else { + this$1.toggleElement([ list.children[prev], list.children[next] ]); + } + }); + } + } + }); + } + function Tab(UIkit) { + UIkit.component("tab", UIkit.components.switcher.extend({ + mixins: [ Class ], + name: "tab", + props: { + media: "media" + }, + defaults: { + media: 960, + attrItem: "uk-tab-item" + }, + init: function init() { + var cls = hasClass(this.$el, "uk-tab-left") ? "uk-tab-left" : hasClass(this.$el, "uk-tab-right") ? "uk-tab-right" : false; + if (cls) { + UIkit.toggle(this.$el, { + cls: cls, + mode: "media", + media: this.media + }); + } + } + })); + } + function Toggle(UIkit) { + UIkit.component("toggle", { + mixins: [ UIkit.mixin.togglable ], + args: "target", + props: { + href: String, + target: null, + mode: "list", + media: "media" + }, + defaults: { + href: false, + target: false, + mode: "click", + queued: true, + media: false + }, + computed: { + target: function target(ref, $el) { + var href = ref.href; + var target = ref.target; + target = queryAll(target || href, $el); + return target.length && target || [ $el ]; + } + }, + events: [ { + name: pointerEnter + " " + pointerLeave, + filter: function filter() { + return includes(this.mode, "hover"); + }, + handler: function handler(e) { + if (!isTouch(e)) { + this.toggle("toggle" + (e.type === pointerEnter ? "show" : "hide")); + } + } + }, { + name: "click", + filter: function filter() { + return includes(this.mode, "click") || hasTouch; + }, + handler: function handler(e) { + if (!isTouch(e) && !includes(this.mode, "click")) { + return; + } + var link; + if (closest(e.target, 'a[href="#"], button') || (link = closest(e.target, "a[href]")) && (this.cls || !isVisible(this.target) || link.hash && matches(this.target, link.hash))) { + once(document, "click", function(e) { + return e.preventDefault(); + }); + } + this.toggle(); + } + } ], + update: { + write: function write() { + if (!includes(this.mode, "media") || !this.media) { + return; + } + var toggled = this.isToggled(this.target); + if (window.matchMedia(this.media).matches ? !toggled : toggled) { + this.toggle(); + } + }, + events: [ "load", "resize" ] + }, + methods: { + toggle: function toggle(type) { + if (trigger(this.target, type || "toggle", [ this ])) { + this.toggleElement(this.target); + } + } + } + }); + } + function Video(UIkit) { + UIkit.component("video", { + args: "autoplay", + props: { + automute: Boolean, + autoplay: Boolean + }, + defaults: { + automute: false, + autoplay: true + }, + computed: { + inView: function inView(ref) { + var autoplay = ref.autoplay; + return autoplay === "inview"; + } + }, + connected: function connected() { + if (this.inView && !hasAttr(this.$el, "preload")) { + this.$el.preload = "none"; + } + }, + ready: function ready() { + this.player = new Player(this.$el); + if (this.automute) { + this.player.mute(); + } + }, + update: [ { + read: function read(_, ref) { + var type = ref.type; + return !this.player || (type === "scroll" || type === "resize") && !this.inView ? false : { + visible: isVisible(this.$el) && css(this.$el, "visibility") !== "hidden", + inView: this.inView && isInView(this.$el) + }; + }, + write: function write(ref) { + var visible = ref.visible; + var inView = ref.inView; + if (!visible || this.inView && !inView) { + this.player.pause(); + } else if (this.autoplay === true || this.inView && inView) { + this.player.play(); + } + }, + events: [ "load", "resize", "scroll" ] + } ] + }); + } + function core(UIkit) { + UIkit.use(Toggle); + UIkit.use(Accordion); + UIkit.use(Alert); + UIkit.use(Video); + UIkit.use(Cover); + UIkit.use(Drop); + UIkit.use(Dropdown); + UIkit.use(FormCustom); + UIkit.use(HeightMatch); + UIkit.use(HeightViewport); + UIkit.use(Margin); + UIkit.use(Gif); + UIkit.use(Grid); + UIkit.use(Leader); + UIkit.use(Modal$1); + UIkit.use(Nav); + UIkit.use(Navbar); + UIkit.use(Offcanvas); + UIkit.use(Responsive); + UIkit.use(Scroll); + UIkit.use(Scrollspy); + UIkit.use(ScrollspyNav); + UIkit.use(Sticky); + UIkit.use(Svg); + UIkit.use(Icon); + UIkit.use(Switcher); + UIkit.use(Tab); + UIkit.use(Core); + } + UIkit$2.version = "3.0.0-beta.42"; + mixin(UIkit$2); + core(UIkit$2); + function plugin(UIkit) { + if (plugin.installed) { + return; + } + var ref = UIkit.util; + var $ = ref.$; + var empty = ref.empty; + var html = ref.html; + UIkit.component("countdown", { + mixins: [ UIkit.mixin.class ], + attrs: true, + props: { + date: String, + clsWrapper: String + }, + defaults: { + date: "", + clsWrapper: ".uk-countdown-%unit%" + }, + computed: { + date: function date(ref) { + var date = ref.date; + return Date.parse(date); + }, + days: function days(ref, $el) { + var clsWrapper = ref.clsWrapper; + return $(clsWrapper.replace("%unit%", "days"), $el); + }, + hours: function hours(ref, $el) { + var clsWrapper = ref.clsWrapper; + return $(clsWrapper.replace("%unit%", "hours"), $el); + }, + minutes: function minutes(ref, $el) { + var clsWrapper = ref.clsWrapper; + return $(clsWrapper.replace("%unit%", "minutes"), $el); + }, + seconds: function seconds(ref, $el) { + var clsWrapper = ref.clsWrapper; + return $(clsWrapper.replace("%unit%", "seconds"), $el); + }, + units: function units() { + var this$1 = this; + return [ "days", "hours", "minutes", "seconds" ].filter(function(unit) { + return this$1[unit]; + }); + } + }, + connected: function connected() { + this.start(); + }, + disconnected: function disconnected() { + var this$1 = this; + this.stop(); + this.units.forEach(function(unit) { + return empty(this$1[unit]); + }); + }, + events: [ { + name: "visibilitychange", + el: document, + handler: function handler() { + if (document.hidden) { + this.stop(); + } else { + this.start(); + } + } + } ], + update: { + write: function write() { + var this$1 = this; + var timespan = getTimeSpan(this.date); + if (timespan.total <= 0) { + this.stop(); + timespan.days = timespan.hours = timespan.minutes = timespan.seconds = 0; + } + this.units.forEach(function(unit) { + var digits = String(Math.floor(timespan[unit])); + digits = digits.length < 2 ? "0" + digits : digits; + var el = this$1[unit]; + if (el.textContent !== digits) { + digits = digits.split(""); + if (digits.length !== el.children.length) { + html(el, digits.map(function() { + return ""; + }).join("")); + } + digits.forEach(function(digit, i) { + return el.children[i].textContent = digit; + }); + } + }); + } + }, + methods: { + start: function start() { + var this$1 = this; + this.stop(); + if (this.date && this.units.length) { + this.$emit(); + this.timer = setInterval(function() { + return this$1.$emit(); + }, 1e3); + } + }, + stop: function stop() { + if (this.timer) { + clearInterval(this.timer); + this.timer = null; + } + } + } + }); + function getTimeSpan(date) { + var total = date - Date.now(); + return { + total: total, + seconds: total / 1e3 % 60, + minutes: total / 1e3 / 60 % 60, + hours: total / 1e3 / 60 / 60 % 24, + days: total / 1e3 / 60 / 60 / 24 + }; + } + } + function plugin$1(UIkit) { + if (plugin$1.installed) { + return; + } + var ref = UIkit.util; + var addClass = ref.addClass; + var css = ref.css; + var scrolledOver = ref.scrolledOver; + var sortBy = ref.sortBy; + var toFloat = ref.toFloat; + UIkit.component("grid-parallax", UIkit.components.grid.extend({ + props: { + target: String, + translate: Number + }, + defaults: { + target: false, + translate: 150 + }, + computed: { + translate: function translate(ref) { + var translate = ref.translate; + return Math.abs(translate); + } + }, + init: function init() { + addClass(this.$el, "uk-grid"); + }, + disconnected: function disconnected() { + this.reset(); + css(this.$el, "marginBottom", ""); + }, + update: [ { + read: function read(ref) { + var rows = ref.rows; + return { + columns: rows && rows[0] && rows[0].length || 0, + rows: rows && rows.map(function(elements) { + return sortBy(elements, "offsetLeft"); + }) + }; + }, + write: function write(ref) { + var columns = ref.columns; + css(this.$el, "marginBottom", columns > 1 ? this.translate + toFloat(css(css(this.$el, "marginBottom", ""), "marginBottom")) : ""); + }, + events: [ "load", "resize" ] + }, { + read: function read() { + return { + scrolled: scrolledOver(this.$el) * this.translate + }; + }, + write: function write(ref) { + var rows = ref.rows; + var columns = ref.columns; + var scrolled = ref.scrolled; + if (!rows || columns === 1 || !scrolled) { + return this.reset(); + } + rows.forEach(function(row) { + return row.forEach(function(el, i) { + return css(el, "transform", "translateY(" + (i % 2 ? scrolled : scrolled / 8) + "px)"); + }); + }); + }, + events: [ "scroll", "load", "resize" ] + } ], + methods: { + reset: function reset() { + css(this.$el.children, "transform", ""); + } + } + })); + UIkit.components.gridParallax.options.update.unshift({ + read: function read() { + this.reset(); + }, + events: [ "load", "resize" ] + }); + } + function AnimationsPlugin(UIkit) { + var ref = UIkit.util; + var css = ref.css; + var Animations = { + slide: { + show: function show(dir) { + return [ { + transform: translate(dir * -100) + }, { + transform: translate() + } ]; + }, + percent: function percent(current) { + return Animations.translated(current); + }, + translate: function translate$1(percent, dir) { + return [ { + transform: translate(dir * -100 * percent) + }, { + transform: translate(dir * 100 * (1 - percent)) + } ]; + } + }, + translated: function translated(el) { + return Math.abs(css(el, "transform").split(",")[4] / el.offsetWidth) || 0; + } + }; + return Animations; + } + function translate(value, unit) { + if (value === void 0) value = 0; + if (unit === void 0) unit = "%"; + return "translateX(" + value + (value ? unit : "") + ")"; + } + function scale3d(value) { + return "scale3d(" + value + ", " + value + ", 1)"; + } + function TransitionerPlugin(UIkit) { + var ref = UIkit.util; + var createEvent = ref.createEvent; + var clamp = ref.clamp; + var css = ref.css; + var Deferred = ref.Deferred; + var noop = ref.noop; + var Promise = ref.Promise; + var Transition = ref.Transition; + var trigger = ref.trigger; + function Transitioner(prev, next, dir, ref) { + var animation = ref.animation; + var easing = ref.easing; + var percent = animation.percent; + var translate = animation.translate; + var show = animation.show; + if (show === void 0) show = noop; + var props = show(dir); + var deferred = new Deferred(); + return { + dir: dir, + show: function show(duration, percent, linear) { + var this$1 = this; + if (percent === void 0) percent = 0; + var timing = linear ? "linear" : easing; + duration -= Math.round(duration * clamp(percent, -1, 1)); + this.translate(percent); + triggerUpdate(next, "itemin", { + percent: percent, + duration: duration, + timing: timing, + dir: dir + }); + triggerUpdate(prev, "itemout", { + percent: 1 - percent, + duration: duration, + timing: timing, + dir: dir + }); + Promise.all([ Transition.start(next, props[1], duration, timing), Transition.start(prev, props[0], duration, timing) ]).then(function() { + this$1.reset(); + deferred.resolve(); + }, noop); + return deferred.promise; + }, + stop: function stop() { + return Transition.stop([ next, prev ]); + }, + cancel: function cancel() { + Transition.cancel([ next, prev ]); + }, + reset: function reset() { + for (var prop in props[0]) { + css([ next, prev ], prop, ""); + } + }, + forward: function forward(duration, percent) { + if (percent === void 0) percent = this.percent(); + Transition.cancel([ next, prev ]); + return this.show(duration, percent, true); + }, + translate: function translate$1(percent) { + this.reset(); + var props = translate(percent, dir); + css(next, props[1]); + css(prev, props[0]); + triggerUpdate(next, "itemtranslatein", { + percent: percent, + dir: dir + }); + triggerUpdate(prev, "itemtranslateout", { + percent: 1 - percent, + dir: dir + }); + }, + percent: function percent$1() { + return percent(prev || next, next, dir); + }, + getDistance: function getDistance() { + return prev.offsetWidth; + } + }; + } + function triggerUpdate(el, type, data) { + trigger(el, createEvent(type, false, false, data)); + } + return Transitioner; + } + function AutoplayMixin(UIkit) { + var ref = UIkit.util; + var pointerDown = ref.pointerDown; + return { + props: { + autoplay: Boolean, + autoplayInterval: Number, + pauseOnHover: Boolean + }, + defaults: { + autoplay: false, + autoplayInterval: 7e3, + pauseOnHover: true + }, + connected: function connected() { + this.startAutoplay(); + }, + disconnected: function disconnected() { + this.stopAutoplay(); + }, + events: [ { + name: "visibilitychange", + el: document, + handler: function handler() { + if (document.hidden) { + this.stopAutoplay(); + } else { + this.startAutoplay(); + } + } + }, { + name: pointerDown, + handler: "stopAutoplay" + }, { + name: "mouseenter", + filter: function filter() { + return this.autoplay; + }, + handler: function handler() { + this.isHovering = true; + } + }, { + name: "mouseleave", + filter: function filter() { + return this.autoplay; + }, + handler: function handler() { + this.isHovering = false; + } + } ], + methods: { + startAutoplay: function startAutoplay() { + var this$1 = this; + this.stopAutoplay(); + if (this.autoplay) { + this.interval = setInterval(function() { + return !(this$1.isHovering && this$1.pauseOnHover) && !this$1.stack.length && this$1.show("next"); + }, this.autoplayInterval); + } + }, + stopAutoplay: function stopAutoplay() { + if (this.interval) { + clearInterval(this.interval); + } + } + } + }; + } + function DragMixin(UIkit) { + var ref = UIkit.util; + var getPos = ref.getPos; + var includes = ref.includes; + var isRtl = ref.isRtl; + var isTouch = ref.isTouch; + var off = ref.off; + var on = ref.on; + var pointerDown = ref.pointerDown; + var pointerMove = ref.pointerMove; + var pointerUp = ref.pointerUp; + var preventClick = ref.preventClick; + var trigger = ref.trigger; + return { + defaults: { + threshold: 10, + preventCatch: false + }, + init: function init() { + var this$1 = this; + [ "start", "move", "end" ].forEach(function(key) { + var fn = this$1[key]; + this$1[key] = function(e) { + var pos = getPos(e).x * (isRtl ? -1 : 1); + this$1.prevPos = pos !== this$1.pos ? this$1.pos : this$1.prevPos; + this$1.pos = pos; + fn(e); + }; + }); + }, + events: [ { + name: pointerDown, + delegate: function delegate() { + return this.slidesSelector; + }, + handler: function handler(e) { + if (!isTouch(e) && hasTextNodesOnly(e.target) || e.button > 0 || this.length < 2 || this.preventCatch) { + return; + } + this.start(e); + } + }, { + name: "dragstart", + handler: function handler(e) { + e.preventDefault(); + } + } ], + methods: { + start: function start() { + this.drag = this.pos; + if (this._transitioner) { + this.percent = this._transitioner.percent(); + this.drag += this._transitioner.getDistance() * this.percent * this.dir; + this._transitioner.translate(this.percent); + this._transitioner.cancel(); + this.dragging = true; + this.stack = []; + } else { + this.prevIndex = this.index; + } + this.unbindMove = on(document, pointerMove, this.move, { + capture: true, + passive: false + }); + on(window, "scroll", this.unbindMove); + on(document, pointerUp, this.end, true); + }, + move: function move(e) { + var this$1 = this; + var distance = this.pos - this.drag; + if (distance === 0 || this.prevPos === this.pos || !this.dragging && Math.abs(distance) < this.threshold) { + return; + } + e.cancelable && e.preventDefault(); + this.dragging = true; + this.dir = distance < 0 ? 1 : -1; + var ref = this; + var slides = ref.slides; + var ref$1 = this; + var prevIndex = ref$1.prevIndex; + var dis = Math.abs(distance); + var nextIndex = this.getIndex(prevIndex + this.dir, prevIndex); + var width = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth; + while (nextIndex !== prevIndex && dis > width) { + this$1.drag -= width * this$1.dir; + prevIndex = nextIndex; + dis -= width; + nextIndex = this$1.getIndex(prevIndex + this$1.dir, prevIndex); + width = this$1._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth; + } + this.percent = dis / width; + var prev = slides[prevIndex]; + var next = slides[nextIndex]; + var changed = this.index !== nextIndex; + var edge = prevIndex === nextIndex; + var itemShown; + [ this.index, this.prevIndex ].filter(function(i) { + return !includes([ nextIndex, prevIndex ], i); + }).forEach(function(i) { + trigger(slides[i], "itemhidden", [ this$1 ]); + if (edge) { + itemShown = true; + this$1.prevIndex = prevIndex; + } + }); + if (this.index === prevIndex && this.prevIndex !== prevIndex || itemShown) { + trigger(slides[this.index], "itemshown", [ this ]); + } + if (changed) { + this.prevIndex = prevIndex; + this.index = nextIndex; + !edge && trigger(prev, "beforeitemhide", [ this ]); + trigger(next, "beforeitemshow", [ this ]); + } + this._transitioner = this._translate(Math.abs(this.percent), prev, !edge && next); + if (changed) { + !edge && trigger(prev, "itemhide", [ this ]); + trigger(next, "itemshow", [ this ]); + } + }, + end: function end() { + off(window, "scroll", this.unbindMove); + this.unbindMove(); + off(document, pointerUp, this.end, true); + if (this.dragging) { + this.dragging = null; + if (this.index === this.prevIndex) { + this.percent = 1 - this.percent; + this.dir *= -1; + this._show(false, this.index, true); + this._transitioner = null; + } else { + var dirChange = (isRtl ? this.dir * (isRtl ? 1 : -1) : this.dir) < 0 === this.prevPos > this.pos; + this.index = dirChange ? this.index : this.prevIndex; + if (dirChange) { + this.percent = 1 - this.percent; + } + this.show(this.dir > 0 && !dirChange || this.dir < 0 && dirChange ? "next" : "previous", true); + } + preventClick(); + } + this.drag = this.percent = null; + } + } + }; + function hasTextNodesOnly(el) { + return !el.children.length && el.childNodes.length; + } + } + function NavMixin(UIkit) { + var ref = UIkit.util; + var $ = ref.$; + var $$ = ref.$$; + var data = ref.data; + var html = ref.html; + var toggleClass = ref.toggleClass; + var toNumber = ref.toNumber; + return { + defaults: { + selNav: false + }, + computed: { + nav: function nav(ref, $el) { + var selNav = ref.selNav; + return $(selNav, $el); + }, + navItemSelector: function navItemSelector(ref) { + var attrItem = ref.attrItem; + return "[" + attrItem + "],[data-" + attrItem + "]"; + }, + navItems: function navItems(_, $el) { + return $$(this.navItemSelector, $el); + } + }, + update: [ { + write: function write() { + var this$1 = this; + if (this.nav && this.length !== this.nav.children.length) { + html(this.nav, this.slides.map(function(_, i) { + return "
  • '; + }).join("")); + } + toggleClass($$(this.navItemSelector, this.$el).concat(this.nav), "uk-hidden", !this.maxIndex); + this.updateNav(); + }, + events: [ "load", "resize" ] + } ], + events: [ { + name: "click", + delegate: function delegate() { + return this.navItemSelector; + }, + handler: function handler(e) { + e.preventDefault(); + e.current.blur(); + this.show(data(e.current, this.attrItem)); + } + }, { + name: "itemshow", + handler: "updateNav" + } ], + methods: { + updateNav: function updateNav() { + var this$1 = this; + var i = this.getValidIndex(); + this.navItems.forEach(function(el) { + var cmd = data(el, this$1.attrItem); + toggleClass(el, this$1.clsActive, toNumber(cmd) === i); + toggleClass(el, "uk-invisible", this$1.finite && (cmd === "previous" && i === 0 || cmd === "next" && i >= this$1.maxIndex)); + }); + } + } + }; + } + function plugin$5(UIkit) { + if (plugin$5.installed) { + return; + } + var ref = UIkit.util; + var $ = ref.$; + var assign = ref.assign; + var clamp = ref.clamp; + var fastdom = ref.fastdom; + var getIndex = ref.getIndex; + var hasClass = ref.hasClass; + var isNumber = ref.isNumber; + var isRtl = ref.isRtl; + var Promise = ref.Promise; + var toNodes = ref.toNodes; + var trigger = ref.trigger; + UIkit.mixin.slider = { + attrs: true, + mixins: [ AutoplayMixin(UIkit), DragMixin(UIkit), NavMixin(UIkit) ], + props: { + clsActivated: Boolean, + easing: String, + index: Number, + finite: Boolean, + velocity: Number + }, + defaults: { + easing: "ease", + finite: false, + velocity: 1, + index: 0, + stack: [], + percent: 0, + clsActive: "uk-active", + clsActivated: false, + Transitioner: false, + transitionOptions: {} + }, + computed: { + duration: function duration(ref, $el) { + var velocity = ref.velocity; + return speedUp($el.offsetWidth / velocity); + }, + length: function length() { + return this.slides.length; + }, + list: function list(ref, $el) { + var selList = ref.selList; + return $(selList, $el); + }, + maxIndex: function maxIndex() { + return this.length - 1; + }, + slidesSelector: function slidesSelector(ref) { + var selList = ref.selList; + return selList + " > *"; + }, + slides: function slides() { + return toNodes(this.list.children); + } + }, + methods: { + show: function show(index, force) { + var this$1 = this; + if (force === void 0) force = false; + if (this.dragging || !this.length) { + return; + } + var ref = this; + var stack = ref.stack; + var queueIndex = force ? 0 : stack.length; + var reset = function() { + stack.splice(queueIndex, 1); + if (stack.length) { + this$1.show(stack.shift(), true); + } + }; + stack[force ? "unshift" : "push"](index); + if (!force && stack.length > 1) { + if (stack.length === 2) { + this._transitioner.forward(Math.min(this.duration, 200)); + } + return; + } + var prevIndex = this.index; + var prev = hasClass(this.slides, this.clsActive) && this.slides[prevIndex]; + var nextIndex = this.getIndex(index, this.index); + var next = this.slides[nextIndex]; + if (prev === next) { + reset(); + return; + } + this.dir = getDirection(index, prevIndex); + this.prevIndex = prevIndex; + this.index = nextIndex; + prev && trigger(prev, "beforeitemhide", [ this ]); + if (!trigger(next, "beforeitemshow", [ this, prev ])) { + this.index = this.prevIndex; + reset(); + return; + } + var promise = this._show(prev, next, force).then(function() { + prev && trigger(prev, "itemhidden", [ this$1 ]); + trigger(next, "itemshown", [ this$1 ]); + return new Promise(function(resolve) { + fastdom.write(function() { + stack.shift(); + if (stack.length) { + this$1.show(stack.shift(), true); + } else { + this$1._transitioner = null; + } + resolve(); + }); + }); + }); + prev && trigger(prev, "itemhide", [ this ]); + trigger(next, "itemshow", [ this ]); + return promise; + }, + getIndex: function getIndex$1(index, prev) { + if (index === void 0) index = this.index; + if (prev === void 0) prev = this.index; + return clamp(getIndex(index, this.slides, prev, this.finite), 0, this.maxIndex); + }, + getValidIndex: function getValidIndex(index, prevIndex) { + if (index === void 0) index = this.index; + if (prevIndex === void 0) prevIndex = this.prevIndex; + return this.getIndex(index, prevIndex); + }, + _show: function _show(prev, next, force) { + this._transitioner = this._getTransitioner(prev, next, this.dir, assign({ + easing: force ? next.offsetWidth < 600 ? "cubic-bezier(0.25, 0.46, 0.45, 0.94)" : "cubic-bezier(0.165, 0.84, 0.44, 1)" : this.easing + }, this.transitionOptions)); + if (!force && !prev) { + this._transitioner.translate(1); + return Promise.resolve(); + } + var ref = this.stack; + var length = ref.length; + return this._transitioner[length > 1 ? "forward" : "show"](length > 1 ? Math.min(this.duration, 75 + 75 / (length - 1)) : this.duration, this.percent); + }, + _getDistance: function _getDistance(prev, next) { + return new this._getTransitioner(prev, prev !== next && next).getDistance(); + }, + _translate: function _translate(percent, prev, next) { + if (prev === void 0) prev = this.prevIndex; + if (next === void 0) next = this.index; + var transitioner = this._getTransitioner(prev !== next ? prev : false, next); + transitioner.translate(percent); + return transitioner; + }, + _getTransitioner: function _getTransitioner(prev, next, dir, options) { + if (prev === void 0) prev = this.prevIndex; + if (next === void 0) next = this.index; + if (dir === void 0) dir = this.dir || 1; + if (options === void 0) options = this.transitionOptions; + return new this.Transitioner(isNumber(prev) ? this.slides[prev] : prev, isNumber(next) ? this.slides[next] : next, dir * (isRtl ? -1 : 1), options); + } + } + }; + function getDirection(index, prevIndex) { + return index === "next" ? 1 : index === "previous" ? -1 : index < prevIndex ? -1 : 1; + } + } + function speedUp(x) { + return .5 * x + 300; + } + function plugin$4(UIkit) { + if (plugin$4.installed) { + return; + } + UIkit.use(plugin$5); + var mixin = UIkit.mixin; + var UIkit_util = UIkit.util; + var addClass = UIkit_util.addClass; + var assign = UIkit_util.assign; + var fastdom = UIkit_util.fastdom; + var isNumber = UIkit_util.isNumber; + var removeClass = UIkit_util.removeClass; + var Animations = AnimationsPlugin(UIkit); + var Transitioner = TransitionerPlugin(UIkit); + UIkit.mixin.slideshow = { + mixins: [ mixin.slider ], + props: { + animation: String + }, + defaults: { + animation: "slide", + clsActivated: "uk-transition-active", + Animations: Animations, + Transitioner: Transitioner + }, + computed: { + animation: function animation(ref) { + var animation = ref.animation; + var Animations = ref.Animations; + return assign(animation in Animations ? Animations[animation] : Animations.slide, { + name: animation + }); + }, + transitionOptions: function transitionOptions() { + return { + animation: this.animation + }; + } + }, + events: { + "itemshow itemhide itemshown itemhidden": function itemshowitemhideitemshownitemhidden(ref) { + var target = ref.target; + UIkit.update(target); + }, + itemshow: function itemshow() { + isNumber(this.prevIndex) && fastdom.flush(); + }, + beforeitemshow: function beforeitemshow(ref) { + var target = ref.target; + addClass(target, this.clsActive); + }, + itemshown: function itemshown(ref) { + var target = ref.target; + addClass(target, this.clsActivated); + }, + itemhidden: function itemhidden(ref) { + var target = ref.target; + removeClass(target, this.clsActive, this.clsActivated); + } + } + }; + } + function AnimationsPlugin$1(UIkit) { + var mixin = UIkit.mixin; + var UIkit_util = UIkit.util; + var assign = UIkit_util.assign; + var css = UIkit_util.css; + return assign({}, mixin.slideshow.defaults.Animations, { + fade: { + show: function show() { + return [ { + opacity: 0 + }, { + opacity: 1 + } ]; + }, + percent: function percent(current) { + return 1 - css(current, "opacity"); + }, + translate: function translate$$1(percent) { + return [ { + opacity: 1 - percent + }, { + opacity: percent + } ]; + } + }, + scale: { + show: function show() { + return [ { + opacity: 0, + transform: scale3d(1 - .2) + }, { + opacity: 1, + transform: scale3d(1) + } ]; + }, + percent: function percent(current) { + return 1 - css(current, "opacity"); + }, + translate: function translate$$1(percent) { + return [ { + opacity: 1 - percent, + transform: scale3d(1 - .2 * percent) + }, { + opacity: percent, + transform: scale3d(1 - .2 + .2 * percent) + } ]; + } + } + }); + } + function plugin$3(UIkit) { + if (plugin$3.installed) { + return; + } + UIkit.use(plugin$4); + var mixin = UIkit.mixin; + var util = UIkit.util; + var $ = util.$; + var addClass = util.addClass; + var ajax = util.ajax; + var append = util.append; + var assign = util.assign; + var attr = util.attr; + var css = util.css; + var getImage = util.getImage; + var html = util.html; + var index = util.index; + var on = util.on; + var pointerDown = util.pointerDown; + var pointerMove = util.pointerMove; + var removeClass = util.removeClass; + var Transition = util.Transition; + var trigger = util.trigger; + var Animations = AnimationsPlugin$1(UIkit); + UIkit.component("lightbox-panel", { + mixins: [ mixin.container, mixin.modal, mixin.togglable, mixin.slideshow ], + functional: true, + props: { + delayControls: Number, + preload: Number, + videoAutoplay: Boolean, + template: String + }, + defaults: { + preload: 1, + videoAutoplay: false, + delayControls: 3e3, + items: [], + cls: "uk-open", + clsPage: "uk-lightbox-page", + selList: ".uk-lightbox-items", + attrItem: "uk-lightbox-item", + selClose: ".uk-close-large", + pauseOnHover: false, + velocity: 2, + Animations: Animations, + template: '
      ' + }, + created: function created() { + var this$1 = this; + this.$mount(append(this.container, this.template)); + this.caption = $(".uk-lightbox-caption", this.$el); + this.items.forEach(function() { + return append(this$1.list, "
    • "); + }); + }, + events: [ { + name: pointerMove + " " + pointerDown + " keydown", + handler: "showControls" + }, { + name: "click", + self: true, + delegate: function delegate() { + return this.slidesSelector; + }, + handler: function handler(e) { + e.preventDefault(); + this.hide(); + } + }, { + name: "shown", + self: true, + handler: "showControls" + }, { + name: "hide", + self: true, + handler: function handler() { + this.hideControls(); + removeClass(this.slides, this.clsActive); + Transition.stop(this.slides); + } + }, { + name: "keyup", + el: document, + handler: function handler(e) { + if (!this.isToggled(this.$el)) { + return; + } + switch (e.keyCode) { + case 37: + this.show("previous"); + break; + + case 39: + this.show("next"); + break; + } + } + }, { + name: "beforeitemshow", + handler: function handler(e) { + if (this.isToggled()) { + return; + } + this.preventCatch = true; + e.preventDefault(); + this.toggleNow(this.$el, true); + this.animation = Animations["scale"]; + removeClass(e.target, this.clsActive); + this.stack.splice(1, 0, this.index); + } + }, { + name: "itemshow", + handler: function handler(ref) { + var this$1 = this; + var target = ref.target; + var i = index(target); + var ref$1 = this.getItem(i); + var caption = ref$1.caption; + css(this.caption, "display", caption ? "" : "none"); + html(this.caption, caption); + for (var j = 0; j <= this.preload; j++) { + this$1.loadItem(this$1.getIndex(i + j)); + this$1.loadItem(this$1.getIndex(i - j)); + } + } + }, { + name: "itemshown", + handler: function handler() { + this.preventCatch = false; + } + }, { + name: "itemload", + handler: function handler(_, item) { + var this$1 = this; + var source = item.source; + var type = item.type; + var alt = item.alt; + this.setItem(item, ""); + if (!source) { + return; + } + var matches; + if (type === "image" || source.match(/\.(jp(e)?g|png|gif|svg)$/i)) { + getImage(source).then(function(img) { + return this$1.setItem(item, '' + (alt ? alt : '); + }, function() { + return this$1.setError(item); + }); + } else if (type === "video" || source.match(/\.(mp4|webm|ogv)$/i)) { + var video = $("'); + attr(video, "src", source); + on(video, "error", function() { + return this$1.setError(item); + }); + on(video, "loadedmetadata", function() { + attr(video, { + width: video.videoWidth, + height: video.videoHeight + }); + this$1.setItem(item, video); + }); + } else if (type === "iframe") { + this.setItem(item, ''); + } else if (matches = source.match(/\/\/.*?youtube(-nocookie)?\.[a-z]+\/watch\?v=([^&\s]+)/) || source.match(/()youtu\.be\/(.*)/)) { + var id = matches[2]; + var setIframe = function(width, height) { + if (width === void 0) width = 640; + if (height === void 0) height = 450; + return this$1.setItem(item, getIframe("//www.youtube" + (matches[1] || "") + ".com/embed/" + id, width, height, this$1.videoAutoplay)); + }; + getImage("//img.youtube.com/vi/" + id + "/maxresdefault.jpg").then(function(ref) { + var width = ref.width; + var height = ref.height; + if (width === 120 && height === 90) { + getImage("//img.youtube.com/vi/" + id + "/0.jpg").then(function(ref) { + var width = ref.width; + var height = ref.height; + return setIframe(width, height); + }, setIframe); + } else { + setIframe(width, height); + } + }, setIframe); + } else if (matches = source.match(/(\/\/.*?)vimeo\.[a-z]+\/([0-9]+).*?/)) { + ajax("//vimeo.com/api/oembed.json?maxwidth=1920&url=" + encodeURI(source), { + responseType: "json" + }).then(function(ref) { + var ref_response = ref.response; + var height = ref_response.height; + var width = ref_response.width; + return this$1.setItem(item, getIframe("//player.vimeo.com/video/" + matches[2], width, height, this$1.videoAutoplay)); + }); + } + } + } ], + methods: { + loadItem: function loadItem(index) { + if (index === void 0) index = this.index; + var item = this.getItem(index); + if (item.content) { + return; + } + trigger(this.$el, "itemload", [ item ]); + }, + getItem: function getItem(index) { + if (index === void 0) index = this.index; + return this.items[index] || {}; + }, + setItem: function setItem(item, content) { + assign(item, { + content: content + }); + var el = html(this.slides[this.items.indexOf(item)], content); + trigger(this.$el, "itemloaded", [ this, el ]); + UIkit.update(el); + }, + setError: function setError(item) { + this.setItem(item, ''); + }, + showControls: function showControls() { + clearTimeout(this.controlsTimer); + this.controlsTimer = setTimeout(this.hideControls, this.delayControls); + addClass(this.$el, "uk-active", "uk-transition-active"); + }, + hideControls: function hideControls() { + removeClass(this.$el, "uk-active", "uk-transition-active"); + } + } + }); + function getIframe(src, width, height, autoplay) { + return ''; + } + } + function plugin$2(UIkit) { + if (plugin$2.installed) { + return; + } + UIkit.use(plugin$3); + var util = UIkit.util; + var $$ = util.$$; + var assign = util.assign; + var data = util.data; + var index = util.index; + var ref = UIkit.components.lightboxPanel; + var options = ref.options; + UIkit.component("lightbox", { + attrs: true, + props: assign({ + toggle: String + }, options.props), + defaults: assign({ + toggle: "a" + }, Object.keys(options.props).reduce(function(defaults, key) { + defaults[key] = options.defaults[key]; + return defaults; + }, {})), + computed: { + toggles: function toggles(ref, $el) { + var toggle = ref.toggle; + return $$(toggle, $el); + } + }, + disconnected: function disconnected() { + this._destroy(); + }, + events: [ { + name: "click", + delegate: function delegate() { + return this.toggle + ":not(.uk-disabled)"; + }, + handler: function handler(e) { + e.preventDefault(); + e.current.blur(); + this.show(index(this.toggles, e.current)); + } + } ], + update: function update(data) { + data.toggles = data.toggles || this.toggles; + if (this.panel && this.animation) { + this.panel.$props.animation = this.animation; + this.panel.$emit(); + } + if (!this.panel || isEqualList(data.toggles, this.toggles)) { + return; + } + data.toggles = this.toggles; + this._destroy(); + this._init(); + }, + methods: { + _init: function _init() { + return this.panel = this.panel || UIkit.lightboxPanel(assign({}, this.$props, { + items: this.toggles.reduce(function(items, el) { + items.push([ "href", "caption", "type", "poster", "alt" ].reduce(function(obj, attr) { + obj[attr === "href" ? "source" : attr] = data(el, attr); + return obj; + }, {})); + return items; + }, []) + })); + }, + _destroy: function _destroy() { + if (this.panel) { + this.panel.$destroy(true); + this.panel = null; + } + }, + show: function show(index) { + if (!this.panel) { + this._init(); + } + return this.panel.show(index); + }, + hide: function hide() { + return this.panel && this.panel.hide(); + } + } + }); + function isEqualList(listA, listB) { + return listA.length === listB.length && listA.every(function(el, i) { + return el === listB[i]; + }); + } + } + function plugin$6(UIkit) { + var obj; + if (plugin$6.installed) { + return; + } + var ref = UIkit.util; + var append = ref.append; + var apply = ref.apply; + var closest = ref.closest; + var css = ref.css; + var pointerEnter = ref.pointerEnter; + var pointerLeave = ref.pointerLeave; + var remove = ref.remove; + var toFloat = ref.toFloat; + var Transition = ref.Transition; + var trigger = ref.trigger; + var containers = {}; + UIkit.component("notification", { + functional: true, + args: [ "message", "status" ], + defaults: { + message: "", + status: "", + timeout: 5e3, + group: null, + pos: "top-center", + clsClose: "uk-notification-close", + clsMsg: "uk-notification-message" + }, + created: function created() { + if (!containers[this.pos]) { + containers[this.pos] = append(UIkit.container, '
      '); + } + var container = css(containers[this.pos], "display", "block"); + this.$mount(append(container, '
      ' + this.message + "
      ")); + }, + ready: function ready() { + var this$1 = this; + var marginBottom = toFloat(css(this.$el, "marginBottom")); + Transition.start(css(this.$el, { + opacity: 0, + marginTop: -this.$el.offsetHeight, + marginBottom: 0 + }), { + opacity: 1, + marginTop: 0, + marginBottom: marginBottom + }).then(function() { + if (this$1.timeout) { + this$1.timer = setTimeout(this$1.close, this$1.timeout); + } + }); + }, + events: (obj = { + click: function click(e) { + if (closest(e.target, 'a[href="#"]')) { + e.preventDefault(); + } + this.close(); + } + }, obj[pointerEnter] = function() { + if (this.timer) { + clearTimeout(this.timer); + } + }, obj[pointerLeave] = function() { + if (this.timeout) { + this.timer = setTimeout(this.close, this.timeout); + } + }, obj), + methods: { + close: function close(immediate) { + var this$1 = this; + var removeFn = function() { + trigger(this$1.$el, "close", [ this$1 ]); + remove(this$1.$el); + if (!containers[this$1.pos].children.length) { + css(containers[this$1.pos], "display", "none"); + } + }; + if (this.timer) { + clearTimeout(this.timer); + } + if (immediate) { + removeFn(); + } else { + Transition.start(this.$el, { + opacity: 0, + marginTop: -this.$el.offsetHeight, + marginBottom: 0 + }).then(removeFn); + } + } + } + }); + UIkit.notification.closeAll = function(group, immediate) { + apply(document.body, function(el) { + var notification = UIkit.getComponent(el, "notification"); + if (notification && (!group || group === notification.group)) { + notification.close(immediate); + } + }); + }; + } + function plugin$8(UIkit) { + if (plugin$8.installed) { + return; + } + var mixin = UIkit.mixin; + var util = UIkit.util; + var css = util.css; + var Dimensions = util.Dimensions; + var each = util.each; + var getImage = util.getImage; + var includes = util.includes; + var isNumber = util.isNumber; + var isUndefined = util.isUndefined; + var toFloat = util.toFloat; + var props = [ "x", "y", "bgx", "bgy", "rotate", "scale", "color", "backgroundColor", "borderColor", "opacity", "blur", "hue", "grayscale", "invert", "saturate", "sepia", "fopacity" ]; + mixin.parallax = { + props: props.reduce(function(props, prop) { + props[prop] = "list"; + return props; + }, { + media: "media" + }), + defaults: props.reduce(function(defaults, prop) { + defaults[prop] = undefined; + return defaults; + }, { + media: false + }), + computed: { + props: function props$1(properties, $el) { + var this$1 = this; + return props.reduce(function(props, prop) { + if (isUndefined(properties[prop])) { + return props; + } + var isColor = prop.match(/color/i); + var isCssProp = isColor || prop === "opacity"; + var pos, bgPos, diff; + var steps = properties[prop].slice(0); + if (isCssProp) { + css($el, prop, ""); + } + if (steps.length < 2) { + steps.unshift((prop === "scale" ? 1 : isCssProp ? css($el, prop) : 0) || 0); + } + var unit = includes(steps.join(""), "%") ? "%" : "px"; + if (isColor) { + var ref = $el.style; + var color = ref.color; + steps = steps.map(function(step) { + return parseColor($el, step); + }); + $el.style.color = color; + } else { + steps = steps.map(toFloat); + } + if (prop.match(/^bg/)) { + css($el, "background-position-" + prop[2], ""); + bgPos = css($el, "backgroundPosition").split(" ")[prop[2] === "x" ? 0 : 1]; + if (this$1.covers) { + var min = Math.min.apply(Math, steps); + var max = Math.max.apply(Math, steps); + var down = steps.indexOf(min) < steps.indexOf(max); + diff = max - min; + steps = steps.map(function(step) { + return step - (down ? min : max); + }); + pos = (down ? -diff : 0) + "px"; + } else { + pos = bgPos; + } + } + props[prop] = { + steps: steps, + unit: unit, + pos: pos, + bgPos: bgPos, + diff: diff + }; + return props; + }, {}); + }, + bgProps: function bgProps() { + var this$1 = this; + return [ "bgx", "bgy" ].filter(function(bg) { + return bg in this$1.props; + }); + }, + covers: function covers$1(_, $el) { + return covers($el); + } + }, + disconnected: function disconnected() { + delete this._image; + }, + update: [ { + read: function read(data) { + var this$1 = this; + data.active = !this.media || window.matchMedia(this.media).matches; + if (data.image) { + data.image.dimEl = { + width: this.$el.offsetWidth, + height: this.$el.offsetHeight + }; + } + if ("image" in data || !this.covers || !this.bgProps.length) { + return; + } + var src = css(this.$el, "backgroundImage").replace(/^none|url\(["']?(.+?)["']?\)$/, "$1"); + if (!src) { + return; + } + data.image = false; + getImage(src).then(function(img) { + data.image = { + width: img.naturalWidth, + height: img.naturalHeight + }; + this$1.$emit(); + }); + }, + write: function write(ref) { + var this$1 = this; + var image = ref.image; + var active = ref.active; + if (!image) { + return; + } + if (!active) { + css(this.$el, { + backgroundSize: "", + backgroundRepeat: "" + }); + return; + } + var dimEl = image.dimEl; + var dim = Dimensions.cover(image, dimEl); + this.bgProps.forEach(function(prop) { + var ref = this$1.props[prop]; + var diff = ref.diff; + var bgPos = ref.bgPos; + var steps = ref.steps; + var attr = prop === "bgy" ? "height" : "width"; + var span = dim[attr] - dimEl[attr]; + if (!bgPos.match(/%$|0px/)) { + return; + } + if (span < diff) { + dimEl[attr] = dim[attr] + diff - span; + } else if (span > diff) { + var bgPosFloat = parseFloat(bgPos); + if (bgPosFloat) { + this$1.props[prop].steps = steps.map(function(step) { + return step - (span - diff) / (100 / bgPosFloat); + }); + } + } + dim = Dimensions.cover(image, dimEl); + }); + css(this.$el, { + backgroundSize: dim.width + "px " + dim.height + "px", + backgroundRepeat: "no-repeat" + }); + }, + events: [ "load", "resize" ] + } ], + methods: { + reset: function reset() { + var this$1 = this; + each(this.getCss(0), function(_, prop) { + return css(this$1.$el, prop, ""); + }); + }, + getCss: function getCss(percent) { + var ref = this; + var props = ref.props; + var translated = false; + return Object.keys(props).reduce(function(css, prop) { + var ref = props[prop]; + var steps = ref.steps; + var unit = ref.unit; + var pos = ref.pos; + var value = getValue(steps, percent); + switch (prop) { + case "x": + case "y": + if (translated) { + break; + } + var ref$1 = [ "x", "y" ].map(function(dir) { + return prop === dir ? value + unit : props[dir] ? getValue(props[dir].steps, percent) + props[dir].unit : 0; + }); + var x = ref$1[0]; + var y = ref$1[1]; + translated = css.transform += " translate3d(" + x + ", " + y + ", 0)"; + break; + + case "rotate": + css.transform += " rotate(" + value + "deg)"; + break; + + case "scale": + css.transform += " scale(" + value + ")"; + break; + + case "bgy": + case "bgx": + css["background-position-" + prop[2]] = "calc(" + pos + " + " + (value + unit) + ")"; + break; + + case "color": + case "backgroundColor": + case "borderColor": + var ref$2 = getStep(steps, percent); + var start = ref$2[0]; + var end = ref$2[1]; + var p = ref$2[2]; + css[prop] = "rgba(" + start.map(function(value, i) { + value = value + p * (end[i] - value); + return i === 3 ? toFloat(value) : parseInt(value, 10); + }).join(",") + ")"; + break; + + case "blur": + css.filter += " blur(" + value + "px)"; + break; + + case "hue": + css.filter += " hue-rotate(" + value + "deg)"; + break; + + case "fopacity": + css.filter += " opacity(" + value + "%)"; + break; + + case "grayscale": + case "invert": + case "saturate": + case "sepia": + css.filter += " " + prop + "(" + value + "%)"; + break; + + default: + css[prop] = value; + } + return css; + }, { + transform: "", + filter: "" + }); + } + } + }; + function parseColor(el, color) { + return css(css(el, "color", color), "color").split(/[(),]/g).slice(1, -1).concat(1).slice(0, 4).map(function(n) { + return toFloat(n); + }); + } + function getStep(steps, percent) { + var count = steps.length - 1; + var index = Math.min(Math.floor(count * percent), count - 1); + var step = steps.slice(index, index + 2); + step.push(percent === 1 ? 1 : percent % (1 / count) * count); + return step; + } + function getValue(steps, percent) { + var ref = getStep(steps, percent); + var start = ref[0]; + var end = ref[1]; + var p = ref[2]; + return (isNumber(start) ? start + Math.abs(start - end) * p * (start < end ? 1 : -1) : +end).toFixed(2); + } + function covers(el) { + var ref = el.style; + var backgroundSize = ref.backgroundSize; + var covers = css(css(el, "backgroundSize", ""), "backgroundSize") === "cover"; + el.style.backgroundSize = backgroundSize; + return covers; + } + } + function plugin$7(UIkit) { + if (plugin$7.installed) { + return; + } + UIkit.use(plugin$8); + var mixin = UIkit.mixin; + var util = UIkit.util; + var clamp = util.clamp; + var css = util.css; + var scrolledOver = util.scrolledOver; + var query = util.query; + UIkit.component("parallax", { + mixins: [ mixin.parallax ], + props: { + target: String, + viewport: Number, + easing: Number + }, + defaults: { + target: false, + viewport: 1, + easing: 1 + }, + computed: { + target: function target(ref, $el) { + var target = ref.target; + return target && query(target, $el) || $el; + } + }, + update: [ { + read: function read(ref) { + var percent = ref.percent; + return { + prev: percent, + percent: ease(scrolledOver(this.target) / (this.viewport || 1), this.easing) + }; + }, + write: function write(ref, ref$1) { + var prev = ref.prev; + var percent = ref.percent; + var active = ref.active; + var type = ref$1.type; + if (type !== "scroll") { + prev = false; + } + if (!active) { + this.reset(); + return; + } + if (prev !== percent) { + css(this.$el, this.getCss(percent)); + } + }, + events: [ "scroll", "load", "resize" ] + } ] + }); + function ease(percent, easing) { + return clamp(percent * (1 - (easing - easing * percent))); + } + } + function SliderReactive(UIkit) { + var ref = UIkit.util; + var removeClass = ref.removeClass; + return { + update: [ { + write: function write() { + if (this.stack.length || this.dragging) { + return; + } + var index = this.getValidIndex(); + delete this.index; + removeClass(this.slides, this.clsActive, this.clsActivated); + this.show(index); + }, + events: [ "load", "resize" ] + } ] + }; + } + function TransitionerPlugin$1(UIkit) { + var ref = UIkit.util; + var assign = ref.assign; + var clamp = ref.clamp; + var createEvent = ref.createEvent; + var css = ref.css; + var Deferred = ref.Deferred; + var includes = ref.includes; + var index = ref.index; + var isRtl = ref.isRtl; + var noop = ref.noop; + var sortBy = ref.sortBy; + var toNodes = ref.toNodes; + var Transition = ref.Transition; + var trigger = ref.trigger; + var Transitioner = assign(function(prev, next, dir, ref) { + var center = ref.center; + var easing = ref.easing; + var list = ref.list; + var deferred = new Deferred(); + var from = prev ? Transitioner.getLeft(prev, list, center) : Transitioner.getLeft(next, list, center) + next.offsetWidth * dir, to = next ? Transitioner.getLeft(next, list, center) : from + prev.offsetWidth * dir * (isRtl ? -1 : 1); + return { + dir: dir, + show: function show(duration, percent, linear) { + if (percent === void 0) percent = 0; + var timing = linear ? "linear" : easing; + duration -= Math.round(duration * clamp(percent, -1, 1)); + this.translate(percent); + prev && this.updateTranslates(); + percent = prev ? percent : clamp(percent, 0, 1); + triggerUpdate(this.getItemIn(), "itemin", { + percent: percent, + duration: duration, + timing: timing, + dir: dir + }); + prev && triggerUpdate(this.getItemIn(true), "itemout", { + percent: 1 - percent, + duration: duration, + timing: timing, + dir: dir + }); + Transition.start(list, { + transform: translate(-to * (isRtl ? -1 : 1), "px") + }, duration, timing).then(deferred.resolve, noop); + return deferred.promise; + }, + stop: function stop() { + return Transition.stop(list); + }, + cancel: function cancel() { + Transition.cancel(list); + }, + reset: function reset() { + css(list, "transform", ""); + }, + forward: function forward(duration, percent) { + if (percent === void 0) percent = this.percent(); + Transition.cancel(list); + return this.show(duration, percent, true); + }, + translate: function translate$1(percent) { + var distance = this.getDistance() * dir * (isRtl ? -1 : 1); + css(list, "transform", translate(clamp(-to + (distance - distance * percent), -Transitioner.getWidth(list), list.offsetWidth) * (isRtl ? -1 : 1), "px")); + this.updateTranslates(); + if (prev) { + percent = clamp(percent, -1, 1); + triggerUpdate(this.getItemIn(), "itemtranslatein", { + percent: percent, + dir: dir + }); + triggerUpdate(this.getItemIn(true), "itemtranslateout", { + percent: 1 - percent, + dir: dir + }); + } + }, + percent: function percent() { + return Math.abs((css(list, "transform").split(",")[4] * (isRtl ? -1 : 1) + from) / (to - from)); + }, + getDistance: function getDistance() { + return Math.abs(to - from); + }, + getItemIn: function getItemIn(out) { + if (out === void 0) out = false; + var actives = this.getActives(); + var all = sortBy(slides(list), "offsetLeft"); + var i = index(all, actives[dir * (out ? -1 : 1) > 0 ? actives.length - 1 : 0]); + return ~i && all[i + (prev && !out ? dir : 0)]; + }, + getActives: function getActives() { + var left = Transitioner.getLeft(prev || next, list, center); + return sortBy(slides(list).filter(function(slide) { + var slideLeft = Transitioner.getElLeft(slide, list); + return slideLeft >= left && slideLeft + slide.offsetWidth <= list.offsetWidth + left; + }), "offsetLeft"); + }, + updateTranslates: function updateTranslates() { + var actives = this.getActives(); + slides(list).forEach(function(slide) { + var isActive = includes(actives, slide); + triggerUpdate(slide, "itemtranslate" + (isActive ? "in" : "out"), { + percent: isActive ? 1 : 0, + dir: slide.offsetLeft <= next.offsetLeft ? 1 : -1 + }); + }); + } + }; + }, { + getLeft: function getLeft(el, list, center) { + var left = this.getElLeft(el, list); + return center ? left - this.center(el, list) : Math.min(left, this.getMax(list)); + }, + getMax: function getMax(list) { + return Math.max(0, this.getWidth(list) - list.offsetWidth); + }, + getWidth: function getWidth(list) { + return slides(list).reduce(function(right, el) { + return el.offsetWidth + right; + }, 0); + }, + getMaxWidth: function getMaxWidth(list) { + return slides(list).reduce(function(right, el) { + return Math.max(right, el.offsetWidth); + }, 0); + }, + center: function center(el, list) { + return list.offsetWidth / 2 - el.offsetWidth / 2; + }, + getElLeft: function getElLeft(el, list) { + return (el.offsetLeft + (isRtl ? el.offsetWidth - list.offsetWidth : 0)) * (isRtl ? -1 : 1); + } + }); + function triggerUpdate(el, type, data) { + trigger(el, createEvent(type, false, false, data)); + } + function slides(list) { + return toNodes(list.children); + } + return Transitioner; + } + function ParallaxPlugin(UIkit, parent) { + UIkit.use(plugin$8); + var mixin = UIkit.mixin; + var UIkit_util = UIkit.util; + var closest = UIkit_util.closest; + var css = UIkit_util.css; + var endsWith = UIkit_util.endsWith; + var noop = UIkit_util.noop; + var Transition = UIkit_util.Transition; + return { + mixins: [ mixin.parallax ], + computed: { + item: function item() { + var slider = UIkit.getComponent(closest(this.$el, ".uk-" + parent), parent); + return slider && closest(this.$el, slider.slidesSelector); + } + }, + events: [ { + name: "itemshown", + self: true, + el: function el() { + return this.item; + }, + handler: function handler() { + css(this.$el, this.getCss(.5)); + } + }, { + name: "itemin itemout", + self: true, + el: function el() { + return this.item; + }, + handler: function handler(ref) { + var type = ref.type; + var ref_detail = ref.detail; + var percent = ref_detail.percent; + var duration = ref_detail.duration; + var timing = ref_detail.timing; + var dir = ref_detail.dir; + Transition.cancel(this.$el); + css(this.$el, this.getCss(getCurrent(type, dir, percent))); + Transition.start(this.$el, this.getCss(isIn(type) ? .5 : dir > 0 ? 1 : 0), duration, timing).catch(noop); + } + }, { + name: "transitioncanceled transitionend", + self: true, + el: function el() { + return this.item; + }, + handler: function handler() { + Transition.cancel(this.$el); + } + }, { + name: "itemtranslatein itemtranslateout", + self: true, + el: function el() { + return this.item; + }, + handler: function handler(ref) { + var type = ref.type; + var ref_detail = ref.detail; + var percent = ref_detail.percent; + var dir = ref_detail.dir; + Transition.cancel(this.$el); + css(this.$el, this.getCss(getCurrent(type, dir, percent))); + } + } ] + }; + function isIn(type) { + return endsWith(type, "in"); + } + function getCurrent(type, dir, percent) { + percent /= 2; + return !isIn(type) ? dir < 0 ? percent : 1 - percent : dir < 0 ? 1 - percent : percent; + } + } + function plugin$9(UIkit) { + if (plugin$9.installed) { + return; + } + UIkit.use(plugin$5); + var mixin = UIkit.mixin; + var UIkit_util = UIkit.util; + var $ = UIkit_util.$; + var $$ = UIkit_util.$$; + var addClass = UIkit_util.addClass; + var css = UIkit_util.css; + var data = UIkit_util.data; + var includes = UIkit_util.includes; + var isNumeric = UIkit_util.isNumeric; + var isUndefined = UIkit_util.isUndefined; + var offset = UIkit_util.offset; + var toggleClass = UIkit_util.toggleClass; + var toFloat = UIkit_util.toFloat; + var Transitioner = TransitionerPlugin$1(UIkit); + UIkit.component("slider-parallax", ParallaxPlugin(UIkit, "slider")); + UIkit.component("slider", { + mixins: [ mixin.class, mixin.slider, SliderReactive(UIkit) ], + props: { + center: Boolean, + sets: Boolean + }, + defaults: { + center: false, + sets: false, + attrItem: "uk-slider-item", + selList: ".uk-slider-items", + selNav: ".uk-slider-nav", + clsContainer: "uk-slider-container", + Transitioner: Transitioner + }, + computed: { + avgWidth: function avgWidth() { + return Transitioner.getWidth(this.list) / this.length; + }, + finite: function finite(ref) { + var finite = ref.finite; + return finite || Transitioner.getWidth(this.list) < this.list.offsetWidth + Transitioner.getMaxWidth(this.list) + this.center; + }, + maxIndex: function maxIndex() { + var this$1 = this; + if (!this.finite || this.center && !this.sets) { + return this.length - 1; + } + if (this.center) { + return this.sets[this.sets.length - 1]; + } + css(this.slides, "order", ""); + var max = Transitioner.getMax(this.list); + var i = this.length; + while (i--) { + if (Transitioner.getElLeft(this$1.list.children[i], this$1.list) < max) { + return Math.min(i + 1, this$1.length - 1); + } + } + return 0; + }, + sets: function sets(ref) { + var this$1 = this; + var sets = ref.sets; + var width = this.list.offsetWidth / (this.center ? 2 : 1); + var left = 0; + var leftCenter = width; + sets = sets && this.slides.reduce(function(sets, slide, i) { + var dim = offset(slide); + if (dim.right > left) { + if (!this$1.center && i > this$1.maxIndex) { + i = this$1.maxIndex; + } + if (!includes(sets, i)) { + var cmp = this$1.slides[i + 1]; + if (this$1.center && cmp && dim.width < leftCenter - offset(cmp).width / 2) { + leftCenter -= dim.width; + } else { + leftCenter = width; + sets.push(i); + left = dim.left + width + (this$1.center ? dim.width / 2 : 0); + } + } + } + return sets; + }, []); + return sets && sets.length && sets; + }, + transitionOptions: function transitionOptions() { + return { + center: this.center, + list: this.list + }; + } + }, + connected: function connected() { + toggleClass(this.$el, this.clsContainer, !$("." + this.clsContainer, this.$el)); + }, + update: { + write: function write() { + var this$1 = this; + $$("[" + this.attrItem + "],[data-" + this.attrItem + "]", this.$el).forEach(function(el) { + var index = data(el, this$1.attrItem); + this$1.maxIndex && toggleClass(el, "uk-hidden", isNumeric(index) && (this$1.sets && !includes(this$1.sets, toFloat(index)) || index > this$1.maxIndex)); + }); + }, + events: [ "load", "resize" ] + }, + events: { + beforeitemshow: function beforeitemshow(e) { + var this$1 = this; + if (!this.dragging && this.sets && this.stack.length < 2 && !includes(this.sets, this.index)) { + this.index = this.getValidIndex(); + } + var diff = Math.abs(this.index - this.prevIndex + (this.dir > 0 && this.index < this.prevIndex || this.dir < 0 && this.index > this.prevIndex ? (this.maxIndex + 1) * this.dir : 0)); + if (!this.dragging && diff > 1) { + for (var i = 0; i < diff; i++) { + this$1.stack.splice(1, 0, this$1.dir > 0 ? "next" : "previous"); + } + e.preventDefault(); + return; + } + this.duration = speedUp(this.avgWidth / this.velocity) * ((this.dir < 0 || !this.slides[this.prevIndex] ? this.slides[this.index] : this.slides[this.prevIndex]).offsetWidth / this.avgWidth); + this.reorder(); + }, + itemshow: function itemshow() { + !isUndefined(this.prevIndex) && addClass(this._getTransitioner().getItemIn(), this.clsActive); + }, + itemshown: function itemshown() { + var this$1 = this; + var actives = this._getTransitioner(this.index).getActives(); + this.slides.forEach(function(slide) { + return toggleClass(slide, this$1.clsActive, includes(actives, slide)); + }); + (!this.sets || includes(this.sets, toFloat(this.index))) && this.slides.forEach(function(slide) { + return toggleClass(slide, this$1.clsActivated, includes(actives, slide)); + }); + } + }, + methods: { + reorder: function reorder() { + var this$1 = this; + css(this.slides, "order", ""); + if (this.finite) { + return; + } + var index = this.dir > 0 && this.slides[this.prevIndex] ? this.prevIndex : this.index; + this.slides.forEach(function(slide, i) { + return css(slide, "order", this$1.dir > 0 && i < index ? 1 : this$1.dir < 0 && i >= this$1.index ? -1 : ""); + }); + if (!this.center) { + return; + } + var next = this.slides[index]; + var width = this.list.offsetWidth / 2 - next.offsetWidth / 2; + var j = 0; + while (width > 0) { + var slideIndex = this$1.getIndex(--j + index, index); + var slide = this$1.slides[slideIndex]; + css(slide, "order", slideIndex > index ? -2 : -1); + width -= slide.offsetWidth; + } + }, + getValidIndex: function getValidIndex(index, prevIndex) { + var this$1 = this; + if (index === void 0) index = this.index; + if (prevIndex === void 0) prevIndex = this.prevIndex; + index = this.getIndex(index, prevIndex); + if (!this.sets) { + return index; + } + var prev; + do { + if (includes(this$1.sets, index)) { + return index; + } + prev = index; + index = this$1.getIndex(index + this$1.dir, prevIndex); + } while (index !== prev); + return index; + } + } + }); + } + function AnimationsPlugin$2(UIkit) { + var mixin = UIkit.mixin; + var UIkit_util = UIkit.util; + var assign = UIkit_util.assign; + var css = UIkit_util.css; + var Animations = assign({}, mixin.slideshow.defaults.Animations, { + fade: { + show: function show() { + return [ { + opacity: 0, + zIndex: 0 + }, { + zIndex: -1 + } ]; + }, + percent: function percent(current) { + return 1 - css(current, "opacity"); + }, + translate: function translate$$1(percent) { + return [ { + opacity: 1 - percent, + zIndex: 0 + }, { + zIndex: -1 + } ]; + } + }, + scale: { + show: function show() { + return [ { + opacity: 0, + transform: scale3d(1 + .5), + zIndex: 0 + }, { + zIndex: -1 + } ]; + }, + percent: function percent(current) { + return 1 - css(current, "opacity"); + }, + translate: function translate$$1(percent) { + return [ { + opacity: 1 - percent, + transform: scale3d(1 + .5 * percent), + zIndex: 0 + }, { + zIndex: -1 + } ]; + } + }, + pull: { + show: function show(dir) { + return dir < 0 ? [ { + transform: translate(30), + zIndex: -1 + }, { + transform: translate(), + zIndex: 0 + } ] : [ { + transform: translate(-100), + zIndex: 0 + }, { + transform: translate(), + zIndex: -1 + } ]; + }, + percent: function percent(current, next, dir) { + return dir < 0 ? 1 - Animations.translated(next) : Animations.translated(current); + }, + translate: function translate$1(percent, dir) { + return dir < 0 ? [ { + transform: translate(30 * percent), + zIndex: -1 + }, { + transform: translate(-100 * (1 - percent)), + zIndex: 0 + } ] : [ { + transform: translate(-percent * 100), + zIndex: 0 + }, { + transform: translate(30 * (1 - percent)), + zIndex: -1 + } ]; + } + }, + push: { + show: function show(dir) { + return dir < 0 ? [ { + transform: translate(100), + zIndex: 0 + }, { + transform: translate(), + zIndex: -1 + } ] : [ { + transform: translate(-30), + zIndex: -1 + }, { + transform: translate(), + zIndex: 0 + } ]; + }, + percent: function percent(current, next, dir) { + return dir > 0 ? 1 - Animations.translated(next) : Animations.translated(current); + }, + translate: function translate$2(percent, dir) { + return dir < 0 ? [ { + transform: translate(percent * 100), + zIndex: 0 + }, { + transform: translate(-30 * (1 - percent)), + zIndex: -1 + } ] : [ { + transform: translate(-30 * percent), + zIndex: -1 + }, { + transform: translate(100 * (1 - percent)), + zIndex: 0 + } ]; + } + } + }); + return Animations; + } + function plugin$10(UIkit) { + if (plugin$10.installed) { + return; + } + UIkit.use(plugin$4); + var mixin = UIkit.mixin; + var height = UIkit.util.height; + var Animations = AnimationsPlugin$2(UIkit); + UIkit.component("slideshow-parallax", ParallaxPlugin(UIkit, "slideshow")); + UIkit.component("slideshow", { + mixins: [ mixin.class, mixin.slideshow, SliderReactive(UIkit) ], + props: { + ratio: String, + minHeight: Boolean, + maxHeight: Boolean + }, + defaults: { + ratio: "16:9", + minHeight: false, + maxHeight: false, + selList: ".uk-slideshow-items", + attrItem: "uk-slideshow-item", + selNav: ".uk-slideshow-nav", + Animations: Animations + }, + update: { + read: function read() { + var ref = this.ratio.split(":").map(Number); + var width = ref[0]; + var height = ref[1]; + height = height * this.$el.offsetWidth / width; + if (this.minHeight) { + height = Math.max(this.minHeight, height); + } + if (this.maxHeight) { + height = Math.min(this.maxHeight, height); + } + return { + height: height + }; + }, + write: function write(ref) { + var hgt = ref.height; + height(this.list, Math.floor(hgt)); + }, + events: [ "load", "resize" ] + } + }); + } + function plugin$11(UIkit) { + var obj; + if (plugin$11.installed) { + return; + } + var mixin = UIkit.mixin; + var util = UIkit.util; + var addClass = util.addClass; + var after = util.after; + var assign = util.assign; + var append = util.append; + var attr = util.attr; + var before = util.before; + var closest = util.closest; + var css = util.css; + var height = util.height; + var fastdom = util.fastdom; + var getPos = util.getPos; + var includes = util.includes; + var index = util.index; + var isInput = util.isInput; + var noop = util.noop; + var offset = util.offset; + var off = util.off; + var on = util.on; + var pointerDown = util.pointerDown; + var pointerMove = util.pointerMove; + var pointerUp = util.pointerUp; + var position = util.position; + var preventClick = util.preventClick; + var Promise = util.Promise; + var remove = util.remove; + var removeClass = util.removeClass; + var toggleClass = util.toggleClass; + var toNodes = util.toNodes; + var Transition = util.Transition; + var trigger = util.trigger; + var within = util.within; + UIkit.component("sortable", { + mixins: [ mixin.class ], + props: { + group: String, + animation: Number, + threshold: Number, + clsItem: String, + clsPlaceholder: String, + clsDrag: String, + clsDragState: String, + clsBase: String, + clsNoDrag: String, + clsEmpty: String, + clsCustom: String, + handle: String + }, + defaults: { + group: false, + animation: 150, + threshold: 5, + clsItem: "uk-sortable-item", + clsPlaceholder: "uk-sortable-placeholder", + clsDrag: "uk-sortable-drag", + clsDragState: "uk-drag", + clsBase: "uk-sortable", + clsNoDrag: "uk-sortable-nodrag", + clsEmpty: "uk-sortable-empty", + clsCustom: "", + handle: false + }, + init: function init() { + var this$1 = this; + [ "init", "start", "move", "end" ].forEach(function(key) { + var fn = this$1[key]; + this$1[key] = function(e) { + this$1.scrollY = window.pageYOffset; + var ref = getPos(e); + var x = ref.x; + var y = ref.y; + this$1.pos = { + x: x, + y: y + }; + fn(e); + }; + }); + }, + events: (obj = {}, obj[pointerDown] = "init", obj), + update: { + write: function write() { + if (this.clsEmpty) { + toggleClass(this.$el, this.clsEmpty, !this.$el.children.length); + } + if (!this.drag) { + return; + } + offset(this.drag, { + top: this.pos.y + this.origin.top, + left: this.pos.x + this.origin.left + }); + var ref = offset(this.drag); + var top = ref.top; + var bottom = top + this.drag.offsetHeight; + var scroll; + if (top > 0 && top < this.scrollY) { + scroll = this.scrollY - 5; + } else if (bottom < height(document) && bottom > height(window) + this.scrollY) { + scroll = this.scrollY + 5; + } + scroll && setTimeout(function() { + return window.scrollTo(window.scrollX, scroll); + }, 5); + } + }, + methods: { + init: function init(e) { + var target = e.target; + var button = e.button; + var defaultPrevented = e.defaultPrevented; + var ref = toNodes(this.$el.children).filter(function(el) { + return within(target, el); + }); + var placeholder = ref[0]; + if (!placeholder || isInput(e.target) || this.handle && !within(target, this.handle) || button > 0 || within(target, "." + this.clsNoDrag) || defaultPrevented) { + return; + } + e.preventDefault(); + this.touched = [ this ]; + this.placeholder = placeholder; + this.origin = assign({ + target: target, + index: index(placeholder) + }, this.pos); + on(document, pointerMove, this.move); + on(document, pointerUp, this.end); + on(window, "scroll", this.scroll); + if (!this.threshold) { + this.start(e); + } + }, + start: function start(e) { + this.drag = append(UIkit.container, this.placeholder.outerHTML.replace(/^
    • $/i, "div>")); + css(this.drag, assign({ + boxSizing: "border-box", + width: this.placeholder.offsetWidth, + height: this.placeholder.offsetHeight + }, css(this.placeholder, [ "paddingLeft", "paddingRight", "paddingTop", "paddingBottom" ]))); + attr(this.drag, "uk-no-boot", ""); + addClass(this.drag, this.clsDrag, this.clsCustom); + height(this.drag.firstElementChild, height(this.placeholder.firstElementChild)); + var ref = offset(this.placeholder); + var left = ref.left; + var top = ref.top; + assign(this.origin, { + left: left - this.pos.x, + top: top - this.pos.y + }); + addClass(this.placeholder, this.clsPlaceholder); + addClass(this.$el.children, this.clsItem); + addClass(document.documentElement, this.clsDragState); + trigger(this.$el, "start", [ this, this.placeholder, this.drag ]); + this.move(e); + }, + move: function move(e) { + if (!this.drag) { + if (Math.abs(this.pos.x - this.origin.x) > this.threshold || Math.abs(this.pos.y - this.origin.y) > this.threshold) { + this.start(e); + } + return; + } + this.$emit(); + var target = e.type === "mousemove" ? e.target : document.elementFromPoint(this.pos.x - document.body.scrollLeft, this.pos.y - document.body.scrollTop); + var sortable = getSortable(target); + var previous = getSortable(this.placeholder); + var move = sortable !== previous; + if (!sortable || within(target, this.placeholder) || move && (!sortable.group || sortable.group !== previous.group)) { + return; + } + target = sortable.$el === target.parentNode && target || toNodes(sortable.$el.children).filter(function(element) { + return within(target, element); + })[0]; + if (move) { + previous.remove(this.placeholder); + } else if (!target) { + return; + } + sortable.insert(this.placeholder, target); + if (!includes(this.touched, sortable)) { + this.touched.push(sortable); + } + }, + scroll: function scroll() { + var scroll = window.pageYOffset; + if (scroll !== this.scrollY) { + this.pos.y += scroll - this.scrollY; + this.scrollY = scroll; + this.$emit(); + } + }, + end: function end(e) { + off(document, pointerMove, this.move); + off(document, pointerUp, this.end); + off(window, "scroll", this.scroll); + if (!this.drag) { + if (e.type !== "mouseup" && within(e.target, "a[href]")) { + location.href = closest(e.target, "a[href]").href; + } + return; + } + preventClick(); + var sortable = getSortable(this.placeholder); + if (this === sortable) { + if (this.origin.index !== index(this.placeholder)) { + trigger(this.$el, "moved", [ this, this.placeholder ]); + } + } else { + trigger(sortable.$el, "added", [ sortable, this.placeholder ]); + trigger(this.$el, "removed", [ this, this.placeholder ]); + } + trigger(this.$el, "stop", [ this ]); + remove(this.drag); + this.drag = null; + var classes = this.touched.map(function(sortable) { + return sortable.clsPlaceholder + " " + sortable.clsItem; + }).join(" "); + this.touched.forEach(function(sortable) { + return removeClass(sortable.$el.children, classes); + }); + removeClass(document.documentElement, this.clsDragState); + }, + insert: function insert(element, target) { + var this$1 = this; + addClass(this.$el.children, this.clsItem); + var insert = function() { + if (target) { + if (!within(element, this$1.$el) || isPredecessor(element, target)) { + before(target, element); + } else { + after(target, element); + } + } else { + append(this$1.$el, element); + } + }; + if (this.animation) { + this.animate(insert); + } else { + insert(); + } + }, + remove: function remove$1(element) { + if (!within(element, this.$el)) { + return; + } + if (this.animation) { + this.animate(function() { + return remove(element); + }); + } else { + remove(element); + } + }, + animate: function animate(action) { + var this$1 = this; + var props = []; + var children = toNodes(this.$el.children); + var reset = { + position: "", + width: "", + height: "", + pointerEvents: "", + top: "", + left: "", + bottom: "", + right: "" + }; + children.forEach(function(el) { + props.push(assign({ + position: "absolute", + pointerEvents: "none", + width: el.offsetWidth, + height: el.offsetHeight + }, position(el))); + }); + action(); + children.forEach(Transition.cancel); + css(this.$el.children, reset); + UIkit.update(this.$el); + fastdom.flush(); + css(this.$el, "minHeight", height(this.$el)); + var positions = children.map(function(el) { + return position(el); + }); + Promise.all(children.map(function(el, i) { + return Transition.start(css(el, props[i]), positions[i], this$1.animation); + })).then(function() { + css(this$1.$el, "minHeight", ""); + css(children, reset); + UIkit.update(this$1.$el); + fastdom.flush(); + }, noop); + } + } + }); + function getSortable(element) { + return element && (UIkit.getComponent(element, "sortable") || getSortable(element.parentNode)); + } + function isPredecessor(element, target) { + return element.parentNode === target.parentNode && index(element) > index(target); + } + } + function plugin$12(UIkit) { + var obj; + if (plugin$12.installed) { + return; + } + var util = UIkit.util; + var mixin = UIkit.mixin; + var append = util.append; + var attr = util.attr; + var flipPosition = util.flipPosition; + var hasAttr = util.hasAttr; + var includes = util.includes; + var isTouch = util.isTouch; + var isVisible = util.isVisible; + var matches = util.matches; + var on = util.on; + var pointerDown = util.pointerDown; + var pointerEnter = util.pointerEnter; + var pointerLeave = util.pointerLeave; + var remove = util.remove; + var within = util.within; + var actives = []; + UIkit.component("tooltip", { + attrs: true, + args: "title", + mixins: [ mixin.container, mixin.togglable, mixin.position ], + props: { + delay: Number, + title: String + }, + defaults: { + pos: "top", + title: "", + delay: 0, + animation: [ "uk-animation-scale-up" ], + duration: 100, + cls: "uk-active", + clsPos: "uk-tooltip" + }, + beforeConnect: function beforeConnect() { + this._hasTitle = hasAttr(this.$el, "title"); + attr(this.$el, { + title: "", + "aria-expanded": false + }); + }, + disconnected: function disconnected() { + this.hide(); + attr(this.$el, { + title: this._hasTitle ? this.title : null, + "aria-expanded": null + }); + }, + methods: { + show: function show() { + var this$1 = this; + if (includes(actives, this)) { + return; + } + actives.forEach(function(active) { + return active.hide(); + }); + actives.push(this); + this._unbind = on(document, "click", function(e) { + return !within(e.target, this$1.$el) && this$1.hide(); + }); + clearTimeout(this.showTimer); + this.tooltip = append(this.container, '
      ' + this.title + "
      "); + attr(this.$el, "aria-expanded", true); + this.positionAt(this.tooltip, this.$el); + this.origin = this.getAxis() === "y" ? flipPosition(this.dir) + "-" + this.align : this.align + "-" + flipPosition(this.dir); + this.showTimer = setTimeout(function() { + this$1.toggleElement(this$1.tooltip, true); + this$1.hideTimer = setInterval(function() { + if (!isVisible(this$1.$el)) { + this$1.hide(); + } + }, 150); + }, this.delay); + }, + hide: function hide() { + var index = actives.indexOf(this); + if (!~index || matches(this.$el, "input") && this.$el === document.activeElement) { + return; + } + actives.splice(index, 1); + clearTimeout(this.showTimer); + clearInterval(this.hideTimer); + attr(this.$el, "aria-expanded", false); + this.toggleElement(this.tooltip, false); + this.tooltip && remove(this.tooltip); + this.tooltip = false; + this._unbind(); + } + }, + events: (obj = {}, obj["focus " + pointerEnter + " " + pointerDown] = function(e) { + if (e.type !== pointerDown || !isTouch(e)) { + this.show(); + } + }, obj.blur = "hide", obj[pointerLeave] = function(e) { + if (!isTouch(e)) { + this.hide(); + } + }, obj) + }); + } + function plugin$13(UIkit) { + if (plugin$13.installed) { + return; + } + var ref = UIkit.util; + var addClass = ref.addClass; + var ajax = ref.ajax; + var matches = ref.matches; + var noop = ref.noop; + var on = ref.on; + var removeClass = ref.removeClass; + var trigger = ref.trigger; + UIkit.component("upload", { + props: { + allow: String, + clsDragover: String, + concurrent: Number, + maxSize: Number, + method: String, + mime: String, + msgInvalidMime: String, + msgInvalidName: String, + msgInvalidSize: String, + multiple: Boolean, + name: String, + params: Object, + type: String, + url: String + }, + defaults: { + allow: false, + clsDragover: "uk-dragover", + concurrent: 1, + maxSize: 0, + method: "POST", + mime: false, + msgInvalidMime: "Invalid File Type: %s", + msgInvalidName: "Invalid File Name: %s", + msgInvalidSize: "Invalid File Size: %s Bytes Max", + multiple: false, + name: "files[]", + params: {}, + type: "", + url: "", + abort: noop, + beforeAll: noop, + beforeSend: noop, + complete: noop, + completeAll: noop, + error: noop, + fail: noop, + load: noop, + loadEnd: noop, + loadStart: noop, + progress: noop + }, + events: { + change: function change(e) { + if (!matches(e.target, 'input[type="file"]')) { + return; + } + e.preventDefault(); + if (e.target.files) { + this.upload(e.target.files); + } + e.target.value = ""; + }, + drop: function drop(e) { + stop(e); + var transfer = e.dataTransfer; + if (!transfer || !transfer.files) { + return; + } + removeClass(this.$el, this.clsDragover); + this.upload(transfer.files); + }, + dragenter: function dragenter(e) { + stop(e); + }, + dragover: function dragover(e) { + stop(e); + addClass(this.$el, this.clsDragover); + }, + dragleave: function dragleave(e) { + stop(e); + removeClass(this.$el, this.clsDragover); + } + }, + methods: { + upload: function upload(files) { + var this$1 = this; + if (!files.length) { + return; + } + trigger(this.$el, "upload", [ files ]); + for (var i = 0; i < files.length; i++) { + if (this$1.maxSize && this$1.maxSize * 1e3 < files[i].size) { + this$1.fail(this$1.msgInvalidSize.replace("%s", this$1.allow)); + return; + } + if (this$1.allow && !match(this$1.allow, files[i].name)) { + this$1.fail(this$1.msgInvalidName.replace("%s", this$1.allow)); + return; + } + if (this$1.mime && !match(this$1.mime, files[i].type)) { + this$1.fail(this$1.msgInvalidMime.replace("%s", this$1.mime)); + return; + } + } + if (!this.multiple) { + files = [ files[0] ]; + } + this.beforeAll(this, files); + var chunks = chunk(files, this.concurrent); + var upload = function(files) { + var data = new FormData(); + files.forEach(function(file) { + return data.append(this$1.name, file); + }); + for (var key in this$1.params) { + data.append(key, this$1.params[key]); + } + ajax(this$1.url, { + data: data, + method: this$1.method, + responseType: this$1.type, + beforeSend: function(env) { + var xhr = env.xhr; + xhr.upload && on(xhr.upload, "progress", this$1.progress); + [ "loadStart", "load", "loadEnd", "abort" ].forEach(function(type) { + return on(xhr, type.toLowerCase(), this$1[type]); + }); + this$1.beforeSend(env); + } + }).then(function(xhr) { + this$1.complete(xhr); + if (chunks.length) { + upload(chunks.shift()); + } else { + this$1.completeAll(xhr); + } + }, function(e) { + return this$1.error(e.message); + }); + }; + upload(chunks.shift()); + } + } + }); + function match(pattern, path) { + return path.match(new RegExp("^" + pattern.replace(/\//g, "\\/").replace(/\*\*/g, "(\\/[^\\/]+)*").replace(/\*/g, "[^\\/]+").replace(/((?!\\))\?/g, "$1.") + "$", "i")); + } + function chunk(files, size) { + var chunks = []; + for (var i = 0; i < files.length; i += size) { + var chunk = []; + for (var j = 0; j < size; j++) { + chunk.push(files[i + j]); + } + chunks.push(chunk); + } + return chunks; + } + function stop(e) { + e.preventDefault(); + e.stopPropagation(); + } + } + UIkit$2.use(plugin); + UIkit$2.use(plugin$1); + UIkit$2.use(plugin$2); + UIkit$2.use(plugin$6); + UIkit$2.use(plugin$7); + UIkit$2.use(plugin$9); + UIkit$2.use(plugin$10); + UIkit$2.use(plugin$11); + UIkit$2.use(plugin$12); + UIkit$2.use(plugin$13); + { + boot(UIkit$2); + } + return UIkit$2; +}); + +(function(global, factory) { + typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define("uikiticons", factory) : global.UIkitIcons = factory(); +})(this, function() { + "use strict"; + var album = ' '; + var ban = ' '; + var behance = ' '; + var bell = ' '; + var bold = ' '; + var bolt = ' '; + var bookmark = ' '; + var calendar = ' '; + var camera = ' '; + var cart = ' '; + var check = ' '; + var clock = ' '; + var close = ' '; + var code = ' '; + var cog = ' '; + var comment = ' '; + var commenting = ' '; + var comments = ' '; + var copy = ' '; + var database = ' '; + var desktop = ' '; + var download = ' '; + var dribbble = ' '; + var expand = ' '; + var facebook = ' '; + var file = ' '; + var flickr = ' '; + var folder = ' '; + var forward = ' '; + var foursquare = ' '; + var future = ' '; + var github = ' '; + var gitter = ' '; + var google = ' '; + var grid = ' '; + var happy = ' '; + var hashtag = ' '; + var heart = ' '; + var history = ' '; + var home = ' '; + var image = ' '; + var info = ' '; + var instagram = ' '; + var italic = ' '; + var joomla = ' '; + var laptop = ' '; + var lifesaver = ' '; + var link = ' '; + var linkedin = ' '; + var list = ' '; + var location = ' '; + var lock = ' '; + var mail = ' '; + var menu = ' '; + var minus = ' '; + var more = ' '; + var move = ' '; + var nut = ' '; + var pagekit = ' '; + var pencil = ' '; + var phone = ' '; + var pinterest = ' '; + var play = ' '; + var plus = ' '; + var pull = ' '; + var push = ' '; + var question = ' '; + var receiver = ' '; + var refresh = ' '; + var reply = ' '; + var rss = ' '; + var search = ' '; + var server = ' '; + var settings = ' '; + var shrink = ' '; + var social = ' '; + var soundcloud = ' '; + var star = ' '; + var strikethrough = ' '; + var table = ' '; + var tablet = ' '; + var tag = ' '; + var thumbnails = ' '; + var trash = ' '; + var tripadvisor = ' '; + var tumblr = ' '; + var tv = ' '; + var twitter = ' '; + var uikit = ' '; + var unlock = ' '; + var upload = ' '; + var user = ' '; + var users = ' '; + var vimeo = ' '; + var warning = ' '; + var whatsapp = ' '; + var wordpress = ' '; + var world = ' '; + var xing = ' '; + var yelp = ' '; + var youtube = ' '; + var Icons = { + album: album, + ban: ban, + behance: behance, + bell: bell, + bold: bold, + bolt: bolt, + bookmark: bookmark, + calendar: calendar, + camera: camera, + cart: cart, + check: check, + clock: clock, + close: close, + code: code, + cog: cog, + comment: comment, + commenting: commenting, + comments: comments, + copy: copy, + database: database, + desktop: desktop, + download: download, + dribbble: dribbble, + expand: expand, + facebook: facebook, + file: file, + flickr: flickr, + folder: folder, + forward: forward, + foursquare: foursquare, + future: future, + github: github, + gitter: gitter, + google: google, + grid: grid, + happy: happy, + hashtag: hashtag, + heart: heart, + history: history, + home: home, + image: image, + info: info, + instagram: instagram, + italic: italic, + joomla: joomla, + laptop: laptop, + lifesaver: lifesaver, + link: link, + linkedin: linkedin, + list: list, + location: location, + lock: lock, + mail: mail, + menu: menu, + minus: minus, + more: more, + move: move, + nut: nut, + pagekit: pagekit, + pencil: pencil, + phone: phone, + pinterest: pinterest, + play: play, + plus: plus, + pull: pull, + push: push, + question: question, + receiver: receiver, + refresh: refresh, + reply: reply, + rss: rss, + search: search, + server: server, + settings: settings, + shrink: shrink, + social: social, + soundcloud: soundcloud, + star: star, + strikethrough: strikethrough, + table: table, + tablet: tablet, + tag: tag, + thumbnails: thumbnails, + trash: trash, + tripadvisor: tripadvisor, + tumblr: tumblr, + tv: tv, + twitter: twitter, + uikit: uikit, + unlock: unlock, + upload: upload, + user: user, + users: users, + vimeo: vimeo, + warning: warning, + whatsapp: whatsapp, + wordpress: wordpress, + world: world, + xing: xing, + yelp: yelp, + youtube: youtube, + "500px": ' ', + "arrow-down": ' ', + "arrow-left": ' ', + "arrow-right": ' ', + "arrow-up": ' ', + "chevron-down": ' ', + "chevron-left": ' ', + "chevron-right": ' ', + "chevron-up": ' ', + "cloud-download": ' ', + "cloud-upload": ' ', + "credit-card": ' ', + "file-edit": ' ', + "git-branch": ' ', + "git-fork": ' ', + "github-alt": ' ', + "google-plus": ' ', + "minus-circle": ' ', + "more-vertical": ' ', + "paint-bucket": ' ', + "phone-landscape": ' ', + "play-circle": ' ', + "plus-circle": ' ', + "quote-right": ' ', + "sign-in": ' ', + "sign-out": ' ', + "tablet-landscape": ' ', + "triangle-down": ' ', + "triangle-left": ' ', + "triangle-right": ' ', + "triangle-up": ' ', + "video-camera": ' ' + }; + function plugin(UIkit) { + if (plugin.installed) { + return; + } + UIkit.icon.add(Icons); + } + if (typeof window !== "undefined" && window.UIkit) { + window.UIkit.use(plugin); + } + return plugin; +}); + +(function() { + "use strict"; + var _$JSONLoader_2 = { + load: load + }; + function load(location, callback) { + var xhr = getXHR(); + xhr.open("GET", location, true); + xhr.onreadystatechange = createStateChangeListener(xhr, callback); + xhr.send(); + } + function createStateChangeListener(xhr, callback) { + return function() { + if (xhr.readyState === 4 && xhr.status === 200) { + try { + callback(null, JSON.parse(xhr.responseText)); + } catch (err) { + callback(err, null); + } + } + }; + } + function getXHR() { + return window.XMLHttpRequest ? new window.XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); + } + "use strict"; + var _$OptionsValidator_3 = function OptionsValidator(params) { + if (!validateParams(params)) { + throw new Error("-- OptionsValidator: required options missing"); + } + if (!(this instanceof OptionsValidator)) { + return new OptionsValidator(params); + } + var requiredOptions = params.required; + this.getRequiredOptions = function() { + return requiredOptions; + }; + this.validate = function(parameters) { + var errors = []; + requiredOptions.forEach(function(requiredOptionName) { + if (typeof parameters[requiredOptionName] === "undefined") { + errors.push(requiredOptionName); + } + }); + return errors; + }; + function validateParams(params) { + if (!params) { + return false; + } + return typeof params.required !== "undefined" && params.required instanceof Array; + } + }; + "use strict"; + function fuzzysearch(needle, haystack) { + var tlen = haystack.length; + var qlen = needle.length; + if (qlen > tlen) { + return false; + } + if (qlen === tlen) { + return needle === haystack; + } + outer: for (var i = 0, j = 0; i < qlen; i++) { + var nch = needle.charCodeAt(i); + while (j < tlen) { + if (haystack.charCodeAt(j++) === nch) { + continue outer; + } + } + return false; + } + return true; + } + var _$fuzzysearch_1 = fuzzysearch; + "use strict"; + var _$FuzzySearchStrategy_5 = new FuzzySearchStrategy(); + function FuzzySearchStrategy() { + this.matches = function(string, crit) { + return _$fuzzysearch_1(crit.toLowerCase(), string.toLowerCase()); + }; + } + "use strict"; + var _$LiteralSearchStrategy_6 = new LiteralSearchStrategy(); + function LiteralSearchStrategy() { + this.matches = function(str, crit) { + if (typeof str !== "string") { + return false; + } + str = str.trim(); + return str.toLowerCase().indexOf(crit.toLowerCase()) >= 0; + }; + } + "use strict"; + var _$Repository_4 = { + put: put, + clear: clear, + search: search, + setOptions: setOptions + }; + function NoSort() { + return 0; + } + var data = []; + var opt = {}; + opt.fuzzy = false; + opt.limit = 10; + opt.searchStrategy = opt.fuzzy ? _$FuzzySearchStrategy_5 : _$LiteralSearchStrategy_6; + opt.sort = NoSort; + function put(data) { + if (isObject(data)) { + return addObject(data); + } + if (isArray(data)) { + return addArray(data); + } + return undefined; + } + function clear() { + data.length = 0; + return data; + } + function isObject(obj) { + return Boolean(obj) && Object.prototype.toString.call(obj) === "[object Object]"; + } + function isArray(obj) { + return Boolean(obj) && Object.prototype.toString.call(obj) === "[object Array]"; + } + function addObject(_data) { + data.push(_data); + return data; + } + function addArray(_data) { + var added = []; + clear(); + for (var i = 0, len = _data.length; i < len; i++) { + if (isObject(_data[i])) { + added.push(addObject(_data[i])); + } + } + return added; + } + function search(crit) { + if (!crit) { + return []; + } + return findMatches(data, crit, opt.searchStrategy, opt).sort(opt.sort); + } + function setOptions(_opt) { + opt = _opt || {}; + opt.fuzzy = _opt.fuzzy || false; + opt.limit = _opt.limit || 10; + opt.searchStrategy = _opt.fuzzy ? _$FuzzySearchStrategy_5 : _$LiteralSearchStrategy_6; + opt.sort = _opt.sort || NoSort; + } + function findMatches(data, crit, strategy, opt) { + var matches = []; + for (var i = 0; i < data.length && matches.length < opt.limit; i++) { + var match = findMatchesInObject(data[i], crit, strategy, opt); + if (match) { + matches.push(match); + } + } + return matches; + } + function findMatchesInObject(obj, crit, strategy, opt) { + for (var key in obj) { + if (!isExcluded(obj[key], opt.exclude) && strategy.matches(obj[key], crit)) { + return obj; + } + } + } + function isExcluded(term, excludedTerms) { + var excluded = false; + excludedTerms = excludedTerms || []; + for (var i = 0, len = excludedTerms.length; i < len; i++) { + var excludedTerm = excludedTerms[i]; + if (!excluded && new RegExp(term).test(excludedTerm)) { + excluded = true; + } + } + return excluded; + } + "use strict"; + var _$Templater_7 = { + compile: compile, + setOptions: __setOptions_7 + }; + var options = {}; + options.pattern = /\{(.*?)\}/g; + options.template = ""; + options.middleware = function() {}; + function __setOptions_7(_options) { + options.pattern = _options.pattern || options.pattern; + options.template = _options.template || options.template; + if (typeof _options.middleware === "function") { + options.middleware = _options.middleware; + } + } + function compile(data) { + return options.template.replace(options.pattern, function(match, prop) { + var value = options.middleware(prop, data[prop], options.template); + if (typeof value !== "undefined") { + return value; + } + return data[prop] || match; + }); + } + "use strict"; + var _$utils_9 = { + merge: merge, + isJSON: isJSON + }; + function merge(defaultParams, mergeParams) { + var mergedOptions = {}; + for (var option in defaultParams) { + if (Object.prototype.hasOwnProperty.call(defaultParams, option)) { + mergedOptions[option] = defaultParams[option]; + if (typeof mergeParams[option] !== "undefined") { + mergedOptions[option] = mergeParams[option]; + } + } + } + return mergedOptions; + } + function isJSON(json) { + try { + if (json instanceof Object && JSON.parse(JSON.stringify(json))) { + return true; + } + return false; + } catch (err) { + return false; + } + } + var _$src_8 = {}; + (function(window) { + "use strict"; + var options = { + searchInput: null, + resultsContainer: null, + json: [], + searchResultTemplate: '
    • {title}
    • ', + templateMiddleware: function() {}, + sortMiddleware: function() { + return 0; + }, + noResultsText: "No results found", + limit: 10, + fuzzy: false, + exclude: [] + }; + var requiredOptions = [ "searchInput", "resultsContainer", "json" ]; + var optionsValidator = _$OptionsValidator_3({ + required: requiredOptions + }); + window.SimpleJekyllSearch = function(_options) { + var errors = optionsValidator.validate(_options); + if (errors.length > 0) { + throwError("You must specify the following required options: " + requiredOptions); + } + options = _$utils_9.merge(options, _options); + _$Templater_7.setOptions({ + template: options.searchResultTemplate, + middleware: options.templateMiddleware + }); + _$Repository_4.setOptions({ + fuzzy: options.fuzzy, + limit: options.limit, + sort: options.sortMiddleware + }); + if (_$utils_9.isJSON(options.json)) { + initWithJSON(options.json); + } else { + initWithURL(options.json); + } + return { + search: search + }; + }; + window.SimpleJekyllSearch.init = window.SimpleJekyllSearch; + if (typeof window.SimpleJekyllSearchInit === "function") { + window.SimpleJekyllSearchInit.call(this, window.SimpleJekyllSearch); + } + function initWithJSON(json) { + _$Repository_4.put(json); + registerInput(); + } + function initWithURL(url) { + _$JSONLoader_2.load(url, function(err, json) { + if (err) { + throwError("failed to get JSON (" + url + ")"); + } + initWithJSON(json); + }); + } + function emptyResultsContainer() { + options.resultsContainer.innerHTML = ""; + } + function appendToResultsContainer(text) { + options.resultsContainer.innerHTML += text; + } + function registerInput() { + options.searchInput.addEventListener("keyup", function(e) { + if (isWhitelistedKey(e.which)) { + emptyResultsContainer(); + search(e.target.value); + } + }); + } + function search(query) { + if (isValidQuery(query)) { + emptyResultsContainer(); + render(_$Repository_4.search(query)); + } + } + function render(results) { + var len = results.length; + if (len === 0) { + return appendToResultsContainer(options.noResultsText); + } + for (var i = 0; i < len; i++) { + appendToResultsContainer(_$Templater_7.compile(results[i])); + } + } + function isValidQuery(query) { + return query && query.length > 0; + } + function isWhitelistedKey(key) { + return [ 13, 16, 20, 37, 38, 39, 40, 91 ].indexOf(key) === -1; + } + function throwError(message) { + throw new Error("SimpleJekyllSearch --- " + message); + } + })(window); +})(); \ No newline at end of file diff --git a/_site/assets/posts/7C04AAA0EE9E3886.png b/_site/assets/posts/7C04AAA0EE9E3886.png new file mode 100644 index 00000000..8af764e0 Binary files /dev/null and b/_site/assets/posts/7C04AAA0EE9E3886.png differ diff --git a/_site/assets/posts/SVG/logo.svg b/_site/assets/posts/SVG/logo.svg new file mode 100644 index 00000000..886b00f8 --- /dev/null +++ b/_site/assets/posts/SVG/logo.svg @@ -0,0 +1 @@ +logo \ No newline at end of file diff --git a/_site/assets/posts/books.svg b/_site/assets/posts/books.svg new file mode 100644 index 00000000..6e5638ac --- /dev/null +++ b/_site/assets/posts/books.svg @@ -0,0 +1,51 @@ + + + + Books + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/_site/assets/posts/box.svg b/_site/assets/posts/box.svg new file mode 100644 index 00000000..625e607a --- /dev/null +++ b/_site/assets/posts/box.svg @@ -0,0 +1,100 @@ + + + + Box + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/_site/assets/posts/city.svg b/_site/assets/posts/city.svg new file mode 100644 index 00000000..337229f8 --- /dev/null +++ b/_site/assets/posts/city.svg @@ -0,0 +1,188 @@ + + + + Style 9 + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/_site/assets/posts/imac.svg b/_site/assets/posts/imac.svg new file mode 100644 index 00000000..88139857 --- /dev/null +++ b/_site/assets/posts/imac.svg @@ -0,0 +1,47 @@ + + + + iMac + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/_site/assets/posts/image1.png b/_site/assets/posts/image1.png new file mode 100644 index 00000000..a7125c31 Binary files /dev/null and b/_site/assets/posts/image1.png differ diff --git a/_site/assets/posts/logo.png b/_site/assets/posts/logo.png new file mode 100644 index 00000000..4b1793c8 Binary files /dev/null and b/_site/assets/posts/logo.png differ diff --git a/_site/assets/posts/logo.svg b/_site/assets/posts/logo.svg new file mode 100644 index 00000000..4cf1acad --- /dev/null +++ b/_site/assets/posts/logo.svg @@ -0,0 +1,8 @@ + + + +logo + + + diff --git a/_site/assets/posts/old.logo.svg b/_site/assets/posts/old.logo.svg new file mode 100755 index 00000000..c12f8625 --- /dev/null +++ b/_site/assets/posts/old.logo.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/_site/assets/posts/safe.svg b/_site/assets/posts/safe.svg new file mode 100644 index 00000000..4ece3600 --- /dev/null +++ b/_site/assets/posts/safe.svg @@ -0,0 +1,41 @@ + + + + Safe + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/_site/assets/posts/sky.svg b/_site/assets/posts/sky.svg new file mode 100644 index 00000000..3913866c --- /dev/null +++ b/_site/assets/posts/sky.svg @@ -0,0 +1,113 @@ + + + + Style 1 + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/_site/assets/posts/slideshow-1/image1.png b/_site/assets/posts/slideshow-1/image1.png new file mode 100644 index 00000000..a7125c31 Binary files /dev/null and b/_site/assets/posts/slideshow-1/image1.png differ diff --git a/_site/assets/posts/teacup.svg b/_site/assets/posts/teacup.svg new file mode 100644 index 00000000..729cf60e --- /dev/null +++ b/_site/assets/posts/teacup.svg @@ -0,0 +1,26 @@ + + + + Teacup + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/_site/assets/posts/touch-icon.png b/_site/assets/posts/touch-icon.png new file mode 100644 index 00000000..243615bb Binary files /dev/null and b/_site/assets/posts/touch-icon.png differ diff --git a/_site/assets/posts/touch-icon.svg b/_site/assets/posts/touch-icon.svg new file mode 100644 index 00000000..cc1205e3 --- /dev/null +++ b/_site/assets/posts/touch-icon.svg @@ -0,0 +1 @@ +Asset 1 \ No newline at end of file diff --git a/_site/changelog/index.html b/_site/changelog/index.html new file mode 100644 index 00000000..f635e7c4 --- /dev/null +++ b/_site/changelog/index.html @@ -0,0 +1,350 @@ + + + + + + + + +Changelog | Blockstack + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      + +
      +
      + + + + +
      +
      + +
      + +

      Changelog

      + +
      +

      Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.

      + +
      + +
      + +
      +
      +
      Oct 21, 2017
      +
      +
      +

      Version 1.0.0 STABLE

      +
        + +
      • Added Slideshow component
      • + +
      • Added style support for radio and minusbox in Firefox
      • + +
      • Removed class from Section component
      • + +
      • Allow fullscreen mode for videos in Lightbox
      • + +
      • Fixed responsive images in modal for IE11
      • + +
      • Fix Grid and Margin component for cells with no height
      • + +
      • Larger horizontal padding for form input and textarea
      • + +
      +
      +
      + +
      +
      +
      Sep 01, 2017
      +
      +
      +

      Version 1.0.0 BETA 1

      +
        + +
      • Allow fullscreen mode for YouTube videos in Lightbox
      • + +
      • Fix icons not displaying if connected in rapid succession
      • + +
      • Fix scrollbar jumping in Switcher
      • + +
      +
      +
      + +
      +
      +
      Aug 15, 2017
      +
      +
      +

      Version 0.6.0

      +
        + +
      • Added style support for radio and checkbox in Firefox
      • + +
      • Removed class from Section component
      • + +
      • Add workaround to mitigate the duplicating icons issue
      • + +
      • Fixed responsive images in modal for IE11
      • + +
      +
      +
      + +
      +
      +
      Oct 21, 2017
      +
      +
      +

      Version 0.5.0

      +
        + +
      • Media options now support any valid media query syntax
      • + +
      • Added style support for radio and checkbox in Firefox
      • + +
      • Fix whitespace trimming in dist
      • + +
      +
      +
      + +
      + +
      + +
      +
      + + +
      +
      + + + + + + + +
      +
      + + + +
      +
      + +
      + +
      +
      +
      + +
      + +
      + + +
      + +
      + + + + +
      + +
      + + + + + +
      + +
      + + + + + + +
      +
      + + +
      +
      + + + + + + + + + + diff --git a/_site/collections.json b/_site/collections.json new file mode 100644 index 00000000..fa0e2e5d --- /dev/null +++ b/_site/collections.json @@ -0,0 +1,17 @@ +{ + "version": "THEVERSION", + "collections": [ + { + "name": "core", + "repo": "https://github.com/blockstack/blockstack-core" + }, + { + "name": "android", + "repo": "https://github.com/moxiegirl/blockstack-android" + }, + { + "name": "browser", + "repo": "https://github.com/blockstack/blockstack-browser" + } + ] +} diff --git a/_site/contact/index.html b/_site/contact/index.html new file mode 100644 index 00000000..23a7c7a1 --- /dev/null +++ b/_site/contact/index.html @@ -0,0 +1,344 @@ + + + + + + + + +Got Any Questions | Blockstack + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      + +
      +
      + + + + +
      +
      + +
      + +

      Got Any Questions

      + +
      +
      Morbi varius in accumsan blandit, elit ligula velit, luctus mattis ante nulla nulla.
      + +

      Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.

      + +
      + + + + + +
      + +
      + + +

      Contact Form

      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + + + + + +
      +
      + + +
      +
      + + +
      +
      + + + + + + + +
      +
      + + + +
      +
      + +
      + +
      +
      +
      + +
      + +
      + + +
      + +
      + + + + +
      + +
      + + + + + +
      + +
      + + + + + + +
      +
      + + +
      +
      + + + + + + + + + + diff --git a/_site/core/README.md b/_site/core/README.md new file mode 100644 index 00000000..8f6f0c78 --- /dev/null +++ b/_site/core/README.md @@ -0,0 +1,36 @@ +# Documentation + +All Blockstack software documentation is either in this directory, or linked +from this file. + +## FAQs + +* [General FAQ](https://blockstack.org/faq) +* [Technical FAQ](faq_technical.md) + +## System Design and Implementation + +* [Blockstack Naming Service](blockstack_naming_service.md) (start here) +* [Atlas Peer Network](atlas_network.md) +* [Gaia Storage System](https://github.com/blockstack/gaia) +* [Transaction Formats](wire-format.md) +* [Glossary](glossary.md) + +## Command-line Documentation + +* [CLI walkthrough](basic_usage.md) +* [CLI reference](cli.md) + +## Developer Documentation + +* [blockstack.js](https://github.com/blockstack/blockstack.js) +* [Blockstack Browser](https://github.com/blockstack/blockstack-browser) +* [Blockstack Core API](https://core.blockstack.org) +* [Integration Test Framework](../integration_tests/README.md) + +## Advanced Topics + +* [How to Create a Namespace](namespace_creation.md) +* [How to link your OpenBazaar Store to your Blockstack ID](openbazaar.md) +* [How to build a Profile Search Index](search.md) +* [How to Run a Blockstack Subdomain Registrar](subdomains.md) diff --git a/_site/core/advanced_usage.md b/_site/core/advanced_usage.md new file mode 100644 index 00000000..2f9db4c2 --- /dev/null +++ b/_site/core/advanced_usage.md @@ -0,0 +1,4 @@ +# Advanced Usage + +This document is deprecated, and contains references to commands that are no +longer valid. It has been moved to the [attic](attic/advanced_usage.md). diff --git a/_site/core/aglio_templates/core.jade b/_site/core/aglio_templates/core.jade new file mode 100644 index 00000000..de87cfe9 --- /dev/null +++ b/_site/core/aglio_templates/core.jade @@ -0,0 +1,36 @@ +doctype + +include mixins.jade + +html + head + meta(charset="utf-8") + title= self.api.name || 'API Documentation' + link(rel="stylesheet", href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css") + style!= self.css + body.preload + #nav-background + div.container-fluid.triple + .row + block nav + +Nav(false) + + .content + #right-panel-background + + block content + +ContentTriple(false) + + .middle + p.text-muted(style="text-align: center;") + + script: include scripts.js + + if self.livePreview + script(src="/socket.io/socket.io.js") + script. + var socket = io(); + socket.on('refresh', refresh); + socket.on('reconnect', function () { + socket.emit('request-refresh'); + }); diff --git a/_site/core/aglio_templates/mixins.jade b/_site/core/aglio_templates/mixins.jade new file mode 100644 index 00000000..ddc54690 --- /dev/null +++ b/_site/core/aglio_templates/mixins.jade @@ -0,0 +1,357 @@ +mixin TryMe(action) + //- Give a "try-me" link for the public api endpoint + - var myUri = action.uriTemplate + - action.parameters.forEach( function (x) { myUri = myUri.replace( "{" + x.name + "}", x.example) } ) + .title + strong + h4 + div + div + span.method(class="badge get",style="float:left") + a.method(href=myUri, style="color:rgb(51, 122, 183);font-size:12pt") + = "Try It!" + |   + p + div + |   + +mixin Badge(method) + //- Draw a badge for a given HTTP method + case method + when 'GET' + span.badge.get: i.fa.fa-arrow-down + when 'HEAD' + span.badge.head: i.fa.fa-info-circle + when 'OPTIONS' + span.badge.options: i.fa.fa-dot-circle-o + when 'POST' + span.badge.post: i.fa.fa-plus + when 'PUT' + span.badge.put: i.fa.fa-pencil + when 'PATCH' + span.badge.patch: i.fa.fa-pencil + when 'DELETE' + span.badge.delete: i.fa.fa-times + default + span.badge: i.fa.fa-dot-circle-o + +mixin Nav(onlyPublic) + //- Draw a navigation bar, which includes links to individual + //- resources and actions. + nav + if self.api.navItems && self.api.navItems.length + .resource-group + .heading + .chevron + i.open.fa.fa-angle-down + a(href='#top') Overview + .collapse-content + ul: each item in self.api.navItems + li + a(href=item[1])!= item[0] + - if (onlyPublic){ + - myGroups = self.api.resourceGroups.filter( filter_public_resourcegroups ) + - }else{ + - myGroups = self.api.resourceGroups.filter( filter_core_resourcegroups ) + - } + each resourceGroup in myGroups || [] + .resource-group + .heading + .chevron + i.open.fa.fa-angle-down + a(href=resourceGroup.elementLink)!= resourceGroup.name || 'Resource Group' + .collapse-content + ul + each item in resourceGroup.navItems || [] + li + a(href=item[1])!= item[0] + - if (onlyPublic){ + - myResources = resourceGroup.resources.filter( filter_public_resources ) + - }else{ + - myResources = resourceGroup.resources.filter( filter_core_resources ) + - } + each resource in myResources || [] + li + - if (onlyPublic){ + - myActions = resource.actions.filter( filter_public_actions ) + - }else{ + - myActions = resource.actions.filter( filter_core_actions ) + - } + if !self.condenseNav || (myActions.length != 1) + a(href=resource.elementLink)!= resource.name || 'Resource' + ul: each action in myActions || [] + li: a(href=resource.elementLink) + +Badge(action.method) + != action.name || action.method + ' ' + (action.attributes && action.attributes.uriTemplate || resource.uriTemplate) + else + - var action = myActions[0] + a(href=resource.elementLink) + +Badge(action.method) + != action.name || resource.name || action.method + ' ' + (action.attributes && action.attributes.uriTemplate || resource.uriTemplate) + //- Link to the API hostname, e.g. api.yourcompany.com + each meta in self.api.metadata || {} + if meta.name == 'HOST' + p(style="text-align: center; word-wrap: break-word;") + a(href=meta.value)= meta.value + +mixin Parameters(params) + //- Draw a definition list of parameter names, types, defaults, + //- examples and descriptions. + .title + strong URI Parameters + .collapse-button.show + span.close Hide + span.open Show + .collapse-content + dl.inner: each param in params || [] + dt= self.urldec(param.name) + dd + code= param.type || 'string' + |   + if param.required + span.required (required) + else + span (optional) + |   + if param.default + span.text-info.default + strong Default:  + span= param.default + |   + if param.example + span.text-muted.example + strong Example:  + span= param.example + != self.markdown(param.description) + if param.values.length + p.choices + strong Choices:  + each value in param.values + code= self.urldec(value.value) + = ' ' + +mixin RequestResponse(title, request, collapse) + .title + strong + = title + if request.name + |    + code= request.name + if collapse && request.hasContent + .collapse-button + span.close Hide + span.open Show + +RequestResponseBody(request, collapse) + +mixin RequestResponseBody(request, collapse, showBlank) + if request.hasContent || showBlank + div(class=collapse ? 'collapse-content' : ''): .inner + if request.description + .description!= self.markdown(request.description) + + if Object.keys(request.headers).length + h5 Headers + pre: code + each item, index in request.headers + != self.highlight(item.name + ': ' + item.value, 'http') + if index < request.headers.length - 1 + br + div(style="height: 1px;") + if request.body + h5 Body + pre: code + != self.highlight(request.body, null, ['json', 'yaml', 'xml', 'javascript']) + div(style="height: 1px;") + if request.schema + h5 Schema + pre: code + != self.highlight(request.schema, null, ['json', 'yaml', 'xml']) + div(style="height: 1px;") + if !request.hasContent + .description.text-muted This response has no content. + div(style="height: 1px;") + +mixin Examples(resourceGroup, resource, action) + each example in action.examples + each request in example.requests + +RequestResponse('Request', request, true) + each response in example.responses + +RequestResponse('Response', response, true) + +mixin Content() + //- Page header and API description + header + h1#top!= self.api.name || 'API Documentation' + + if self.api.descriptionHtml + != self.api.descriptionHtml + + //- Loop through and display information about all the resource + //- groups, resources, and actions. + each resourceGroup in self.api.resourceGroups || [] + section.resource-group(id=resourceGroup.elementId) + h2.group-heading + != resourceGroup.name || 'Resource Group' + = " " + a.permalink(href=resourceGroup.elementLink) ¶ + if resourceGroup.descriptionHtml + != resourceGroup.descriptionHtml + + each resource in resourceGroup.resources || [] + .resource(id=resource.elementId) + h3.resource-heading + != resource.name || ((resource.actions[0] != null) && resource.actions[0].name) || 'Resource' + = " " + a.permalink(href=resource.elementLink)  ¶ + if resource.description + != self.markdown(resource.description) + + each action in resource.actions || [] + .action(class=action.methodLower, id=action.elementId) + h4.action-heading + .name!= action.name + a.method(class=action.methodLower, href=action.elementLink) + = action.method + code.uri= self.urldec(action.uriTemplate) + if action.description + != self.markdown(action.description) + + h4 Example URI + .definition + span.method(class=action.methodLower)= action.method + |   + span.uri + span.hostname= self.api.host + != action.colorizedUriTemplate + + //- A list of sub-sections for parameters, requests + //- and responses. + if action.parameters.length + +Parameters(action.parameters) + if action.examples + +Examples(resourceGroup, resource, action) + +- function filter_public_actions(x){ +- return (x.description.includes('+ Public Endpoint') || x.description.includes('+ Public Only Endpoint')) +- } +- function filter_public_resources(x){ +- return (x.actions.filter( filter_public_actions ).length > 0) +- } +- function filter_public_resourcegroups(x){ +- return (x.resources.filter( filter_public_resources ).length > 0) +- } +- function filter_core_actions(x){ +- return !(x.description.includes('+ Public Only Endpoint')) +- } +- function filter_core_resources(x){ +- return (x.actions.filter( filter_core_actions ).length > 0) +- } +- function filter_core_resourcegroups(x){ +- return (x.resources.filter( filter_core_resources ).length > 0) +- } + +mixin ContentTriple(onlyPublic, descriptionHtml) + + .right + h5 API Endpoint + a(href=self.api.host)= self.api.host + .middle + if descriptionHtml + != descriptionHtml + + //- Loop through and display information about all the resource + //- groups, resources, and actions. + - if (onlyPublic){ + - myGroups = self.api.resourceGroups.filter( filter_public_resourcegroups ) + - }else{ + - myGroups = self.api.resourceGroups.filter( filter_core_resourcegroups ) + - } + each resourceGroup in myGroups || [] + .middle + section.resource-group(id=resourceGroup.elementId) + h2.group-heading + != resourceGroup.name || 'Resource Group' + = " " + a.permalink(href=resourceGroup.elementLink) ¶ + if resourceGroup.descriptionHtml + != resourceGroup.descriptionHtml + + - if (onlyPublic){ + - myResources = resourceGroup.resources.filter( filter_public_resources ) + - }else{ + - myResources = resourceGroup.resources.filter( filter_core_resources ) + - } + each resource in myResources || [] + if resource.public != null + .middle + .resource(id=resource.elementId) + a.permalink(href=resource.elementLink) + h3.resource-heading + != resource.name || ((resource.actions[0] != null) && resource.actions[0].name) || 'Resource' + = " " + ¶ + if resource.description + != self.markdown(resource.description) + + - if (onlyPublic){ + - myActions = resource.actions.filter( filter_public_actions ) + - }else{ + - myActions = resource.actions.filter( filter_core_actions ) + - } + each action in myActions || [] + if action.examples + .right + .definition + span.method(class=action.methodLower)= action.method + |   + span.uri + span.hostname= self.api.host + != action.colorizedUriTemplate + .tabs + if action.hasRequest + .example-names + span Requests + - var requestCount = 0 + each example in action.examples + each request in example.requests + - requestCount++ + span.tab-button= request.name || 'example ' + requestCount + each example in action.examples + each request in example.requests + .tab + +RequestResponseBody(request, false, true) + .tabs + .example-names + span Responses + each response in example.responses + span.tab-button= response.name + each response in example.responses + .tab + +RequestResponseBody(response, false, true) + else + each example in action.examples + .tabs + .example-names + span Responses + each response in example.responses + span.tab-button= response.name + each response in example.responses + .tab + +RequestResponseBody(response, false, true) + .middle + .action(class=action.methodLower, id=action.elementId) + h4.action-heading + .name!= action.name + a.method(class=action.methodLower, href=action.elementLink) + = action.method + code.uri= self.urldec(action.uriTemplate) + if action.description + != self.markdown(action.description) + + //- A list of sub-sections for parameters, requests + //- and responses. + if action.parameters.length + +Parameters(action.parameters) + if onlyPublic + +TryMe(action) + hr.split diff --git a/_site/core/aglio_templates/public.jade b/_site/core/aglio_templates/public.jade new file mode 100644 index 00000000..b5ae6b15 --- /dev/null +++ b/_site/core/aglio_templates/public.jade @@ -0,0 +1,53 @@ +doctype + + +include mixins.jade + +html + head + meta(charset="utf-8") + title= 'Blockstack Core' + link(rel="stylesheet", href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css") + style!= self.css + body.preload + #nav-background + div.container-fluid.triple + .row + block nav + +Nav(true) + + .content + #right-panel-background + .middle + header + h1#top!= 'Getting Started' + p!= 'Welcome to this deployment of Blockstack Core v{{server_info.server_version}}. You can read the documentation and make RESTful calls to this node.' + p + table + tr + td!= 'Consensus hash' + td!= '{{server_info.consensus}}' + tr + + td!= 'Last block seen' + td!= '{{server_info.last_block_seen}}' + tr + td!= 'Last block processed' + td!= '{{server_info.last_block_processed}}' + p!= 'Blockstack Core is open-source software released under a GPLv3 license. The code for this API is available on Github and you can deploy your own nodes by following these instructions.' + block content + +ContentTriple(true) + + .middle + p.text-muted(style="text-align: center;") + + script: include scripts.js + + if self.livePreview + script(src="/socket.io/socket.io.js") + script. + var socket = io(); + socket.on('refresh', refresh); + socket.on('reconnect', function () { + socket.emit('request-refresh'); + }); diff --git a/_site/core/aglio_templates/scripts.js b/_site/core/aglio_templates/scripts.js new file mode 100644 index 00000000..d105df6c --- /dev/null +++ b/_site/core/aglio_templates/scripts.js @@ -0,0 +1,223 @@ +/* eslint-env browser */ +/* eslint quotes: [2, "single"] */ +'use strict'; + +/* + Determine if a string ends with another string. +*/ +function endsWith(str, suffix) { + return str.indexOf(suffix, str.length - suffix.length) !== -1; +} + +/* + Get a list of direct child elements by class name. +*/ +function childrenByClass(element, name) { + var filtered = []; + + for (var i = 0; i < element.children.length; i++) { + var child = element.children[i]; + var classNames = child.className.split(' '); + if (classNames.indexOf(name) !== -1) { + filtered.push(child); + } + } + + return filtered; +} + +/* + Get an array [width, height] of the window. +*/ +function getWindowDimensions() { + var w = window, + d = document, + e = d.documentElement, + g = d.body, + x = w.innerWidth || e.clientWidth || g.clientWidth, + y = w.innerHeight || e.clientHeight || g.clientHeight; + + return [x, y]; +} + +/* + Collapse or show a request/response example. +*/ +function toggleCollapseButton(event) { + var button = event.target.parentNode; + var content = button.parentNode.nextSibling; + var inner = content.children[0]; + + if (button.className.indexOf('collapse-button') === -1) { + // Clicked without hitting the right element? + return; + } + + if (content.style.maxHeight && content.style.maxHeight !== '0px') { + // Currently showing, so let's hide it + button.className = 'collapse-button'; + content.style.maxHeight = '0px'; + } else { + // Currently hidden, so let's show it + button.className = 'collapse-button show'; + content.style.maxHeight = inner.offsetHeight + 12 + 'px'; + } +} + +function toggleTabButton(event) { + var i, index; + var button = event.target; + + // Get index of the current button. + var buttons = childrenByClass(button.parentNode, 'tab-button'); + for (i = 0; i < buttons.length; i++) { + if (buttons[i] === button) { + index = i; + button.className = 'tab-button active'; + } else { + buttons[i].className = 'tab-button'; + } + } + + // Hide other tabs and show this one. + var tabs = childrenByClass(button.parentNode.parentNode, 'tab'); + for (i = 0; i < tabs.length; i++) { + if (i === index) { + tabs[i].style.display = 'block'; + } else { + tabs[i].style.display = 'none'; + } + } +} + +/* + Collapse or show a navigation menu. It will not be hidden unless it + is currently selected or `force` has been passed. +*/ +function toggleCollapseNav(event, force) { + var heading = event.target.parentNode; + var content = heading.nextSibling; + var inner = content.children[0]; + + if (heading.className.indexOf('heading') === -1) { + // Clicked without hitting the right element? + return; + } + + if (content.style.maxHeight && content.style.maxHeight !== '0px') { + // Currently showing, so let's hide it, but only if this nav item + // is already selected. This prevents newly selected items from + // collapsing in an annoying fashion. + if (force || window.location.hash && endsWith(event.target.href, window.location.hash)) { + content.style.maxHeight = '0px'; + } + } else { + // Currently hidden, so let's show it + content.style.maxHeight = inner.offsetHeight + 12 + 'px'; + } +} + +/* + Refresh the page after a live update from the server. This only + works in live preview mode (using the `--server` parameter). +*/ +function refresh(body) { + document.querySelector('body').className = 'preload'; + document.body.innerHTML = body; + + // Re-initialize the page + init(); + autoCollapse(); + + document.querySelector('body').className = ''; +} + +/* + Determine which navigation items should be auto-collapsed to show as many + as possible on the screen, based on the current window height. This also + collapses them. +*/ +function autoCollapse() { + var windowHeight = getWindowDimensions()[1]; + var itemsHeight = 64; /* Account for some padding */ + var itemsArray = Array.prototype.slice.call( + document.querySelectorAll('nav .resource-group .heading')); + + // Get the total height of the navigation items + itemsArray.forEach(function (item) { + itemsHeight += item.parentNode.offsetHeight; + }); + + // Should we auto-collapse any nav items? Try to find the smallest item + // that can be collapsed to show all items on the screen. If not possible, + // then collapse the largest item and do it again. First, sort the items + // by height from smallest to largest. + var sortedItems = itemsArray.sort(function (a, b) { + return a.parentNode.offsetHeight - b.parentNode.offsetHeight; + }); + + while (sortedItems.length && itemsHeight > windowHeight) { + for (var i = 0; i < sortedItems.length; i++) { + // Will collapsing this item help? + var itemHeight = sortedItems[i].nextSibling.offsetHeight; + if ((itemsHeight - itemHeight <= windowHeight) || i === sortedItems.length - 1) { + // It will, so let's collapse it, remove its content height from + // our total and then remove it from our list of candidates + // that can be collapsed. + itemsHeight -= itemHeight; + toggleCollapseNav({target: sortedItems[i].children[0]}, true); + sortedItems.splice(i, 1); + break; + } + } + } +} + +/* + Initialize the interactive functionality of the page. +*/ +function init() { + var i, j; + + // Make collapse buttons clickable + var buttons = document.querySelectorAll('.collapse-button'); + for (i = 0; i < buttons.length; i++) { + buttons[i].onclick = toggleCollapseButton; + + // Show by default? Then toggle now. + if (buttons[i].className.indexOf('show') !== -1) { + toggleCollapseButton({target: buttons[i].children[0]}); + } + } + + var responseCodes = document.querySelectorAll('.example-names'); + for (i = 0; i < responseCodes.length; i++) { + var tabButtons = childrenByClass(responseCodes[i], 'tab-button'); + for (j = 0; j < tabButtons.length; j++) { + tabButtons[j].onclick = toggleTabButton; + + // Show by default? + if (j === 0) { + toggleTabButton({target: tabButtons[j]}); + } + } + } + + // Make nav items clickable to collapse/expand their content. + var navItems = document.querySelectorAll('nav .resource-group .heading'); + for (i = 0; i < navItems.length; i++) { + navItems[i].onclick = toggleCollapseNav; + + // Show all by default + toggleCollapseNav({target: navItems[i].children[0]}); + } +} + +// Initial call to set up buttons +init(); + +window.onload = function () { + autoCollapse(); + // Remove the `preload` class to enable animations + document.querySelector('body').className = ''; +}; diff --git a/_site/core/api-specs.md b/_site/core/api-specs.md new file mode 100644 index 00000000..80c445e3 --- /dev/null +++ b/_site/core/api-specs.md @@ -0,0 +1,3061 @@ +# Group Authorization + +## Auth Request View [GET /auth?authRequest={authRequestToken}] + +This endpoint is accessed internally by +[blockstack.js](https://github.com/blockstack/blockstack.js) to process user +sign-in requests. Applications use `blockstack.js` to direct users to sign in +or sign up. Please see the [blockstack.js +documentation](http://blockstack.github.io/blockstack.js/#authentication) on +authentication for details. + +When the user clicks the Blockstack login button in an application, the app should +redirect the user to this endpoint (via `blockstack.js`). If the user already has an +account, they will be redirected along with requested data. If the +user doesn’t have an account, the user will be presented with each of +the app’s requested permissions, then will satisfy or deny them. The +sign-in dashboard will then redirect the user back to the application +with a signed JWT. This JWT contains a signature and an API +token that the app can use for future authorization of endpoints. + +Each application specifies in advance which family of API calls it +will need to make to function properly. This list is passed along to +this endpoint when creating an application account. The +account-creation page shows this list of API endpoints and what they +do, and allows the user to line-item approve or deny them. The list +is stored to the user's profile, and returned to the application +application as part of the session JWT. The API +server will NACK requests to endpoints in API families absent from the +session JWT. + ++ Requires root authorization ++ Parameters + + authRequestToken: eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksifQ.eyJhcHBfZG9tYWluIjoiaGVsbG9ibG9ja3N0YWNrLmNvbSIsIm1ldGhvZHMiOltdLCJhcHBfcHVibGljX2tleSI6IjAyYjk0ZjY4NDgzOGFkMjdmZTE0Nzk1MGMyNjQ1ZjRhYzhjYmU1OTJlYjYzYmQwYTQ5MWQ2YzBlYWZjNjE0YzVjMCJ9.0lLrxt8uGtB2rCKB9sb0jK1DdrrWuuuWM-nsyjvFnmjNx0XfG14Npl72w6hp9W2OHoXdPe7VuXkfvKmVNlQdeA (jwt token) - app token before signing ++ Response 200 + + Body + + {"token": + "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJhcHBfZG9tYWluIjoiaGVsbG9ibG9ja3N0YWNrLmNvbSIsIm1ldGhvZHMiOltdLCJ0aW1lc3RhbXAiOjE0OTkzNDc4OTUsImV4cGlyZXMiOjE0OTk5NTI2OTUsImFwcF91c2VyX2lkIjoiMUVITmE2UTRKejJ1dk5FeEw0OTdtRTQzaWtYaHdGNmtabSIsImRldmljZV9pZCI6IjAiLCJibG9ja2NoYWluX2lkIjpudWxsLCJzdG9yYWdlIjp7ImNsYXNzZXMiOnsid3JpdGVfcHJpdmF0ZSI6WyJkaXNrIiwiczMiLCJibG9ja3N0YWNrX3NlcnZlciIsImRodCJdLCJyZWFkX2xvY2FsIjpbImRpc2siXSwicmVhZF9wdWJsaWMiOlsiczMiLCJibG9ja3N0YWNrX3Jlc29sdmVyIiwiYmxvY2tzdGFja19zZXJ2ZXIiLCJodHRwIiwiZGh0Il0sIndyaXRlX2xvY2FsIjpbImRpc2siXSwid3JpdGVfcHVibGljIjpbXSwicmVhZF9wcml2YXRlIjpbImRpc2siXX0sInByZWZlcmVuY2VzIjp7fX0sImFwaV9lbmRwb2ludCI6ImxvY2FsaG9zdDo2MjcwIiwiYXBwX3B1YmxpY19rZXlzIjpbXSwidmVyc2lvbiI6MX0.Bhne8wQpPVfkV-VLf2mrsoMmNiE2e04crgLN7OUFKEh_YWeGmqjoZU7JVSzXA5r7LCpZ9Eki5uAWlJSHk-JuCA" + } + +# Group Core Node Administration + +Blockstack Core's API module provides a set of API calls for interacting with +the node's configuration. However, most of this section is **DEPRECATED** in favor +of moving configuration state to the [Blockstack +Browser](https://github.com/blockstack/blockstack-browser). Client-side state +is managed by [blockstack.js](https://github.com/blockstack/blockstack.js). + +## Ping the node [GET /v1/node/ping] +Ping the Blockstack node to see if it's alive. ++ Public Endpoint ++ Response 200 (application/json) + + Body + + { + "status": "alive", + "version": "###version###" + } + + Schema + + { + "type": "object", + "properties": { + "status": { + "type": "string" + }, + "version": { + "type": "string" + } + }, + "required": [ + "status", + "version" + ] + } + +## Get the node's config [GET /v1/node/config] +Returns the current configuation settings of the Blockstack node. + ++ DEPRECATED. Blockstack clients should use + [blockstack.js](https://github.com/blockstack/blockstack.js) for querying +client-side configuration state. ++ Requires root authorization ++ Legacy Endpoint ++ Response 200 (application/json) + + Body + + { + "bitcoind": { + "passwd": "blockstacksystem", + "port": "18332", + "regtest": "True", + "server": "localhost", + "spv_path": "/tmp/.../spv_headers.dat", + "use_https": "False", + "user": "blockstack" + }, + "blockchain-reader": { + "port": "18332", + "rpc_password": "blockstacksystem", + "rpc_username": "blockstack", + "server": "localhost", + "use_https": "False", + "utxo_provider": "bitcoind_utxo", + "version_byte": "0" + }, + "blockchain-writer": { + "port": "18332", + "rpc_password": "blockstacksystem", + "rpc_username": "blockstack", + "server": "localhost", + "use_https": "False", + "utxo_provider": "bitcoind_utxo", + "version_byte": "0" + }, + "blockstack-client": { + "advanced_mode": "true", + "api_endpoint_port": "6270", + "api_password": "...", + "blockchain_reader": "bitcoind_utxo", + "blockchain_writer": "bitcoind_utxo", + "client_version": "0.18.0.0", + "poll_interval": "300", + "port": "16264", + "queue_path": "/tmp/.../client/queues.db", + "rpc_detach": "True", + "server": "localhost", + "storage_drivers": "disk", + "storage_drivers_required_write": "disk", + } + } + + + Schema + + { + 'type': 'object', + 'patternProperties': { + '.+': { + 'type': 'string', + 'pattern': '.+', + }, + } + +## Set config field [POST /v1/node/config/{section}?{key}={value}] +Set one or more config fields in a config section. + ++ DEPRECATED. Blockstack clients should use + [blockstack.js](https://github.com/blockstack/blockstack.js) for client-side +configuration management. ++ Requires root authorization ++ Legacy Endpoint ++ Parameters + + section: blockstack-client (string) - configuration section + + key: server (string) - configuration variable to set + + value: node.blockstack.org (string) - value to set + ++ Response 200 (application/json) + + Body + + { 'status' : true } + + + Schema + + { + 'anyOf': [ + { + 'type': 'object', + 'properties': { + 'status': { + 'type': 'boolean' + }, + }, + }, + { + 'type': 'object', + 'properties': { + 'error': { + 'type': 'string', + }, + }, + }, + ], + } + +## Delete a config field [DELETE /v1/node/config/{section}/{key}] +Delete a single field from the configuration. + ++ DEPRECATED. Blockstack clients should use + [blockstack.js](https://github.com/blockstack/blockstack.js) for client-side +configuration management. ++ Requires root authorization ++ Legacy Endpoint ++ Parameters + + section: blockstack-client (string) - configuration section + + key: advanced_mode (string) - configuration variable to set + ++ Response 200 (application/json) + + + Body + + { 'status' : true } + + + Schema + + { + 'anyOf': [ + { + 'type': 'object', + 'properties': { + 'status': { + 'type': 'boolean' + }, + }, + }, + { + 'type': 'object', + 'properties': { + 'error': { + 'type': 'string', + }, + }, + }, + ], + } + +## Delete a config section [DELETE /v1/node/config/{section}] +Deletes a whole section from the node's configuration. + ++ DEPRECATED. Blockstack clients should use + [blockstack.js](https://github.com/blockstack/blockstack.js) for client-side +configuration management. ++ Requires root authorization ++ Legacy Endpoint ++ Parameters + + section: blockstack-client (string) - configuration section + ++ Response 200 (application/json) + + Body + + { 'status' : true } + + + Schema + + { + 'anyOf': [ + { + 'type': 'object', + 'properties': { + 'status': { + 'type': 'boolean' + }, + }, + }, + { + 'type': 'object', + 'properties': { + 'error': { + 'type': 'string', + }, + }, + }, + ], + } + +## Get registrar state [GET /v1/node/registrar/state] +Gets the current state of the registrar. That is, the Blockstack operations +that have been submitted to the blockchain but are still waiting for +enough confirmations. + ++ DEPRECATED. Blockstack clients should use + [blockstack.js](https://github.com/blockstack/blockstack.js) to query +the status of pending transactions. ++ Requires root authorization ++ Legacy Endpoint ++ Response 200 (application/json) + + Body + + [ + { + "block_height": 666, + "fqu": "bar.test", + "owner_address": "myaPViveUWiiZQQTb51KXCDde4iLC3Rf3K", + "payment_address": "mv1uqYWZpnap4VBSKTHfKW6noTZcNtxtCW", + "profile": { + "@type": "Person", + "accounts": [] + }, + "transfer_address": null, + "tx_hash": "b0fa7d4d79bb69cb3eccf40978514dec1620d05fe7822c550c2764c670efcd29", + "type": "preorder", + "zonefile": "$ORIGIN bar.test\n$TTL 3600\npubkey TXT \"pubkey:data:03ea5d8c2a3ba84eb17625162320bb53440557c71f7977a57d61405e86be7bdcda\"\n_file URI 10 1 \"file:///home/bar/.blockstack/storage-disk/mutable/bar.test\"\n", + "zonefile_hash": "cbe11bbbfffe415b915a7f9566748f72a0d8b2bd" + } + ] + + + Schema + + { + 'type': 'array', + 'items': { + 'type': 'object', + 'properties': { + 'block_height': { + 'type': 'integer', + 'minimum': 0, + }, + 'fqu': { + 'type': 'string', + 'pattern': r'^([a-z0-9\\-_.+]{3,37})$', + }, + 'owner_address': { + 'type': 'string', + 'pattern': r'^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + }, + 'payment_address': { + 'type': 'string', + 'pattern': r'^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + }, + 'profile': { + 'type': 'object', + 'additionalProperties': true, + 'properties': { + '@context': { + 'optional': true, + 'type': 'string' + }, + '@id': { + 'optional': true, + 'type': 'string' + }, + '@type': { + 'type': 'string' + }, + 'account': { + 'items': { + 'properties': { + '@type': { + 'type': 'string' + }, + 'identifier': { + 'optional': true, + 'type': 'string' + }, + 'proofMessage': { + 'optional': true, + 'type': 'string' + }, + 'proofSignature': { + 'optional': true, + 'type': 'string' + }, + 'proofType': { + 'optional': true, + 'type': 'string' + }, + 'proofUrl': { + 'optional': true, + 'type': 'string' + }, + 'service': { + 'optional': true, + 'type': 'string' + } + }, + 'type': 'object' + }, + 'optional': true, + 'type': 'array' + }, + 'address': { + 'optional': true, + 'properties': { + '@type': { + 'type': 'string' + }, + 'addressCountry': { + 'optional': true, + 'type': 'string' + }, + 'addressLocality': { + 'optional': true, + 'type': 'string' + }, + 'postalCode': { + 'optional': true, + 'type': 'string' + }, + 'streetAddress': { + 'optional': true, + 'type': 'string' + } + }, + 'type': 'object' + }, + 'birthDate': { + 'optional': true, + 'type': 'string' + }, + 'description': { + 'optional': true, + 'type': 'string' + }, + 'familyName': { + 'optional': true, + 'type': 'string' + }, + 'givenName': { + 'optional': true, + 'type': 'string' + }, + 'image': { + 'items': { + 'properties': { + '@type': { + 'type': 'string' + }, + 'contentUrl': { + 'optional': true, + 'type': 'string' + }, + 'name': { + 'optional': true, + 'type': 'string' + } + }, + 'type': 'object' + }, + 'optional': true, + 'type': 'array' + }, + 'knows': { + 'items': { + 'properties': { + '@id': { + 'optional': true, + 'type': 'string' + }, + '@type': { + 'type': 'string' + } + }, + 'type': 'object' + }, + 'optional': true, + 'type': 'array' + }, + 'name': { + 'optional': true, + 'type': 'string' + }, + 'taxID': { + 'optional': true, + 'type': 'string' + }, + 'website': { + 'items': { + 'properties': { + '@type': { + 'type': 'string' + }, + 'url': { + 'optional': true, + 'type': 'string' + } + }, + 'type': 'object' + }, + 'optional': true, + 'type': 'array' + }, + 'worksFor': { + 'items': { + 'properties': { + '@id': { + 'optional': true, + 'type': 'string' + }, + '@type': { + 'type': 'string' + } + }, + 'type': 'object' + }, + 'optional': true, + 'type': 'array' + } + } + }, + 'transfer_address': r'^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + 'tx_hash': r'^([0-9a-fA-F]+)$', + 'type': '.+', + 'zonefile': '.+', + 'zonefile_hash': r'^([0-9a-fA-F]+)$' + } + } + } + + +# Group Core Wallet Management + +This entire section is **DEPRECATED** in favor of the wallet software in +[blockstack.js](https://github.com/blockstack/blockstack.js). Names registered +with this API will need to be transferred to the Blockstack Browser. + +The Blockstack Core node manages its own wallet -- this has three keys +for payment, name ownership, and signing data (e.g., user profiles). This +wallet can be managed through these endpoints. + +## Get balance via mock-insight API [GET /insight-api/addr/{address}/balance] +Returns the integer satoshi balance of the given address, with mininum +of 1 confirmation. + ++ DEPRECATED. Blockstack clients should use + [blockstack.js](https://github.com/blockstack/blockstack.js) to query +balances. ++ Authorization: `wallet_read` ++ Legacy Endpoint ++ Response 200 (application/json) + + Body + + 2104 + + + Schema + + { 'type' : 'integer' } + +## Get unconfirmed balance via mock-insight API [GET /insight-api/addr/{address}/unconfirmedBalance] +Returns the integer *unconfirmed* satoshi balance of the given address +(only the 0-confirmation balance). To get the min_conf=0 balance of an +address, you want *unconfirmedBalance* + *balance*. The unconfirmed +balance may be negative (if there is an unconfirmed spend). This +specification is strange, I know, but it replicates the interface of +insight-api. + ++ DEPRECATED. Blockstack clients should use + [blockstack.js](https://github.com/blockstack/blockstack.js) to query +balances. ++ Authorization: `wallet_read` ++ Legacy Endpoint ++ Response 200 (application/json) + + Body + + -1000 + + + Schema + + { 'type' : 'integer' } + +## Get wallet payment address [GET /v1/wallet/payment_address] + +Returns core node's payment address. + ++ DEPRECATED. Blockstack clients should use + [blockstack.js](https://github.com/blockstack/blockstack.js) to manage keys +and query UTXOs. ++ Authorization: `wallet_read` ++ Legacy Endpoint ++ Response 200 (application/json) + + Body + + { + "address": "mv1uqYWZpnap4VBSKTHfKW6noTZcNtxtCW" + } + + + Schema + + { + 'type': 'object', + 'properties': { + 'type': 'string', + 'pattern': r'^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + } + } + +## Set a specific wallet key [PUT /v1/wallet/keys/{keyname}] +This call instructs the blockstack core node to use a particular key +instead of the core node's configured wallet key. The setting of this +key is *temporary* by default, meaning that it is not written to +`~/.blockstack/wallet.json`, and on a subsequent restart, the key will +return to the original key. However, the core registrar *tracks* the +owner key used for each `PREORDER`, and stores that private key +encrypted (with `scrypt` and the core wallet password) in the +queue. When the registrar detects that the key being used for a +particular name has changed, it will recover by submitting further +transactions with the stored key. + +However, for blockstack core >= 0.14.5, the `persist_change` keyword +will instruct the core node to write the changed key to +`~/.blockstack/wallet.json`. In this mode, the node will backup the +previous wallet to `~/.blockstack/wallet.json.prior.` + ++ DEPRECATED. Blockstack clients should use + [blockstack.js](https://github.com/blockstack/blockstack.js) to manage keys. ++ Requires root authorization ++ Legacy Endpoint ++ Parameters + + keyname: owner (string) - which key to set (one of 'owner', 'data', 'payment') + ++ Request (application/json) + + Body + + "cPo24qGYz76xSbUCug6e8LzmzLGJPZoowQC7fCVPLN2tzCUJgfcW" + ++ Request (application/json) + + Schema + + { + "type" : "object", + "properties" : { + "private_key" : { + "anyOf": [ + { + "anyOf": [ + { + "pattern": "^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$", + "type": "string" + }, + { + "pattern": "^([0-9a-fA-F]+)$", + "type": "string" + } + ] + }, + { + "properties": { + "address": { + "pattern": "^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$", + "type": "string" + }, + "private_keys": { + "items": { + "anyOf": [ + { + "pattern": "^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$", + "type": "string" + }, + { + "pattern": "^([0-9a-fA-F]+)$", + "type": "string" + } + ] + }, + "type": "array" + }, + "redeem_script": { + "pattern": "^([0-9a-fA-F]+)$", + "type": "string" + } + }, + "required": [ + "address", + "redeem_script", + "private_keys" + ], + "type": "object" + } + ] + }, + "persist_change" : {"type" : "boolean"} + }, + "required" : [ "private_key" ] + } + ++ Request (application/json) + + Schema + + { + "anyOf": [ + { + "anyOf": [ + { + "pattern": "^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$", + "type": "string" + }, + { + "pattern": "^([0-9a-fA-F]+)$", + "type": "string" + } + ] + }, + { + "properties": { + "address": { + "pattern": "^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$", + "type": "string" + }, + "private_keys": { + "items": { + "anyOf": [ + { + "pattern": "^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$", + "type": "string" + }, + { + "pattern": "^([0-9a-fA-F]+)$", + "type": "string" + } + ] + }, + "type": "array" + }, + "redeem_script": { + "pattern": "^([0-9a-fA-F]+)$", + "type": "string" + } + }, + "required": [ + "address", + "redeem_script", + "private_keys" + ], + "type": "object" + } + ] + } + ++ Response 200 (application/json) + + Body + + {"status": true} + + + Schema + + { + 'anyOf': [ + { + 'type': 'object', + 'properties': { + 'status': { + 'type': 'boolean' + }, + }, + }, + { + 'type': 'object', + 'properties': { + 'error': { + 'type': 'string', + }, + }, + }, + ], + } + +## Get payment wallet balance [GET /v1/wallet/balance/{minconfs}] + +Fetches wallet balance, including UTXOs from transactions with at +least a specified number of confirmations. + ++ DEPRECATED. Blockstack clients should use + [blockstack.js](https://github.com/blockstack/blockstack.js) to manage keys +and query UTXOs. ++ Authorization: `wallet_read` ++ Legacy Endpoint ++ Parameters + + minconfs: 0 (number, optional) - the minimum confs of transactions to include in balance ++ Response 200 (application/json) + + Body + + { + "balance": { + "bitcoin": 49.931727, + "satoshis": 4993172700 + } + } + + + Schema + + { + 'type': 'object', + 'properties': { + 'balance': { + 'type': 'object', + 'properties': { + 'bitcoin': { + 'type': 'number', + 'minimum': 0, + }, + 'satoshis': { + 'type': 'integer', + 'minimum': 0, + }, + }, + }, + }, + } + +## Withdraw payment wallet funds [POST /v1/wallet/balance] +Withdraw an amount (given in satoshis) from the core payment +wallet, to a particular address. + ++ DEPRECATED. Blockstack clients should use + [blockstack.js](https://github.com/blockstack/blockstack.js) to manage keys, +generate transactions, and send transactions. ++ Authorization: `wallet_write` ++ Legacy Endpoint ++ Request (application/json) + + Body + + {'address' : 'mibZW6EBpXSTWQNQ9E4fi9hhGKYSMkjyg9', + 'amount' : 100, + 'min_confs' : 6, + 'tx_only' : false} + + + Schema + + { + 'type': 'object', + 'properties': { + 'address': { + 'type': 'string', + 'pattern': r"^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$", + }, + 'amount': { + 'type': 'integer', + 'minimum': 0, + }, + 'message': { + 'type': 'string', + 'pattern': '^.{1,80}$', + } + 'min_confs': { + 'type': 'integer', + 'minimum': 0, + }, + 'tx_only': { + 'type': 'boolean' + }, + 'payment_key': { + 'anyOf': [ + { + 'anyOf': [ + { + 'pattern': '^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + 'type': 'string' + }, + { + 'pattern': '^([0-9a-fA-F]+)$', + 'type': 'string' + } + ] + }, + { + 'properties': { + 'address': { + 'pattern': '^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + 'type': 'string' + }, + 'private_keys': { + 'items': { + 'anyOf': [ + { + 'pattern': '^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + 'type': 'string' + }, + { + 'pattern': '^([0-9a-fA-F]+)$', + 'type': 'string' + } + ] + }, + 'type': 'array' + }, + 'redeem_script': { + 'pattern': '^([0-9a-fA-F]+)$', + 'type': 'string' + } + }, + 'required': [ + 'owner' + ], + 'type': 'object' + } + ] + } + }, + 'required': [ + 'address' + ], + } + ++ Response 200 (application/json) + + Body + + { + "status": true, + "transaction_hash": "c4ee8d1993794487e6b5aca802a1793530bdff35c763ca051fbaa4b998780822", + "success": true + } + + Schema + + { + 'anyOf': [ + { + 'type': 'object', + 'properties': { + 'success': { + 'type': 'boolean' + }, + 'transaction_hash': { + 'type': 'string', + 'pattern': r'^([0-9a-fA-F]+)$', + }, + }, + }, + { + 'type': 'object', + 'properties': { + 'error': { + 'type': 'string', + }, + }, + }, + ], + } + + +## Get wallet owner address [GET /v1/wallet/owner_address] +Returns core node's owner address. + ++ DEPRECATED. Blockstack clients should use + [blockstack.js](https://github.com/blockstack/blockstack.js) to manage keys. ++ Authorization: `wallet_read` ++ Legacy Endpoint ++ Response 200 (application/json) + + Body + + { + "address": "myaPViveUWiiZQQTb51KXCDde4iLC3Rf3K" + } + + Schema + + { + 'anyOf': [ + { + 'type': 'object', + 'properties': { + 'address': { + 'type': 'string', + 'pattern': r"^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$", + }, + }, + }, + { + 'type': 'object', + 'properties': { + 'error': { + 'type': 'string', + }, + }, + }, + ], + } + + +## Get wallet data public key [GET /v1/wallet/data_pubkey] +Returns the public key the core node uses for signing user data + ++ DEPRECATED. Blockstack clients should use + [blockstack.js](https://github.com/blockstack/blockstack.js) to manage keys. ++ Authorization: `wallet_read` ++ Legacy Endpoint ++ Response 200 (application/json) + + Body + + { + "public_key": "03ea5d8c2a3ba84eb17625162320bb53440557c71f7977a57d61405e86be7bdcda" + } + + Schema + + { + 'anyOf': [ + { + 'type': 'object', + 'properties': { + 'public_key': { + 'type': 'string', + 'pattern': r'^([0-9a-fA-F]+)$', + }, + }, + }, + { + 'type': 'object', + 'properties': { + 'error': { + 'type': 'string', + }, + }, + }, + ], + } + +## Change wallet password [PUT /v1/wallet/password] +This will change the password for core's wallet. Currently not working endpoint. + ++ DEPRECATED. Blockstack clients should use + [blockstack.js](https://github.com/blockstack/blockstack.js) to encrypt keys. ++ Authorization: `wallet_write` ++ Legacy Endpoint ++ Request (application/json) + + Body + + {'password' : '"0123456789abcdef"', + 'new_password' : "abcdef0123456789"'} + + Schema + + { + 'anyOf': [ + { + 'type': 'object', + 'properties': { + 'password': { + 'type': 'string', + }, + 'new_password': { + 'type': 'string', + }, + }, + }, + { + 'type': 'object', + 'properties': { + 'error': { + 'type': 'string', + }, + }, + }, + ], + } + +## Set all wallet keys [PUT /v1/wallet/keys] + ++ DEPRECATED. Blockstack clients should use + [blockstack.js](https://github.com/blockstack/blockstack.js) to manage keys +in a client wallet. ++ Legacy Endpoint ++ Requires root authorization + +## Get all wallet keys [GET /v1/wallet/keys] + ++ DEPRECATED. Blockstack clients should use + [blockstack.js](https://github.com/blockstack/blockstack.js) to interact with +a client wallet. ++ Legacy Endpoint ++ Requires root authorization + +# Group Managing Names + +All POST, PUT, and DELETE routes in this section are **DEPRECATED** in favor of using either the [Blockstack +Browser](https://github.com/blockstack/blockstack-browser) or +[blockstack.js](https://github.com/blockstack/blockstack.js) to register and +manage names. + +All GET routes are still valid. + +## Register a name [POST /v1/names] +Registers a name, optionally to a given owner key and optionally using +a given payment key to pay for the name and transaction fees. + +This method takes a JSON blob with the following fields: + +* `name`: (required) the fully-qualified name to register. +* `zonefile`: (optional) the zone file to associate with this name. If one is + not given, a default one will be generated. +* `owner_address`: (optional) the recipient of this name. See below. +* `min_confs`: (optional) this is the minimum number of confirmations for UTXOs + that will be used for payments for this name registration. Lower values speed +up the name registration time, at the risk of blockchain reorgs or frontrunners +invalidating your name's registration. +* `tx_fee`: (optional) use this transaction fee (in satoshis) instead of + estimating one. +* `cost_satoshis`: (optional) how much to pay for this name. This value will be + sent to the name's namespace's designated burn address. If not given, the +precise value will be looked up automatically. +* `unsafe`: (optional) ignore internal safety checks when generating and sending + transactions. See below. +* `owner_key`: (optional) if given, this is the *private key* of the owner +that will receive the name. Useful for when you want to use your *personal* +node to register names to a different key, without having to bother with the +extra `NAME_TRANSFER` transaction required by passing `owner_address`. +DO NOT USE IN PUBLIC SETTINGS. +* `payment_key`: (optional) if given, this is the *private key* used to pay for + the name registration fee and transaction fees. Useful for when you want to +use your *personal* node to register names with a different payment key. DO NOT +USE IN PUBLIC SETTINGS. + +If no `owner_address` is supplied in the POSTed JSON +object, the node will register a name for the `owner_key` given in the +JSON blob. If no `owner_key` is given, then the node's current owner address +in its wallet will be used. + +If an `owner_address` is supplied, a `TRANSFER` transaction will be +broadcasted to send the name to appropriate owner. If you intend to register +many names to different addresses, it is recommended that you use one of the +wallet endpoints to set the node's owner keys to save yourself the extra +`TRANSFER` transactions (or pass `owner_key`). However, you should *ONLY* do +this if you trust the node (i.e. only do this for personal nodes). + +The `min_confs` keyword controls the minimum number of confirmations for +UTXOs used as payments for name registration. + +The `unsafe` keyword instructs the node's registrar to ignore certain +safety checks while registering the name (in particular, the registrar +will not verify that the user own's the name before issuing a +`REGISTER` and `UPDATE`). This allows the registrar to submit +operations before they have been confirmed on remote resolvers or +indexers, in this mode, the registrar will wait for 4 confirmations on +a `PREORDER`, 1 confirmation on a `REGISTER` and 1 confirmation on an +`UPDATE`. `node.blockstack.org` will correctly detect the registration +after the `UPDATE` has 6 confirmations. + ++ DEPRECATED. Registering names is now performed by [Blockstack + Browser](https://github.com/blockstack/blocktack-browser) and +[blockstack.js](https://github.com/blockstack/blockstack.js). ++ Authorization: `register` ++ Legacy Endpoint ++ Request (application/json) + + Body + + { + 'name' : 'bar.test' + } + ++ Request (application/json) + + Schema + + { + 'type': 'object', + 'properties': { + "name": { + 'type': 'string', + 'pattern': OP_NAME_PATTERN + }, + "zonefile": { + 'type': 'string', + 'maxLength': RPC_MAX_ZONEFILE_LEN, + }, + "owner_address": { + 'type': 'string', + 'pattern': OP_BASE58CHECK_PATTERN, + }, + 'min_confs': { + 'type': 'integer', + 'minimum': 0, + }, + 'tx_fee': { + 'type': 'integer', + 'minimum': 0, + 'maximum': TX_MAX_FEE, + }, + 'cost_satoshis': { + 'type': 'integer', + 'minimum': 0, + }, + 'unsafe': { + 'type': 'boolean' + }, + 'owner_key': { + 'anyOf': [ + { + 'anyOf': [ + { + 'pattern': '^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + 'type': 'string' + }, + { + 'pattern': '^([0-9a-fA-F]+)$', + 'type': 'string' + } + ] + }, + { + 'properties': { + 'address': { + 'pattern': '^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + 'type': 'string' + }, + 'private_keys': { + 'items': { + 'anyOf': [ + { + 'pattern': '^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + 'type': 'string' + }, + { + 'pattern': '^([0-9a-fA-F]+)$', + 'type': 'string' + } + ] + }, + 'type': 'array' + }, + 'redeem_script': { + 'pattern': '^([0-9a-fA-F]+)$', + 'type': 'string' + } + }, + 'required': [ + 'owner' + ], + 'type': 'object' + } + ] + }, + 'payment_key': { + 'anyOf': [ + { + 'anyOf': [ + { + 'pattern': '^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + 'type': 'string' + }, + { + 'pattern': '^([0-9a-fA-F]+)$', + 'type': 'string' + } + ] + }, + { + 'properties': { + 'address': { + 'pattern': '^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + 'type': 'string' + }, + 'private_keys': { + 'items': { + 'anyOf': [ + { + 'pattern': '^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + 'type': 'string' + }, + { + 'pattern': '^([0-9a-fA-F]+)$', + 'type': 'string' + } + ] + }, + 'type': 'array' + }, + 'redeem_script': { + 'pattern': '^([0-9a-fA-F]+)$', + 'type': 'string' + } + }, + 'required': [ + 'owner' + ], + 'type': 'object' + } + ] + } + }, + 'required': [ + 'name' + ], + 'additionalProperties': False, + } + ++ Response 200 (application/json) + + Body + + { + "message": "Name queued for registration. The process takes several hours. You can check the status with `blockstack info`.", + "success": true, + "transaction_hash": "6cdb9722f72875b30e1ab3de463e3960aced951f674be942b302581a9a9469a5" + } + + + Schema + + { + 'anyOf': [ + { + 'type': 'object', + 'properties': { + 'success': { + 'type': 'boolean' + }, + 'transaction_hash': { + 'type': 'string', + 'pattern': r'^([0-9a-fA-F]+)$', + }, + }, + }, + { + 'type': 'object', + 'properties': { + 'error': { + 'type': 'string', + }, + }, + }, + ], + } + + +## Revoke name [DELETE /v1/names/{name}] +Revokes the name from Blockstack. This renders +the name unusable until it expires. Use this method if your private keys +are compromised. + ++ DEPRECATED. Blockstack clients should use + [blockstack.js](https://github.com/blockstack/blockstack.js) for generating +transactions. ++ Authorization: `revoke` ++ Legacy Endpoint ++ Parameters + + name: bar.test (string) - fully-qualified name ++ Response 200 (application/json) + + Body + + { + "message": "Name queued for revocation. The process takes ~1 hour. You can check the status with `blockstack info`.", + "success": true, + "transaction_hash": "b2745b706d7a14ce652265de103d7eaefb44a75eb658d7bb1db8868da08768b2" + } + + + Schema + + { + 'anyOf': [ + { + 'type': 'object', + 'properties': { + 'success': { + 'type': 'boolean' + }, + 'transaction_hash': { + 'type': 'string', + 'pattern': r'^([0-9a-fA-F]+)$', + }, + }, + }, + { + 'type': 'object', + 'properties': { + 'error': { + 'type': 'string', + }, + }, + }, + ], + } + + +## Transfer name [PUT /v1/names/{name}/owner] +Transfers a name to a different owner. + ++ DEPRECATED. Blockstack clients should use + [blockstack.js](https://github.com/blockstack/blockstack.js) for generating +transactions. ++ Authorization: `transfer` ++ Legacy Endpoint ++ Parameters + + name: bar.test (string) - name to transfer ++ Request (application/json) + + Body + + { "owner" : "mjZicz7GSJBZuGeCMEgpzr8U9w6d41DfXm" } + ++ Request (application/json) + + Schema + + + { + 'type': 'object', + 'properties': { + 'owner': { + 'type': 'string', + 'pattern': OP_BASE58CHECK_PATTERN, + }, + 'tx_fee': { + 'type': 'integer', + 'minimum': 0, + 'maximum': 500000 + }, + 'owner_key': { + 'anyOf': [ + { + 'anyOf': [ + { + 'pattern': '^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + 'type': 'string' + }, + { + 'pattern': '^([0-9a-fA-F]+)$', + 'type': 'string' + } + ] + }, + { + 'properties': { + 'address': { + 'pattern': '^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + 'type': 'string' + }, + 'private_keys': { + 'items': { + 'anyOf': [ + { + 'pattern': '^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + 'type': 'string' + }, + { + 'pattern': '^([0-9a-fA-F]+)$', + 'type': 'string' + } + ] + }, + 'type': 'array' + }, + 'redeem_script': { + 'pattern': '^([0-9a-fA-F]+)$', + 'type': 'string' + } + }, + 'required': [ + 'owner' + ], + 'type': 'object' + } + ] + }, + 'payment_key': { + 'anyOf': [ + { + 'anyOf': [ + { + 'pattern': '^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + 'type': 'string' + }, + { + 'pattern': '^([0-9a-fA-F]+)$', + 'type': 'string' + } + ] + }, + { + 'properties': { + 'address': { + 'pattern': '^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + 'type': 'string' + }, + 'private_keys': { + 'items': { + 'anyOf': [ + { + 'pattern': '^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + 'type': 'string' + }, + { + 'pattern': '^([0-9a-fA-F]+)$', + 'type': 'string' + } + ] + }, + 'type': 'array' + }, + 'redeem_script': { + 'pattern': '^([0-9a-fA-F]+)$', + 'type': 'string' + } + }, + 'required': [ + 'owner' + ], + 'type': 'object' + } + ] + } + }, + 'additionalProperties': False, + } + + ++ Response 202 (application/json) + + Body + + { + "message": "Name queued for transfer. The process takes ~1 hour. You can check the status with `blockstack info`.", + "success": true, + "transaction_hash": "c0d677f9ee681abbed8ca6d231bc4ece517c8c6695ce883e5e196b5395402779" + } + + + Schema + + { + 'anyOf': [ + { + 'type': 'object', + 'properties': { + 'success': { + 'type': 'boolean' + }, + 'transaction_hash': { + 'type': 'string', + 'pattern': r'^([0-9a-fA-F]+)$', + }, + }, + }, + { + 'type': 'object', + 'properties': { + 'error': { + 'type': 'string', + }, + }, + }, + ], + } + +## Publish zone file [POST /v1/names/zonefile] +Publish the zonefile which has _already_ been announced. +Submit either as a string with the 'zonefile' property, or +as a base64 encoded blob with the 'zonefile_b64' property. +We recommend base64-encoding your zone files in order to guarantee that they +will be JSON-encodable. + ++ DEPRECATED. ++ Request (application/json) + + Schema + + { + 'type': 'object', + 'properties': { + "zonefile": { + 'type': 'string', + }, + "zonefile_b64": { + 'type': 'string', + } + }, + 'additionalProperties': False, + } + ++ Response 200 (application/json) + + Body + + {'success': true, 'servers' : ['...']} + + +## Set zone file [PUT /v1/names/{name}/zonefile] +Sets the user's zonefile hash, and, if supplied, propagates the +zonefile. If you supply the zonefile, the hash will be calculated from +that. Ultimately, your requests should only supply one of `zonefile`, +`zonefile_b64`, or `zonefile_hash`. + +The value for `zonefile_b64` is a base64-encoded string. +New clients _should_ use the `zonefile_b64` field when specifying a zone file. +The `zonefile` field is preserved for legacy compatibility. + +This API call issues a `NAME_UPDATE` transaction for a name that is owned by +this node's wallet. That is, you can only call this API method if your node +owns the name you're updating. + ++ DEPRECATED. Blockstack clients should use + [blockstack.js](https://github.com/blockstack/blockstack.js) for generating +transactions. ++ Authorization: `update` ++ Legacy Endpoint ++ Parameters + + name: bar.test (string) - fully-qualified name ++ Request (application/json) + + Schema + + { + 'type': 'object', + 'properties': { + "zonefile": { + 'type': 'string', + }, + 'zonefile_b64': { + 'type': 'string', + 'pattern': r'^((?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4}))$' + }, + 'zonefile_hash': { + 'type': 'string', + 'pattern': '^([0-9a-fA-F]{20})$' + }, + 'tx_fee': { + 'type': 'integer', + 'minimum': 0, + 'maximum': 500000 + }, + 'owner_key': { + 'anyOf': [ + { + 'anyOf': [ + { + 'pattern': '^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + 'type': 'string' + }, + { + 'pattern': '^([0-9a-fA-F]+)$', + 'type': 'string' + } + ] + }, + { + 'properties': { + 'address': { + 'pattern': '^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + 'type': 'string' + }, + 'private_keys': { + 'items': { + 'anyOf': [ + { + 'pattern': '^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + 'type': 'string' + }, + { + 'pattern': '^([0-9a-fA-F]+)$', + 'type': 'string' + } + ] + }, + 'type': 'array' + }, + 'redeem_script': { + 'pattern': '^([0-9a-fA-F]+)$', + 'type': 'string' + } + }, + 'required': [ + 'owner' + ], + 'type': 'object' + } + ] + }, + 'payment_key': { + 'anyOf': [ + { + 'anyOf': [ + { + 'pattern': '^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + 'type': 'string' + }, + { + 'pattern': '^([0-9a-fA-F]+)$', + 'type': 'string' + } + ] + }, + { + 'properties': { + 'address': { + 'pattern': '^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + 'type': 'string' + }, + 'private_keys': { + 'items': { + 'anyOf': [ + { + 'pattern': '^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + 'type': 'string' + }, + { + 'pattern': '^([0-9a-fA-F]+)$', + 'type': 'string' + } + ] + }, + 'type': 'array' + }, + 'redeem_script': { + 'pattern': '^([0-9a-fA-F]+)$', + 'type': 'string' + } + }, + 'required': [ + 'owner' + ], + 'type': 'object' + } + ] + } + }, + 'additionalProperties': False, + } + ++ Response 202 (application/json) + + Body + + {'success': true, 'transaction_hash' : '...'} + + Schema + + { + 'anyOf': [ + { + 'type': 'object', + 'properties': { + 'success': { + 'type': 'boolean' + }, + 'transaction_hash': { + 'type': 'string', + 'pattern': r'^([0-9a-fA-F]+)$', + }, + }, + }, + { + 'type': 'object', + 'properties': { + 'error': { + 'type': 'string', + }, + }, + }, + ], + } + +## Fetch zone file [GET /v1/names/{name}/zonefile] +Fetch a user's raw zone file. This only works for RFC-compliant zone files. +This method returns an error for names that have non-standard zone files. + ++ Parameters + + name: bar.test (string) - fully-qualified name ++ Response 200 (application/json) + + Body + + { + "zonefile": "$ORIGIN bar.test\n$TTL 3600\n_https._tcp URI 10 1 \"https://blockstack.s3.amazonaws.com/bar.test\"\n" + } + + + Schema + + { + 'anyOf': [ + { + 'type': 'object', + 'properties': { + 'zonefile': { + 'type': 'string', + 'pattern': '.+', + }, + }, + { + 'type': 'object', + 'properties': { + 'error': { + 'type': 'string', + 'pattern': '.+', + }, + }, + ] + } + +# Group Name Querying +This family of API endpoints deals with querying name information. + +## Get all names [GET /v1/names?page={page}] +Fetch a list of all names known to the node. ++ Public Endpoint ++ Parameters + + page: 23 (number) - names are returned in pages of size 100, + so specify the page number. ++ Response 200 (application/json) + + Body + + [ "aldenquimby.id", "aldeoryn.id", + "alderete.id", "aldert.id", + "aldi.id", "aldighieri.id", ... ] + + + Schema + + { + 'type': 'array', + 'items': { + 'type': 'string', + 'pattern': r'^([a-z0-9\\-_.+]{3,37})$', + } + } + +## Get all subdomains [GET /v1/subdomains?page={page}] +Fetch a list of all names known to the node. ++ Public Endpoint ++ Parameters + + page: 3 (number) - names are returned in pages of size 100, + so specify the page number. ++ Response 200 (application/json) + + Body + + [ + "collegeinfogeek.verified.podcast", + "collider.verified.podcast", + "combatandclassics.verified.podcast", + "combatjack.verified.podcast", + "comedybangbang.verified.podcast", + "comedybutton.verified.podcast", + "commonsense.verified.podcast", + "concilio002.personal.id", ... ] + + + Schema + + { + 'type': 'array', + 'items': { + 'type': 'string', + 'pattern': r'^([a-z0-9\\-_.+]{3,37})\.([a-z0-9\\-_.+]{3,37})$', + } + } + +## Get name info [GET /v1/names/{name}] ++ Public Endpoint ++ Subdomain Aware ++ Parameters + + name: muneeb.id (string) - fully-qualified name ++ Response 200 (application/json) + + Body + + { + "address": "1QJQxDas5JhdiXhEbNS14iNjr8auFT96GP", + "blockchain": "bitcoin", + "expire_block": 489247, + "last_txid": "1edfa419f7b83f33e00830bc9409210da6c6d1db60f99eda10c835aa339cad6b", + "status": "registered", + "zonefile": "$ORIGIN muneeb.id\n$TTL 3600\n_http._tcp IN URI 10 1 \"https://blockstack.s3.amazonaws.com/muneeb.id\"\n", + "zonefile_hash": "b100a68235244b012854a95f9114695679002af9" + } + + + Schema + + { + 'type': 'object', + 'properties': { + 'address': { + 'type': 'string', + 'pattern': r"^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$", + }, + 'blockchain': { + 'type': 'string', + 'pattern': '^bitcoin$', + }, + 'expire_block': { + 'type': 'integer', + 'minimum': 0, + }, + 'last_txid': { + 'type': 'string', + 'pattern': '^[0-9a-fA-F]+$', + }, + 'status': { + 'type': 'string', + 'pattern': '^(registered|revoked)$', + }, + 'zonefile': { + 'anyOf': [ + { + 'type': 'string', + }, + { + 'type': 'object', + 'properties': { + 'error': { + 'type': 'string', + }, + }, + }, + ], + }, + 'zonefile_hash': { + 'type': 'string', + 'pattern': '^[0-9a-fA-F]{20}$`, + }, + }, + { 'required': + [ + 'address', 'blockchain', 'last_txid', + 'status', 'zonefile', 'zonefile_hash' + ] + } + } + +## Name history [GET /v1/names/{name}/history?page={page}] +Get a history of all blockchain records of a registered name. ++ Public Endpoint ++ Subdomain aware ++ Parameters + + name: muneeb.id (string) - name to query + + page: 0 (integer) - the page (in 20-entry pages) of the history to fetch ++ Response 200 (application/json) + + Body + + { + "373821": [ + { + "address": "1QJQxDas5JhdiXhEbNS14iNjr8auFT96GP", + "block_number": 373821, + "consensus_hash": null, + "first_registered": 373821, + "importer": "76a9143e2b5fdd12db7580fb4d3434b31d4fe9124bd9f088ac", + "importer_address": "16firc3qZU97D1pWkyL6ZYwPX5UVnWc82V", + "last_creation_op": ";", + "last_renewed": 373821, + "name": "muneeb.id", + "name_hash128": "deb7fe99776122b77925cbf0a24ab6f8", + "namespace_block_number": 373601, + "namespace_id": "id", + "op": ";", + "op_fee": 100000.0, + "opcode": "NAME_IMPORT", + "preorder_block_number": 373821, + } + ] + } + + + Schema + + { + 'type': 'object', + 'patternProperties': { + '^[0-9]+': { + 'type': 'array', + 'items': { + 'type': 'object', + 'properties': { + 'address': { + 'type': 'string', + 'pattern': r"^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$", + }, + 'base': { + 'type': 'integer', + 'minimum': 0, + 'maximum': 255, + }, + 'buckets': { + 'anyOf': [ + { + 'type': 'array', + 'items': { + 'type': 'integer', + 'minItems': 16, + 'maxItems': 16, + }, + }, + { + 'type': 'null', + }, + ], + }, + 'block_number': { + 'type': 'integer', + 'minimum': 0, + }, + 'coeff': { + 'anyOf': [ + { + 'type': 'integer', + 'minimum': 0, + 'maximum': 255, + }, + { + 'type': 'null' + }, + ], + }, + 'consensus_hash': { + 'anyOf': [ + { + 'type': 'string', + 'pattern': '^[0-9a-fA-F]{32}', + }, + { + 'type': 'null' + }, + ], + }, + 'fee': { + 'type': 'integer', + 'minimum': 0, + }, + 'first_registered': { + 'type': 'integer', + 'minimum': 0, + }, + 'history_snapshot': { + 'type': 'boolean', + }, + 'importer': { + 'anyOf': [ + { + 'type': 'string', + 'pattern': r'^76[aA]914[0-9a-fA-F]{40}88[aA][cC]$', + }, + { + 'type': 'null', + }, + ], + }, + 'importer_address': { + 'anyOf': [ + { + 'type': 'string', + 'pattern': r"^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$", + }, + { + 'type': 'null', + }, + ], + }, + 'last_renewed': { + 'type': 'integer', + 'minimum': 0, + }, + 'op': { + 'type': 'string', + 'pattern': '^([>?+~:!&*:;#]{1}|>>|>~|::)$', + }, + 'op_fee': { + 'type': 'number', + }, + 'opcode': { + 'type': 'string', + 'pattern': '^NAME_TRANSFER|NAME_PREORDER|NAME_UPDATE|NAME_REVOKE|NAME_REGISTRATION|NAMESPACE_READY|NAMESPACE_REVEAL|NAMESPACE_PREORDER|NAME_RENEWAL|NAME_IMPORT|ANNOUNCE$' + }, + 'revoked': { + 'type': 'boolean', + }, + 'sender': { + 'type': 'string', + 'pattern': '^([0-9a-fA-F]+)$', + }, + 'sender_pubkey': { + 'anyOf': [ + { + 'type': 'string', + 'pattern': '^([0-9a-fA-F]+)$', + }, + { + 'type': 'null' + }, + ], + }, + 'recipient': { + 'anyOf': [ + { + 'type': 'string', + 'pattern': '^([0-9a-fA-F]+)$', + }, + { + 'type': 'null' + }, + ], + }, + 'recipient_address': { + 'anyOf': [ + { + 'type': 'string', + 'pattern': '^([123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+)$', + }, + { + 'type': 'null' + }, + ], + }, + 'recipient_pubkey': { + 'anyOf': [ + { + 'type': 'string', + 'pattern': '^([0-9a-fA-F]+)$', + }, + { + 'type': 'null' + }, + ], + }, + 'txid': { + 'type': 'string', + 'pattern': '^([0-9a-fA-F]+)$', + }, + 'value_hash': { + 'anyOf': [ + { + 'type': 'string', + 'pattern': '^([0-9a-fA-F]{40})$', + }, + { + 'type': 'null', + }, + ], + }, + 'vtxindex': { + 'type': 'integer', + 'minimum': 0, + }, + }, + 'required': [ + 'op', + 'opcode', + 'txid', + 'vtxindex' + ], + } + } + } + } + +## Get historical zone file [GET /v1/names/{name}/zonefile/{zoneFileHash}] +Fetches the historical zonefile specified by the username and zone hash. ++ Public Endpoint ++ Subdomain aware ++ Parameters + + name: muneeb.id (string) username to fetch + + zoneFileHash: b100a68235244b012854a95f9114695679002af9 ++ Response 200 (application/json) + + Body + + { + "zonefile": + "$ORIGIN muneeb.id\n$TTL 3600\n_http._tcp IN URI 10 1 \"https://blockstack.s3.amazonaws.com/muneeb.id\"\n" + } + + + Schema + + { + 'anyOf': [ + { + 'type': 'object', + 'properties': { + 'zonefile': { 'type': 'string' }, + }, + }, + { + 'type': 'object', + 'properties': { + 'error': { 'type': 'string' }, + }, + }, + ], + } + +## Get names owned by address [GET /v1/addresses/{blockchain}/{address}] +Retrieves a list of names owned by the address provided. ++ Subdomain Aware ++ Public Endpoint ++ Parameters + + blockchain: bitcoin (string) - the layer-1 blockchain for the address + + address: 1QJQxDas5JhdiXhEbNS14iNjr8auFT96GP (string) - the address to lookup + ++ Response 200 (application/json) + + Body + + { + "names": ["muneeb.id"] + } + + + Schema + + { + 'type': 'object', + 'properties': { + 'names': { + 'type': 'array', + 'items': { + 'type': 'string', + 'pattern': '^([a-z0-9\-_.+]{3,37})$', + }, + }, + }, + } + +# Group Price Checks +## Get namespace price [GET /v1/prices/namespaces/{tld}] + +This endpoint is used to get the price of a namespace. Anyone can create a +namespace by following [this +tutorial](https://github.com/blockstack/blockstack-core/blob/master/docs/namespace_creation.md). + ++ Public Endpoint ++ Parameters + + tld: id (string) - namespace to query price for ++ Response 200 (application/json) + + Body + + { + "satoshis": 4000000000 + } + + + Schema + + { + 'type': 'object', + 'properties': { + 'satoshis': { + 'type': 'integer', + 'minimum': 0, + }, + }, + } + +## Get name price [GET /v1/prices/names/{name}] + +This endpoint is used to get the price of a name. If you are using +a public endpoint, you should *only* rely on the `name_price` field in the +returned JSON blob. Other fields are **DEPRECATED**, since they are relevant +only for estimating the cost of registering a name (which should be done via +[blockstack.js](https://github.com/blockstack/blockstack.js) or the [Blockstack +Browser](https://github.com/blockstack/blockstack-browser)). + ++ Public Endpoint ++ Parameters + + name: muneeb.id (string) - name to query price information for ++ Response 200 (application/json) + + Body + + { + "name_price": { + "satoshis": 100000, + "btc": 0.001 + }, + "total_tx_fees": 519209, + "register_tx_fee": { + "satoshis": 159110, + "btc": 0.0015911 + }, + "preorder_tx_fee": { + "satoshis": 163703, + "btc": 0.00163703 + }, + "warnings": [ + "Insufficient funds; fees are rough estimates." + ], + "total_estimated_cost": { + "satoshis": 619209, + "btc": 0.00619209 + }, + "update_tx_fee": { + "satoshis": 196396, + "btc": 0.00196396 + } + } + + + Schema + + { + 'type': 'object', + 'properties': { + 'name_price': { + 'type': 'object', + 'properties': { + 'btc': { 'type': 'number', 'minimum': 0 }, + 'satoshis': { 'type': 'integer', 'minimum': 0 } + } + }, + 'preorder_tx_fee': { + 'type': 'object', + 'properties': { + 'btc': { 'type': 'number', 'minimum': 0 }, + 'satoshis': { 'type': 'integer', 'minimum': 0 } + } + }, + 'register_tx_fee': { + 'type': 'object', + 'properties': { + 'btc': { 'type': 'number', 'minimum': 0 }, + 'satoshis': { 'type': 'integer', 'minimum': 0 } + } + }, + 'update_tx_fee': { + 'type': 'object', + 'properties': { + 'btc': { 'type': 'number', 'minimum': 0 }, + 'satoshis': { 'type': 'integer', 'minimum': 0 } + } + }, + 'total_estimated_cost': { + 'type': 'object', + 'properties': { + 'btc': { 'type': 'number', 'minimum': 0 }, + 'satoshis': { 'type': 'integer', 'minimum': 0 } + } + }, + 'total_tx_fees': { + 'type': 'integer', + 'minimum': 0, + } + 'name_price': { + 'type': 'object', + 'properties': { + 'btc': { 'type': 'number', 'minimum': 0 }, + 'satoshis': { 'type': 'integer', 'minimum': 0 } + } + }, + 'warnings': { + 'type': 'array', + 'items': { + 'type': 'string', + }, + }, + }, + } + +# Group Blockchain Operations +## Get consensus hash [GET /v1/blockchains/{blockchainName}/consensus] +Get the current Blockstack consensus hash on a blockchain. ++ Public Endpoint ++ Parameters + + blockchainName : bitcoin (string) - the given blockchain ++ Response 200 (application/json) + + Body + + { + "consensus_hash": "2fcbdf66c350894fe03b42c6a2e8a6ac" + } + + + Schema + + { + 'type': 'object', + 'properties': { + 'consensus_hash': { + 'type': 'string', + 'pattern': '^[0-9a-fA-F]{32}$`, + }, + }, + } + +## Get number of names on blockchain [GET /v1/blockchains/{blockchainName}/name_count{?all}] +Get the number of names on a blockchain. ++ Public Endpoint ++ Parameters + + blockchainName: bitcoin (string) - the given blockchain + + all: true (enum[string], optional) - include expired names ++ Response 200 (application/json) + + Body + + { + "names_count": 73950 + } + + + Schema + + { + 'type': 'object', + 'properties': { + 'names_count': { + 'type': 'integer', + 'minimum': 0, + }, + }, + } + ++ Response 401 (application/json) + + Body + + { "error": "Unsupported blockchain" } + + + Schema + + { + 'type': 'object', + 'properties': { + 'error': { 'type': 'string' }, + }, + }, + + +## Get number of subdomains on blockchain [GET /v1/blockchains/{blockchainName}/subdomains_count] +Get the number of subdomains on a blockchain. ++ Public Endpoint ++ Parameters + + blockchainName: bitcoin (string) - the given blockchain ++ Response 200 (application/json) + + Body + + { + "names_count": 1646 + } + + + Schema + + { + 'type': 'object', + 'properties': { + 'names_count': { + 'type': 'integer', + 'minimum': 0, + }, + }, + } + ++ Response 401 (application/json) + + Body + + { "error": "Unsupported blockchain" } + + + Schema + + { + 'type': 'object', + 'properties': { + 'error': { 'type': 'string' }, + }, + }, + + +## Get operations in block [GET /v1/blockchains/{blockchainName}/operations/{blockHeight}] +Get the Blockstack operations in a given block ++ Parameters + + blockchainName : bitcoin (string) - the given blockchain + + blockHeight : 462592 (integer) - the block height ++ Response 200 (application/json) + + Body + + [ + { + "address": "1GS1eHthSK2gqnU9MW9Nis1pUyHP3bJnFK", + "block_number": 462592, + "burn_address": "1111111111111111111114oLvT2", + "consensus_hash": "d206b2f615de00803402cade4d0d51d4", + "op": "?", + "op_fee": 6250, + "opcode": "NAME_PREORDER", + "preorder_hash": "ba22cdf24b05b9a7972e13ada69f96a7850b471e", + "sender": "76a914a944d29012f83c00105778e0bc717c46ea2accfc88ac", + "sender_pubkey": "0343b263f7adc6ae59e8d8310f4a6a87799f6b10cec608f3236cd6a802ffc71728", + "txid": "b3f4f7a43d60666d1a9b42131f9117ad7deac34a478b6ca152344da3d734691f", + "vtxindex": 173 + }, + { + "address": "1gijbF8NkbgwzcoZR1nXMa76NbdcD7GQW", + "block_number": 462592, + "burn_address": "1111111111111111111114oLvT2", + "consensus_hash": "d206b2f615de00803402cade4d0d51d4", + "op": "?", + "op_fee": 6250, + "opcode": "NAME_PREORDER", + "preorder_hash": "386e2de88a908ad056361e586faa95852be454ca", + "sender": "76a91407830f81167f6a2aa253c0f176b7ff2e1c04c61a88ac", + "sender_pubkey": "03b7795d33b362338179e5b2a579431b285f6c303d07ddd83c897277be4e5eb916", + "txid": "4dd315ad1d1b318614a19e15e767efb7ef327bd5cd4ebaf8f80ede58fd1da107", + "vtxindex": 174 + }, + { + "address": "17QEd6rrhNZp4xoyWu6BpA8NQ4axyNKaZy", + "block_number": 462592, + "burn_address": "1111111111111111111114oLvT2", + "consensus_hash": "d206b2f615de00803402cade4d0d51d4", + "op": "?", + "op_fee": 6250, + "opcode": "NAME_PREORDER", + "preorder_hash": "a7a388a2bbe0e7741c6cfdc54d7b5a67811cd582", + "sender": "76a9144635b1794a22bfbe6c5c5eba17b693f4aaf0e34888ac", + "sender_pubkey": "020d6e50b2660af27933c42bc1395fe93df90ffac5e2a989f6a134919fb8cf8075", + "txid": "51d6bd117da5889e710c62967d03233a84fc27f7fad10ca4359111928818f017", + "vtxindex": 332 + }, + { + "address": "15YMyvqz6v9ATSbmqJnudwrdm7RiVfkU3s", + "block_number": 462453, + "consensus_hash": "f6491e1d2b9817fa58512fc9bf8cd3df", + "first_registered": 462575, + "importer": null, + "importer_address": null, + "keep_data": true, + "last_renewed": 462575, + "name": "ablankstein.id", + "name_hash128": "943b8e0613d975c05a05ccd5472e2a72", + "namespace_block_number": 373601, + "namespace_id": "id", + "op": ">>", + "op_fee": 25000, + "opcode": "NAME_TRANSFER", + "preorder_block_number": 462453, + "preorder_hash": "822d5cb6f2e3f0f901d6af8c1111ee466b6c07bd", + "revoked": false, + "sender": "76a91431cee995f242f0f66518080a291714cd7e8d2f5e88ac", + "sender_pubkey": null, + "txid": "121540e81223c45d139fbe03a9713ddd292372f2f88fe2b10b6a7c5e6738e87f", + "value_hash": "96ec93cbc57d17b16a347c11ddfa7ea88d2cf93b", + "vtxindex": 633 + }, + { + "address": "1Dwq9oA5BNz7DAR1LtDncEa647ZxgmkoVV", + "block_number": 462325, + "consensus_hash": "1288cef43f52bf97e2f458a4afe40b61", + "first_registered": 462359, + "importer": null, + "importer_address": null, + "keep_data": true, + "last_renewed": 462359, + "name": "fpenrose.id", + "name_hash128": "7af28a9834934a0af81a19ee14a45f8e", + "namespace_block_number": 373601, + "namespace_id": "id", + "op": ">>", + "op_fee": 25000, + "opcode": "NAME_TRANSFER", + "preorder_block_number": 462325, + "preorder_hash": "59c25d7cddf433b5122cabcbf2ebcc1bc1519e4d", + "revoked": false, + "sender": "76a9148e002a93b9b1936b5d320967194eaff3deaa979088ac", + "sender_pubkey": null, + "txid": "6461bb4bbf517e9c80ffcac4c349836972656572e113aba736b356119655064e", + "value_hash": "ac73155702ca7aea1161d0f0c7877ac81d48d8fc", + "vtxindex": 637 + }, + { + "address": "1Q44Md5KFr6gxQ6TdUSFaCRm3MaUyXMF6t", + "block_number": 462316, + "consensus_hash": "1288cef43f52bf97e2f458a4afe40b61", + "first_registered": 462353, + "importer": null, + "importer_address": null, + "keep_data": true, + "last_renewed": 462353, + "name": "rahulpradhan.id", + "name_hash128": "c55ff9e14c72b2950b14ff10067d7e27", + "namespace_block_number": 373601, + "namespace_id": "id", + "op": ">>", + "op_fee": 25000, + "opcode": "NAME_TRANSFER", + "preorder_block_number": 462316, + "preorder_hash": "fcb3389ca4d2ab8003ce8b6b3baa0a5ae1600cce", + "revoked": false, + "sender": "76a914fcdef125f40f984fafad4b58e30e3b1761a953f388ac", + "sender_pubkey": null, + "txid": "be58e02642c457fec2835a354fbc2de45e8c838aa5b7fd18ed831f67d08269e6", + "value_hash": "e213e58ca1446875b79d866720130cc90cbca681", + "vtxindex": 638 + }, + { + "address": "1D8pL725X9HWvoTVgzqDNbTPayHGG7tkY6", + "block_number": 462345, + "consensus_hash": "919df884f14f34fd15a791af2fddb569", + "first_registered": 462380, + "importer": null, + "importer_address": null, + "keep_data": true, + "last_renewed": 462380, + "name": "sajithskurup.id", + "name_hash128": "3fda1c60620c42e1ede385bb246bd5f0", + "namespace_block_number": 373601, + "namespace_id": "id", + "op": ">>", + "op_fee": 25000, + "opcode": "NAME_TRANSFER", + "preorder_block_number": 462345, + "preorder_hash": "540daefe1f3b520253f7ab954dbc8bf131471133", + "revoked": false, + "sender": "76a914851bee0185dd799755234fb20710a26ec40354d288ac", + "sender_pubkey": null, + "txid": "e7d35196ca3eec697274d848136f5267b1c935055a917020f93e8ecaf821ba99", + "value_hash": "92534954e934019718478bb52150765dfad79171", + "vtxindex": 644 + }, + { + "address": "1EbjXtYv9QCVBp8iWiDH6xQ1B74oFW696X", + "block_number": 462345, + "consensus_hash": "e0c31e03125f2feefd4090e5c635ee45", + "first_registered": 462380, + "importer": null, + "importer_address": null, + "keep_data": true, + "last_renewed": 462380, + "name": "hubject.id", + "name_hash128": "03e8bf92dd3cbde65cac012350efb79d", + "namespace_block_number": 373601, + "namespace_id": "id", + "op": ">>", + "op_fee": 25000, + "opcode": "NAME_TRANSFER", + "preorder_block_number": 462345, + "preorder_hash": "ded4d097614cf5321388bbe56b24d3d592b2ef76", + "revoked": false, + "sender": "76a914952b4844005dd98a1f7fc99813db2a649109b45988ac", + "sender_pubkey": null, + "txid": "7b7a2a2963f7454b93003031cfce64ac609f902b4c2cababfbbfad2c01bbeb9b", + "value_hash": "be968a1f17ac828179e5b2fbc70d238056af7482", + "vtxindex": 645 + }, + { + "address": "14YsDo5qgAP7kmnq33tw9JdHVBywpg9pge", + "block_number": 462326, + "consensus_hash": "e0c31e03125f2feefd4090e5c635ee45", + "first_registered": 462354, + "importer": null, + "importer_address": null, + "keep_data": true, + "last_renewed": 462354, + "name": "ramimassoud.id", + "name_hash128": "61a48b6f8aeb027883ecd1f8d808c8ac", + "namespace_block_number": 373601, + "namespace_id": "id", + "op": ">>", + "op_fee": 25000, + "opcode": "NAME_TRANSFER", + "preorder_block_number": 462326, + "preorder_hash": "23aa275e42d7d6d7e538584a799252939687c457", + "revoked": false, + "sender": "76a91426ef31b7aac60eff23cbbab51d453b84700e330388ac", + "sender_pubkey": null, + "txid": "85babcf66caf41cb7beb2e637cbed4e728ab8030337fb5df8461d0e14dd2be75", + "value_hash": "e27c9c3dcce8a8445d84fb8b4d81fbd30fac9749", + "vtxindex": 646 + }, + { + "address": "1H934mT7AVVZmHwjddUZ9EiostLwm655oF", + "block_number": 462345, + "consensus_hash": "919df884f14f34fd15a791af2fddb569", + "first_registered": 462391, + "importer": null, + "importer_address": null, + "keep_data": true, + "last_renewed": 462391, + "name": "was2bme.id", + "name_hash128": "f2b5688682fd47b8f3fbf709bb35ef33", + "namespace_block_number": 373601, + "namespace_id": "id", + "op": ">>", + "op_fee": 6250, + "opcode": "NAME_TRANSFER", + "preorder_block_number": 462345, + "preorder_hash": "3dfdcee2b0e64697c4bb0b0dd791518bcb078dc7", + "revoked": false, + "sender": "76a914b107105f8ae57e7bb5bad58caba666faa679c70f88ac", + "sender_pubkey": null, + "txid": "16171e4e20778354a94c5353b0c6ed0b29a3e73c1b59b9bfbcbe6d26c570fd0c", + "value_hash": "ac73155702ca7aea1161d0f0c7877ac81d48d8fc", + "vtxindex": 649 + }, + { + "address": "1B4zxvVMPm1PBGarc8PrYQjQY2ezwniyG6", + "block_number": 462345, + "consensus_hash": "e0c31e03125f2feefd4090e5c635ee45", + "first_registered": 462391, + "importer": null, + "importer_address": null, + "keep_data": true, + "last_renewed": 462391, + "name": "tadas_serbenta.id", + "name_hash128": "6d800932daf830925ab47dee5ceb8661", + "namespace_block_number": 373601, + "namespace_id": "id", + "op": ">>", + "op_fee": 6250, + "opcode": "NAME_TRANSFER", + "preorder_block_number": 462345, + "preorder_hash": "07a85eac4dbf20000a66a14a4a89a01134b70fab", + "revoked": false, + "sender": "76a9146e72e44bbe4c1706ea5830096a4bb4449dcc948f88ac", + "sender_pubkey": null, + "txid": "e3f0b019550417a7acfe27addfbd34ec7ec5fc1dd9616ed8c6bc86a0ad148290", + "value_hash": "fbac107ba5d9bbfc30ecdeae3e10ca3db72b3431", + "vtxindex": 855 + }, + { + "address": "16BF35VputeLEmbsk7gDnUcwKXcjwPDUvf", + "block_number": 462345, + "consensus_hash": "919df884f14f34fd15a791af2fddb569", + "first_registered": 462359, + "importer": null, + "importer_address": null, + "keep_data": true, + "last_renewed": 462359, + "name": "alexucf.id", + "name_hash128": "d9bc88b0fdc536e7ac5467609faed518", + "namespace_block_number": 373601, + "namespace_id": "id", + "op": ">>", + "op_fee": 25000, + "opcode": "NAME_TRANSFER", + "preorder_block_number": 462345, + "preorder_hash": "30f841114af6ada90ba720d563672113c4f74439", + "revoked": false, + "sender": "76a91438c8814ae2a9035e85bbf2b7976919c2e3387ac588ac", + "sender_pubkey": null, + "txid": "f8e9eebd48b9182b82b22e5ce10f805d3db38786bb2aaf56f9badf83aa3cc0ee", + "value_hash": "8ae0f51263f540be175230d6b46f5d9609de799d", + "vtxindex": 856 + }, + { + "address": "1EmXTRHC6f9bnLJkVZRavv7HLG1owLgNir", + "block_number": 462326, + "consensus_hash": "31a304b682e3291811441a12f19d14e5", + "first_registered": 462391, + "importer": null, + "importer_address": null, + "keep_data": true, + "last_renewed": 462391, + "name": "seamur.id", + "name_hash128": "09f3b9d2da3d0aa1999824f7884f0d18", + "namespace_block_number": 373601, + "namespace_id": "id", + "op": ">>", + "op_fee": 100000, + "opcode": "NAME_TRANSFER", + "preorder_block_number": 462326, + "preorder_hash": "678991fd4d3833babe27f732206a40d1f15dd3ca", + "revoked": false, + "sender": "76a91497055c47fa0ab396fb321e9d37f6bce1796e3d5688ac", + "sender_pubkey": null, + "txid": "e32124770c359eaf57709e5a666894f2954aa687820c41c6911f214e9006b58e", + "value_hash": "4bcdd931185537902ef1af9975198c6404d4c73e", + "vtxindex": 857 + }, + { + "address": "13pGtMcHsNdq3EeLMa1yVVKppP1WjSKgFG", + "block_number": 462345, + "consensus_hash": "e0c31e03125f2feefd4090e5c635ee45", + "first_registered": 462354, + "importer": null, + "importer_address": null, + "keep_data": true, + "last_renewed": 462354, + "name": "innergame.id", + "name_hash128": "a3e4e010d82369ee19b64fccc2b97f69", + "namespace_block_number": 373601, + "namespace_id": "id", + "op": ">>", + "op_fee": 25000, + "opcode": "NAME_TRANSFER", + "preorder_block_number": 462345, + "preorder_hash": "f54850caf10c3041cb2a4d9186bbb234dd7d9f85", + "revoked": false, + "sender": "76a9141ee10ff0ae9969e2dc39d94a959e3160b26b6adf88ac", + "sender_pubkey": null, + "txid": "28de7193e28e1b0c950a32af393284578669c15dc98bad68f382f8b920d94509", + "value_hash": "bab40c2b10f676288edea119edade67ff5e853ba", + "vtxindex": 869 + } + ] + +## Get pending transactions [GET /v1/blockchains/{blockchainName}/pending] +Get the current transactions that the node has issued and are still pending. ++ DEPRECATED. Blockstack clients should use + [blockstack.js](https://github.com/blockstack/blockstack.js) to query the +blockchain. ++ Public Endpoint ++ Parameters + + blockchainName : bitcoin (string) - the given blockchain ++ Response 200 (application/json) + + Body + + { + "queues": {} + } + + + Schema + + { + 'type': 'object', + 'properties': { + 'preorder': { + 'type': 'array', + 'items': { + 'type': 'object', + 'properties': { + 'name': { 'type': 'string', 'pattern': '^([a-z0-9\-_.+]{3,37})$' }, + 'tx_hash': { 'type': 'string', 'pattern': '^[0-9a-fA-F]+$' }, + 'confirmations': { 'type': 'integer', 'minimum': 0 }, + }, + }, + }, + 'register': { + 'type': 'array', + 'items': { + 'type': 'object', + 'properties': { + 'name': { 'type': 'string', 'pattern': '^([a-z0-9\-_.+]{3,37})$' }, + 'tx_hash': { 'type': 'string', 'pattern': '^[0-9a-fA-F]+$' }, + 'confirmations': { 'type': 'integer', 'minimum': 0 }, + }, + }, + }, + 'update': { + 'type': 'array', + 'items': { + 'type': 'object', + 'properties': { + 'name': { 'type': 'string', 'pattern': '^([a-z0-9\-_.+]{3,37})$' }, + 'tx_hash': { 'type': 'string', 'pattern': '^[0-9a-fA-F]+$' }, + 'confirmations': { 'type': 'integer', 'minimum': 0 }, + }, + }, + }, + 'transfer': { + 'type': 'array', + 'items': { + 'type': 'object', + 'properties': { + 'name': { 'type': 'string', 'pattern': '^([a-z0-9\-_.+]{3,37})$' }, + 'tx_hash': { 'type': 'string', 'pattern': '^[0-9a-fA-F]+$' }, + 'confirmations': { 'type': 'integer', 'minimum': 0 }, + }, + }, + }, + 'renew': { + 'type': 'array', + 'items': { + 'type': 'object', + 'properties': { + 'name': { 'type': 'string', 'pattern': '^([a-z0-9\-_.+]{3,37})$' }, + 'tx_hash': { 'type': 'string', 'pattern': '^[0-9a-fA-F]+$' }, + 'confirmations': { 'type': 'integer', 'minimum': 0 }, + }, + }, + }, + 'revoke': { + 'type': 'array', + 'items': { + 'type': 'object', + 'properties': { + 'name': { 'type': 'string', 'pattern': '^([a-z0-9\-_.+]{3,37})$' }, + 'tx_hash': { 'type': 'string', 'pattern': '^[0-9a-fA-F]+$' }, + 'confirmations': { 'type': 'integer', 'minimum': 0 }, + }, + }, + }, + 'name_import': { + 'type': 'array', + 'items': { + 'type': 'object', + 'properties': { + 'name': { 'type': 'string', 'pattern': '^([a-z0-9\-_.+]{3,37})$' }, + 'tx_hash': { 'type': 'string', 'pattern': '^[0-9a-fA-F]+$' }, + 'confirmations': { 'type': 'integer', 'minimum': 0 }, + }, + }, + }, + } + } + +## Get unspent outputs [GET /v1/blockchains/{blockchainName}/{address}/unspent] ++ DEPRECATED. Blockstack clients should use + [blockstack.js](https://github.com/blockstack/blockstack.js) to query the +blockchain. ++ Authorization: `blockchain` ++ Parameters + + blockchainName : bitcoin (string) - the given blockchain + + address : 1GuKR3nJi2VH3E1ZSPvuX8nAu3jNnr7xzq (string) - the address to get unspents for ++ Response 200 (application/json) + + Body + + [ + { + "confirmations": 18, + "out_script": "76a914ae6ee3760fccb8225541ca89f08c927930adf97b88ac", + "outpoint": { + "hash": "977d3a025790e2cbdb50f63761872f36e78fbb9c53d515cb4c53155a1964932d", + "index": 1 + }, + "transaction_hash": "977d3a025790e2cbdb50f63761872f36e78fbb9c53d515cb4c53155a1964932d", + "value": 76779 + } + ] + + + Schema + + { + 'type': 'array', + 'items': { + 'type': 'object', + 'properties': { + 'confirmations': { 'type': 'integer', 'minimum': 0 }, + 'out_script': { 'type': 'string', 'pattern': '^[0-9a-fA-F]+$' }, + 'outpoint': { + 'type': 'object', + 'properties': { + 'hash': { 'type': 'string', 'pattern': '^[0-9a-fA-F]+$' }, + 'index': { 'type': 'integer', 'minimum': 0 }, + }, + }, + 'transaction_hash': { 'type': 'string', 'pattern': '^[0-9a-fA-F]+$' }, + 'value': { 'type': 'integer', 'minimum': 0 }, + }, + }, + } + +## Broadcast transaction [POST /v1/blockchains/{blockchainName}/txs] ++ DEPRECATED. Blockstack clients should use + [blockstack.js](https://github.com/blockstack/blockstack.js) to broadcast +transactions. ++ Authorization: `blockchain` ++ Parameters + + blockchainName : bitcoin (string) - the blockchain to broadcast on ++ Request (application/json) + + Schema + + { + 'type': 'object', + 'properties': { + 'tx': { + 'type': 'string', + 'pattern': OP_HEX_PATTERN, + }, + }, + 'additionalProperties': False, + 'required': [ + 'tx' + ], + } + ++ Response 200 (application/json) + + Body + + { 'status' : True, 'tx_hash' : '...' } + + + Schema + + { + 'anyOf': [ + { + 'type': 'object', + 'properties': { + 'status': { 'type': 'boolean' }, + 'tx_hash': { 'type': 'string', 'pattern': '^[0-9a-fA-F]+$' }, + }, + }, + { + 'type': 'object', + 'properties': { + 'error': { 'type': 'string' }, + }, + }, + ] + } + +# Group Namespace Operations +## Get all namespaces [GET /v1/namespaces] ++ Public Endpoint ++ Response 200 (application/json) + + Body + + { + "namespaces": [ + ".id" + ] + } + +## Get namespace names [GET /v1/namespaces/{tld}/names?page={page}] +Fetch a list of names from the namespace. ++ Public Endpoint ++ Parameters + + tld: id (string) - the namespace to fetch names from + + page: 23 (number) - names are returned in pages of size 100, + so specify the page number. ++ Response 200 (application/json) + + Body + + [ "aldenquimby.id", "aldeoryn.id", + "alderete.id", "aldert.id", + "aldi.id", "aldighieri.id", ... ] + +# Group Resolver Endpoints +## Lookup User [GET /v1/users/{username}] +Lookup and resolver a user's profile. Defaults to the `id` namespace. +Note that [blockstack.js](https://github.com/blockstack/blockstack.js) does +*not* rely on this endpoint. + ++ Public Only Endpoint ++ Subdomain Aware ++ Legacy Endpoint ++ Parameters + + username: fred (string) - username to lookup ++ Response 200 (application/json) + + + + { + "fred.id": { + "owner_address": "1CER5u4QXuqffHjHKrU76iMCsqtJLM5VHu", + "profile": { + "@context": "http://schema.org", + "@type": "Person", + "account": [ + { + "@type": "Account", + "identifier": "fredwilson", + "placeholder": false, + "proofType": "http", + "proofUrl": "https://twitter.com/fredwilson/status/943066895422455809", + "service": "twitter" + } + ], + "description": "I am a VC", + "image": [ + { + "@type": "ImageObject", + "contentUrl": "https://gaia.blockstack.org/hub/1CER5u4QXuqffHjHKrU76iMCsqtJLM5VHu/0/avatar-0", + "name": "avatar" + } + ], + "name": "Fred Wilson" + }, + "public_key": "026c94d1897fa148fa6401247a339b55abd869a3d562fdae8a7fcb9a11f1f846f3", + "verifications": [ + { + "identifier": "fredwilson", + "proof_url": "https://twitter.com/fredwilson/status/943066895422455809", + "service": "twitter", + "valid": true + } + ], + "zone_file": { + "$origin": "fred.id", + "$ttl": 3600, + "uri": [ + { + "name": "_http._tcp", + "priority": 10, + "target": "https://gaia.blockstack.org/hub/1CER5u4QXuqffHjHKrU76iMCsqtJLM5VHu/0/profile.json", + "weight": 1 + } + ] + } + } + } + + +## Profile Search [GET /v1/search?query={query}] +Searches for a profile using a search string. ++ Public Only Endpoint ++ Parameters + + query: wenger (string) - the search query ++ Response 200 (application/json) + + Body + + { + "results": [ + { + "fullyQualifiedName": "albertwenger.id", + "username": "albertwenger", + "profile": { + "@type": "Person", + "account": [ + { + "@type": "Account", + "identifier": "albertwenger", + "proofType": "http", + "service": "twitter" + }, + { + "@type": "Account", + "identifier": "albertwenger", + "proofType": "http", + "service": "facebook" + }, + { + "@type": "Account", + "identifier": "albertwenger", + "proofType": "http", + "service": "github" + }, + { + "@type": "Account", + "identifier": "1QHDGGLEKK7FZWsBEL78acV9edGCTarqXt", + "role": "payment", + "service": "bitcoin" + } + ], + "address": { + "@type": "PostalAddress", + "addressLocality": "New York" + }, + "description": "VC at USV.com", + ... + } + diff --git a/_site/core/atlas_network.md b/_site/core/atlas_network.md new file mode 100644 index 00000000..2d972d32 --- /dev/null +++ b/_site/core/atlas_network.md @@ -0,0 +1,414 @@ +# Atlas Network + +This document describes the Atlas network, a peer-to-peer content-addressed +storage system whose chunks' hashes are announced on a public blockchain. +Atlas allows users and developers to **permanently store** chunks of data that are +**replicated across every peer.** As long as at least one Atlas peer is online, +all chunks are available to clients. + +This document is aimed at developers and technical users. The following +concepts are discussed: + +* What the Atlas network offers developers +* How to load and store data in the Atlas network +* How the Atlas network works internally +* How the Atlas network compares to related content-addressed storage systems + +The reader of this document is expected to be familiar with the [Blockstack +Naming Service](blockstack_naming_service.md) (BNS), as well as Blockstack's +storage system [Gaia](https://github.com/blockstack/gaia). We advise the reader +to familiarize themselves with both systems before approaching this document. + +# Introduction + +Atlas is designed to integrate with BNS in order to allow users to +store name state off-chain, encoded as a DNS zone file. +The overwhelmingly-common use-cases in Blockstack are: + +* Storing a name's routing information for its owners' [Gaia](https://github.com/blockstack/gaia) +datastores. +* Storing BNS subdomain transactions and associated state. + +Atlas is a middleware system in Blockstack. Most developers do not +interact with it directly. BNS clients like the +[Blockstack Browser](https://github.com/blockstack/blockstack-browser) +automatically generate zone files for the names they register, and automatically +propagate them to the Atlas network. BNS API endpoints, including our +[public endpoint](https://core.blockstack.org) and the +[blockstack.js](https://github.com/blockstack/blockstack.js) library, +will automatically fetch zone files from Atlas when they need to look +up data in Gaia (such as profiles and app data). + +``` + +--------------+ +---------------+ +----------------+ +clients | Blockstack | | blockstack.js | | BNS API module | + | Browser | | | | | + +--------------+ +---------------+ +----------------+ + ^ ^ ^ ^ ^ ^ + | | | | | | + | | | | | | + V | V | V | + +----------+ | +----------+ | +----------+ | +Gaia | Gaia hub | | | Gaia hub | | | Gaia hub | | + +----------+ | +----------+ | +----------+ | + | | | + | | | + V V V + +---------------------------------------------------------------+ +Atlas | Atlas Peer Network | + +----------+------+----------+-----+----------+------+----------+ +BNS | BNS node | | BNS node | | BNS node | | BNS node | + +----------+ +----------+ +----------+ +----------+ + ^ ^ ^ ^ + | (indexing | | | + | blockchain) | | | + +---------------------------------------------------------------+ +Blockchain | Blockchain Peer Network | + +---------------------------------------------------------------+ + + +Figure 1: Location of Atlas in the Blockstack architecture. Each BNS node +implements an Atlas peer. An Atlas peer treats a name state value in BNS as +the hash of a DNS zone file. Atlas peers exchange zone files with one another +until they each have a full replica of all known zone files. Clients can look +up zone files for names using the name's stat value as a zone file hash. Clients +can broadcast zone files to the network if they match a previously-announced +hash. In practice, zone files store URLs to a name owner's Gaia hubs, thereby +allowing Blockstack apps to read and write data in Gaia. +``` + +Nevertheless, Atlas is a general-purpose content-addressed storage +system that advanced developers can use to **host data in an immutable +and durable manner.** Beyond its default use-case in Blockstack, +Atlas is ideal for tasks like: + +* Announcing PGP public keys under a human-readable name +* Storing package hashes for a software release +* Securely deploying shell scripts to remote VMs +* Binding human-readable names to Tor .onion addresses + ([example](https://github.com/blockstack-packages/blockstack-tor)) + +# Motivation + +Atlas was designed to augment BNS. BNS allows each name to store a small +amount of state---on the order of 20 bytes. The size is so small because the +state must be recorded to a public blockchain, where the cost per byte is +high and the blockchain protocol limits the size of transactions. + +To compensate for this, we developed an off-chain storage system allows BNS +names to bind and store a large amount of state to each name in a way that +*preserves the security properties of having written that state to the +blockchain*. Instead of storing 20 bytes of data on the blockchain, a BNS name +owner would store the *cryptograhpic hash* of its state, and then store the actual state +Atlas. This decouples the name's state size from the blockchain. + +The reference implementation of Atlas currently allows up to 40kb of state to be +bound to a BNS name, instead of a measly 20 bytes. The 40kb of data is +replicated to each BNS node, where it is stored forever. + +# How to Use the Atlas Network + +While the Blockstack software stack expects that Atlas-hosted data is made up of +DNS zone files, Atlas itself does not enforce this (nor does it care about the +format of its chunks). It is designed as a general-purpose chunk store. +Nevertheless, the ubiquitous use of Atlas to store data as DNS zone files has +had an influence on its API design---fields and method names frequently allude +to zone files and zone file hashes. This is intentional. + +The [public BNS API endpoint](https://core.blockstack.org) does not support +resolving Atlas chunks that do not encode Gaia routing information or subdomain +information. To directly interact with Atlas, developers will need to install +[Blockstack Core](https://github.com/blockstack/blockstack-core) and use its +Python client libraries for these examples. + +## Looking up Chunks + +All Atlas chunks are addressed by the RIPEMD160 hash of the SHA256 hash of the +chunk data. A client can query up to 100 chunks in one RPC call. + +A client can look up a chunk with the `get_zonefiles()` method. If successful, +the returned payload will be a `dict` with a `zonefiles` key that maps the chunk +hashes to their respective data. + +```python +>>> import blockstack +>>> data = blockstack.lib.client.get_zonefiles('https://node.blockstack.org:6263', ['1b89a685f4c4ea245ce9433d0b29166c22175ab4']) +>>> print data['zonefiles']['1b89a685f4c4ea245ce9433d0b29166c22175ab4'] +$ORIGIN duckduckgo_tor.id +$TTL 3600 +tor TXT "3g2upl4pq6kufc4m.onion" + +>>> +``` + +(This particular chunk happens to be associated with the BNS name +`duckduckgo_tor.id`). + +## Adding a New Chunk + +The only way to add a chunk to Atlas is to do so through an on-chain name in +BNS. Adding a new chunk is a two-step process: + +* The name owner announces the chunk hash as a name's state +via a `NAME_REGISTRATION`, `NAME_UPDATE`, `NAME_RENEWAL`, or `NAME_IMPORT` transaction. +* Once the transaction is confirmed and processed by BNS, the name owner + broadcasts the matching zone file. + +Setting a name's state to be the hash of a chunk is beyond the scope of this +document, since it needs to be done through a BNS client. +See the relevant documentation for +[blockstack.js](https://github.com/blockstack/blockstack.js) and the [Blockstack +Browser](https://github.com/blockstack/blockstack-browser) for doing this. + +Once the name operation is confirmed, you can announce the data to the +Atlas network. You can do so with the Python client as follows: + +```python +>>> import blockstack +>>> import base64 +>>> data = "..." # this is the chunk data you will announce +>>> data_b64 = base64.b64encode(data) +>>> result = blockstack.lib.client.put_zonefiles('https://node.blockstack.org:6263', [data_b64]) +>>> assert result['saved'][0] == 1 +>>> +``` + +At most five chunks can be announced in one RPC call. +Note that the data must be base64-encoded before it can be announced. + +When the `put_zonefiles()` method succeeds, it returns a `dict` with a list +under the `saved` key. Here, `result['saved'][i]` will be 1 if the `i`th +chunk given to `put_zonefiles()` was saved by the node, and 0 if not. +The node will not save a chunk if it is too big, or if it has not yet processed +the name operation that contained the chunk's hash. + +The `put_zonefiles()` method is idempotent. + +## Propagating Chunks + +Atlas peers will each store a copy of the chunks you announce. In the +background, they will asynchronously announce to one another which chunks they +have available, and replicate them to one another in a rarest-first order (much +like how BitTorrent works). Eventually, every Atlas peer will receive the +chunk. + +However, developers can accelerate this process by eagerly propagating chunks. +To do so, they can ask an Atlas peer for its immediate neighbors in the Atlas +peer graph, and replicate the chunk to each of them as well. + +For example, this code will replicate the chunk to not only +`https://node.blockstack.org:6263`, but also to its immediate neighbors. + +```python +>>> import blockstack +>>> import base64 +>>> data = "..." # this is the chunk you will replicate widely +>>> data_b64 = base64.b64encode(data) +>>> +>>> result = blockstack.lib.client.get_atlas_peers('https://node.blockstack.org:6263') +>>> neighbors = result['peers'] +>>> print ", ".join(neighbors) +13.65.207.163:6264, 52.225.128.191:6264, node.blockstack.org:6264, 23.102.162.7:6264, 52.167.230.235:6264, 23.102.162.124:6264, 52.151.59.26:6264, 13.92.134.106:6264 +>>> +>>> for neighbor in neighbors: +... result = blockstack.lib.client.put_zonefiles(neighbor, [data_b64]) +... assert result['saved'][0] == 1 +... +>>> +``` + +This is not strictly necessary, but it does help accelerate chunk replication +and makes it less likely that a chunk will get lost due to individual node +failures. + +# How Atlas Works + +Atlas was designed to overcome the structural weaknesses inherent to all +distributed hash tables. In particular, it uses an unstructured peer network to +maximize resilience against network link failure, and it uses the underlying +blockchain (through BNS) to rate-limit chunk announcements. + +## Peer Selection + +Atlas peers self-organize into an unstructured peer-to-peer network. +The Atlas peer network is a [random K-regular +graph](https://en.wikipedia.org/wiki/Random_regular_graph). Each node maintains +*K* neighbors chosen at random from the set of Atlas peers. + +Atlas nodes select peers by carrying out an unbiased random walk of the peer +graph. When "visiting" a node *N*, it will ask for *N*'s neighbors and then +"step" to one of them with a probability dependent on *N*'s out-degree and the +neighbor's in-degree. + +The sampling algorithm is based on the Metropolis-Hastings (MH) random graph walk +algorithm, but with a couple key differences. In particular, the algorithm +attempts to calculate an unbiased peer graph sample that accounts for the fact +that most nodes will be short-lived or unreliable, while a few persistent nodes +will remain online for long periods of time. The sampling algorithm accounts +for this with the following tweaks: + +* If the neighbors of the visited node *N* are all unresponsive, the random +walk resets to a randomly-chosen known neighbor. There is no back-tracking on +the peer graph in this case. + +* The transition probability from *N* to a live neighbor is *NOT* `min(1, +degree(neighbor)/degree(N))` like it is in the vanilla MH algorithm. Instead, +the transition probability discourages backtracking to the previous neighbor *N_prev*, +but in a way that still guarantees that the sampling will remain unbiased. + +* A peer does not report its entire neighbor set when queried, +but only reports a random subset of peers that have met a minimium health threshold. + +* A new neighbor is only selected if it belongs to the same [BNS + fork-set](blockstack_naming_service.md#bns-forks) (i.e. it reports +as having a recent valid consensus hash). + +The algorithm was adapted from the work from [Lee, Xu, and +Eun](https://arxiv.org/pdf/1204.4140.pdf) in the proceedings of +ACM SIGMETRICS 2012. + +### Comparison to DHTs + +The reason Atlas uses an unstructured random peer network +instead of a [distributed hash table](https://en.wikipedia.org/wiki/Distributed_hash_table) +(DHT) is that DHTs are susceptbile to Sybil attacks. An adaptive adversary can +insert malicious nodes into the DHT in order to stop victims from +resolving chunks or finding honest neighbors. + +#### Chunk Censorship + +In a DHT, an attacker can censor a chunk by inserting nodes into the peers' routing tables +such that the attacker takes control over all of the chunk's hash buckets. +It can do so at any point in time after the chunk was first stored, +because only the peers who maintain the chunk's hash bucket have to store it. +This is a *fundamental* problem with structured overlay networks +that perform request routing based on content hash---they give the attacker +insight as to the path(s) the queries take through the peer graph, and thus +reduce the number of paths the attacker must disrupt in order to censor the +chunk. + +Atlas uses an unstructured overlay network combined with a 100% chunk +replication strategy in order to maximize +the amount of work an adversary has to do to censor a chunk. +In Atlas, all peers replicate a chunk, and the paths the chunk take through the +network are *independent* of the content and *randomized* by the software +(so the paths cannot be predicted in advance). The attacker's only +recourse is to quickly identify the nodes that can serve the chunk and partition them from +the rest of the network in order to carry out a censorship attack. +This requires them to have visibility into the vast majority of network links in +the Atlas network (which is extremely difficult to do, because in practice Atlas +peers maintain knowledge of up to 65536 neighbors and only report 10 random peers +when asked). + +#### Neighbor Censorship + +Another problem with DHTs is that their overlay +network structure is determined by preferential attachment. Not every peer that +contacts a given DHT node has an equal chance of becoming its neighbor. +The node will instead rank a set of peers as being more or less ideal +for being neighbors. In DHTs, the degree of preference a node exhibits to +another node is usually a function of the node's self-given node identifier +(e.g. a node might want to select neighbors based on proximity in the key +space). + +The preferential attachment property means that an adaptive adversary can game the node's +neighbor selection algorithm by inserting malicious nodes that do not +forward routing or lookup requests. The attacker does not even have to eclipse +the victim node---the victim node will simply prefer to talk to the attacker's unhelpful nodes +instead of helpful honest nodes. In doing so, the attacker can prevent honest peers from discovering each +other and each other's chunks. + +Atlas's neighbor selection strategy does not exhibit preferential attachment +based on any self-reported node properties. A +node is selected as a neighbor only if it is reached through an unbiased random graph +walk, and if it responds to queries correctly. +In doing so, an attacker is forced to completely eclipse a set of nodes +in order to cut them off from the rest of the network. + +## Chunk Propagation + +Atlas nodes maintain an *inventory* of chunks that are known to exist. Each +node independently calculates the chunk inventory from its BNS database. +Because the history of name operations in BNS is linearized, each node can +construct a linearized sub-history of name operations that can set chunk +hashes as their name state. This gives them a linearized sequence of chunks, +and every Atlas peer will independently arrive at the same sequence by reading +the same blockchain. + +Atlas peers keep track of which chunks are present and which are absent. They +each construct an *inventory vector* of chunks *V* such that *V[i]* is set to 1 +if the node has the chunk whose hash is in the *i*th position in the chunk +sequence (and set to 0 if it is absent). + +Atlas peers exchange their inventory vectors with their neighbors in order to +find out which chunks they each have. Atlas nodes download chunks from +neighbors in rarest-first order in order to prioritize data replication for the +chunks that are currently most at-risk for disappearing due to node failure. + +``` + Name operation | chunk hashes | chunk data | Inventory + history | as name state | | vector + ++-------------------+ +| NAME_PREORDER | ++-------------------+----------------+ +| NAME_REGISTRATION | chunk hash | "0123abcde..." 1 ++-------------------+----------------+ +| NAME_UPDATE | chunk hash | (null) 0 ++-------------------+----------------+ +| NAME_TRANSFER | ++-------------------+ +| NAME_PREORDER | ++-------------------+----------------+ +| NAME_IMPORT | chunk hash | "4567fabcd..." 1 ++-------------------+----------------+ +| NAME_TRANSFER | ++-------------------| + . . . + + +Figure 2: Relationship between Atlas node chunk inventory and BNS name state. +Some name operations announce name state in the blockchain, which Atlas +interprets as a chunk hash. The Atlas node builds up a vector of which chunks +it has and which ones it does not, and announces it to other Atlas peers so +they can fetch chunks they are missing. In this example, the node's +inventory vector is [1, 0, 1], since the 0th and 2nd chunks are present +but the 1st chunk is missing. +``` + +## Querying Chunk Inventories + +Developers can query a node's inventory vector as follows: + +```python +>>> import blockstack +>>> result = blockstack.lib.client.get_zonefile_inventory("https://node.blockstack.org:6263", 0, 524288) +>>> print len(result['inv']) +11278 +>>> +``` + +The variable `result['inv']` here is a big-endian bit vector, where the *i*th +bit is set to 1 if the *i*th chunk in the chunk sequence is present. The bit at +`i=0` (the earliest chunk) refers to the leftmost bit. + +A sample program that inspects a set of Atlas nodes' inventory vectors and determines +which ones are missing which chunks can be found +[here](https://github.com/blockstack/atlas/blob/master/atlas/atlas-test). + +# Appendix 1: Feature Comparison + +Atlas is not the only peer-to-peer content-addressible chunk store in existance. The following +feature table describes Atlas in relation to other popular chunk stores. + +| **Features** | Atlas | BitTorrent | [DAT](https://datproject.org/) | [IPFS](https://ipfs.io) | [Swarm](https://github.com/ethersphere/swarm) | +|-----------------------------|-------|------------|--------------------------------|-------------------------|-----------------------------------------------| +| Each peer stores all chunks | X | X | | | | +| Replicas are permanent [1] | X | X | X | | | +| Replicas are free | | X | X | X | | +| Sybil-resistant chunk discovery | X | X | | | X | +| Sybil-resistant peer discovery | X | | | | | +| Fixed chunk size | X | | X | X | X | + +[1] Here, "permanent" means that once a peer has data, they will never evict it +as part of the protocol. diff --git a/_site/core/attic/README.md b/_site/core/attic/README.md new file mode 100644 index 00000000..33ae11f7 --- /dev/null +++ b/_site/core/attic/README.md @@ -0,0 +1,4 @@ +# Legacy Documentation + +Documents here are out-of-date but preserved for posterity. Do not rely on +them. diff --git a/_site/core/attic/advanced_usage.md b/_site/core/attic/advanced_usage.md new file mode 100644 index 00000000..5d75b35e --- /dev/null +++ b/_site/core/attic/advanced_usage.md @@ -0,0 +1,124 @@ +# Advanced Usage + +This section details some of the advanced features in the CLI. + +## A Word of Warning + +Advanced features are meant to be used by experienced Blockstack users and developers, They receive less UI/UX testing than basic features, and their interfaces are expected to change to accomodate bugfixes and security fixes. Moreover, improper use of some advanced methods can cost you money, corrupt your profile, or compromise your wallet. Once they receive sufficient testing, an advanced feature may become a basic-mode feature in a subsequent release. + +**Do not use advanced mode unless you know what you are doing!** + +## Activating Advanced Mode + +To activate advanced mode, use the command `blockstack set_advanced_mode on`. + +To deactivate it later (recommended), use the command `blockstack set_advanced_mode off`. + +## Changing or Using Exiting Keys + +If you already have a payment key you want to use, or an owner key you want to migrate over, you can generate a wallet directly with `import_wallet`. We recommend using this command interactively, so you know which keys correspond to which usages. + +## Accounts + +With the accounts methods, you can directly manage your social proofs, link existing services to your profile, and store small bits of information. + +The account management methods are: +* `get_account`: Look up an account in a name's profile. There can be more than one match. +* `list_accounts`: List all accounts in a name's profile. +* `put_account`: Add or update an account in a name's profile. +* `delete_account`: Remove an account from a name's profile. This may need to be done more than once, if there are duplicates of the account. + +## Advanced Blockstack ID Queries + +Beyond `lookup` and `whois`, there are a few other more advanced queries you can run on Blockstack IDs. These include: + +### Listing Blockstack IDs +* `get_all_names`: Get the list of every single Blockstack ID in existance. +* `get_names_owned_by_address`: Get the list of names owned by a particular ownership address. + +### Querying the Blockchain +* `get_name_blockchain_record`: Get the raw database record for a Blockstack ID. It will contain a *compressed* history of all name operations that have affected it. This is meant primarily for debugging purposes; to get an easier-to-parse listing of the information this command returns, use `get_name_blockchain_history`. +* `get_name_blockchain_history`: Get the set of all prior states a Blockstack ID has been in, keyed by the block heights at which the state-change was processed. +* `get_records_at`: Get the list of name operation records processed at a particular block height. +* `list_update_history`: Get the list of all zonefile hashes that a Blockstack ID has ever had. + +### Zonefiles +* `get_name_zonefile`: Get only a Blockstack ID's zonefile. +* `list_zonefile_history`: Get the list of all zonefiles a Blockstack ID has ever had. **NOTE:** There is no guarantee that the server will hold copies of old zonefiles. This command is meant mainly for determining which historic zonefiles a server has processed. +* `set_zonefile_hash`: This is the counterpart to `update`, but instead of setting the zonefile directly and uploading it to storage, you can use this command to directly set the data hash for a Blockstack ID. **NOTE:** You should ensure that the associated zonefile data has been replicated off-chain to a place where other users can get at it. + +### Lightweight Queries + +The lightweight lookup protocol for Blockstack is called *Simplified Name Verification* (SNV). This command returns a prior blockchain-level record given a more recent known-good consensus hash, serial number, or transaction ID of a transaction that contains a consensus hash. The CLI does not need to trust the Blockstack server to use these commands. + +* `lookup_snv`: Use the Merkle skip-list in the name database to look up a historic name operation on a Blockstack ID. + +## Consensus Queries + +You can query consensus hash information from the server with the following commands: + +* `consensus`: Get the consensus hash at a particular block height + +## Namespace Queries + +In addition to querying Blockstack IDs, the CLI has advanced commands for querying namespaces. These include: + +* `get_namespace_blockchain_record`: Get the raw database record for a Blockstack namespace. It will contain a *compressed* history of all namespace operations that have affected it. +* `get_names_in_namespace`: Get the list of every Blockstack ID in a particular namespace. +* `get_namespace_cost`: Get the cost required to preorder a namespace. Does *not* include the cost to reveal and ready it, nor does it include the transaction fees. + +## Namespace Creation + +**WARNING:** We do not recommend that you try to do this by yourself. Creating a namespace is **EXTREMELY EXPENSIVE**. If you are interested in creating your own namespace, please contact the Blockstack developers on the [Blockstack Slack](http://chat.blockstack.org). + +These methods allow you to create a namespace. There are three steps: preordering, revealing, and readying. Preordering a namespace is like preordering a name--you announce the hash of the namespace ID and the address that will control it. Revealing a namespace not only reveals the namespace ID, but also sets the pricing and lifetime rules for names in the namespace. After revealing the namespace, the namespace controller can pre-populate the namespace by importing Blockstack IDs. Once the namespace has been pre-populated, the controller sends a final transaction that readies the namespace for general use. + +* `namespace_preorder`: Preorder a namespace. +* `namespace_reveal`: Reveal a namespace, and set its pricing and lifetime parameters. **NOTE:** This must be done within 144 blocks of sending the namespace preorder transaction. +* `name_import`: Import a name into a revealed (but not readied) namespace. You can set its owner address and zonefile hash directly. +* `namespace_ready`: Open a namespace for general registrations. + +## Data Storage + +Blockstack allows users to store arbitrary data to any set of storage providers for which the CLI has a driver. The data will be signed by the user's data key, so when other users read the data later on, they can verify that it is authentic (i.e. the storage provider is not trusted). Moreover, Blockstack is designed such that users don't have to know or care about which storage providers were used--as far as users can see, storage providers are just shared hard drives. + +There are two types of data supported by Blockstack: *mutable* data, and *immutable* data. Mutable data is linked by the profile, and can be written as fast and as frequently as the storage provider allows. Mutable data is addressed by URL. + +**WARNING:** While mutable data guarantees end-to-end authenticity, there is a chance that a malicious storage provider can serve new readers stale versions of the data. That is, users who have read the latest data already will not get tricked into reading stale data, but users who have *not yet* read the latest data *can* be tricked (i.e. the CLI keeps a version number for mutable data to do so). This must be taken into account if you intend to use this API. + +Immutable data, however, is content-addressed, and its cryptographic hash is stored to the user's zonefile. Writing immutable data will entail updating the zonefile and sending an `update` transaction (handled internally), so it will be slow by comparison. This has the advantage that storage providers cannot perform the aforementioned stale data attack, but has the downside that writes cost money and take a long time to complete. + +That said, we recommend using the mutable data API with several different storage providers whenever possible. + +### Mutable Data + +The following commands affect mutable data: + +* `get_mutable`: Use the profile to look up and fetch a piece of mutable data. +* `put_mutable`: Add a link to mutable data to the profile, and replicate the signed data itself to all storage providers. Other users will need the data's name to read it with `get_mutable`. +* `delete_mutable`: Remove a link to mutable data from the profile, and ask all storage providers to delete the signed data. + +### Immutable Data + +The following commnds affect immutable data: + +* `get_immutable`: Look up and fetch a piece of immutable data. You can supply either the name of the data, or its hash (both are stored in the zonefile, so there is no gain or loss of security in this choice). +* `put_immutable`: Replicate a piece of data to all storage providers, add its name and hash to the zonefile, and issue an `update` to upload the new zonefile to Blockstack servers and write the hash to the blockchain. +* `delete_immutable`: Remove the link to the data from the zonefile, ask all storage providers to delete the data, and issue an `update` to upload the new zonefile to Blockstack servers and write the new hash to the blockchain. +* `list_immutable_data_history`: Given the name of a piece of immutable data, query the zonefile history to find the historic list of hashes it has had. **NOTE:** Like `list_zonefile_history` above, this only returns data hashes for the data if the Blockstack server has the historic zonefile. + +## Fault Recovery + +Sometimes, things beyond our control can happen. Transactions can get stuck, storage providers can go offline or corrupt data, and so on. These commands are meant to assist in recovering from these problems: + +* `set_profile`: Directly set a Blockstack ID's profile. All previous accounts, data links, etc. must be included in the new profile, since the old profile (if still present) will be overwritten by the one given here. +* `convert_legacy_profile`: Given a legacy profile taken from a resolver, directly convert it into a new profile. This can be used with `set_profile` to recover from a failed profile migration. +* `unqueue`: If a transaction gets lost or stuck, you can remove it from the CLI's transaction queue with this command. This will allow you to re-try it. +* `rpcctl`: This lets you directly start or stop the Blockstack CLI's background daemon, which lets you recover from any crashes it experiences (you can find a trace of its behavior in `~/.blockstack/api_endpoint.log`) + +## Programmatic Access + +Other programs may want to make RPC calls the Blockstack CLI daemon. They can do so using either the `blockstack_client` Python package, or they can do so via the CLI as follows: + +* `rpc`: Issue a JSON RPC call. Takes a raw JSON string that encodes a list of arguments. + diff --git a/_site/core/attic/figures/gaia-authentication.png b/_site/core/attic/figures/gaia-authentication.png new file mode 100644 index 00000000..03ca186e Binary files /dev/null and b/_site/core/attic/figures/gaia-authentication.png differ diff --git a/_site/core/attic/figures/gaia-connect.png b/_site/core/attic/figures/gaia-connect.png new file mode 100644 index 00000000..34ab7947 Binary files /dev/null and b/_site/core/attic/figures/gaia-connect.png differ diff --git a/_site/core/attic/figures/gaia-getfile.png b/_site/core/attic/figures/gaia-getfile.png new file mode 100644 index 00000000..29d87c72 Binary files /dev/null and b/_site/core/attic/figures/gaia-getfile.png differ diff --git a/_site/core/attic/figures/gaia-listdir.png b/_site/core/attic/figures/gaia-listdir.png new file mode 100644 index 00000000..b48072b7 Binary files /dev/null and b/_site/core/attic/figures/gaia-listdir.png differ diff --git a/_site/core/attic/figures/gaia-putfile.png b/_site/core/attic/figures/gaia-putfile.png new file mode 100644 index 00000000..6ad02a5b Binary files /dev/null and b/_site/core/attic/figures/gaia-putfile.png differ diff --git a/_site/core/attic/gaia.md b/_site/core/attic/gaia.md new file mode 100644 index 00000000..b63e0536 --- /dev/null +++ b/_site/core/attic/gaia.md @@ -0,0 +1,461 @@ +# LEGACY DOCUMENTATION + +Please see the [latest Gaia documentation](https://github.com/blockstack/gaia) + +Gaia: The Blockstack Storage System +==================================== + +The Blockstack storage system, called "Gaia", is used to host each user's data +without requiring users to run their own servers. + +Gaia works by hosting data in one or more existing storage systems of the user's choice. +These storage systems include cloud storage systems like Dropbox and Google +Drive, they include personal servers like an SFTP server or a WebDAV server, and +they include decentralized storage systems like BitTorrent or IPFS. The point +is, the user gets to choose where their data lives, and Gaia enables +applications to access it via a uniform API. + +A high-level analogy is to compare Gaia to the VFS and block layer in a UNIX +operating system kernel, and to compare existing storage systems to block +devices. Gaia has "drivers" for each storage system that allow it to load, +store, and delete chunks of data via a uniform interface, and it gives +applications a familiar API for organizing their data. + +Applications interface with Gaia via the [Blockstack Core +API](https://github.com/blockstack/blockstack-core/tree/master/api). Javascript +applications connect to Gaia using [Blockstack Portal](https://github.com/blockstack/blockstack-portal), +which helps them bootstrap a secure connection to Blockstack Core. + +# Datastores + +Gaia organizes data into datastores. A **datastore** is a filesystem-like +collection of data that is backed by one or more existing storage systems. + +When a user logs into an application, the application will create or connect to +the datastore that holds the user's data. Once connected, it can proceed to +interact with its data via POSIX-like functions: `mkdir`, `listdir`, `rmdir`, +`getFile`, `putFile`, `deleteFile`, and `stat`. + +A datastore has exactly one writer: the user that creates it. However, all data +within a datastore is world-readable by default, so other users can see the +owner's writes even when the owner is offline. Users manage access controls +by encrypting files and directories to make them readable to other specific users. +All data in a datastore is signed by a datastore-specific key on write, in order +to guarantee that readers only consume authentic data. + +The application client handles all of the encryption and signing. The other +participants---Blockstack Portal, Blockstack Core, and the storage +systems---only ferry data back and forth between application clients. + +## Data Organization + +True to its filesystem inspiration, data in a datastore is organized into a +collection of inodes. Each inode has two parts: + +* a **header**, which contains: + + * the inode type (i.e. file or directory) + + * the inode ID (i.e. a UUID4) + + * the hash of the data it stores + + * the size of the data it stores + + * a signature from the user + + * the version number + + * the ID of the device from which it was sent (see Advanced Topics below) + +* a **payload**, which contains the raw bytes to be stored. + + * For files, this is just the raw bytes. + + * For directories, this is a serialized data structure that lists the names + and inode IDs of its children, as well as a copy of the header. + +The header has a fixed length, and is somewhat small--only a few hundred bytes. +The payload can be arbitrarily large. + +## Data Consistency + +The reason for organizing data this way is to make cross-storage system reads +efficient, even when there are stale copies of the data available. In this +organization, reading an inode's data is a matter of: + +1. Fetching all copies of the header + +2. Selecting the header with the highest version number + +3. Fetching the payload from the storage system that served the latest header. + +This way, we can guarantee that: + +* The inode payload is fetched *once* in the common case, even if there are multiple stale copies of the inode available. + +* All clients observe the *strongest* consistency model offerred by the + underlying storage providers. + +* All readers observe a *minimum* consistency of monotonically-increasing reads. + +* Writers observe sequential consistency. + +This allows Gaia to interface with decentralized storage systems that make +no guarantees regarding data consistency. + +*(Aside 1: The Core node keeps track of the highest last-seen inode version number, +so if all inodes are stale, then no data will be returned).* + +*(Aside 2: In step 3, an error path exists whereby all storage systems will be +queried for the payload if the storage system that served the fresh inode does +not have a fresh payload).* + +# Accessing the Datastore + +Blockstack applications get access to the datastore as part of the sign-in +process. Suppose the user wishes to sign into the application `foo.app`. Then, +the following protocol is executed: + +![Gaia authentication](/docs/figures/gaia-authentication.png) + +1. Using `blockstack.js`, the application authenticates to Blockstack Portal via +`makeAuthRequest()` and `redirectUserToSignIn()`. + +2. When Portal receives the request, it contacts the user's Core node to get the + list of names owned by the user. + +3. Portal redirects the user to a login screen, and presents the user with the + list of names to use. The user selects which name to sign in as. + +4. Now that Portal knows which name to use, and which application is signing in, + it loads the datastore private key and requests a Blockstack Core session +token. This token will be used by the application to access Gaia. + +5. Portal creates an authentication response with `makeAuthResponse()`, which it + relays back to the application. + +6. The application retrieves the datastore private key and the Core session + token from the authentication response object. + + +## Creating a Datastore + +Once the application has a Core session token and the datastore private key, it +can proceed to connect to it, or create it if it doesn't exist. To do so, the +application calls `datastoreConnectOrCreate()`. + +This method contacts the Core node directly. It first requests the public +datastore record, if it exists. The public datastore record +contains information like who owns the datastore, when it was created, and which +drivers should be used to load and store its data. + +![Gaia connect](/docs/figures/gaia-connect.png) + +Suppose the user signing into `foo.app` does not yet have a datastore, and wants +to store her data on storage providers `A`, `B`, and `C`. Then, the following +protocol executes: + +1. The `datastoreConnectOrCreate()` method will generate a signed datastore record +stating that `alice.id`'s public key owns the datastore, and that the drivers +for `A`, `B`, and `C` should be loaded to access its data. + +2. The `datastoreConnectOrCreate()` method will call `mkdir()` to create a +signed root directory. + +3. The `datastoreConnectOrCreate()` method will send these signed records to the Core node. +The Core node replicates the root directory header (blue path), the root +direcory payload (green path), and the datastore record (gold path). + +4. The Core node then replicates them with drivers `A`, `B`, and `C`. + +Now, storage systems `A`, `B`, and `C` each hold a copy of the datastore record +and its root directory. + +*(Aside: The datastore record's consistency is preserved the same way as the +inode consistency).* + +## Reading Data + +Once the application has a Core session token, a datastore private key, and a +datastore connection object, it can proceed to read it. The available methods +are: + +* `listDir()`: Get the contents of a directory + +* `getFile()`: Get the contents of a file + +* `stat()`: Get a file or directory's header + +Reading data is done by path, just as it is in UNIX. At a high-level, reading +data involes (1) resolving the path to the inode, and (2) reading the inode's +contents. + +Path resolution works as it does in UNIX: the root directory is fetched, then +the first directory in the path, then the second directory, then the third +directory, etc., until either the file or directory at the end of the path is +fetched, or the name does not exist. + +### Authenticating Data + +Data authentication happens in the Core node,. +This is meant to enable linking files and directories to legacy Web +applications. For example, a user might upload a photo to a datastore, and +create a public URL to it to share with friends who do not yet use Blockstack. + +By default, the Core node serves back the inode payload data +(`application/octet-stream` for files, and `application/json` for directories). +The application client may additionally request the signatures from the Core +node if it wants to authenticate the data itself. + +### Path Resolution + +Applications do not need to do path resolution themselves; they simply ask the +Blockstack Core node to do so on their behalf. Fetching the root directory +works as follows: + +1. Get the root inode ID from the datastore record. + +2. Fetch all root inode headers. + +3. Select the latest inode header, and then fetch its payload. + +4. Authenticate the data. + +For example, if a client wanted to read the root directory, it would call +`listDir()` with `"/"` as the path. + +![Gaia listdir](/docs/figures/gaia-listdir.png) + +The blue paths are the Core node fetching the root inode's headers. The green +paths are the Core node selecting the latest header and fetching the root +payload. The Core node would reply the list of inode names within the root +directory. + +Once the root directory is resolved, the client simply walks down the path to +the requested file or directory. This involves iteratively fetching a +directory, searching its children for the next directory in the path, and if it +is found, proceeding to fetch it. + +### Fetching Data + +Once the Core node has resolved the path to the base name, it looks up the inode +ID from the parent directory and fetches it from the backend storage providers +via the relevant drivers. + +For example, fetching the file `/bar` works as follows: + +![Gaia getFile](/docs/figures/gaia-getfile.png) + +1. Resolve the root directory (blue paths) + +2. Find `bar` in the root directory + +3. Get `bar`'s headers (green paths) + +4. Find the latest header for `bar`, and fetch its payload (gold paths) + +5. Return the contents of `bar`. + +## Writing Data + +There are three steps to writing data: + +* Resolving the path to the inode's parent directory + +* Creating and replicating the new inode + +* Linking the new inode to the parent directory, and uploading the new parent + directory. + +All of these are done with both `putFile()` and `mkdir()`. + +### Creating a New Inode + +When it calls either `putFile()` or `mkdir()`, the application client will +generate a new inode header and payload and sign them with the datastore private +key. Once it has done so successfully, it will insert the new inode's name and +ID into the parent directory, give the parent directory a new version number, +and sign and replicate it and its header. + +For example, suppose the client attempts to write the data `"hello world"` to `/bar`. +To do so: + +![Gaia putFile](/docs/figures/gaia-putfile.png) + +1. The client executes `listDir()` on the parent directory, `/` (blue paths). + +2. If an inode by the name of `bar` exists in `/`, then the method fails. + +3. The client makes a new inode header and payload for `bar` and signs them with + the datastore private key. It replicates them to the datastore's storage +drivers (green paths). + +4. The client adds a record for `bar` in `/`'s data obtained from (1), + increments the version for `/`, and signs and replicates `/`'s header and +payload (gold paths). + + +### Updating a File or Directory + +A client can call `putFile()` multiple times to set the file's contents. In +this case, the client creates, signs, and replicates a new inode header and new +inode payload for the file. It does not touch the parent directory at all. +In this case, `putFile()` will only succeed if the parent directory lists an +inode with the given name. + +A client cannot directly update the contents of a directory. + +## Deleting Data + +Deleting data can be done with either `rmdir()` (to remove an empty directory) +or `deleteFile()` (to remove a file). In either case, the protocol executed is + +1. The client executes `listDir()` on the parent directory + +2. If an inode by the given name does not exist, then the method fails. + +3. The client removes the inode's name and ID from the directory listing, signs + the new directory, and replicates it to the Blockstack Core node. + +4. The client tells the Blockstack Core node to delete the inode's header and + payload from all storage systems. + + +# Advanced Topics + +These features are still being implemented. + +## Data Integrity + +What happens if the client crashes while replicating new inode state? What +happens if the client crashes while deleting inode state? The data hosted in +the underlying data stores can become inconsistent with the directory structure. + +Given the choice between leaking data and rendering data unresolvable, Gaia +chooses to leak data. + +### Partial Inode-creation Failures + +When creating a file or directory, Gaia stores four records in this order: + +* the new inode payload + +* the new inode header + +* the updated parent directory payload + +* the updated parent directory header + +If the new payload replicates successfully but the new header does not, then the +new payload is leaked. + +If the new payload and new header replicate successfully, but neither parent +directory record succeeds, then the new inode header and payload are leaked. + +If the new payload, new header, and updated parent directory payload replicate +successfully, but the updated parent header fails, then not only are the new +inode header and payload leaked, but also *reading the parent directory will +fail due to a hash mismatch between its header and inode*. This can be detected +and resolved by observing that the copy of the header in the parent directory +payload has a later version than the parent directory header indicates. + +### Partial Inode-deletion Failures + +When deleting a file or directory, Gaia alters records in this order: + +* update parent directory payload + +* update parent directory header + +* delete inode header + +* delete inode payload + +Similar to partial failures from updating parent directories when creating +files, if the client replicates the new parent directory inode payload but fails +before it can update the header, then clients will detect on the next read that +the updated payload is valid because it has a signed inode header with a newer +version. + +If the client successfully updates the parent directory but fails to delete +either the inode header or payload, then they are leaked. However, since the +directory was updated, no correct client will access the deleted inode data. + +### Leak Recovery + +Gaia's storage drivers are designed to keep the inode data they store in a +"self-contained" way (i.e. within a single folder or bucket). In the future, +we will implement a `fsck`-like tool that will scan through a datastore and find +the set of inode headers and payloads that are no longer referenced and delete +them. + +## Multi-Device Support + +Contemporary users read and write data across multiple devices. In this +document, we have thus far described datastores with the assumption that there +is a single writer at all times. + +This assumption is still true in a multi-device setting, since a user is +unlikely to be writing data with the same application simultaneously from two +different devices. + +However, an open question is how multiple devices can access the same +application data for a user. Our design goal is to **give each device its own +keyring**, so if it gets lost, the user can revoke its access without having to +re-key her other devices. + +To do so, we'll expand the definition of a datastore to be a **per-user, +per-application, and per-device** collection of data. The view of a user's +application data will be constructed by merging each device-specific +datastore, and resolving conflicts by showing the "last-written" inode (where +"last-written" is determined by a loosely-synchronized clock). + +For example, if a user uploads a profile picture from their phone, and then +uploads a profile picture from their tablet, a subsequent read will query the +phone-originated picture and the tablet-originated picture, and return the +tablet-originated picture. + +The aforementioned protocols will need to be extended to search for inode +headers not only on each storage provider, but also search for inodes on the +same storage provider that may have been written by each of the user's devices. +Without careful optimization, this can lead to a lot of inode header queries, +which we address in the next topic. + +## A `.storage` Namespace + +Blockstack Core nodes can already serve as storage "gateways". That is, one +node can ask another node to store its data and serve it back to any reader. + +For example, Alice can make her Blockstack Core node public and program it to +store data to her Amazon S3 bucket and her Dropbox account. Bob can then post data to Alice's +node, causing her node to replicate data to both providers. Later, Charlie can +read Bob's data from Alice's node, causing Alice's node to fetch and serve back +the data from her cloud storage. Neither Bob nor Charlie have to set up accounts on +Amazon S3 and Dropbox this way. + +Since Alice is on the read/write path between Bob and Charlie and cloud storage, +she has the opportunity to make optimizations. First, she can program her +Core node to synchronously write data to +local disk and asynchronously back it up to S3 and Dropbox. This would speed up +Bob's writes, but at the cost of durability (i.e. Alice's node could crash +before replicating to the cloud). + +In addition, Alice can program her Core node to service all reads from disk. This +would speed up Charlie's reads, since he'll get the latest data without having +to hit back-end cloud storage providers. + +Since Alice is providing a service to Bob and Charlie, she will want +compensation. This can be achieved by having both of them send her money via +the underlying blockchain. + +To do so, she would register her node's IP address in a +`.storage` namespace in Blockstack, and post her rates per GB in her node's +profile and her payment address. Once Bob and Charlie sent her payment, her +node would begin accepting reads and writes from them up to the capacity +purchased. They would continue sending payments as long as Alice provides them +with service. + +Other experienced node operators would register their nodes in `.storage`, and +compete for users by offerring better durability, availability, performance, +extra storage features, and so on. diff --git a/_site/core/basic_usage.md b/_site/core/basic_usage.md new file mode 100644 index 00000000..b579a046 --- /dev/null +++ b/_site/core/basic_usage.md @@ -0,0 +1,324 @@ +# Basic Usage + +This section describes the basic features of Blockstack CLI. This document is meant to supplement the built-in documentation in the tool. + +If at any point you forget how to use a particular CLI command, you can just type `blockstack `, and you will be interactively prompted for each piece of data it needs. + +## Client Setup + +By default, the CLI tool will automatically configure itself with sensible defaults. If you don't like the defaults, you can change them by running `blockstack configure`. + +In particular, you can enable the advanced features with `blockstack set_advanced_mode on`. Please see the `advanced_usage.md` file for details. + +## Wallet Setup + +Blockstack uses its own wallet, stored to `~/.blockstack/wallet.json`. You do not need a wallet to do lookups. + +Blockstack will set up a wallet for you when you try to do something that requires payment (e.g. registering a name). When prompted, you will be asked for a wallet password. This password will be used to encrypt your private keys, and must be at least 16 characters. We recommend using a random string of words that you can easily memorize, since **there is no way to recover your wallet if you forget your password.** + +Once you generate a wallet, **make a back-up to a USB key**. You can also print it out, since it's just a string of plain text. + +## Doing Lookups + +There are two kinds of lookups: a `whois` and a `lookup`. The `whois` queries only information found in the blockchain, whereas a `lookup` queries off-chain data. + +A `lookup` fetches the off-chain profile and zonefile. For example: + +``` + $ blockstack lookup guylepage3.id + { + "profile": { + "@type": "Person", + "account": [ + { + "@type": "Account", + "identifier": "1Mp5vKwCbekeWetMHLKDD2fDLJzw4vKxiQ", + "role": "payment", + "service": "bitcoin" + }, + { + "@type": "Account", + "identifier": "guylepage3", + "proofType": "http", + "proofUrl": "https://twitter.com/guylepage3/status/731252874886385665", + "service": "twitter" + }, + { + "@type": "Account", + "identifier": "g3lepage", + "proofType": "http", + "proofUrl": "https://www.facebook.com/g3lepage/posts/10154223148908760", + "service": "facebook" + }, + { + "@type": "Account", + "identifier": "guylepage3", + "proofType": "http", + "proofUrl": "https://gist.github.com/guylepage3/06f522444fb71f1daf01a534396d1f9e", + "service": "github" + } + ], + "address": { + "@type": "PostalAddress", + "addressLocality": "New York, NY" + }, + "description": "@blockstackorg developer. 1st hire, Design Partner @blockstacklabs (YC/USV backed) entrepreneur, blockchain, creative, marketing, surf, triathlon, ironman", + "graph": { + "url": "https://s3.amazonaws.com/grph/guylepage3" + }, + "image": [ + { + "@type": "ImageObject", + "contentUrl": "https://s3.amazonaws.com/dx3/guylepage3", + "name": "cover" + }, + { + "@type": "ImageObject", + "contentUrl": "https://s3.amazonaws.com/kd4/guylepage3", + "name": "avatar" + } + ], + "name": "Guy Lepage", + "website": [ + { + "@type": "WebSite", + "url": "http://blockstack.com/team" + } + ] + }, + "zonefile": { + "$origin": "guylepage3.id", + "$ttl": 3600, + "uri": [ + { + "name": "_http._tcp", + "priority": 10, + "target": "https://blockstack.s3.amazonaws.com/guylepage3.id", + "weight": 1 + } + ] + } + } +``` +There will always be two keys defined: `profile` and `zonefile`. The hash of the contents of the `zonefile` object are stored in the blockchain, and the Blockstack servers hold copies of zonefile data. The `profile` object is constructed from a **signed JSON web token** (JWT), which is hosted on the storage providers of the user's choice (as determined in the `client.ini` config file). A modern zonefile points to where the profile JWT is hosted. + +The `whois` query is more low-level, and pulls up information that's hosted only in the blockchain. Here's a sample `whois` query: +``` + $ blockstack whois muneeb.id + { + "approx_expiration_date": "2016 Sep 09 13:12:31 UTC", + "block_preordered_at": 373821, + "block_renewed_at": 373821, + "expire_block": 426416, + "has_zonefile": true, + "last_transaction_height": 402804, + "last_transaction_id": "904c5f187ab143d187e26afaddaa6061059451407193fbfc4c4a9b0baa24dbd7", + "owner_address": "1QJQxDas5JhdiXhEbNS14iNjr8auFT96GP", + "owner_script": "76a914ff95f5612a26a81e919e4b6e63fdd929fd115d6d88ac", + "zonefile_hash": "3085137b19ce56092f5cb91b7f78d073c815dbc1" + } +``` + +This information includes the block heights at which the name was preordered (for the first time ever), when it was registered to its curent owner, when it will expire, and when the last transaction (whose ID is given) that affected the name was seen. It also encodes the hash of the zonefile (stored off-chain), the owner's address (public key hash), and owner script (scriptPubKey from Bitcoin). + +Note that the `approx_expiration_data` is *approxmiate*. The system uses the `expire_block` to determine when exactly the name expires; the date is extrapolated from the average block time. You should renew your name well before it expires, just to be sure the transaction gets accepted. We recommend doing it 1,000 blocks before it is set to expire. + +### A Note on Legacy Profiles + +Older profiles used a different structure for storing information. Looking them up will produce a "legacy" zonefile, as well as the profile it represents. + +Legacy zonefiles do not look like DNS zonefiles at all. For example: +``` + $ blockstack lookup muneeb.id + { + "profile": { + "@type": "Person", + "account": [ + { + "@type": "Account", + "identifier": "muneeb", + "proofType": "http", + "service": "twitter" + }, + { + "@type": "Account", + "identifier": "muneeb.ali", + "proofType": "http", + "service": "facebook" + }, + { + "@type": "Account", + "identifier": "muneeb-ali", + "proofType": "http", + "service": "github" + }, + { + "@type": "Account", + "identifier": "1LNLCwtigWAvLkNakUK4jnmmvdVvmULeES", + "role": "payment", + "service": "bitcoin" + }, + { + "@type": "Account", + "contentUrl": "http://muneebali.com/static/files/key.asc", + "identifier": "9862A3FB338BE9EB6C6A5E05639C89272AFEC540", + "role": "key", + "service": "pgp" + } + ], + "address": { + "@type": "PostalAddress", + "addressLocality": "New York, NY" + }, + "description": "Co-founder of Onename (YC S14), final-year PhD candidate at Princeton. Interested in distributed systems and blockchains.", + "image": [ + { + "@type": "ImageObject", + "contentUrl": "https://s3.amazonaws.com/kd4/muneeb", + "name": "avatar" + }, + { + "@type": "ImageObject", + "contentUrl": "https://s3.amazonaws.com/dx3/muneeb", + "name": "cover" + } + ], + "name": "Muneeb Ali", + "website": [ + { + "@type": "WebSite", + "url": "http://muneebali.com" + } + ] + }, + "zonefile": { + "avatar": { + "url": "https://s3.amazonaws.com/kd4/muneeb" + }, + "bio": "Co-founder of Onename (YC S14), final-year PhD candidate at Princeton. Interested in distributed systems and blockchains.", + "bitcoin": { + "address": "1LNLCwtigWAvLkNakUK4jnmmvdVvmULeES" + }, + "cover": { + "url": "https://s3.amazonaws.com/dx3/muneeb" + }, + "facebook": { + "proof": { + "url": "https://facebook.com/muneeb.ali/posts/10152524743274123" + }, + "username": "muneeb.ali" + }, + "github": { + "proof": { + "url": "https://gist.github.com/muneeb-ali/0f00d4da967646ee0bc3" + }, + "username": "muneeb-ali" + }, + "graph": { + "followee_count": 4, + "url": "https://s3.amazonaws.com/grph/muneeb" + }, + "location": { + "formatted": "New York, NY" + }, + "name": { + "formatted": "Muneeb Ali" + }, + "pgp": { + "fingerprint": "9862A3FB338BE9EB6C6A5E05639C89272AFEC540", + "url": "http://muneebali.com/static/files/key.asc" + }, + "twitter": { + "proof": { + "url": "https://twitter.com/muneeb/status/483765788478689280" + }, + "username": "muneeb" + }, + "v": "0.2", + "website": "http://muneebali.com" + } + } +``` + +## Blockstack Wallet + +The Blockstack wallet has three keys: your payment key, your ownership key (i.e. the key that owns the names), and your data key (i.e. the key that signs your profile data). +In the basic mode of operation, you can query information about them with these commands: + +* `blockstack balance`: Query your payment account balance (excludes transactions with less than 6 confirmations). +* `blockstack deposit`: Get your payment address information. This is the address that **pays for names and transaction fees**. +* `blockstack import`: Get your name owner address. This is the address for **transferring a name to a different wallet**. +* `blockstack names`: See the list of names that are owned by your owner address. + +## Registering a Name + +To register a name, simply type: +``` + $ blockstack register .id +``` + +At this time, the name must end in `.id`. It will be registered in the `.id` namespace, since only the `.id` namespace exists (see [here](https://blockstack.org/docs/namespaces) for details). + +You will be prompted to confirm the purchase, and (if you haven't entered it yet), you will be prompted for your wallet password. + +If you'd like to see the price of a name, without actually purchasing it, you can use `blockstack price .id`. + +### A Note on Transaction Fees +The total name cost includes all the relevant transaction fees. However, fee prices are dynamic, and may change during the registration (which requires issuing three transactions). + +To ensure timely registration, you should fill your payment address with **at least +0.001 BTC more than the name cost**. + +## Migrating an Existing Name to the New Profile Schema + +Some advanced options are disabled for older names registered through [Onename](https://onename.com). To enable them, you will need to migrate your name's off-chain data. + +To do so, run `blockstack migrate .id`. It will take about an hour and a half to complete, but only needs to be done once, and only if your name has a legacy zonefile (see above). + +## Checking the Blockstack Server + +You can track the progress of your name transactions with `blockstack info`, which will show you which names have unconfirmed transactions (and what kind they are). The CLI waits for 10 confirmations before considering it confirmed. + +When registering a name, a name will pass through three states: `preorder`, `register`, and `update`. The first step registers your public key and the hash of the name, and waits for it to be confirmed (so no one can front-run you when you reveal the name). The second step reveals the name in the blockchain; you can look at the transaction in a block explorer and find it in the `OP_RETURN` data. The third stage sets up your zonefile and your profile, and writes your zonefile's hash to the blockchain. + +## Other Operations + +### Transferring a Name + +You can send a name to a new ownership address with `blockstack transfer .id `. + +### Renewing a Name + +Names do not last forever, and must be periodically renewed. You can see when a name expires using `whois`, and renew it with `blockstack renew .id`. + +**If you do not renew your name, someone else can register it, and you will not be able to get it back.** The best alternative is to try to ask the new owner if (s)he will sell it back to you. + +### Revoking a Name + +If you lose your Blockstack wallet or the device(s) that host it, you have the option of revoking the name using a backed up copy of your wallet. To do so, type `blockstack revoke .id`. + + +### Updating a Name's Zonefile + +**OpenBazaar Users**: If you are trying to add your OpenBazaar GUID to your Blockstack ID, please follow [these instructions](https://github.com/blockstack/blockstack-cli/blob/master/docs/openbazaar.md) instead. + +**CAUTION**: You almost never want to update your name's zonefile, since it's slow, tedious, and costs money. It is meant primarily for recovering from zonefile loss, for changing where people find your profile, and for changing your data public key. If you want to store data in your profile, please see the [data storage](https://github.com/blockstack/blockstack-cli/blob/master/docs/advanced_usage.md#data-storage) and [accounts](https://github.com/blockstack/blockstack-cli/blob/master/docs/advanced_usage.md#accounts) commands in the [advanced usage](https://github.com/blockstack/blockstack-cli/blob/master/docs/advanced_usage.md) section (but read the [warnings](https://github.com/blockstack/blockstack-cli/blob/master/docs/advanced_usage.md#a-word-of-warning) first). + +If you want to change the name's zonefile, you can do so with `blockstack update`. You must specify the new zonefile to do so. For example: + +``` + $ blockstack update judecn.id '$ORIGIN judecn.id + > $TTL 3600 + > pubkey TXT "pubkey:data:04cabba0b5b9a871dbaa11c044066e281c5feb57243c7d2a452f06a0d708613a46ced59f9f806e601b3353931d1e4a98d7040127f31016311050bedc0d4f1f62ff" + > _file URI 10 1 "file:///home/jude/.blockstack/storage-disk/mutable/judecn.id" + > _https._tcp URI 10 1 "https://blockstack.s3.amazonaws.com/judecn.id" + > _http._tcp URI 10 1 "http://node.blockstack.org:6264/RPC2#judecn.id" + > _dht._udp URI 10 1 "dht+udp://fc4d9c1481a6349fe99f0e3dd7261d67b23dadc5" + > ' +``` + +The zonefile can be any valid DNS zonefile, but must follow these extra rules: +* There must be only one `$ORIGIN`, and it must be the blockstack ID. +* There must be at least one `URI` resource record. +* If you want to set a new data keypair, you must do so via a `TXT` record named `pubkey`, and the text field must start with `pubkey:data:` (as per the example). It must be an ECDSA public key. + +**WARNING**: Each of the URLs must refer to the **signed JSON Web Token** (JWT) that encodes your profile data. The JWT can be signed either with the private key that owns your name, or with a private key that matches the `pubkey:data:` TXT record. If you do not do this, your profile **will not be readable** to the Blockstack CLI tool or to any public profile resolvers. diff --git a/_site/core/blockstack_naming_service.md b/_site/core/blockstack_naming_service.md new file mode 100644 index 00000000..b267c458 --- /dev/null +++ b/_site/core/blockstack_naming_service.md @@ -0,0 +1,1342 @@ +# Blockstack Naming Service + +This document is written for Blockstack developers and technically-inclined +users. Its purpose is twofold: to give a brief overview of how the +Blockstack Naming Service works, and describe how developers can use it +to build decentralized Web applications. + +If you read this document in its entirety, you will +understand the following concepts: + +* Why a secure decentralized naming service is an important building + block in decentralized systems +* How Blockstack applications can leverage BNS to solve real-world problems +* How the Blockstack Naming Service is different from other offerings in this + space. + +This project repository ([Blockstack Core](https://github.com/blockstack/blockstack-core)) +is the reference implementation of the Blockstack Naming Service. + +# Introduction + +The Blockstack Naming Service (BNS) is a network system that binds names +to off-chain state without relying on any central points of control. +It does so by embedding a log of its control-plane messages within a public blockchain, like Bitcoin. + +Each BNS peer determines the state of each name by indexing these specially-crafted +transactions. In doing so, each peer independently calculates the same global +name state. + +Names in BNS have three properties: + +* **Names are globally unique.** The protocol does not allow name collisions, and all + well-behaved nodes resolve a given name to the same state. +* **Names are human-meaningful.** Each name is chosen by its creator. +* **Names are strongly-owned.** Only the name's owner can change the state it + resolves to. Specifically, a name is owned by one or more ECDSA private keys. + +Internally, a BNS node implements a replicated name database. Each BNS node keeps itself +synchronized to all of the other ones in the world, so queries on one BNS node +will be the same on other nodes. BNS nodes allow a name's owner to bind +up to 40Kb of off-chain state to their name, which will be replicated to all +BNS nodes via the [Atlas network](atlas_network.md). + +BNS nodes extract the name database log from an underlying blockchain (Blockstack +Core currently uses Bitcoin, and had used Namecoin in the past). +BNS uses the blockchain to establish a shared "ground truth" for the system: as long as +two nodes have the same view of the blockchain, then they will build up the same +database. + +The biggest consequence for developers is that in BNS, reading name state is +fast and cheap but writing name state is slow and expensive. This is because +registering and modifying names requires one or more transactions to be sent to +the underlying blockchain, and BNS nodes will not process them until they are +sufficiently confirmed. Users and developers need to acquire and spend +the requisite cryptocurrency (i.e. Bitcoin) to send BNS transactions. + +# Motivation + +We rely on naming systems in everyday life, and they play a critical +role in many different applications. For example, when you look up a +friend on social media, you are using the platform's naming service to resolve +their name to their profile. When you look up a website, you are using the +Domain Name Service to +resolve the hostname to its host's IP address. When you check out a Git branch, you +are using your Git client to resolve the branch name to a commit hash. +When you look up someone's PGP key on a keyserver, you are resolving +their key ID to their public key. + +What kinds of things do we want to be true about names? In BNS, names are +globally unique, names are human-meaningful, and names are strongly-owned. +However, if you look at these examples, you'll see that each of them only +guarantees *two* of these properties. This limits how useful they can be. + +* In DNS and social media, names are globally unique and human-readable, but not +strongly-owned. The system operator has the +final say as to what each names resolves to. + * **Problem**: Clients must trust the system to make the right + choice in what a given name resolves to. This includes trusting that + no one but the system administrators can make these changes. + +* In Git, branch names are human-meaningful +and strongly-owned, but not globally unique. Two different Git nodes may resolve the same +branch name to different unrelated repository states. + * **Problem**: Since names can refer to conflicting state, developers + have to figure out some other mechanism to resolve ambiguities. In Git's + case, the user has to manually intervene. + +* In PGP, names are key IDs. They are +are globally unique and cryptographically owned, but not human-readable. PGP +key IDs are derived from the keys they reference. + * **Problem**: These names are difficult for most users to + remember since they do not carry semantic information relating to their use in the system. + +BNS names have all three properties, and none of these problems. This makes it a +powerful tool for building all kinds of network applications. With BNS, we +can do the following and more: + +* Build domain name services where hostnames can't be hijacked. +* Build social media platforms where user names can't be stolen by phishers. +* Build version control systems where repository branches do not conflict. +* Build public-key infrastructure where it's easy for users to discover and + remember each other's keys. + +# BNS Architecture + +The BNS node is the heart of the system. It is responsible for building up +and replicating global name state. + +There are three parts to BNS that developers should be aware of. They are: + +* **The BNS indexer**. This module crawls the blockchain and builds + up its name database. BNS indexers do not contain any private or sensitive +state, and can be deployed publicly. We maintain a fleet of them at +`https://node.blockstack.org:6263` for developers to use to get started. + +* **The BNS API**. This module gives + developers a *stable RESTful API* for interacting with the BNS network. +We provide one for developers to experiment with at `https://core.blockstack.org`. + +* **BNS clients**. These communicate with the BNS API module in order to + resolve names. Internally, they generate and send transactions to register +and modify names. + +The BNS indexer and BNS API comprise the **BNS node**. An architectural schematic appears below. + +``` + +-------------------------------------------------------+ + RESTful | +----------------+ +--------------------+ | ++--------+ API | | | private API | | | +| client |<------------>| BNS API module |<----------->| BNS indexer module | | ++--------+ | | | | | | + | | +----------------+ | +----------------+ | | + | | | | name database | | | + | | | +----------------+ | | + | | +--------------------+ | + | | BNS node ^ | + | +------------------------------------------|------------+ + | | + | v + | blockchain transactions +--------------------+ + +------------------------------------------------->| blockchain peer | + +--------------------+ + +Figure 1: BNS architecture overview. Clients talk to the BNS API module to +resolve names, and generate and send blockchain transactions to register and +modify names. The API module talks to the indexer module and gives clients +a stable, Web-accessible interface for resolving names. The indexer module reads +the blochchain via a blockchain peer, over the blockchain's peer network. + +Blockstack Core currently implements the API module and indexer module as separate +daemons (`blockstack api` and `blockstack-core`, respectively). However, this +is an implementation detail, and may change in the future. +``` + +The BNS indexer implements the blockchain consensus rules and network protocols. +Its main responsibility is to build up and replicate all of the name state. It does +not have any public APIs of its own. + +The BNS API modules allows users and developers to resolve names via a RESTful +interface. Resolution can be done with vanilla `curl` or `wget`. +BNS applications should use the BNS API module for name resolution. +They should not attempt to talk to a BNS indexer directly, because its API is not stable and is not meant +for consumption by any other process except for the API module. + +Registering and managing names require generating and sending blockchain +transactions, which requires running a BNS client. We provide two reference +BNS clients: + +* The [Blockstack Browser](https://github.com/blockstack/blockstack-browser) gives users +and developers a graphical UI to resolve, register and manage names. This is the recommended +way to interact with BNS. +* The [Blockstack CLI](https://blockstack.org/docs/#lookups) gives developers low-level +control over resolving, registering, and managing names. +A new CLI that uses [blockstack.js](https://github.com/blockstack/blockstack.js) +is under development, and will replace the existing CLI program. + +We recommend that new developers use the [Blockstack +Browser](https://github.com/blockstack/blockstack-browser). + +Developers who want to make their own client programs that do not use +the reference client library code should read the +[BNS transaction wire format](wire-format.md) document for generating and +sending their own transactions. + +The examples in this document focus on resolving names using `curl`. We refer +the reader to client-specific documentation for registering and managing names. + +# How to Use BNS + +BNS names are organized into a global name hierarchy. There are three different +layers in this hierarchy related to naming: + +* **Namespaces**. These are the top-level names in the hierarchy. An analogy + to BNS namespaces are DNS top-level domains. Existing BNS namespaces include +`.id`, `.podcast`, and `.helloworld`. All other names belong to exactly one +namespace. Anyone can create a namespace, but in order for the namespace +to be persisted, it must be *launched* so that anyone can register names in it. +Namespaces are not owned by their creators. + +* **BNS names**. These are names whose records are stored directly on the + blockchain. The ownership and state of these names are controlled by sending +blockchain transactions. Example names include `verified.podcast` and +`muneeb.id`. Anyone can create a BNS name, as long as the namespace that +contains it exists already. The state for BNS names is usually stored in the [Atlas +network](atlas_network.md). + +* **BNS subdomains**. These are names whose records are stored off-chain, +but are collectively anchored to the blockchain. The ownership and state for +these names lives within the [Atlas network](atlas_network.md). While BNS +subdomains are owned by separate private keys, a BNS name owner must +broadcast their subdomain state. Example subdomains include `jude.personal.id` +and `podsaveamerica.verified.podcast`. Unlike BNS namespaces and names, the +state of BNS subdomains is *not* part of the blockchain consensus rules. + +A feature comparison matrix summarizing the similarities and differences +between these name objects is presented below: + +| Feature | **Namespaces** | **BNS names** | **BNS Subdomains** | +|---------|----------------|---------------|--------------------| +| Globally unique | X | X | X | +| Human-meaningful | X | X | X | +| Owned by a private key | | X | X | +| Anyone can create | X | X | [1] | +| Owner can update | | X | [1] | +| State hosted on-chain | X | X | | +| State hosted off-chain | | X | X | +| Behavior controlled by consensus rules | X | X | | +| May have an expiration date | | X | | + +[1] Requires the cooperation of a BNS name owner to broadcast its transactions + +## BNS Namespaces + +Namespaces are the top-level naming objects in BNS. +They control a few properties about the names within them: +* How expensive they are to register +* How long they last before they have to be renewed +* Who (if anyone) receives the name registration fees +* Who is allowed to seed the namespace with its initial names. + +At the time of this writing, by far the largest BNS namespace is the `.id` +namespace. Names in the `.id` namespace are meant for resolving user +identities. Short names in `.id` are more expensive than long names, and have +to be renewed by their owners every two years. Name registration fees are not +paid to anyone in particular---they are instead sent to a "black hole" where they are +rendered unspendable (the intention is to discourage ID sqautters). + +Unlike DNS, *anyone* can create a namespace and set its properties. +Namespaces are created on a first-come first-serve basis, and once created, they +last forever. + +However, creating a namespace is not free. The namespace creator must *burn* +cryptocurrency to do so. The shorter the namespace, the more cryptocurrency +must be burned (i.e. short namespaces are more valuable than long namespaces). +For example, it cost Blockstack PBC 40 BTC to create the `.id` namespace in +2015 (in transaction `5f00b8e609821edd6f3369ee4ee86e03ea34b890e242236cdb66ef6c9c6a1b281`). + +Namespaces can be between 1 and 19 characters long, and are composed of the +characters `a-z`, `0-9`, `-`, and `_`. + +### Creating a Namespace + +There are four steps to creating a namespace: + +1. **Send a `NAMESPACE_PREORDER` transaction** ([live example](https://www.blocktrail.com/BTC/tx/5f00b8e609821edd6f3369ee4ee86e03ea34b890e242236cdb66ef6c9c6a1b28)). +This is the first step. This registers the *salted hash* of the namespace with BNS nodes, and burns the +requisite amount of cryptocurrency. In addition, it proves to the +BNS nodes that user has honored the BNS consensus rules by including +a recent *consensus hash* in the transaction +(see the section on [BNS forks](#bns-forks) for details). + +2. **Send a `NAMESPACE_REVEAL` transaction** ([live example](https://www.blocktrail.com/BTC/tx/ab54b1c1dd5332dc86b24ca2f88b8ca0068485edf0c322416d104c5b84133a32)). +This is the second step. This reveals the salt and the namespace ID (pairing it with its +`NAMESPACE_PREORDER`), it reveals how long names last in this namespace before +they expire or must be renewed, and it sets a *price function* for the namespace +that determines how cheap or expensive names its will be. The price function takes +a name in this namespace as input, and outputs the amount of cryptocurrency the +name will cost (i.e. by examining how long the name is, and whether or not it +has any vowels or non-alphabet characters). The namespace creator +has the option to collect name registration fees for the first year of the +namespace's existence by setting a *namespace creator address*. + +3. **Seed the namespace with `NAME_IMPORT` transactions** ([live example](https://www.blocktrail.com/BTC/tx/c698ac4b4a61c90b2c93dababde867dea359f971e2efcf415c37c9a4d9c4f312)). +Once the namespace has been revealed, the user has the option to populate it with a set of +names. Each imported name is given both an owner and some off-chain state. +This step is optional---namespace creators are not required to import names. + +4. **Send a `NAMESPACE_READY` transaction** ([live example](https://www.blocktrail.com/BTC/tx/2bf9a97e3081886f96c4def36d99a677059fafdbd6bdb6d626c0608a1e286032)). +This is the final step of the process. It *launches* the namespace, which makes it available to the +public. Once a namespace is ready, anyone can register a name in it if they +pay the appropriate amount of cryptocurrency (according to the price funtion +revealed in step 2). + +The reason for the `NAMESPACE_PREORDER/NAMESPACE_REVEAL` pairing is to prevent +frontrunning. The BNS consensus rules require a `NAMESPACE_REVEAL` to be +paired with a previous `NAMESPACE_PREORDER` sent within the past 24 hours. +If it did not do this, then a malicious actor could watch the blockchain network +and race a victim to claim a namespace. + +Namespaces are created on a first-come first-serve basis. If two people try to +create the same namespace, the one that successfully confirms both the +`NAMESPACE_PREORDER` and `NAMESPACE_REVEAL` wins. The fee burned in the +`NAMESPACE_PREORDER` is spent either way. + +Once the user issues the `NAMESPACE_PREORDER` and `NAMESPACE_REVEAL`, they have +1 year before they must send the `NAMESPACE_READY` transaction. If they do not +do this, then the namespace they created disappears (along with all the names +they imported). + +Developers wanting to create their own namespaces should read the [namespace +creation](namespace_creation.md) document. It is highly recommended that +developers follow this tutorial closely, given the large amount of +cryptocurrency at stake. + +### Using Namespaces + +The intention is that each application can create its own BNS +namespace for its own purposes. Applications can use namespaces for things like: + +* Giving users a SSO system, where each user registers their public key under a + username. Blockstack applications do this with names in the `.id` namespace, +for example. +* Providing a subscription service, where each name is a 3rd party that provides +a service for users to subscribe to. For example, names in +`.podcast` point to podcasts that users of the +[DotPodcast](https://dotpodcast.co) app can subscribe to. +* Implementing software licenses, where each name corresponds to an access key. + Unlike conventional access keys, access keys implemented as names +can be sold and traded independently. The licensing fee (paid as a name +registration) would be set by the developer and sent to a developer-controlled +blockchain address. + +Names within a namespace can serve any purpose the developer wants. The ability +to collect registration fees for 1 year after creating the namespace not only +gives developers the incentive to get users to participate in the app, but also +gives them a way to measure economic activity. + +Developers can query individual namespaces and look up names within them using +the BNS API. The API offers routes to do the following: + +#### List all namespaces in existence ([reference](https://core.blockstack.org/#namespace-operations-get-all-namespaces)). + +```bash +$ curl https://core.blockstack.org/v1/namespaces +[ + "id", + "helloworld", + "podcast" +] +``` + +#### List all names within a namespace ([reference](https://core.blockstack.org/#namespace-operations-get-all-namespaces)) + +```bash +$ curl https://core.blockstack.org/v1/namespaces/id/names?page=0 +[ + "0.id", + "0000.id", + "000000.id", + "000001.id", + "00000111111.id", + "000002.id", + "000007.id", + "0011sro.id", + "007_007.id", + "00n3w5.id", + "00r4zr.id", + "00w1k1.id", + "0101010.id", + "01jack.id", + "06nenglish.id", + "08.id", + "0cool_f.id", + "0dadj1an.id", + "0nelove.id", + "0nename.id" +... +] +``` + +Each page returns a batch of 100 names. + +#### Get the Cost to Register a Namespace ([reference](https://core.blockstack.org/#price-checks-get-namespace-price)) + +```bash +$ curl https://core.blockstack.org/v1/prices/namespaces/test +{ + "satoshis": 40000000 +} +``` + +If you want to register a namespace, please see the [namespace creation tutorial](namespace_creation.md). + +#### Getting the Current Consensus Hash ([reference](https://core.blockstack.org/#blockchain-operations-get-consensus-hash)) + +```bash +$ curl -sL https://core.blockstack.org/v1/blockchains/bitcoin/consensus +{ + "consensus_hash": "98adf31989bd937576aa190cc9f5fa3a" +} +``` + +A recent consensus hash is required to create a `NAMESPACE_PREORDER` transaction. The reference +BNS clients do this automatically. See the [transaction format](wire-format.md) +document for details on how the consensus hash is used to construct the +transaction. + +## Resolving BNS Names + +BNS names are bound to both public keys and to about 40Kb of off-chain state. +The off-chain state is encoded as a [DNS zone file](https://en.wikipedia.org/wiki/Zone_file), +which contains routing information for discovering the user's Blockstack data +(such as their profile and app data, which are hosted in the [Gaia storage +system](https://github.com/blockstack/gaia)). + +The blockchain is not used to store this information directly. Instead, the +blockchain stores the *public key hash* and the *zone file hash*. When +indexing the blockchain, each BNS node builds a database with +three columns: all the on-chain BNS names that have been registered, each +name's public key hash, and each name's zone file's hash. +In addition, each BNS node maintains the *transaction history* of each name. +A developer can resolve a name to any configuration it was in at any prior +point in time. + +Below is an example name table pulled from a live BNS node: + +| Name | Public key hash | Zone File Hash | +|------|-----------------|--------------| +| `ryan.id` | `15BcxePn59Y6mYD2fRLCLCaaHScefqW2No` | `a455954b3e38685e487efa41480beeb315f4ec65` | +| `muneeb.id` | `1J3PUxY5uDShUnHRrMyU6yKtoHEUPhKULs` | `37aecf837c6ae9bdc9dbd98a268f263dacd00361` | +| `jude.id` | `16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg` | `b6e99200125e70d634b17fe61ce55b09881bfafd` | +| `verified.podcast` | `1MwPD6dH4fE3gQ9mCov81L1DEQWT7E85qH` | `6701ce856620d4f2f57cd23b166089759ef6eabd` | +| `cicero.res_publica.id` | `1EtE77Aa5AA8etzF2irk56vvkS4v7rZ7PE` | `7e4ac75f9d79ba9d5d284fac19617497433b832d` | +| `podsaveamerica.verified.podcast` | `1MwPD6dH4fE3gQ9mCov81L1DEQWT7E85qH` | `0d6f090db8945aa0e60759f9c866b17645893a95` | + +In practice, the zone file hash is the `RIPEMD160` hash of the `SHA256` hash of +the zone file, and the public key is the `base58check`-encoded `RIPEMD160` hash +of the double-`SHA256` hash of the ECDSA public key (i.e. a Bitcoin address). + +The BNS consensus rules ensure that +a BNS name can only be registered if it is not already taken, and that only the +user who owns the name's private key can change its public key hash or zone file +hash. This means that a name's public key and zone file can be stored anywhere, +since they can be authenticated using the hashes discovered by indexing the +blockchain under the BNS consensus rules. + +BNS nodes implement a decentralized storage system for zone files called the +[Atlas network](atlas_network.md). In this system, BNS nodes eagerly replicate +all the zone files they know about to one another, so that eventually every BNS +node has a full replica of all zone files. + +The public keys for names are stored off-chain in [Gaia](https://github.com/blockstack/gaia). +The user controls where their public keys are hosted using the zone file +contents (if they are hosted online anywhere at all). + +Developers can query this table via the BNS API. The API offers routes +to do the following: + +#### Look up a name's public key and zone file ([reference](https://core.blockstack.org/#name-querying-get-name-info)) + +```bash +$ curl https://core.blockstack.org/v1/names/muneeb.id +{ + "address": "1J3PUxY5uDShUnHRrMyU6yKtoHEUPhKULs", + "blockchain": "bitcoin", + "expire_block": 599266, + "last_txid": "7e16e8688ca0413a398bbaf16ad4b10d3c9439555fc140f58e5ab4e50793c476", + "status": "registered", + "zonefile": "$ORIGIN muneeb.id\n$TTL 3600\n_http._tcp URI 10 1 \"https://gaia.blockstack.org/hub/1J3PUxY5uDShUnHRrMyU6yKtoHEUPhKULs/0/profile.json\"\n", + "zonefile_hash": "37aecf837c6ae9bdc9dbd98a268f263dacd00361" +} +``` + +Note that the `zonefile` field is given with the off-chain data that hashes +to the `zonefile_hash` field. + +#### List all names the node knows about ([reference](https://core.blockstack.org/#name-querying-get-all-names)) + +```bash +$ curl https://core.blockstack.org/v1/names?page=0 +[ + "judecn.id", + "3.id", + "4.id", + "8.id", + "e.id", + "h.id", + "5.id", + "9.id", + "i.id", + "l.id", + "p.id", + "w.id", + "ba.id", + "df.id", +... +] +``` + +Each page returns 100 names. While no specific ordering is mandated by the +protocol, the reference implementation orders names by their order of creation +in the blockchain. + +#### Look up the history of states a name was in ([reference](https://core.blockstack.org/#name-querying-name-history)) + +```bash +$ curl https://core.blockstack.org/v1/names/patrickstanley.id/history +{ + "445838": [ + { + "address": "1occgbip7tFDXX9MvzQhcnTUUjcVX2dYK", + "block_number": 445838, + "burn_address": "1111111111111111111114oLvT2", + "consensus_hash": "7b696b6f4060b792d41912068944d73b", + "op": "?", + "op_fee": 25000, + "opcode": "NAME_PREORDER", + "preorder_hash": "26bf7874706ac761afdd403ed6b3b9578fb01a34", + "sender": "76a91408d0dd44c1f0a3a4f0957ae95901929d7d66d55788ac", + "sender_pubkey": "039a8948d339ecbff44cf426cb85d90fce876f1658d385cdc47f007f279be626ea", + "txid": "6730ae09574d5935ffabe3dd63a9341ea54fafae62fde36c27738e9ee9c4e889", + "vtxindex": 40 + } + ], + "445851": [ + { + "address": "17CbHgTgBG3kLedXNneEKBkCTgW2fyrnUD", + "block_number": 445838, + "consensus_hash": null, + "first_registered": 445851, + "importer": null, + "importer_address": null, + "last_creation_op": "?", + "last_renewed": 445851, + "name": "patrickstanley.id", + "name_hash128": "683a3e1ee5f0296833c56e481cf41b77", + "namespace_block_number": 373601, + "namespace_id": "id", + "op": ":", + "op_fee": 25000, + "opcode": "NAME_REGISTRATION", + "preorder_block_number": 445838, + "preorder_hash": "26bf7874706ac761afdd403ed6b3b9578fb01a34", + "revoked": false, + "sender": "76a9144401f3be5311585ea519c1cb471a8dc7b02fd6ee88ac", + "sender_pubkey": "039a8948d339ecbff44cf426cb85d90fce876f1658d385cdc47f007f279be626ea", + "transfer_send_block_id": null, + "txid": "55b8b42fc3e3d23cbc0f07d38edae6a451dfc512b770fd7903725f9e465b2925", + "value_hash": null, + "vtxindex": 54 + } + ], + "445873": [ + { + "address": "17CbHgTgBG3kLedXNneEKBkCTgW2fyrnUD", + "block_number": 445838, + "consensus_hash": "18b8d69f0182b89ccb1aa536f83be18a", + "first_registered": 445851, + "importer": null, + "importer_address": null, + "last_creation_op": "?", + "last_renewed": 445851, + "name": "patrickstanley.id", + "name_hash128": "683a3e1ee5f0296833c56e481cf41b77", + "namespace_block_number": 373601, + "namespace_id": "id", + "op": "+", + "op_fee": 25000, + "opcode": "NAME_UPDATE", + "preorder_block_number": 445838, + "preorder_hash": "26bf7874706ac761afdd403ed6b3b9578fb01a34", + "revoked": false, + "sender": "76a9144401f3be5311585ea519c1cb471a8dc7b02fd6ee88ac", + "sender_pubkey": "039a8948d339ecbff44cf426cb85d90fce876f1658d385cdc47f007f279be626ea", + "transfer_send_block_id": null, + "txid": "dc478659fc684a1a6e1e09901971e82de11f4dfe2b32a656700bf9a3b6030719", + "value_hash": "02af0ef21161ad06b0923106f40b994b9e4c1614", + "vtxindex": 95 + } + ], + "445884": [ + { + "address": "1GZqrVbamkaE6YNveJFWK6cDrCy6bXyS6b", + "block_number": 445838, + "consensus_hash": "18b8d69f0182b89ccb1aa536f83be18a", + "first_registered": 445851, + "importer": null, + "importer_address": null, + "last_creation_op": "?", + "last_renewed": 445851, + "name": "patrickstanley.id", + "name_hash128": "683a3e1ee5f0296833c56e481cf41b77", + "namespace_block_number": 373601, + "namespace_id": "id", + "op": ">>", + "op_fee": 25000, + "opcode": "NAME_TRANSFER", + "preorder_block_number": 445838, + "preorder_hash": "26bf7874706ac761afdd403ed6b3b9578fb01a34", + "revoked": false, + "sender": "76a914aabffa6dd90d731d3a349f009323bb312483c15088ac", + "sender_pubkey": null, + "transfer_send_block_id": 445875, + "txid": "7a0a3bb7d39b89c3638abc369c85b5c028d0a55d7804ba1953ff19b0125f3c24", + "value_hash": "02af0ef21161ad06b0923106f40b994b9e4c1614", + "vtxindex": 16 + } + ] +} +``` + +All of the above information is extracted from the blockchain. Each top-level +field encodes the states the name transitioned to at the given block height (e.g. +445838, 445851, 445873, adn 445884). At each block height, the name's zone file +hashes are returned in the order they were discovered in the blockchain. + +Each name state contains a lot of ancillary data that is used internally by +other API calls and client libraries. The relevant fields for this document's +scope are: + +* `address`: This is the base58check-encoded public key hash. +* `name`: This is the name queried. +* `value_hash`: This is the zone file hash. +* `opcode`: This is the type of transaction that was processed. +* `txid`: This is the transaction ID in the underlying blockchain. + +The name's *entire* history is returned. This includes the history of the name +under its previous owner, if the name expired and was reregistered. + +#### Look up the list of names owned by a given public key hash ([reference](https://core.blockstack.org/#name-querying-get-names-owned-by-address)) + +```bash +$ curl https://core.blockstack.org/v1/addresses/bitcoin/16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg +{ + "names": [ + "judecn.id", + "patrickstanley1.id", + "abcdefgh123456.id", + "duckduckgo_tor.id", + "jude.id", + "blockstacknewyear2017.id", + "jude.statism.id" + ] +} +``` + +Note that this API endpoint includes names and +[subdomains](#bns-subdomains). + +## Registering BNS Names + +Registering a BNS name costs cryptocurrency. This cost comes from two sources: + +* **Transaction fees:** These are the fees imposed by the cost of storing the + transaction data to the blockchain itself. They are independent of BNS, since +all of the blockchain's users are competing to have their transactions included +in the next block. The blockchain's miners receive the transaction fee. + +* **Registration fees:** Each BNS namespace imposes an *additional* fee on how + much a name costs. The registration fee is sent to the namespace creator +during the first year that a namespace exists, and is sent to a burn address +afterwards. The registration fee is different for each name and is +determined by the namespace itself, but can be queried in advance by the user. + +Registering a name takes two transactions. They are: + +* **`NAME_PREORDER` transaction**: This is the first transaction to be sent. + It tells all BNS nodes the *salted hash* of the BNS name, and it pays the +registration fee to the namespace owner's designated address (or the burn +address). In addition, it proves to the BNS nodes that the client knows about +the current state of the system by including a recent *consensus hash* +in the transaction (see the section on [BNS forks](#bns-forks) for details). + +* **`NAME_REGISTRATION` transaction**: This is the second transaction to be + sent. It reveals the salt and the name to all BNS nodes, and assigns the name +an initial public key hash and zone file hash + +The reason this process takes two transactions is to prevent front-running. +The BNS consensus rules stipulate that a name can only be registered if its +matching preorder transaction was sent in the last 24 hours. Because a name +must be preordered before it is registered, someone watching the blockchain's +peer network cannot race a victim to claim the name they were trying to +register (i.e. the attacker would have needed to send a `NAME_PREORDER` +transaction first, and would have had to have sent it no more than 24 hours +ago). + +Registering a name on top of the Bitcoin blockchain takes 1-2 hours. This is +because you need to wait for the `NAME_PREORDER` transaction to be sufficiently +confirmed before sending the `NAME_REGISTRATION` transaction. The BNS nodes +only register the name once both transactions have at least 6 confirmations +(which itself usually takes about an hour). + +Names are registered on a first-come first-serve basis. +If two different people try to register the same name at the same time, the +person who completes the two-step process *earliest* will receive the name. The +other person's `NAME_REGISTRATION` transaction will be ignored, since it will +not be considered valid at this point. The registration fee paid by the +`NAME_PREORDER` will be lost. However, this situation is rare in practice--- +as of early 2018, we only know of one confirmed instance in the system's 3+ years +of operation. + +Fully-qualified names can be between 3 and 37 characters long, and consist of +the characters `a-z`, `0-9`, `+`, `-`, `_`, and `.`. This is to prevent +[homograph attacks](https://en.wikipedia.org/wiki/IDN_homograph_attack). +`NAME_REGISTRATION` transactions that do not conform to this requirement will be +ignored. + +#### Getting a Name's Registration Fee ([reference](https://core.blockstack.org/#price-checks-get-name-price)) + +```bash +$ curl -sL https://core.blockstack.org/v1/prices/names/helloworld.id | jq -r ".name_price" +{ + "btc": 2.5e-05, + "satoshis": 2500 +} +``` + +Note the use of `jq -r` to select the `"name_price"` field. This API +endpoint may return other ancilliary data regarding transaction fee estimation, +but this is the only field guaranteed by this specification to be present. + +#### Getting the Current Consensus Hash ([reference](https://core.blockstack.org/#blockchain-operations-get-consensus-hash)) + +```bash +$ curl -sL https://core.blockstack.org/v1/blockchains/bitcoin/consensus +{ + "consensus_hash": "98adf31989bd937576aa190cc9f5fa3a" +} +``` + +The consensus hash must be included in the `NAME_PREORDER` transaction. The BNS +clients do this automatically. See the [transaction format +document](wire-format.md) for details as to how to include this in the +transaction. + +#### Registering a Name + +Registration happens through a BNS client, such as the [Blockstack +Browser](https://github.com/blockstack/blockstack-browser) or +[blockstack.js](https://github.com/blockstack/blockstack.js). +The reference BNS clients manage a local Bitcoin wallet, calculate transaction fees +dynamically and automatically, and broadcast both the `NAME_PREORDER` and +`NAME_REGISTRATION` transactions at the right times. + +If you want to make your own registration client, you should see the +[transaction format](wire-format.md) document. + +## Managing BNS Names + +Once you register a BNS name, you have the power to change its zone file hash, +change its public key hash, destroy it (i.e. render it unresolvable), +or renew it. The BNS consensus rules ensure that *only* you, as the owner of +the name's private key, have the ability to carry out these operations. + +Each of these operations are executed by sending a specially-formatted +blockchain transaction to the blockchain, which BNS nodes read and process. +The operations are listed below: + +| Transaction Type | Description | +|------------------|-------------| +| `NAME_UPDATE` | This changes the name's zone file hash. Any 20-byte string is allowed. | +| `NAME_TRANSFER` | This changes the name's public key hash. In addition, the current owner has the option to atomically clear the name's zone file hash (so the new owner won't "receive" the zone file). | +| `NAME_REVOKE` | This renders a name unresolvable. You should do this if your private key is compromised. | +| `NAME_RENEWAL` | This pushes back the name's expiration date (if it has one), and optionally both sets a new zone file hash and a new public key hash. | + +The reference BNS clients--- +[blockstack.js](https://github.com/blockstack/blockstack.js) and the [Blockstack +Browser](https://github.com/blockstack/blockstack-browser)---can handle creating +and sending all of these transactions for you. + +### NAME_UPDATE ([live example](https://www.blocktrail.com/BTC/tx/e2029990fa75e9fc642f149dad196ac6b64b9c4a6db254f23a580b7508fc34d7)) + +A `NAME_UPDATE` transaction changes the name's zone file hash. You would send +one of these transactions if you wanted to change the name's zone file contents. +For example, you would do this if you want to deploy your own [Gaia +hub](https://github.com/blockstack/gaia) and want other people to read from it. + +A `NAME_UPDATE` transaction is generated from the name, a recent [consensus +hash](#bns-forks), and the new zone file hash. The reference clients gather +this information automatically. See the [transaction format](wire-format.md) +document for details on how to construct this transaction. + +### NAME_TRANSFER ([live example](https://www.blocktrail.com/BTC/tx/7a0a3bb7d39b89c3638abc369c85b5c028d0a55d7804ba1953ff19b0125f3c24)) + +A `NAME_TRANSFER` transaction changes the name's public key hash. You would +send one of these transactions if you wanted to: + +* Change your private key +* Send the name to someone else + +When transferring a name, you have the option to also clear the name's zone +file hash (i.e. set it to `null`). +This is useful for when you send the name to someone else, so the +recipient's name does not resolve to your zone file. + +The `NAME_TRANSFER` transaction is generated from the name, a recent [consensus +hash](#bns-forks), and the new public key hash. The reference clients gather +this information automatically. See the [transaction format](wire-format.md) +document for details on how to construct this transaction. + +### NAME_REVOKE ([live example](https://www.blocktrail.com/BTC/tx/eb2e84a45cf411e528185a98cd5fb45ed349843a83d39fd4dff2de47adad8c8f)) + +A `NAME_REVOKE` transaction makes a name unresolvable. The BNS consensus rules +stipulate that once a name is revoked, no one can change its public key hash or +its zone file hash. The name's zone file hash is set to `null` to prevent it +from resolving. + +You should only do this if your private key is compromised, or if you want to +render your name unusable for whatever reason. It is rarely used in practice. + +The `NAME_REVOKE` operation is generated using only the name. See the +[transaction format](wire-format.md) document for details on how to construct +it. + +### NAME_RENEWAL ([live example](https://www.blocktrail.com/BTC/tx/e543211b18e5d29fd3de7c0242cb017115f6a22ad5c6d51cf39e2b87447b7e65)) + +Depending in the namespace rules, a name can expire. For example, names in the +`.id` namespace expire after 2 years. You need to send a `NAME_RENEWAL` every +so often to keep your name. + +A `NAME_RENEWAL` costs both transaction fees and registration fees. You will +pay the registration cost of your name to the namespace's designated burn address when you +renew it. You can find this fee using the `/v1/prices/names/{name}` endpoint. + +When a name expires, it enters a month-long "grace period" (5000 blocks). It +will stop resolving in the grace period, and all of the above operations will +cease to be honored by the BNS consensus rules. You may, however, send a +`NAME_RENEWAL` during this grace period to preserve your name. + +If your name is in a namespace where names do not expire, then you never need to +use this transaction. + +When you send a `NAME_RENEWAL`, you have the option of also setting a new public +key hash and a new zone file hash. See the [transaction format](wire-format.md) +document for details on how to construct this transaction. + +## BNS Subdomains + +BNS names are strongly-owned because the owner of its private key can generate +valid transactions that update its zone file hash and owner. However, this comes at the +cost of requiring a name owner to pay for the underlying transaction in the +blockchain. Moreover, this approach limits the rate of BNS name registrations +and operations to the underlying blockchain's transaction bandwidth. + +BNS overcomes this with subdomains. A **BNS subdomain** is a type of BNS name whose state +and owner are stored outside of the blockchain, but whose existence and +operation history are anchored to the +blockchain. In the example table in the [Resolving BNS +Names](#resolving-bns-names) section, the names `cicero.res_publica.id` and +`podsaveamerica.verified.podcast` are subdomains. + +Like their on-chain counterparts, subdomains are globally +unique, strongly-owned, and human-readable. BNS gives them their own name state +and public keys. + +Unlike on-chain names, subdomains can be created and managed +cheaply, because they are broadcast to the +BNS network in batches. A single blockchain transaction can send up to 120 +subdomain operations. + +This is achieved by storing subdomain records in the [Atlas Network](atlas_network.md). +An on-chain name owner broadcasts subdomain operations by encoding them as +`TXT` records within a DNS zone file. To broadcast the zone file, +the name owner sets the new zone file hash with a `NAME_UPDATE` transaction and +replicates the zone file via Atlas. This, in turn, replicates all subdomain +operations it contains, and anchors the set of subdomain operations to +an on-chain transaction. The BNS node's consensus rules ensure that only +valid subdomain operations from *valid* `NAME_UPDATE` transactions will ever be +stored. + +For example, the name `verified.podcast` once wrote the zone file hash `247121450ca0e9af45e85a82e61cd525cd7ba023`, +which is the hash of the following zone file: + +```bash +$ curl -sL https://core.blockstack.org/v1/names/verified.podcast/zonefile/247121450ca0e9af45e85a82e61cd525cd7ba023 | jq -r '.zonefile' +$ORIGIN verified.podcast +$TTL 3600 +1yeardaily TXT "owner=1MwPD6dH4fE3gQ9mCov81L1DEQWT7E85qH" "seqn=0" "parts=1" "zf0=JE9SSUdJTiAxeWVhcmRhaWx5CiRUVEwgMzYwMApfaHR0cC5fdGNwIFVSSSAxMCAxICJodHRwczovL3BoLmRvdHBvZGNhc3QuY28vMXllYXJkYWlseS9oZWFkLmpzb24iCg==" +2dopequeens TXT "owner=1MwPD6dH4fE3gQ9mCov81L1DEQWT7E85qH" "seqn=0" "parts=1" "zf0=JE9SSUdJTiAyZG9wZXF1ZWVucwokVFRMIDM2MDAKX2h0dHAuX3RjcCBVUkkgMTAgMSAiaHR0cHM6Ly9waC5kb3Rwb2RjYXN0LmNvLzJkb3BlcXVlZW5zL2hlYWQuanNvbiIK" +10happier TXT "owner=1MwPD6dH4fE3gQ9mCov81L1DEQWT7E85qH" "seqn=0" "parts=1" "zf0=JE9SSUdJTiAxMGhhcHBpZXIKJFRUTCAzNjAwCl9odHRwLl90Y3AgVVJJIDEwIDEgImh0dHBzOi8vcGguZG90cG9kY2FzdC5jby8xMGhhcHBpZXIvaGVhZC5qc29uIgo=" +31thoughts TXT "owner=1MwPD6dH4fE3gQ9mCov81L1DEQWT7E85qH" "seqn=0" "parts=1" "zf0=JE9SSUdJTiAzMXRob3VnaHRzCiRUVEwgMzYwMApfaHR0cC5fdGNwIFVSSSAxMCAxICJodHRwczovL3BoLmRvdHBvZGNhc3QuY28vMzF0aG91Z2h0cy9oZWFkLmpzb24iCg==" +359 TXT "owner=1MwPD6dH4fE3gQ9mCov81L1DEQWT7E85qH" "seqn=0" "parts=1" "zf0=JE9SSUdJTiAzNTkKJFRUTCAzNjAwCl9odHRwLl90Y3AgVVJJIDEwIDEgImh0dHBzOi8vcGguZG90cG9kY2FzdC5jby8zNTkvaGVhZC5qc29uIgo=" +30for30 TXT "owner=1MwPD6dH4fE3gQ9mCov81L1DEQWT7E85qH" "seqn=0" "parts=1" "zf0=JE9SSUdJTiAzMGZvcjMwCiRUVEwgMzYwMApfaHR0cC5fdGNwIFVSSSAxMCAxICJodHRwczovL3BoLmRvdHBvZGNhc3QuY28vMzBmb3IzMC9oZWFkLmpzb24iCg==" +onea TXT "owner=1MwPD6dH4fE3gQ9mCov81L1DEQWT7E85qH" "seqn=0" "parts=1" "zf0=JE9SSUdJTiBvbmVhCiRUVEwgMzYwMApfaHR0cC5fdGNwIFVSSSAxMCAxICJodHRwczovL3BoLmRvdHBvZGNhc3QuY28vb25lYS9oZWFkLmpzb24iCg==" +10minuteteacher TXT "owner=1MwPD6dH4fE3gQ9mCov81L1DEQWT7E85qH" "seqn=0" "parts=1" "zf0=JE9SSUdJTiAxMG1pbnV0ZXRlYWNoZXIKJFRUTCAzNjAwCl9odHRwLl90Y3AgVVJJIDEwIDEgImh0dHBzOi8vcGguZG90cG9kY2FzdC5jby8xMG1pbnV0ZXRlYWNoZXIvaGVhZC5qc29uIgo=" +36questionsthepodcastmusical TXT "owner=1MwPD6dH4fE3gQ9mCov81L1DEQWT7E85qH" "seqn=0" "parts=1" "zf0=JE9SSUdJTiAzNnF1ZXN0aW9uc3RoZXBvZGNhc3RtdXNpY2FsCiRUVEwgMzYwMApfaHR0cC5fdGNwIFVSSSAxMCAxICJodHRwczovL3BoLmRvdHBvZGNhc3QuY28vMzZxdWVzdGlvbnN0aGVwb2RjYXN0bXVzaWNhbC9oZWFkLmpzb24iCg==" +_http._tcp URI 10 1 "https://dotpodcast.co/" +``` + +Each `TXT` record in this zone file encodes a subdomain-creation. +For example, `1yeardaily.verified.podcast` resolves to: + +```bash +$ curl https://core.blockstack.org/v1/names/1yeardaily.verified.podcast +{ + "address": "1MwPD6dH4fE3gQ9mCov81L1DEQWT7E85qH", + "blockchain": "bitcoin", + "last_txid": "d87a22ebab3455b7399bfef8a41791935f94bc97aee55967edd5a87f22cce339", + "status": "registered_subdomain", + "zonefile_hash": "e7acc97fd42c48ed94fd4d41f674eddbee5557e3", + "zonefile_txt": "$ORIGIN 1yeardaily\n$TTL 3600\n_http._tcp URI 10 1 \"https://ph.dotpodcast.co/1yeardaily/head.json\"\n" +} +``` + +This information was extracted from the `1yeardaily` `TXT` resource record in the zone +file for `verified.podcast`. + +### Subdomain Lifecycle + +Note that `1yeardaily.verified.podcast` has a different public key +hash (address) than `verified.podcast`. A BNS node will only process a +subsequent subdomain operation on `1yeardaily.verified.podcast` if it includes a +signature from this address's private key. `verified.podcast` cannot generate +updates; only the owner of `1yeardaily.verified.podcast can do so`. + +The lifecycle of a subdomain and its operations is shown in Figure 2. + +``` + subdomain subdomain subdomain + creation update transfer ++----------------+ +----------------+ +----------------+ +| cicero | | cicero | | cicero | +| owner="1Et..." | signed | owner="1Et..." | signed | owner="1cJ..." | +| zf0="7e4..." |<--------| zf0="111..." |<--------| zf0="111..." |<---- ... +| seqn=0 | | seqn=1 | | seqn=2 | +| | | sig="xxxx" | | sig="xxxx" | ++----------------+ +----------------+ +----------------+ + | | | + | off-chain | | +~ ~ ~ ~ | ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~|~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | ~ ~ ~ ~ ~ ~ ~ ... + | on-chain | | + V V (zone file hash ) V ++----------------+ +----------------+ +----------------+ +| res_publica.id | | jude.id | | res_publica.id | +| NAME_UPDATE |<--------| NAME_UPDATE |<--------| NAME_UPDATE |<---- ... ++----------------+ +----------------+ +----------------+ + blockchain blockchain blockchain + block block block + + +Figure 2: Subdomain lifetime with respect to on-chain name operations. A new +subdomain operation will only be accepted if it has a later "sequence=" number, +and a valid signature in "sig=" over the transaction body. The "sig=" field +includes both the public key and signature, and the public key must hash to +the previous subdomain operation's "addr=" field. + +Thesubdomain-creation and subdomain-transfer transactions for +"cicero.res_publica.id" are broadcast by the owner of "res_publica.id". +However, any on-chain name ("jude.id" in this case) can broadcast a subdomain +update for "cicero.res_publica.id". +``` + +Subdomain operations are ordered by sequence number, starting at 0. Each new +subdomain operation must include: + +* The next sequence number +* The public key that hashes to the previous subdomain transaction's address +* A signature from the corresponding private key over the entire subdomain + operation. + +If two correctly-signed but conflicting subdomain operations are discovered +(i.e. they have the same sequence number), the one that occurs earlier in the +blockchain's history is accepted. Invalid subdomain operations are ignored. + +Combined, this ensures that a BNS node with all of the zone files with a given +subdomain's operations will be able to determine the valid sequence of +state-transitions it has undergone, and determine the current zone file and public +key hash for the subdomain. + +### Resolving Subdomains + +Developers interact with subdomains the same way they interact with names. +Using the BNS API, a developer can: + +#### Look up a subdomain's public key and zone file ([reference](https://core.blockstack.org/#name-querying-get-name-info)) + +```bash +$ curl https://core.blockstack.org/v1/names/aaron.personal.id +{ + "address": "1PwztPFd1s2STMv4Ntq6UPBdYgHSBr5pdF", + "blockchain": "bitcoin", + "last_txid": "85e8273b0a38d3e9f0af7b4b72faf0907de9f4616afc101caac13e7bbc832394", + "status": "registered_subdomain", + "zonefile_hash": "a6dda6b74ffecf85f4a162627d8df59577243813", + "zonefile_txt": "$ORIGIN aaron.personal.id\n$TTL 3600\n_https._tcp URI 10 1 \"https://gaia.blockstack.org/hub/1PwztPFd1s2STMv4Ntq6UPBdYgHSBr5pdF/profile.json\"\n" +} +``` + +#### Look up a subdomain's transaction history ([reference](https://core.blockstack.org/#name-querying-name-history)) + +```bash +$ curl https://core.blockstack.org/v1/names/aaron.personal.id/history +{ + "509981": [ + { + "address": "1PwztPFd1s2STMv4Ntq6UPBdYgHSBr5pdF", + "block_number": 509981, + "domain": "personal.id", + "name": "aaron.personal.id", + "sequence": 0, + "txid": "85e8273b0a38d3e9f0af7b4b72faf0907de9f4616afc101caac13e7bbc832394", + "value_hash": "a6dda6b74ffecf85f4a162627d8df59577243813", + "zonefile": "JE9SSUdJTiBhYXJvbi5wZXJzb25hbC5pZAokVFRMIDM2MDAKX2h0dHBzLl90Y3AgVVJJIDEwIDEgImh0dHBzOi8vZ2FpYS5ibG9ja3N0YWNrLm9yZy9odWIvMVB3enRQRmQxczJTVE12NE50cTZVUEJkWWdIU0JyNXBkRi9wcm9maWxlLmpzb24iCg==" + } + ] +} +``` + +#### Look up the list of names and subdomains owned by a given public key hash ([reference](https://core.blockstack.org/#name-querying-get-names-owned-by-address)) + +```bash +$ curl https://core.blockstack.org/v1/addresses/bitcoin/1PwztPFd1s2STMv4Ntq6UPBdYgHSBr5pdF +{ + "names": [ + "aaron.personal.id" + ] +} +``` + +### Subdomain Creation and Management + +Unlike an on-chain name, a subdomain owner needs an on-chain name owner's help +to broadcast their subdomain operations. In particular: +* A subdomain-creation transaction can only be processed by the owner of the on-chain +name that shares its suffix. For example, only the owner of `res_publica.id` +can broadcast subdomain-creation transactions for subdomain names ending in +`.res_publica.id`. +* A subdomain-transfer transaction can only be broadcast by the owner of the +on-chain name that created it. For example, the owner of +`cicero.res_publica.id` needs the owner of `res_publica.id` to broadcast a +subdomain-transfer transaction to change `cicero.res_publica.id`'s public key. +* In order to send a subdomain-creation or subdomain-transfer, all + of an on-chain name owner's zone files must be present in the Atlas network. + This lets the BNS node prove the *absence* of any conflicting subdomain-creation and +subdomain-transfer operations when processing new zone files. +* A subdomain update transaction can be broadcast by *any* on-chain name owner, + but the subdomain owner needs to find one who will cooperate. For example, +the owner of `verified.podcast` can broadcast a subdomain-update transaction +created by the owner of `cicero.res_publica.id`. + +That said, to create a subdomain, the subdomain owner generates a +subdomain-creation operation for their desired name +and gives it to the on-chain name owner. +The on-chain name owner then uses Atlas to +broadcast it to all other BNS nodes. + +Once created, a subdomain owner can use any on-chain name owner to broadcast a +subdomain-update operation. To do so, they generate and sign the requisite +subdomain operation and give it to an on-chain name owner, who then packages it +with other subdomain operations into a DNS zone file +and sends them all out on the Atlas network. + +If the subdomain owner wants to change the address of their subdomain, they need +to sign a subdomain-transfer operation and give it to the on-chain name owner +who created the subdomain. They then package it into a zone file and broadcast +it. + +### Subdomain Registrars + +Because subdomain names are cheap, developers may be inclined to run +subdomain registrars on behalf of their applications. For example, +the name `personal.id` is used to register Blockstack application users without +requiring them to spend any Bitcoin. + +We supply a reference +implementation of a [BNS Subdomain Registrar](https://github.com/blockstack/subdomain-registrar) +to help developers broadcast subdomain operations. Users would still own their +subdomain names; the registrar simply gives developers a convenient way for them +to register and manage them in the context of a particular application. +Please see the [tutorial on running a subdomain registrar](subdomains.md) for +details on how to use it. + +## BNS Forks + +BNS effectively uses a public blockchain to store a database log. A BNS peer +bootstraps itself by downloading and replaying the database log from the +blockchain, and in doing so, will calculate the same name database state as +every other (honest) BNS peer that has the same view of the blockchain. + +Crucially, BNS is built on top of a public blockchain that is *unaware* of BNS's existence. +This means that the blockchain peers do not validate BNS transactions. Instead, +the BNS peer needs to do so, and must know how to *reject* both invalid transactions +as well as well-formed transactions from dishonest peers (i.e. peers that do not +follow the same consensus rules). + +BNS nodes do not directly communicate with one another---by design, the set of +BNS peers is not enumerable. The only shared communication medium between BNS +peers is the blockchain. + +To identify and reject invalid and malicious transactions without the blockchain's help, +the log of name operations embedded in the blockchain is constructed as a +[fork\*-consistent](http://www.scs.stanford.edu/~jinyuan/bft2f.pdf) database +log. Fork\*-consistency is a [consistency +model](https://en.wikipedia.org/wiki/Consistency_model) whereby the state +replicas in all of the nodes exhibit the following properties: + +* Each correct peer maintains a history of well-formed, valid state operations. In this + case, each correct BNS node maintains a copy of the history blockchain transactions +that encoded well-formed, valid name operations. + +* Each honest peer's history contains the sequence of all operations that it + sent. That is, a user's BNS peer's transaction log will contain the sequence of all valid +transactions that the user's client wrote to the blockchain. + +* If two peers accept operations *op* and *op'* from the same correct client, + then both of their logs will have the both operations in the same order. If +*op'* was accepted before *op*, then both peers' logs are identical up to *op'*. +In BNS, this means that if two peers both accept a given transaction, then it +means that they have accepted the same sequence of prior transactions. + +This means that unlike with blockchains, +there can be *multiple long-lived conflicting forks* of the BNS database log. +However, due to fork\*-consistency, a correct BNS peer will only process *one* +of these forks, and will *ignore* transactions from peers in other forks. In other words, +fork\*-consistency partitions the set of BNS peers into different **fork-sets**, +where all peers in a fork-set process each other's transactions, but the +completely ignore peers in other fork-sets. + +BNS nodes identify which fork set they belong to using a **consensus hash**. The +consensus hash is a cryptographic digest of a node's operation +history. Each BNS peer calculates a new consensus hash each time it processes a +new block, and stores the history of consensus hashes for each block it +processed. + +Two honest BNS peers can quickly determine if they are in the same fork-set by querying +each other's consensus hashes for a given block. If they match, then they are +in the same fork-set (assming no hash collisions). + +A BNS client executes a name operation on a specific fork-set by including a +recent consensus hash from that fork-set in the blockchain transaction. +At the same time, the BNS consensus rules state that a transaction can only be +accepted if it included a recent valid consensus hash. +This means that all BNS nodes in the client's desired fork-set will accept +the transaction, and all other BNS nodes not in the fork-set will ignore it. +You can see where the consensus hash is included in blockchain transactions by reading +the [transaction wire format](wire-format.md) document. + +### Fork-set Selection + +The blockchain linearizes the history of transactions, which means that +in general, there exists a fork-set for each distinct set of BNS +consensus rules. For example, the Blockstack Core [2016 hard fork](release_notes/changelog-0.14.md) +and [2017 hard fork](release_notes/changelog-0.17.md) both introduced new consensus +rules, which means at the time of this writing there are three possible fork-sets: +the pre-2016 fork-set, the 2016-2017 fork-set, and the post-2017 fork-set. +The [public BNS nodes](https://node.blockstack.org:6263) are always running +in the fork-set with the latest consensus rules. + +BNS clients are incentivized to communicate with peers in the fork-set that has +the most use, since this fork-set's name database will encode name/state +bindings that are the most widely-accepted and understood by users. +To identify this fork-set, a BNS client needs to learn one of +its recent consensus hashes. Once it has a recent consensus hash, it can +query an *untrusted* BNS node for a copy of +its name database, and use the consensus hash to verify that the name database +was used to generate it. + +How does a BNS node determine whether or not a consensus hash corresponds to the +most widely-used fork-set? There are two strategies: + +* Determine whether or not a *characteristic transaction* was accepted by the +widely-used fork-set. If a client knows that a specific transaction belongs to +the widely-used fork-set and not others, then they can use the consensus hash to +efficiently determine whether or not a given node belongs to this fork-set. + +* Determine how much "economic activity" exists in a fork-set by inspecting +the blockchain for burned cryptocurrency tokens. Namespace and name +registrations are structured in a way that sends cryptocurrency tokens to either +a well-known burn address, or to an easily-queried pay-to-namespace-creator +address. + +Both strategies rely on the fact that the consensus hash is calculated as a +[Merkle skip-list](https://github.com/blockstack/blockstack-core/issues/146) +over the BNS node's accepted transactions. A client can use a consensus hash to +determine whether or not a transaction *T* was accepted by a node with *O(log +n)* time and space complexity. We call the protocol for resolving a consensus hash to a specific transaction +**Simplified Name Verification** (SNV). See our [paper on the subject](https://blockstack.org/virtualchain_dccl16.pdf) +for details of how SNV works under the hood. + +If the client has a consensus hash and knows of a characteristic transaction in the widely-used fork-set, +it can use SNV to determine whether or not a node belongs to the fork-set that accepted it. + +If the client knows about multiple conflicting consensus hashes, +they can still use SNV to determine which one corresponds +to the most-used fork-set. To do so, the client would use a +[blockchain explorer](https://explorer.blockstack.org) to find the +list of transactions that burned cryptocurrency tokens. Each of these +transactions will be treated as potential characteristic transactions: +the client would first select the subset of transactions that are well-formed +BNS transactions, and then use SNV to determine which of them correspond to which +consensus hashes. The client chooses the consensus hash that corresponds +to the fork-set with the highest cumulative burn. + +Work is currently underway to automate this process. + +## Decentralized Identifiers (DIDs) + +BNS nodes are compliant with the emerging +[Decentralized Identity Foundation](http://identity.foundation) protocol +specification for decentralized identifiers (DIDs). + +Each name in BNS has an associated DID. The DID format for BNS is: + +``` + did:stack:v0:{address}-{index} +``` + +Where: +* `{address}` is an on-chain public key hash (e.g. a Bitcoin address). +* `{index}` refers to the `nth` name this address created. + +For example, the DID for `personal.id` is +`did:stack:v0:1dARRtzHPAFRNE7Yup2Md9w18XEQAtLiV-0`, because the name +`personal.id` was the first-ever name created by +`1dARRtzHPAFRNE7Yup2Md9w18XEQAtLiV`. + +As another example, the DID for `jude.id` is `did:stack:v0:16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg-1`. +Here, the address `16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg` had created one earlier +name in history prior to this one (which happens to be `abcdefgh123456.id`). + +The purpose of a DID is to provide an eternal identifier for a public key. +The public key may change, but the DID will not. + +Blockstack Core implements a DID method of its own +in order to be compatible with other systems that use DIDs for public key resolution. +In order for a DID to be resolvable, all of the following must be true for a +name: + +* The name must exist +* The name's zone file hash must be the hash of a well-formed DNS zone file +* The DNS zone file must be present in the BNS [Atlas Network](atlas_network.md) +* The DNS zone file must contain a `URI` resource record that points to a signed + JSON Web Token +* The public key that signed the JSON Web Token (and is included with it) must + hash to the address that owns the name + +Not all names will have DIDs that resolve to public keys. However, names created by the [Blockstack +Browser](https://github.com/blockstack/blockstack-browser) will have DIDs that +do. + +Developers can programmatically resolve DIDs via the Python API: + +```Python +>>> import blockstack +>>> blockstack.lib.client.resolve_DID('did:stack:v0:16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg-1', hostport='https://node.blockstack.org:6263') +{'public_key': '020fadbbcea0ff3b05f03195b41cd991d7a0af8bd38559943aec99cbdaf0b22cc8'} +``` + +A RESTful API is under development. + +### DID Encoding for Subdomains + +Every name and subdomain in BNS has a DID. The encoding is slightly different +for subdomains, so the software can determine which code-path to take. + +* For on-chain BNS names, the `{address}` is the same as the Bitcoin address + that owns the name. Currently, both version byte 0 and version byte 5 +addresses are supported (i.e. addresses starting with `1` or `3`, meaning `p2pkh` and +`p2sh` addresses). + +* For off-chain BNS subdomains, the `{address}` has version byte 63 for + subdomains owned by a single private key, and version byte 50 for subdomains +owned by a m-of-n set of private keys. That is, subdomain DID addresses start +with `S` or `M`, respectively. + +The `{index}` field for a subdomain's DID is distinct from the `{index}` field +for a BNS name's DID, even if the same created both names and subdomains. +For example, the name `abcdefgh123456.id` has the DID `did:stack:v0:16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg-0`, +because it was the first name created by `16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg`. +However, `16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg` *also* created `jude.statism.id` +as its first subdomain name. The DID for `jude.statism.id` is +`did:stack:v0:SSXMcDiCZ7yFSQSUj7mWzmDcdwYhq97p2i-0`. Note that the address +`SSXMcDiCZ7yFSQSUj7mWzmDcdwYhq97p2i` encodes the same public key hash as the address +`16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg` (the only difference between these two +strings is that the first is base58check-encoded with version byte 0, and the +second is encoded with version byte 63). + +You can see this play out in practice with the following code snippit: + +```python +>>> import blockstack +>>> blockstack.lib.client.get_name_record('jude.statism.id', hostport='https://node.blockstack.org:6263')['address'] +u'16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg' +>>> import virtualchain +>>> virtualchain.address_reencode('16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg', version_byte=63) +'SSXMcDiCZ7yFSQSUj7mWzmDcdwYhq97p2i' +>>> blockstack.lib.client.resolve_DID('did:stack:v0:SSXMcDiCZ7yFSQSUj7mWzmDcdwYhq97p2i-0', hostport='https://node.blockstack.org:6263') +{'public_key': '020fadbbcea0ff3b05f03195b41cd991d7a0af8bd38559943aec99cbdaf0b22cc8'} +``` + +## Summary + +BNS is a decentralized naming system that produces names that are +globally-unique, human-readable, and strongly-owned. It does so by embedding a +database log within a public blockchain like Bitcoin, and replaying it locally +to calculate the state and owner of each name. In doing so, a BNS node provides +a full replica of all of the network's state, which gives it the ability to +service queries like prior name states and name historys. + +BNS groups names by namespaces in order to provide different ways to register +and use names, and furthermore implements subdomains to provide a cheap, +scalable way to register many names for the cost of a single blockchain +transaction. + +[Blockstack Core](https://github.com/blockstack/blockstack-core) is the +reference implementation of BNS, and provides a public BNS node with online +documentation at https://core.blockstack.org. + +## Appendix 1: Feature Comparison + +BNS is not the only naming system in wide-spread use, nor is it the only +decentralized naming system that implements human-readable, +globally-unique, and strongly-owned names. The following feature table +describes how BNS differs from other naming systems + +| Feature | BNS | [ENS](https://ens.domains/) | DNS | [Namecoin](https://namecoin.org/) | +|----------------------------|-----|-----|-----|----------| +| Globally unique names | X | X | X | X | +| Human-readable names | X | X | X | X | +| Strongly-owned names | X | X | | X | +| Names are enumerable | X | | | X | +| Registration times | 1-2 hours | ~1 week | ~1 day | 1-2 hours | +| Subdomain registration times | 1 hour (instant with [#750](https://github.com/blockstack/blockstack-core/issues/750)) | varies | instant | ~1 hour | +| Anyone can make a TLD/namespace | X | [1] | | [1] | +| TLD/Namespace owners get registration fees | X | | X | | +| TLD/Namespace can be seeded with initial names | X | | X | | +| Portable across blockchains | X | | N/A | | +| Off-chain names | X | | N/A | | +| Off-chain name state | X | X | N/A | | +| Name provenance | X | X | | X | +| [DID](http://identity.foundation) support | X | | | | +| Turing-complete namespace rules | | X | X | | +| Miners are rewarded for participating | [1] | | N/A | X | + +[1] Requires support in higher-level applications. These systems are not aware +of the existence of namespaces/TLDs at the protocol level. + +[2] Blockstack Core destroys the underlying blockchain token to pay for +registration fees when there is no pay-to-namespace-creator address set in the +name's namespace. This has the effect of making the blockchain miners' holdings +slightly more valuable. + diff --git a/_site/core/cli.md b/_site/core/cli.md new file mode 100644 index 00000000..09b7f060 --- /dev/null +++ b/_site/core/cli.md @@ -0,0 +1,530 @@ +# Blockstack CLI + +Blockstack CLI is both a command-line interface (CLI) tool, a system service (daemon), and a client (Python library) for interacting with Blockstack. It talks to Blockstack Core and provides an interface for interacting with it. + +## Architecture Overview + +Most of the complexity of Blockstack lives in its client library. Specifically, the library does the following: + +* Generating and sending name operation transactions. +* Reading, writing, and deleting data in your storage providers (and reading other peoples' data from their storage providers). +* Handling data authenticity, encryption, and validation. +* Querying a Blockstack Server for blockchain-hosted information. + +The CLI tool is a wrapper around the library. Most of its commands are thin wrappers around library functions. + +In addition to a CLI tool and library, Blockstack CLI comes with a system service that runs in the background as a daemon. The daemon does the following: + +* Acts as a personal registrar. It queues up all your name operation transactions, waits for them to be confirmed by the blockchain, sends them out, and replicates your zonefile and profile as needed. +* Hosts your wallet. Your wallet is never stored in plaintext; it only lives in the daemon's RAM (for when it needs to send out transactions). +* Allows programmatic access to a subset of CLI commands. This allows other programs on your computer to do things like look up Blockstack IDs, query their data, and so on. For security, the daemon will never serve the wallet via the API, nor does it expose any API call that can change data or send transactions (it is effectively a read-only API). + +## Files + +These files are created by Blockstack CLI: + +### Files You Can Edit + +These files define how the CLI behaves. + +* `~/.blockstack/client.ini`: This is the CLI config file. You can interactively modify it with `blockstack configure`. +* `~/.blockstack/wallet.json`: This is your JSON-encoded wallet. It contains your password-encrypted keys. + +### Files You Can Read + +These files are useful primarily for troubleshooting. + +* `~/.blockstack/api_endpoint.log`: This is the log for the system service that manages your wallet, sends your name operations, and accesses your profile and data. It's a great source for troubleshooting. +* `~/.blockstack/api_endpoint.pid`: This contains the PID of the system service. +* `~/.blockstack/metadata/`: This directory contains versioning information for mutable data from other profiles you have read. It gets used to stop malicious storage providers from serving you older versions of the data you've already seen. +* `~/.blockstack/storage-disk/`: If you use the `disk` storage driver (it is activated by default), then this is where it holds your zonefiles, profiles, and data. + +### Files You Should NOT Edit + +You shouldn't touch these files unless you're a developer, and even then, you should only do so at your own risk. + +* `~/.blockstack/queues.db`: This is a SQLite database that contains queued-up transactions for name operations. If you want to remove any stuck transactions, use `blockstack unqueue` in the [advanced](https://github.com/blockstack/blockstack-cli/blob/master/docs/advanced_usage.md) usage. +* `~/.blockstack/registrar.lock`: This is a lockfile held by a thread in the registrar thread in the CLI daemon. +* `~/.blockstack/blockchain_headers.dat`: SPV headers. +* `~/.blockstack/client.uuid`: Used for anonymous statistics gathering purposes (which you can disable using `blockstack configure`). If you remove it, a new one will be generated. + +## Getting Help + +If you ever need help with these instructions or want to learn more, please join the [Blockstack Slack](https://blockstack.slack.com) and drop us a line on the \#cli channel. + +## Installation + +Installing the command line interface and client library: + +### Debian + Ubuntu + +Via APT: +``` +$ curl https://raw.githubusercontent.com/blockstack/packaging/master/repo-key.pub | sudo apt-key add - +$ sudo sh -c "echo \"deb http://packages.blockstack.com/repositories/ubuntu xenial main\" > /etc/apt/sources.list.d/blockstack.list" +$ sudo apt-get update +$ sudo apt-get install blockstack +``` + +Via pip: +``` +$ sudo apt-get update && sudo apt-get install -y python-pip python-dev libssl-dev libffi-dev rng-tools +$ sudo pip install blockstack --upgrade +``` + +### OS X + +```bash +$ brew install libffi openssl +$ sudo pip install blockstack --upgrade +``` + +We recommend installing the CLI inside of a [virtual environment](http://docs.python-guide.org/en/latest/dev/virtualenvs/), in which case you can drop the "sudo" at the beginning like so: + +```bash +$ pip install blockstack --upgrade +``` + +If the installation command above fails, see the [troubleshooting section](#troubleshooting-installation). + +### Windows Subsystem for Linux + +Installation will mirror `Debian + Ubuntu`, above, with an additional package. + +```bash +$ sudo apt-get update && sudo apt-get install -y python-pip python-dev libssl-dev libffi-dev +``` + +```bash +$ sudo pip install functools32 +$ sudo pip install blockstack +``` + +## Command-Line Reference + +### Listing All Commands + +```bash +$ blockstack +usage: blockstack [-h] + ... + +Blockstack cli version 0.14.0 +positional arguments: + balance Get the account balance + configure Interactively configure the client + deposit Display the address with which to receive bitcoins + import Display the address with which to receive names + info Get details about pending name commands + lookup Get the zone file and profile for a particular name + migrate Migrate a profile to the latest profile format + names Display the names owned by local addresses + ping Check server status and get server details + price Get the price of a name + register Register a name + renew Renew a name + revoke Revoke a name + set_advanced_mode Enable advanced commands + transfer Transfer a name to a new address + update Set the zone file for a name + whois Look up the blockchain info for a name + +optional arguments: + -h, --help show this help message and exit +``` + +### Info (or ping or status) + +```bash +$ blockstack info +``` + +##### Examples + +```bash +$ blockstack info +{ + "advanced_mode": false, + "cli_version": "0.14.0", + "consensus_hash": "106d4648661d49e16d103b071e26617e", + "last_block_processed": 420518, + "last_block_seen": 420596, + "server_alive": true, + "server_host": "40.76.8.249", + "server_port": "6264", + "server_version": "0.14.0" +} +``` + +### Config + +```bash +$ blockstack configure +``` + +##### Examples + +```bash +$ blockstack configure +# ... interactive prompts ... +{ + "path": "/home/jude/.blockstack/client.ini" +} +``` + +### Cost + +```bash +$ blockstack price +``` + +##### Examples + +```bash +$ blockstack price $(whoami).id +{ + "name_price": { + "btc": "0.00025", + "satoshis": "25000" + }, + "preorder_tx_fee": { + "btc": "0.00047406", + "satoshis": "47406" + }, + "register_tx_fee": { + "btc": "0.00046184", + "satoshis": "46184" + }, + "total_estimated_cost": { + "btc": "0.00188394", + "satoshis": "188394" + }, + "update_tx_fee": { + "btc": "0.00069804", + "satoshis": "69804" + } +} +``` + +### Whois + +```bash +$ blockstack whois +``` + +##### Examples + +```bash +$ blockstack whois fredwilson.id +{ + "block_preordered_at": 374084, + "block_renewed_at": 374084, + "expire_block": 426679, + "has_zonefile": true, + "last_transaction_id": "2986ec31ec957692d7f5bc58a3b02d2ac2d1a60039e9163365fc954ff51aeb5a", + "owner_address": "1F2nHEDLRJ39XxAvSxwQhJsaVzvS5RHDRM", + "owner_script": "76a91499e7f97f5d2c77b4f32b4ed9ae0f0385c45aa5c788ac", + "zonefile_hash": "1a587366368aaf8477d5ddcea2557dcbcc67073e" +} +``` + +```bash +$ blockstack whois $(whoami)_$(date +"%m_%d").id +Not found. +``` + +### Lookup + +```bash +$ blockstack lookup +``` + +##### Examples + +```bash +$ blockstack lookup fredwilson.id +{ + "profile": { + "avatar": { + "url": "https://s3.amazonaws.com/kd4/fredwilson1" + }, + "bio": "I am a VC", + ... +} + +``` + +```bash +$ blockstack lookup $(whoami)_$(date +"%m_%d").id +Not found. +``` + +### Register + +```bash +$ blockstack register +``` + +##### Example + +```bash +$ blockstack register $(whoami)_$(date +"%m_%d").id +Registering muneeb_02_22.id will cost 0.0002225 BTC. Continue? (y/n): y +{ + "transaction_hash": "f576313b2ff4cc7cb0d25545e1e38e2d0d48a6ef486b7118e5ca0f8e8b98ae45", + "message": "The name has been queued up for registration and will take a few hours to go through. You can check on the status at any time by running 'blockstack info'." + "success": true +} +``` + +```bash +$ blockstack register fredwilson.id +fredwilson.id is already registered. +``` + +### Update + +```bash +$ blockstack update +``` + +##### Examples + +```bash +$ echo > new_zone_file.txt <
      +``` + +##### Examples + +```bash +$ blockstack transfer $(whoami)_$(date +"%m_%d").id 1Jbcrh9Lkwm73jXyxramFukViEtktwq8gt +{ + "transaction_hash": "8a68d52d70cf06d819eb72a9a58f4dceda942db792ceb35dd333f43f55fa8713", + "message": "The name has been queued up for transfer and will take ~1 hour to process. You can check on the status at any time by running 'blockstack info'." + "success": true +} +``` + +```bash +$ blockstack transfer fredwilson.id 1Jbcrh9Lkwm73jXyxramFukViEtktwq8gt +fredwilson.id is not in your possession. +``` + +### Balance + +```bash +$ blockstack balance +``` + +##### Examples + +```bash +$ blockstack balance +{ + "addresses": [ + { + "address": "16yE3e928JakaXbympwSywyrJPM9cuL4wZ", + "bitcoin": 0.00959454, + "satoshis": 959454 + } + ], + "total_balance": { + "bitcoin": 0.00959454, + "satoshis": 959454 + } +} +``` + +### Names + +```bash +$ blockstack names +``` + +##### Examples + +```bash +$ blockstack names +{ + "addresses": [ + { + "address": "16CtpS8LhmW3bGtVC69UGZ3wSwvi95BE8E", + "names_owned": [ + "testregistration001.id", + "testregistration002.id" + ] + } + ], + "names_owned": [ + "testregistration001.id", + "testregistration002.id" + ] +} +``` + +### Deposit + +```bash +$ blockstack deposit +``` + +##### Examples + +```bash +$ blockstack deposit +{ + "address": "1EHgqHVpA1tjn6RhaVj8bx6y5NGvBwoMNS", + "message": "Send bitcoins to the address specified.", +} +``` + +### Import + +```bash +$ blockstack import +``` + +##### Examples + +```bash +$ blockstack import +{ + "address": "1Jbcrh9Lkwm73jXyxramFukViEtktwq8gt" + "message": "Send the name you want to receive to the address specified.", +} +``` + +## Troubleshooting Installation + +**a) Error installing pycrypto** + +If you see the following error, while pycrpyto installs on OS X: + +```bash +error: command 'cc' failed with exit status 1 +``` + +Try installing it with the following: + +```bash +$ ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install pycrypto +``` + +**b) Blockstack hangs while running in a VM** + +If Blockstack hangs while performing one of the above operations while running in a VM, and you hit Ctrl+C, you +may see a stack trace like this: + +``` +Traceback (most recent call last): + File "/home/dev/blockstack-venv/bin/blockstack", line 67, in + result = run_cli() + File "/home/dev/blockstack-venv/local/lib/python2.7/site-packages/blockstack_client/cli.py", line 287, in run_cli + result = method( args, config_path=config_path ) + File "/home/dev/blockstack-venv/local/lib/python2.7/site-packages/blockstack_client/actions.py", line 479, in cli_price + fees = get_total_registration_fees( fqu, payment_privkey_info, owner_privkey_info, proxy=proxy, config_path=config_path, payment_address=payment_address ) + File "/home/dev/blockstack-venv/local/lib/python2.7/site-packages/blockstack_client/actions.py", line 271, in get_total_registration_fees + preorder_tx_fee = estimate_preorder_tx_fee( name, data['satoshis'], payment_address, utxo_client, owner_privkey_params=get_privkey_info_params(owner_privkey_info), config_path=config_path, include_dust=True ) + File "/home/dev/blockstack-venv/local/lib/python2.7/site-packages/blockstack_client/backend/nameops.py", line 116, in estimate_preorder_tx_fee + fake_privkey = make_fake_privkey_info( owner_privkey_params ) + File "/home/dev/blockstack-venv/local/lib/python2.7/site-packages/blockstack_client/backend/nameops.py", line 103, in make_fake_privkey_info + return virtualchain.make_multisig_wallet( m, n ) + File "/home/dev/blockstack-venv/local/lib/python2.7/site-packages/virtualchain/lib/blockchain/bitcoin_blockchain/multisig.py", line 82, in make_multisig_wallet + pk = BitcoinPrivateKey().to_wif() + File "/home/dev/blockstack-venv/local/lib/python2.7/site-packages/pybitcoin/privatekey.py", line 55, in __init__ + secret_exponent = random_secret_exponent(self._curve.order) + File "/home/dev/blockstack-venv/local/lib/python2.7/site-packages/pybitcoin/privatekey.py", line 32, in random_secret_exponent + random_hex = hexlify(dev_random_entropy(32)) + File "/home/dev/blockstack-venv/local/lib/python2.7/site-packages/utilitybelt/entropy.py", line 38, in dev_random_entropy + return open("/dev/random", "rb").read(numbytes) +KeyboardInterrupt +``` + +If so, the reason is because the VM does not have enough entropy. This causes reads to `/dev/random` to block +for a long time. + +The solution is to install `rng-tools` and configure it to seed `/dev/random` with entropy from `/dev/urandom`. +Please see your distribution documentation for setting up `rng-tools`. + +If the issue you are experiencing is not listed here, please +[report it as a new issue](https://github.com/blockstack/blockstack-client/issues/new). + +## Running Your Server + +The CLI by default talks to a remote server, but you can easily start your own server. + +Open a new terminal window and run the following command: + +```bash +$ blockstack-server start --foreground +``` + +You can now switch the cli to use the local server: + +```bash +$ blockstack configure +... +server (default: 'node.blockstack.org'): 127.0.0.1 +... +``` + +[More information on the Blockstack Server(http://github.com/blockstack/blockstack-server) + +## Client Library + +You can also import the blockstack client and write your own programs. + +Here is some example code to get you started: + +```python +from blockstack_client import client +from blockstack_client.utils import print_result as pprint + +client.session(server_host='127.0.0.1', server_port=6264) +resp = client.ping() +pprint(resp) +``` diff --git a/_site/core/faq_technical.md b/_site/core/faq_technical.md new file mode 100644 index 00000000..f1f1c30f --- /dev/null +++ b/_site/core/faq_technical.md @@ -0,0 +1,385 @@ +# Blockstack Technical FAQ + +This document lists frequently-asked questions and answers to technical +questions about Blockstack. + +If you are new to Blockstack, you should read the +[non-technical FAQ](https://blockstack.org/faq) first. + +If you have a technical question that gets frequently asked on the +[forum](https://forum.blockstack.org) or [Slack](https://blockstack.slack.com), +feel free to send a pull-request with the question and answer. + +# General Questions + +## What is Blockstack? + +Blockstack is a new Internet for decentralized applications. Blockstack +applications differ from Web applications in two ways: + +* **Users own their identities**. The user brings their identity to the + applications; applications do not require the user to create accounts and +passwords. +* **Users own their data**. Users control who can read it, and where it gets stored. + The application does not need to worry about hosting any user data. + +The Blockstack project provides all of the infrastructure required for building +these kinds of applications. + +## Is Blockstack decentralized? + +Yes! The components that make up Blockstack do not have any central points of +control. + +* The [Blockstack Naming Service](blockstack_naming_service.md) runs on top of + the Bitcoin blockchain, which itself is decentralized. It binds Blockstack +IDs to a small amount of on-chain data (usually a hash of off-chain data). +* The [Atlas Peer Network](atlas_network.md) stores chunks of data referenced by +names in BNS. It operates under similar design principles to BitTorrent, and +has no single points of failure. The network is self-healing---if a node +crashes, it quickly recovers all of its state from its peers. +* The [Gaia storage system](https://github.com/blockstack/gaia) lets users + choose where their application data gets hosted. Gaia reduces all storage +systems---from cloud storage to peer-to-peer networks---to dumb, interchangeable +hard drives. Users have maximum flexibility and control over their data in a +way that is transparent to app developers. + +## Are Blockstack applications usable today? + +Yes! Blockstack applications are as easy to use as normal Web applications, if +not easier. Moreover, they are just as performant if not more so. + +If you install the [Blockstack +Browser](https://github.com/blockstack/blockstack-browser), or use our +[Web-hosted Blockstack Browser](https://browser.blockstack.org), you can get +started with them right away. + +## Where does Blockstack keep my user account? + +Your user account is ultimately controlled by a [private +key](https://en.wikipedia.org/wiki/Public-key_cryptography). You and only you +know what the private key is, and using your private key, you can prove to other +people that you own a particular piece of data (such as your Blockstack ID). + +Your private key resides within your locally-running Blockstack Browser. +It never leaves your computer. + +Your public keys are stored off-chain, and the *hash* of your public key is +stored on the Bitcoin blockchain. The [Blockstack Naming +Service](blockstack_naming_service.md) allows anyone to look up your public key +hash, given your Blockstack ID. + +## Where does Blockstack keep my app data? + +As a Blockstack user, you can choose exactly where your data gets stored. +Blockstack uses a decentralized storage system called +[Gaia](https://github.com/blockstack/gaia) to host your data. Gaia is different +from other storage systems because it lets you securely host your data wherever you want---in cloud +storage providers, on your personal server, or in another decentralized storage +system like BitTorrent or IPFS. + +When you register, you are given a default Gaia hub that replicates your +data to a bucket in Microsoft Azure. However, you can configure and +deploy your own Gaia hub and have Blockstack store your data there instead. + +The [Blockstack Naming Service](blockstack_naming_service.md) and the [Atlas +network](atlas_network.md) work together to help other users discover your +app-specific public data, given your Blockstack ID. + +# Blockstack IDs + +## What is a Blockstack ID? + +Blockstack IDs are usernames. Unlike normal Web app usernames, Blockstack IDs +are usable *across every Blockstack app.* They fill a similar role to +centralized single-signon services like Facebook or Google. However, you and +only you control your Blockstack ID, and no one can track your logins. + +## How do I get a Blockstack ID? + +If you install the [Blockstack +Browser](https://github.com/blockstack/blockstack-browser) or use the +[Web-hosted Blockstack Browser](https://browser.blockstack.org), you can +purchase one with Bitcoin. + +## Do I need a Blockstack ID to use Blockstack apps? + +No, you can use Blockstack applications right away. However, if you want to +*share data with other users*, then you need a Blockstack ID. + +## Why do I need a Blockstack ID? + +Blockstack IDs are used to discover where you are keeping your +(publicly-readable) application data. For example, if `alice.id` wants to share +a document with `bob.id`, then `bob.id`'s browser uses the Blockstack ID +`alice.id` to look up where `alice.id` stored it. + +The technical descriptions of how and why this works are quite long. +Please see the [Blockstack Naming Service](blockstack_naming_service.md) +documentation for a full description. + +## What is a Blockstack Subdomain? + +This is also a Blockstack ID, and can be used for all the things a Blockstack ID +can be used for. The only difference is that they have the format `foo.bar.baz` +instead of `bar.baz`. For example, +[jude.personal.id](https://core.blockstack.org/v1/users/jude.personal.id) is a +Blockstack ID, and is a subdomain of `personal.id`. + +Subdomains are first-class Blockstack IDs---they can be used for all the same +things that an on-chain Blockstack ID can be used for, and they have all of +the same safety properties. They are globally unique, they are strongly owned +by a private key, and they are human-readable. + +Subdomains are considerably cheaper than Blockstack IDs, since hundreds of them +can be registered with a single transaction. The [BNS +documentation](blockstack_naming_service.md) describes them in detail. + +Subdomains provide a fast, inexpensive way to onboard many users at once. + +## Can I get a Blockstack ID without spending Bitcoin? + +Blockstack subdomains can be obtained without spending Bitcoin +by asking a subdomain registrar to create one for you. + +## Is there a Blockstack name explorer? + +Yes! It's at https://explorer.blockstack.org + +# Blockstack App Development + +## I'm a Web developer. Can I build on Blockstack? + +Yes! Blockstack is geared primarily towards Web developers. All of your +existing knowledge is immediately applicable to Blockstack. Anything you can do +in a Web browser, you can do in a Blockstack app. + +## I'm a non-Web developer. Can I build on Blockstack? + +Yes! Blockstack implements a [RESTful API](https://core.blockstack.org) which +lets you interact with Blockstack from any language and any runtime. In fact, +the reference client +([blockstack.js](https://github.com/blockstack/blockstack.js)) is mainly a +wrapper around these RESTful API calls, so you won't be missing much by using a +language other than Javascript. + +## What's the difference between a Web app and a Blockstack app? + +Blockstack apps are built like [single-page Web +apps](https://en.wikipedia.org/wiki/Single-page_application)---they are, in +fact, a type of Web application. + +Blockstack apps are a subset of Web applications that use Blockstack's +technology to preserve the user's control over their identities and data. +As such, they tend to be simpler +in design and operation, since in many cases they don't have to host anything +besides the application's assets. + +## Do I need to learn any new languages or frameworks? + +No. Blockstack applications are built using existing Web frameworks and programming +The only new thing you need to learn is either [blockstack.js](https://github.com/blockstack/blockstack.js) or +the [Blockstack RESTful API](https://core.blockstack.org). + +## How does my Web app interact with Blockstack? + +The [blockstack.js](https://github.com/blockstack/blockstack.js) library gives +any Web application the ability to interact with Blockstack's authentication and +storage services. In addition, we supply a [public RESTful API](https://core.blockstack.org). + +## What does `blockstack.js` do? + +This is the reference client implementation for Blockstack. You use it in your +Web app to do the following: + +* Authenticate users +* Load and store user data +* Read other users' public data + +## How do I use `blockstack.js`? + +Please see the API documentation [here](https://github.com/blockstack/blockstack.js). + +## How can I look up names and profiles? + +You can use `blockstack.js`, or you can use the [public Blockstack Core +endpoint](https://core.blockstack.org). + +## How can I read my public app data without `blockstack.js`? + +The URLs to a user's public app data are in a canonical location in their +profile. For example, here's how you would get public data from the +[Publik](https://publik.ykliao.com) app, stored under the Blockstack ID `ryan.id`. + +1. Get the bucket URL +```bash +$ BUCKET_URL="$(curl -sL https://core.blockstack.org/v1/users/ryan.id | jq -r '."ryan.id"["profile"]["apps"]["http://publik.ykliao.com"]')" +$ echo "$BUCKET_URL" +https://gaia.blockstack.org/hub/1FrZTGQ8DM9TMPfGXtXMUvt2NNebLiSzad/ +``` + +2. Get the data +```bash +$ curl -sL "${BUCKET_URL%%/}/statuses.json" +[{"id":0,"text":"Hello, Blockstack!","created_at":1515786983492}] +``` + +## How do I register Blockstack IDs? + +You should use the [Blockstack Browser](https://github.com/blockstack/blockstack-browser). + +## How do I register Blockstack Subdomains? + +You can deploy and use a [Blockstack Subdomain Registrar](subdomains.md), or +use an existing one. + +## Can I programmatically register Blockstack IDs? + +Blockstack applications do not currently have +have access to the user's wallet. Users are expected to +register Blockstack IDs themselves. + +However, if you feel particularly ambitious, you can do one of the following: + +* Set up a `blockstack api` endpoint (see the project [README](../README.md)) and write a + program to automatically register names. Also, see the [API +documentation](https://blockstack.github.io/blockstack-core/#managing-names-register-a-name) +for registering names on this endpoint. + +* Write a `node.js` program that uses `blockstack.js` to register + names. This is currently in development. + +## Can I programmatically register Blockstack Subdomains? + +Yes! Once you deploy your own subdomain registrar, you can have your Web app +send it requests to register subdomains on your Blockstack ID. You can also +create a program that drives subdomain registration on your Blockstack ID. + +## Do you have a testnet or sandbox to experiment with Blockstack? + +We have an [integration test framework](../integration_tests) that provides a +private Blockstack testnet. It uses `bitcoin -regtest` to create a private +blockchain that you can interact with, without having to spend any Bitcoin or +having to wait for blocks to confirm. Please see the +[README](../integration_tests/README.md) for details. + +## Does Blockstack have a smart contract system? + +No, not yet. This is because +Blockstack's design philosophy focuses on keeping system complexity at the +"edges" of the network (e.g. clients), instead of the "core" of the network (e.g. +the blockchain), in accordance with the [end-to-end +principle](https://en.wikipedia.org/wiki/End-to-end_principle). +Generally speaking, this can be interpreted as "if you can do X without +a smart contract, you should do X without a smart contract." This organizing +principle applies to a lot of useful decentralized applications. + +## Can Blockstack applications interact with Bitcoin? Ethereum? Smart contracts? Other blockchains? + +Yes! Since Blockstack applications are built like Web applications, all you need to do is include the +relevant Javascript library into your application. + +## Do you have a Blockstack app development tutorial? + +Yes! See [here](https://blockstack.org/tutorials). + +# Comparisons to Other Systems + +## Blockstack vs DNS + +Blockstack and DNS both implement naming systems, but in fundamentally +different ways. Blockstack *can be used* for resolving host names to IP +addresses, but this is not its default use-case. The [Blockstack Naming +Service](blockstack_naming_service.md) (BNS) instead behaves +more like a decentralized +[LDAP](https://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol) system for +resolving user names to user data. + +While DNS and BNS handle different problems, they share some terminology and +serialization formats. However, it is important to recognize that this is the +*only* thing they have in common---BNS has fundamentally different semantics +than DNS: + +* **Zone files**: Blockstack stores a DNS zone file for each name. However, +the semantics of a BNS zone file are nothing like the semantics of a DNS zone +file---the only thing they have in common is their format. +A "standard" Blockstack zone files only have `URI` and `TXT` resource records +that point to the user's application data. Moreover, a Blockstack ID has a +*history* of zone files, and historic zone files can alter the way in which a +Blockstack ID gets resolved (DNS has no such concept). It is conceivable that an advanced +user could add `A` and `AAAA` records to their Blockstack ID's zone file, +but these are not honored by any Blockstack software at this time. + +* **Subdomains**: Blockstack has the concept of a subdomain, but it is + semantically very different from a DNS subdomain. In Blockstack, a subdomain +is a Blockstack ID whose state and transaction history are anchored to the +blockchain, but stored within an on-chain Blockstack ID's zone file history. +Unlike DNS subdomains, a BNS subdomain has +its own owner and is a first-class BNS name---all subdomains are resolvable, +and only the subdomain's owner can update the subdomain's records. The only thing BNS subdomains and DNS +subdomains have in common is the name format (e.g. `foo.bar.baz` is a subdomain +of `bar.baz` in both DNS and BNS). + +More details can be found in the [Blockstack vs +DNS](https://blockstack.org/docs/blockstack-vs-dns) document. A feature +comparison can be found at the end of the [Blockstack Naming +Service](blockstack_naming_service.md) document. + +## Blockstack vs Namecoin + +Namecoin also implements a decentralized naming service on top of a blockchain, +just like BNS. In fact, early versions of Blockstack were built on Namecoin. +However, [it was discovered](https://www.usenix.org/node/196209) that Namecoin's +merged mining with Bitcoin regularly placed it under the *de facto* control of a single +miner. This prompted a re-architecting of the system to be *portable* across +blockchains, so that if Blockstack's underlying blockchain (currently Bitcoin) +ever became insecure, the system could migrate to a more secure blockchain. + +A feature comparison can be found at the end of the [Blockstack Naming +Service](blockstack_naming_service.md) document. + +## Blockstack vs ENS + +ENS also implements a decentralized naming system on top of a blockchain, but as +a smart contract on Ethereum. Like BNS, ENS is geared towards resolving names +to off-chain state (ENS names resolve to a hash, for example). Moreover, ENS is +geared towards providing programmatic control over names with Turing-complete +on-chain resolvers. + +BNS has a fundamentally different relationship with blockchains than ENS. +WHereas ENS tries to use on-chain logic as much as possible, BNS +tries to use the blockchain as little as possible. BNS only uses it to store a +database log for name operations (which are interpreted with an off-chain BNS +node like Blockstack Core). BNS name state and BNS subdomains reside entirely +off-chain in the Atlas network. This has allowed BNS to migrate from blockchain +to blockchain in order to survive individual blockchain failures, and this has +allowed BNS developers to upgrade its consensus rules without having to get the +blockchain's permission (see the [virtualchain +paper](https://blockstack.org/virtualchain_dccl2016.pdf) for details). + +A feature comparison can be found at the end of the [Blockstack Naming +Service](blockstack_naming_service.md) document. + +## Blockstack vs Ethereum + +Blockstack and Ethereum both strive to provide a decentralized application +platform. Blockstack's design philosophy differs from Ethereum's design +philosophy in that Blockstack emphasizes treating the blockchain as a "dumb +ledger" with no special functionality or properties beyond a few bare minimum +requirements. Instead, it strives to do everything off-chain---an application of the [end-to-end principle](https://en.wikipedia.org/wiki/End-to-end_principle). +Most Blockstack applications do *not* +interact with the blockchain, and instead interact with Blockstack +infrastructure through client libraries and RESTful endpoints. +This is evidenced by Blockstack's decision to implement its naming system (BNS), discovery and routing system +(Atlas), and storage system (Gaia) as blockchain-agnostic components that can be +ported from one blockchain to another. + +Ethereum takes the opposite approach. Ethereum dapps are expected to interface +directly with on-chain smart contract logic, and are expected to host a +non-trivial amount of state in the blockchain itself. This is necessary for +them, because many Ethereum dapps' business logic is centered around the +mechanics of an ERC20 token. + +Blockstack does not implement a smart contract system (yet), but it will soon +implement a [native token](https://blockstack.com/distribution.pdf) that will be +accessible to Blockstack applications. diff --git a/_site/core/figures/test-screen.png b/_site/core/figures/test-screen.png new file mode 100644 index 00000000..c47fc26b Binary files /dev/null and b/_site/core/figures/test-screen.png differ diff --git a/_site/core/gaia.md b/_site/core/gaia.md new file mode 100644 index 00000000..0060549c --- /dev/null +++ b/_site/core/gaia.md @@ -0,0 +1,3 @@ +# Gaia Documentation + +This document has moved to the [Gaia repository](https://github.com/blockstack/gaia) diff --git a/_site/core/glossary.md b/_site/core/glossary.md new file mode 100644 index 00000000..c710ca27 --- /dev/null +++ b/_site/core/glossary.md @@ -0,0 +1,148 @@ +# Glossary + +Commonly used terms and jargon in Blockstack + +## Account + +A field in a profile that links the name to an existing service, like Twitter or OpenBazaar. They are listed under the `accounts` listing in a profile. + +Some accounts serve as social proofs, but they can contain any data the user wants. + +## Atlas + +A peer-to-peer network maintained by Blockstack Core nodes that stores each +name's zone files and immutable data. See [this document](atlas_network.md) for +details. + +## Blockstack ID + +(Also called a "name"). + +A human-readable name in Blockstack. It is comprised only of upper and lower-case ASCII characters, numbers, as well as `-`, `_`, and `.`. It must end with a `.`, followed by a namespace ID. It has at least 3 characters, and at most 37 (including the `.` and the namespace ID). + +Anyone can register a Blockstack ID, such as through the [Blockstack Browser](https://github.com/blockstack/blockstack-browser) + +## Blockstack Core + +A server that reads a blockchain with [virtualchain](https://github.com/blockstack/blockstack-virtualchain), filters out transactions that represent name operations, and builds up a database of (name, public key, state value) triples. + +## Blockstack Naming Service (BNS) + +This is the naming protocol that Blockstack Core implements. See [this +document](blockstack_naming_service.md) for details. + +## Consensus Hash + +A cryptographic hash that represents a proof-of-computation by a Blockstack Core node. Two Blockstack Core nodes have seen and processed the same name operations up to block `n` if and only if they each calculate the same consensus hash at height `n`. + +A Blockstack Core node only accepts a name operation if it has a previously-calculated but recent consensus hash. Blockstack clients obtain a consensus hash from a Blockstack Core node in order to construct a name operation. + +## Gaia + +This is Blockstack's storage system. Gaia hosts all of your app-specific data. + +## Gaia Hub + +This is a publicly-routable server that serves as an entry point for Gaia data. +Anyone can stand up and run a Gaia hub by following [these +instructions](https://github.com/blockstack/gaia). +Blockstack provides a [default Gaia hub](https://gaia.blockstack.org). + +## Immutable Data + +This is the general term for chunks of data whose hash is cryptographically +bound to a blockchain transaction. This includes all data stored in the Atlas +network (such as your Blockstack ID's zone file), +as well as any data whose hash is stored in the Atlas network. + +## Mutable Data + +This is the general term for data that is (1) signed by your Blockstack ID, and +(2) can be looked up using your Blockstack ID. This includes all your Gaia +data, as well as your profile. + +## Name + +See Blockstack ID. + +## Name Database + +The set of (name, public key, name state) triples that the Blockstack Core node generates by reading the blockchain. The name state is usually the hash of a DNS zone file stored in Atlas. + +## Name Operation + +A specially-crafted transaction in the underlying blockchain that, when processed, will change each Blockstack Core's name database. Examples include `NAME_PREORDER` (preorders a name), `NAME_REGISTRATION` (registers a name), `NAME_UPDATE` (changes a name's zonefile hash), `NAME_TRANSFER` (changes a name's public key), and `NAME_REVOKE` (locks everyone out of a name until it expires). + +Name operations are encoded on Bitcoin as `OP_RETURN` outputs that start with `id`, followed by a 1-byte character that identifies the particular operation. + +See the [wire format](wire-format.md) document for details. + +## Namespace + +Analogous to a DNS TLD, it represents a grouping of names. All names under the same namespace have the same pricing and lifetime rules. + +Anyone can create a namespace, but doing so is expensive by design. See the +[namespace creation](namespace_creation.md) tutorial for details. + +## Preorder + +The first of two steps to acquire a name. This operation writes the hash of both the name and the address that will own it. + +## Profile + +A signed JSON web token that describes a [Person](https://schema.org/Person), which describes the name's owner. You can put anything you want into your profile. + +Additionally, profiles hold lists of social verifications and pointers to your Gaia data. + +## Register + +(1) The act of acquiring a name in Blockstack. + +(2) The second of two steps to create a new name entry in the name database. Reveals the name as plaintext to the world. Must match a recent preorder to be accepted. + +## Registrar + +An online service that lets you sign up for and manage the profiles of Blockstack IDs. + +## Resolver + +An online service that displays zonefile and profile data for a Blockstack ID. [The Blockstack Explorer](https://explorer.blockstack.org) is a resolver. + +## Social proof + +A post in an account on an existing Web service like Twitter, Facebook, or GitHub that points back to a Blockstack ID. Used to provide some evidence that the person who owns the Blockstack ID is also the person who owns the Web service account. + +Social proofs are listed in your profile. + +## Storage Provider + +This is any service that can serve your zone file, profile, or data. In all cases, the data is signed by one of your wallet's keys, so you can use any provider without having to worry about it trying to change the data. + +Storage providers are accessed through a Gaia hub. Gaia hubs ship with drivers +that allow them to treat storage providers as dumb hard drives, which store +signed encrypted data on the hub's behalf. + +Not all storage providers support writes--some of them are read-only. + +Supported storage providers today include: +* Amazon S3 +* Dropbox +* Your harddrive +* Any HTTP/HTTPS/FTP server (read-only) +* Any public-use Gaia hub +* IPFS + +Support is being added for: +* Google Drive +* Microsoft OneDrive +* Box.com +* BitTorrent + +If you have a preferred storage provider, and you're a developer, please consider sending us a pull request to add support for it! + +## Zone file + +A specially-formatted file that stores routing information for a Blockstack ID. +Blockstack clients use your zone file to find out where your preferred Gaia +hub(s) are. Ever Blockstack Core node stores a copy of every zone file for +every Blockstack ID by participating in the Atlas network. diff --git a/_site/core/install-api.md b/_site/core/install-api.md new file mode 100644 index 00000000..932bc110 --- /dev/null +++ b/_site/core/install-api.md @@ -0,0 +1,80 @@ +# Blockstack API + +Step-by-step instructions for deploying a Blockstack API node on Debian or +Ubuntu are below. + +- **Step 1:** Make sure you have Blockstack Core running locally (see [instructions](https://github.com/blockstack/blockstack-core/blob/master/README.md#quick-start)). + +- **Step 2:** Make sure you have [virtualenv installed](http://docs.python-guide.org/en/latest/dev/virtualenvs/). +Then, setup the API: +``` +$ sudo apt-get install -y python-pip memcached rng-tools python-dev libmemcached-dev zlib1g-dev libgmp-dev libffi-dev libssl-dev +$ sudo service memcached start +$ sudo pip install virtualenv +$ sudo npm -g install aglio +$ virtualenv api && source api/bin/activate +$ git clone https://github.com/blockstack/blockstack-core.git +$ cd blockstack-core/ +$ pip install . +$ pip install -r api/requirements.txt +$ blockstack setup_wallet +$ blockstack api start +$ deactivate +$ ./build_docs.sh public_api +``` + +### Search Subsystem + +If you want to enable the search subsystem in your installation, you can +follow the instructions [here](search.md). + +### Nginx Deployment + +For a production deployment we recommend using nginx and uwsgi: + +- **Step 1:** Install nginx and uWSGI: +``` +$ sudo apt-get install -y nginx +$ sudo pip install uwsgi +``` +- **Step 2:** Copy [this sample nginx sites file](../api/nginx/config/nginx_sites-available/blockstack_api) to + +> /etc/nginx/sites-available/blockstack_api + +and edit the paths depending on the uwsgi blockstack_api socket directory (defaults to /tmp/blockstack_api.sock) +You can test your nginx settings: +``` +$ sudo nginx -t +``` +- **Step 3:** Copy [this sample systemd service file](../api/nginx/config/systemd_system/blockstack_api.service) to + +> /etc/systemd/system/blockstack_api.service + +and edit the service user and blockstack paths depending on where your blockstack repo is located, and +where your virtualenv is located. + +Note: The following sed commands will work if the virtualenv is currently active and your shell is in the repo's root directory. + +``` +$ sudo sed -i "s/User\=USER/User\=$USER/" /etc/systemd/system/blockstack_api.service +$ sudo sed -i "s#/path/to/blockstack#$PWD#" /etc/systemd/system/blockstack_api.service +$ sudo sed -i "s#/path/to/virtualenv#$VIRTUAL_ENV#" /etc/systemd/system/blockstack_api.service +``` + +- **Step 4:** Get a security certificate from [Let's Encrypt](https://letsencrypt.org/). +``` +$ git clone https://github.com/certbot/certbot.git +$ cd certbot/ +$ ./certbot-auto --nginx -d +``` + +And copy the cert files to the path given in the nginx sites file earlier. + +- **Step 5:** Start nginx and the Blockstack API uwsgi server: +``` +sudo systemctl restart blockstack_api +sudo systemctl restart nginx +``` + +If you run into any issues, please [submit a Github issue](https://github.com/blockstack/blockstack-core/issues) and we'll update these +instructions. diff --git a/_site/core/interactive_regtest_macos.md b/_site/core/interactive_regtest_macos.md new file mode 100644 index 00000000..cc4a5359 --- /dev/null +++ b/_site/core/interactive_regtest_macos.md @@ -0,0 +1,3 @@ +Documentation for setting up the regtest mode for Blockstack Browser +using core's integration tests in macOS and Linux has +moved [here](../integration_tests). diff --git a/_site/core/memcached.md b/_site/core/memcached.md new file mode 100644 index 00000000..aedd01e1 --- /dev/null +++ b/_site/core/memcached.md @@ -0,0 +1,42 @@ +Installing Memcached +======= + +The Blockstack API optionally uses memcached and pylibmc for scaling read-only +calls. If you want to enable this functionality then you should have memcached +running locally. + +### Memcached on Debian & Ubuntu: + +``` +$ sudo apt-get install -y python-dev libmemcached-dev zlib1g-dev +$ pip install pylibmc +``` + +### Memcached on macOS: + +Easiest way to install memcached on macOS is by using [Homebrew](https://brew.sh/). + +After installing Homebrew: + +``` +$ brew install memcached +$ brew install libmemcached +$ pip install pylibmc --install-option="--with-libmemcached=/usr/local/Cellar/libmemcached/1.0.18_1/" +``` + +After installing, you can start memcached and check if it's running properly: + +``` +$ memcached -d +$ echo stats | nc localhost 11211 +``` + +### Memcached on Heroku + +To deploy on Heroku: + +```bash +$ heroku create +$ heroku addons:add memcachedcloud +$ git push heroku master +``` diff --git a/_site/core/namespace_creation.md b/_site/core/namespace_creation.md new file mode 100644 index 00000000..2e95348b --- /dev/null +++ b/_site/core/namespace_creation.md @@ -0,0 +1,589 @@ +# Creating a Namespace + +**WARNING**: If you intend to create a namespace, you must read this document +_in its entirety_. You should also _install the test framework_ and experiment +with your namespace's parameters. _FAILURE TO DO SO MAY RESULT IN IRRECOVERABLE +LOSS OF FUNDS._ + +**Before you begin**: Some basic familiarity with how Bitcoin works is required to +understand this tutorial. This includes: + +* knowing the difference between mainnet, testnet, and regtest +* knowing about compressed and uncompressed ECDSA public keys +* knowing about base58-check encoding +* knowing how Bitcoin transactions are structured +* knowing how UTXOs work + +## Overview + +Creating a namespace is a three-step process. The first +step is to `preorder` the namespace, which broadcasts a salted hash of the +namespace ID. The second step is to `reveal` the namespace, which exposes the +namespace ID and price function to the blockchain. The final step is to `ready` +the namespace, which allows anyone to register names within it. + +In between the `reveal` and `ready` steps, the namespace creator will have a +"lock" on the namespace that lasts for about 1 year. During this time period, +the namespace creator can `import` names. The `import` transaction lets the +namespace creator assign the name a zone file and an owner in one step. + +## Before Trying This in Production... + +Creating namespaces is expensive. +Be sure to test your namespace in our [integration test +framework](https://github.com/blockstack/blockstack-core/tree/master/integration_tests) +first! It will let you simulate any valid namespace configuration +you want at no risk to you. + +### Setting up the Test Environment + +In this example, we will use the test framework to create a private Bitcoin +blockchain on your computer, and then create a Blockstack namespace on it. +This will let you experiment with different namespace parameters +without spending actual BTC. The test framework uses `bitcoind -regtest`, +so all of the commands you'll run here will work identically on +mainnet. + +To install the test framework, please follow these +[instructions](https://github.com/blockstack/blockstack-core/tree/master/integration_tests). +Once you have the test framework installed, you should run the `namespace_check` test in `--interactive-web` mode. +This will create an empty `.test` namespace and leave the test scenario running +once it finishes. You will be able to fund addresses and create new blocks via +your Web browser or via `curl`, as will be explained below. Also, you'll be able to use the +`blockstack` utility to interact with your private blockchain and namespaces. + +The test setup command is as follows. This will launch the `namespace_check` +test scenario, and open a web server on port 3001. +```bash + $ blockstack-test-scenario --interactive-web 3001 blockstack_integration_tests.scenarios.namespace_check +``` + +When the test is ready for us to experiment, you should see the following: + +```bash + An empty namespace called 'test' has been created + Feel free to experiment with other namespaces + + Available keys with a balance: + * 6e50431b955fe73f079469b24f06480aee44e4519282686433195b3c4b5336ef01 + * c244642ce0b4eb68da8e098facfcad889e3063c36a68b7951fb4c085de49df1b01 + * f4c3907cb5769c28ff603c145db7fc39d7d26f69f726f8a7f995a40d3897bb5201 + * 8f87d1ea26d03259371675ea3bd31231b67c5df0012c205c154764a124f5b8fe01 + * bb68eda988e768132bc6c7ca73a87fb9b0918e9a38d3618b74099be25f7cab7d01 + * 2,3,6f432642c087c2d12749284d841b02421259c4e8178f25b91542c026ae6ced6d01,65268e6267b14eb52dc1ccc500dc2624a6e37d0a98280f3275413eacb1d2915d01,cdabc10f1ff3410082448b708c0f860a948197d55fb612cb328d7a5cc07a6c8a01 + * 2,3,4c3ab2a0704dfd9fdc319cff2c3629b72ebda1580316c7fddf9fad1baa323e9601,75c9f091aa4f0b1544a59e0fce274fb1ac29d7f7e1cd020b66f941e5d260617b01,d62af1329e541871b244c4a3c69459e8666c40b683ffdcb504aa4adc6a559a7701 + * 2,3,4b396393ca030b21bc44a5eba1bb557d04be1bfe974cbebc7a2c82b4bdfba14101,d81d4ef8123852403123d416b0b4fb25bcf9fa80e12aadbc08ffde8c8084a88001,d0482fbe39abd9d9d5c7b21bb5baadb4d50188b684218429f3171da9de206bb201 + * 2,3,836dc3ac46fbe2bcd379d36b977969e5b6ef4127e111f2d3e2e7fb6f0ff1612e01,1528cb864588a6a5d77eda548fe81efc44180982e180ecf4c812c6be9788c76a01,9955cfdac199b8451ccd63ec5377a93df852dc97ea01afc47db7f870a402ff0501 +``` + +You can determine that the test framework is live by going to +`http://localhost:3001` in your Web browser. From there, you can generate +blocks in the test framework's `bitcoind` node and you can fund any address in +the test framework. + +Finally, you can use the `blockstack-test-env` command to set up your shell +environment variables so `blockstack` will interact with this test (instead of +mainnet). To do so, run the following in your shell: + +```bash + $ . $(which blockstack-test-env) namespace_check + |blockstack-test namespace_check| $ +``` + +You can verify that the environment variables by verifying that your `$PS1` +variable includes the name of your test (as shown above), and that some other +`BLOCKSTACK_`-prefixed variables are set: + +```bash + |blockstack-test namespace_check| $ env | grep BLOCKSTACK + BLOCKSTACK_OLD_PS1=\u@\h:\w$ + BLOCKSTACK_TESTNET=1 + BLOCKSTACK_EPOCH_1_END_BLOCK=1 + BLOCKSTACK_EPOCH_2_END_BLOCK=2 + BLOCKSTACK_TEST=1 + BLOCKSTACK_DEBUG=1 + BLOCKSTACK_CLIENT_CONFIG=/tmp/blockstack-run-scenario.blockstack_integration_tests.scenarios.namespace_check/client/client.ini +``` + +## Registering a Namespace + +Suppose we're going to create the `hello` namespace. The key +`6e50431b955fe73f079469b24f06480aee44e4519282686433195b3c4b5336ef01` will be the key that +*pays* for the namespace. The key +`c244642ce0b4eb68da8e098facfcad889e3063c36a68b7951fb4c085de49df1b01` will be the key that +*creates* the namespace. The creator key will be used to `import` names and +declare the namespace `ready`. The payment key will be used to both pay for the +namespace and receive name registration and renewal fees for the first year of +the namespace's lifetime. + +In this example, we will set these keys as environment variables: + +```bash + |blockstack-test namespace_check| $ export PAYMENT_PKEY="6e50431b955fe73f079469b24f06480aee44e4519282686433195b3c4b5336ef01" + |blockstack-test namespace_check| $ export CREATOR_PKEY="c244642ce0b4eb68da8e098facfcad889e3063c36a68b7951fb4c085de49df1b01" +``` + +#### Multisig Namespace Payment + +If you want to use a multisig address to pay for your namespace (and collect +name registration fees), then instead of using +`6e50431b955fe73f079469b24f06480aee44e4519282686433195b3c4b5336ef01`, you should +use a string formatted as `m,n,pk1,pk2,...,pk_n`. `m` is the number of +signatures required, `n` is the number of private keys, and `pk1,pk2,...,pk_n` +are the private keys. + +For example, you can use the following as your `PAYMENT_PKEY` to have a 2-of-3 +multisig script pay for your namespace and collect name registration fees: + +```bash + |blockstack-test namespace_check| $ export PAYMENT_PKEY="2,3,6f432642c087c2d12749284d841b02421259c4e8178f25b91542c026ae6ced6d01,65268e6267b14eb52dc1ccc500dc2624a6e37d0a98280f3275413eacb1d2915d01,cdabc10f1ff3410082448b708c0f860a948197d55fb612cb328d7a5cc07a6c8a01" +``` + +### Namespace preorder + +The command to preorder the namespace would be: + +```bash + |blockstack-test namespace_check| $ blockstack namespace_preorder hello "$PAYMENT_PKEY" "$CREATOR_PKEY" +``` + +You will be given a set of instructions on how to proceed to reveal and +launch the namespace. _READ THEM CAREFULLY_. You will be prompted to +explicitly acknowledge that you understand the main points of the instructions, +and that you understand the risks. + +The command outputs some necessary information at the very end of its execution. +In particular, you will need to remember the transaction ID of the namespace +preorder. The command will help you do so. + +Here is a sample output: + +```bash + |blockstack-test namespace_check| $ blockstack namespace_preorder hello "$PAYMENT_PKEY" "$CREATOR_PKEY" + + <...snip...> + + Remember this transaction ID: b40dd1375ef63e5a40ee60d790ec6dccd06efcbac99d0cd5f3b07502a4ab05ac + You will need it for `blockstack namespace_reveal` + + Wait until b40dd1375ef63e5a40ee60d790ec6dccd06efcbac99d0cd5f3b07502a4ab05ac has six (6) confirmations. Then, you can reveal `hello` with: + + $ blockstack namespace_reveal "hello" "6e50431b955fe73f079469b24f06480aee44e4519282686433195b3c4b5336ef01" "c244642ce0b4eb68da8e098facfcad889e3063c36a68b7951fb4c085de49df1b01" "b40dd1375ef63e5a40ee60d790ec6dccd06efcbac99d0cd5f3b07502a4ab05ac" + + { + "status": true, + "success": true, + "transaction_hash": "b40dd1375ef63e5a40ee60d790ec6dccd06efcbac99d0cd5f3b07502a4ab05ac" + } +``` + +If all goes well, you will get back a transaction hash (in this case, `b40dd1375ef63e5a40ee60d790ec6dccd06efcbac99d0cd5f3b07502a4ab05ac`). +To get Blockstack to process it, you will need to mine some blocks in the test framework (by default, +Blockstack will only accept a transaction that has 6 confirmations). To do +this, simply go to `http://localhost:3001` and generate at least 6 blocks. If you +observe the test log, you will see the Blockstack node process and accept it. + +Note that when you do this live, you should wait for +at least 10 confirmations before sending the `reveal` transaction, just to be +safe. + +### Namespace reveal + +The command to reveal a preordered namespace is more complicated, since it +describes the price curve. + +This command is **interactive**. The command to invoke it is as follows: + +```bash + |blockstack-test namespace_check| $ blockstack namespace_reveal hello "$PAYMENT_PKEY" "$CREATOR_PKEY" "b40dd1375ef63e5a40ee60d790ec6dccd06efcbac99d0cd5f3b07502a4ab05ac" +``` + +When running the command, you will see the namespace creation wizard prompt you +with the price curve and the current values: + +``` +Name lifetimes (blocks): infinite +Price coefficient: 4 +Price base: 4 +Price bucket exponents: [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0] +Non-alpha discount: 2 +No-vowel discount: 5 +Burn or receive fees? Receive to mr6nrMvvh44sR5MiX929mMXP5hqgaTr6fx + +Name price formula: +(UNIT_COST = 10.0 satoshi): + buckets[min(len(name)-1, 15)] + UNIT_COST * coeff * base +cost(name) = ----------------------------------------------------- + max(nonalpha_discount, no_vowel_discount) + + +Name price table: +| length | price | price, nonalpha | price, no vowel | price, both | +-------------------------------------------------------------------------- +| 1 | 42949672960 | 8589934592 | 8589934592 | 8589934592 | +| 2 | 10737418240 | 5368709120 | 2147483648 | 2147483648 | +| 3 | 2684354560 | 1342177280 | 536870912 | 536870912 | +| 4 | 671088640 | 335544320 | 134217728 | 134217728 | +| 5 | 167772160 | 83886080 | 33554432 | 33554432 | +| 6 | 41943040 | 20971520 | 8388608 | 8388608 | +| 7 | 10485760 | 5242880 | 2097152 | 2097152 | +| 8 | 2621440 | 1310720 | 524288 | 524288 | +| 9 | 655360 | 327680 | 131072 | 131072 | +| 10 | 163840 | 81920 | 32768 | 32768 | +| 11 | 40960 | 20480 | 8192 | 8192 | +| 12 | 10240 | 5120 | 2048 | 2048 | +| 13 | 2560 | 1280 | 512 | 512 | +| 14 | 640 | 320 | 128 | 128 | +| 15 | 160 | 80 | 32 | 32 | +| 16+ | 40 | 20 | 10 | 10 | + + +What would you like to do? +(0) Set name lifetime in blocks (positive integer between 1 and 4294967295, or "infinite") +(1) Set price coefficient (positive integer between 1 and 255) +(2) Set base price (positive integer between 1 and 255) +(3) Set price bucket exponents (16 comma-separated integers, each between 1 and 15) +(4) Set non-alphanumeric character discount (positive integer between 1 and 15) +(5) Set no-vowel discount (positive integer between 1 and 15) +(6) Toggle collecting name fees (True: receive fees; False: burn fees) +(7) Show name price formula +(8) Show price table +(9) Done + +(1-9) +``` + +All prices are in the "fundamental unit" of the underlying blockchain (i.e. +satoshis). + +As the formula describes, the name's price is a function of: + +* a fixed unit cost (`UNIT_COST`) +* a multiplicative constant coefficient (`coeff`) +* a fixed exponential base (`base`) +* a 16-element list of price buckets, indexed by the length of the name (`buckets`) +* a discount for having non-alphnumeric letters (`nonalpha_discount`) +* a discount for having no vowels in the name (`no_vowel_discount`) + +You can use options 1 through 8 to play with the pricing function and examine +the name costs in the price table. Enter 9 to send the transaction itself. + +Once you're happy, you can issue the namespace-reveal transaction. As with the +namespace-preorder transaction, you will get back a transaction hash, and your transaction will be +unconfirmed. Simply go to `http://localhost:3001` to generate some more blocks +to confirm your namespace-reveal. + +Once you have confirmed your namespace-reveal transaction, you can +begin to populate your namespace with some initial names. + +**Collecting Name Fees** + +Blockstack 0.17 introduced the ability to create a namespace such that for the +first year of its existence (54595 blocks), all name registration and renewal +fees will be sent to the address of the _payment key_. In this example, +this is the address `mr6nrMvvh44sR5MiX929mMXP5hqgaTr6fx`. + +The alternative is to +have all namespace fees sent to an unspendable burn address +(`1111111111111111111114oLvT2`). This is the case for the `.id` namespace, +for example. + +After the year has passed, all future name registrations and renewal fees +will be sent to the unspendable burn address. This is to disincentivize +namespace squatters. + +**Warnings** + +* You must issue this command **within 144 blocks** of the namespace-preorder transaction. Otherwise, the preorder will expire and you will need to start over from scratch. + +### Importing names + +After sending the `reveal` transaction, you can populate your namespace with +some initial names. You can do so with the `name_import` command. + +Suppose we want to import the name `example.hello` and assign it to an owner +whose public key address is `ms6Y32bcL5zhA57e8tf7awgVZuPxV8Xg8N`. Suppose also +that you wanted to give `example.hello` an initial zone file stored at +`/var/blockstack/zone_files/example.hello`. To do so, you would issue the +following command: + +```bash + |blockstack-test namespace_check| $ blockstack name_import example.hello ms6Y32bcL5zhA57e8tf7awgVZuPxV8Xg8N /var/blockstack/zone_files/example.hello "$CREATOR_PKEY" +``` + +By default, you **must** use the private key you used to reveal the namespace +to import names (this is `$CREATOR_PKEY` in this example). + +As with namespace-preorder and namespace-reveal, the transaction this command +generates will be unconfirmed. Simply go to `http://localhost:3001` to generate +some blocks to confirm it. + +You can check the progress of the transaction with `blockstack info`, as follows: + +```bash + |blockstack-test namespace_check| $ blockstack info + { + "cli_version": "0.17.0.8", + "consensus_hash": "b10fdd38a20a7e46555ce3a7f68cf95c", + "last_block_processed": 694, + "last_block_seen": 694, + "queues": { + "name_import": [ + { + "confirmations": 1, + "name": "example.hello", + "tx_hash": "10f7dcd9d6963ef5d20d010f731d5d2ddb76163a083b9d7a2b9fd4515c7fe58c" + } + ] + }, + "server_alive": true, + "server_host": "localhost", + "server_port": 16264, + "server_version": "0.17.0.8" + } +``` + +The `confirmation` field indicates how deep in the blockchain the transaction is +at the time. Generating more blocks will increase its number of confirmations. + +When you do this live, +**YOU SHOULD LEAVE YOUR COMPUTER RUNNING UNTIL THE `name_import` QUEUE IS EMPTY**. +Blockstack's background API daemon will monitor the transactions and upload the +name's zone file to the Blockstack Atlas network once it is confirmed. +But to do so, your computer must remain online. If you do not do this, then +the name will not have a zone file and will be unusable in the higher layers of +Blockstack-powered software (including Blockstack applications). However, +if your computer does go offline or reboots, you can recover by +restarting the Blockstack API daemon (with +`blockstack api start`). The daemon itself will pick up where it left off, and +replicate all zone files that have confirmed transactions. + +After the zone file is uploaded, the name will be public and resolvable. You can re-import the +same name over and over, and give it a different address and/or zone file. Like +all other names, the Blockstack Atlas network will accept and propagate zone +files for imported names. + +The owner of the address `ms6Y32bcL5zhA57e8tf7awgVZuPxV8Xg8N` will **not** be +able to issue any transactions for the name `example.hello` until the namespace +creator has sent the `ready` transaction. + +#### Using multiple private keys for NAME_IMPORT + +Bitcoin itself imposes limits on how fast you can send transactions from the +same key (limited by a maximum UTXO-chain length). To work around this, +Blockstack lets you import names by using up to 300 private keys. The private +keys you can use are BIP32 unhardened children of the namespace reveal key (i.e. +`$CREATOR_PKEY` in this example). + +The first name you import **must** use the namespace reveal private key +(`$CREATOR_PKEY` in this example). However, all future names you import in this +namespace can use one of the 300 BIP32 keys. + +To get the list of keys you can use, you can use the `make_import_keys` command: + +```bash + |blockstack-test namespace_check| $ blockstack make_import_keys example hello "$CREATOR_PKEY" + aeda50305ada40aaf53f2d8921aa717f1ec71a0a3b9b4c6397b3877f6d45c46501 (n4DVTuLLv5J1Yc17AoRYY1GtxDAuLGAESr) + 92ff179901819a1ec7d32997ce3bb0d9a913895d5850cc05146722847128549201 (mib2KNBGR4az8GiUmusBZexVBqb9YB2gm5) + cc5b6a454e2b614bfa18f4deb9a8e179ab985634d63b7fedfaa59573472d209b01 (mxE2iqV4jdpn4K349Gy424TvZp6MPqSXve) + 9b0265e0ac8c3c24fe1d79a734b3661ec2b5c0c2619bb6342356572b8235910101 (n4rGz8hkXTscUGWCwZvahrkEh6LHZVQUoa) + e2585af250404b7918cf6c91c6fa67f3401c0d1ae66df2fafa8fa132f4b9350f01 (moGNpEpighqc6FnkqyNVJA9xtfTiStr5YU) + { + "status": true + } +``` + +(NOTE: in the test environment, you get only 5 keys in order to save time). + +You can use any of these keys to import names. + +#### Trying it out + +Here's an example walkthrough of how to try this out in the test framework: + +1. Import the first name, creating a zone file in the process: + +```bash + |blockstack-test namespace_check| $ cat > /var/blockstack/zone_files/example.hello < $ORIGIN example.hello + > $TTL 3600 + > _file URI 10 1 "file:///home/blockstack-test/example.hello" + > EOF + |blockstack-test namespace_check| $ blockstack name_import example.hello ms6Y32bcL5zhA57e8tf7awgVZuPxV8Xg8N /var/blockstack/zone_files/example.hello "$CREATOR_PKEY" + Import cost breakdown: + { + "name_import_tx_fee": { + "btc": 0.0003342, + "satoshis": 33420 + }, + "total_estimated_cost": { + "btc": 0.0003342, + "satoshis": 33420 + }, + "total_tx_fees": 33420 + } + Importing name 'example.hello' to be owned by 'ms6Y32bcL5zhA57e8tf7awgVZuPxV8Xg8N' with zone file hash '05c302430f4ed0a24470abf9df7e264d517fd389' + Proceed? (y/N) y + { + "status": true, + "success": true, + "transaction_hash": "bd875f00f63bcb718bb22782c88c3edcbed79663f2f9152deab328c48746f103", + "value_hash": "05c302430f4ed0a24470abf9df7e264d517fd389" + } +``` + +2. Advance the test framework blockchain, so the indexer knows which import keys to expect: + +```bash + # NOTE: you can also do this by going to http://localhost:3001 in your Web browser + |blockstack-test namespace_check| $ curl -X POST http://localhost:3001/nextblock +``` + +3. Make import keys: + +```bash + |blockstack-test namespace_check| $ blocksatck make_import_keys hello "$CREATOR_PKEY" + aeda50305ada40aaf53f2d8921aa717f1ec71a0a3b9b4c6397b3877f6d45c46501 (n4DVTuLLv5J1Yc17AoRYY1GtxDAuLGAESr) + 92ff179901819a1ec7d32997ce3bb0d9a913895d5850cc05146722847128549201 (mib2KNBGR4az8GiUmusBZexVBqb9YB2gm5) + cc5b6a454e2b614bfa18f4deb9a8e179ab985634d63b7fedfaa59573472d209b01 (mxE2iqV4jdpn4K349Gy424TvZp6MPqSXve) + 9b0265e0ac8c3c24fe1d79a734b3661ec2b5c0c2619bb6342356572b8235910101 (n4rGz8hkXTscUGWCwZvahrkEh6LHZVQUoa) + e2585af250404b7918cf6c91c6fa67f3401c0d1ae66df2fafa8fa132f4b9350f01 (moGNpEpighqc6FnkqyNVJA9xtfTiStr5YU) + { + "status": true + } +``` + +4. Fill up one of the addresses in the test framework, so we can fund `NAME_IMPORT` transactions with it: + +```bash + # NOTE: you can also do this by going to http://localhost:3001 in your Web browser + |blockstack-test namespace_check| $ curl -X POST -F 'addr=n4DVTuLLv5J1Yc17AoRYY1GtxDAuLGAESr' -F 'value=100000000' 'http://localhost:3001/sendfunds' +``` + +5. Import another name, with the child private key we just funded: + +```bash + |blockstack-test namespace_check| $ cat > /tmp/example.hello.zonefile < $ORIGIN example2.hello + > $TTL 3600 + > _file URI 10 1 "file:///home/blockstack-test/example2.hello" + > EOF + |blockstack-test namespace_check| $ blockstack name_import example2.hello n3sFkNfBQPWS25G12DqDEqHRPiqHotAkEb /tmp/example.hello.zonefile aeda50305ada40aaf53f2d8921aa717f1ec71a0a3b9b4c6397b3877f6d45c46501 + Import cost breakdown: + { + "name_import_tx_fee": { + "btc": 0.0003342, + "satoshis": 33420 + }, + "total_estimated_cost": { + "btc": 0.0003342, + "satoshis": 33420 + }, + "total_tx_fees": 33420 + } + Importing name 'example2.hello' to be owned by 'n3sFkNfBQPWS25G12DqDEqHRPiqHotAkEb' with zone file hash '0649bc0b457f54c564d054ce20dc3745a0c4f0c0' + Proceed? (y/N) y + { + "status": true, + "success": true, + "transaction_hash": "496a6c2aaccedd98a8403c2e61ff3bdeff221a58bf0e9c362fcae981353f459f", + "value_hash": "0649bc0b457f54c564d054ce20dc3745a0c4f0c0" + } +``` + +6. Advance the blockchain again: + +```bash + # NOTE: you can also do this by going to http://localhost:3001 in your Web browser + |blockstack-test namespace_check| $ curl -X POST http://localhost:3001/nextblock +``` + +7. See that the names are processing: + +```bash + |blockstack-test namespace_check| $ blockstack info + { + "cli_version": "0.17.0.8", + "consensus_hash": "2a055beeaedcaa1365ab2671a0254a03", + "last_block_processed": 711, + "last_block_seen": 711, + "queues": { + "name_import": [ + { + "confirmations": 2, + "name": "example.hello", + "tx_hash": "bd875f00f63bcb718bb22782c88c3edcbed79663f2f9152deab328c48746f103", + }, + { + "confirmations": 1, + "name": "example2.hello", + "tx_hash": "496a6c2aaccedd98a8403c2e61ff3bdeff221a58bf0e9c362fcae981353f459f" + } + ] + }, + "server_alive": true, + "server_host": "localhost", + "server_port": 16264, + "server_version": "0.17.0.8" + } +``` + +8. Confirm all the transactions: + +```bash + # NOTE: you can also do this by going to http://localhost:3001 in your Web browser + |blockstack-test namespace_check| $ for i in $(seq 1 10); do curl -X POST http://localhost:3001/nextblock +``` + +9. Look up name zone files to confirm they were replicated to the test framework's Atlas network: + +```bash + |blockstack-test namespace_check| $ blockstack info + { + "cli_version": "0.17.0.8", + "consensus_hash": "ad247c1d5ff239a65db0736951078f17", + "last_block_processed": 721, + "last_block_seen": 721, + "queues": {}, + "server_alive": true, + "server_host": "localhost", + "server_port": 16264, + "server_version": "0.17.0.8" + } + |blockstack-test namespace_check| $ blockstack get_name_zonefile example.hello + $ORIGIN example.hello + $TTL 3600 + _file URI 10 1 "file:///home/blockstack-test/example.hello" + + |blockstack-test namespace_check| $ blockstack get_name_zonefile example2.hello + $ORIGIN example2.hello + $TTL 3600 + _file URI 10 1 "file:///home/blockstack-test/example2.hello" +``` + +Now, these names are imported and once the `NAMESPACE_READY` transaction is +sent, the name owners can proceed to issue name operations. + +**Warnings** + +* The first private key you use must be the same one you used to *create* the namespace (`$CREATOR_KEY`). +* You may only use the 300 private keys described above to import names. +* You must complete all `NAME_IMPORT` transactions within 52595 blocks of the `NAMESPACE_REVEAL` transaction (about 1 year). + +### Launching a Namespace + +Once you have pre-populated your namespace with all of the initial names, you +have to make it `ready` so anyone can register a name. If you do not do this +within 1 year of the `reveal` transaction, then your namespace and all of the +names will disappear, and someone else will be able to register it. + +To make a namespace `ready`, you use the creator private key as follows: + +```bash + |blockstack-test namespace_check| $ blockstack namespace_ready hello "$CREATOR_PKEY" +``` + +**Warnings** + +* You must send the `NAMESPACE_READY` transaction within 52595 blocks (about 1 year) of the `NAMESPACE_REVEAL` transaction. diff --git a/_site/core/openbazaar.md b/_site/core/openbazaar.md new file mode 100644 index 00000000..98594013 --- /dev/null +++ b/_site/core/openbazaar.md @@ -0,0 +1,64 @@ +# Linking your OpenBazaar GUID to your Blockstack ID + +If you don't have the Blockstack CLI. Download and install it first. Instructions are [here](https://github.com/blockstack/blockstack-cli/blob/master/README.md). The rest of this tutorial assumes that you've already registered a name using the Blockstack CLI. + +## Step 1: Advanced Mode + +The first step is to activate "advanced mode" in the CLI. The command to do so is: + +``` + $ blockstack set_advanced_mode on +``` + +## Step 2: Add an OpenBazaar Account + +The second step is to create an OpenBazaar account for your profile (the [Onename](https://onename.com) app also enabled to link your OpenBazaar GUID). The command to do so is: + +``` + $ blockstack put_account "" "openbazaar" "" "" +``` + +The URL can be any valid URL; it won't be used by OpenBazaar. Here's an example, using the name `testregistration001.id` and the GUID `0123456789abcdef`: + +``` + $ blockstack put_account "testregistration001.id" "openbazaar" "0123456789abcdef" "https://bazaarbay.org/@testregistration001" +``` + +The update should be instantaneous. You can verify that your store is present with `list_accounts`: + +``` + $ blockstack list_accounts "testregistration001.id" + { + "accounts": [ + { + "contentUrl": "https://bazaarbay.org/@testregistration001.id", + "identifier": "0123456789abcdef", + "service": "openbazaar" + } + ] + } +```` + +# Troubleshooting + +Common problems you might encounter. + +## Profile is in legacy format + +If you registered your blockstack ID before spring 2016, there's a chance that your profile is still in a legacy format. It will get migrated to the new format automatically if you update your profile on the [Onename](https://onename.com) app. However, you have to do this manually with the CLI. + +To do so, the command is: +``` + $ blockstack migrate +``` + +It will take a little over an hour to complete, but once finished, you'll be able to manage your accounts with the above commands (and do so with no delays). + +## Failed to broadcast update transaction + +This can happen during a `migrate` for one of a few reasons: +* You do not have enough balance to pay the transaction fee (which is calculated dynamically). +* Your payment address has unconfirmed transactions. +* You can't connect to a Bitcoin node. + +To determine what's going on, you should try the command again by typing `BLOCKSTACK_DEBUG=1 blockstack ...` instead of `blockstack...`. diff --git a/_site/core/resolver.md b/_site/core/resolver.md new file mode 100644 index 00000000..50b00abb --- /dev/null +++ b/_site/core/resolver.md @@ -0,0 +1,33 @@ +# Blockstack Resolver + +During 2014-2016, Bockstack resolver was a separate service (like DNS resolvers). +It was merged into the Blockstack API in early 2017. + +The following (legacy) API call is still being supported by the Blockstack API: + +``` +http://localhost:5000/v2/users/fredwilson +``` + +And you can see a legacy resolver in action at http://resolver.onename.com/v2/users/fredwilson + +## Cron Job for Namespaces + +**Note: the instructions below need updating.** + +Currently, the resolver indexes all valid names in a local file which can be +populated by running +> $ ./refresh_names.sh + +On a production deployment, you should add a crond job to periodically run this +script. You can edit your crontab file by: +> $ crontab -e + +Here is a sample crontab file that runs the refresh script every two hours: +``` +SHELL=/bin/bash +HOME=/home/ubuntu + +#This is a comment +0 */2 * * * /home/ubuntu/resolver/resolver/refresh_names.sh +``` diff --git a/_site/core/search.md b/_site/core/search.md new file mode 100644 index 00000000..73b48068 --- /dev/null +++ b/_site/core/search.md @@ -0,0 +1,184 @@ +# Search + +The search subsystem for Blockstack Core creates an index for data associated +with registered names in namespaces and makes that data searchable. + +The search subsystem is currently meant to index the .id namespace but can +be easily expanded to include other namespaces. + +Currently there are two types of indexes to handle search queries: + +* Substring search on usernames, full names, twitter_handle (powered by MongoDB) +* Raw Lucene index which handles searching extended data e.g., bio. + +Search will currently return upto a max of 20 results (can be less depending on the query) +with data that follows structure of [blockstack IDs](https://github.com/blockstack/blockstack): + +In early 2017, the search subsystem was ported over to the new API system, where support for search is provided by the endpoint: + +``` +http://localhost:5000/search?query= +``` + +This document describes how to setup the search subsystem to respond at that endpoint. + +# Installation + +- **Step 1:** First, make sure you have [virtualenv installed](http://docs.python-guide.org/en/latest/dev/virtualenvs/). +Then, setup the API and search subsystem: +``` +$ sudo apt-get install -y mongodb memcached python-dev libmemcached-dev zlib1g-dev nginx +$ sudo pip install uwsgi +$ git clone https://github.com/blockstack/blockstack-core.git --branch api +$ cd blockstack-core/ +$ sudo pip install . +$ sudo pip install -r api/requirements.txt +$ sudo mkdir /var/blockstack-search && sudo chown $USER:$USER /var/blockstack-search +``` + +- **Step 2:** Make sure you have Blockstack Core running locally (see [instructions](https://github.com/blockstack/blockstack-core/blob/master/README.md#quick-start)). We highly +recommend using a local node because the search subsystem issues thousands of calls to +Blockstack Core for re-indexing and remote nodes can slow down performance. + +- **Step 3:** Fetch the data for the .id namespace and respective profiles. Note, you may want to redirect stderr to a file, as there is a lot of debug output. + +``` +$ cd api/ + +$ python -m search.fetch_data --fetch_namespace + +$ python -m search.fetch_data --fetch_profiles +``` + +- **Step 4:** Create the search index: + +``` +python -m search.basic_index --refresh +``` + +- **Step 5:** Enable search API endpoint: + +``` +$ sed -i 's/SEARCH_API_ENDPOINT_ENABLED \= False/SEARCH_API_ENDPOINT_ENABLED \= True/' config.py +``` + +# Usage + +You can quickly test the search index from the command line: + +``` +python -m search.substring_search --search_name "Fred Wil" +python -m search.substring_search --search_twitter fredwil +``` + +You can also use the search API end-point: + +> curl -G {machine_ip}:port/search/name -d "query=muneeb" + +Sample Response: + +``` +{ + "people": [ + { + "profile": { + "website": [ + { + "url": "http://muneebali.com", + "@type": "WebSite" + } + ], + "name": "Muneeb Ali", + "address": { + "addressLocality": "New York, NY", + "@type": "PostalAddress" + }, + "image": [ + { + "contentUrl": "https://s3.amazonaws.com/dx3/muneeb", + "@type": "ImageObject", + "name": "cover" + }, + { + "contentUrl": "https://s3.amazonaws.com/kd4/muneeb", + "@type": "ImageObject", + "name": "avatar" + } + ], + "@type": "Person", + "description": "Co-founder of Blockstack. Interested in distributed systems and blockchains. Previously, PhD at Princeton." + }, + "username": "muneeb" + }, + { + "profile": { + "message": "This blockchain ID is reserved for Muneeb Ali. If this is you, please email support@onename.com to claim it for free.", + "status": "reserved" + }, + "username": "muneebali" + }, + { + "profile": { + "cover": { + "url": "https://s3.amazonaws.com/97p/HHE.jpg" + }, + "v": "0.2" + }, + "username": "muneebali1" + } + + ] +} +``` + +## Enabling Elastic Search + +### Requirements: + +``` +sudo apt-get install mongodb +sudo apt-get install memcached libmemcached-dev +sudo apt-get install python2.7-dev +pip install -r requirements.txt +``` + +### Elastic Search + +Elastic Search library is not in github and resides at unix/lib/elastic + +the current version we're using is *0.90.2*. Download from: + +> wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.2.zip + +before installing pylimbmc make sure [memcached](memcached.md) is installed. + +Ensure that mongodb and elastic search are running +starting elastic search: + +``` +$elasticsearch (on mac) +bin/elasticsearch -d (on linux) +``` + +To test if elastic search is running: + +> curl -X GET http://localhost:9200/ + +returns: + +``` +{ + "ok" : true, + "status" : 200, + "name" : "Angler", + "version" : { + "number" : "0.90.2", + "snapshot_build" : false, + "lucene_version" : "4.3.1" + }, +``` + +Create Index: + +> python create_search_index.py --create_index + diff --git a/_site/core/setup_core_portal.md b/_site/core/setup_core_portal.md new file mode 100644 index 00000000..bd1dc80e --- /dev/null +++ b/_site/core/setup_core_portal.md @@ -0,0 +1,114 @@ +# Install Script + +We provide a [script](../images/scripts/ubuntu-17.04.sh) which will +perform all the steps outlined in this doc (except for creating a protocol handler -- see the bottom of the doc). The script creates a virtualenv of +Blockstack Core and installs Browser in a subdirectory. It additionally creates some +scripts for starting Core and Browser together. + +However, if you'd like to customize your install, step through it +yourself, or you are on a different distro, continue on with this doc! + +# Setting up Blockstack Core API Service + +Install required binaries in Ubuntu: + +``` +sudo apt update && sudo apt-get install -y python-pip python-dev libssl-dev libffi-dev rng-tools curl build-essential +``` + + +If you'd like to use a virtualenv to install Blockstack, you can do that + +``` +pip install virtualenv +virtualenv --python=python2.7 ~/.blockstack.venv/ && source ~/.blockstack.venv/bin/activate +``` + +Let's install virtualchain 0.14.3 and blockstack 0.14.3 + +``` +sudo apt install git +pip install git+https://github.com/blockstack/virtualchain.git@rc-0.14.3 +pip install git+https://github.com/blockstack/blockstack-core.git@rc-0.14.3 +``` + +Get Blockstack core configured with default settings and choose your Bitcoin wallet password +``` +blockstack setup -y --password BITCOIN_WALLET_PASSWORD --debug +``` + +# Setting up Blockstack Browser Node Application + +Install NodeJS through NodeSource PPA + +``` +curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash - +sudo apt install -y nodejs +``` + +Download Blockstack Browser and install its dependencies + +``` +git clone https://github.com/blockstack/blockstack-browser.git -bv0.11.1 +cd blockstack-browser +npm install node-sass +npm install +``` + +Note that `blockstack-browser` depends on `node-sass` which can sometimes install strangely on Linux, running `npm install node-sass` before trying to install the other dependencies solves that problem. + +# Running Blockstack Browser + +Now we're ready to run our Core API service and start the Browser node app. + +First, start the Core API service. + +``` +blockstack api start -y --password BITCOIN_WALLET_PASSWORD --debug +``` + +Start the CORS proxy. + +``` +npm run dev-proxy & +``` + +Start the Node Application + +``` +npm run dev +``` + +Then you can open `http://localhost:3000/` in your browser to get to the Blockstack Browser. + + +You can copy your api password to your clipboard with this command: +``` +grep api_password ~/.blockstack/client.ini | sed 's/api_password = //g' | xclip -selection clipboard +``` + +## Setting up a protocol handler + +If you'd like your browser to automatically handle links with the `blockstack:` protocol specifier, you will need to register a protocol handler with your desktop environment. In Ubuntu/Gnome, this can be done by creating a file + +`~/.local/share/applications/blockstack.desktop` + +With the following contents: + +``` +[Desktop Entry] +Type=Application +Terminal=false +Exec=bash -c 'xdg-open http://localhost:3000/auth?authRequest=$(echo "%u" | sed s,blockstack:////*,,)' +Name=Blockstack-Browser +MimeType=x-scheme-handler/blockstack; +``` + +Then you need to make this file executable, and register it as a protocol handler. + +``` +$ chmod +x ~/.local/share/applications/blockstack.desktop +$ xdg-mime default blockstack.desktop x-scheme-handler/blockstack +``` + +Now, `blockstack:` protocol URLs should get handled by your Blockstack Browser. If you're running Browser in your browser's private mode, you may have to copy and paste the link, as this protocol handler will try to open in a regular browser window. diff --git a/_site/core/subdomains.md b/_site/core/subdomains.md new file mode 100644 index 00000000..8ca85138 --- /dev/null +++ b/_site/core/subdomains.md @@ -0,0 +1,303 @@ +# Subdomain Design and Implementation + +Subdomains allow us to provide names to end users cheaply (and quickly). + +## Strong subdomain ownership + +For those who are new to this concept, it's a model where domains can +permanently, cryptographically delegate subdomains to particular keys, +relinquishing their ability to revoke the names or change the name +resolution details. + +These names will be indicated with an `.`, e.g., `foo.bar.id` + +## Overall Design + +We can do this today with a special indexer & resolver endpoint and +without any changes to the core protocol. + +We can do this by having a zone file record for each subdomain *i* +containing the following information: + +1. An owner address *addr* +2. A sequence number *N* +3. A zonefile +4. A signature *S* of the above + +The signature *S_i* must be verifiable with the address in the +*(N-1)*th entry for subdomain *i*. + +## Zonefile Format + +For now, the resolver will use an *TXT* record per subdomain to define +this information. The entry name will be `$(subdomain)`. + + +We'll use the format of [RFC 1464](https://tools.ietf.org/html/rfc1464) +for the TXT entry. We'll have the following strings with identifiers: + +1. **parts** : this specifies the number of pieces that the +zonefile has been chopped into. TXT strings can only be 255 bytes, +so we chop up the zonefile. +2. **zf{n}**: part *n* of the zonefile, base64 encoded +3. **owner**: the owner address delegated to operate the subdomain +4. **seqn**: the sequence number +5. **sig**: signature of the above data. + +``` +$ORIGIN bar.id +$TTL 3600 +pubkey TXT "pubkey:data:0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" +registrar URI 10 1 "bsreg://foo.com:8234" +aaron TXT "owner=33VvhhSQsYQyCVE2VzG3EHa9gfRCpboqHy" "seqn=0" "parts=1" "zf0=JE9SSUdJTiBhYXJvbgokVFRMIDM2MDAKbWFpbiBVUkkgMSAxICJwdWJrZXk6ZGF0YTowMzAyYWRlNTdlNjNiMzc1NDRmOGQ5Nzk4NjJhNDlkMDBkYmNlMDdmMjkzYmJlYjJhZWNmZTI5OTkxYTg3Mzk4YjgiCg==" +``` + +The `registrar` entry indicates how to contact the registrar service +for clients of the domain wishing to register or modify their entry. + +### Operations per Zonefile + +At 4kb zonefile size, we can only fit around 20 updates per zonefile. + +## Domain Operator Endpoint + +The directory `subdomain_registrar/` contains our code for running a +subdomain registrar. It can be executed by running: + +``` +$ blockstack-subdomain-registrar start foo.id +``` + +Here, `foo.id` is the domain for which subdomains will be associated. + +### Configuration and Registration Files + +Configuration of the subdomain registrar is done through `~/.blockstack_subdomains/config.ini` + +The sqlite database which stores the registrations is located alongside the config `~/.blockstack_subdomains/registrar.db`. + +You can change the location of the config file (and the database), by setting the environment variable `BLOCKSTACK_SUBDOMAIN_CONFIG` + +### Register Subdomain + +Subdomain registrations can be submitted to this endpoint using a REST +API. + +``` +POST /register +``` + +The schema for registration is: + +``` +{ + 'type' : 'object', + 'properties' : { + 'name' : { + 'type': 'string', + 'pattern': '([a-z0-9\-_+]{3,36})$' + }, + 'owner_address' : { + 'type': 'string', + 'pattern': schemas.OP_ADDRESS_PATTERN + }, + 'zonefile' : { + 'type' : 'string', + 'maxLength' : blockstack_constants.RPC_MAX_ZONEFILE_LEN + } + }, + 'required':[ + 'name', 'owner_address', 'zonefile' + ], + 'additionalProperties' : True +} +``` + +The registrar will: + +1. Check if the subdomain `foo` exists already on the domain. +2. Add the subdomain to the queue. + +On success, this returns `202` and the message + +``` +{"status": "true", "message": "Subdomain registration queued."} +``` + +When the registrar wakes up to prepare a transaction, it packs the queued +registrations together and issues an `UPDATE`. + + +### Check subdomain registration status + +A user can check on the registration status of their name via querying the +registrar. + +This is an API call: +``` +GET /status/{subdomain} +``` + +The registrar checks if the subdomain has propagated (i.e., the +registration is completed), in which case the following is returned: + +``` +{"status": "Subdomain already propagated"} +``` + +Or, if the subdomain has already been submitted in a transaction: + +``` +{"status": "Your subdomain was registered in transaction 09a40d6ea362608c68da6e1ebeb3210367abf7aa39ece5fd57fd63d269336399 -- it should propagate on the network once it has 6 confirmations."} +``` + +If the subdomain still hasn't been submitted yet: + +``` +{"status": "Subdomain is queued for update and should be announced within the next few blocks."} +``` + +If an error occurred trying to submit the `UPDATE` transaction, this endpoint will return an error +message in the `"error"` key of a JSON object. + +### Updating Entries + +The subdomain registrar does not currently support updating subdomain entries. + +## Resolver Behavior + +When a lookup like `foo.bar.id` hits the resolver, the resolver will need to: + +1. Lookup the zonefile history of `bar.id` +2. Fetch all these zonefiles and filter by operations on `foo` +3. Verify that all `foo` operations are correct +4. Return the latest record for foo +5. Do a profile lookup for `foo.bar.id` by fetching the URLs in the entry. +*Note*, this spec does not define a priority order for fetching those URLs. + +### Supported Core / Resolver Endpoints + +Generally, domain endpoints are not aware of subdomains (only endpoints +aware of subdomains is `/v1/users/`, +`/v1/names/`, and `/v1/addresses/bitcoin/`) +The endpoints which *are* subdomain aware are marked as such in +[api-specs.md], the cli command `blockstack lookup` is subdomain +aware. + +This means that search is *not* yet supported. + +The lookups work just like normal -- it returns the user's +profile object: + +``` +$ curl -H "Authorization: bearer blockstack_integration_test_api_password" -H "Origin: http://localhost:3000" http://localhost:16268/v1/users/bar.foo.id -v -s | python -m json.tool +* Trying 127.0.0.1... +* Connected to localhost (127.0.0.1) port 16268 (#0) +> GET /v1/users/bar.foo.id HTTP/1.1 +> Host: localhost:16268 +> User-Agent: curl/7.50.1 +> Accept: */* +> Authorization: bearer blockstack_integration_test_api_password +> Origin: http://localhost:3000 +> +* HTTP 1.0, assume close after body +< HTTP/1.0 200 OK +< Server: SimpleHTTP/0.6 Python/2.7.12+ +< Date: Thu, 03 Aug 2017 14:39:16 GMT +< content-type: application/json +< Access-Control-Allow-Origin: * +< +{ [66 bytes data] +* Closing connection 0 +{ + "bar": { + "@type": "Person", + "description": "Lorem Ipsum Bazorem" + } +} +``` + +Name info lookups are also supported (this should enable authenticating logins +with `blockstack.js`, but I will need to double check). + +``` +$ curl -H "Authorization: bearer XXXX" -H "Origin: http://localhost:3000" http://localhost:6270/v1/names/created_equal.self_evident_truth.id -s | python -m json.tool +{ + "address": "1AYddAnfHbw6bPNvnsQFFrEuUdhMhf2XG9", + "blockchain": "bitcoin", + "expire_block": -1, + "last_txid": "0bacfd5a3e0ec68723d5948d6c1a04ad0de1378c872d45fa2276ebbd7be230f7", + "satus": "registered_subdomain", + "zonefile_hash": "48fc1b351ce81cf0a9fd9b4eae7a3f80e93c0451", + "zonefile_txt": "$ORIGIN created_equal\n$TTL 3600\n_https._tcp URI 10 1 \"https://www.cs.princeton.edu/~ablankst/created_equal.json\"\n_file URI 10 1 \"file:///tmp/created_equal.json\"\n" +} +``` + +### Subdomain Caching + +A resolver *caches* a subdomain's state by keeping a database of all +the current subdomain records. This database is automatically updated +when a new zonefile for a particularly domain is seen by the resolver +(this is performed lazily). + +### Testing Subdomain Registrar and Resolution + +You can run a subdomain registrar and resolver with blockstack-core in +regtest mode as follows: + +```bash +IMAGE=$(docker run -dt -p 3000:3000 -p 6270:6270 -p 16269:16269 -p 18332:18332 -e BLOCKSTACK_TEST_CLIENT_RPC_PORT=6270 -e BLOCKSTACK_TEST_CLIENT_BIND=0.0.0.0 -e BLOCKSTACK_TEST_BITCOIND_ALLOWIP=172.17.0.0/16 quay.io/blockstack/integrationtests:master blockstack-test-scenario --interactive 2 blockstack_integration_tests.scenarios.browser_env) +``` + +Once you see `Test finished; doing checks` in that container's logs, the +registrar has started and is ready to accept requests. (We recommend +following the docker instructions below for running this test in +Docker, as it will fetch the source code for the registrar and set the +correct environment variables for it to run). + +Once this environment has started, you can issue a registration request from curl: + +``` +curl -X POST -H 'Content-Type: application/json' --data '{"zonefile": "$ORIGIN baz\n$TTL 3600\n_file URI 10 1 \"file:///tmp/baz.profile.json\"\n", "name": "baz", "owner_address": "14x2EMRz1gf16UzGbxZh2c6sJg4A8wcHLD"}' http://localhost:3000/register/ +``` + +This registers `baz.foo.id` -- you can check the registrar's status with + +``` +curl http://localhost:3000/status/baz +``` + +The API endpoints `/v1/users/`, +`/v1/names/`, and `/v1/addresses/bitcoin/` all work, so if you query the core API, you'll get a response. + +For example: + +``` +curl http://localhost:6270/v1/names/baz.foo.id | python -m json.tool +``` + +Will return: +``` +{ + "address": "1Nup2UcbVuVoDZeZCtR4vjSkrvTi8toTqc", + "blockchain": "bitcoin", + "expire_block": -1, + "last_txid": "43bbcbd8793cdc52f1b0bd2713ed136f4f104a683a9fd5c89911a57a8c4b28b6", + "satus": "registered_subdomain", + "zonefile_hash": "e7e3aada18c9ac5189f1c54089e987f58c0fa51e", + "zonefile_txt": "$ORIGIN bar\n$TTL 3600\n_file URI 10 1 \"file:///tmp/baz.profile.json\"\n" +} +``` + +### Running an interactive testing environment with the Subdomain Registrar service + +Follow the [instructions here](../integration_tests/README.md) to download the regtesting Docker image. + +Since the subdomain registrar service runs on port 3000, we need to do two things to expose this endpoint to interact with it from the browser: +- Open port 3000 with `-p 3000:3000` + +Here's the full command you'd run to start the interactive testing scenario: + +```bash +IMAGE=$(docker run -dt -p 3000:3000 -p 6270:6270 -p 16269:16269 -p 18332:18332 -e BLOCKSTACK_TEST_CLIENT_RPC_PORT=6270 -e BLOCKSTACK_TEST_CLIENT_BIND=0.0.0.0 -e BLOCKSTACK_TEST_BITCOIND_ALLOWIP=172.17.0.0/16 quay.io/blockstack/integrationtests:master blockstack-test-scenario --interactive 2 blockstack_integration_tests.scenarios.browser_env) +``` diff --git a/_site/core/wire-format.md b/_site/core/wire-format.md new file mode 100644 index 00000000..5f45ee8c --- /dev/null +++ b/_site/core/wire-format.md @@ -0,0 +1,492 @@ +This page is for organizations who want to be able to create and send name operation transactions to the blockchain(s) Blockstack supports. + +# Bitcoin + +This section describes the transaction formats for the Bitcoin blockchain. + +## Transaction format + +Each Bitcoin transaction for Blockstack contains signatures from two sets of keys: the name owner, and the payer. The owner `scriptSig` and `scriptPubKey` fields are generated from the key(s) that own the given name. The payer `scriptSig` and `scriptPubKey` fields are used to *subsidize* the operation. The owner keys do not pay for any operations; the owner keys only control the minimum amount of BTC required to make the transaction standard. The payer keys only pay for the transaction's fees, and (when required) they pay the name fee. + +This construction is meant to allow the payer to be wholly separate from the owner. The principal that owns the name can fund their own transactions, or they can create a signed transaction that carries out the desired operation and request some other principal (e.g. a parent organization) to actually pay for and broadcast the transaction. + +The general transaction layout is as follows: + +| **Inputs** | **Outputs** | +| ------------------------ | ----------------------- | +| Owner scriptSig (1) | `OP_RETURN ` (2) | +| Payment scriptSig | Owner scriptPubKey (3) | +| Payment scriptSig... (4) | +| ... (4) | ... (5) | + +(1) The owner `scriptSig` is *always* the first input. +(2) The `OP_RETURN` script that describes the name operation is *always* the first output. +(3) The owner `scriptPubKey` is *always* the second output. +(4) The payer can use as many payment inputs as (s)he likes. +(5) At most one output will be the "change" `scriptPubKey` for the payer. +Different operations require different outputs. + +## Payload Format + +Each Blockstack transaction in Bitcoin describes the name operation within an `OP_RETURN` output. It encodes name ownership, name fees, and payments as `scriptPubKey` outputs. The specific operations are described below. + +Each `OP_RETURN` payload *always* starts with the two-byte string `id` (called the "magic" bytes in this document), followed by a one-byte `op` that describes the operation. + +### NAME_PREORDER + +Op: `?` + +Description: This transaction commits to the *hash* of a name. It is the first +transaction of two transactions that must be sent to register a name in BNS. + +Example: [6730ae09574d5935ffabe3dd63a9341ea54fafae62fde36c27738e9ee9c4e889](https://www.blocktrail.com/BTC/tx/6730ae09574d5935ffabe3dd63a9341ea54fafae62fde36c27738e9ee9c4e889) + +`OP_RETURN` wire format: +``` + 0 2 3 23 39 + |-----|--|--------------------------------------------------|--------------| + magic op hash_name(name.ns_id,script_pubkey,register_addr) consensus hash +``` + +Inputs: +* Payment `scriptSig`'s + +Outputs: +* `OP_RETURN` payload +* Payment `scriptPubkey` script for change +* `p2pkh` `scriptPubkey` to the burn address (0x00000000000000000000000000000000000000) + +Notes: +* `register_addr` is a base58check-encoded `ripemd160(sha256(pubkey))` (i.e. an address). This address **must not** have been used before in the underlying blockchain. +* `script_pubkey` is either a `p2pkh` or `p2sh` compiled Bitcoin script for the payer's address. + +### NAME_REGISTRATION + +Op: `:` + +Description: This transaction reveals the name whose hash was announced by a +previous `NAME_PREORDER`. It is the second of two transactions that must be +sent to register a name in BNS. + +Example: [55b8b42fc3e3d23cbc0f07d38edae6a451dfc512b770fd7903725f9e465b2925](https://www.blocktrail.com/BTC/tx/55b8b42fc3e3d23cbc0f07d38edae6a451dfc512b770fd7903725f9e465b2925) + +`OP_RETURN` wire format (2 variations allowed): + +Variation 1: +``` + 0 2 3 39 + |----|--|-----------------------------| + magic op name.ns_id (37 bytes) +``` + +Variation 2: +``` + 0 2 3 39 59 + |----|--|----------------------------------|-------------------| + magic op name.ns_id (37 bytes, 0-padded) value +``` + +Inputs: +* Payer `scriptSig`'s + +Outputs: +* `OP_RETURN` payload +* `scriptPubkey` for the owner's address +* `scriptPubkey` for the payer's change + +Notes: + +* Variation 1 simply registers the name. Variation 2 will register the name and +set a name value simultaneously. This is used in practice to set a zone file +hash for a name without the extra `NAME_UPDATE` transaction. +* Both variations are supported. Variation 1 was designed for the time when + Bitcoin only supported 40-byte `OP_RETURN` outputs. + +### NAME_RENEWAL + +Op: `:` + +Description: This transaction renews a name in BNS. The name must still be +registered and not expired, and owned by the transaction sender. + +Example: [e543211b18e5d29fd3de7c0242cb017115f6a22ad5c6d51cf39e2b87447b7e65](https://www.blocktrail.com/BTC/tx/e543211b18e5d29fd3de7c0242cb017115f6a22ad5c6d51cf39e2b87447b7e65) + +`OP_RETURN` wire format (2 variations allowed): + +Variation 1: +``` + 0 2 3 39 + |----|--|-----------------------------| + magic op name.ns_id (37 bytes) +``` + +Variation 2: +``` + 0 2 3 39 59 + |----|--|----------------------------------|-------------------| + magic op name.ns_id (37 bytes, 0-padded) value +``` + +Inputs: + +* Payer `scriptSig`'s + +Outputs: + +* `OP_RETURN` payload +* `scriptPubkey` for the owner's addess. This can be a different address than + the current name owner (in which case, the name is renewed and transferred). +* `scriptPubkey` for the payer's change +* `scriptPubkey` for the burn address (to pay the name cost) + +Notes: + +* This transaction is identical to a `NAME_REGISTRATION`, except for the presence of the fourth output that pays for the name cost (to the burn address). +* Variation 1 simply renews the name. Variation 2 will both renew the name and + set a new name value (in practice, the hash of a new zone file). +* Both variations are supported. Variation 1 was designed for the time when + Bitcoin only supported 40-byte `OP_RETURN` outputs. +* This operation can be used to transfer a name to a new address by setting the + second output (the first `scriptPubkey`) to be the `scriptPubkey` of the new + owner key. + +### NAME_UPDATE + +Op: `+` + +Description: This transaction sets the name state for a name to the given +`value`. In practice, this is used to announce new DNS zone file hashes to the [Atlas +network](atlas_network.md). + +Example: [e2029990fa75e9fc642f149dad196ac6b64b9c4a6db254f23a580b7508fc34d7](https://www.blocktrail.com/BTC/tx/e2029990fa75e9fc642f149dad196ac6b64b9c4a6db254f23a580b7508fc34d7) + +`OP_RETURN` wire format: +``` + 0 2 3 19 39 + |-----|--|-----------------------------------|-----------------------| + magic op hash128(name.ns_id,consensus hash) zone file hash +``` + +Note that `hash128(name.ns_id, consensus hash)` is the first 16 bytes of a SHA256 hash over the name concatenated to the hexadecimal string of the consensus hash (not the bytes corresponding to that hex string). +See the [Method Glossary](#method-glossary) below. + +Example: `hash128("jude.id" + "8d8762c37d82360b84cf4d87f32f7754") == "d1062edb9ec9c85ad1aca6d37f2f5793"`. + +Inputs: +* owner `scriptSig` +* payment `scriptSig`'s + +Outputs: +* `OP_RETURN` payload +* owner's `scriptPubkey` +* payment `scriptPubkey` change + +### NAME_TRANSFER + +Op: `>` + +Description: This transaction changes the public key hash that owns the name in +BNS. + +Example: [7a0a3bb7d39b89c3638abc369c85b5c028d0a55d7804ba1953ff19b0125f3c24](https://www.blocktrail.com/BTC/tx/7a0a3bb7d39b89c3638abc369c85b5c028d0a55d7804ba1953ff19b0125f3c24) + +`OP_RETURN` wire format: +``` + 0 2 3 4 20 36 + |-----|--|----|-------------------|---------------| + magic op keep hash128(name.ns_id) consensus hash + data? +``` + +Inputs: + +* Owner `scriptSig` +* Payment `scriptSig`'s + +Outputs: + +* `OP_RETURN` payload +* new name owner's `scriptPubkey` +* old name owner's `scriptPubkey` +* payment `scriptPubkey` change + +Notes: + +* The `keep data?` byte controls whether or not the name's 20-byte value is preserved. This value is either `>` to preserve it, or `~` to delete it. + +### NAME_REVOKE + +Op: `~` + +Description: This transaction destroys a registered name. Its name state value +in BNS will be cleared, and no further transactions will be able to affect the +name until it expires (if its namespace allows it to expire at all). + +Example: [eb2e84a45cf411e528185a98cd5fb45ed349843a83d39fd4dff2de47adad8c8f](https://www.blocktrail.com/BTC/tx/eb2e84a45cf411e528185a98cd5fb45ed349843a83d39fd4dff2de47adad8c8f) + +`OP_RETURN` wire format: +``` + 0 2 3 39 + |----|--|-----------------------------| + magic op name.ns_id (37 bytes) +``` + +Inputs: + +* owner `scriptSig` +* payment `scriptSig`'s + +Outputs: + +* `OP_RETURN` payload +* owner `scriptPubkey` +* payment `scriptPubkey` change + +### ANNOUNCE + +Op: `#` + +Description: This transaction does not affect any names in BNS, but it allows a +user to send a message to other BNS nodes. In order for the message to be +received, the following must be true: + +* The sender must have a BNS name +* The BNS nodes must list the sender's BNS name as being a "trusted message + sender" +* The message must have already been propagated through the [Atlas + network](atlas_network.md). This transaction references it by content hash. + +`OP_RETURN` wire format: + +``` + 0 2 3 23 + |----|--|-----------------------------| + magic op ripemd160(sha256(message)) +``` + +Inputs: + +* The payer `scriptSig`'s + +Outputs: + +* `OP_RETURN` payload +* change `scriptPubKey` + +Notes: + +* The payer key should be an owner key for an existing name, since Blockstack users can subscribe to announcements from specific name-owners. + +### NAMESPACE_PREORDER + +Op: `*` + +Description: This transaction announces the *hash* of a new namespace. It is the +first of three transactions that must be sent to create a namespace. + +Example: [5f00b8e609821edd6f3369ee4ee86e03ea34b890e242236cdb66ef6c9c6a1b28](https://www.blocktrail.com/BTC/tx/5f00b8e609821edd6f3369ee4ee86e03ea34b890e242236cdb66ef6c9c6a1b28) + +`OP_RETURN` wire format: +``` + 0 2 3 23 39 + |-----|---|-----------------------------------------|----------------| + magic op hash_name(ns_id,script_pubkey,reveal_addr) consensus hash +``` + +Inputs: + +* Namespace payer `scriptSig` + +Outputs: + +* `OP_RETURN` payload +* Namespace payer `scriptPubkey` change address +* `p2pkh` script to the burn address `1111111111111111111114oLvT2`, whose public key hash is 0x00000000000000000000000000000000 + +Notes: + +* The `reveal_addr` field is the address of the namespace revealer public key. The revealer private key will be used to generate `NAME_IMPORT` transactions. + +### NAMESPACE_REVEAL + +Op: `&` + +Description: This transaction reveals the namespace ID and namespace rules +for a previously-anounced namespace hash (sent by a previous `NAMESPACE_PREORDER`). + +Example: [ab54b1c1dd5332dc86b24ca2f88b8ca0068485edf0c322416d104c5b84133a32](https://www.blocktrail.com/BTC/tx/ab54b1c1dd5332dc86b24ca2f88b8ca0068485edf0c322416d104c5b84133a32) + +`OP_RETURN` wire format: +``` + 0 2 3 7 8 9 10 11 12 13 14 15 16 17 18 20 39 + |-----|---|--------|-----|-----|----|----|----|----|----|-----|-----|-----|--------|----------|-------------------------| + magic op life coeff. base 1-2 3-4 5-6 7-8 9-10 11-12 13-14 15-16 nonalpha version namespace ID + bucket exponents no-vowel + discounts +``` + +Inputs: + +* Namespace payer `scriptSig`s + +Outputs: + +* `OP_RETURN` payload +* namespace revealer `scriptPubkey` +* namespace payer change `scriptPubkey` + +Notes: + +* This transaction must be sent within 1 day of the `NAMESPACE_PREORDER` +* The second output (with the namespace revealer) **must** be a `p2pkh` script +* The address of the second output **must** be the `reveal_addr` in the `NAMESPACE_PREORDER` + +Pricing: + +The rules for a namespace are as follows: + + * a name can fall into one of 16 buckets, measured by length. Bucket 16 incorporates all names at least 16 characters long. + * the pricing structure applies a multiplicative penalty for having numeric characters, or punctuation characters. + * the price of a name in a bucket is ((coeff) * (base) ^ (bucket exponent)) / ((numeric discount multiplier) * (punctuation discount multiplier)) + +Example: +* base = 10 +* coeff = 2 +* nonalpha discount: 10 +* no-vowel discount: 10 +* buckets 1, 2: 9 +* buckets 3, 4, 5, 6: 8 +* buckets 7, 8, 9, 10, 11, 12, 13, 14: 7 +* buckets 15, 16+: + +With the above example configuration, the following are true: + +* The price of "john" would be 2 * 10^8, since "john" falls into bucket 4 and has no punctuation or numerics. +* The price of "john1" would be 2 * 10^6, since "john1" falls into bucket 5 but has a number (and thus receives a 10x discount) +* The price of "john_1" would be 2 * 10^6, since "john_1" falls into bucket 6 but has a number and punctuation (and thus receives a 10x discount) +* The price of "j0hn_1" would be 2 * 10^5, since "j0hn_1" falls into bucket 6 but has a number and punctuation and lacks vowels (and thus receives a 100x discount) + + +### NAME_IMPORT + +Op: `;` + +Description: This transaction registers a name and some name state into a +namespace that has been revealed, but not been launched. Only the namespace +creator can import names. See the [namespace creation +tutorial](namespace_creation.md) for details. + +Example: [c698ac4b4a61c90b2c93dababde867dea359f971e2efcf415c37c9a4d9c4f312](https://www.blocktrail.com/BTC/tx/c698ac4b4a61c90b2c93dababde867dea359f971e2efcf415c37c9a4d9c4f312) + +`OP_RETURN` wire format: +``` + 0 2 3 39 + |----|--|-----------------------------| + magic op name.ns_id (37 bytes) +``` + +Inputs: + +* The namespace reveal `scriptSig` (with the namespace revealer's public key), or one of its first 300 extended public keys +* Any payment inputs + +Outputs: + +* `OP_RETURN` payload +* recipient `scriptPubKey` +* zone file hash (using the 20-byte hash in a standard `p2pkh` script) +* payment change `scriptPubKey` + +Notes: + +* These transactions can only be sent between the `NAMESPACE_REVEAL` and `NAMESPACE_READY`. +* The first `NAME_IMPORT` transaction **must** have a `scriptSig` input that matches the `NAMESPACE_REVEAL`'s second output (i.e. the reveal output). +* Any subsequent `NAME_IMPORT` transactions **may** have a `scriptSig` input whose public key is one of the first 300 extended public keys from the `NAMESPACE_REVEAL`'s `scriptSig` public key. + +### NAMESPACE_READY + +Op: `!` + +Description: This transaction launches a namesapce. Only the namespace creator +can send this transaction. Once sent, anyone can register names in the +namespace. + +Example: [2bf9a97e3081886f96c4def36d99a677059fafdbd6bdb6d626c0608a1e286032](https://www.blocktrail.com/BTC/tx/2bf9a97e3081886f96c4def36d99a677059fafdbd6bdb6d626c0608a1e286032) + +`OP_RETURN` wire format: +``` + + 0 2 3 4 23 + |-----|--|--|------------| + magic op . ns_id +``` + +Inputs: +* Namespace revealer's `scriptSig`s + +Outputs: +* `OP_RETURN` payload +* Change output to the namespace revealer's `p2pkh` script + +Notes: +* This transaction must be sent within 1 year of the corresponding `NAMESPACE_REVEAL` to be accepted. + +## Method Glossary + +Some hashing primitives are used to construct the wire-format representation of each name operation. They are enumerated here: + +``` +B40_REGEX = '^[a-z0-9\-_.+]*$' + +def is_b40(s): + return isinstance(s, str) and re.match(B40_REGEX, s) is not None + +def b40_to_bin(s): + if not is_b40(s): + raise ValueError('{} must only contain characters in the b40 char set'.format(s)) + return unhexlify(charset_to_hex(s, B40_CHARS)) + +def hexpad(x): + return ('0' * (len(x) % 2)) + x + +def charset_to_hex(s, original_charset): + return hexpad(change_charset(s, original_charset, B16_CHARS)) + +def bin_hash160(s, hex_format=False): + """ s is in hex or binary format + """ + if hex_format and is_hex(s): + s = unhexlify(s) + return hashlib.new('ripemd160', bin_sha256(s)).digest() + +def hex_hash160(s, hex_format=False): + """ s is in hex or binary format + """ + if hex_format and is_hex(s): + s = unhexlify(s) + return hexlify(bin_hash160(s)) + +def hash_name(name, script_pubkey, register_addr=None): + """ + Generate the hash over a name and hex-string script pubkey. + Returns the hex-encoded string RIPEMD160(SHA256(x)), where + x is the byte string composed of the concatenation of the + binary + """ + bin_name = b40_to_bin(name) + name_and_pubkey = bin_name + unhexlify(script_pubkey) + + if register_addr is not None: + name_and_pubkey += str(register_addr) + + # make hex-encoded hash + return hex_hash160(name_and_pubkey) + +def hash128(data): + """ + Hash a string of data by taking its 256-bit sha256 and truncating it to the + first 16 bytes + """ + return hexlify(bin_sha256(data)[0:16]) +``` + diff --git a/_site/feed.xml b/_site/feed.xml new file mode 100644 index 00000000..1dbe6ac6 --- /dev/null +++ b/_site/feed.xml @@ -0,0 +1,49 @@ +Jekyll2018-08-27T11:40:45-07:00http://localhost:4000/BlockstackDocsBlockstackSite tags2017-05-25T00:00:00-07:002017-05-25T00:00:00-07:00http://localhost:4000/2017/05/25/post63<p>http://localhost:4000/assets/posts/</p> + +<p>/2017/05/25/post63.html</p> + +<p>Musce libero nunc, dignissim quis turpis quis, semper vehicula dolor. Suspendisse tincidunt consequat quam, ac posuere leo dapibus id. Cras fringilla convallis elit, at eleifend mi interam.</p> + +<p>Nulla non sollicitudin. Morbi sit amet laoreet ipsum, vel pretium mi. Morbi varius, tellus in accumsan blandit, elit ligula eleifend velit, luctus mattis ante nulla condimentum nulla. Etiam vestibulum risus vel arcu elementum eleifend. Cras at dolor eget urna varius faucibus tempus in elit.</p> + +<h2 id="image-lightbox-example">Image Lightbox Example</h2> +<p>Nunc porta malesuada porta. Etiam tristique vestibulum dolor at ultricies. Proin hendrerit sapien sed erat fermentum, at commodo velit consectetur.</p> + +<figure data-uk-lightbox="animation: slide"> + <!-- <a class="uk-inline" href="http://localhost:4000/assets/posts/image1.png" caption="Image in lightbox"> --> + <a class="uk-inline" href="/assets/posts/image1.png" caption="Image in lightbox"> + <!-- <img src="http://localhost:4000/assets/posts/image1.png" alt="Alt for image"> --> + <img src="/assets/posts/image1.png" alt="Alt for image" /> + <div class="uk-position-center"> + <span data-uk-overlay-icon=""></span> + </div> + </a> + <figcaption data-uk-grid="" class="uk-flex-right"><span class="uk-width-auto">Image in lightbox</span></figcaption> +</figure> + +<p>Etiam vestibulum risus vel arcu elementum eleifend. Cras at dolor eget urna varius faucibus tempus in elit. Cras a dui imperdiet, tempus metus quis, pharetra turpis. Phasellus at massa sit amet ante semper fermentum sed eget lectus. Quisque id dictum magna, et dapibus turpis.</p> + +<h2 id="example-of-code-block">Example Of Code Block</h2> +<p>In accumsan lacus ac neque maximus dictum. Phasellus eleifend leo id mattis bibendum. Curabitur et purus turpis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;</p> + +<div class="language-html highlighter-rouge"><pre class="highlight"><code><span class="nt">&lt;head&gt;</span> + <span class="nt">&lt;meta</span> <span class="na">charset=</span><span class="s">"utf-8"</span><span class="nt">&gt;</span> + <span class="nt">&lt;meta</span> <span class="na">http-equiv=</span><span class="s">"X-UA-Compatible"</span> <span class="na">content=</span><span class="s">"IE=edge"</span><span class="nt">&gt;</span> + <span class="nt">&lt;meta</span> <span class="na">name=</span><span class="s">"viewport"</span> <span class="na">content=</span><span class="s">"width=device-width, initial-scale=1"</span><span class="nt">&gt;</span> + <span class="nt">&lt;link</span> <span class="na">rel=</span><span class="s">"stylesheet"</span> <span class="na">href=</span><span class="s">"/assets/css/main.css"</span><span class="nt">&gt;</span> + <span class="nt">&lt;link</span> <span class="na">rel=</span><span class="s">"shortcut icon"</span> <span class="na">type=</span><span class="s">"image/png"</span> <span class="na">href=</span><span class="s">"/assets/img/favicon.png"</span> <span class="nt">&gt;</span> + <span class="nt">&lt;script </span><span class="na">src=</span><span class="s">"/assets/js/main.js"</span><span class="nt">&gt;&lt;/script&gt;</span> +<span class="nt">&lt;/head&gt;</span> +</code></pre> +</div> + +<h2 id="text-and-quote">Text and Quote</h2> +<p>Cras at dolor eget urna varius faucibus tempus in elit. Cras a dui imperdiet, tempus metus quis, pharetra turpis. Phasellus at massa sit amet ante semper fermentum sed eget lectus. Quisque id dictum magna turpis.</p> + +<blockquote> + <p>Etiam vestibulum risus vel arcu elementum eleifend. Cras at dolor eget urna varius faucibus tempus in elit. Cras a dui imperdiet</p> +</blockquote> + +<p>In accumsan lacus ac neque maximus dictum. Phasellus eleifend leo id mattis bibendum. Curabitur et purus turpis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;</p> + +<p>Etiam in fermentum mi. Sed et tempor felis, eu aliquet nisi. Nam eget ullamcorper arcu. Nunc porttitor nisl a dolor blandit, eget consequat sem maximus. Phasellus lacinia quam porta orci malesuada, vel tincidunt.</p>John BlackSite tags \ No newline at end of file diff --git a/_site/get-content.sh b/_site/get-content.sh new file mode 100755 index 00000000..a8db13c6 --- /dev/null +++ b/_site/get-content.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# get the content from the downstream repos +# needs jq "brew install jq" + +collectionList=$( + + + + + + + +Blockstack | Docs + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      + +
      +
      + + + +
      +
      + + +

      Hero

      + + + +

      Welcome to the documentation on everything Blockstack.

      + + + + + +
      +
      + + + + + + +
      +
      + + +

      Browse by topic or technology category

      + + + + +
      + + + + +
      +
      + + + + +

      Evaluate Blockstack

      + +

      Learn about the technology behind Blockstack. Understand the value it offers and how it provides it.

      + +
      +
      + + + + + +
      +
      + + + + +

      Use the New Internet

      + +

      Learn about the New Internet and its applications. Create an identity and learn how to use it.

      + +
      +
      + + + + + +
      +
      + + + + +

      Build Apps and Earn Money

      + +

      Learn how to build an application that earns with Blockstack.

      + +
      +
      + + + + + +
      +
      + + + + +

      Use the Naming Service

      + +

      Managing your account, create new users and exporting data

      + +
      +
      + + + + + +
      +
      + + + + +

      Implement Authentication

      + +

      Managing your account, creating new users and exporting data

      + +
      +
      + + + + + +
      +
      + + + + +

      Implement Storage with GAIA

      + +

      Backend storage drivers and interactions between developer APIs and the Gaia service.

      + +
      +
      + + +
      + +
      +
      + + + + + + + + +
      +
      + + + + + +
      +
      +
      +
      + + + + + + +
      +
      +
      +

      Didn't find an answer to your question?

      +

      Get in touch with us and we will be happy to respond!

      + Contact Us +
      +
      +
      + + + +
      +
      + + + + + + + +
      +
      + + + +
      +
      + +
      + +
      +
      +
      + +
      + +
      + + +
      + +
      + + + + +
      + +
      + + + + + +
      + +
      + + + + + + +
      +
      + + +
      +
      + + + + + + + + + + diff --git a/_site/netlify.toml b/_site/netlify.toml new file mode 100644 index 00000000..a0ed3e18 --- /dev/null +++ b/_site/netlify.toml @@ -0,0 +1,6 @@ +[Settings] +ID = "2daa9486-d204-4dc7-857a-2bfcded10b91" + + +[build] + publish: _site diff --git a/_site/news/index.html b/_site/news/index.html new file mode 100644 index 00000000..f34202e1 --- /dev/null +++ b/_site/news/index.html @@ -0,0 +1,294 @@ + + + + + + + + +News | Blockstack + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      + +
      +
      + + + + +
      +
      + +

      News

      + + +
      + +
      +
      + + +
      + + Blockstack + +
      +
      +

      Site tags

      +

      +
      +
      +
      +
      +

      Site tags

      + + +
      + + +
      + + + +
        + +
      + + +
      +
      + + +
      +
      + + + + + + + +
      +
      + + + +
      +
      + +
      + +
      +
      +
      + +
      + +
      + + +
      + +
      + + + + +
      + +
      + + + + + +
      + +
      + + + + + + +
      +
      + + +
      +
      + + + + + + + + + + diff --git a/_site/package.json b/_site/package.json new file mode 100644 index 00000000..65298ac4 --- /dev/null +++ b/_site/package.json @@ -0,0 +1,41 @@ +{ + "name": "docs", + "version": "1.0.0", + "description": "Docs Jekyll theme.", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "copy": "ncp node_modules/uikit/src/scss/ _sass/uikit/ && ncp node_modules/system-font-css/ _sass/system-font-css/", + "lint": "jshint assets/js/custom.js", + "uglify": "uglifyjs node_modules/uikit/dist/js/uikit.js node_modules/uikit/dist/js/uikit-icons.js node_modules/simple-jekyll-search/dest/simple-jekyll-search.js assets/js/custom.js -m -c -o assets/js/main.js", + "concat": "uglifyjs node_modules/uikit/dist/js/uikit.js node_modules/uikit/dist/js/uikit-icons.js node_modules/simple-jekyll-search/dest/simple-jekyll-search.js assets/js/custom.js -b -o assets/js/main.js", + "dev": "npm run lint && npm run concat", + "build": "npm run lint && npm run uglify", + "watch": "watch 'npm run dev' assets/js/", + "postinstall": "npm run copy && npm run concat" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/" + }, + "author": "moxiegirl", + "license": "MIT", + "bugs": { + "url": "https://github.com/" + }, + "homepage": "https://github.com/", + "dependencies": { + "simple-jekyll-search": "^1.5.0", + "system-font-css": "^2.0.1", + "uikit": "^3.0.0-beta.42" + }, + "devDependencies": { + "jshint": "^2.9.5", + "ncp": "latest", + "uglify-js": "^3.2.1", + "watch": "^1.0.2" + }, + "directories": { + "doc": "docs" + } +} diff --git a/_site/robots.txt b/_site/robots.txt new file mode 100644 index 00000000..1f53798b --- /dev/null +++ b/_site/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / diff --git a/_site/search.json b/_site/search.json new file mode 100644 index 00000000..3c5c1916 --- /dev/null +++ b/_site/search.json @@ -0,0 +1,3 @@ +[ + +] diff --git a/_site/thanks/index.html b/_site/thanks/index.html new file mode 100644 index 00000000..45645cb7 --- /dev/null +++ b/_site/thanks/index.html @@ -0,0 +1,270 @@ + + + + + + + + +Thanks | Blockstack + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      + +
      +
      + + + + +
      +
      + +
      + +

      Thanks

      + +
      +

      Varius tempor. Nulla non sollicitudin tortor. Morbi sit amet laoreet ipsum, vel pretium mi. Morbi varius, tellus in accumsan blandit, elit ligula eleifend velit, luctus mattis ante nulla condimentum nulla.

      + +

      Ut malesuada varius tempor. Nulla non sollicitudin tortor. Morbi sit amet laoreet ipsum, vel pretium mi. Morbi varius, tellus in accumsan blandit, elit ligula eleifend velit, luctus mattis ante nulla condimentum nulla.

      + +

      Mesuada varius tempor. Nulla non sollicitudin tortor. Morbi sit amet laoreet ipsum, vel pretium mi. Morbi varius, tellus in accumsan blandit, elit ligula eleifend velit, luctus mattis ante nulla condimentum nulla.

      + +

      Varius tempor. Nulla non sollicitudin tortor. Morbi sit amet laoreet ipsum, vel pretium mi. Morbi varius, tellus in accumsan blandit, elit ligula eleifend velit, luctus mattis ante nulla condimentum nulla.

      + +
      + +
      + +
      +
      + + +
      +
      + + + + + + + +
      +
      + + + +
      +
      + +
      + +
      +
      +
      + +
      + +
      + + +
      + +
      + + + + +
      + +
      + + + + + +
      + +
      + + + + + + +
      +
      + + +
      +
      + + + + + + + + + +