├── .gitignore
├── public
├── CNAME
├── favicon.ico
└── index.html
├── .babelrc
├── docs
├── favicon.ico
├── index.html
├── css
│ └── app.44e36df0.css
└── js
│ ├── app.7bf0c650.js
│ └── chunk-vendors.921305e9.js
├── src
├── assets
│ ├── logo.png
│ └── GitHub-Mark-64px.png
├── main.js
├── components
│ └── Logo.vue
└── App.vue
├── libs
├── helpers-log.js
├── index.js
└── helpers.js
├── .eslintrc
├── release.sh
├── vue.config.js
├── LICENSE
├── rollup.config.js
├── package.json
├── dist
├── vue-fb-customer-chat.umd.js
├── vue-fb-customer-chat.esm.js
└── vue-fb-customer-chat.cjs.js
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 |
--------------------------------------------------------------------------------
/public/CNAME:
--------------------------------------------------------------------------------
1 | vue-fb-customer-chat.js.org
2 |
--------------------------------------------------------------------------------
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["@babel/preset-env"]
3 | }
4 |
--------------------------------------------------------------------------------
/docs/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmnCodes/vue-fb-customer-chat/HEAD/docs/favicon.ico
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmnCodes/vue-fb-customer-chat/HEAD/public/favicon.ico
--------------------------------------------------------------------------------
/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmnCodes/vue-fb-customer-chat/HEAD/src/assets/logo.png
--------------------------------------------------------------------------------
/src/assets/GitHub-Mark-64px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dmnCodes/vue-fb-customer-chat/HEAD/src/assets/GitHub-Mark-64px.png
--------------------------------------------------------------------------------
/libs/helpers-log.js:
--------------------------------------------------------------------------------
1 | const log = {
2 | success: 'padding:0.6em 0; color:#27b376;',
3 | info: 'padding:0.6em 0; color:#3B5998;',
4 | error: 'padding:0.6em 0; color:#bf212f;'
5 | }
6 |
7 | export default log
8 |
--------------------------------------------------------------------------------
/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "root": true,
3 | "extends": [
4 | "plugin:vue-libs/recommended"
5 | ],
6 | "rules": {
7 | "space-before-function-paren": ["error", {
8 | "anonymous": "never",
9 | "named": "never",
10 | "asyncArrow": "always"
11 | }]
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import VueAnalytics from 'vue-analytics'
3 | import VueFbCustomerChat from '../dist/vue-fb-customer-chat.umd.js'
4 | import App from './App.vue'
5 |
6 | Vue.use(VueAnalytics, {
7 | id: 'UA-139039966-2'
8 | })
9 |
10 | Vue.use(VueFbCustomerChat, {
11 | page_id: 112279751371696,
12 | theme_color: '#2c3e50',
13 | locale: 'en_US'
14 | })
15 |
16 | Vue.config.productionTip = false
17 |
18 | new Vue({
19 | render: function (h) { return h(App) },
20 | }).$mount('#app')
21 |
--------------------------------------------------------------------------------
/release.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -e
4 | echo "Enter release version: "
5 | read VERSION
6 |
7 | read -p "Releasing $VERSION - are you sure? (y/n)" -n 1 -r
8 | echo # (optional) move to a new line
9 | if [[ $REPLY =~ ^[Yy]$ ]]
10 | then
11 | echo "Releasing $VERSION ..."
12 |
13 | # build
14 | VERSION=$VERSION npm run build
15 |
16 | # commit
17 | git add -A
18 | git commit -m "[build] $VERSION"
19 | npm version $VERSION --message "[release] $VERSION"
20 |
21 | # publish
22 | git push origin refs/tags/v$VERSION
23 | git push
24 | npm publish
25 | fi
26 |
--------------------------------------------------------------------------------
/vue.config.js:
--------------------------------------------------------------------------------
1 | // const fs = require('fs');
2 | module.exports = {
3 | publicPath: process.env.NODE_ENV === 'production'
4 | ? '/vue-fb-customer-chat/'
5 | : '/',
6 | outputDir: 'docs',
7 | devServer: {
8 | open: true,
9 | // host: '127.0.0.1',
10 | // hotOnly: false,
11 | // port: 8080,
12 | // https: {
13 | // key: fs.readFileSync('./.certs/localhost.key'),
14 | // cert: fs.readFileSync('./.certs/localhost.crt'),
15 | // // ca: fs.readFileSync('./.certs/ca.crt'),
16 | // },
17 | },
18 | lintOnSave: process.env.NODE_ENV !== 'production',
19 | productionSourceMap: false
20 | }
21 |
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Facebook Customer Chat Plugin for Vue.js
10 |
11 |
12 |
13 | We're sorry but vue doesn't work properly without JavaScript enabled. Please enable it to continue.
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 | Facebook Customer Chat Plugin for Vue.js We're sorry but vue doesn't work properly without JavaScript enabled. Please enable it to continue.
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Damian Przepiórka
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/rollup.config.js:
--------------------------------------------------------------------------------
1 | import resolve from 'rollup-plugin-node-resolve';
2 | import commonjs from 'rollup-plugin-commonjs';
3 | import babel from 'rollup-plugin-babel';
4 | import { uglify } from 'rollup-plugin-uglify';
5 | import { eslint } from 'rollup-plugin-eslint';
6 | import pkg from './package.json';
7 |
8 | let removeConsole = (process.env.NODE_ENV === 'production') ? ["transform-remove-console"]: []
9 | console.log(process.env.NODE_ENV);
10 |
11 | export default [
12 | // browser-friendly UMD build
13 | {
14 | input: 'libs/index.js',
15 | output: {
16 | name: 'VueFbCustomerChat',
17 | file: pkg.browser,
18 | format: 'umd'
19 | },
20 | plugins: [
21 | resolve(), // so Rollup can find `ms`
22 | commonjs(), // so Rollup can convert `ms` to an ES module
23 | eslint(),
24 | babel({
25 | plugins: [...removeConsole]
26 | }), // to ES5
27 | uglify() // minify
28 | ]
29 | },
30 |
31 | // CommonJS (for Node) and ES module (for bundlers) build.
32 | {
33 | input: 'libs/index.js',
34 | external: ['ms'],
35 | output: [
36 | { file: pkg.main, format: 'cjs' },
37 | { file: pkg.module, format: 'es' }
38 | ]
39 | }
40 | ];
41 |
--------------------------------------------------------------------------------
/src/components/Logo.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | vue
5 | Fb
6 |
7 |
8 | Customer
9 | Chat
10 |
11 |
12 |
13 |
14 |
18 |
19 |
60 |
--------------------------------------------------------------------------------
/libs/index.js:
--------------------------------------------------------------------------------
1 | import log from './helpers-log'
2 | import { getFbSdk, mountFbCustomerChat } from './helpers'
3 |
4 | const VueFbCustomerChat = {
5 | install: (Vue, options) => {
6 | Vue.fbCustomerChat = {
7 | setOptions(otherOptions) {
8 | options = { ...options, ...otherOptions }
9 | }
10 | }
11 |
12 | Object.defineProperties(Vue.prototype, {
13 | $fbCustomerChat: {
14 | get: () => {
15 | return Vue.fbCustomerChat
16 | }
17 | }
18 | })
19 |
20 | Vue.mixin({
21 | mounted() {
22 | if (!this.$parent) {
23 | getFbSdk(options).then(() => {
24 | if (options.page_id) {
25 | mountFbCustomerChat(options)
26 | } else {
27 | console.error(
28 | '%cVueFbCustomerChat:: You have to specify `page_id`',
29 | log.error
30 | )
31 | }
32 | })
33 | }
34 | }
35 | })
36 | }
37 | }
38 |
39 | // register plugin if it is used via cdn or directly as a script tag
40 | if (typeof window !== 'undefined' && window.Vue) {
41 | window.VueFbCustomerChat = VueFbCustomerChat
42 | }
43 |
44 | export default VueFbCustomerChat
45 |
--------------------------------------------------------------------------------
/docs/css/app.44e36df0.css:
--------------------------------------------------------------------------------
1 | .logo[data-v-61af14ba]{width:100%;height:100%;padding:0 0 .5em 0;font-size:20vw}.logo .brand[data-v-61af14ba]{display:flex;justify-content:center;align-items:center;font-size:1em}.logo .brand .vue[data-v-61af14ba]{color:#41b883;font-weight:400}.logo .brand .fb[data-v-61af14ba]{color:#35495e;font-weight:800;font-size:.5em;margin-top:-.15em}.logo .package[data-v-61af14ba]{display:flex;justify-content:center;font-weight:400;font-size:.35em;line-height:1;opacity:.75}@media screen and (min-width:600px){.logo[data-v-61af14ba]{font-size:8rem}}*,:after,:before{box-sizing:border-box;margin:0;padding:0}html{width:100vw;height:100vh;overflow:hidden;font-family:Dosis,Helvetica,Arial,sans-serif;font-size:13px;text-align:center;color:#2c3e50}@media (min-width:600px){html{font-size:15px}}@media (min-width:1200px){html{font-size:16px}}#app{display:flex;justify-content:center;align-items:center;width:100vw;height:100vh}h1{font-weight:600}h3{font-weight:300;font-size:1.3rem}p{margin-top:2em}.github{position:fixed;top:18pt;right:18pt;width:45pt;height:45pt;display:flex;justify-content:center;align-items:center}.github:before{content:"";border-radius:50%;box-shadow:0 8px 16px rgba(0,0,0,.1);width:100%;height:100%;position:absolute;opacity:0;transition:opacity .3s}.github:hover:before{opacity:1}.github img{display:block;width:100%;opacity:.25;border-radius:50%;overflow:hidden}
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-fb-customer-chat",
3 | "description": "Facebook Customer Chat Plugin for Vue.js",
4 | "version": "0.2.2",
5 | "author": {
6 | "name": "Damian Przepiórka",
7 | "email": "damian.przepiorka@gmail.com",
8 | "url": "https://dmn.codes/"
9 | },
10 | "license": "MIT",
11 | "repository": {
12 | "type": "git",
13 | "url": "git+https://github.com/dmnCodes/vue-fb-customer-chat.git"
14 | },
15 | "main": "dist/vue-fb-customer-chat.cjs.js",
16 | "module": "dist/vue-fb-customer-chat.esm.js",
17 | "browser": "dist/vue-fb-customer-chat.umd.js",
18 | "scripts": {
19 | "dev": "NODE_ENV=development rollup -c -w & vue-cli-service serve",
20 | "build": "NODE_ENV=production rollup -c",
21 | "build:docs": "NODE_ENV=production vue-cli-service build"
22 | },
23 | "dependencies": {},
24 | "devDependencies": {
25 | "@babel/cli": "^7.4.3",
26 | "@babel/core": "^7.4.3",
27 | "@babel/preset-env": "^7.4.3",
28 | "@vue/cli-service": "^4.5.15",
29 | "babel-plugin-transform-remove-console": "^6.9.4",
30 | "eslint": "^5.16.0",
31 | "eslint-plugin-vue-libs": "^3.0.0",
32 | "ms": "^2.1.2",
33 | "rollup": "^1.10.0",
34 | "rollup-plugin-babel": "^4.3.2",
35 | "rollup-plugin-commonjs": "^9.3.4",
36 | "rollup-plugin-eslint": "^5.1.0",
37 | "rollup-plugin-node-resolve": "^4.2.3",
38 | "rollup-plugin-uglify": "^6.0.2",
39 | "sass": "^1.49.7",
40 | "sass-loader": "^10.2.1",
41 | "vue": "^2.6.10",
42 | "vue-analytics": "^5.17.2",
43 | "vue-template-compiler": "^2.6.10"
44 | },
45 | "files": [
46 | "dist"
47 | ],
48 | "keywords": [
49 | "vue",
50 | "vuejs",
51 | "fb",
52 | "facebook",
53 | "customer",
54 | "chat",
55 | "customerchat",
56 | "messenger"
57 | ]
58 | }
59 |
--------------------------------------------------------------------------------
/dist/vue-fb-customer-chat.umd.js:
--------------------------------------------------------------------------------
1 | !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).VueFbCustomerChat=t()}(this,function(){"use strict";function n(i){for(var e=1;e {
7 | ;(function(d, s, id) {
8 | const fjs = d.getElementsByTagName(s)[0]
9 | if (d.getElementById(id)) {
10 | return
11 | }
12 | const js = d.createElement(s)
13 | js.id = id
14 | js.src = 'https://connect.facebook.net/' + locale + '/sdk/xfbml.customerchat.js'
15 | fjs.parentNode.insertBefore(js, fjs)
16 | js.onload = function() {
17 | console.log('%cVueFbCustomerChat:: loaded', log.info)
18 | resolve()
19 | }
20 | js.onerror = function() {
21 | reject()
22 | console.error('%cVueFbCustomerChat:: NOT loaded', log.error)
23 | }
24 | })(document, 'script', 'facebook-jssdk')
25 | })
26 | }
27 |
28 | export function initFbSdk(options) {
29 | return new Promise(resolve => {
30 | window.fbAsyncInit = function() {
31 | const defaults = { cookie: true, xfbml: true, version: 'v5.0' }
32 | options = { ...defaults, ...options }
33 | window.FB.init(options)
34 | resolve()
35 | }
36 | })
37 | }
38 |
39 | export function getFbSdk(options) {
40 | return new Promise(resolve => {
41 | if (window.FB) {
42 | resolve(window.FB)
43 | } else {
44 | fetchFbSdk(options).then(() => {
45 | initFbSdk(options).then(() => {
46 | resolve(window.FB)
47 | })
48 | })
49 | }
50 | })
51 | }
52 |
53 | export function mountFbCustomerChat(options) {
54 | const elem = document.createElement('div')
55 | elem.setAttribute('class', 'fb-customerchat')
56 | elem.setAttribute('attribution', 'setup_tool')
57 |
58 | // set attributes
59 | Object.entries(options).forEach(attr => {
60 | elem.setAttribute(attr[0], attr[1])
61 | })
62 | document.body.appendChild(elem)
63 | }
64 |
65 | // TODO:
66 | // // events to emit
67 | // FB.Event.subscribe('customerchat.load', () => console.log('customerchat.load'));
68 | // FB.Event.subscribe('customerchat.show', () => console.log('customerchat.show'));
69 | // FB.Event.subscribe('customerchat.hide', () => console.log('customerchat.hide'));
70 | // FB.Event.subscribe('customerchat.dialogShow', () => console.log('customerchat.dialogShow'));
71 | // FB.Event.subscribe('customerchat.dialogHide', () => console.log('customerchat.dialogHide'));
72 | // // triggers
73 | // FB.CustomerChat.show(shouldShowDialog: boolean);
74 | // FB.CustomerChat.hide();
75 | // FB.CustomerChat.hideDialog();
76 | // FB.CustomerChat.showDialog();
77 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # !!! Important !!!
2 | > On May 9, 2024, you will no longer be able to access any of the functionality of the Chat Plugin. Effective immediately, Chat Plugin in guest mode is no longer available. Other features like m.me links will still be available for you to use.
3 | https://developers.facebook.com/docs/messenger-platform/discovery/facebook-chat-plugin/
4 | # !!! Important !!!
5 |
6 |
7 | Vue Fb Customer Chat
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | > Facebook Customer Chat Plugin for Vue.js
28 |
29 |
30 |
31 | ## Demo
32 | [https://dmnCodes.github.io/vue-fb-customer-chat/](https://dmnCodes.github.io/vue-fb-customer-chat/)
33 |
34 |
35 |
36 | ## Installation
37 | Install using npm
38 | ```sh
39 | $ npm install vue-fb-customer-chat
40 | ```
41 |
42 | Install using yarn
43 | ```sh
44 | $ yarn add vue-fb-customer-chat
45 | ```
46 |
47 |
48 |
49 | ## Usage
50 | #### Setting up the Messenger
51 | For the messenger to work, you need to enable it on Facebook first:
52 |
53 | 1. Go to your Page on Facebook
54 | 2. Go to `About` and copy the Page ID (https://www.facebook.com/help/1503421039731588)
55 | 2. Go to `Settings` > `Messaging`
56 | 3. Complete the setup in the `Add Messenger to your website`, do not forget to add both production and local URLs
57 |
58 | #### For Vue.js projects.
59 |
60 |
61 | ```js
62 | import Vue from 'vue'
63 | import VueFbCustomerChat from 'vue-fb-customer-chat'
64 |
65 | Vue.use(VueFbCustomerChat, {
66 | page_id: null, // change 'null' to your Facebook Page ID,
67 | theme_color: '#333333', // theme color in HEX
68 | locale: 'en_US', // default 'en_US'
69 | })
70 | ```
71 |
72 |
73 |
74 | #### For Nuxt.js projects.
75 | Create 'plugins/vue-fb-customer-chat.js'
76 |
77 | ```js
78 | import Vue from 'vue'
79 | import VueFbCustomerChat from 'vue-fb-customer-chat'
80 |
81 | Vue.use(VueFbCustomerChat, {
82 | page_id: null, // change 'null' to your Facebook Page ID,
83 | theme_color: '#333333', // theme color in HEX
84 | locale: 'en_US', // default 'en_US'
85 | })
86 | ```
87 |
88 | Add plugin in nuxt.config.js file for plugins section
89 | ```js
90 | plugins: [
91 | { src: '~/plugins/vue-fb-customer-chat.js', ssr: false }
92 | ],
93 | ```
94 |
--------------------------------------------------------------------------------
/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
31 |
32 |
33 |
72 |
73 |
153 |
--------------------------------------------------------------------------------
/dist/vue-fb-customer-chat.esm.js:
--------------------------------------------------------------------------------
1 | const log = {
2 | success: 'padding:0.6em 0; color:#27b376;',
3 | info: 'padding:0.6em 0; color:#3B5998;',
4 | error: 'padding:0.6em 0; color:#bf212f;'
5 | };
6 |
7 | const defaultLocale = 'en_us';
8 |
9 | function fetchFbSdk(options) {
10 | const locale = options.locale ? options.locale : defaultLocale;
11 | return new Promise((resolve, reject) => {
12 | (function(d, s, id) {
13 | const fjs = d.getElementsByTagName(s)[0];
14 | if (d.getElementById(id)) {
15 | return
16 | }
17 | const js = d.createElement(s);
18 | js.id = id;
19 | js.src = 'https://connect.facebook.net/' + locale + '/sdk/xfbml.customerchat.js';
20 | fjs.parentNode.insertBefore(js, fjs);
21 | js.onload = function() {
22 | console.log('%cVueFbCustomerChat:: loaded', log.info);
23 | resolve();
24 | };
25 | js.onerror = function() {
26 | reject();
27 | console.error('%cVueFbCustomerChat:: NOT loaded', log.error);
28 | };
29 | })(document, 'script', 'facebook-jssdk');
30 | })
31 | }
32 |
33 | function initFbSdk(options) {
34 | return new Promise(resolve => {
35 | window.fbAsyncInit = function() {
36 | const defaults = { cookie: true, xfbml: true, version: 'v5.0' };
37 | options = { ...defaults, ...options };
38 | window.FB.init(options);
39 | resolve();
40 | };
41 | })
42 | }
43 |
44 | function getFbSdk(options) {
45 | return new Promise(resolve => {
46 | if (window.FB) {
47 | resolve(window.FB);
48 | } else {
49 | fetchFbSdk(options).then(() => {
50 | initFbSdk(options).then(() => {
51 | resolve(window.FB);
52 | });
53 | });
54 | }
55 | })
56 | }
57 |
58 | function mountFbCustomerChat(options) {
59 | const elem = document.createElement('div');
60 | elem.setAttribute('class', 'fb-customerchat');
61 | elem.setAttribute('attribution', 'setup_tool');
62 |
63 | // set attributes
64 | Object.entries(options).forEach(attr => {
65 | elem.setAttribute(attr[0], attr[1]);
66 | });
67 | document.body.appendChild(elem);
68 | }
69 |
70 | // TODO:
71 | // // events to emit
72 | // FB.Event.subscribe('customerchat.load', () => console.log('customerchat.load'));
73 | // FB.Event.subscribe('customerchat.show', () => console.log('customerchat.show'));
74 | // FB.Event.subscribe('customerchat.hide', () => console.log('customerchat.hide'));
75 | // FB.Event.subscribe('customerchat.dialogShow', () => console.log('customerchat.dialogShow'));
76 | // FB.Event.subscribe('customerchat.dialogHide', () => console.log('customerchat.dialogHide'));
77 | // // triggers
78 | // FB.CustomerChat.show(shouldShowDialog: boolean);
79 | // FB.CustomerChat.hide();
80 | // FB.CustomerChat.hideDialog();
81 | // FB.CustomerChat.showDialog();
82 |
83 | const VueFbCustomerChat = {
84 | install: (Vue, options) => {
85 | Vue.fbCustomerChat = {
86 | setOptions(otherOptions) {
87 | options = { ...options, ...otherOptions };
88 | }
89 | };
90 |
91 | Object.defineProperties(Vue.prototype, {
92 | $fbCustomerChat: {
93 | get: () => {
94 | return Vue.fbCustomerChat
95 | }
96 | }
97 | });
98 |
99 | Vue.mixin({
100 | mounted() {
101 | if (!this.$parent) {
102 | getFbSdk(options).then(() => {
103 | if (options.page_id) {
104 | mountFbCustomerChat(options);
105 | } else {
106 | console.error(
107 | '%cVueFbCustomerChat:: You have to specify `page_id`',
108 | log.error
109 | );
110 | }
111 | });
112 | }
113 | }
114 | });
115 | }
116 | };
117 |
118 | // register plugin if it is used via cdn or directly as a script tag
119 | if (typeof window !== 'undefined' && window.Vue) {
120 | window.VueFbCustomerChat = VueFbCustomerChat;
121 | }
122 |
123 | export default VueFbCustomerChat;
124 |
--------------------------------------------------------------------------------
/dist/vue-fb-customer-chat.cjs.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const log = {
4 | success: 'padding:0.6em 0; color:#27b376;',
5 | info: 'padding:0.6em 0; color:#3B5998;',
6 | error: 'padding:0.6em 0; color:#bf212f;'
7 | };
8 |
9 | const defaultLocale = 'en_us';
10 |
11 | function fetchFbSdk(options) {
12 | const locale = options.locale ? options.locale : defaultLocale;
13 | return new Promise((resolve, reject) => {
14 | (function(d, s, id) {
15 | const fjs = d.getElementsByTagName(s)[0];
16 | if (d.getElementById(id)) {
17 | return
18 | }
19 | const js = d.createElement(s);
20 | js.id = id;
21 | js.src = 'https://connect.facebook.net/' + locale + '/sdk/xfbml.customerchat.js';
22 | fjs.parentNode.insertBefore(js, fjs);
23 | js.onload = function() {
24 | console.log('%cVueFbCustomerChat:: loaded', log.info);
25 | resolve();
26 | };
27 | js.onerror = function() {
28 | reject();
29 | console.error('%cVueFbCustomerChat:: NOT loaded', log.error);
30 | };
31 | })(document, 'script', 'facebook-jssdk');
32 | })
33 | }
34 |
35 | function initFbSdk(options) {
36 | return new Promise(resolve => {
37 | window.fbAsyncInit = function() {
38 | const defaults = { cookie: true, xfbml: true, version: 'v5.0' };
39 | options = { ...defaults, ...options };
40 | window.FB.init(options);
41 | resolve();
42 | };
43 | })
44 | }
45 |
46 | function getFbSdk(options) {
47 | return new Promise(resolve => {
48 | if (window.FB) {
49 | resolve(window.FB);
50 | } else {
51 | fetchFbSdk(options).then(() => {
52 | initFbSdk(options).then(() => {
53 | resolve(window.FB);
54 | });
55 | });
56 | }
57 | })
58 | }
59 |
60 | function mountFbCustomerChat(options) {
61 | const elem = document.createElement('div');
62 | elem.setAttribute('class', 'fb-customerchat');
63 | elem.setAttribute('attribution', 'setup_tool');
64 |
65 | // set attributes
66 | Object.entries(options).forEach(attr => {
67 | elem.setAttribute(attr[0], attr[1]);
68 | });
69 | document.body.appendChild(elem);
70 | }
71 |
72 | // TODO:
73 | // // events to emit
74 | // FB.Event.subscribe('customerchat.load', () => console.log('customerchat.load'));
75 | // FB.Event.subscribe('customerchat.show', () => console.log('customerchat.show'));
76 | // FB.Event.subscribe('customerchat.hide', () => console.log('customerchat.hide'));
77 | // FB.Event.subscribe('customerchat.dialogShow', () => console.log('customerchat.dialogShow'));
78 | // FB.Event.subscribe('customerchat.dialogHide', () => console.log('customerchat.dialogHide'));
79 | // // triggers
80 | // FB.CustomerChat.show(shouldShowDialog: boolean);
81 | // FB.CustomerChat.hide();
82 | // FB.CustomerChat.hideDialog();
83 | // FB.CustomerChat.showDialog();
84 |
85 | const VueFbCustomerChat = {
86 | install: (Vue, options) => {
87 | Vue.fbCustomerChat = {
88 | setOptions(otherOptions) {
89 | options = { ...options, ...otherOptions };
90 | }
91 | };
92 |
93 | Object.defineProperties(Vue.prototype, {
94 | $fbCustomerChat: {
95 | get: () => {
96 | return Vue.fbCustomerChat
97 | }
98 | }
99 | });
100 |
101 | Vue.mixin({
102 | mounted() {
103 | if (!this.$parent) {
104 | getFbSdk(options).then(() => {
105 | if (options.page_id) {
106 | mountFbCustomerChat(options);
107 | } else {
108 | console.error(
109 | '%cVueFbCustomerChat:: You have to specify `page_id`',
110 | log.error
111 | );
112 | }
113 | });
114 | }
115 | }
116 | });
117 | }
118 | };
119 |
120 | // register plugin if it is used via cdn or directly as a script tag
121 | if (typeof window !== 'undefined' && window.Vue) {
122 | window.VueFbCustomerChat = VueFbCustomerChat;
123 | }
124 |
125 | module.exports = VueFbCustomerChat;
126 |
--------------------------------------------------------------------------------
/docs/js/app.7bf0c650.js:
--------------------------------------------------------------------------------
1 | (function(e){function t(t){for(var i,c,s=t[0],u=t[1],a=t[2],p=0,b=[];p0}function l(){var e=N.checkDuplicatedScript,t=N.disableScriptLoader;return[Boolean(window&&window.ga),e&&!u(),!t].some(Boolean)}function f(e){return e.name||e.replace(/-/gi,"")}function d(){return new Promise(function(e,t){var n=setInterval(function(){"undefined"!=typeof window&&window.ga&&(e(),clearInterval(n))},10)})}function p(e,t){return o().length>1?f(t)+"."+e:e}function v(e){var t=Object.keys(e).reduce(function(t,n,r,o){var i=r===o.length-1,a=e[n];return null==a?t:t+=n+"="+a+(i?"":"&")},"");return""!==t?"?"+t:""}function h(e){return[e.name,e.path].filter(Boolean).find(function(e){return-1!==N.ignoreRoutes.indexOf(e)})}function m(e){return e.query&&e.params}function y(e){return e.currentRoute}function g(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t1?t-1:0),r=1;r1?U({},N.fields,r,{name:n}):N.fields;window.ga("create",t.id||t,"auto",o)}),N.beforeFirstHit();var t=N.ecommerce;if(t.enabled){var n=t.enhanced?"ec":"ecommerce";t.options?_("require",n,t.options):_("require",n)}N.linkers.length>0&&(_("require","linker"),_("linker:autoLink",N.linkers)),N.debug.sendHitTask||b("sendHitTask",null)}}function A(){for(var e=arguments.length,t=Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:{};r(ae({},t,{$vue:e})),e.directive("ga",re),e.prototype.$ga=e.$ga=ne,J(e),K()}Object.defineProperty(t,"__esModule",{value:!0});var P=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0])||arguments[0];"undefined"!=typeof window&&o().forEach(function(t){window["ga-disable-"+t]=e})},K=function(){if("undefined"!=typeof document&&"undefined"!=typeof window){var e=N.ready,t=N.debug.enabled?"analytics_debug":"analytics",n=N.customResourceURL||"https://www.google-analytics.com/"+t+".js";if(!N.id)throw new Error('[vue-analytics] Missing the "id" parameter. Add at least one tracking domain ID');var o=[M(N.id),M(N.disabled)];return l()&&o.push(a(n).catch(function(){throw new Error("[vue-analytics] An error occured! Please check your connection, if you have any Google Analytics blocker installed in your browser or check your custom resource URL if you have added any.")})),Promise.all(o).then(function(t){r({id:t[0],disabled:t[1]}),W(N.disabled),w(),V(),z(),x(),e()}).catch(function(e){N.debug.enabled&&console.error(e.message)})}},X=this,G=function(e){_("send","exception",{exDescription:e,exFatal:arguments.length>1&&void 0!==arguments[1]&&arguments[1]})},J=function(e){if(N.autoTracking.exception){window.addEventListener("error",function(e){G(e.message)});var t=e.config.errorHandler;e.config.errorHandler=function(e,n,r){G(e.message),N.autoTracking.exceptionLogs&&(console.error("[vue-analytics] Error in "+r+": "+e.message),console.error(e)),"function"==typeof t&&t.call(X,e,n,r)}}},Q=G,Z=Object.assign||function(e){for(var t=1;t=0&&Math.floor(t)===t&&isFinite(e)}function p(e){return o(e)&&"function"===typeof e.then&&"function"===typeof e.catch}function v(e){return null==e?"":Array.isArray(e)||l(e)&&e.toString===u?JSON.stringify(e,null,2):String(e)}function h(e){var t=parseFloat(e);return isNaN(t)?e:t}function m(e,t){for(var n=Object.create(null),r=e.split(","),o=0;o-1)return e.splice(n,1)}}var _=Object.prototype.hasOwnProperty;function b(e,t){return _.call(e,t)}function w(e){var t=Object.create(null);return function(n){var r=t[n];return r||(t[n]=e(n))}}var A=/-(\w)/g,C=w(function(e){return e.replace(A,function(e,t){return t?t.toUpperCase():""})}),$=w(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}),x=/\B([A-Z])/g,k=w(function(e){return e.replace(x,"-$1").toLowerCase()});function O(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n}function S(e,t){return e.bind(t)}var E=Function.prototype.bind?S:O;function j(e,t){t=t||0;var n=e.length-t,r=new Array(n);while(n--)r[n]=e[n+t];return r}function T(e,t){for(var n in t)e[n]=t[n];return e}function I(e){for(var t={},n=0;n0,ne=Y&&Y.indexOf("edge/")>0,re=(Y&&Y.indexOf("android"),Y&&/iphone|ipad|ipod|ios/.test(Y)||"ios"===Z),oe=(Y&&/chrome\/\d+/.test(Y),Y&&/phantomjs/.test(Y),Y&&Y.match(/firefox\/(\d+)/)),ie={}.watch,ae=!1;if(J)try{var se={};Object.defineProperty(se,"passive",{get:function(){ae=!0}}),window.addEventListener("test-passive",null,se)}catch(Ca){}var ce=function(){return void 0===X&&(X=!J&&!Q&&"undefined"!==typeof e&&(e["process"]&&"server"===e["process"].env.VUE_ENV)),X},ue=J&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function le(e){return"function"===typeof e&&/native code/.test(e.toString())}var fe,de="undefined"!==typeof Symbol&&le(Symbol)&&"undefined"!==typeof Reflect&&le(Reflect.ownKeys);fe="undefined"!==typeof Set&&le(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var pe=P,ve=0,he=function(){this.id=ve++,this.subs=[]};he.prototype.addSub=function(e){this.subs.push(e)},he.prototype.removeSub=function(e){g(this.subs,e)},he.prototype.depend=function(){he.target&&he.target.addDep(this)},he.prototype.notify=function(){var e=this.subs.slice();for(var t=0,n=e.length;t-1)if(i&&!b(o,"default"))a=!1;else if(""===a||a===k(e)){var c=et(String,o.type);(c<0||s0&&(a=Ot(a,(t||"")+"_"+n),kt(a[0])&&kt(u)&&(l[c]=Ae(u.text+a[0].text),a.shift()),l.push.apply(l,a)):s(a)?kt(u)?l[c]=Ae(u.text+a):""!==a&&l.push(Ae(a)):kt(a)&&kt(u)?l[c]=Ae(u.text+a.text):(i(e._isVList)&&o(a.tag)&&r(a.key)&&o(t)&&(a.key="__vlist"+t+"_"+n+"__"),l.push(a)));return l}function St(e){var t=e.$options.provide;t&&(e._provided="function"===typeof t?t.call(e):t)}function Et(e){var t=jt(e.$options.inject,e);t&&(Ee(!1),Object.keys(t).forEach(function(n){De(e,n,t[n])}),Ee(!0))}function jt(e,t){if(e){for(var n=Object.create(null),r=de?Reflect.ownKeys(e):Object.keys(e),o=0;o0,a=e?!!e.$stable:!i,s=e&&e.$key;if(e){if(e._normalized)return e._normalized;if(a&&r&&r!==n&&s===r.$key&&!i&&!r.$hasNormal)return r;for(var c in o={},e)e[c]&&"$"!==c[0]&&(o[c]=Dt(t,c,e[c]))}else o={};for(var u in t)u in o||(o[u]=Lt(t,u));return e&&Object.isExtensible(e)&&(e._normalized=o),z(o,"$stable",a),z(o,"$key",s),z(o,"$hasNormal",i),o}function Dt(e,t,n){var r=function(){var e=arguments.length?n.apply(null,arguments):n({});return e=e&&"object"===typeof e&&!Array.isArray(e)?[e]:xt(e),e&&(0===e.length||1===e.length&&e[0].isComment)?void 0:e};return n.proxy&&Object.defineProperty(e,t,{get:r,enumerable:!0,configurable:!0}),r}function Lt(e,t){return function(){return e[t]}}function Nt(e,t){var n,r,i,a,s;if(Array.isArray(e)||"string"===typeof e)for(n=new Array(e.length),r=0,i=e.length;r1?j(n):n;for(var r=j(arguments,1),o='event handler for "'+e+'"',i=0,a=n.length;idocument.createEvent("Event").timeStamp&&(Xn=function(){return Gn.now()})}function Jn(){var e,t;for(Kn=Xn(),Vn=!0,Un.sort(function(e,t){return e.id-t.id}),zn=0;znzn&&Un[n].id>e.id)n--;Un.splice(n+1,0,e)}else Un.push(e);qn||(qn=!0,vt(Jn))}}var tr=0,nr=function(e,t,n,r,o){this.vm=e,o&&(e._watcher=this),e._watchers.push(this),r?(this.deep=!!r.deep,this.user=!!r.user,this.lazy=!!r.lazy,this.sync=!!r.sync,this.before=r.before):this.deep=this.user=this.lazy=this.sync=!1,this.cb=n,this.id=++tr,this.active=!0,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new fe,this.newDepIds=new fe,this.expression="","function"===typeof t?this.getter=t:(this.getter=K(t),this.getter||(this.getter=P)),this.value=this.lazy?void 0:this.get()};nr.prototype.get=function(){var e;ye(this);var t=this.vm;try{e=this.getter.call(t,t)}catch(Ca){if(!this.user)throw Ca;tt(Ca,t,'getter for watcher "'+this.expression+'"')}finally{this.deep&&mt(e),ge(),this.cleanupDeps()}return e},nr.prototype.addDep=function(e){var t=e.id;this.newDepIds.has(t)||(this.newDepIds.add(t),this.newDeps.push(e),this.depIds.has(t)||e.addSub(this))},nr.prototype.cleanupDeps=function(){var e=this.deps.length;while(e--){var t=this.deps[e];this.newDepIds.has(t.id)||t.removeSub(this)}var n=this.depIds;this.depIds=this.newDepIds,this.newDepIds=n,this.newDepIds.clear(),n=this.deps,this.deps=this.newDeps,this.newDeps=n,this.newDeps.length=0},nr.prototype.update=function(){this.lazy?this.dirty=!0:this.sync?this.run():er(this)},nr.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||c(e)||this.deep){var t=this.value;if(this.value=e,this.user)try{this.cb.call(this.vm,e,t)}catch(Ca){tt(Ca,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,e,t)}}},nr.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},nr.prototype.depend=function(){var e=this.deps.length;while(e--)this.deps[e].depend()},nr.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||g(this.vm._watchers,this);var e=this.deps.length;while(e--)this.deps[e].removeSub(this);this.active=!1}};var rr={enumerable:!0,configurable:!0,get:P,set:P};function or(e,t,n){rr.get=function(){return this[t][n]},rr.set=function(e){this[t][n]=e},Object.defineProperty(e,n,rr)}function ir(e){e._watchers=[];var t=e.$options;t.props&&ar(e,t.props),t.methods&&vr(e,t.methods),t.data?sr(e):Pe(e._data={},!0),t.computed&&lr(e,t.computed),t.watch&&t.watch!==ie&&hr(e,t.watch)}function ar(e,t){var n=e.$options.propsData||{},r=e._props={},o=e.$options._propKeys=[],i=!e.$parent;i||Ee(!1);var a=function(i){o.push(i);var a=Je(i,t,n,e);De(r,i,a),i in e||or(e,"_props",i)};for(var s in t)a(s);Ee(!0)}function sr(e){var t=e.$options.data;t=e._data="function"===typeof t?cr(t,e):t||{},l(t)||(t={});var n=Object.keys(t),r=e.$options.props,o=(e.$options.methods,n.length);while(o--){var i=n[o];0,r&&b(r,i)||V(i)||or(e,"_data",i)}Pe(t,!0)}function cr(e,t){ye();try{return e.call(t,t)}catch(Ca){return tt(Ca,t,"data()"),{}}finally{ge()}}var ur={lazy:!0};function lr(e,t){var n=e._computedWatchers=Object.create(null),r=ce();for(var o in t){var i=t[o],a="function"===typeof i?i:i.get;0,r||(n[o]=new nr(e,a||P,P,ur)),o in e||fr(e,o,i)}}function fr(e,t,n){var r=!ce();"function"===typeof n?(rr.get=r?dr(t):pr(n),rr.set=P):(rr.get=n.get?r&&!1!==n.cache?dr(t):pr(n.get):P,rr.set=n.set||P),Object.defineProperty(e,t,rr)}function dr(e){return function(){var t=this._computedWatchers&&this._computedWatchers[e];if(t)return t.dirty&&t.evaluate(),he.target&&t.depend(),t.value}}function pr(e){return function(){return e.call(this,this)}}function vr(e,t){e.$options.props;for(var n in t)e[n]="function"!==typeof t[n]?P:E(t[n],e)}function hr(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var o=0;o-1)return this;var n=j(arguments,1);return n.unshift(this),"function"===typeof e.install?e.install.apply(e,n):"function"===typeof e&&e.apply(null,n),t.push(e),this}}function xr(e){e.mixin=function(e){return this.options=Xe(this.options,e),this}}function kr(e){e.cid=0;var t=1;e.extend=function(e){e=e||{};var n=this,r=n.cid,o=e._Ctor||(e._Ctor={});if(o[r])return o[r];var i=e.name||n.options.name;var a=function(e){this._init(e)};return a.prototype=Object.create(n.prototype),a.prototype.constructor=a,a.cid=t++,a.options=Xe(n.options,e),a["super"]=n,a.options.props&&Or(a),a.options.computed&&Sr(a),a.extend=n.extend,a.mixin=n.mixin,a.use=n.use,U.forEach(function(e){a[e]=n[e]}),i&&(a.options.components[i]=a),a.superOptions=n.options,a.extendOptions=e,a.sealedOptions=T({},a.options),o[r]=a,a}}function Or(e){var t=e.options.props;for(var n in t)or(e.prototype,"_props",n)}function Sr(e){var t=e.options.computed;for(var n in t)fr(e.prototype,n,t[n])}function Er(e){U.forEach(function(t){e[t]=function(e,n){return n?("component"===t&&l(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"===typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}})}function jr(e){return e&&(e.Ctor.options.name||e.tag)}function Tr(e,t){return Array.isArray(e)?e.indexOf(t)>-1:"string"===typeof e?e.split(",").indexOf(t)>-1:!!f(e)&&e.test(t)}function Ir(e,t){var n=e.cache,r=e.keys,o=e._vnode;for(var i in n){var a=n[i];if(a){var s=jr(a.componentOptions);s&&!t(s)&&Pr(n,i,r,o)}}}function Pr(e,t,n,r){var o=e[t];!o||r&&o.tag===r.tag||o.componentInstance.$destroy(),e[t]=null,g(n,t)}_r(Cr),yr(Cr),En(Cr),Pn(Cr),gn(Cr);var Dr=[String,RegExp,Array],Lr={name:"keep-alive",abstract:!0,props:{include:Dr,exclude:Dr,max:[String,Number]},created:function(){this.cache=Object.create(null),this.keys=[]},destroyed:function(){for(var e in this.cache)Pr(this.cache,e,this.keys)},mounted:function(){var e=this;this.$watch("include",function(t){Ir(e,function(e){return Tr(t,e)})}),this.$watch("exclude",function(t){Ir(e,function(e){return!Tr(t,e)})})},render:function(){var e=this.$slots.default,t=Cn(e),n=t&&t.componentOptions;if(n){var r=jr(n),o=this,i=o.include,a=o.exclude;if(i&&(!r||!Tr(i,r))||a&&r&&Tr(a,r))return t;var s=this,c=s.cache,u=s.keys,l=null==t.key?n.Ctor.cid+(n.tag?"::"+n.tag:""):t.key;c[l]?(t.componentInstance=c[l].componentInstance,g(u,l),u.push(l)):(c[l]=t,u.push(l),this.max&&u.length>parseInt(this.max)&&Pr(c,u[0],u,this._vnode)),t.data.keepAlive=!0}return t||e&&e[0]}},Nr={KeepAlive:Lr};function Mr(e){var t={get:function(){return B}};Object.defineProperty(e,"config",t),e.util={warn:pe,extend:T,mergeOptions:Xe,defineReactive:De},e.set=Le,e.delete=Ne,e.nextTick=vt,e.observable=function(e){return Pe(e),e},e.options=Object.create(null),U.forEach(function(t){e.options[t+"s"]=Object.create(null)}),e.options._base=e,T(e.options.components,Nr),$r(e),xr(e),kr(e),Er(e)}Mr(Cr),Object.defineProperty(Cr.prototype,"$isServer",{get:ce}),Object.defineProperty(Cr.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(Cr,"FunctionalRenderContext",{value:Qt}),Cr.version="2.6.10";var Fr=m("style,class"),Rr=m("input,textarea,option,select,progress"),Ur=function(e,t,n){return"value"===n&&Rr(e)&&"button"!==t||"selected"===n&&"option"===e||"checked"===n&&"input"===e||"muted"===n&&"video"===e},Hr=m("contenteditable,draggable,spellcheck"),Br=m("events,caret,typing,plaintext-only"),qr=function(e,t){return Xr(t)||"false"===t?"false":"contenteditable"===e&&Br(t)?t:"true"},Vr=m("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),zr="http://www.w3.org/1999/xlink",Wr=function(e){return":"===e.charAt(5)&&"xlink"===e.slice(0,5)},Kr=function(e){return Wr(e)?e.slice(6,e.length):""},Xr=function(e){return null==e||!1===e};function Gr(e){var t=e.data,n=e,r=e;while(o(r.componentInstance))r=r.componentInstance._vnode,r&&r.data&&(t=Jr(r.data,t));while(o(n=n.parent))n&&n.data&&(t=Jr(t,n.data));return Qr(t.staticClass,t.class)}function Jr(e,t){return{staticClass:Zr(e.staticClass,t.staticClass),class:o(e.class)?[e.class,t.class]:t.class}}function Qr(e,t){return o(e)||o(t)?Zr(e,Yr(t)):""}function Zr(e,t){return e?t?e+" "+t:e:t||""}function Yr(e){return Array.isArray(e)?eo(e):c(e)?to(e):"string"===typeof e?e:""}function eo(e){for(var t,n="",r=0,i=e.length;r-1?so[e]=t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:so[e]=/HTMLUnknownElement/.test(t.toString())}var uo=m("text,number,password,search,email,tel,url");function lo(e){if("string"===typeof e){var t=document.querySelector(e);return t||document.createElement("div")}return e}function fo(e,t){var n=document.createElement(e);return"select"!==e?n:(t.data&&t.data.attrs&&void 0!==t.data.attrs.multiple&&n.setAttribute("multiple","multiple"),n)}function po(e,t){return document.createElementNS(no[e],t)}function vo(e){return document.createTextNode(e)}function ho(e){return document.createComment(e)}function mo(e,t,n){e.insertBefore(t,n)}function yo(e,t){e.removeChild(t)}function go(e,t){e.appendChild(t)}function _o(e){return e.parentNode}function bo(e){return e.nextSibling}function wo(e){return e.tagName}function Ao(e,t){e.textContent=t}function Co(e,t){e.setAttribute(t,"")}var $o=Object.freeze({createElement:fo,createElementNS:po,createTextNode:vo,createComment:ho,insertBefore:mo,removeChild:yo,appendChild:go,parentNode:_o,nextSibling:bo,tagName:wo,setTextContent:Ao,setStyleScope:Co}),xo={create:function(e,t){ko(t)},update:function(e,t){e.data.ref!==t.data.ref&&(ko(e,!0),ko(t))},destroy:function(e){ko(e,!0)}};function ko(e,t){var n=e.data.ref;if(o(n)){var r=e.context,i=e.componentInstance||e.elm,a=r.$refs;t?Array.isArray(a[n])?g(a[n],i):a[n]===i&&(a[n]=void 0):e.data.refInFor?Array.isArray(a[n])?a[n].indexOf(i)<0&&a[n].push(i):a[n]=[i]:a[n]=i}}var Oo=new _e("",{},[]),So=["create","activate","update","remove","destroy"];function Eo(e,t){return e.key===t.key&&(e.tag===t.tag&&e.isComment===t.isComment&&o(e.data)===o(t.data)&&jo(e,t)||i(e.isAsyncPlaceholder)&&e.asyncFactory===t.asyncFactory&&r(t.asyncFactory.error))}function jo(e,t){if("input"!==e.tag)return!0;var n,r=o(n=e.data)&&o(n=n.attrs)&&n.type,i=o(n=t.data)&&o(n=n.attrs)&&n.type;return r===i||uo(r)&&uo(i)}function To(e,t,n){var r,i,a={};for(r=t;r<=n;++r)i=e[r].key,o(i)&&(a[i]=r);return a}function Io(e){var t,n,a={},c=e.modules,u=e.nodeOps;for(t=0;th?(f=r(n[g+1])?null:n[g+1].elm,C(e,f,n,v,g,i)):v>g&&x(e,t,d,h)}function S(e,t,n,r){for(var i=n;i-1?qo(e,t,n):Vr(t)?Xr(n)?e.removeAttribute(t):(n="allowfullscreen"===t&&"EMBED"===e.tagName?"true":t,e.setAttribute(t,n)):Hr(t)?e.setAttribute(t,qr(t,n)):Wr(t)?Xr(n)?e.removeAttributeNS(zr,Kr(t)):e.setAttributeNS(zr,t,n):qo(e,t,n)}function qo(e,t,n){if(Xr(n))e.removeAttribute(t);else{if(ee&&!te&&"TEXTAREA"===e.tagName&&"placeholder"===t&&""!==n&&!e.__ieph){var r=function(t){t.stopImmediatePropagation(),e.removeEventListener("input",r)};e.addEventListener("input",r),e.__ieph=!0}e.setAttribute(t,n)}}var Vo={create:Ho,update:Ho};function zo(e,t){var n=t.elm,i=t.data,a=e.data;if(!(r(i.staticClass)&&r(i.class)&&(r(a)||r(a.staticClass)&&r(a.class)))){var s=Gr(t),c=n._transitionClasses;o(c)&&(s=Zr(s,Yr(c))),s!==n._prevClass&&(n.setAttribute("class",s),n._prevClass=s)}}var Wo,Ko={create:zo,update:zo},Xo="__r",Go="__c";function Jo(e){if(o(e[Xo])){var t=ee?"change":"input";e[t]=[].concat(e[Xo],e[t]||[]),delete e[Xo]}o(e[Go])&&(e.change=[].concat(e[Go],e.change||[]),delete e[Go])}function Qo(e,t,n){var r=Wo;return function o(){var i=t.apply(null,arguments);null!==i&&ei(e,o,n,r)}}var Zo=at&&!(oe&&Number(oe[1])<=53);function Yo(e,t,n,r){if(Zo){var o=Kn,i=t;t=i._wrapper=function(e){if(e.target===e.currentTarget||e.timeStamp>=o||e.timeStamp<=0||e.target.ownerDocument!==document)return i.apply(this,arguments)}}Wo.addEventListener(e,t,ae?{capture:n,passive:r}:n)}function ei(e,t,n,r){(r||Wo).removeEventListener(e,t._wrapper||t,n)}function ti(e,t){if(!r(e.data.on)||!r(t.data.on)){var n=t.data.on||{},o=e.data.on||{};Wo=t.elm,Jo(n),bt(n,o,Yo,ei,Qo,t.context),Wo=void 0}}var ni,ri={create:ti,update:ti};function oi(e,t){if(!r(e.data.domProps)||!r(t.data.domProps)){var n,i,a=t.elm,s=e.data.domProps||{},c=t.data.domProps||{};for(n in o(c.__ob__)&&(c=t.data.domProps=T({},c)),s)n in c||(a[n]="");for(n in c){if(i=c[n],"textContent"===n||"innerHTML"===n){if(t.children&&(t.children.length=0),i===s[n])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===n&&"PROGRESS"!==a.tagName){a._value=i;var u=r(i)?"":String(i);ii(a,u)&&(a.value=u)}else if("innerHTML"===n&&oo(a.tagName)&&r(a.innerHTML)){ni=ni||document.createElement("div"),ni.innerHTML=""+i+" ";var l=ni.firstChild;while(a.firstChild)a.removeChild(a.firstChild);while(l.firstChild)a.appendChild(l.firstChild)}else if(i!==s[n])try{a[n]=i}catch(Ca){}}}}function ii(e,t){return!e.composing&&("OPTION"===e.tagName||ai(e,t)||si(e,t))}function ai(e,t){var n=!0;try{n=document.activeElement!==e}catch(Ca){}return n&&e.value!==t}function si(e,t){var n=e.value,r=e._vModifiers;if(o(r)){if(r.number)return h(n)!==h(t);if(r.trim)return n.trim()!==t.trim()}return n!==t}var ci={create:oi,update:oi},ui=w(function(e){var t={},n=/;(?![^(]*\))/g,r=/:(.+)/;return e.split(n).forEach(function(e){if(e){var n=e.split(r);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t});function li(e){var t=fi(e.style);return e.staticStyle?T(e.staticStyle,t):t}function fi(e){return Array.isArray(e)?I(e):"string"===typeof e?ui(e):e}function di(e,t){var n,r={};if(t){var o=e;while(o.componentInstance)o=o.componentInstance._vnode,o&&o.data&&(n=li(o.data))&&T(r,n)}(n=li(e.data))&&T(r,n);var i=e;while(i=i.parent)i.data&&(n=li(i.data))&&T(r,n);return r}var pi,vi=/^--/,hi=/\s*!important$/,mi=function(e,t,n){if(vi.test(t))e.style.setProperty(t,n);else if(hi.test(n))e.style.setProperty(k(t),n.replace(hi,""),"important");else{var r=gi(t);if(Array.isArray(n))for(var o=0,i=n.length;o-1?t.split(wi).forEach(function(t){return e.classList.add(t)}):e.classList.add(t);else{var n=" "+(e.getAttribute("class")||"")+" ";n.indexOf(" "+t+" ")<0&&e.setAttribute("class",(n+t).trim())}}function Ci(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(wi).forEach(function(t){return e.classList.remove(t)}):e.classList.remove(t),e.classList.length||e.removeAttribute("class");else{var n=" "+(e.getAttribute("class")||"")+" ",r=" "+t+" ";while(n.indexOf(r)>=0)n=n.replace(r," ");n=n.trim(),n?e.setAttribute("class",n):e.removeAttribute("class")}}function $i(e){if(e){if("object"===typeof e){var t={};return!1!==e.css&&T(t,xi(e.name||"v")),T(t,e),t}return"string"===typeof e?xi(e):void 0}}var xi=w(function(e){return{enterClass:e+"-enter",enterToClass:e+"-enter-to",enterActiveClass:e+"-enter-active",leaveClass:e+"-leave",leaveToClass:e+"-leave-to",leaveActiveClass:e+"-leave-active"}}),ki=J&&!te,Oi="transition",Si="animation",Ei="transition",ji="transitionend",Ti="animation",Ii="animationend";ki&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(Ei="WebkitTransition",ji="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(Ti="WebkitAnimation",Ii="webkitAnimationEnd"));var Pi=J?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(e){return e()};function Di(e){Pi(function(){Pi(e)})}function Li(e,t){var n=e._transitionClasses||(e._transitionClasses=[]);n.indexOf(t)<0&&(n.push(t),Ai(e,t))}function Ni(e,t){e._transitionClasses&&g(e._transitionClasses,t),Ci(e,t)}function Mi(e,t,n){var r=Ri(e,t),o=r.type,i=r.timeout,a=r.propCount;if(!o)return n();var s=o===Oi?ji:Ii,c=0,u=function(){e.removeEventListener(s,l),n()},l=function(t){t.target===e&&++c>=a&&u()};setTimeout(function(){c0&&(n=Oi,l=a,f=i.length):t===Si?u>0&&(n=Si,l=u,f=c.length):(l=Math.max(a,u),n=l>0?a>u?Oi:Si:null,f=n?n===Oi?i.length:c.length:0);var d=n===Oi&&Fi.test(r[Ei+"Property"]);return{type:n,timeout:l,propCount:f,hasTransform:d}}function Ui(e,t){while(e.length1}function Wi(e,t){!0!==t.data.show&&Bi(t)}var Ki=J?{create:Wi,activate:Wi,remove:function(e,t){!0!==e.data.show?qi(e,t):t()}}:{},Xi=[Vo,Ko,ri,ci,bi,Ki],Gi=Xi.concat(Uo),Ji=Io({nodeOps:$o,modules:Gi});te&&document.addEventListener("selectionchange",function(){var e=document.activeElement;e&&e.vmodel&&oa(e,"input")});var Qi={inserted:function(e,t,n,r){"select"===n.tag?(r.elm&&!r.elm._vOptions?wt(n,"postpatch",function(){Qi.componentUpdated(e,t,n)}):Zi(e,t,n.context),e._vOptions=[].map.call(e.options,ta)):("textarea"===n.tag||uo(e.type))&&(e._vModifiers=t.modifiers,t.modifiers.lazy||(e.addEventListener("compositionstart",na),e.addEventListener("compositionend",ra),e.addEventListener("change",ra),te&&(e.vmodel=!0)))},componentUpdated:function(e,t,n){if("select"===n.tag){Zi(e,t,n.context);var r=e._vOptions,o=e._vOptions=[].map.call(e.options,ta);if(o.some(function(e,t){return!N(e,r[t])})){var i=e.multiple?t.value.some(function(e){return ea(e,o)}):t.value!==t.oldValue&&ea(t.value,o);i&&oa(e,"change")}}}};function Zi(e,t,n){Yi(e,t,n),(ee||ne)&&setTimeout(function(){Yi(e,t,n)},0)}function Yi(e,t,n){var r=t.value,o=e.multiple;if(!o||Array.isArray(r)){for(var i,a,s=0,c=e.options.length;s-1,a.selected!==i&&(a.selected=i);else if(N(ta(a),r))return void(e.selectedIndex!==s&&(e.selectedIndex=s));o||(e.selectedIndex=-1)}}function ea(e,t){return t.every(function(t){return!N(t,e)})}function ta(e){return"_value"in e?e._value:e.value}function na(e){e.target.composing=!0}function ra(e){e.target.composing&&(e.target.composing=!1,oa(e.target,"input"))}function oa(e,t){var n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!0),e.dispatchEvent(n)}function ia(e){return!e.componentInstance||e.data&&e.data.transition?e:ia(e.componentInstance._vnode)}var aa={bind:function(e,t,n){var r=t.value;n=ia(n);var o=n.data&&n.data.transition,i=e.__vOriginalDisplay="none"===e.style.display?"":e.style.display;r&&o?(n.data.show=!0,Bi(n,function(){e.style.display=i})):e.style.display=r?i:"none"},update:function(e,t,n){var r=t.value,o=t.oldValue;if(!r!==!o){n=ia(n);var i=n.data&&n.data.transition;i?(n.data.show=!0,r?Bi(n,function(){e.style.display=e.__vOriginalDisplay}):qi(n,function(){e.style.display="none"})):e.style.display=r?e.__vOriginalDisplay:"none"}},unbind:function(e,t,n,r,o){o||(e.style.display=e.__vOriginalDisplay)}},sa={model:Qi,show:aa},ca={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function ua(e){var t=e&&e.componentOptions;return t&&t.Ctor.options.abstract?ua(Cn(t.children)):e}function la(e){var t={},n=e.$options;for(var r in n.propsData)t[r]=e[r];var o=n._parentListeners;for(var i in o)t[C(i)]=o[i];return t}function fa(e,t){if(/\d-keep-alive$/.test(t.tag))return e("keep-alive",{props:t.componentOptions.propsData})}function da(e){while(e=e.parent)if(e.data.transition)return!0}function pa(e,t){return t.key===e.key&&t.tag===e.tag}var va=function(e){return e.tag||An(e)},ha=function(e){return"show"===e.name},ma={name:"transition",props:ca,abstract:!0,render:function(e){var t=this,n=this.$slots.default;if(n&&(n=n.filter(va),n.length)){0;var r=this.mode;0;var o=n[0];if(da(this.$vnode))return o;var i=ua(o);if(!i)return o;if(this._leaving)return fa(e,o);var a="__transition-"+this._uid+"-";i.key=null==i.key?i.isComment?a+"comment":a+i.tag:s(i.key)?0===String(i.key).indexOf(a)?i.key:a+i.key:i.key;var c=(i.data||(i.data={})).transition=la(this),u=this._vnode,l=ua(u);if(i.data.directives&&i.data.directives.some(ha)&&(i.data.show=!0),l&&l.data&&!pa(i,l)&&!An(l)&&(!l.componentInstance||!l.componentInstance._vnode.isComment)){var f=l.data.transition=T({},c);if("out-in"===r)return this._leaving=!0,wt(f,"afterLeave",function(){t._leaving=!1,t.$forceUpdate()}),fa(e,o);if("in-out"===r){if(An(i))return u;var d,p=function(){d()};wt(c,"afterEnter",p),wt(c,"enterCancelled",p),wt(f,"delayLeave",function(e){d=e})}}return o}}},ya=T({tag:String,moveClass:String},ca);delete ya.mode;var ga={props:ya,beforeMount:function(){var e=this,t=this._update;this._update=function(n,r){var o=Tn(e);e.__patch__(e._vnode,e.kept,!1,!0),e._vnode=e.kept,o(),t.call(e,n,r)}},render:function(e){for(var t=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,o=this.$slots.default||[],i=this.children=[],a=la(this),s=0;s