text
string
size
int64
token_count
int64
module.exports = { options: {}, issues: [], summary: { sessions: [], subjects: [], tasks: [], modalities: [], totalFiles: [], size: 0, }, }
172
61
require('dotenv').config(); const { TruffleProvider } = require('@harmony-js/core'); const operator_private_key = process.env.OPERATOR_PRIVATE_KEY; const operator_meemonic = process.env.OPERATOR_MNEMONIC; const testnet_url = process.env.TESTNET_0_URL; //Mainnet const mainnet_mnemonic = process.env.MAINNET_MNEMONIC; const mainnet_private_key = process.env.MAINNET_PRIVATE_KEY; const mainnet_url = process.env.MAINNET_0_URL; //GAS - Currently using same GAS accross all environments gasLimit = process.env.GAS_LIMIT; gasPrice = process.env.GAS_PRICE; module.exports = { // contracts_build_directory: '/build/contracts', networks: { testnet: { network_id: '2', // Any network (default: none) provider: () => { const truffleProvider = new TruffleProvider( testnet_url, { memonic: operator_meemonic }, { shardID: 0, chainId: 2 }, { gasLimit: gasLimit, gasPrice: gasPrice } ); const newAcc = truffleProvider.addByPrivateKey(operator_private_key); truffleProvider.setSigner(newAcc); return truffleProvider; } }, mainnet0: { network_id: '1', // Any network (default: none) provider: () => { const truffleProvider = new TruffleProvider( mainnet_url, { memonic: mainnet_mnemonic }, { shardID: 0, chainId: 1 }, { gasLimit: gasLimit, gasPrice: gasPrice } ); const newAcc = truffleProvider.addByPrivateKey(mainnet_private_key); truffleProvider.setSigner(newAcc); return truffleProvider; } } }, // Set default mocha options here, use special reporters etc. mocha: { // timeout: 100000 useColors: true }, // Configure your compilers compilers: { solc: { version: '0.5.8' } } };
1,823
608
import _ from 'lodash'; import React, {Component} from 'react'; import ReactDOM from 'react-dom'; import YTSearch from 'youtube-api-search'; import SearchBar from './components/search_bar'; import VideoList from './components/video_list'; import VideoDetail from './components/video_detail'; class App extends Component { constructor(props) { super(props); this.state = { videos: [], selectedVideo: null }; this.videoSearch('surfboards'); } videoSearch(term) { YTSearch({key: __API_KEY__, term: term}, (videos) => { this.setState({ videos: videos, selectedVideo: videos[0] }); }); } render() { const videoSearch = _.debounce((term) => {this.videoSearch(term)}, 300); return ( <div> <SearchBar onSearchTermChange={videoSearch}/> <VideoDetail video={this.state.selectedVideo}/> <VideoList onVideoSelect={selectedVideo => this.setState({selectedVideo}) } videos={this.state.videos} /> </div> ); } } ReactDOM.render(<App />, document.querySelector('.container'));
1,110
335
(function () { /* Imports */ var Meteor = Package.meteor.Meteor; var global = Package.meteor.global; var meteorEnv = Package.meteor.meteorEnv; (function(){ /////////////////////////////////////////////////////////////////////// // // // packages/raix_ui-dropped-event/packages/raix_ui-dropped-event.js // // // /////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////// }).call(this); /* Exports */ Package._define("raix:ui-dropped-event"); })();
744
161
const express = require('express'); const router = express.Router(); const fs = require('fs'); const theatreHelpers = require('../helpers/theatreHelpers'); const passport = require('passport'); const date = require('date-and-time'); const isTheatre = require('../middleware/auth').isTheatre; router.get('/login', (req, res) => { if (req.isAuthenticated() && req.user.theatre) { res.redirect('/theatre'); } else { if (req.session.messages) { res.render('theatre/login', { title: 'Theatre | Login', messages: req.session.messages, theatreStyle: true }); req.session.messages = false; } else { res.render('theatre/login', { title: 'Theatre | Login', theatreStyle: true }); } } }); router.post('/login', passport.authenticate('theatre-login', { successRedirect: '/theatre', failureRedirect: '/theatre/login', failureFlash: true })); router.get('/auth/google', passport.authenticate('theatre-google-auth', { scope: ['profile', 'email'] })); router.get('/auth/google/callback', passport.authenticate('theatre-google-auth', { failureRedirect: '/theatre/popup', failureFlash: true }), (req, res) => { res.redirect('/theatre/popup'); }); router.get('/popup', (req, res) => { if (!req.isAuthenticated()) { req.session.messages = { error: 'Invalid Account' }; } res.render('auth-popup-callback'); }); router.get('/logout', (req, res) => { req.logout(); res.json({ status: true }); }); router.get('/', isTheatre, async function (req, res, next) { const totalShows = await theatreHelpers.getNumberOfShows(req.user._id); const totalScreens = await theatreHelpers.getNumberOfScreens(req.user._id); const totalBookings = await theatreHelpers.getNumberOfBookings(req.user._id); const paidBookings = await theatreHelpers.getNumberOfPayedBookings(req.user._id); const unpaidBookings = await theatreHelpers.getNumberOfUnpayedBookings(req.user._id); const currentMonthBookings = await theatreHelpers.getTheatreBookings(req.user._id, date.format(new Date(), 'YYYY'), date.format(new Date(), 'MM'), date.format(new Date(), 'DD')); const pastMonthBookings = await theatreHelpers.getTheatreBookings(req.user._id, date.format(new Date(), 'YYYY'), date.format(new Date(new Date().getFullYear(), new Date().getMonth(), 0), 'MM'), date.format(new Date(new Date().getFullYear(), new Date().getMonth(), 0), 'DD')); res.render('theatre/dashboard', { title: 'Theatre | Dashboard', theatre: req.user, totalShows, totalScreens, totalBookings, paidBookings, unpaidBookings, currentMonthBookings, pastMonthBookings }); }); router.post('/update-owner-picture/:id', isTheatre, (req, res) => { if (req.files.ownerPicture) { theatreHelpers.updateOwnerPicture(req.params.id, true).then((response) => { let image = req.files.ownerPicture; image.mv(`./public/images/theatre/${response.theatre._id}.jpg`, (err, done) => { if (err) { console.log(err); } else { console.log(done); } }); req.flash('info', response.alertMessage); res.redirect('/theatre'); }).catch((error) => { req.flash('error', error.errMessage); res.redirect('/theatre'); }); } }); router.get('/remove-owner-picture/:id', isTheatre, (req, res) => { theatreHelpers.updateOwnerPicture(req.params.id, false).then((response) => { req.flash('info', response.alertMessage); fs.unlinkSync(`./public/images/theatre/${response.theatre._id}.jpg`); res.redirect('/theatre'); }).catch((error) => { req.flash('error', error.errMessage); res.redirect('/theatre'); });; }); router.post('/update-theatre-details', isTheatre, (req, res) => { theatreHelpers.updateTheatreDetails(req.body, req.user._id).then((response) => { res.json(response); }).catch((error) => { res.redirect(error); }); }); router.post('/update-location', (req, res) => { theatreHelpers.updateLocation(req.body, req.user._id).then((response) => { res.json(response); }).catch((error) => { res.json(error); }); }); router.post('/change-password', isTheatre, (req, res) => { theatreHelpers.changePassword(req.body, req.user._id).then((response) => { res.json(response); }).catch((error) => { res.json(error); }); }); router.get('/screens', isTheatre, (req, res) => { theatreHelpers.getAllScreens(req.user._id).then((screens) => { res.render('theatre/screens', { title: 'Theatre | Screens', theatre: req.user, screens }); }); }); router.get('/add-screens', isTheatre, (req, res) => { res.render('theatre/add-screens', { title: 'Admin | Add Screens', theatre: req.user }); }); router.post('/add-screens', isTheatre, (req, res) => { theatreHelpers.addScreens(req.body, req.user._id).then((response) => { req.flash('info', response.alertMessage); res.redirect('/theatre/screens'); }).catch((error) => { req.flash('error', error.errMessage); res.redirect('/theatre/screens'); }); }); router.get('/edit-screen/:id', isTheatre, (req, res) => { theatreHelpers.getScreen(req.params.id).then((screen) => { res.render('theatre/edit-screen', { title: 'Admin | Edit Screen', theatre: req.user, screen }); }).catch((error) => { req.flash('error', error.errMessage); res.redirect('/theatre/screens'); }); }); router.post('/edit-screen', isTheatre, (req, res) => { theatreHelpers.editScreen(req.body).then((response) => { req.flash('info', response.alertMessage); res.redirect('/theatre/screens'); }).catch((error) => { req.flash('error', error.errMessage); res.redirect('/theatre/screens'); }); }); router.post('/delete-screen', isTheatre, (req, res) => { theatreHelpers.deleteScreen(req.body.id).then((response) => { res.json(response); }).catch((error) => { res.json(error); }); }); router.get('/movie-management', isTheatre, (req, res) => { theatreHelpers.getAllMovies().then((movies) => { res.render('theatre/movie-management', { title: 'Theatre | Movie Management', theatre: req.user, movies, errMessage: req.session.errMessage, alertMessage: req.session.alertMessage }); req.session.errMessage = false; req.session.alertMessage = false; }); }); router.get('/add-movies', isTheatre, (req, res) => { res.render('theatre/add-movies', { title: 'Theatre | Add Movies', theatre: req.user }); }); router.post('/add-movies', isTheatre, (req, res) => { theatreHelpers.addMovies(req.body, req.user._id).then((response) => { let image = req.files.moviePoster; image.mv(`./public/images/movies/posters/${response.data._id}.jpg`, (err, done) => { if (err) { console.log(err); } else { console.log(done); } }); req.flash('info', response.alertMessage); res.redirect('/theatre/movie-management'); }).catch((error) => { req.flash('error', error.errMessage); res.redirect('/theatre/movie-management'); }); }); router.get('/edit-movie/:id', isTheatre, (req, res) => { theatreHelpers.getMovie(req.params.id).then((movie) => { res.render('theatre/edit-movie', { title: 'Theatre | Edit Movie', theatre: req.user, movie }); }).catch((error) => { req.flash('error', error.errMessage); res.redirect('/theatre/movie-management'); }); }); router.post('/edit-movie', isTheatre, (req, res) => { theatreHelpers.editMovie(req.body).then((response) => { req.flash('info', response.alertMessage); res.redirect('/theatre/movie-management'); if (req.files.moviePoster) { let image = req.files.moviePoster; image.mv(`./public/images/movies/posters/${response.movieId}.jpg`, (err, done) => { if (err) { console.log(err); } else { console.log(done); } }); } }).catch((error) => { req.flash('error', error.errMessage); res.redirect('/theatre/movie-management'); }); }); router.post('/delete-movie', isTheatre, (req, res) => { theatreHelpers.deleteMovie(req.body.id, req.user._id).then((response) => { fs.unlinkSync(`./public/images/movies/posters/${req.body.id}.jpg`); res.json(response); }).catch((error) => { res.json(error); }); }); router.get('/upcoming-movies', isTheatre, (req, res) => { theatreHelpers.getAllUpcomingMovies(req.user._id).then((movies) => { res.render('theatre/upcoming-movies', { title: 'Theatre | Upcoming Movies', theatre: req.user, movies }); }); }); router.get('/add-upcoming-movies', isTheatre, (req, res) => { res.render('theatre/add-upcoming-movies', { title: 'Theatre | Add Movies', theatre: req.user }); }); router.post('/add-upcoming-movies', isTheatre, (req, res) => { theatreHelpers.addUpcomingMovies(req.body, req.user._id).then((response) => { let image = req.files.moviePoster; image.mv(`./public/images/movies/upcoming-movies/posters/${response.data._id}.jpg`, (err, done) => { if (err) { console.log(err); } else { console.log(done); } }); req.flash('info', response.alertMessage); res.redirect('/theatre/upcoming-movies'); }).catch((error) => { req.flash('error', error.errMessage); res.redirect('/theatre/upcoming-movies'); }); }); router.get('/edit-upcoming-movie/:id', isTheatre, (req, res) => { theatreHelpers.getUpcomingMovie(req.params.id).then((movie) => { res.render('theatre/edit-upcoming-movie', { title: 'Theatre | Edit Upcoming Movie', theatre: req.user, movie }); }).catch((error) => { req.flash('error', error.errMessage); res.redirect('/theatre/upcoming-movies'); }); }); router.post('/edit-upcoming-movie', isTheatre, (req, res) => { theatreHelpers.editUpcomingMovie(req.body).then((response) => { req.flash('info', response.alertMessage); res.redirect('/theatre/upcoming-movies'); if (req.files.moviePoster) { let image = req.files.moviePoster; image.mv(`./public/images/movies/upcoming-movies/posters/${response.movieId}.jpg`, (err, done) => { if (err) { console.log(err); } else { console.log(done); } }); } }).catch((error) => { req.flash('error', error.errMessage); res.redirect('/theatre/upcoming-movies'); }); }); router.post('/delete-upcoming-movie', isTheatre, (req, res) => { theatreHelpers.deleteUpcomingMovie(req.body.id).then((response) => { fs.unlinkSync(`./public/images/movies/upcoming-movies/posters/${req.body.id}.jpg`); res.json(response); }).catch((error) => { res.json(error); }); }); router.get('/view-schedule/:id', isTheatre, (req, res) => { theatreHelpers.getScreen(req.params.id).then(async (screen) => { const shows = await theatreHelpers.getAllShows(req.params.id); res.render('theatre/view-schedule', { title: 'Theatre | View Schedule', theatre: req.user, screen, shows }); }).catch((error) => { req.flash('error', error.errMessage); res.redirect('/theatre/screens'); }); }); router.get('/add-shows/:id', isTheatre, (req, res) => { theatreHelpers.getAllMovies().then((movies) => { res.render('theatre/add-shows', { title: 'Theatre | Add Shows', theatre: req.user, screenId: req.params.id, movies }); }); }); router.post('/add-shows', isTheatre, (req, res) => { theatreHelpers.addShows(req.body).then((response) => { req.flash('info', response.alertMessage); res.redirect(`/theatre/view-schedule/${response.screenId}`); }).catch((error) => { req.flash('error', error.errMessage); res.redirect(`/theatre/view-schedule/${error.screenId}`); }); }); router.get('/edit-show', isTheatre, (req, res) => { theatreHelpers.getAllMovies().then(async (movies) => { const show = await theatreHelpers.getShow(req.query); res.render('theatre/edit-show', { title: 'Theatre | Edit Show', theatre: req.user, show, movies }); }).catch((error) => { req.flash('error', error.errMessage); res.redirect(`/theatre/view-schedule/${req.query.screenId}`); }); }); router.post('/edit-show', isTheatre, (req, res) => { theatreHelpers.editShow(req.body).then((response) => { req.flash('info', response.alertMessage); res.redirect(`/theatre/view-schedule/${req.body.screenId}`) }).catch((error) => { req.flash('error', error.errMessage); res.redirect(`/theatre/view-schedule/${req.body.screenId}`) }); }); router.post('/delete-show', isTheatre, (req, res) => { theatreHelpers.deleteShow(req.body).then((response) => { res.json(response); }).catch((error) => { res.json(error); }); }); router.post('/get-time-slots', (req, res) => { theatreHelpers.getTimeSlots(req.body).then((slots) => { res.json(slots); }); }); router.get('/users-activity', isTheatre, (req, res) => { theatreHelpers.getUsers(req.user._id).then((users) => { res.render('theatre/users-activity', { title: 'Theatre | Users Activity', theatre: req.user, users }); }); }); router.get('/profile', isTheatre, (req, res) => { res.render('theatre/profile', { title: 'Theatre | Profile', theatre: req.user }); }); module.exports = router;
13,373
4,524
function scholarship(arg1, arg2, arg3) { let income = Number(arg1); let averageGrade = Number(arg2); let minIncome = Number(arg3); let socialScholarship = 0; let excellentScholarship = 0; if (averageGrade >= 5.50) { excellentScholarship = averageGrade * 25; } if ((averageGrade >= 4.50 && averageGrade < 5.50) && income <= minIncome) { socialScholarship = minIncome * 0.35; } if (socialScholarship > excellentScholarship) { console.log(`You get a Social scholarship ${Math.floor(socialScholarship)} BGN`); } else if (excellentScholarship > socialScholarship) { console.log(`You get a scholarship for excellent results ${Math.floor(excellentScholarship)} BGN`); } else { console.log(`You cannot get a scholarship!`); } } scholarship(300.00, 5.65, 420.00, );
865
309
/* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved. * This program are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ import {SuperMap} from '../SuperMap'; import {ShapeFactory} from './feature/ShapeFactory'; import {Sector} from './feature/Sector'; import {Graph} from './Graph'; /** * @class SuperMap.Feature.Theme.Pie * @classdesc 饼图。 * @category Visualization Theme * @param {SuperMap.Feature.Vector} data - 用户数据。 * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。 * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。 * @param {SuperMap.Feature.Theme.Point.setting} setting - 图表配置对象。 * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。 * @extends SuperMap.Feature.Theme.Graph * @example * // sectorStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性: * // start: 值域值下限(包含); * // end: 值域值上限(不包含); * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Sector.style> 。 * // sectorStyleByCodomain 数组形如: * [ * { * start:0, * end:250, * style:{ * fillColor:"#00CD00" * } * }, * { * start:250, * end:500, * style:{ * fillColor:"#00EE00" * } * }, * { * start:500, * end:750, * style:{ * fillColor:"#00FF7F" * } * }, * { * start:750, * end:1500, * style:{ * fillColor:"#00FF00" * } * } * ] * @extends {SuperMap.Feature.Theme.Graph} */ export class Pie extends Graph { constructor(data, layer, fields, setting, lonlat) { super(data, layer, fields, setting, lonlat); this.CLASS_NAME = "SuperMap.Feature.Theme.Pie"; } /** * @function SuperMap.Feature.Theme.Pie.prototype.destroy * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。 */ destroy() { super.destroy(); } /** * @function SuperMap.Feature.Theme.Pie.prototype.assembleShapes * @description 装配图形(扩展接口)。 */ assembleShapes() { // 图表配置对象 var sets = this.setting; // 一个默认 style 组 var defaultStyleGroup = [ {fillColor: "#ff9277"}, {fillColor: "#dddd00"}, {fillColor: "#ffc877"}, {fillColor: "#bbe3ff"}, {fillColor: "#d5ffbb"}, {fillColor: "#bbbbff"}, {fillColor: "#ddb000"}, {fillColor: "#b0dd00"}, {fillColor: "#e2bbff"}, {fillColor: "#ffbbe3"}, {fillColor: "#ff7777"}, {fillColor: "#ff9900"}, {fillColor: "#83dd00"}, {fillColor: "#77e3ff"}, {fillColor: "#778fff"}, {fillColor: "#c877ff"}, {fillColor: "#ff77ab"}, {fillColor: "#ff6600"}, {fillColor: "#aa8800"}, {fillColor: "#77c7ff"}, {fillColor: "#ad77ff"}, {fillColor: "#ff77ff"}, {fillColor: "#dd0083"}, {fillColor: "#777700"}, {fillColor: "#00aa00"}, {fillColor: "#0088aa"}, {fillColor: "#8400dd"}, {fillColor: "#aa0088"}, {fillColor: "#dd0000"}, {fillColor: "#772e00"} ]; // 重要步骤:初始化参数 if (!this.initBaseParameter()) { return; } // 背景框,默认不启用 if (sets.useBackground) { this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets)); } // 数据值数组 var fv = this.dataValues; if (fv.length < 1) { return; } // 没有数据 // 值域范围 var codomain = this.DVBCodomain; // 值域范围检测 for (let i = 0; i < fv.length; i++) { if (fv[i] < codomain[0] || fv[i] > codomain[1]) { return; } } // 值的绝对值总和 var valueSum = 0; for (let i = 0; i < fv.length; i++) { valueSum += Math.abs(fv[i]); } // 重要步骤:定义图表 Pie 数据视图框中单位值的含义,单位值:每度代表的数值 this.DVBUnitValue = 360 / valueSum; var uv = this.DVBUnitValue; var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为扇心 var startAngle = 0; // 扇形起始边角度 var endAngle = 0; // 扇形终止边角度 var startAngleTmp = startAngle; // 扇形临时起始边角度 // 扇形(自适应)半径 var r = this.DVBHeight < this.DVBWidth ? this.DVBHeight / 2 : this.DVBWidth / 2; for (var i = 0; i < fv.length; i++) { var fvi = Math.abs(fv[i]); //计算终止角 if (i === 0) { endAngle = startAngle + fvi * uv; } else if (i === fvi.length - 1) { endAngle = startAngleTmp; } else { endAngle = startAngle + fvi * uv; } //矫正误差计算 if ((endAngle - startAngle) >= 360) { endAngle = 359.9999999; } // 扇形参数对象 var sectorSP = new Sector(dvbCenter[0], dvbCenter[1], r, startAngle, endAngle); // 扇形样式 if (typeof(sets.sectorStyleByFields) === "undefined") { // 使用默认 style 组 var colorIndex = i % defaultStyleGroup.length; sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, defaultStyleGroup, null, colorIndex); } else { sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, sets.sectorStyleByFields, sets.sectorStyleByCodomain, i, fv[i]); } // 扇形 hover 样式 sectorSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.sectorHoverStyle); // 扇形 hover 与 click 设置 if (typeof(sets.sectorHoverAble) !== "undefined") { sectorSP.hoverable = sets.sectorHoverAble; } if (typeof(sets.sectorClickAble) !== "undefined") { sectorSP.clickable = sets.sectorClickAble; } // 图形携带的数据信息 sectorSP.refDataID = this.data.id; sectorSP.dataInfo = { field: this.fields[i], value: fv[i] }; // 创建扇形并把此扇形添加到图表图形数组 this.shapes.push(this.shapeFactory.createShape(sectorSP)); // 把上一次的结束角度作为下一次的起始角度 startAngle = endAngle; } // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形 // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数) this.shapesConvertToRelativeCoordinate(); } } /** * @typedef {Object} SuperMap.Feature.Theme.Pie.setting * @property {number} width - 专题要素(图表)宽度。 * @property {number} height - 专题要素(图表)高度。 * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。 * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。 * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。 * @property {Array.<number>} [dataViewBoxParameter=[0, 0, 0, 0]] - 数据视图框 dataViewBox 参数, * 它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。 * @property {Array.<number>} decimalNumber - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。 * @property {boolean} [useBackground=false] - 是否使用图表背景框。 * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} backgroundStyle - 背景样式。 * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,则 backgroundRadius 为 [r1、r2、r3、r4 ]。 * @property {SuperMap.Feature.ShapeParameters.Sector.style} sectorStyle - 饼图中扇形的基础 style,此参数控制饼图扇形基础样式,优先级低于 sectorStyleByFields 和 sectorStyleByCodomain。 * @property {Array.<SuperMap.Feature.ShapeParameters.Sector.style>} sectorStyleByFields - 按专题字段 themeFields(<SuperMap.Layer.Graph.themeFields>)为饼图扇形赋 style,此参数按字段控制饼图扇形样式,优先级低于 sectorStyleByCodomain,高于 sectorStyle。此参数中的 style 与 themeFields 中的字段一一对应 。例如: themeFields(<SuperMap.Layer.Graph.themeFields>) 为 ["POP_1992", "POP_1995", "POP_1999"], * sectorStyleByFields 为[style1, style2, style3],则在图表中,字段 POP_1992 对应的饼图扇形使用 style1,字段 POP_1995 对应的饼图扇形使用 style2 ,字段 POP_1999 对应的饼图扇形使用 style3。 * @property {Array.<Object>} sectorStyleByCodomain - 按饼图扇形代表的数据值所在值域范围控制饼图扇形样式,优先级高于 sectorStyle 和 sectorStyleByFields。 * @property {Object} [sectorHoverStyle] 饼图扇形 hover 状态时的样式,sectorHoverAble 为 true 时有效。 * @property {boolean} [sectorHoverAble=true] 是否允许饼图扇形使用 hover 状态。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽饼图扇形对专题图层事件的响应。 * @property {boolean} [sectorClickAble=true] 是否允许饼图扇形被点击。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽饼图扇形对专题图层事件的响应。 */ SuperMap.Feature.Theme.Pie = Pie;
8,669
4,010
import { get } from '@wp-g2/create-styles'; import { colorize, getComputedColor, is, noop } from '@wp-g2/utils'; import { space } from '../mixins/space'; import { config } from './config'; import { generateColorAdminColors } from './utils'; const baseTheme = Object.freeze(Object.assign({}, config)); export function createTheme(callback = noop) { if (!is.function(callback)) return {}; const props = { get, theme: baseTheme, color: colorize, space, }; const customConfig = callback(props); if (!is.plainObject(customConfig)) return {}; let colorAdminColors = {}; if (customConfig.colorAdmin) { const colorAdminValue = getComputedColor(customConfig.colorAdmin); colorAdminColors = generateColorAdminColors(colorAdminValue); } return { ...customConfig, ...colorAdminColors, }; }
813
271
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[9],{ /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/productItem.vue?vue&type=script&lang=js&": /*!**********************************************************************************************************************************************************************!*\ !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/productItem.vue?vue&type=script&lang=js& ***! \**********************************************************************************************************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var vue_router__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue-router */ "./node_modules/vue-router/dist/vue-router.esm.js"); /* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vuex */ "./node_modules/vuex/dist/vuex.esm.js"); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } // // // // // // // // // // // // // // // // // // // // // // // // // //import { mapGetters } from "vuex"; /* harmony default export */ __webpack_exports__["default"] = ({ name: 'productItem', props: ['prod', 'item', 'displayList'], data: function data() { return { "short": this.prod.description.substring(0, 20), image: "/assets/products/medium/" + this.prod.image }; }, methods: _objectSpread({ loadProdDetails: function loadProdDetails(id) { this.$router.push("/product-details/" + id); this.prodDetails(id); } }, Object(vuex__WEBPACK_IMPORTED_MODULE_1__["mapActions"])(['prodDetails'])) /* methods: { ...mapActions(['updateCart']), addItem() { const order = { item: Object.assign({}, this.item), quantity: 1, isAdd: true }; this.updateCart(order); } }, filters: { shortDescription(value) { if (value && value.length > 100) { return value.substring(0, 100) + '...'; } else { return value; } } } */ }); /***/ }), /***/ "./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/productItem.vue?vue&type=style&index=0&id=74f7cea7&scoped=true&lang=css&": /*!*****************************************************************************************************************************************************************************************************************************************************************************************************!*\ !*** ./node_modules/css-loader??ref--6-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--6-2!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/productItem.vue?vue&type=style&index=0&id=74f7cea7&scoped=true&lang=css& ***! \*****************************************************************************************************************************************************************************************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false); // imports // module exports.push([module.i, "\ndiv.card[data-v-74f7cea7] {\n height: 100%;\n}\n.card-text[data-v-74f7cea7] {\n font-size: 0.875rem;\n}\n.remain[data-v-74f7cea7] {\n color: #d17581;\n}\n.grow[data-v-74f7cea7] {\n transition: all .2s ease-in-out;\n}\n.grow[data-v-74f7cea7]:hover {\n transform: scale(1.1);\n}\n.list-group-item[data-v-74f7cea7] {\n float: none;\n width: 100%;\n background-color: #fff;\n margin-bottom: 30px;\n flex: 0 0 100%;\n max-width: 100%;\n padding: 0 1rem;\n border: 0;\n.thumbnail {\n display: inline-block;\n width: 100%;\n}\n.img-event {\n width: 20%;\n float: left;\n padding: 0 !important;\n margin: 0;\n height: auto;\n}\n.thumbnail-image {\n position: static;\n}\n.card-body {\n float: left;\n width: 80%;\n margin: 0;\n}\n@media (max-width: 767.98px) {\n.img-event {\n width: 30%;\n float: left;\n padding: 0 !important;\n margin: 0;\n}\n.card-body {\n float: left;\n width: 70%;\n margin: 0;\n}\n}\n}\n.item.list-group-item[data-v-74f7cea7]:before, .item.list-group-item[data-v-74f7cea7]:after\n{\n display: table;\n content: \" \";\n}\n.item.list-group-item[data-v-74f7cea7]:after {\n clear: both;\n}\n", ""]); // exports /***/ }), /***/ "./node_modules/style-loader/index.js!./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/productItem.vue?vue&type=style&index=0&id=74f7cea7&scoped=true&lang=css&": /*!*********************************************************************************************************************************************************************************************************************************************************************************************************************************!*\ !*** ./node_modules/style-loader!./node_modules/css-loader??ref--6-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--6-2!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/productItem.vue?vue&type=style&index=0&id=74f7cea7&scoped=true&lang=css& ***! \*********************************************************************************************************************************************************************************************************************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(/*! !../../../node_modules/css-loader??ref--6-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src??ref--6-2!../../../node_modules/vue-loader/lib??vue-loader-options!./productItem.vue?vue&type=style&index=0&id=74f7cea7&scoped=true&lang=css& */ "./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/productItem.vue?vue&type=style&index=0&id=74f7cea7&scoped=true&lang=css&"); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/productItem.vue?vue&type=template&id=74f7cea7&scoped=true&": /*!**************************************************************************************************************************************************************************************************************************!*\ !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/productItem.vue?vue&type=template&id=74f7cea7&scoped=true& ***! \**************************************************************************************************************************************************************************************************************************/ /*! exports provided: render, staticRenderFns */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; }); var render = function() { var _vm = this var _h = _vm.$createElement var _c = _vm._self._c || _h return _c( "div", { staticClass: "col-sm-6 col-md-4 item", class: { "list-group-item": false } }, [ _c("div", { staticClass: "thumbnail card" }, [ _c("div", { staticClass: "img-event intrinsic" }, [ _c("img", { staticClass: "grow thumbnail-image card-img-top intrinsic-item p-3", attrs: { src: _vm.image, alt: "" } }) ]), _vm._v(" "), _c("div", { staticClass: "card-body" }, [ _c("h6", { staticClass: "card-subtitle mb-2 remain" }, [ _vm._v("40 left in stock") ]), _vm._v(" "), _c( "h6", { staticClass: "card-subtitle mb-2 remain", staticStyle: { color: "green" } }, [_vm._v(_vm._s(_vm.short) + " ...")] ), _vm._v(" "), _c("p", { staticClass: "card-text truncate" }, [ _vm._v(_vm._s(_vm.prod.p_name)) ]), _vm._v(" "), _c("div", { staticClass: "row" }, [ _c("p", { staticClass: "col-6 lead" }, [ _vm._v("$" + _vm._s(_vm.prod.price)) ]), _vm._v(" "), _c("p", { staticClass: "col-6" }, [ _c( "button", { staticClass: "btn btn-success pull-right", staticStyle: { "font-size": "10px" }, attrs: { disabled: false }, on: { click: function($event) { return _vm.loadProdDetails(_vm.prod.id) } } }, [_vm._v(" View Product \n ")] ) ]) ]) ]) ]) ] ) } var staticRenderFns = [] render._withStripped = true /***/ }), /***/ "./resources/js/components/productItem.vue": /*!*************************************************!*\ !*** ./resources/js/components/productItem.vue ***! \*************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _productItem_vue_vue_type_template_id_74f7cea7_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./productItem.vue?vue&type=template&id=74f7cea7&scoped=true& */ "./resources/js/components/productItem.vue?vue&type=template&id=74f7cea7&scoped=true&"); /* harmony import */ var _productItem_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./productItem.vue?vue&type=script&lang=js& */ "./resources/js/components/productItem.vue?vue&type=script&lang=js&"); /* empty/unused harmony star reexport *//* harmony import */ var _productItem_vue_vue_type_style_index_0_id_74f7cea7_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./productItem.vue?vue&type=style&index=0&id=74f7cea7&scoped=true&lang=css& */ "./resources/js/components/productItem.vue?vue&type=style&index=0&id=74f7cea7&scoped=true&lang=css&"); /* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js"); /* normalize component */ var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])( _productItem_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"], _productItem_vue_vue_type_template_id_74f7cea7_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"], _productItem_vue_vue_type_template_id_74f7cea7_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"], false, null, "74f7cea7", null ) /* hot reload */ if (false) { var api; } component.options.__file = "resources/js/components/productItem.vue" /* harmony default export */ __webpack_exports__["default"] = (component.exports); /***/ }), /***/ "./resources/js/components/productItem.vue?vue&type=script&lang=js&": /*!**************************************************************************!*\ !*** ./resources/js/components/productItem.vue?vue&type=script&lang=js& ***! \**************************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_productItem_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./productItem.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/productItem.vue?vue&type=script&lang=js&"); /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_productItem_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]); /***/ }), /***/ "./resources/js/components/productItem.vue?vue&type=style&index=0&id=74f7cea7&scoped=true&lang=css&": /*!**********************************************************************************************************!*\ !*** ./resources/js/components/productItem.vue?vue&type=style&index=0&id=74f7cea7&scoped=true&lang=css& ***! \**********************************************************************************************************/ /*! no static exports found */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_productItem_vue_vue_type_style_index_0_id_74f7cea7_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/style-loader!../../../node_modules/css-loader??ref--6-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src??ref--6-2!../../../node_modules/vue-loader/lib??vue-loader-options!./productItem.vue?vue&type=style&index=0&id=74f7cea7&scoped=true&lang=css& */ "./node_modules/style-loader/index.js!./node_modules/css-loader/index.js?!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/productItem.vue?vue&type=style&index=0&id=74f7cea7&scoped=true&lang=css&"); /* harmony import */ var _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_productItem_vue_vue_type_style_index_0_id_74f7cea7_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_productItem_vue_vue_type_style_index_0_id_74f7cea7_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__); /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_productItem_vue_vue_type_style_index_0_id_74f7cea7_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__) if(["default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _node_modules_style_loader_index_js_node_modules_css_loader_index_js_ref_6_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_2_node_modules_vue_loader_lib_index_js_vue_loader_options_productItem_vue_vue_type_style_index_0_id_74f7cea7_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__)); /***/ }), /***/ "./resources/js/components/productItem.vue?vue&type=template&id=74f7cea7&scoped=true&": /*!********************************************************************************************!*\ !*** ./resources/js/components/productItem.vue?vue&type=template&id=74f7cea7&scoped=true& ***! \********************************************************************************************/ /*! exports provided: render, staticRenderFns */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_productItem_vue_vue_type_template_id_74f7cea7_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./productItem.vue?vue&type=template&id=74f7cea7&scoped=true& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/productItem.vue?vue&type=template&id=74f7cea7&scoped=true&"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_productItem_vue_vue_type_template_id_74f7cea7_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_productItem_vue_vue_type_template_id_74f7cea7_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; }); /***/ }) }]);
20,612
6,869
import React from 'react' export default () => ( <svg width="80px" height="80px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" class="lds-fidget-spinner" > <g transform="rotate(6 50 50)"> <g transform="translate(50 50)"> <g ng-attr-transform="scale({{config.r}})" transform="scale(0.9)"> <g transform="translate(-50 -58)"> <path ng-attr-fill="{{config.c2}}" d="M27.1,79.4c-1.1,0.6-2.4,1-3.7,1c-2.6,0-5.1-1.4-6.4-3.7c-2-3.5-0.8-8,2.7-10.1c1.1-0.6,2.4-1,3.7-1c2.6,0,5.1,1.4,6.4,3.7 C31.8,72.9,30.6,77.4,27.1,79.4z" fill="#fc636b" /> <path ng-attr-fill="{{config.c3}}" d="M72.9,79.4c1.1,0.6,2.4,1,3.7,1c2.6,0,5.1-1.4,6.4-3.7c2-3.5,0.8-8-2.7-10.1c-1.1-0.6-2.4-1-3.7-1c-2.6,0-5.1,1.4-6.4,3.7 C68.2,72.9,69.4,77.4,72.9,79.4z" fill="#6a67ce" /> <circle ng-attr-fill="{{config.c4}}" cx="50" cy="27" r="7.4" fill="#ffb900" /> <path ng-attr-fill="{{config.c1}}" d="M86.5,57.5c-3.1-1.9-6.4-2.8-9.8-2.8c-0.5,0-0.9,0-1.4,0c-0.4,0-0.8,0-1.1,0c-2.1,0-4.2-0.4-6.2-1.2 c-0.8-3.6-2.8-6.9-5.4-9.3c0.4-2.5,1.3-4.8,2.7-6.9c2-2.9,3.2-6.5,3.2-10.4c0-10.2-8.2-18.4-18.4-18.4c-0.3,0-0.6,0-0.9,0 C39.7,9,32,16.8,31.6,26.2c-0.2,4.1,1,7.9,3.2,11c1.4,2.1,2.3,4.5,2.7,6.9c-2.6,2.5-4.6,5.7-5.4,9.3c-1.9,0.7-4,1.1-6.1,1.1 c-0.4,0-0.8,0-1.2,0c-0.5,0-0.9-0.1-1.4-0.1c-3.1,0-6.3,0.8-9.2,2.5c-9.1,5.2-12,17-6.3,25.9c3.5,5.4,9.5,8.4,15.6,8.4 c2.9,0,5.8-0.7,8.5-2.1c3.6-1.9,6.3-4.9,8-8.3c1.1-2.3,2.7-4.2,4.6-5.8c1.7,0.5,3.5,0.8,5.4,0.8c1.9,0,3.7-0.3,5.4-0.8 c1.9,1.6,3.5,3.5,4.6,5.7c1.5,3.2,4,6,7.4,8c2.9,1.7,6.1,2.5,9.2,2.5c6.6,0,13.1-3.6,16.4-10C97.3,73.1,94.4,62.5,86.5,57.5z M29.6,83.7c-1.9,1.1-4,1.6-6.1,1.6c-4.2,0-8.4-2.2-10.6-6.1c-3.4-5.9-1.4-13.4,4.5-16.8c1.9-1.1,4-1.6,6.1-1.6 c4.2,0,8.4,2.2,10.6,6.1C37.5,72.8,35.4,80.3,29.6,83.7z M50,39.3c-6.8,0-12.3-5.5-12.3-12.3S43.2,14.7,50,14.7 c6.8,0,12.3,5.5,12.3,12.3S56.8,39.3,50,39.3z M87.2,79.2c-2.3,3.9-6.4,6.1-10.6,6.1c-2.1,0-4.2-0.5-6.1-1.6 c-5.9-3.4-7.9-10.9-4.5-16.8c2.3-3.9,6.4-6.1,10.6-6.1c2.1,0,4.2,0.5,6.1,1.6C88.6,65.8,90.6,73.3,87.2,79.2z" fill="#3be8b0" /> </g> </g> </g> <animateTransform attributeName="transform" type="rotate" calcMode="linear" values="0 50 50;360 50 50" keyTimes="0;1" dur="1s" begin="0s" repeatCount="indefinite" /> </g> </svg> )
2,677
1,847
/** * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.9 * Copyright (C) 2020 Oliver Nightingale * @license MIT */ !function(){var e=function(t){var r=new e.Builder;return r.pipeline.add(e.trimmer,e.stopWordFilter,e.stemmer),r.searchPipeline.add(e.stemmer),t.call(r,r),r.build()};e.version="2.3.9",e.utils={},e.utils.warn=function(e){return function(t){e.console&&console.warn&&console.warn(t)}}(this),e.utils.asString=function(e){return void 0===e||null===e?"":e.toString()},e.utils.clone=function(e){if(null===e||void 0===e)return e;for(var t=Object.create(null),r=Object.keys(e),i=0;i<r.length;i++){var n=r[i],s=e[n];if(Array.isArray(s))t[n]=s.slice();else{if("string"!=typeof s&&"number"!=typeof s&&"boolean"!=typeof s)throw new TypeError("clone is not deep and does not support nested objects");t[n]=s}}return t},e.FieldRef=function(e,t,r){this.docRef=e,this.fieldName=t,this._stringValue=r},e.FieldRef.joiner="/",e.FieldRef.fromString=function(t){var r=t.indexOf(e.FieldRef.joiner);if(r===-1)throw"malformed field ref string";var i=t.slice(0,r),n=t.slice(r+1);return new e.FieldRef(n,i,t)},e.FieldRef.prototype.toString=function(){return void 0==this._stringValue&&(this._stringValue=this.fieldName+e.FieldRef.joiner+this.docRef),this._stringValue},e.Set=function(e){if(this.elements=Object.create(null),e){this.length=e.length;for(var t=0;t<this.length;t++)this.elements[e[t]]=!0}else this.length=0},e.Set.complete={intersect:function(e){return e},union:function(){return this},contains:function(){return!0}},e.Set.empty={intersect:function(){return this},union:function(e){return e},contains:function(){return!1}},e.Set.prototype.contains=function(e){return!!this.elements[e]},e.Set.prototype.intersect=function(t){var r,i,n,s=[];if(t===e.Set.complete)return this;if(t===e.Set.empty)return t;this.length<t.length?(r=this,i=t):(r=t,i=this),n=Object.keys(r.elements);for(var o=0;o<n.length;o++){var a=n[o];a in i.elements&&s.push(a)}return new e.Set(s)},e.Set.prototype.union=function(t){return t===e.Set.complete?e.Set.complete:t===e.Set.empty?this:new e.Set(Object.keys(this.elements).concat(Object.keys(t.elements)))},e.idf=function(e,t){var r=0;for(var i in e)"_index"!=i&&(r+=Object.keys(e[i]).length);var n=(t-r+.5)/(r+.5);return Math.log(1+Math.abs(n))},e.Token=function(e,t){this.str=e||"",this.metadata=t||{}},e.Token.prototype.toString=function(){return this.str},e.Token.prototype.update=function(e){return this.str=e(this.str,this.metadata),this},e.Token.prototype.clone=function(t){return t=t||function(e){return e},new e.Token(t(this.str,this.metadata),this.metadata)},e.tokenizer=function(t,r){if(null==t||void 0==t)return[];if(Array.isArray(t))return t.map(function(t){return new e.Token(e.utils.asString(t).toLowerCase(),e.utils.clone(r))});for(var i=t.toString().toLowerCase(),n=i.length,s=[],o=0,a=0;o<=n;o++){var u=i.charAt(o),l=o-a;if(u.match(e.tokenizer.separator)||o==n){if(l>0){var c=e.utils.clone(r)||{};c.position=[a,l],c.index=s.length,s.push(new e.Token(i.slice(a,o),c))}a=o+1}}return s},e.tokenizer.separator=/[\s\-]+/,e.Pipeline=function(){this._stack=[]},e.Pipeline.registeredFunctions=Object.create(null),e.Pipeline.registerFunction=function(t,r){r in this.registeredFunctions&&e.utils.warn("Overwriting existing registered function: "+r),t.label=r,e.Pipeline.registeredFunctions[t.label]=t},e.Pipeline.warnIfFunctionNotRegistered=function(t){var r=t.label&&t.label in this.registeredFunctions;r||e.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",t)},e.Pipeline.load=function(t){var r=new e.Pipeline;return t.forEach(function(t){var i=e.Pipeline.registeredFunctions[t];if(!i)throw new Error("Cannot load unregistered function: "+t);r.add(i)}),r},e.Pipeline.prototype.add=function(){var t=Array.prototype.slice.call(arguments);t.forEach(function(t){e.Pipeline.warnIfFunctionNotRegistered(t),this._stack.push(t)},this)},e.Pipeline.prototype.after=function(t,r){e.Pipeline.warnIfFunctionNotRegistered(r);var i=this._stack.indexOf(t);if(i==-1)throw new Error("Cannot find existingFn");i+=1,this._stack.splice(i,0,r)},e.Pipeline.prototype.before=function(t,r){e.Pipeline.warnIfFunctionNotRegistered(r);var i=this._stack.indexOf(t);if(i==-1)throw new Error("Cannot find existingFn");this._stack.splice(i,0,r)},e.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);t!=-1&&this._stack.splice(t,1)},e.Pipeline.prototype.run=function(e){for(var t=this._stack.length,r=0;r<t;r++){for(var i=this._stack[r],n=[],s=0;s<e.length;s++){var o=i(e[s],s,e);if(null!==o&&void 0!==o&&""!==o)if(Array.isArray(o))for(var a=0;a<o.length;a++)n.push(o[a]);else n.push(o)}e=n}return e},e.Pipeline.prototype.runString=function(t,r){var i=new e.Token(t,r);return this.run([i]).map(function(e){return e.toString()})},e.Pipeline.prototype.reset=function(){this._stack=[]},e.Pipeline.prototype.toJSON=function(){return this._stack.map(function(t){return e.Pipeline.warnIfFunctionNotRegistered(t),t.label})},e.Vector=function(e){this._magnitude=0,this.elements=e||[]},e.Vector.prototype.positionForIndex=function(e){if(0==this.elements.length)return 0;for(var t=0,r=this.elements.length/2,i=r-t,n=Math.floor(i/2),s=this.elements[2*n];i>1&&(s<e&&(t=n),s>e&&(r=n),s!=e);)i=r-t,n=t+Math.floor(i/2),s=this.elements[2*n];return s==e?2*n:s>e?2*n:s<e?2*(n+1):void 0},e.Vector.prototype.insert=function(e,t){this.upsert(e,t,function(){throw"duplicate index"})},e.Vector.prototype.upsert=function(e,t,r){this._magnitude=0;var i=this.positionForIndex(e);this.elements[i]==e?this.elements[i+1]=r(this.elements[i+1],t):this.elements.splice(i,0,e,t)},e.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var e=0,t=this.elements.length,r=1;r<t;r+=2){var i=this.elements[r];e+=i*i}return this._magnitude=Math.sqrt(e)},e.Vector.prototype.dot=function(e){for(var t=0,r=this.elements,i=e.elements,n=r.length,s=i.length,o=0,a=0,u=0,l=0;u<n&&l<s;)o=r[u],a=i[l],o<a?u+=2:o>a?l+=2:o==a&&(t+=r[u+1]*i[l+1],u+=2,l+=2);return t},e.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},e.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),t=1,r=0;t<this.elements.length;t+=2,r++)e[r]=this.elements[t];return e},e.Vector.prototype.toJSON=function(){return this.elements},e.stemmer=function(){var e={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},t={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},r="[^aeiou]",i="[aeiouy]",n=r+"[^aeiouy]*",s=i+"[aeiou]*",o="^("+n+")?"+s+n,a="^("+n+")?"+s+n+"("+s+")?$",u="^("+n+")?"+s+n+s+n,l="^("+n+")?"+i,c=new RegExp(o),h=new RegExp(u),d=new RegExp(a),f=new RegExp(l),p=/^(.+?)(ss|i)es$/,y=/^(.+?)([^s])s$/,m=/^(.+?)eed$/,v=/^(.+?)(ed|ing)$/,g=/.$/,x=/(at|bl|iz)$/,w=new RegExp("([^aeiouylsz])\\1$"),Q=new RegExp("^"+n+i+"[^aeiouwxy]$"),k=/^(.+?[^aeiou])y$/,S=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,E=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,L=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,b=/^(.+?)(s|t)(ion)$/,P=/^(.+?)e$/,T=/ll$/,O=new RegExp("^"+n+i+"[^aeiouwxy]$"),I=function(r){var i,n,s,o,a,u,l;if(r.length<3)return r;if(s=r.substr(0,1),"y"==s&&(r=s.toUpperCase()+r.substr(1)),o=p,a=y,o.test(r)?r=r.replace(o,"$1$2"):a.test(r)&&(r=r.replace(a,"$1$2")),o=m,a=v,o.test(r)){var I=o.exec(r);o=c,o.test(I[1])&&(o=g,r=r.replace(o,""))}else if(a.test(r)){var I=a.exec(r);i=I[1],a=f,a.test(i)&&(r=i,a=x,u=w,l=Q,a.test(r)?r+="e":u.test(r)?(o=g,r=r.replace(o,"")):l.test(r)&&(r+="e"))}if(o=k,o.test(r)){var I=o.exec(r);i=I[1],r=i+"i"}if(o=S,o.test(r)){var I=o.exec(r);i=I[1],n=I[2],o=c,o.test(i)&&(r=i+e[n])}if(o=E,o.test(r)){var I=o.exec(r);i=I[1],n=I[2],o=c,o.test(i)&&(r=i+t[n])}if(o=L,a=b,o.test(r)){var I=o.exec(r);i=I[1],o=h,o.test(i)&&(r=i)}else if(a.test(r)){var I=a.exec(r);i=I[1]+I[2],a=h,a.test(i)&&(r=i)}if(o=P,o.test(r)){var I=o.exec(r);i=I[1],o=h,a=d,u=O,(o.test(i)||a.test(i)&&!u.test(i))&&(r=i)}return o=T,a=h,o.test(r)&&a.test(r)&&(o=g,r=r.replace(o,"")),"y"==s&&(r=s.toLowerCase()+r.substr(1)),r};return function(e){return e.update(I)}}(),e.Pipeline.registerFunction(e.stemmer,"stemmer"),e.generateStopWordFilter=function(e){var t=e.reduce(function(e,t){return e[t]=t,e},{});return function(e){if(e&&t[e.toString()]!==e.toString())return e}},e.stopWordFilter=e.generateStopWordFilter(["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]),e.Pipeline.registerFunction(e.stopWordFilter,"stopWordFilter"),e.trimmer=function(e){return e.update(function(e){return e.replace(/^\W+/,"").replace(/\W+$/,"")})},e.Pipeline.registerFunction(e.trimmer,"trimmer"),e.TokenSet=function(){this["final"]=!1,this.edges={},this.id=e.TokenSet._nextId,e.TokenSet._nextId+=1},e.TokenSet._nextId=1,e.TokenSet.fromArray=function(t){for(var r=new e.TokenSet.Builder,i=0,n=t.length;i<n;i++)r.insert(t[i]);return r.finish(),r.root},e.TokenSet.fromClause=function(t){return"editDistance"in t?e.TokenSet.fromFuzzyString(t.term,t.editDistance):e.TokenSet.fromString(t.term)},e.TokenSet.fromFuzzyString=function(t,r){for(var i=new e.TokenSet,n=[{node:i,editsRemaining:r,str:t}];n.length;){var s=n.pop();if(s.str.length>0){var o,a=s.str.charAt(0);a in s.node.edges?o=s.node.edges[a]:(o=new e.TokenSet,s.node.edges[a]=o),1==s.str.length&&(o["final"]=!0),n.push({node:o,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(0!=s.editsRemaining){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new e.TokenSet;s.node.edges["*"]=u}if(0==s.str.length&&(u["final"]=!0),n.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&n.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),1==s.str.length&&(s.node["final"]=!0),s.str.length>=1){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new e.TokenSet;s.node.edges["*"]=l}1==s.str.length&&(l["final"]=!0),n.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var c,h=s.str.charAt(0),d=s.str.charAt(1);d in s.node.edges?c=s.node.edges[d]:(c=new e.TokenSet,s.node.edges[d]=c),1==s.str.length&&(c["final"]=!0),n.push({node:c,editsRemaining:s.editsRemaining-1,str:h+s.str.slice(2)})}}}return i},e.TokenSet.fromString=function(t){for(var r=new e.TokenSet,i=r,n=0,s=t.length;n<s;n++){var o=t[n],a=n==s-1;if("*"==o)r.edges[o]=r,r["final"]=a;else{var u=new e.TokenSet;u["final"]=a,r.edges[o]=u,r=u}}return i},e.TokenSet.prototype.toArray=function(){for(var e=[],t=[{prefix:"",node:this}];t.length;){var r=t.pop(),i=Object.keys(r.node.edges),n=i.length;r.node["final"]&&(r.prefix.charAt(0),e.push(r.prefix));for(var s=0;s<n;s++){var o=i[s];t.push({prefix:r.prefix.concat(o),node:r.node.edges[o]})}}return e},e.TokenSet.prototype.toString=function(){if(this._str)return this._str;for(var e=this["final"]?"1":"0",t=Object.keys(this.edges).sort(),r=t.length,i=0;i<r;i++){var n=t[i],s=this.edges[n];e=e+n+s.id}return e},e.TokenSet.prototype.intersect=function(t){for(var r=new e.TokenSet,i=void 0,n=[{qNode:t,output:r,node:this}];n.length;){i=n.pop();for(var s=Object.keys(i.qNode.edges),o=s.length,a=Object.keys(i.node.edges),u=a.length,l=0;l<o;l++)for(var c=s[l],h=0;h<u;h++){var d=a[h];if(d==c||"*"==c){var f=i.node.edges[d],p=i.qNode.edges[c],y=f["final"]&&p["final"],m=void 0;d in i.output.edges?(m=i.output.edges[d],m["final"]=m["final"]||y):(m=new e.TokenSet,m["final"]=y,i.output.edges[d]=m),n.push({qNode:p,output:m,node:f})}}}return r},e.TokenSet.Builder=function(){this.previousWord="",this.root=new e.TokenSet,this.uncheckedNodes=[],this.minimizedNodes={}},e.TokenSet.Builder.prototype.insert=function(t){var r,i=0;if(t<this.previousWord)throw new Error("Out of order word insertion");for(var n=0;n<t.length&&n<this.previousWord.length&&t[n]==this.previousWord[n];n++)i++;this.minimize(i),r=0==this.uncheckedNodes.length?this.root:this.uncheckedNodes[this.uncheckedNodes.length-1].child;for(var n=i;n<t.length;n++){var s=new e.TokenSet,o=t[n];r.edges[o]=s,this.uncheckedNodes.push({parent:r,"char":o,child:s}),r=s}r["final"]=!0,this.previousWord=t},e.TokenSet.Builder.prototype.finish=function(){this.minimize(0)},e.TokenSet.Builder.prototype.minimize=function(e){for(var t=this.uncheckedNodes.length-1;t>=e;t--){var r=this.uncheckedNodes[t],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r["char"]]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}},e.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},e.Index.prototype.search=function(t){return this.query(function(r){var i=new e.QueryParser(t,r);i.parse()})},e.Index.prototype.query=function(t){for(var r=new e.Query(this.fields),i=Object.create(null),n=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),u=0;u<this.fields.length;u++)n[this.fields[u]]=new e.Vector;t.call(r,r);for(var u=0;u<r.clauses.length;u++){var l=r.clauses[u],c=null,h=e.Set.empty;c=l.usePipeline?this.pipeline.runString(l.term,{fields:l.fields}):[l.term];for(var d=0;d<c.length;d++){var f=c[d];l.term=f;var p=e.TokenSet.fromClause(l),y=this.tokenSet.intersect(p).toArray();if(0===y.length&&l.presence===e.Query.presence.REQUIRED){for(var m=0;m<l.fields.length;m++){var v=l.fields[m];o[v]=e.Set.empty}break}for(var g=0;g<y.length;g++)for(var x=y[g],w=this.invertedIndex[x],Q=w._index,m=0;m<l.fields.length;m++){var v=l.fields[m],k=w[v],S=Object.keys(k),E=x+"/"+v,L=new e.Set(S);if(l.presence==e.Query.presence.REQUIRED&&(h=h.union(L),void 0===o[v]&&(o[v]=e.Set.complete)),l.presence!=e.Query.presence.PROHIBITED){if(n[v].upsert(Q,l.boost,function(e,t){return e+t}),!s[E]){for(var b=0;b<S.length;b++){var P,T=S[b],O=new e.FieldRef(T,v),I=k[T];void 0===(P=i[O])?i[O]=new e.MatchData(x,v,I):P.add(x,v,I)}s[E]=!0}}else void 0===a[v]&&(a[v]=e.Set.empty),a[v]=a[v].union(L)}}if(l.presence===e.Query.presence.REQUIRED)for(var m=0;m<l.fields.length;m++){var v=l.fields[m];o[v]=o[v].intersect(h)}}for(var R=e.Set.complete,F=e.Set.empty,u=0;u<this.fields.length;u++){var v=this.fields[u];o[v]&&(R=R.intersect(o[v])),a[v]&&(F=F.union(a[v]))}var C=Object.keys(i),N=[],_=Object.create(null);if(r.isNegated()){C=Object.keys(this.fieldVectors);for(var u=0;u<C.length;u++){var O=C[u],j=e.FieldRef.fromString(O);i[O]=new e.MatchData}}for(var u=0;u<C.length;u++){var j=e.FieldRef.fromString(C[u]),D=j.docRef;if(R.contains(D)&&!F.contains(D)){var A,B=this.fieldVectors[j],V=n[j.fieldName].similarity(B);if(void 0!==(A=_[D]))A.score+=V,A.matchData.combine(i[j]);else{var z={ref:D,score:V,matchData:i[j]};_[D]=z,N.push(z)}}}return N.sort(function(e,t){return t.score-e.score})},e.Index.prototype.toJSON=function(){var t=Object.keys(this.invertedIndex).sort().map(function(e){return[e,this.invertedIndex[e]]},this),r=Object.keys(this.fieldVectors).map(function(e){return[e,this.fieldVectors[e].toJSON()]},this);return{version:e.version,fields:this.fields,fieldVectors:r,invertedIndex:t,pipeline:this.pipeline.toJSON()}},e.Index.load=function(t){var r={},i={},n=t.fieldVectors,s=Object.create(null),o=t.invertedIndex,a=new e.TokenSet.Builder,u=e.Pipeline.load(t.pipeline);t.version!=e.version&&e.utils.warn("Version mismatch when loading serialised index. Current version of lunr '"+e.version+"' does not match serialized index '"+t.version+"'");for(var l=0;l<n.length;l++){var c=n[l],h=c[0],d=c[1];i[h]=new e.Vector(d)}for(var l=0;l<o.length;l++){var c=o[l],f=c[0],p=c[1];a.insert(f),s[f]=p}return a.finish(),r.fields=t.fields,r.fieldVectors=i,r.invertedIndex=s,r.tokenSet=a.root,r.pipeline=u,new e.Index(r)},e.Builder=function(){this._ref="id",this._fields=Object.create(null),this._documents=Object.create(null),this.invertedIndex=Object.create(null),this.fieldTermFrequencies={},this.fieldLengths={},this.tokenizer=e.tokenizer,this.pipeline=new e.Pipeline,this.searchPipeline=new e.Pipeline,this.documentCount=0,this._b=.75,this._k1=1.2,this.termIndex=0,this.metadataWhitelist=[]},e.Builder.prototype.ref=function(e){this._ref=e},e.Builder.prototype.field=function(e,t){if(/\//.test(e))throw new RangeError("Field '"+e+"' contains illegal character '/'");this._fields[e]=t||{}},e.Builder.prototype.b=function(e){e<0?this._b=0:e>1?this._b=1:this._b=e},e.Builder.prototype.k1=function(e){this._k1=e},e.Builder.prototype.add=function(t,r){var i=t[this._ref],n=Object.keys(this._fields);this._documents[i]=r||{},this.documentCount+=1;for(var s=0;s<n.length;s++){var o=n[s],a=this._fields[o].extractor,u=a?a(t):t[o],l=this.tokenizer(u,{fields:[o]}),c=this.pipeline.run(l),h=new e.FieldRef(i,o),d=Object.create(null);this.fieldTermFrequencies[h]=d,this.fieldLengths[h]=0,this.fieldLengths[h]+=c.length;for(var f=0;f<c.length;f++){var p=c[f];if(void 0==d[p]&&(d[p]=0),d[p]+=1,void 0==this.invertedIndex[p]){var y=Object.create(null);y._index=this.termIndex,this.termIndex+=1;for(var m=0;m<n.length;m++)y[n[m]]=Object.create(null);this.invertedIndex[p]=y}void 0==this.invertedIndex[p][o][i]&&(this.invertedIndex[p][o][i]=Object.create(null));for(var v=0;v<this.metadataWhitelist.length;v++){var g=this.metadataWhitelist[v],x=p.metadata[g];void 0==this.invertedIndex[p][o][i][g]&&(this.invertedIndex[p][o][i][g]=[]),this.invertedIndex[p][o][i][g].push(x)}}}},e.Builder.prototype.calculateAverageFieldLengths=function(){for(var t=Object.keys(this.fieldLengths),r=t.length,i={},n={},s=0;s<r;s++){var o=e.FieldRef.fromString(t[s]),a=o.fieldName;n[a]||(n[a]=0),n[a]+=1,i[a]||(i[a]=0),i[a]+=this.fieldLengths[o]}for(var u=Object.keys(this._fields),s=0;s<u.length;s++){var l=u[s];i[l]=i[l]/n[l]}this.averageFieldLength=i},e.Builder.prototype.createFieldVectors=function(){for(var t={},r=Object.keys(this.fieldTermFrequencies),i=r.length,n=Object.create(null),s=0;s<i;s++){for(var o=e.FieldRef.fromString(r[s]),a=o.fieldName,u=this.fieldLengths[o],l=new e.Vector,c=this.fieldTermFrequencies[o],h=Object.keys(c),d=h.length,f=this._fields[a].boost||1,p=this._documents[o.docRef].boost||1,y=0;y<d;y++){var m,v,g,x=h[y],w=c[x],Q=this.invertedIndex[x]._index;void 0===n[x]?(m=e.idf(this.invertedIndex[x],this.documentCount),n[x]=m):m=n[x],v=m*((this._k1+1)*w)/(this._k1*(1-this._b+this._b*(u/this.averageFieldLength[a]))+w),v*=f,v*=p,g=Math.round(1e3*v)/1e3,l.insert(Q,g)}t[o]=l}this.fieldVectors=t},e.Builder.prototype.createTokenSet=function(){this.tokenSet=e.TokenSet.fromArray(Object.keys(this.invertedIndex).sort())},e.Builder.prototype.build=function(){return this.calculateAverageFieldLengths(),this.createFieldVectors(),this.createTokenSet(),new e.Index({invertedIndex:this.invertedIndex,fieldVectors:this.fieldVectors,tokenSet:this.tokenSet,fields:Object.keys(this._fields),pipeline:this.searchPipeline})},e.Builder.prototype.use=function(e){var t=Array.prototype.slice.call(arguments,1);t.unshift(this),e.apply(this,t)},e.MatchData=function(e,t,r){for(var i=Object.create(null),n=Object.keys(r||{}),s=0;s<n.length;s++){var o=n[s];i[o]=r[o].slice()}this.metadata=Object.create(null),void 0!==e&&(this.metadata[e]=Object.create(null),this.metadata[e][t]=i)},e.MatchData.prototype.combine=function(e){for(var t=Object.keys(e.metadata),r=0;r<t.length;r++){var i=t[r],n=Object.keys(e.metadata[i]);void 0==this.metadata[i]&&(this.metadata[i]=Object.create(null));for(var s=0;s<n.length;s++){var o=n[s],a=Object.keys(e.metadata[i][o]);void 0==this.metadata[i][o]&&(this.metadata[i][o]=Object.create(null));for(var u=0;u<a.length;u++){var l=a[u];void 0==this.metadata[i][o][l]?this.metadata[i][o][l]=e.metadata[i][o][l]:this.metadata[i][o][l]=this.metadata[i][o][l].concat(e.metadata[i][o][l])}}}},e.MatchData.prototype.add=function(e,t,r){if(!(e in this.metadata))return this.metadata[e]=Object.create(null),void(this.metadata[e][t]=r);if(!(t in this.metadata[e]))return void(this.metadata[e][t]=r);for(var i=Object.keys(r),n=0;n<i.length;n++){var s=i[n];s in this.metadata[e][t]?this.metadata[e][t][s]=this.metadata[e][t][s].concat(r[s]):this.metadata[e][t][s]=r[s]}},e.Query=function(e){this.clauses=[],this.allFields=e},e.Query.wildcard=new String("*"),e.Query.wildcard.NONE=0,e.Query.wildcard.LEADING=1,e.Query.wildcard.TRAILING=2,e.Query.presence={OPTIONAL:1,REQUIRED:2,PROHIBITED:3},e.Query.prototype.clause=function(t){return"fields"in t||(t.fields=this.allFields),"boost"in t||(t.boost=1),"usePipeline"in t||(t.usePipeline=!0),"wildcard"in t||(t.wildcard=e.Query.wildcard.NONE),t.wildcard&e.Query.wildcard.LEADING&&t.term.charAt(0)!=e.Query.wildcard&&(t.term="*"+t.term),t.wildcard&e.Query.wildcard.TRAILING&&t.term.slice(-1)!=e.Query.wildcard&&(t.term=""+t.term+"*"),"presence"in t||(t.presence=e.Query.presence.OPTIONAL),this.clauses.push(t),this},e.Query.prototype.isNegated=function(){for(var t=0;t<this.clauses.length;t++)if(this.clauses[t].presence!=e.Query.presence.PROHIBITED)return!1;return!0},e.Query.prototype.term=function(t,r){if(Array.isArray(t))return t.forEach(function(t){this.term(t,e.utils.clone(r))},this),this;var i=r||{};return i.term=t.toString(),this.clause(i),this},e.QueryParseError=function(e,t,r){this.name="QueryParseError",this.message=e,this.start=t,this.end=r},e.QueryParseError.prototype=new Error,e.QueryLexer=function(e){this.lexemes=[],this.str=e,this.length=e.length,this.pos=0,this.start=0,this.escapeCharPositions=[]},e.QueryLexer.prototype.run=function(){for(var t=e.QueryLexer.lexText;t;)t=t(this)},e.QueryLexer.prototype.sliceString=function(){for(var e=[],t=this.start,r=this.pos,i=0;i<this.escapeCharPositions.length;i++)r=this.escapeCharPositions[i],e.push(this.str.slice(t,r)),t=r+1;return e.push(this.str.slice(t,this.pos)),this.escapeCharPositions.length=0,e.join("")},e.QueryLexer.prototype.emit=function(e){this.lexemes.push({type:e,str:this.sliceString(),start:this.start,end:this.pos}),this.start=this.pos},e.QueryLexer.prototype.escapeCharacter=function(){this.escapeCharPositions.push(this.pos-1),this.pos+=1},e.QueryLexer.prototype.next=function(){if(this.pos>=this.length)return e.QueryLexer.EOS;var t=this.str.charAt(this.pos);return this.pos+=1,t},e.QueryLexer.prototype.width=function(){return this.pos-this.start},e.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},e.QueryLexer.prototype.backup=function(){this.pos-=1},e.QueryLexer.prototype.acceptDigitRun=function(){var t,r;do t=this.next(),r=t.charCodeAt(0);while(r>47&&r<58);t!=e.QueryLexer.EOS&&this.backup()},e.QueryLexer.prototype.more=function(){return this.pos<this.length},e.QueryLexer.EOS="EOS",e.QueryLexer.FIELD="FIELD",e.QueryLexer.TERM="TERM",e.QueryLexer.EDIT_DISTANCE="EDIT_DISTANCE",e.QueryLexer.BOOST="BOOST",e.QueryLexer.PRESENCE="PRESENCE",e.QueryLexer.lexField=function(t){return t.backup(),t.emit(e.QueryLexer.FIELD),t.ignore(),e.QueryLexer.lexText},e.QueryLexer.lexTerm=function(t){if(t.width()>1&&(t.backup(),t.emit(e.QueryLexer.TERM)),t.ignore(),t.more())return e.QueryLexer.lexText},e.QueryLexer.lexEditDistance=function(t){return t.ignore(),t.acceptDigitRun(),t.emit(e.QueryLexer.EDIT_DISTANCE),e.QueryLexer.lexText},e.QueryLexer.lexBoost=function(t){return t.ignore(),t.acceptDigitRun(),t.emit(e.QueryLexer.BOOST),e.QueryLexer.lexText},e.QueryLexer.lexEOS=function(t){t.width()>0&&t.emit(e.QueryLexer.TERM)},e.QueryLexer.termSeparator=e.tokenizer.separator,e.QueryLexer.lexText=function(t){for(;;){var r=t.next();if(r==e.QueryLexer.EOS)return e.QueryLexer.lexEOS;if(92!=r.charCodeAt(0)){if(":"==r)return e.QueryLexer.lexField;if("~"==r)return t.backup(),t.width()>0&&t.emit(e.QueryLexer.TERM),e.QueryLexer.lexEditDistance;if("^"==r)return t.backup(),t.width()>0&&t.emit(e.QueryLexer.TERM),e.QueryLexer.lexBoost;if("+"==r&&1===t.width())return t.emit(e.QueryLexer.PRESENCE),e.QueryLexer.lexText;if("-"==r&&1===t.width())return t.emit(e.QueryLexer.PRESENCE),e.QueryLexer.lexText;if(r.match(e.QueryLexer.termSeparator))return e.QueryLexer.lexTerm}else t.escapeCharacter()}},e.QueryParser=function(t,r){this.lexer=new e.QueryLexer(t),this.query=r,this.currentClause={},this.lexemeIdx=0},e.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var t=e.QueryParser.parseClause;t;)t=t(this);return this.query},e.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},e.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},e.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},e.QueryParser.parseClause=function(t){var r=t.peekLexeme();if(void 0!=r)switch(r.type){case e.QueryLexer.PRESENCE:return e.QueryParser.parsePresence;case e.QueryLexer.FIELD:return e.QueryParser.parseField;case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var i="expected either a field or a term, found "+r.type;throw r.str.length>=1&&(i+=" with value '"+r.str+"'"),new e.QueryParseError(i,r.start,r.end)}},e.QueryParser.parsePresence=function(t){var r=t.consumeLexeme();if(void 0!=r){switch(r.str){case"-":t.currentClause.presence=e.Query.presence.PROHIBITED;break;case"+":t.currentClause.presence=e.Query.presence.REQUIRED;break;default:var i="unrecognised presence operator'"+r.str+"'";throw new e.QueryParseError(i,r.start,r.end)}var n=t.peekLexeme();if(void 0==n){var i="expecting term or field, found nothing";throw new e.QueryParseError(i,r.start,r.end)}switch(n.type){case e.QueryLexer.FIELD:return e.QueryParser.parseField;case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var i="expecting term or field, found '"+n.type+"'";throw new e.QueryParseError(i,n.start,n.end)}}},e.QueryParser.parseField=function(t){var r=t.consumeLexeme();if(void 0!=r){if(t.query.allFields.indexOf(r.str)==-1){var i=t.query.allFields.map(function(e){return"'"+e+"'"}).join(", "),n="unrecognised field '"+r.str+"', possible fields: "+i;throw new e.QueryParseError(n,r.start,r.end)}t.currentClause.fields=[r.str];var s=t.peekLexeme();if(void 0==s){var n="expecting term, found nothing";throw new e.QueryParseError(n,r.start,r.end)}switch(s.type){case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var n="expecting term, found '"+s.type+"'";throw new e.QueryParseError(n,s.start,s.end)}}},e.QueryParser.parseTerm=function(t){var r=t.consumeLexeme();if(void 0!=r){t.currentClause.term=r.str.toLowerCase(),r.str.indexOf("*")!=-1&&(t.currentClause.usePipeline=!1);var i=t.peekLexeme();if(void 0==i)return void t.nextClause();switch(i.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;case e.QueryLexer.PRESENCE:return t.nextClause(),e.QueryParser.parsePresence;default:var n="Unexpected lexeme type '"+i.type+"'";throw new e.QueryParseError(n,i.start,i.end)}}},e.QueryParser.parseEditDistance=function(t){var r=t.consumeLexeme();if(void 0!=r){var i=parseInt(r.str,10);if(isNaN(i)){var n="edit distance must be numeric";throw new e.QueryParseError(n,r.start,r.end)}t.currentClause.editDistance=i;var s=t.peekLexeme();if(void 0==s)return void t.nextClause();switch(s.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;case e.QueryLexer.PRESENCE:return t.nextClause(),e.QueryParser.parsePresence;default:var n="Unexpected lexeme type '"+s.type+"'";throw new e.QueryParseError(n,s.start,s.end)}}},e.QueryParser.parseBoost=function(t){var r=t.consumeLexeme();if(void 0!=r){var i=parseInt(r.str,10);if(isNaN(i)){var n="boost must be numeric";throw new e.QueryParseError(n,r.start,r.end)}t.currentClause.boost=i;var s=t.peekLexeme();if(void 0==s)return void t.nextClause();switch(s.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;case e.QueryLexer.PRESENCE:return t.nextClause(),e.QueryParser.parsePresence;default:var n="Unexpected lexeme type '"+s.type+"'";throw new e.QueryParseError(n,s.start,s.end)}}},function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.lunr=t()}(this,function(){return e})}();
29,510
12,713
import React from 'react'; import styled from '@emotion/styled'; import Tile from '../Tile'; import { getAvatarById } from '../../shared/avatars'; import { StyledText, transparent } from '../../design/shared-styles'; import { useSelector } from 'react-redux'; const TileUserProfile = () => { const isConnected = useSelector((state) => state.chat.isConnected); const user = useSelector((state) => state.chat.user); const avatar = getAvatarById(user.avatarId); return ( <Tile appearance={transparent}> <AvatarWrapper> <Avatar image={avatar.image} isConnected={isConnected} role="img" aria-label={avatar.name} /> </AvatarWrapper> <Username>{user.username}</Username> <Brand>Mediaan Masterclass 2020</Brand> </Tile> ); }; export default TileUserProfile; const AvatarWrapper = styled.div` display: flex; margin-bottom: ${({ theme }) => theme.spacing.md}; `; const Avatar = styled.div` position: relative; width: 100px; height: 100px; margin: 0 auto; border-radius: 50%; background-image: ${({ image }) => `url('${image}')`}; background-size: cover; background-position: center; &:after { content: ''; z-index: 1; position: absolute; top: 0; right: -10px; display: block; width: 30px; height: 30px; border: 7px solid ${({ theme }) => theme.color.background}; border-radius: 50%; background-color: ${({ isConnected, theme }) => (isConnected ? theme.color.lima : theme.color.rose)}; } `; const Username = styled(StyledText)` margin-bottom: ${({ theme }) => theme.spacing.sm}; text-align: center; color: ${({ theme }) => theme.color.white}; `; const Brand = styled.p` font-size: 0.8rem; line-height: 1.2rem; text-align: center; color: ${({ theme }) => theme.color.sapphire}; `;
1,809
644
import { useStaticQuery, graphql } from "gatsby" export default assetUrl => { const { allContentfulAsset } = useStaticQuery(graphql` query { allContentfulAsset { nodes { file { url } fluid(maxWidth: 785) { ...GatsbyContentfulFluid_withWebp } } } } `) return allContentfulAsset.nodes.find(n => n.file.url === assetUrl).fluid }
483
136
import React, { Component } from "react"; import { requireNativeComponent, View, UIManager, findNodeHandle, DeviceEventEmitter } from "react-native"; import PropTypes from "prop-types"; class SketchView extends Component { constructor(props) { super(props); this.onChange = this.onChange.bind(this); this.subscriptions = []; } onChange(event) { console.log("save event: ", event.nativeEvent); if (event.nativeEvent.type === "onSaveSketch") { if (!this.props.onSaveSketch) { return; } this.props.onSaveSketch({ localFilePath: event.nativeEvent.event.localFilePath, imageWidth: event.nativeEvent.event.imageWidth, imageHeight: event.nativeEvent.event.imageHeight }); } } componentDidMount() { if (this.props.onSaveSketch) { let sub = DeviceEventEmitter.addListener( "onSaveSketch", this.props.onSaveSketch ); this.subscriptions.push(sub); } } componentWillUnmount() { this.subscriptions.forEach(sub => sub.remove()); this.subscriptions = []; } render() { return <RNSketchView {...this.props} onChange={this.onChange} />; } clearSketch() { UIManager.dispatchViewManagerCommand( findNodeHandle(this), UIManager.RNSketchView.Commands.clearSketch, [] ); } saveSketch() { UIManager.dispatchViewManagerCommand( findNodeHandle(this), UIManager.RNSketchView.Commands.saveSketch, [] ); } changeTool(toolId) { UIManager.dispatchViewManagerCommand( findNodeHandle(this), UIManager.RNSketchView.Commands.changeTool, [toolId] ); } } SketchView.constants = { toolType: { pen: { id: 0, name: "Pen" }, eraser: { id: 1, name: "Eraser" } } }; SketchView.propTypes = { ...View.propTypes, // include the default view properties selectedTool: PropTypes.number, localSourceImagePath: PropTypes.string }; let RNSketchView = requireNativeComponent("RNSketchView", SketchView, { nativeOnly: { onChange: true } }); export default SketchView;
2,133
712
export const AMOUNT = 10; export const TYPES = ['multiple', 'boolean']; export const DIFFICULTIES = ['easy', 'medium', 'hard']; export const ANSWER_VALUE = 100;
161
60
const authenticationMiddleware = require("./authn"); const corsMiddleware = require("./cors"); module.exports = { azureAuth: authenticationMiddleware, cors: corsMiddleware }
183
50
/* eslint-disable no-console */ 'use strict'; // const install = require('./install') const runCmd = require('./runCmd'); const getBabelCommonConfig = require('./getBabelCommonConfig'); const merge2 = require('merge2'); const { execSync } = require('child_process'); const through2 = require('through2'); const transformLess = require('./transformLess'); const webpack = require('webpack'); const babel = require('gulp-babel'); const argv = require('minimist')(process.argv.slice(2)); const { Octokit } = require('@octokit/rest'); const packageJson = require(`${process.cwd()}/package.json`); // const getNpm = require('./getNpm') // const selfPackage = require('../package.json') const chalk = require('chalk'); const getNpmArgs = require('./utils/get-npm-args'); const getChangelog = require('./utils/getChangelog'); const path = require('path'); // const watch = require('gulp-watch') const gulp = require('gulp'); const fs = require('fs'); const rimraf = require('rimraf'); const replaceLib = require('./replaceLib'); const stripCode = require('gulp-strip-code'); const compareVersions = require('compare-versions'); const cwd = process.cwd(); const libDir = path.join(cwd, 'lib'); const esDir = path.join(cwd, 'es'); function dist(done) { rimraf.sync(path.join(cwd, 'dist')); process.env.RUN_ENV = 'PRODUCTION'; const webpackConfig = require(path.join(cwd, 'webpack.build.conf.js')); webpack(webpackConfig, (err, stats) => { if (err) { console.error(err.stack || err); if (err.details) { console.error(err.details); } return; } const info = stats.toJson(); if (stats.hasErrors()) { console.error(info.errors); } if (stats.hasWarnings()) { console.warn(info.warnings); } const buildInfo = stats.toString({ colors: true, children: true, chunks: false, modules: false, chunkModules: false, hash: false, version: false, }); console.log(buildInfo); done(0); }); } function babelify(js, modules) { const babelConfig = getBabelCommonConfig(modules); babelConfig.babelrc = false; delete babelConfig.cacheDirectory; if (modules === false) { babelConfig.plugins.push(replaceLib); } let stream = js.pipe(babel(babelConfig)).pipe( through2.obj(function z(file, encoding, next) { this.push(file.clone()); if (file.path.match(/\/style\/index\.(js|jsx)$/)) { const content = file.contents.toString(encoding); file.contents = Buffer.from( content.replace(/\/style\/?'/g, "/style/css'").replace(/\.less/g, '.css'), ); file.path = file.path.replace(/index\.(js|jsx)$/, 'css.js'); this.push(file); next(); } else { next(); } }), ); if (modules === false) { stream = stream.pipe( stripCode({ start_comment: '@remove-on-es-build-begin', end_comment: '@remove-on-es-build-end', }), ); } return stream.pipe(gulp.dest(modules === false ? esDir : libDir)); } function compile(modules) { rimraf.sync(modules !== false ? libDir : esDir); const less = gulp .src(['components/**/*.less']) .pipe( through2.obj(function(file, encoding, next) { this.push(file.clone()); if ( file.path.match(/\/style\/index\.less$/) || file.path.match(/\/style\/v2-compatible-reset\.less$/) ) { transformLess(file.path) .then(css => { file.contents = Buffer.from(css); file.path = file.path.replace(/\.less$/, '.css'); this.push(file); next(); }) .catch(e => { console.error(e); }); } else { next(); } }), ) .pipe(gulp.dest(modules === false ? esDir : libDir)); const assets = gulp .src(['components/**/*.@(png|svg)']) .pipe(gulp.dest(modules === false ? esDir : libDir)); const source = ['components/**/*.js', 'components/**/*.jsx', '!components/*/__tests__/*']; const jsFilesStream = babelify(gulp.src(source), modules); return merge2([less, jsFilesStream, assets]); } function tag() { console.log('tagging'); const { version } = packageJson; execSync(`git config --global user.email ${process.env.GITHUB_USER_EMAIL}`); execSync(`git config --global user.name ${process.env.GITHUB_USER_NAME}`); execSync(`git tag ${version}`); execSync( `git push https://${process.env.GITHUB_TOKEN}@github.com/vueComponent/ant-design-vue.git ${version}:${version}`, ); execSync( `git push https://${process.env.GITHUB_TOKEN}@github.com/vueComponent/ant-design-vue.git master:master`, ); console.log('tagged'); } function githubRelease(done) { const changlogFiles = [ path.join(cwd, 'CHANGELOG.en-US.md'), path.join(cwd, 'CHANGELOG.zh-CN.md'), ]; console.log('creating release on GitHub'); if (!process.env.GITHUB_TOKEN) { console.log('no GitHub token found, skip'); return; } if (!changlogFiles.every(file => fs.existsSync(file))) { console.log('no changelog found, skip'); return; } const github = new Octokit({ auth: process.env.GITHUB_TOKEN, }); const date = new Date(); const { version } = packageJson; const enChangelog = getChangelog(changlogFiles[0], version); const cnChangelog = getChangelog(changlogFiles[1], version); const changelog = [ `\`${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}\``, enChangelog, '\n', '---', '\n', cnChangelog, ].join('\n'); const [_, owner, repo] = execSync('git remote get-url origin') // eslint-disable-line .toString() .match(/github.com[:/](.+)\/(.+)\.git/); github.repos .createRelease({ owner, repo, tag_name: version, name: version, body: changelog, }) .then(() => { done(); }); } gulp.task( 'tag', gulp.series(done => { tag(); githubRelease(done); }), ); gulp.task( 'check-git', gulp.series(done => { runCmd('git', ['status', '--porcelain'], (code, result) => { if (/^\?\?/m.test(result)) { return done(`There are untracked files in the working tree.\n${result} `); } if (/^([ADRM]| [ADRM])/m.test(result)) { return done(`There are uncommitted changes in the working tree.\n${result} `); } return done(); }); }), ); function publish(tagString, done) { let args = ['publish', '--with-antd-tools']; if (tagString) { args = args.concat(['--tag', tagString]); } const publishNpm = process.env.PUBLISH_NPM_CLI || 'npm'; runCmd(publishNpm, args, code => { tag(); githubRelease(() => { done(code); }); }); } function pub(done) { dist(code => { if (code) { done(code); return; } const notOk = !packageJson.version.match(/^\d+\.\d+\.\d+$/); let tagString; if (argv['npm-tag']) { tagString = argv['npm-tag']; } if (!tagString && notOk) { tagString = 'next'; } if (packageJson.scripts['pre-publish']) { runCmd('npm', ['run', 'pre-publish'], code2 => { if (code2) { done(code2); return; } publish(tagString, done); }); } else { publish(tagString, done); } }); } gulp.task( 'compile-with-es', gulp.series(done => { compile(false).on('finish', function() { done(); }); }), ); gulp.task( 'compile', gulp.series('compile-with-es', done => { compile().on('finish', function() { done(); }); }), ); gulp.task( 'dist', gulp.series('compile', done => { dist(done); }), ); gulp.task( 'pub', gulp.series('check-git', 'compile', done => { // if (!process.env.GITHUB_TOKEN) { // console.log('no GitHub token found, skip'); // } else { // pub(done); // } pub(done); }), ); gulp.task( 'pub-with-ci', gulp.series(done => { if (!process.env.NPM_TOKEN) { console.log('no NPM token found, skip'); } else { const github = new Octokit({ auth: process.env.GITHUB_TOKEN, }); const [_, owner, repo] = execSync('git remote get-url origin') // eslint-disable-line .toString() .match(/github.com[:/](.+)\/(.+)\.git/); const getLatestRelease = github.repos.getLatestRelease({ owner, repo, }); const listCommits = github.repos.listCommits({ owner, repo, per_page: 1, }); Promise.all([getLatestRelease, listCommits]).then(([latestRelease, commits]) => { const preVersion = latestRelease.data.tag_name; const { version } = packageJson; const [_, newVersion] = commits.data[0].commit.message.trim().match(/bump (.+)/) || []; // eslint-disable-line if ( compareVersions(version, preVersion) === 1 && newVersion && newVersion.trim() === version ) { // eslint-disable-next-line no-unused-vars runCmd('npm', ['run', 'pub'], code => { done(); }); } else { console.log('donot need publish' + version); } }); } }), ); gulp.task( 'guard', gulp.series(done => { function reportError() { console.log(chalk.bgRed('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')); console.log(chalk.bgRed('!! `npm publish` is forbidden for this package. !!')); console.log(chalk.bgRed('!! Use `npm run pub` instead. !!')); console.log(chalk.bgRed('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')); } const npmArgs = getNpmArgs(); if (npmArgs) { for (let arg = npmArgs.shift(); arg; arg = npmArgs.shift()) { if (/^pu(b(l(i(sh?)?)?)?)?$/.test(arg) && npmArgs.indexOf('--with-antd-tools') < 0) { reportError(); done(1); return; } } } done(); }), );
9,966
3,408
import fs from 'fs-extra' import path from 'path' import {coreUtils, config, Handlebars, User} from '../../../../cli' var route = function route(req, res) { var resHtml = '' var page = path.join(__dirname + '/../../../views/users/profile.html') if (coreUtils.file.exist(page)) { resHtml = fs.readFileSync(page, 'utf8') } var template = Handlebars.compile(resHtml, {noEscape: true}) var userEditable = JSON.parse(JSON.stringify(res.user)) delete userEditable.password delete userEditable.role delete userEditable.id delete userEditable.actif var tmp = template({ csrfToken: res.locals.csrfToken, config: config, userEditable: userEditable, express: { req: req, res: res }, info: req.flash('info'), error: req.flash('error'), isProfile: true, user: res.user, manager: { config: JSON.stringify(config) } }) return res.send(tmp) } export default route
948
321
import React from "react"; import { Wave } from "react-animated-text"; import { Link } from "react-scroll"; import TravisCI from "../../pages/images/TravisCI-Mascot-2.png"; import "./style.css"; const style = { removeUnderline: { textDecoration: "none", }, }; function NavBar() { return ( <header className="row align-items-center py-3"> <div className="col-sm-12 col-md-6"> <a className="d-flex justify-content-center" href="https://travis-ci.com/github/lfernandez79/reactPortfolio" style={style.removeUnderline}> <img id="radius" src={TravisCI} style={{ width: "5%", height: "5%" }} alt="TravisCI" /> <span> &nbsp; CI/CD! </span> </a> </div> <nav className="col-sm-12 col-md-6"> <ul className="nav d-flex justify-content-around"> <li className="nav-item"> <Link to="About" duration={500} smooth className="nav-link" href="/"><Wave text="About" effect="stretch" effectChange={2.0} /></Link> </li> <li className="nav-item"> <Link to="Projtcs" duration={500} smooth className="nav-link" href="/"><Wave text="Portfolio" effect="stretch" effectChange={2.0} /></Link> </li> <li className="nav-item"> <Link to="Contact" duration={500} smooth className="nav-link" href="/"><Wave text="Contact" effect="stretch" effectChange={2.0} /></Link> </li> </ul> </nav> </header> ); } export default NavBar;
1,514
502
var seeProcessorFn = require('../processors/transfer-see'); describe('transfer-see', function() { var seeProcessor; beforeEach(function() { seeProcessor = seeProcessorFn(); }); var transferSee = function(docs) { seeProcessor.$process(docs); }; it('should put @see info in the description', function() { var doc = { description: '', see: ['greetings.HelloWorld'] }; transferSee([doc]); expect(doc.description).toBe('See {@link greetings.HelloWorld}'); }); it('should append @see info to the description', function() { var doc = { description: 'Hello, World', see: ['greetings.HelloWorld'] }; transferSee([doc]); expect(doc.description).toBe('Hello, World<br />See {@link greetings.HelloWorld}'); }); it('should handle multiple @see tags', function() { var doc = { description: '', see: ['greetings.HelloWorld', 'greetings.HolaMundo'] }; transferSee([doc]); expect(doc.description).toBe('See {@link greetings.HelloWorld}<br />' + 'See {@link greetings.HolaMundo}'); }); it('should handle information after @see tag', function() { var doc = { description: '', see: ['greetings.HelloWorld\n\nHello, World'] }; transferSee([doc]); expect(doc.description).toBe('See {@link greetings.HelloWorld}<br />Hello, World'); }); });
1,380
435
(this["webpackJsonpinventory-management-system"]=this["webpackJsonpinventory-management-system"]||[]).push([[3],{402:function(t,e,n){"use strict";n.r(e),n.d(e,"getCLS",(function(){return p})),n.d(e,"getFCP",(function(){return g})),n.d(e,"getFID",(function(){return F})),n.d(e,"getLCP",(function(){return k})),n.d(e,"getTTFB",(function(){return C}));var i,a,r,o,c=function(t,e){return{name:t,value:void 0===e?-1:e,delta:0,entries:[],id:"v1-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12)}},u=function(t,e){try{if(PerformanceObserver.supportedEntryTypes.includes(t)){var n=new PerformanceObserver((function(t){return t.getEntries().map(e)}));return n.observe({type:t,buffered:!0}),n}}catch(t){}},s=function(t,e){var n=function n(i){"pagehide"!==i.type&&"hidden"!==document.visibilityState||(t(i),e&&(removeEventListener("visibilitychange",n,!0),removeEventListener("pagehide",n,!0)))};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},f=function(t){addEventListener("pageshow",(function(e){e.persisted&&t(e)}),!0)},m="function"==typeof WeakSet?new WeakSet:new Set,d=function(t,e,n){var i;return function(){e.value>=0&&(n||m.has(e)||"hidden"===document.visibilityState)&&(e.delta=e.value-(i||0),(e.delta||void 0===i)&&(i=e.value,t(e)))}},p=function(t,e){var n,i=c("CLS",0),a=function(t){t.hadRecentInput||(i.value+=t.value,i.entries.push(t),n())},r=u("layout-shift",a);r&&(n=d(t,i,e),s((function(){r.takeRecords().map(a),n()})),f((function(){i=c("CLS",0),n=d(t,i,e)})))},v=-1,l=function(){return"hidden"===document.visibilityState?0:1/0},h=function(){s((function(t){var e=t.timeStamp;v=e}),!0)},y=function(){return v<0&&(v=l(),h(),f((function(){setTimeout((function(){v=l(),h()}),0)}))),{get timeStamp(){return v}}},g=function(t,e){var n,i=y(),a=c("FCP"),r=u("paint",(function(t){"first-contentful-paint"===t.name&&(r&&r.disconnect(),t.startTime<i.timeStamp&&(a.value=t.startTime,a.entries.push(t),m.add(a),n()))}));r&&(n=d(t,a,e),f((function(i){a=c("FCP"),n=d(t,a,e),requestAnimationFrame((function(){requestAnimationFrame((function(){a.value=performance.now()-i.timeStamp,m.add(a),n()}))}))})))},S={passive:!0,capture:!0},w=new Date,E=function(t,e){i||(i=e,a=t,r=new Date,b(removeEventListener),L())},L=function(){if(a>=0&&a<r-w){var t={entryType:"first-input",name:i.type,target:i.target,cancelable:i.cancelable,startTime:i.timeStamp,processingStart:i.timeStamp+a};o.forEach((function(e){e(t)})),o=[]}},T=function(t){if(t.cancelable){var e=(t.timeStamp>1e12?new Date:performance.now())-t.timeStamp;"pointerdown"==t.type?function(t,e){var n=function(){E(t,e),a()},i=function(){a()},a=function(){removeEventListener("pointerup",n,S),removeEventListener("pointercancel",i,S)};addEventListener("pointerup",n,S),addEventListener("pointercancel",i,S)}(e,t):E(e,t)}},b=function(t){["mousedown","keydown","touchstart","pointerdown"].forEach((function(e){return t(e,T,S)}))},F=function(t,e){var n,r=y(),p=c("FID"),v=function(t){t.startTime<r.timeStamp&&(p.value=t.processingStart-t.startTime,p.entries.push(t),m.add(p),n())},l=u("first-input",v);n=d(t,p,e),l&&s((function(){l.takeRecords().map(v),l.disconnect()}),!0),l&&f((function(){var r;p=c("FID"),n=d(t,p,e),o=[],a=-1,i=null,b(addEventListener),r=v,o.push(r),L()}))},k=function(t,e){var n,i=y(),a=c("LCP"),r=function(t){var e=t.startTime;e<i.timeStamp&&(a.value=e,a.entries.push(t)),n()},o=u("largest-contentful-paint",r);if(o){n=d(t,a,e);var p=function(){m.has(a)||(o.takeRecords().map(r),o.disconnect(),m.add(a),n())};["keydown","click"].forEach((function(t){addEventListener(t,p,{once:!0,capture:!0})})),s(p,!0),f((function(i){a=c("LCP"),n=d(t,a,e),requestAnimationFrame((function(){requestAnimationFrame((function(){a.value=performance.now()-i.timeStamp,m.add(a),n()}))}))}))}},C=function(t){var e,n=c("TTFB");e=function(){try{var e=performance.getEntriesByType("navigation")[0]||function(){var t=performance.timing,e={entryType:"navigation",startTime:0};for(var n in t)"navigationStart"!==n&&"toJSON"!==n&&(e[n]=Math.max(t[n]-t.navigationStart,0));return e}();n.value=n.delta=e.responseStart,n.entries=[e],t(n)}catch(t){}},"complete"===document.readyState?setTimeout(e,0):addEventListener("pageshow",e)}}}]); //# sourceMappingURL=3.1f9f47dc.chunk.js.map
4,261
1,791
/* eslint-disable linebreak-style */ // ====================================================================== // Some Assembly Required // Advent of Code 2015 Day 07 -- Eric Wastl -- https://adventofcode.com // // Javascript implementation by Dr. Dean Earl Wright III // ====================================================================== // ====================================================================== // a o c _ 0 7 . j s // // Solve the Advent of Code 2015 day 07 problem // ====================================================================== // ---------------------------------------------------------------------- // import // ---------------------------------------------------------------------- const yargs = require('yargs'); const fs = require('fs'); const process = require('process'); const gates = require('./gates'); // ---------------------------------------------------------------------- // parseCommndLine // ---------------------------------------------------------------------- function parseCommandLine() { // Parse the command line options" // 1. Create the command line parser const { argv } = yargs .command('aoc_07', 'Some Assembly Required - Day 07 of Advent of Code 2015', { }) .option('verbose', { alias: 'v', default: false, describe: 'Print status messages to stdout', type: 'boolean', }) .option('part', { alias: 'p', default: 1, describe: 'Puzzle Part (1 or 2)', type: 'number', }) .option('limit', { alias: 'l', default: 0, describe: 'Maximum limit (e.g., time, size, recursion) before stopping', type: 'number', }) .option('filepath', { alias: 'f', default: 'input.txt', describe: 'Location of puzzle input', type: 'string', }) .example('$0 -p 1 input.txt', 'Solve part one of the puzzle') .help() .alias('help', 'h'); // 2. Get the options and arguments return argv; } // ---------------------------------------------------------------------- // partOne // ---------------------------------------------------------------------- function partOne(args, inputLines) { // Process part one of the puzzle // 1. Create the puzzle solver const solver = new gates.Gates({ part2: false, text: inputLines }); // 2. Determine the solution for part two const solution = solver.partOne({ verbose: args.verbose, limit: args.limit }); if (solution == null) { console.log('There is no solution for part one'); // eslint-disable-line no-console } else { console.log('The solution for part one is', solution); // eslint-disable-line no-console } // 3. Return result return solution != null; } // ---------------------------------------------------------------------- // partTwo // ---------------------------------------------------------------------- function partTwo(args, inputLines) { // Process part two of the puzzle // 1. Create the puzzle solver const solver = new gates.Gates({ part2: true, text: inputLines }); // 2. Determine the solution for part two const solution = solver.partTwo({ verbose: args.verbose, limit: args.limit }); if (solution == null) { console.log('There is no solution for part two'); // eslint-disable-line no-console } else { console.log('The solution for part two is', solution); // eslint-disable-line no-console } // 3. Return result return solution != null; } // ---------------------------------------------------------------------- // from_text // ---------------------------------------------------------------------- function fromText(text) { // Break the text into trimed, non-comment lines" // 1. We start with no lines const lines = []; // 2. Loop for lines in the text text.split(/\r?\n/).forEach((line) => { // 3. But ignore blank and non-claim lines const cleaned = line.trimEnd(); if (cleaned.length > 0 && !cleaned.startsWith('!')) { // 4. Add the line lines.push(cleaned); } }); // 5. Return a list of clean lines return lines; } // ---------------------------------------------------------------------- // from_file // ---------------------------------------------------------------------- function fromFile(filepath) { // Read the file try { const data = fs.readFileSync(filepath, 'utf8'); return fromText(data); } catch (e) { console.log('Error', e.stack); // eslint-disable-line no-console return ''; } } // ---------------------------------------------------------------------- // main // ---------------------------------------------------------------------- function main() { // Read the Advent of Code problem and solve it let result = null; // 1. Get the command line options const argv = parseCommandLine(); // 2. Read the puzzle file const inputText = fromFile(argv.filepath); // 3. Process the appropiate part of the puzzle if (argv.part === 1) { result = partOne(argv, inputText); } else { result = partTwo(argv, inputText); } // 5. Set return code (0 if solution found, 2 if not) if (result != null) { process.exit(0); } process.exit(2); } // ---------------------------------------------------------------------- // module initialization // ---------------------------------------------------------------------- if (typeof require !== 'undefined' && require.main === module) { main(); } // ---------------------------------------------------------------------- // export // ---------------------------------------------------------------------- module.exports.fromText = fromText; // ====================================================================== // end a o c _ 0 7 . j s end // ======================================================================
6,434
1,585
/* eslint-disable no-unused-vars */ /* eslint-disable no-undef */ const assert = require("assert"); const should = require("should"); const rewire = require("rewire"); const buildPackageModule = rewire("../app/jobs/buildPackage"); const filterRemoteTags = buildPackageModule.__get__("filterRemoteTags"); describe("app/jobs/buildPackage.js", function() { describe("filterRemoteTags()", function() { it("simple", function() { let names = filterRemoteTags([ { tag: "1.0.2", commit: "0000010" }, { tag: "patch", commit: "0000009" }, { tag: "1.0.0", commit: "0000008" }, { tag: "0.8.0-preview", commit: "0000006" } ]); names.should.deepEqual([ { commit: "0000010", tag: "1.0.2" }, { commit: "0000008", tag: "1.0.0" }, { commit: "0000006", tag: "0.8.0-preview" } ]); }); it("duplication 1", function() { let names = filterRemoteTags([ { tag: "1.0.2", commit: "0000010" }, { tag: "v1.0.2", commit: "0000009" } ]); names.should.deepEqual([ { commit: "0000010", tag: "1.0.2" } ]); }); it("duplication 2", function() { let names = filterRemoteTags([ { tag: "v1.0.2", commit: "0000010" }, { tag: "1.0.2", commit: "0000009" } ]); names.should.deepEqual([ { commit: "0000010", tag: "v1.0.2" } ]); }); it("ignore pattern", function() { let names = filterRemoteTags( [ { tag: "1.0.2-master", commit: "10" }, { tag: "1.0.2", commit: "09" }, { tag: "1.0.1-master", commit: "08" }, { tag: "1.0.1", commit: "07" } ], "-master$" ); names.should.deepEqual([ { tag: "1.0.2", commit: "09" }, { tag: "1.0.1", commit: "07" } ]); }); }); });
1,975
756
import React, { Fragment, useState } from 'react' import PropTypes from 'prop-types' // ES6 import { extent, max } from 'd3-array' import { scaleBand, scaleLinear, scaleTime } from 'd3-scale' import { line, curveCardinal } from 'd3-shape' import { timeMonth, timeDay } from 'd3-time' import { formatDate, formatNumber } from '~utilities/visualization' import Tooltip from './tooltip' import chartStyles from './charts.module.scss' import styles from './bar-chart.module.scss' import colors from '~scss/colors.module.scss' const BarChart = ({ data, lineData, refLineData, annotations, handleAnnotationClick, fill, lineColor, marginBottom, marginLeft, marginRight, marginTop, showTicks, width, height, yMax, yTicks, lastXTick, renderTooltipContents, perCapLabel, }) => { const [tooltip, setTooltip] = useState(null) // Used for tooltip optimization const [timeoutRef, setTimeoutRef] = useState(null) // Used when placing annotations const getValueForDate = date => { const dateData = data.find(d => d.date.getTime() === date.getTime()) return dateData && dateData.value } const totalXMargin = marginLeft + marginRight const totalYMargin = marginTop + marginBottom // The x range is over the area in which the chart should be displaying. // We don't use an X transform to place it in the correct spot, we use range // instead const xScale = scaleBand() .domain(data.map(d => d.date)) .range([marginLeft, width - marginRight]) .padding(0.1) const dateDomain = extent(data, d => d.date) // Should probably refactor to use a single x-axis scale // but the bars make use of the band. const xScaleTime = scaleTime() .domain(dateDomain) .range([marginLeft, width - marginRight]) const yMaxEffective = yMax || max([...data, ...(refLineData || [])], d => d.value) const yScale = scaleLinear() .domain([0, yMaxEffective]) .nice() .range([height - totalYMargin, 0]) const msInOneMonth = 2628000000 const monthlyTickInterval = Math.ceil( Math.abs((dateDomain[1] - dateDomain[0]) / (msInOneMonth * 6)), ) const xTickAmount = timeMonth.every(monthlyTickInterval) const yTicksThreshold = 4 const yTicksEffective = yTicks || yMaxEffective < yTicksThreshold ? yMaxEffective : yTicksThreshold const lastTime = xScaleTime.ticks(timeDay.every(1)).pop() let lineFn = null if (lineData) { lineFn = line() .defined(d => !Number.isNaN(d.value) && d.value !== null) .curve(curveCardinal) .x(d => xScaleTime(d.date)) .y(d => yScale(d.value)) } const hover = (event, d) => { // Ensure that tooltip doesn't flash when transitioning between bars if (timeoutRef) { clearTimeout(timeoutRef) } const isTouchEvent = !event.clientX const eventX = isTouchEvent ? event.touches[0].clientX : event.clientX const eventY = isTouchEvent ? event.touches[0].clientY : event.clientY setTooltip({ top: isTouchEvent ? eventY - 130 : eventY + 10, left: isTouchEvent ? eventX - 80 : eventX + 5, d, }) } const mouseOut = () => { if (timeoutRef) { clearTimeout(timeoutRef) } setTimeoutRef(setTimeout(() => setTooltip(null), 200)) } return ( <> <svg className={chartStyles.chart} viewBox={`0 0 ${width} ${height}`} aria-hidden > {/* y ticks */} <g transform={`translate(${marginLeft} ${marginTop})`}> {yScale.ticks(yTicksEffective).map( (tick, i) => i < showTicks && ( <g key={tick}> {/* Do not remove nested svg. See https://github.com/COVID19Tracking/website/pull/645#discussion_r411676987 */} <svg y={yScale(tick) + 6} x="-10" className={chartStyles.yTickLabel} > <text className={chartStyles.label}> {formatNumber(tick)} {tick > 0 && perCapLabel /* this only displays if passed */} </text> </svg> <line className={chartStyles.gridLine} x1={0} x2={width - totalXMargin} y1={yScale(tick)} y2={yScale(tick)} /> </g> ), )} </g> {/* x ticks (dates) */} <g transform={`translate(0, ${height - marginBottom})`}> {xScaleTime.ticks(xTickAmount).map(d => ( <Fragment key={`x-${d}`}> <text className={`${chartStyles.label} ${chartStyles.xTickLabel}`} key={d} x={xScaleTime(d)} y="20" >{`${formatDate(d)}`}</text> <line className={chartStyles.label} stroke={colors.colorSlate500} x1={xScaleTime(d)} y1="0" x2={xScaleTime(d)} y2="5" /> </Fragment> ))} {lastXTick && ( <> <text className={`${chartStyles.label} ${chartStyles.xTickLabel}`} x={xScaleTime(lastTime)} y="20" >{`${formatDate(lastTime)}`}</text> <line className={chartStyles.label} stroke={colors.colorSlate500} x1={xScaleTime(lastTime)} y1="0" x2={xScaleTime(lastTime)} y2="5" /> </> )} </g> <mask id="dataMask"> <rect x="0" y="0" width={width - marginRight} height={height - totalYMargin} fill="white" /> </mask> {/* data */} <g transform={`translate(0 ${marginTop})`} mask="url(#dataMask)"> {/* bars (data) */} {data.map(d => ( <rect key={d.date + d.value} x={xScale(d.date)} y={yScale(d.value)} height={yScale(0) - yScale(d.value)} width={xScale.bandwidth()} fillOpacity={lineData ? 1 : 0.8} fill={fill} className={renderTooltipContents && styles.interactiveBar} onMouseOver={event => hover(event, d)} onFocus={event => hover(event, d)} onMouseOut={mouseOut} onBlur={mouseOut} /> ))} {/* line */} {lineData && ( <path d={lineFn(lineData)} stroke={lineColor} strokeWidth="3" fill="none" /> )} {/* reference line */} {refLineData && ( <path d={lineFn(refLineData)} stroke="black" strokeWidth="2" strokeDasharray="4" fill="none" /> )} </g> {/* annotations */} {annotations && ( <g transform={`translate(0 ${marginTop})`}> {annotations .filter( annotation => xScaleTime(annotation.date) >= xScaleTime(dateDomain[0]) && xScaleTime(annotation.date) <= xScaleTime(dateDomain[1]), ) .map(d => ( <svg key={d} width="20" height="24" x={xScaleTime(d.date) - 11} y={ yScale( getValueForDate(d.date) > 10 ? getValueForDate(d.date) : 10, ) - 26 } viewBox="0 0 20 24" fill="none" xmlns="http://www.w3.org/2000/svg" onClick={handleAnnotationClick} style={{ cursor: 'pointer' }} className={styles.annotationBubbleSvg} pointerEvents="bounding-box" > <mask id="path-1-inside-1" fill="white"> <path fillRule="evenodd" clipRule="evenodd" d="M3 0C1.34315 0 0 1.34314 0 3V16.9412C0 18.5981 1.34315 19.9412 3 19.9412H6.17188L10.2426 24L14.3134 19.9412H17C18.6569 19.9412 20 18.5981 20 16.9412V3C20 1.34315 18.6569 0 17 0H3Z" /> </mask> <rect x="0" y="0" height="32" width="20" className={styles.annotationBubbleSvgFill} mask="url(#path-1-inside-1)" /> <path d="M6.17188 19.9412L6.87794 19.2331L6.58523 18.9412H6.17188V19.9412ZM10.2426 24L9.53658 24.7081L10.2426 25.4121L10.9487 24.7081L10.2426 24ZM14.3134 19.9412V18.9412H13.9001L13.6073 19.2331L14.3134 19.9412ZM1 3C1 1.89543 1.89543 1 3 1V-1C0.790863 -1 -1 0.790856 -1 3H1ZM1 16.9412V3H-1V16.9412H1ZM3 18.9412C1.89543 18.9412 1 18.0458 1 16.9412H-1C-1 19.1503 0.790861 20.9412 3 20.9412V18.9412ZM6.17188 18.9412H3V20.9412H6.17188V18.9412ZM10.9487 23.2919L6.87794 19.2331L5.46581 20.6493L9.53658 24.7081L10.9487 23.2919ZM13.6073 19.2331L9.53658 23.2919L10.9487 24.7081L15.0195 20.6493L13.6073 19.2331ZM17 18.9412H14.3134V20.9412H17V18.9412ZM19 16.9412C19 18.0458 18.1046 18.9412 17 18.9412V20.9412C19.2091 20.9412 21 19.1503 21 16.9412H19ZM19 3V16.9412H21V3H19ZM17 1C18.1046 1 19 1.89543 19 3H21C21 0.790861 19.2091 -1 17 -1V1ZM3 1H17V-1H3V1Z" fill="black" mask="url(#path-1-inside-1)" /> <text fill="black" x="9.5" y="15" textAnchor="middle" style={{ fontSize: 13, fontWeight: 700 }} > {d.annotationSymbol} </text> </svg> ))} </g> )} </svg> {renderTooltipContents && tooltip && ( <Tooltip {...tooltip}>{renderTooltipContents(tooltip.d)} </Tooltip> )} </> ) } BarChart.defaultProps = { lineData: null, lineColor: 'black', refLineData: null, annotations: [], handleAnnotationClick: null, marginBottom: 0, marginLeft: 0, marginRight: 0, marginTop: 0, width: 300, height: 300, yMax: null, yTicks: null, showTicks: 4, renderTooltipContents: null, perCapLabel: null, } BarChart.propTypes = { data: PropTypes.arrayOf( PropTypes.shape({ date: PropTypes.instanceOf(Date).isRequired, /* value isn't required: state's may have started reporting a value _after_ the start date. (i.e. hospitalization values that have only been reported for the past 5 days) */ }), ).isRequired, lineData: PropTypes.arrayOf( PropTypes.shape({ date: PropTypes.instanceOf(Date).isRequired, /* value isn't required: state's may have started reporting a value _after_ the start date. (i.e. hospitalization values that have only been reported for the past 5 days) */ }), ), refLineData: PropTypes.arrayOf( PropTypes.shape({ date: PropTypes.instanceOf(Date).isRequired, value: PropTypes.number.isRequired, }), ), annotations: PropTypes.arrayOf( PropTypes.shape({ annotationSymbol: PropTypes.string.isRequired, date: PropTypes.instanceOf(Date).isRequired, value: PropTypes.number, }), ), handleAnnotationClick: PropTypes.func, // also requires chart Annotations to be present at #chart-annotations fill: PropTypes.string.isRequired, lineColor: PropTypes.string, width: PropTypes.number, height: PropTypes.number, marginBottom: PropTypes.number, marginLeft: PropTypes.number, marginRight: PropTypes.number, marginTop: PropTypes.number, showTicks: PropTypes.number, yMax: PropTypes.number, yTicks: PropTypes.number, renderTooltipContents: PropTypes.func, perCapLabel: PropTypes.string, } export default BarChart
12,358
4,430
function type(obj, type) { return Object.prototype.toString.call(obj).slice(8, -1).toLocaleLowerCase() === type; } export const assert = [ 'String', 'Object', 'Function', 'Array' ].reduce((init, key) => { init['is' + key] = function(target) { return type(target, key.toLocaleLowerCase()); }; return init; }, {});
337
123
'use strict'; const names = ['bag', 'banana', 'bathroom', 'boots', 'breakfast', 'bubblegum', 'chair', 'cthulhu', 'dog-duck', 'dragon', 'pen', 'pet-sweep', 'scissors', 'shark', 'sweep', 'tauntaun', 'unicorn', 'usb', 'water-can', 'wine-glass']; const leftImage = document.getElementById(`left`); const centerImage = document.getElementById(`center`); const rightImage = document.getElementById(`right`); let allProducts = []; const container = document.getElementById(`image_container`); const viewed = []; const labels = []; const pics = [leftImage, centerImage, rightImage]; const list = document.getElementById(`productlist`); let totalClicks = 0; let views = []; let votes = []; function Product(name) { this.name = name; this.path = `img/` + name + `.jpg`; this.votes = 0; this.views = 0; allProducts.push(this); } function makeRandom() { return Math.floor(Math.random() * names.length); } function displayPics(){ while(viewed.length < 6){ const rando = makeRandom(); while(!viewed.includes(rando)){ viewed.push(rando); } } // console.log(rando); // TODO: In a sentence or two, explain why the previous line of code threw an error when we changed the variable declaration from `var to `let`. // PUT YOUR RESPONSE IN THIS COMMENT : 'let' declaration works only in the same block (LOCALY) so if we use it outside its scope it will throw an error but the 'var' declaration its a global scope works even if we use it outside the block console.log(viewed); for (let i = 0; i < 3; i++){ const temp = viewed.shift(); pics[i].src = allProducts[temp].path; pics[i].id = allProducts[temp].name; allProducts[temp].views += 1; } } function handleClick(event) { if (event.target.id === `image_container`) { return alert('Be sure to click directly on an image!!'); } totalClicks += 1; if(totalClicks > 24) { container.removeEventListener(`click`, handleClick); container.style.display = `none`; showList(); makeChart(); } for(let i = 0; i < names.length; i++){ if(event.target.id === allProducts[i].name) { allProducts[i].votes += 1; console.log(event.target.id + ` has ` + allProducts[i].votes + ` votes in ` + allProducts[i].views + ` views`); } } localStorage.busmall = JSON.stringify(allProducts); localStorage.busmallProducts = JSON.stringify(allProducts); displayPics(); } function showList() { for(let i = 0; i < allProducts.length; i++) { const liEl = document.createElement('li'); liEl.textContent = allProducts[i].name + ` has ` + allProducts[i].votes + ` votes in ` + allProducts[i].views + ` views`; list.appendChild(liEl); } } function makeChartData(){ allProducts.forEach(function(product){ labels.push(product.name); votes.push(product.votes); views.push(product.views); }); } function makeChart(){ makeChartData(); const ctx = document.getElementById('chartypants').getContext('2d'); new Chart(ctx, { //eslint-disable-line type: 'bar', data: { labels: labels, datasets: [{ label: 'total votes', backgroundColor: 'gold', borderColor: '#214', data: votes, }] }, options: { responsive: false, scales: { yAxes: [{ ticks: { max: 20, min: 0, stepSize: 1 } }] } } }); Chart.defaults.global.defaultFontColor = '#eee'; //eslint-disable-line } container.addEventListener('click', handleClick); document.getElementById('bus').addEventListener('click', function(){ localStorage.removeItem('busmall'); console.log('Local storage was cleared!'); }); if(localStorage.busmall){ console.log('Local storage data exists'); allProducts = JSON.parse(localStorage.busmall); } else { console.log('There is no local storage data; initialize app by creating instances'); for(let i = 0; i < names.length; i++) { new Product(names[i]); } } displayPics();
4,125
1,340
import { isArray, addObject, findBy } from '@/utils/array'; const parseCache = {}; const OP_MAP = { '=': 'In', '==': 'In', '!=': 'NotIn', '<': 'Lt', '>': 'Gt', }; // Parse a labelSelector string export function parse(labelSelector) { // matchLabels: // comma-separated list, all rules ANDed together // spaces may be encoded as + // // Equals: foo = bar // Not Equals: bar != baz // Key Exists: optional.prefix/just-some-key // Key Doesn't: !optional.prefix/just-some-key // In Set: environment in (production,qa) // Not in Set: environment notin (production,qa) // Convert into matchExpressions, which newer resources support // and express the same things // // Object of: // key: optional.prefix/some-key // operator: In, NotIn, Exists, or DoesNotExist // values: [array, of, values, even, if, only, one] labelSelector = labelSelector.replace(/\+/g, ' '); if ( parseCache[labelSelector] ) { return parseCache[labelSelector]; } let match; const out = []; const parens = []; // Substitute out all the parenthetical lists because they might have commas in them match = labelSelector.match(/\([^)]+\)/g); if ( match && match.length ) { for ( const str of match ) { const val = str.replace(/^\s*\(\s*/, '').replace(/\s*\)\s*$/, '').split(/\s*,\s*/); parens.push(val); labelSelector = labelSelector.replace(str, ` @${ parens.length - 1 } `); } } const parts = labelSelector.split(/\s*,\s*/).filter(x => !!x); for ( let rule of parts ) { rule = rule.trim(); match = rule.match(/^(.*?)\s+((not\s*)?in)\s+@(\d+)*$/i); if ( match ) { out.push({ key: match[1].trim(), operator: match[2].toLowerCase().replace(/\s/g, '') === 'notin' ? 'NotIn' : 'In', values: parens[match[4].trim()], }); continue; } match = rule.match(/^([^!=]*)\s*(\!=|=|==|>|<)\s*([^!=]*)$/); if ( match ) { out.push({ key: match[1].trim(), operator: OP_MAP[match[2]], values: [match[3].trim()], }); continue; } if ( rule.startsWith('!') ) { out.push({ key: rule.substr(1).trim(), operator: 'DoesNotExist' }); continue; } out.push({ key: rule.trim(), operator: 'Exists' }); } parseCache[labelSelector] = out; return out; } // Convert a Selector object to matchExpressions export function convertSelectorObj(obj) { return convert(obj.matchLabels || {}, obj.matchExpressions || []); } // Convert matchLabels to matchExpressions // Optionally combining with an existing set of matchExpressions export function convert(matchLabelsObj, matchExpressions) { const keys = Object.keys(matchLabelsObj || {}); const out = matchExpressions || []; for ( const key of keys ) { const value = matchLabelsObj[key]; const existing = findBy(out, { key, operator: 'In' }); if ( existing ) { addObject(existing.values, value); } else { out.push({ key, operator: 'In', values: [value], }); } } return out; } // Convert matchExpressions to matchLabels when possible, // returning the simplest combination of them. export function simplify(matchExpressionsInput) { const matchLabels = {}; const matchExpressions = []; // Look for keys with more than one "In" expression and disqualify them from simplifying const impossible = []; const seen = {}; for ( const expr of matchExpressionsInput ) { if ( expr.operator !== 'In' ) { continue; } if ( seen[expr.key] ) { addObject(impossible, expr.key); } else { seen[expr.key] = true; } } for ( const expr of matchExpressionsInput ) { if ( expr.operator === 'In' && expr.values.length === 1 && !impossible.includes(expr.key) ) { matchLabels[expr.key] = expr.values[0]; } else { matchExpressions.push(Object.assign({}, expr)); } } return { matchLabels, matchExpressions }; } export function matches(obj, selector) { let rules = []; if ( typeof selector === 'string' ) { // labelSelector string rules = parse(selector); } else if ( isArray(selector) ) { // Already matchExpression rules = selector; } else if ( typeof selector === 'object' && selector ) { // matchLabels object rules = convert(selector); } else { return false; } const labels = obj?.metadata?.labels || {}; for ( const rule of rules ) { const value = labels[rule.key]; const asInt = parseInt(value, 10); const exists = typeof labels[rule.key] !== 'undefined'; switch ( rule.operator ) { case 'Exists': if ( !exists ) { return false; } break; case 'DoesNotExist': if ( exists ) { return false; } break; case 'In': if ( !value || !rule.values.length || !rule.values.includes(value) ) { return false; } break; case 'NotIn': if ( rule.values.includes(value) ) { return false; } break; case 'Lt': if ( isNaN(asInt) || asInt >= Math.min.apply(null, rule.values) ) { return false; } break; case 'Gt': if ( isNaN(asInt) || asInt <= Math.max.apply(null, rule.values) ) { return false; } break; } } return true; } export function matching(ary, selector) { return ary.filter(obj => matches(obj, selector)); }
5,506
1,811
/*! * Copyright (c) 2015-2017 Cisco Systems, Inc. See LICENSE file. */ import {registerInternalPlugin} from '@webex/webex-core'; import Search from './search'; import config from './config'; import {has} from 'lodash'; import '@webex/internal-plugin-encryption'; registerInternalPlugin('search', Search, { config, payloadTransformer: { predicates: [ { name: 'encryptSearchQuery', direction: 'outbound', test(ctx, options) { if (!has(options, 'body.query')) { return Promise.resolve(false); } if (!has(options, 'body.searchEncryptionKeyUrl')) { return Promise.resolve(false); } return ctx.spark.internal.device.isSpecificService('argonaut', options.service || options.url); }, extract(options) { return Promise.resolve(options.body); } }, { name: 'transformObjectArray', direction: 'inbound', test(ctx, response) { return Promise.resolve(has(response, 'body.activities.items[0].objectType')) .then((res) => res && ctx.spark.internal.device.isSpecificService('argonaut', response.options.service || response.options.uri)); }, extract(response) { return Promise.resolve(response.body.activities.items); } } ], transforms: [ { name: 'encryptSearchQuery', direction: 'outbound', fn(ctx, object) { return ctx.spark.internal.encryption.encryptText(object.searchEncryptionKeyUrl, object.query) .then((q) => { object.query = q; }); } } ] } }); export {default} from './search';
1,727
499
import React, { useEffect, useRef, useState } from 'react'; import { Row, Col } from 'react-bootstrap'; import Card from '@material-ui/core/Card'; import IconButton from '@material-ui/core/IconButton'; import PlayArrowIcon from '@material-ui/icons/PlayArrow'; import PauseIcon from '@material-ui/icons/Pause'; import { MDBProgress } from 'mdbreact'; import Slider from '@material-ui/core/Slider'; import VolumeUp from '@material-ui/icons/VolumeUp'; import Divider from '@material-ui/core/Divider'; import { makeStyles } from '@material-ui/core/styles'; import AudioUtil from '../../../utils/audio'; const useStyles = makeStyles((theme) => ({ slider: { padding: '3px', }, light: { backgroundColor: 'rgba(255, 255, 255, 0.1) !important', }, })); const useInterval = (callback, delay) => { const savedCallback = useRef(); useEffect(() => { savedCallback.current = callback; }, [callback]); useEffect(() => { const tick = () => savedCallback.current(); if (delay !== null) { const id = setInterval(tick, delay); return () => clearInterval(id); } }, [delay]); }; const Audio = () => { // const [disabled, setDisabled] = useState(true); const classes = useStyles(); const [song, setSong] = useState({}); const [value, setValue] = useState(0); const [timer, setTimer] = useState(null); const [audio, setAudio] = useState(null); const [volume, setVolume] = useState(5); const [current, setCurrent] = useState(null); const [playing, setPlaying] = useState(false); const [timeDisplay, setTimeDisplay] = useState('00:00'); useEffect(() => { const url = 'https://file-examples-com.github.io/uploads/2017/11/file_example_MP3_5MG.mp3'; AudioUtil.loadSong(url).then((audiobuffer) => { if (audio) { audio.context.decodeAudioData( audiobuffer, (buffer) => { if (current !== null) { current.disconnect(); } const _current = audio.context.createBufferSource(); _current.buffer = buffer; setCurrent(_current); }, console.error ); } }); }, [audio]); useEffect(() => { if (current && audio) { current.connect(audio.analyser); audio.analyser.connect(audio.gainNode); audio.gainNode.connect(audio.context.destination); audio.node.connect(audio.context.destination); audio.gainNode.gain.value = volume / 10.0; if (song.when && song.offset) { current.start(song.when, song.offset); } else { current.start(0); } if (audio.context.state === 'suspended') { audio.context.resume(); } let offset = (new Date() - audio.created) / 1000; if (offset > audio.context.currentTime) { offset = audio.context.currentTime; } setSong({ offset, duration: current.buffer.duration }); setPlaying(true); } }, [current]); useInterval(() => { if ( audio && audio.context && audio.context.state !== 'suspended' && current ) { const time = audio.context.currentTime - song.offset; const seconds = parseInt(time || 0); const progress = 100.0 * (seconds / song.duration); setValue(progress); if (progress <= 100) { const min = Math.floor(seconds / 60); const sec = seconds - min * 60; setTimeDisplay( `${min < 10 ? `0${min}` : min}:${sec < 10 ? `0${sec}` : sec}` ); } else { // Finished playing. setValue(0); setTimeDisplay('00:00'); setPlaying(false); clearInterval(timer); current.start(0); } } }, 1000); const play = () => { if (!audio) { const _audio = AudioUtil.init(); setAudio(_audio); } else { audio.context.resume(); setPlaying(true); } }; const pause = () => { if (audio) { audio.context.suspend(); setPlaying(false); clearInterval(timer); } }; const updateVolume = (_, newVolume) => { if (audio) { audio.gainNode.gain.value = newVolume / 10; } setVolume(newVolume); }; return ( <Card style={{ width: '550px', background: 'rgba(0,0,0,0.8)' }} id="audio"> <Row> <Col md="auto" className="pr-0"> {playing ? ( <IconButton onClick={pause} color="primary"> <PauseIcon /> </IconButton> ) : ( <IconButton onClick={play} color="primary"> <PlayArrowIcon /> </IconButton> )} </Col> <Divider orientation="vertical" flexItem light className={classes.light} /> <Col md="7" className="align-self-center"> <Row> <Col md="10" className="pr-0" className="align-self-center"> <MDBProgress value={value} /> </Col> <Col md="auto" className="pl-0 ml-auto" style={{ color: '#3f51b5' }} > {timeDisplay} </Col> </Row> </Col> <Divider orientation="vertical" flexItem light className={classes.light} /> <Col md="3" className="align-self-center"> <Row> <Col md="auto" className="align-self-center pr-0"> <VolumeUp color="primary" /> </Col> <Col className="align-self-center"> <Slider color="primary" className={classes.slider} value={volume} onChange={updateVolume} min={0} max={10} /> </Col> </Row> </Col> </Row> </Card> ); }; export default Audio;
5,891
1,837
function loop(){ // Rotate the propeller, the sea and the sky //airplane.propeller.rotation.x += 0.3; sky.mesh.rotation.z += .05; // update the plane on each frame updatePlane(); airplane.pilot.updateHairs(); sea.moveWaves(); // render the scene renderer.render(scene, camera); // call the loop function again requestAnimationFrame(loop); } function updatePlane(){ // let's move the airplane between -100 and 100 on the horizontal axis, // and between 25 and 175 on the vertical axis, // depending on the mouse position which ranges between -1 and 1 on both axes; // to achieve that we use a normalize function (see below) var targetX = normalize(mousePos.x, -1, 1, -20, 20); var targetY = normalize(mousePos.y, -1, 1, 80, 120); // update the airplane's position //airplane.mesh.position.y = targetY; airplane.mesh.position.y += (targetY-airplane.mesh.position.y)*0.1; airplane.mesh.position.x = targetX; airplane.mesh.rotation.z = (targetY-airplane.mesh.position.y)*0.0128; airplane.mesh.rotation.x = (airplane.mesh.position.y-targetY)*0.064; airplane.propeller.rotation.x += 0.3; } function normalize(v,vmin,vmax,tmin, tmax){ var nv = Math.max(Math.min(v,vmax), vmin); var dv = vmax-vmin; var pc = (nv-vmin)/dv; var dt = tmax-tmin; var tv = tmin + (pc*dt); return tv; }
1,346
537
function getGEOJSONArray(geojson, positions, clau) { var array1 = [] var z = 0; $.each(geojson.features, function (key, val) { z = z + 1; if (z <= positions) { $.each(val.properties, function (i, j) { if (i == clau) { array1.push(j); } }) } }); return array1; } function addCommasFormated(nStr) { try{ nStr += ''; nStr = nStr.replace(".", ","); x = nStr.split(','); x1 = x[0]; x2 = x.length > 1 ? ',' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while (rgx.test(x1)) { x1 = x1.replace(rgx, '$1' + '.' + '$2'); } return x1 + x2; }catch(err){ return nStr; } } function ckeckAQArrays(array1, array2) { var common = $.grep(array1, function (element) { return $.inArray(element, array2) !== -1; }); return common.length; } function normalizeNameColumns(row_CSV) { var normalized = []; $.each(row_CSV, function (i, val) { normalized.push(treuAccentsiEspais(val)); }); return normalized; } function getTypeColumns(row_CSV) { var normalized = []; $.each(row_CSV, function (i, val) { normalized.push(typeof (quiSoconVinc(val))); }); return normalized; } function treuAccentsiEspais(str) { try { str = removeAccents(str); str = str.replace(/[^0-9a-zA-Z ]/g, ""); str = str.replace(/\s/g, "-"); } catch (Err) {} return str; } function removeAccents(str) { var accents = 'ÀÁÂÃÄÅàáâãäåÒÓÔÕÕÖØòóôõöøÈÉÊËèéêëðÇçÐÌÍÎÏìíîïÙÚÛÜùúûüÑñŠšŸÿýŽž'; var accentsOut = "AAAAAAaaaaaaOOOOOOOooooooEEEEeeeeeCcDIIIIiiiiUUUUuuuuNnSsYyyZz"; str = str.split(''); var strLen = str.length; var i, x; for (i = 0; i < strLen; i++) { if ((x = accents.indexOf(str[i])) != -1) { str[i] = accentsOut[x]; } } return str.join(''); } function randomColor() { return '#' + Math.floor(Math.random() * 16777215).toString(16); } function getRamdomColorFromArray() { var colors = [ '#000000', '#424242', '#636363', '#9C9C94', '#CEC6CE', '#EFEFEF', '#F7F7F7', '#FFFFFF', '#FF0000', '#FF9C00', '#FFFF00', '#00FF00', '#00FFFF', '#0000FF', '#9C00FF', '#FF00FF', '#F7C6CE', '#FFE7CE', '#FFEFC6', '#D6EFD6', '#CEDEE7', '#CEE7F7', '#D6D6E7', '#E7D6DE', '#E79C9C', '#FFC69C', '#FFE79C', '#B5D6A5', '#A5C6CE', '#9CC6EF', '#B5A5D6', '#D6A5BD', '#E76363', '#F7AD6B', '#FFD663', '#94BD7B', '#73A5AD', '#6BADDE', '#8C7BC6', '#C67BA5', '#CE0000', '#E79439', '#EFC631', '#6BA54A', '#4A7B8C', '#3984C6', '#634AA5', '#A54A7B', '#9C0000', '#B56308', '#BD9400', '#397B21', '#104A5A', '#085294', '#311873', '#731842', '#630000', '#7B3900', '#846300', '#295218', '#083139', '#003163', '#21104A', '#4A1031' ]; return colors[Math.floor(Math.random() * colors.length)]; } function getColumFromGEOJSON(keyField, GeoJSON) { var items = []; $.each(GeoJSON.features, function (key, val) { if (typeof val.properties[keyField] != 'undefined') { items.push(val.properties[keyField]); } }); return items; } function getColumFromGEOJSONFilter(keyField, GeoJSON, keyFilter, valueFilter) { var items = []; $.each(GeoJSON.features, function (key, val) { if (typeof val.properties[keyField] != 'undefined' && val.properties[keyField] != null && val.properties[keyField] != 'null' && !isNaN(val.properties[keyField])) { if (val.properties[keyFilter] < valueFilter) { items.push(val.properties[keyField]); } } }); return items; } function getColumFromCSV(numColum, forceNumber, dataCSV) { var arrayColum = []; $.each(dataCSV, function (i, feature) { if (i > 0) { var value = feature[numColum]; if (value && value != 'undefined') { if (forceNumber) { arrayColum.push(quiSoconVinc(value)); } else { arrayColum.push(value); } } } }); return arrayColum; } function getUniqueValuesfromFilter(numKeyColum, forceNumberKeyColum, dataCSV) { var estatsKeyColum = new geostats(getColumFromCSV(numKeyColum, forceNumberKeyColum, dataCSV)); var itemKeyColum = estatsKeyColum.getClassUniqueValues(); return itemKeyColum; } function insertUniqueValuesfromFilter(numKeyColum, forceNumberKeyColum, dataCSV, HTML_ID) { try { var estatsKeyColum = new geostats(getColumFromCSV(numKeyColum, forceNumberKeyColum, dataCSV)); insertValueToSelectHTML(estatsKeyColum, HTML_ID); return true; } catch (err) { return false; } } function insertValuesFromQuery(numQueryColum, textQuery, numTextColum, HTML_ID, dataCSV) { try { var arrayColum = []; $.each(dataCSV, function (i, feature) { if (i > 0) { if (feature) var value = feature[numQueryColum]; if (value == textQuery) { arrayColum.push(feature[numTextColum]); } } }); var estatsKeyColum = new geostats(arrayColum); insertValueToSelectHTML(estatsKeyColum, HTML_ID); return true; } catch (err) { return false; } } function insertValueToSelectHTML(itemKeyColumGeostats, HTML_ID) { try { $(HTML_ID).html(''); var itemKeyColum = itemKeyColumGeostats.getClassUniqueValues(); $.each(itemKeyColum, function (key, value) { $(HTML_ID) .append($('<option>', { value: value }) .text(value)); }); } catch (err) { console.log(err); } } function getValuesFromQuery(numQueryColum, textQuery, dataCSV) { var arrayColum = []; $.each(dataCSV, function (i, feature) { if (i > 0) { if (feature) var value = feature[numQueryColum]; if (value == textQuery) { arrayColum.push(feature); } } }); return arrayColum; } function updateLegend(legend, textTitol, HTML_ID) { $(HTML_ID).html(legend); $('.geostats-legend-title').html(textTitol); } function getGenerateStyle(recordset, numRangs, arrayColors, factorH) { var _numRangs = recordset.estadistica.getClassJenks(numRangs); if (numRangs < initNumRangs) { _numRangs = recordset.estadistica.getClassUniqueValues(numRangs); } if (recordset.estadistica.ranges.length > arrayColors.length) { arrayColorCurrent = getColorArrayfromSelectedBrewer(recordset.estadistica.ranges.length + 1, initNumRangs); recordset.estadistica.setColors(arrayColorCurrent); } else { recordset.estadistica.setColors(arrayColors); } var expColor = ["match", ["get", "abp"]]; var expHeight = ["match", ["get", "abp"]]; recordset.results.forEach(function (row) { var value = parseInt((row["sum"])); var color = recordset.estadistica.colors[recordset.estadistica.getRangeNum(value)]; if (!color) { color = "rgba(0,0,0,0)"; } expColor.push(row["abp"], color); expHeight.push(row["abp"], parseInt(value * factorH)); }); expColor.push("rgba(0,0,0,0)"); expHeight.push(0); return { "color": expColor, "height": expHeight, 'legend': recordset.estadistica.getHtmlLegend(), 'titol': recordset.titol, 'legend_color': recordset.estadistica.colors, 'legend_rangs': recordset.estadistica.bounds, 'sum':addCommasFormated(recordset.estadistica.sum()) }; } function getArrayValuesFromUniqueKeyFilterByABP(arrayUniqueKey, arrayFromSearchQuery, numKeyColum, numSumColum, textNumColum, forceNumber, textTitle, numKeyColumABP, nomABP) { var array = []; var arrayValues = []; var title = textTitle; var text = ""; for (var i = 0; i < arrayUniqueKey.length; i++) { var ini = 0; for (var j = 0; j < arrayFromSearchQuery.length; j++) { if (arrayUniqueKey[i] == arrayFromSearchQuery[j][numKeyColum] && arrayFromSearchQuery[j][numKeyColumABP] == nomABP) { var _al = parseInt(arrayFromSearchQuery[j][numSumColum]); var text = arrayFromSearchQuery[j][textNumColum] if (isNaN(_al)) { _al = 0 } ini = ini + parseInt(_al); // text=arrayFromSearchQuery[j][textNumColum] } } array.push([arrayUniqueKey[i], ini, capitalizeFirstLetter(text)]); array.sort(sortFunction); } return { "titol": title, "filter": nomABP, "results": array }; } function getArrayValuesFromUniqueKey(arrayUniqueKey, arrayFromSearchQuery, numKeyColum, numSumColum, textNumColum, forceNumber, textTitle) { var array = []; var arrayValues = []; var title = textTitle; var text = ""; for (var i = 0; i < arrayUniqueKey.length; i++) { var ini = 0; for (var j = 0; j < arrayFromSearchQuery.length; j++) { if (arrayUniqueKey[i] == arrayFromSearchQuery[j][numKeyColum]) { var _al = parseInt(arrayFromSearchQuery[j][numSumColum]); var text = arrayFromSearchQuery[j][textNumColum] if (isNaN(_al)) { _al = 0 } ini = ini + parseInt(_al); // text=arrayFromSearchQuery[j][textNumColum] } } array.push([arrayUniqueKey[i], ini, capitalizeFirstLetter(text)]); array.sort(sortFunction); } return { "titol": title, "results": array }; } function sortFunction(a, b) { if (a[0] === b[0]) { return 0; } else { return (a[0] < b[0]) ? -1 : 1; } } function capitalizeFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1); } function getSumValuesFromUniqueKey(arrayUniqueKey, arrayFromSearchQuery, numKeyColum, numSumColum, textNumColum, forceNumber, textTitle) { var array = []; var arrayValues = []; var _GEOSTATS; var title = textTitle; var text = ""; for (var i = 0; i < arrayUniqueKey.length; i++) { var ini = 0; for (var j = 0; j < arrayFromSearchQuery.length; j++) { if (arrayUniqueKey[i] == arrayFromSearchQuery[j][numKeyColum]) { var _al = parseInt(arrayFromSearchQuery[j][numSumColum]); if (isNaN(_al)) { _al = 0 } ini = ini + parseInt(_al); // text=arrayFromSearchQuery[j][textNumColum] } } array.push({ "abp": arrayUniqueKey[i], "sum": ini }) arrayValues.push(ini); } _GEOSTATS = new geostats(arrayValues); var newEstats = new geostats(arrayValues); var _controlUniques = newEstats.getClassUniqueValues().length; if (_controlUniques >= initNumRangs) { _numRangs = initNumRangs; } else { _numRangs = _controlUniques; } return { "estadistica": _GEOSTATS, "titol": title, "results": array, "numRangs": _numRangs }; } function getTitlefromCSV(numColum, dataCSV) { return dataCSV[0][numColum]; } function calculateStatsCVS(numColum, forceNumber, dataCSV) { var _GEOSTATS; var title = dataCSV[0][numColum]; _GEOSTATS = new geostats(getColumFromCSV(numColum, forceNumber, dataCSV)); return { "estadistica": _GEOSTATS, "titol": title }; } function quiSoconVinc(valor) { if (!isNaN(parseFloat(valor)) && 'string' == typeof (valor)) { valor = valor.replace(",", "."); valor = parseFloat(valor); } else if ('number' == typeof (valor)) {} else if (valor == 'undefined') { valor = 0; } else {} return valor; } function calculateStatsGeoJSON(keyField, newGeoJSON) { var _GEOSTATS; if ('number' == keyType) { _GEOSTATS = new geostats(getColumFromGEOJSON(keyField, newGeoJSON)); } return _GEOSTATS; }
12,431
4,482
module.exports={A:{A:{"2":"E A B gB","8":"K D G"},B:{"2":"1 C c J M H I"},C:{"1":"0 1 2 3 4 5 6 7 8 9 F N K D G E A B C c J M H I O P Q R S T U V W X Y Z a b d e f g h i j k l m n o L q r s t u v w x y z AB CB DB","129":"eB EB cB WB"},D:{"1":"T","8":"0 1 2 3 4 5 6 7 8 9 F N K D G E A B C c J M H I O P Q R S U V W X Y Z a b d e f g h i j k l m n o L q r s t u v w x y z AB CB DB QB hB KB IB LB MB NB OB"},E:{"1":"A B C VB p XB","260":"F N K D G E PB HB RB SB TB UB"},F:{"2":"E","4":"B C YB ZB aB bB p FB dB BB","8":"0 4 J M H I O P Q R S T U V W X Y Z a b d e f g h i j k l m n o L q r s t u v w x y z"},G:{"1":"G JB iB jB kB lB mB nB oB pB qB rB","8":"HB fB GB"},H:{"8":"sB"},I:{"8":"3 EB F tB uB vB wB GB xB yB"},J:{"1":"A","8":"D"},K:{"8":"A B C L p FB BB"},L:{"8":"IB"},M:{"1":"2"},N:{"2":"A B"},O:{"4":"zB"},P:{"8":"F 0B 1B 2B 3B"},Q:{"8":"4B"},R:{"8":"5B"}},B:2,C:"MathML"};
882
503
/*! * OS.js - JavaScript Cloud/Web Panel Platform * * Copyright (c) 2011-2017, Anders Evenrud <[email protected]> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * @author Anders Evenrud <[email protected]> * @licence Simplified BSD License */ /*eslint valid-jsdoc: "off"*/ (function(Application, Window, Utils, API, Panel, GUI) { 'use strict'; var panelItems = []; var items = []; var max = 0; var panel; ///////////////////////////////////////////////////////////////////////////// // HELPERS ///////////////////////////////////////////////////////////////////////////// function openOptions(wm, idx) { // FIXME try { wm.panels[0]._items[idx].openSettings(); } catch ( e ) {} } function checkSelection(win, idx) { var hasOptions = true; try { var it = items[panel.items[idx].name]; hasOptions = it.HasOptions === true; } catch ( e ) {} win._find('PanelButtonOptions').set('disabled', idx < 0 || !hasOptions); win._find('PanelButtonRemove').set('disabled', idx < 0); win._find('PanelButtonUp').set('disabled', idx <= 0); win._find('PanelButtonDown').set('disabled', idx < 0 || idx >= max); } function renderItems(win, setSelected) { var list = []; panelItems.forEach(function(i, idx) { var name = i.name; if ( items[name] ) { list.push({ value: idx, columns: [{ icon: API.getIcon(items[name].Icon), label: Utils.format('{0} ({1})', items[name].Name, items[name].Description) }] }); } }); max = panelItems.length - 1; var view = win._find('PanelItems'); view.clear(); view.add(list); if ( typeof setSelected !== 'undefined' ) { view.set('selected', setSelected); checkSelection(win, setSelected); } else { checkSelection(win, -1); } } function movePanelItem(win, index, pos) { var value = panelItems[index]; var newIndex = index + pos; panelItems.splice(index, 1); panelItems.splice(newIndex, 0, value); renderItems(win, newIndex); } function createDialog(win, scheme, cb) { if ( scheme ) { var app = win._app; var nwin = new OSjs.Applications.ApplicationSettings.SettingsItemDialog(app, app.__metadata, scheme, cb); nwin._on('inited', function(scheme) { nwin._find('List').clear().add(Object.keys(items).map(function(i, idx) { return { value: i, columns: [{ icon: API.getIcon(items[i].Icon), label: Utils.format('{0} ({1})', items[i].Name, items[i].Description) }] }; })); nwin._setTitle('Panel Items', true); }); win._addChild(nwin, true, true); } } function createColorDialog(win, color, cb) { win._toggleDisabled(true); API.createDialog('Color', { color: color }, function(ev, button, result) { win._toggleDisabled(false); if ( button === 'ok' && result ) { cb(result.hex); } }, win); } ///////////////////////////////////////////////////////////////////////////// // MODULE ///////////////////////////////////////////////////////////////////////////// var module = { group: 'personal', name: 'Panel', label: 'LBL_PANELS', icon: 'apps/gnome-panel.png', watch: ['CoreWM'], init: function() { }, update: function(win, scheme, settings, wm) { panel = settings.panels[0]; var opacity = 85; if ( typeof panel.options.opacity === 'number' ) { opacity = panel.options.opacity; } win._find('PanelPosition').set('value', panel.options.position); win._find('PanelAutoHide').set('value', panel.options.autohide); win._find('PanelOntop').set('value', panel.options.ontop); win._find('PanelBackgroundColor').set('value', panel.options.background || '#101010'); win._find('PanelForegroundColor').set('value', panel.options.foreground || '#ffffff'); win._find('PanelOpacity').set('value', opacity); items = OSjs.Core.getPackageManager().getPackage('CoreWM').panelItems; panelItems = panel.items || []; renderItems(win); }, render: function(win, scheme, root, settings, wm) { win._find('PanelPosition').add([ {value: 'top', label: API._('LBL_TOP')}, {value: 'bottom', label: API._('LBL_BOTTOM')} ]); win._find('PanelBackgroundColor').on('open', function(ev) { createColorDialog(win, ev.detail, function(result) { win._find('PanelBackgroundColor').set('value', result); }); }); win._find('PanelForegroundColor').on('open', function(ev) { createColorDialog(win, ev.detail, function(result) { win._find('PanelForegroundColor').set('value', result); }); }); win._find('PanelItems').on('select', function(ev) { if ( ev && ev.detail && ev.detail.entries && ev.detail.entries.length ) { checkSelection(win, ev.detail.entries[0].index); } }); win._find('PanelButtonAdd').on('click', function() { win._toggleDisabled(true); createDialog(win, scheme, function(ev, result) { win._toggleDisabled(false); if ( result ) { panelItems.push({name: result.data}); renderItems(win); } }); }); win._find('PanelButtonRemove').on('click', function() { var selected = win._find('PanelItems').get('selected'); if ( selected.length ) { panelItems.splice(selected[0].index, 1); renderItems(win); } }); win._find('PanelButtonUp').on('click', function() { var selected = win._find('PanelItems').get('selected'); if ( selected.length ) { movePanelItem(win, selected[0].index, -1); } }); win._find('PanelButtonDown').on('click', function() { var selected = win._find('PanelItems').get('selected'); if ( selected.length ) { movePanelItem(win, selected[0].index, 1); } }); win._find('PanelButtonReset').on('click', function() { var defaults = wm.getDefaultSetting('panels'); panelItems = defaults[0].items; renderItems(win); }); win._find('PanelButtonOptions').on('click', function() { var selected = win._find('PanelItems').get('selected'); if ( selected.length ) { openOptions(wm, selected[0].index); } }); }, save: function(win, scheme, settings, wm) { settings.panels = settings.panels || [{}]; settings.panels[0].options = settings.panels[0].options || {}; settings.panels[0].options.position = win._find('PanelPosition').get('value'); settings.panels[0].options.autohide = win._find('PanelAutoHide').get('value'); settings.panels[0].options.ontop = win._find('PanelOntop').get('value'); settings.panels[0].options.background = win._find('PanelBackgroundColor').get('value') || '#101010'; settings.panels[0].options.foreground = win._find('PanelForegroundColor').get('value') || '#ffffff'; settings.panels[0].options.opacity = win._find('PanelOpacity').get('value'); settings.panels[0].items = panelItems; } }; ///////////////////////////////////////////////////////////////////////////// // EXPORTS ///////////////////////////////////////////////////////////////////////////// OSjs.Applications = OSjs.Applications || {}; OSjs.Applications.ApplicationSettings = OSjs.Applications.ApplicationSettings || {}; OSjs.Applications.ApplicationSettings.Modules = OSjs.Applications.ApplicationSettings.Modules || {}; OSjs.Applications.ApplicationSettings.Modules.Panel = module; })(OSjs.Core.Application, OSjs.Core.Window, OSjs.Utils, OSjs.API, OSjs.Panel, OSjs.GUI);
9,200
2,860
import {HTMLElement} from './html-element.js'; /** * @implements globalThis.HTMLDirectoryElement */ export class HTMLDirectoryElement extends HTMLElement { constructor(ownerDocument, localName = 'dir') { super(ownerDocument, localName); } }
252
74
var __generator = (this && this.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; var __values = (this && this.__values) || function(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); }; import TreeNode from "../Base/TreeNode"; function Map(container, cmp) { var _this = this; if (container === void 0) { container = []; } cmp = cmp || (function (x, y) { if (x < y) return -1; if (x > y) return 1; return 0; }); var len = 0; var root = new TreeNode(); root.color = TreeNode.TreeNodeColorType.black; this.size = function () { return len; }; this.empty = function () { return len === 0; }; this.clear = function () { len = 0; root.key = root.value = undefined; root.leftChild = root.rightChild = root.brother = undefined; }; var findSubTreeMinNode = function (curNode) { if (!curNode || curNode.key === undefined) throw new Error("unknown error"); return curNode.leftChild ? findSubTreeMinNode(curNode.leftChild) : curNode; }; var findSubTreeMaxNode = function (curNode) { if (!curNode || curNode.key === undefined) throw new Error("unknown error"); return curNode.rightChild ? findSubTreeMaxNode(curNode.rightChild) : curNode; }; this.front = function () { if (this.empty()) return undefined; var minNode = findSubTreeMinNode(root); if (minNode.key === undefined || minNode.value === undefined) throw new Error("unknown error"); return { key: minNode.key, value: minNode.value }; }; this.back = function () { if (this.empty()) return undefined; var maxNode = findSubTreeMaxNode(root); if (maxNode.key === undefined || maxNode.value === undefined) throw new Error("unknown error"); return { key: maxNode.key, value: maxNode.value }; }; this.forEach = function (callback) { var e_1, _a; var index = 0; try { for (var _b = __values(this), _c = _b.next(); !_c.done; _c = _b.next()) { var pair = _c.value; callback(pair, index++); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } }; this.getElementByPos = function (pos) { var e_2, _a; if (pos < 0 || pos >= this.size()) throw new Error("pos must more than 0 and less than set's size"); var index = 0; try { for (var _b = __values(this), _c = _b.next(); !_c.done; _c = _b.next()) { var pair = _c.value; if (index === pos) return pair; ++index; } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_2) throw e_2.error; } } throw new Error("unknown Error"); }; var _lowerBound = function (curNode, key) { if (!curNode || curNode.key === undefined || curNode.value === undefined) return undefined; var cmpResult = cmp(curNode.key, key); if (cmpResult === 0) return { key: curNode.key, value: curNode.value }; if (cmpResult < 0) return _lowerBound(curNode.rightChild, key); return _lowerBound(curNode.leftChild, key) || { key: curNode.key, value: curNode.value }; }; this.lowerBound = function (key) { return _lowerBound(root, key); }; var _upperBound = function (curNode, key) { if (!curNode || curNode.key === undefined || curNode.value === undefined) return undefined; var cmpResult = cmp(curNode.key, key); if (cmpResult <= 0) return _upperBound(curNode.rightChild, key); return _upperBound(curNode.leftChild, key) || { key: curNode.key, value: curNode.value }; }; this.upperBound = function (key) { return _upperBound(root, key); }; var _reverseLowerBound = function (curNode, key) { if (!curNode || curNode.key === undefined || curNode.value === undefined) return undefined; var cmpResult = cmp(curNode.key, key); if (cmpResult === 0) return { key: curNode.key, value: curNode.value }; if (cmpResult > 0) return _reverseLowerBound(curNode.leftChild, key); return _reverseLowerBound(curNode.rightChild, key) || { key: curNode.key, value: curNode.value }; }; this.reverseLowerBound = function (key) { return _reverseLowerBound(root, key); }; var _reverseUpperBound = function (curNode, key) { if (!curNode || curNode.key === undefined || curNode.value === undefined) return undefined; var cmpResult = cmp(curNode.key, key); if (cmpResult >= 0) return _reverseUpperBound(curNode.leftChild, key); return _reverseUpperBound(curNode.rightChild, key) || { key: curNode.key, value: curNode.value }; }; this.reverseUpperBound = function (key) { return _reverseUpperBound(root, key); }; var eraseNodeSelfBalance = function (curNode) { var parentNode = curNode.parent; if (!parentNode) { if (curNode === root) return; throw new Error("unknown error"); } if (curNode.color === TreeNode.TreeNodeColorType.red) { curNode.color = TreeNode.TreeNodeColorType.black; return; } var brotherNode = curNode.brother; if (!brotherNode) throw new Error("unknown error"); if (curNode === parentNode.leftChild) { if (brotherNode.color === TreeNode.TreeNodeColorType.red) { brotherNode.color = TreeNode.TreeNodeColorType.black; parentNode.color = TreeNode.TreeNodeColorType.red; var newRoot = parentNode.rotateLeft(); if (root === parentNode) root = newRoot; eraseNodeSelfBalance(curNode); } else if (brotherNode.color === TreeNode.TreeNodeColorType.black) { if (brotherNode.rightChild && brotherNode.rightChild.color === TreeNode.TreeNodeColorType.red) { brotherNode.color = parentNode.color; parentNode.color = TreeNode.TreeNodeColorType.black; if (brotherNode.rightChild) brotherNode.rightChild.color = TreeNode.TreeNodeColorType.black; var newRoot = parentNode.rotateLeft(); if (root === parentNode) root = newRoot; curNode.color = TreeNode.TreeNodeColorType.black; } else if ((!brotherNode.rightChild || brotherNode.rightChild.color === TreeNode.TreeNodeColorType.black) && brotherNode.leftChild && brotherNode.leftChild.color === TreeNode.TreeNodeColorType.red) { brotherNode.color = TreeNode.TreeNodeColorType.red; if (brotherNode.leftChild) brotherNode.leftChild.color = TreeNode.TreeNodeColorType.black; var newRoot = brotherNode.rotateRight(); if (root === brotherNode) root = newRoot; eraseNodeSelfBalance(curNode); } else if ((!brotherNode.leftChild || brotherNode.leftChild.color === TreeNode.TreeNodeColorType.black) && (!brotherNode.rightChild || brotherNode.rightChild.color === TreeNode.TreeNodeColorType.black)) { brotherNode.color = TreeNode.TreeNodeColorType.red; eraseNodeSelfBalance(parentNode); } } } else if (curNode === parentNode.rightChild) { if (brotherNode.color === TreeNode.TreeNodeColorType.red) { brotherNode.color = TreeNode.TreeNodeColorType.black; parentNode.color = TreeNode.TreeNodeColorType.red; var newRoot = parentNode.rotateRight(); if (root === parentNode) root = newRoot; eraseNodeSelfBalance(curNode); } else if (brotherNode.color === TreeNode.TreeNodeColorType.black) { if (brotherNode.leftChild && brotherNode.leftChild.color === TreeNode.TreeNodeColorType.red) { brotherNode.color = parentNode.color; parentNode.color = TreeNode.TreeNodeColorType.black; if (brotherNode.leftChild) brotherNode.leftChild.color = TreeNode.TreeNodeColorType.black; var newRoot = parentNode.rotateRight(); if (root === parentNode) root = newRoot; curNode.color = TreeNode.TreeNodeColorType.black; } else if ((!brotherNode.leftChild || brotherNode.leftChild.color === TreeNode.TreeNodeColorType.black) && brotherNode.rightChild && brotherNode.rightChild.color === TreeNode.TreeNodeColorType.red) { brotherNode.color = TreeNode.TreeNodeColorType.red; if (brotherNode.rightChild) brotherNode.rightChild.color = TreeNode.TreeNodeColorType.black; var newRoot = brotherNode.rotateLeft(); if (root === brotherNode) root = newRoot; eraseNodeSelfBalance(curNode); } else if ((!brotherNode.leftChild || brotherNode.leftChild.color === TreeNode.TreeNodeColorType.black) && (!brotherNode.rightChild || brotherNode.rightChild.color === TreeNode.TreeNodeColorType.black)) { brotherNode.color = TreeNode.TreeNodeColorType.red; eraseNodeSelfBalance(parentNode); } } } }; var eraseNode = function (curNode) { var swapNode = curNode; while (swapNode.leftChild || swapNode.rightChild) { if (swapNode.rightChild) { swapNode = findSubTreeMinNode(swapNode.rightChild); var tmpKey = curNode.key; curNode.key = swapNode.key; swapNode.key = tmpKey; var tmpValue = curNode.value; curNode.value = swapNode.value; swapNode.value = tmpValue; curNode = swapNode; } if (swapNode.leftChild) { swapNode = findSubTreeMaxNode(swapNode.leftChild); var tmpKey = curNode.key; curNode.key = swapNode.key; swapNode.key = tmpKey; var tmpValue = curNode.value; curNode.value = swapNode.value; swapNode.value = tmpValue; curNode = swapNode; } } eraseNodeSelfBalance(swapNode); if (swapNode) swapNode.remove(); --len; root.color = TreeNode.TreeNodeColorType.black; }; var inOrderTraversal = function (curNode, callback) { if (!curNode || curNode.key === undefined) return false; var ifReturn = inOrderTraversal(curNode.leftChild, callback); if (ifReturn) return true; if (callback(curNode)) return true; return inOrderTraversal(curNode.rightChild, callback); }; this.eraseElementByPos = function (pos) { if (pos < 0 || pos >= len) throw new Error("pos must more than 0 and less than set's size"); var index = 0; inOrderTraversal(root, function (curNode) { if (pos === index) { eraseNode(curNode); return true; } ++index; return false; }); }; this.eraseElementByKey = function (key) { if (this.empty()) return; var curNode = findElementPos(root, key); if (curNode === undefined || curNode.key === undefined || cmp(curNode.key, key) !== 0) return; eraseNode(curNode); }; var findInsertPos = function (curNode, element) { if (!curNode || curNode.key === undefined) throw new Error("unknown error"); var cmpResult = cmp(element, curNode.key); if (cmpResult < 0) { if (!curNode.leftChild) { curNode.leftChild = new TreeNode(); curNode.leftChild.parent = curNode; curNode.leftChild.brother = curNode.rightChild; if (curNode.rightChild) curNode.rightChild.brother = curNode.leftChild; return curNode.leftChild; } return findInsertPos(curNode.leftChild, element); } else if (cmpResult > 0) { if (!curNode.rightChild) { curNode.rightChild = new TreeNode(); curNode.rightChild.parent = curNode; curNode.rightChild.brother = curNode.leftChild; if (curNode.leftChild) curNode.leftChild.brother = curNode.rightChild; return curNode.rightChild; } return findInsertPos(curNode.rightChild, element); } return curNode; }; var insertNodeSelfBalance = function (curNode) { var parentNode = curNode.parent; if (!parentNode) { if (curNode === root) return; throw new Error("unknown error"); } if (parentNode.color === TreeNode.TreeNodeColorType.black) return; if (parentNode.color === TreeNode.TreeNodeColorType.red) { var uncleNode = parentNode.brother; var grandParent = parentNode.parent; if (!grandParent) throw new Error("unknown error"); if (uncleNode && uncleNode.color === TreeNode.TreeNodeColorType.red) { uncleNode.color = parentNode.color = TreeNode.TreeNodeColorType.black; grandParent.color = TreeNode.TreeNodeColorType.red; insertNodeSelfBalance(grandParent); } else if (!uncleNode || uncleNode.color === TreeNode.TreeNodeColorType.black) { if (parentNode === grandParent.leftChild) { if (curNode === parentNode.leftChild) { parentNode.color = TreeNode.TreeNodeColorType.black; grandParent.color = TreeNode.TreeNodeColorType.red; var newRoot = grandParent.rotateRight(); if (grandParent === root) root = newRoot; } else if (curNode === parentNode.rightChild) { var newRoot = parentNode.rotateLeft(); if (grandParent === root) root = newRoot; insertNodeSelfBalance(parentNode); } } else if (parentNode === grandParent.rightChild) { if (curNode === parentNode.leftChild) { var newRoot = parentNode.rotateRight(); if (grandParent === root) root = newRoot; insertNodeSelfBalance(parentNode); } else if (curNode === parentNode.rightChild) { parentNode.color = TreeNode.TreeNodeColorType.black; grandParent.color = TreeNode.TreeNodeColorType.red; var newRoot = grandParent.rotateLeft(); if (grandParent === root) root = newRoot; } } } } }; this.setElement = function (key, value) { if (key === null || key === undefined) { throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here"); } if (value === null || value === undefined) { this.eraseElementByKey(key); return; } if (this.empty()) { ++len; root.key = key; root.value = value; root.color = TreeNode.TreeNodeColorType.black; return; } var curNode = findInsertPos(root, key); if (curNode.key !== undefined && cmp(curNode.key, key) === 0) { curNode.value = value; return; } ++len; curNode.key = key; curNode.value = value; insertNodeSelfBalance(curNode); root.color = TreeNode.TreeNodeColorType.black; }; var findElementPos = function (curNode, element) { if (!curNode || curNode.key === undefined) return undefined; var cmpResult = cmp(element, curNode.key); if (cmpResult < 0) return findElementPos(curNode.leftChild, element); else if (cmpResult > 0) return findElementPos(curNode.rightChild, element); return curNode; }; this.find = function (element) { return !!findElementPos(root, element); }; this.getElementByKey = function (element) { var curNode = findElementPos(root, element); if ((curNode === null || curNode === void 0 ? void 0 : curNode.key) === undefined || (curNode === null || curNode === void 0 ? void 0 : curNode.value) === undefined) throw new Error("unknown error"); return curNode.value; }; // waiting for optimization, this is O(mlog(n+m)) algorithm now, but we expect it to be O(mlog(n/m+1)). // (https://en.wikipedia.org/wiki/Red%E2%80%93black_tree#Set_operations_and_bulk_operations) this.union = function (other) { var _this = this; other.forEach(function (_a) { var key = _a.key, value = _a.value; return _this.setElement(key, value); }); }; this.getHeight = function () { if (this.empty()) return 0; var traversal = function (curNode) { if (!curNode) return 1; return Math.max(traversal(curNode.leftChild), traversal(curNode.rightChild)) + 1; }; return traversal(root); }; var iterationFunc = function (curNode) { return __generator(this, function (_a) { switch (_a.label) { case 0: if (!curNode || curNode.key === undefined || curNode.value === undefined) return [2 /*return*/]; return [5 /*yield**/, __values(iterationFunc(curNode.leftChild))]; case 1: _a.sent(); return [4 /*yield*/, { key: curNode.key, value: curNode.value }]; case 2: _a.sent(); return [5 /*yield**/, __values(iterationFunc(curNode.rightChild))]; case 3: _a.sent(); return [2 /*return*/]; } }); }; this[Symbol.iterator] = function () { return iterationFunc(root); }; container.forEach(function (_a) { var key = _a.key, value = _a.value; return _this.setElement(key, value); }); Object.freeze(this); } Object.freeze(Map); export default Map;
22,069
6,172
'use strict'; const runJustAPIJSON = require('./helpers').runJustAPIJSON; const expect = require('chai').expect; const fs = require('fs'); describe('Multipart form post', function () { let suiteContext = this; before(async function () { let result = runJustAPIJSON('multipartformpost.suite.yml'); if (result.error) throw result.error; expect(result.exitCode).to.equal(1); expect(result.terminationSignal).to.be.a('null'); const report = fs.readFileSync(result.jsonReport); let reportData = JSON.parse(report); expect(reportData.passedSuitesCount).to.equal(0); expect(reportData.skippedSuitesCount).to.equal(0); expect(reportData.failedSuitesCount).to.equal(1); expect(reportData.passedTestsCount).to.equal(3); expect(reportData.skippedTestsCount).to.equal(0); expect(reportData.failedTestsCount).to.equal(3); expect(reportData.suites.length).to.equal(1); expect(reportData.suites[0].status).to.equal('fail'); suiteContext.result = reportData.suites[0]; }); it('post multipart form data single file and field', function () { let result = suiteContext.result; let test = result.tests.find(t => t.name === this.test.title); expect(test.status).to.equal('pass'); expect(test.error).to.be.a('null'); }); it('post multipart form data multiple files and fields', function () { let result = suiteContext.result; let test = result.tests.find(t => t.name === this.test.title); expect(test.status).to.equal('pass'); expect(test.error).to.be.a('null'); }); it('post multipart form data single file and json text as field with options', function () { let result = suiteContext.result; let test = result.tests.find(t => t.name === this.test.title); expect(test.status).to.equal('pass'); expect(test.error).to.be.a('null'); }); it('post multipart form data single file and field without header - should fail', function () { let result = suiteContext.result; let test = result.tests.find(t => t.name === this.test.title); expect(test.status).to.equal('fail'); expect(test.error.name).to.equal('InvalidRequestHeaderError'); expect(test.error.message).to.contain('Request method is post,request body is provided but Content-Type header is not provided'); }); it('post multipart form data single non existant file and field - should fail', function () { let result = suiteContext.result; let test = result.tests.find(t => t.name === this.test.title); expect(test.status).to.equal('fail'); expect(test.error.name).to.equal('RequestBodyBuilderError'); expect(test.error.message).to.contain("Provide a valid path for content of form body"); }); it('post multipart form data single directory as file and field - should fail', function () { let result = suiteContext.result; let test = result.tests.find(t => t.name === this.test.title); expect(test.status).to.equal('fail'); expect(test.error.name).to.equal('RequestBodyBuilderError'); expect(test.error.message).to.contain("Provide a valid path for content of form body"); }); });
3,323
968
Template.gamesessionEdit.helpers({ gamesession: function() { var gamesessionId = FlowRouter.getParam('gamesessionId'); var gamesession = Gamesessions.findOne(gamesessionId) || {}; if(gamesession.boardgameTags) gamesession.category = 'boardgame'; if(gamesession.videogameTags) gamesession.category = 'videogame'; Session.set('newGamesession', gamesession); return gamesession; }, meetingDateValue: function() { var date = moment(this.meetingDate, 'X'); return moment(date).format('DD/MM/YYYY HH:mm'); }, meetingTypeOptions: function() { var options = new Array( {label: TAPi18n.__('schemas.gamesession.meetingType.options.irl'), value: "irl"}, {label: TAPi18n.__('schemas.gamesession.meetingType.options.online'), value: "online"} ); return options; }, meetingServiceOptions: function() { var options = new Array( {label: TAPi18n.__('schemas.gamesession.meetingPlace.service.title.options.other'), value: "other"}, {label: TAPi18n.__('schemas.gamesession.meetingPlace.service.title.options.skype'), value: "skype"}, {label: TAPi18n.__('schemas.gamesession.meetingPlace.service.title.options.steam'), value: "steam"}, {label: TAPi18n.__('schemas.gamesession.meetingPlace.service.title.options.teamspeak'), value: "teamspeak"}, {label: TAPi18n.__('schemas.gamesession.meetingPlace.service.title.options.psn'), value: "psn"}, {label: TAPi18n.__('schemas.gamesession.meetingPlace.service.title.options.xlive'), value: "xlive"} ); return options; }, meetingTypeIsIRL: function() { var isIrl = (Session.get('newGamesession').meetingType === 'irl'); if (!isIrl) { $('[name="meetingType"]').filter('[value=online]').prop('checked', true); } else if(Session.get('newGamesession').meetingType === 'online') { $('[name="meetingType"]').filter('[value=irl]').prop('checked', true); } return isIrl; }, gamesTitlePlaceholder: function() { return TAPi18n.__('schemas.gamesession.games.$.title.placeholder') }, newGames: function (){ return Session.get('newGamesession').games; }, gamesSuggests: function() { return Session.get('suggests'); }, beforeRemove: function () { return function (collection, id) { var doc = collection.findOne(id); if (confirm(TAPi18n.__('gamesessionRemoveConfirm'))) { this.remove(); } }; }, onRemoveSuccess: function () { return function (result) { FlowRouter.go('gamesessionList'); }; } }); Template.gamesessionEdit.events({ 'change [name="meetingType"]:checked': function(e) { var form = Session.get('newGamesession'); form.meetingType = $(e.target).val(); Session.set('newGamesession', form); }, 'change [name="boardgameTags"]': function(e, tpl) { if($(e.target).is(":checked")) { var form = Session.get('newGamesession'); form.category = 'boardgame'; Session.set('newGamesession', form); tpl.$('[name="videogameTags"]').attr('checked', false); } }, 'change [name="videogameTags"]': function(e, tpl) { if($(e.target).is(":checked")) { var form = Session.get('newGamesession'); form.category = 'videogame'; Session.set('newGamesession', form); tpl.$('[name="boardgameTags"]').attr('checked', false); } }, 'change [name="games.$.title"]': function(e, tpl) { var value = $(e.target).val(); var newGamesession = Session.get('newGamesession'); if(value) { var newGame = Games.findOne(value); if(newGame) { if(!newGamesession.games) newGamesession.games = []; newGamesession.games.push(newGame); Session.set('newGamesession', newGamesession); } else { getGamesSuggestByTitle(value, newGamesession.category); } } }, 'click .game-remove': function(e, tpl) { var form = Session.get('newGamesession'); form.games.contains('title', this.title); var index = form.games.contains('title', this.title); form.games.splice(index, 1); Session.set('newGamesession', form); }, 'click [data-toggle="boardgameTags"]': function(e, tpl) { e.preventDefault(); var showGame = Session.get('showGame'); showGame.boardgameTags ++; if(showGame.boardgameTags > 1) showGame.boardgameTags = 0; Session.set('showGame', showGame); }, 'click [data-toggle="videogameTags"]': function(e, tpl) { e.preventDefault(); var showGame = Session.get('showGame'); showGame.videogameTags ++; if(showGame.videogameTags > 1) showGame.videogameTags = 0; Session.set('showGame', showGame); } }); Template.gamesessionCreate.onCreated(function() { Tracker.autorun(function() { Meteor.subscribe('someGames', {}); }); }); Template.gamesessionEdit.rendered = function() { var self = this; Tracker.autorun(function () { var lang = Session.get('lang'); self.$('.datetimepicker').datetimepicker({ format: 'DD/MM/YYYY HH:mm', formatDate: 'DD/MM/YYYY', formatTime: 'HH:mm', minDate: 0, step: 15, use24hours: true, pick12HourFormat: false, dayOfWeekStart: 1, lang: lang }); }); Session.set('suggests', null); }; AutoForm.hooks({ gamesessionUpdate: { before: { update: function(doc) { form = Session.get('newGamesession'); // Format the date time var meetingDate = moment(doc.$set.meetingDate, "DD/MM/YYYY HH:mm"); doc.$set.meetingDate = moment(meetingDate).unix(); // Choose a cover var newCover = (form.category === 'videogame')? Meteor.absoluteUrl()+'/images/cover_video.svg' : Meteor.absoluteUrl()+'/images/cover_board.svg'; if(form.games && form.games.length > 0) newCover = form.games[0].cover; doc.$set.cover = newCover; // Generate a title var newTitle = { what: TAPi18n.__('gamesessionCreateGames'), where: '', when: ''}; // Where if(doc.$set.meetingType) { if(doc.$set.meetingType === 'irl') { if(doc.$set['meetingPlace.address.city']) { newTitle.where = TAPi18n.__('helper.inCity', doc.$set['meetingPlace.address.city']); if(doc.$set['meetingPlace.address.zipCode']) { newTitle.where += ' ('+doc.$set['meetingPlace.address.zipCode']+')'; } } else if(doc.$set['meetingPlace.address.zipCode']) { newTitle.where = TAPi18n.__('helper.inZipCode', doc.$set['meetingPlace.address.zipCode']); } } else if (doc.$set.meetingType === 'online') { if(doc.$set['meetingPlace.service.title'] != 'other') { var key = TAPi18n.__('schemas.gamesession.meetingPlace.service.title.options.'+doc.$set['meetingPlace.service.title']); newTitle.where = TAPi18n.__('helper.onPlatform', key); } } } // What if(form.category === 'boardgame') { newTitle.what = TAPi18n.__('gamesessionCreateBoardGames'); } else if(form.category === 'videogame') { newTitle.what = TAPi18n.__('gamesessionCreateVideoGames'); } if(form.games.length === 1) { newTitle.what = form.games[0].title; } else { newTitle.when = splitDay(moment(doc.$set.meetingDate, 'X').hour()); } doc.$set.title = newTitle.when + ' ' + newTitle.what + ' ' + newTitle.where; // Add games doc.$set.games = form.games.map(function(item,index){ if(!item.gameId) item.gameId = item._id; return item; }); delete doc.$set['games.$.title']; delete doc.$unset['games.$']; return doc; } }, onSuccess: function(t, result) { FlowRouter.go('gamesessionList'); }, onError: function(formType, error) { console.log(error); } } });
7,909
2,648
/** * LEETCODE 151: Reverse Words in String * * https://leetcode.com/problems/reverse-words-in-a-string/ * * Given an input string, reverse the string word by word. A word is * defined as a sequence of non-space characters. * * The input string does not contain leading or trailing spaces and the * words are always separated by a single space. For example, Given s = * "the sky is blue", return "blue is sky the". */ // SOLUTION #1: WITH STACK const reverseWords = input => { // what we return let returnValue = ""; // parse input, throw words into a Stack const stack = []; const tokens = input.split(" "); tokens.forEach(token => { if (token.length > 0) stack.push(token); // trim spaces before & after? }); // iterate thru stack, build output stack.reverse().forEach(word => { returnValue += word + " "; }); returnValue = returnValue.trim(); // finally return return returnValue; }; // SOLUTION #2: IN PLACE const noStackReverseWords = input => { // what we return let returnValue = ""; // reverse input input = input .split("") .reverse() .join(""); console.log(input); returnValue = input .split(" ") .map(word => { return word .split("") .reverse() .join(""); }) .join(" "); // finally return return returnValue; }; //// TEST CASES //// // 1 let input = "the sky is blue"; let output = noStackReverseWords(input); console.log("in: <" + input + ">\nout: <" + output + ">"); // 2 console.log("===="); input = " welcome to Florida!"; output = noStackReverseWords(input); console.log("in: <" + input + ">\nout: <" + output + ">");
1,667
545
import React from 'react'; const Multi = () => [ 'first sibling', 'second sibling' ].map((v, i) => <p key={i}>{v}</p>); export default Multi;
148
57
//* @protected /** If you make changes to _enyo.xhr_, be sure to add or update the appropriate [unit tests](https://github.com/enyojs/enyo/tree/master/tools/test/ajax/tests). */ enyo.xhr = { /** <code>inParams</code> is an Object that may contain these properties: - _url_: The URL to request (required). - _method_: The HTTP method to use for the request. Defaults to GET. - _callback_: Called when request is completed. (Optional) - _body_: Specific contents for the request body for POST method. (Optional) - _headers_: Additional request headers. (Optional). Given headers override the ones that Enyo may set by default (`null` explictly removing the header from the AJAX request). - _username_: The optional user name to use for authentication purposes. - _password_: The optional password to use for authentication purposes. - _xhrFields_: Optional object containing name/value pairs to mix directly into the generated xhr object. - _mimeType_: Optional string to override the MIME-Type. */ request: function(inParams) { var xhr = this.getXMLHttpRequest(inParams); var url = enyo.path.rewrite(this.simplifyFileURL(inParams.url)); // var method = inParams.method || "GET"; var async = !inParams.sync; // if (inParams.username) { xhr.open(method, url, async, inParams.username, inParams.password); } else { xhr.open(method, url, async); } // enyo.mixin(xhr, inParams.xhrFields); // only setup handler when we have a callback if (inParams.callback) { this.makeReadyStateHandler(xhr, inParams.callback); } // inParams.headers = inParams.headers || {}; // work around iOS 6 bug where non-GET requests are cached // see http://www.einternals.com/blog/web-development/ios6-0-caching-ajax-post-requests // not sure (yet) wether this will be required for later ios releases if (method !== "GET" && enyo.platform.ios && enyo.platform.ios >= 6) { if (inParams.headers["cache-control"] !== null) { inParams.headers["cache-control"] = inParams.headers['cache-control'] || "no-cache"; } } // user-set headers override any platform-default if (xhr.setRequestHeader) { for (var key in inParams.headers) { if (inParams.headers[key]) { xhr.setRequestHeader(key, inParams.headers[key]); } } } // if((typeof xhr.overrideMimeType == "function") && inParams.mimeType) { xhr.overrideMimeType(inParams.mimeType); } // xhr.send(inParams.body || null); if (!async && inParams.callback) { xhr.onreadystatechange(xhr); } return xhr; }, //* remove any callbacks that might be set from Enyo code for an existing XHR //* and stop the XHR from completing. cancel: function(inXhr) { if (inXhr.onload) { inXhr.onload = null; } if (inXhr.onreadystatechange) { inXhr.onreadystatechange = null; } if (inXhr.abort) { inXhr.abort(); } }, //* @protected makeReadyStateHandler: function(inXhr, inCallback) { if (window.XDomainRequest && inXhr instanceof XDomainRequest) { inXhr.onload = function() { var text; if (typeof inXhr.responseText === "string") { text = inXhr.responseText; } inCallback.apply(null, [text, inXhr]); }; } inXhr.onreadystatechange = function() { if (inXhr.readyState == 4) { var text; if (typeof inXhr.responseText === "string") { text = inXhr.responseText; } inCallback.apply(null, [text, inXhr]); } }; }, inOrigin: function(inUrl) { var a = document.createElement("a"), result = false; a.href = inUrl; // protocol is ":" for relative URLs if (a.protocol === ":" || (a.protocol === window.location.protocol && a.hostname === window.location.hostname && a.port === (window.location.port || (window.location.protocol === "https:" ? "443" : "80")))) { result = true; } return result; }, simplifyFileURL: function(inUrl) { var a = document.createElement("a"), result = false; a.href = inUrl; // protocol is ":" for relative URLs if (a.protocol === "file:" || a.protocol === ":" && window.location.protocol === "file:") { // leave off search and hash parts of the URL return a.protocol + '//' + a.host + a.pathname; } else if (a.protocol === ":" && window.location.protocol === "x-wmapp0:") { // explicitly return absolute URL for Windows Phone 8, as an absolute path is required for local files return window.location.protocol + "//" + window.location.pathname.split('/')[0] + "/" + a.host + a.pathname; } else { return inUrl; } }, getXMLHttpRequest: function(inParams) { try { // only use XDomainRequest when it exists, no extra headers were set, and the // target URL maps to a domain other than the document origin. if (enyo.platform.ie < 10 && window.XDomainRequest && !inParams.headers && !this.inOrigin(inParams.url) && !/^file:\/\//.test(window.location.href)) { return new XDomainRequest(); } } catch(e) {} try { return new XMLHttpRequest(); } catch(e) {} return null; } };
4,999
1,861
import Outlet from '../../../../src/classes/outlet'; import { mountSpies, cMountSpies, } from '../sinon-spies'; import { SinonSpyRootApp } from './base-mounts'; import { RootRootRoute, RootNewsRoute, RootAllConditionalRoute, RootNewsConditionalRoute, RootIdConditionalRouteOne, RootIdConditionalRouteTwo, RootConditionalRoute, } from './root-routes'; import TodoApp from './todo-app/'; import UserApp from './user-app/'; // need to make sure to mount each mount class and // each conditional mount class exactly once, // to ensure spy call counts are unique and correct class MyRootApp extends SinonSpyRootApp { createOutlets(outlets) { // mounts outlets.RootRootRoute = new Outlet(document.createElement('div')); outlets.RootNewsRoute = new Outlet(document.createElement('div')); outlets.TodoApp = new Outlet(document.createElement('div')); outlets.UserApp = new Outlet(document.createElement('div')); // conditional mounts outlets.RootAllConditionalRoute = new Outlet(document.createElement('div')); outlets.RootNewsConditionalRoute = new Outlet(document.createElement('div')); outlets.RootIdConditionalRouteOne = new Outlet(document.createElement('div')); outlets.RootIdConditionalRouteTwo = new Outlet(document.createElement('div')); outlets.RootConditionalRoute = new Outlet(document.createElement('div')); return outlets; } mount() { return { '': RootRootRoute .addresses('rootRoot') .outlets('RootRootRoute') .setup(() => mountSpies), 'news/{news=\\w+}': RootNewsRoute .outlets('RootNewsRoute') .setup(() => mountSpies), 'todos/{id=\\d+}': TodoApp .addresses('todoApp') .outlets('TodoApp') .setup(() => mountSpies), 'user/{id=\\d+}': UserApp .addresses('userApp') .outlets('UserApp') .setup(() => mountSpies), }; } mountConditionals() { return { '*': RootAllConditionalRoute .outlets('RootAllConditionalRoute') .setup(() => cMountSpies), '!todoApp,userApp,rootRoot': RootNewsConditionalRoute .outlets('RootNewsConditionalRoute') .setup(() => cMountSpies), '+userApp': [ RootIdConditionalRouteOne .outlets('RootIdConditionalRouteOne') .setup(() => cMountSpies), RootIdConditionalRouteTwo .outlets('RootIdConditionalRouteTwo') .setup(() => cMountSpies), ], '+rootRoot': RootConditionalRoute .outlets('RootConditionalRoute') .setup(() => cMountSpies), }; } } export default MyRootApp.setup(() => mountSpies);
3,179
836
import Client from './Client'; import sinon from 'sinon'; import { expect } from './tests/chai'; describe('Client', () => { it('makes a GET request', () => { const superagent = { get: sinon.stub(), }; superagent .get.withArgs('http://example.com/custom-path') .returns(Promise.resolve({ body: { property: 'value', }, status: 200, })); const client = new Client(superagent); client.setHost('http://example.com'); return client.get('/custom-path') .then(response => { expect(response.body).to.matchPattern( ` { "property": "value", } ` ); expect(response.status).to.be.equal(200); }); }); it('makes a POST request', () => { const body = { property: 'value', other: 'value', }; const superagent = { post: sinon.stub(), }; const poster = { send: sinon.stub(), }; superagent.post.withArgs('http://example.com/custom-path') .returns(poster); poster.send.withArgs(body) .returns(Promise.resolve({ body: { property: 'value', }, status: 201, })); const client = new Client(superagent); client.setHost('http://example.com'); return client.post('/custom-path', body) .then(response => { expect(response.body).to.matchPattern( ` { "property": "value", } ` ); expect(response.status).to.be.equal(201); }); }); it('sets headers', () => { const superagent = { get: sinon.stub(), }; const request = { set: sinon.spy(), then: () => Promise.resolve(), }; superagent .get.withArgs('http://example.com/path') .returns(request); const client = new Client(superagent); client.setHost('http://example.com'); client.setHeader('Accept', 'application/json'); return client.get('/path') .then(response => { expect(request.set.withArgs('Accept', 'application/json')).to.have.been.calledOnce; }); }); });
2,176
681
import jsonp from '../common/js/jsonp' import {commonParams, options} from './config' /* eslint-disable */ /*export function getSingerList() { const url = ' https://u.y.qq.com/cgi-bin/musicu.fcg' const data = Object.assign({}, commonParams, { jsonpCallback: 'getUCGI6636201101768355', g_tk: 5381, loginUin: 0, hostUin: 0, needNewCode: 0, platform: 'yqq', data: '{"comm":{"ct":24,"cv":10000},"singerList":{"module":"Music.SingerListServer","method":"get_singer_list","param":{"area":-100,"sex":-100,"genre":-100,"index":-100,"sin":0,"cur_page":1}}}' }) return jsonp(url, data, { name: 'getUCGI6636201101768355' }) }*/ export function getSingerList() { const url = 'https://c.y.qq.com/v8/fcg-bin/v8.fcg' const data = Object.assign({}, commonParams, { channel: 'singer', page: 'list', key: 'all_all_all', pagesize: 100, pagenum: 1, hostUin: 0, needNewCode: 0, platform: 'yqq' }) return jsonp(url, data, options) } export function getSingerDetail(singerId) { const url = 'https://c.y.qq.com/v8/fcg-bin/fcg_v8_singer_track_cp.fcg' const data = Object.assign({}, commonParams, { hostUin: 0, needNewCode: 0, platform: 'yqq', order: 'listen', begin: 0, num: 100, songstatus: 1, g_tk: 1664029744, singermid: singerId }) return jsonp(url, data, options) }
1,377
606
'use strict'; const Base = require('./Base'); const BaseMessageComponent = require('./BaseMessageComponent'); const ClientApplication = require('./ClientApplication'); const InteractionCollector = require('./InteractionCollector'); const MessageAttachment = require('./MessageAttachment'); const Embed = require('./MessageEmbed'); const Mentions = require('./MessageMentions'); const MessagePayload = require('./MessagePayload'); const ReactionCollector = require('./ReactionCollector'); const Sticker = require('./Sticker'); const { Error } = require('../errors'); const ReactionManager = require('../managers/ReactionManager'); const Collection = require('../util/Collection'); const { InteractionTypes, MessageTypes, SystemMessageTypes } = require('../util/Constants'); const MessageFlags = require('../util/MessageFlags'); const Permissions = require('../util/Permissions'); const SnowflakeUtil = require('../util/SnowflakeUtil'); const Util = require('../util/Util'); /** * Represents a message on Discord. * @extends {Base} */ class Message extends Base { /** * @param {Client} client The instantiating client * @param {APIMessage} data The data for the message * @param {TextChannel|DMChannel|NewsChannel|ThreadChannel} channel The channel the message was sent in */ constructor(client, data, channel) { super(client); /** * The channel that the message was sent in * @type {TextChannel|DMChannel|NewsChannel|ThreadChannel} */ this.channel = channel; /** * Whether this message has been deleted * @type {boolean} */ this.deleted = false; if (data) this._patch(data); } _patch(data) { /** * The message's id * @type {Snowflake} */ this.id = data.id; if ('type' in data) { /** * The type of the message * @type {?MessageType} */ this.type = MessageTypes[data.type]; /** * Whether or not this message was sent by Discord, not actually a user (e.g. pin notifications) * @type {?boolean} */ this.system = SystemMessageTypes.includes(this.type); } else if (typeof this.type !== 'string') { this.system = null; this.type = null; } if ('content' in data) { /** * The content of the message * @type {?string} */ this.content = data.content; } else if (typeof this.content !== 'string') { this.content = null; } if ('author' in data) { /** * The author of the message * @type {?User} */ this.author = this.client.users._add(data.author, !data.webhook_id); } else if (!this.author) { this.author = null; } if ('pinned' in data) { /** * Whether or not this message is pinned * @type {?boolean} */ this.pinned = Boolean(data.pinned); } else if (typeof this.pinned !== 'boolean') { this.pinned = null; } if ('thread' in data) { /** * The thread started by this message * @type {?ThreadChannel} */ this.thread = this.client.channels._add(data.thread); } else if (!this.thread) { this.thread = null; } if ('tts' in data) { /** * Whether or not the message was Text-To-Speech * @type {?boolean} */ this.tts = data.tts; } else if (typeof this.tts !== 'boolean') { this.tts = null; } /** * A random number or string used for checking message delivery * <warn>This is only received after the message was sent successfully, and * lost if re-fetched</warn> * @type {?string} */ this.nonce = 'nonce' in data ? data.nonce : null; /** * A list of embeds in the message - e.g. YouTube Player * @type {MessageEmbed[]} */ this.embeds = data.embeds?.map(e => new Embed(e, true)) ?? []; /** * A list of MessageActionRows in the message * @type {MessageActionRow[]} */ this.components = data.components?.map(c => BaseMessageComponent.create(c, this.client)) ?? []; /** * A collection of attachments in the message - e.g. Pictures - mapped by their ids * @type {Collection<Snowflake, MessageAttachment>} */ this.attachments = new Collection(); if (data.attachments) { for (const attachment of data.attachments) { this.attachments.set(attachment.id, new MessageAttachment(attachment.url, attachment.filename, attachment)); } } /** * A collection of stickers in the message * @type {Collection<Snowflake, Sticker>} */ this.stickers = new Collection(); if (data.stickers) { for (const sticker of data.stickers) { this.stickers.set(sticker.id, new Sticker(this.client, sticker)); } } /** * The timestamp the message was sent at * @type {number} */ this.createdTimestamp = SnowflakeUtil.deconstruct(this.id).timestamp; /** * The timestamp the message was last edited at (if applicable) * @type {?number} */ this.editedTimestamp = data.edited_timestamp ? new Date(data.edited_timestamp).getTime() : null; /** * A manager of the reactions belonging to this message * @type {ReactionManager} */ this.reactions = new ReactionManager(this); if (data.reactions?.length > 0) { for (const reaction of data.reactions) { this.reactions._add(reaction); } } /** * All valid mentions that the message contains * @type {MessageMentions} */ this.mentions = new Mentions( this, data.mentions, data.mention_roles, data.mention_everyone, data.mention_channels, data.referenced_message?.author, ); /** * The id of the webhook that sent the message, if applicable * @type {?Snowflake} */ this.webhookId = data.webhook_id ?? null; /** * Supplemental application information for group activities * @type {?ClientApplication} */ this.groupActivityApplication = data.application ? new ClientApplication(this.client, data.application) : null; /** * The id of the application of the interaction that sent this message, if any * @type {?Snowflake} */ this.applicationId = data.application_id ?? null; /** * Group activity * @type {?MessageActivity} */ this.activity = data.activity ? { partyId: data.activity.party_id, type: data.activity.type, } : null; if (this.member && data.member) { this.member._patch(data.member); } else if (data.member && this.guild && this.author) { this.guild.members._add(Object.assign(data.member, { user: this.author })); } /** * Flags that are applied to the message * @type {Readonly<MessageFlags>} */ this.flags = new MessageFlags(data.flags).freeze(); /** * Reference data sent in a message that contains ids identifying the referenced message * @typedef {Object} MessageReference * @property {string} channelId The channel's id the message was referenced * @property {?string} guildId The guild's id the message was referenced * @property {?string} messageId The message's id that was referenced */ /** * Message reference data * @type {?MessageReference} */ this.reference = data.message_reference ? { channelId: data.message_reference.channel_id, guildId: data.message_reference.guild_id, messageId: data.message_reference.message_id, } : null; if (data.referenced_message) { this.channel.messages._add(data.referenced_message); } /** * Partial data of the interaction that a message is a reply to * @typedef {Object} MessageInteraction * @property {Snowflake} id The interaction's id * @property {InteractionType} type The type of the interaction * @property {string} commandName The name of the interaction's application command * @property {User} user The user that invoked the interaction */ if (data.interaction) { /** * Partial data of the interaction that this message is a reply to * @type {?MessageInteraction} */ this.interaction = { id: data.interaction.id, type: InteractionTypes[data.interaction.type], commandName: data.interaction.name, user: this.client.users._add(data.interaction.user), }; } else if (!this.interaction) { this.interaction = null; } } /** * Whether or not this message is a partial * @type {boolean} * @readonly */ get partial() { return typeof this.content !== 'string' || !this.author; } /** * Updates the message and returns the old message. * @param {APIMessage} data Raw Discord message update data * @returns {Message} * @private */ patch(data) { const clone = this._clone(); if (data.edited_timestamp) this.editedTimestamp = new Date(data.edited_timestamp).getTime(); if ('content' in data) this.content = data.content; if ('pinned' in data) this.pinned = data.pinned; if ('tts' in data) this.tts = data.tts; if ('thread' in data) this.thread = this.client.channels._add(data.thread); if ('attachments' in data) { this.attachments = new Collection(); for (const attachment of data.attachments) { this.attachments.set(attachment.id, new MessageAttachment(attachment.url, attachment.filename, attachment)); } } else { this.attachments = new Collection(this.attachments); } this.embeds = data.embeds?.map(e => new Embed(e, true)) ?? this.embeds.slice(); this.components = data.components?.map(c => BaseMessageComponent.create(c, this.client)) ?? this.components.slice(); this.mentions = new Mentions( this, data.mentions ?? this.mentions.users, data.mention_roles ?? this.mentions.roles, data.mention_everyone ?? this.mentions.everyone, data.mention_channels ?? this.mentions.crosspostedChannels, data.referenced_message?.author ?? this.mentions.repliedUser, ); this.flags = new MessageFlags(data.flags ?? 0).freeze(); return clone; } /** * Represents the author of the message as a guild member. * Only available if the message comes from a guild where the author is still a member * @type {?GuildMember} * @readonly */ get member() { return this.guild?.members.resolve(this.author) ?? null; } /** * The time the message was sent at * @type {Date} * @readonly */ get createdAt() { return new Date(this.createdTimestamp); } /** * The time the message was last edited at (if applicable) * @type {?Date} * @readonly */ get editedAt() { return this.editedTimestamp ? new Date(this.editedTimestamp) : null; } /** * The guild the message was sent in (if in a guild channel) * @type {?Guild} * @readonly */ get guild() { return this.channel.guild ?? null; } /** * The url to jump to this message * @type {string} * @readonly */ get url() { return `https://discord.com/channels/${this.guild ? this.guild.id : '@me'}/${this.channel.id}/${this.id}`; } /** * The message contents with all mentions replaced by the equivalent text. * If mentions cannot be resolved to a name, the relevant mention in the message content will not be converted. * @type {string} * @readonly */ get cleanContent() { // eslint-disable-next-line eqeqeq return this.content != null ? Util.cleanContent(this.content, this.channel) : null; } /** * Creates a reaction collector. * @param {ReactionCollectorOptions} [options={}] Options to send to the collector * @returns {ReactionCollector} * @example * // Create a reaction collector * const filter = (reaction, user) => reaction.emoji.name === '👌' && user.id === 'someId'; * const collector = message.createReactionCollector({ filter, time: 15000 }); * collector.on('collect', r => console.log(`Collected ${r.emoji.name}`)); * collector.on('end', collected => console.log(`Collected ${collected.size} items`)); */ createReactionCollector(options = {}) { return new ReactionCollector(this, options); } /** * An object containing the same properties as CollectorOptions, but a few more: * @typedef {ReactionCollectorOptions} AwaitReactionsOptions * @property {string[]} [errors] Stop/end reasons that cause the promise to reject */ /** * Similar to createReactionCollector but in promise form. * Resolves with a collection of reactions that pass the specified filter. * @param {AwaitReactionsOptions} [options={}] Optional options to pass to the internal collector * @returns {Promise<Collection<string, MessageReaction>>} * @example * // Create a reaction collector * const filter = (reaction, user) => reaction.emoji.name === '👌' && user.id === 'someId' * message.awaitReactions({ filter, time: 15000 }) * .then(collected => console.log(`Collected ${collected.size} reactions`)) * .catch(console.error); */ awaitReactions(options = {}) { return new Promise((resolve, reject) => { const collector = this.createReactionCollector(options); collector.once('end', (reactions, reason) => { if (options.errors?.includes(reason)) reject(reactions); else resolve(reactions); }); }); } /** * @typedef {CollectorOptions} MessageComponentCollectorOptions * @property {MessageComponentType} [componentType] The type of component to listen for * @property {number} [max] The maximum total amount of interactions to collect * @property {number} [maxComponents] The maximum number of components to collect * @property {number} [maxUsers] The maximum number of users to interact */ /** * Creates a message component interaction collector. * @param {MessageComponentCollectorOptions} [options={}] Options to send to the collector * @returns {InteractionCollector} * @example * // Create a message component interaction collector * const filter = (interaction) => interaction.customId === 'button' && interaction.user.id === 'someId'; * const collector = message.createMessageComponentCollector({ filter, time: 15000 }); * collector.on('collect', i => console.log(`Collected ${i.customId}`)); * collector.on('end', collected => console.log(`Collected ${collected.size} items`)); */ createMessageComponentCollector(options = {}) { return new InteractionCollector(this.client, { ...options, interactionType: InteractionTypes.MESSAGE_COMPONENT, message: this, }); } /** * An object containing the same properties as CollectorOptions, but a few more: * @typedef {Object} AwaitMessageComponentOptions * @property {CollectorFilter} [filter] The filter applied to this collector * @property {number} [time] Time to wait for an interaction before rejecting * @property {MessageComponentType} [componentType] The type of component interaction to collect */ /** * Collects a single component interaction that passes the filter. * The Promise will reject if the time expires. * @param {AwaitMessageComponentOptions} [options={}] Options to pass to the internal collector * @returns {Promise<MessageComponentInteraction>} * @example * // Collect a message component interaction * const filter = (interaction) => interaction.customId === 'button' && interaction.user.id === 'someId'; * message.awaitMessageComponent({ filter, time: 15000 }) * .then(interaction => console.log(`${interaction.customId} was clicked!`)) * .catch(console.error); */ awaitMessageComponent(options = {}) { const _options = { ...options, max: 1 }; return new Promise((resolve, reject) => { const collector = this.createMessageComponentCollector(_options); collector.once('end', (interactions, reason) => { const interaction = interactions.first(); if (interaction) resolve(interaction); else reject(new Error('INTERACTION_COLLECTOR_ERROR', reason)); }); }); } /** * Whether the message is editable by the client user * @type {boolean} * @readonly */ get editable() { return this.author.id === this.client.user.id; } /** * Whether the message is deletable by the client user * @type {boolean} * @readonly */ get deletable() { return Boolean( !this.deleted && (this.author.id === this.client.user.id || this.channel.permissionsFor?.(this.client.user)?.has(Permissions.FLAGS.MANAGE_MESSAGES)), ); } /** * Whether the message is pinnable by the client user * @type {boolean} * @readonly */ get pinnable() { return ( this.type === 'DEFAULT' && (!this.guild || this.channel.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_MESSAGES, false)) ); } /** * Fetches the Message this crosspost/reply/pin-add references, if available to the client * @returns {Promise<Message>} */ async fetchReference() { if (!this.reference) throw new Error('MESSAGE_REFERENCE_MISSING'); const { channelId, messageId } = this.reference; const channel = this.client.channels.resolve(channelId); if (!channel) throw new Error('GUILD_CHANNEL_RESOLVE'); const message = await channel.messages.fetch(messageId); return message; } /** * Whether the message is crosspostable by the client user * @type {boolean} * @readonly */ get crosspostable() { return ( this.channel.type === 'news' && !this.flags.has(MessageFlags.FLAGS.CROSSPOSTED) && this.type === 'DEFAULT' && this.channel.viewable && this.channel.permissionsFor(this.client.user).has(Permissions.FLAGS.SEND_MESSAGES) && (this.author.id === this.client.user.id || this.channel.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_MESSAGES)) ); } /** * Options that can be passed into {@link Message#edit}. * @typedef {Object} MessageEditOptions * @property {?string} [content] Content to be edited * @property {MessageEmbed[]|APIEmbed[]} [embeds] Embeds to be added/edited * @property {MessageMentionOptions} [allowedMentions] Which mentions should be parsed from the message content * @property {MessageFlags} [flags] Which flags to set for the message. Only `SUPPRESS_EMBEDS` can be edited. * @property {MessageAttachment[]} [attachments] An array of attachments to keep, * all attachments will be kept if omitted * @property {FileOptions[]|BufferResolvable[]|MessageAttachment[]} [files] Files to add to the message * @property {MessageActionRow[]|MessageActionRowOptions[]|MessageActionRowComponentResolvable[][]} [components] * Action rows containing interactive components for the message (buttons, select menus) */ /** * Edits the content of the message. * @param {string|MessagePayload|MessageEditOptions} options The options to provide * @returns {Promise<Message>} * @example * // Update the content of a message * message.edit('This is my new content!') * .then(msg => console.log(`Updated the content of a message to ${msg.content}`)) * .catch(console.error); */ edit(options) { return this.channel.messages.edit(this, options); } /** * Publishes a message in an announcement channel to all channels following it. * @returns {Promise<Message>} * @example * // Crosspost a message * if (message.channel.type === 'news') { * message.crosspost() * .then(() => console.log('Crossposted message')) * .catch(console.error); * } */ crosspost() { return this.channel.messages.crosspost(this.id); } /** * Pins this message to the channel's pinned messages. * @returns {Promise<Message>} * @example * // Pin a message * message.pin() * .then(console.log) * .catch(console.error) */ pin() { return this.channel.messages.pin(this.id).then(() => this); } /** * Unpins this message from the channel's pinned messages. * @returns {Promise<Message>} * @example * // Unpin a message * message.unpin() * .then(console.log) * .catch(console.error) */ unpin() { return this.channel.messages.unpin(this.id).then(() => this); } /** * Adds a reaction to the message. * @param {EmojiIdentifierResolvable} emoji The emoji to react with * @returns {Promise<MessageReaction>} * @example * // React to a message with a unicode emoji * message.react('🤔') * .then(console.log) * .catch(console.error); * @example * // React to a message with a custom emoji * message.react(message.guild.emojis.cache.get('123456789012345678')) * .then(console.log) * .catch(console.error); */ async react(emoji) { emoji = this.client.emojis.resolveIdentifier(emoji); await this.channel.messages.react(this.id, emoji); return this.client.actions.MessageReactionAdd.handle({ user: this.client.user, channel: this.channel, message: this, emoji: Util.parseEmoji(emoji), }).reaction; } /** * Deletes the message. * @returns {Promise<Message>} * @example * // Delete a message * message.delete() * .then(msg => console.log(`Deleted message from ${msg.author.username}`)) * .catch(console.error); */ async delete() { await this.channel.messages.delete(this.id); return this; } /** * Options provided when sending a message as an inline reply. * @typedef {BaseMessageOptions} ReplyMessageOptions * @property {boolean} [failIfNotExists=true] Whether to error if the referenced message * does not exist (creates a standard message in this case when false) */ /** * Send an inline reply to this message. * @param {string|MessagePayload|ReplyMessageOptions} options The options to provide * @returns {Promise<Message|Message[]>} * @example * // Reply to a message * message.reply('This is a reply!') * .then(() => console.log(`Replied to message "${message.content}"`)) * .catch(console.error); */ reply(options) { let data; if (options instanceof MessagePayload) { data = options; } else { data = MessagePayload.create(this, options, { reply: { messageReference: this, failIfNotExists: options?.failIfNotExists ?? this.client.options.failIfNotExists, }, }); } return this.channel.send(data); } /** * Create a new public thread from this message * @see ThreadManager#create * @param {string} name The name of the new Thread * @param {ThreadAutoArchiveDuration} autoArchiveDuration How long before the thread is automatically archived * @param {string} [reason] Reason for creating the thread * @returns {Promise<ThreadChannel>} */ startThread(name, autoArchiveDuration, reason) { if (!['text', 'news'].includes(this.channel.type)) { return Promise.reject(new Error('MESSAGE_THREAD_PARENT')); } return this.channel.threads.create({ name, autoArchiveDuration, startMessage: this, reason }); } /** * Fetch this message. * @param {boolean} [force=false] Whether to skip the cache check and request the API * @returns {Promise<Message>} */ fetch(force = false) { return this.channel.messages.fetch(this.id, true, force); } /** * Fetches the webhook used to create this message. * @returns {Promise<?Webhook>} */ fetchWebhook() { if (!this.webhookId) return Promise.reject(new Error('WEBHOOK_MESSAGE')); return this.client.fetchWebhook(this.webhookId); } /** * Suppresses or unsuppresses embeds on a message. * @param {boolean} [suppress=true] If the embeds should be suppressed or not * @returns {Promise<Message>} */ suppressEmbeds(suppress = true) { const flags = new MessageFlags(this.flags.bitfield); if (suppress) { flags.add(MessageFlags.FLAGS.SUPPRESS_EMBEDS); } else { flags.remove(MessageFlags.FLAGS.SUPPRESS_EMBEDS); } return this.edit({ flags }); } /** * Removes the attachments from this message. * @returns {Promise<Message>} */ removeAttachments() { return this.edit({ attachments: [] }); } /** * Used mainly internally. Whether two messages are identical in properties. If you want to compare messages * without checking all the properties, use `message.id === message2.id`, which is much more efficient. This * method allows you to see if there are differences in content, embeds, attachments, nonce and tts properties. * @param {Message} message The message to compare it to * @param {APIMessage} rawData Raw data passed through the WebSocket about this message * @returns {boolean} */ equals(message, rawData) { if (!message) return false; const embedUpdate = !message.author && !message.attachments; if (embedUpdate) return this.id === message.id && this.embeds.length === message.embeds.length; let equal = this.id === message.id && this.author.id === message.author.id && this.content === message.content && this.tts === message.tts && this.nonce === message.nonce && this.embeds.length === message.embeds.length && this.attachments.length === message.attachments.length; if (equal && rawData) { equal = this.mentions.everyone === message.mentions.everyone && this.createdTimestamp === new Date(rawData.timestamp).getTime() && this.editedTimestamp === new Date(rawData.edited_timestamp).getTime(); } return equal; } /** * When concatenated with a string, this automatically concatenates the message's content instead of the object. * @returns {string} * @example * // Logs: Message: This is a message! * console.log(`Message: ${message}`); */ toString() { return this.content; } toJSON() { return super.toJSON({ channel: 'channelId', author: 'authorId', groupActivityApplication: 'groupActivityApplicationId', guild: 'guildId', cleanContent: true, member: false, reactions: false, }); } } module.exports = Message;
26,415
8,053
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Phoenix=t():e.Phoenix=t()}(this,function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){(function(t){e.exports=t.Phoenix=n(2)}).call(this,n(1))},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";function i(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],i=!0,o=!1,r=void 0;try{for(var s,a=e[Symbol.iterator]();!(i=(s=a.next()).done)&&(n.push(s.value),!t||n.length!==t);i=!0);}catch(e){o=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(o)throw r}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function c(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),e}n.r(t),n.d(t,"Channel",function(){return j}),n.d(t,"Serializer",function(){return C}),n.d(t,"Socket",function(){return R}),n.d(t,"LongPoll",function(){return T}),n.d(t,"Ajax",function(){return w}),n.d(t,"Presence",function(){return E});var u="undefined"!=typeof self?self:null,h="undefined"!=typeof window?window:null,l=u||h||void 0,f="2.0.0",d={connecting:0,open:1,closing:2,closed:3},p=1e4,v={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},y={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},g=[y.close,y.error,y.join,y.reply,y.leave],m={longpoll:"longpoll",websocket:"websocket"},k=function(e){if("function"==typeof e)return e;return function(){return e}},b=function(){function e(t,n,i,o){s(this,e),this.channel=t,this.event=n,this.payload=i||function(){return{}},this.receivedResp=null,this.timeout=o,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}return c(e,[{key:"resend",value:function(e){this.timeout=e,this.reset(),this.send()}},{key:"send",value:function(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}},{key:"receive",value:function(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}},{key:"reset",value:function(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}},{key:"matchReceive",value:function(e){var t=e.status,n=e.response;e.ref;this.recHooks.filter(function(e){return e.status===t}).forEach(function(e){return e.callback(n)})}},{key:"cancelRefEvent",value:function(){this.refEvent&&this.channel.off(this.refEvent)}},{key:"cancelTimeout",value:function(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}},{key:"startTimeout",value:function(){var e=this;this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,function(t){e.cancelRefEvent(),e.cancelTimeout(),e.receivedResp=t,e.matchReceive(t)}),this.timeoutTimer=setTimeout(function(){e.trigger("timeout",{})},this.timeout)}},{key:"hasReceived",value:function(e){return this.receivedResp&&this.receivedResp.status===e}},{key:"trigger",value:function(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}}]),e}(),j=function(){function e(t,n,i){var o=this;s(this,e),this.state=v.closed,this.topic=t,this.params=k(n||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new b(this,y.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new S(function(){o.socket.isConnected()&&o.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(function(){return o.rejoinTimer.reset()})),this.stateChangeRefs.push(this.socket.onOpen(function(){o.rejoinTimer.reset(),o.isErrored()&&o.rejoin()})),this.joinPush.receive("ok",function(){o.state=v.joined,o.rejoinTimer.reset(),o.pushBuffer.forEach(function(e){return e.send()}),o.pushBuffer=[]}),this.joinPush.receive("error",function(){o.state=v.errored,o.socket.isConnected()&&o.rejoinTimer.scheduleTimeout()}),this.onClose(function(){o.rejoinTimer.reset(),o.socket.hasLogger()&&o.socket.log("channel","close ".concat(o.topic," ").concat(o.joinRef())),o.state=v.closed,o.socket.remove(o)}),this.onError(function(e){o.socket.hasLogger()&&o.socket.log("channel","error ".concat(o.topic),e),o.isJoining()&&o.joinPush.reset(),o.state=v.errored,o.socket.isConnected()&&o.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",function(){o.socket.hasLogger()&&o.socket.log("channel","timeout ".concat(o.topic," (").concat(o.joinRef(),")"),o.joinPush.timeout),new b(o,y.leave,k({}),o.timeout).send(),o.state=v.errored,o.joinPush.reset(),o.socket.isConnected()&&o.rejoinTimer.scheduleTimeout()}),this.on(y.reply,function(e,t){o.trigger(o.replyEventName(t),e)})}return c(e,[{key:"join",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.timeout;if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}},{key:"onClose",value:function(e){this.on(y.close,e)}},{key:"onError",value:function(e){return this.on(y.error,function(t){return e(t)})}},{key:"on",value:function(e,t){var n=this.bindingRef++;return this.bindings.push({event:e,ref:n,callback:t}),n}},{key:"off",value:function(e,t){this.bindings=this.bindings.filter(function(n){return!(n.event===e&&(void 0===t||t===n.ref))})}},{key:"canPush",value:function(){return this.socket.isConnected()&&this.isJoined()}},{key:"push",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.timeout;if(!this.joinedOnce)throw new Error("tried to push '".concat(e,"' to '").concat(this.topic,"' before joining. Use channel.join() before pushing events"));var i=new b(this,e,function(){return t},n);return this.canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}},{key:"leave",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.timeout;this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=v.leaving;var n=function(){e.socket.hasLogger()&&e.socket.log("channel","leave ".concat(e.topic)),e.trigger(y.close,"leave")},i=new b(this,y.leave,k({}),t);return i.receive("ok",function(){return n()}).receive("timeout",function(){return n()}),i.send(),this.canPush()||i.trigger("ok",{}),i}},{key:"onMessage",value:function(e,t,n){return t}},{key:"isLifecycleEvent",value:function(e){return g.indexOf(e)>=0}},{key:"isMember",value:function(e,t,n,i){return this.topic===e&&(!i||i===this.joinRef()||!this.isLifecycleEvent(t)||(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:n,joinRef:i}),!1))}},{key:"joinRef",value:function(){return this.joinPush.ref}},{key:"sendJoin",value:function(e){this.state=v.joining,this.joinPush.resend(e)}},{key:"rejoin",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.timeout;this.isLeaving()||this.sendJoin(e)}},{key:"trigger",value:function(e,t,n,i){var o=this.onMessage(e,t,n,i);if(t&&!o)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");for(var r=0;r<this.bindings.length;r++){var s=this.bindings[r];s.event===e&&s.callback(o,n,i||this.joinRef())}}},{key:"replyEventName",value:function(e){return"chan_reply_".concat(e)}},{key:"isClosed",value:function(){return this.state===v.closed}},{key:"isErrored",value:function(){return this.state===v.errored}},{key:"isJoined",value:function(){return this.state===v.joined}},{key:"isJoining",value:function(){return this.state===v.joining}},{key:"isLeaving",value:function(){return this.state===v.leaving}}]),e}(),C={encode:function(e,t){var n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))},decode:function(e,t){var n=r(JSON.parse(e),5);return t({join_ref:n[0],ref:n[1],topic:n[2],event:n[3],payload:n[4]})}},R=function(){function e(t){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s(this,e),this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=i.timeout||p,this.transport=i.transport||l.WebSocket||T,this.defaultEncoder=C.encode,this.defaultDecoder=C.decode,this.closeWasClean=!1,this.unloaded=!1,this.binaryType=i.binaryType||"arraybuffer",this.transport!==T?(this.encode=i.encode||this.defaultEncoder,this.decode=i.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder),h&&h.addEventListener&&h.addEventListener("unload",function(e){n.conn&&(n.unloaded=!0,n.abnormalClose("unloaded"))}),this.heartbeatIntervalMs=i.heartbeatIntervalMs||3e4,this.rejoinAfterMs=function(e){return i.rejoinAfterMs?i.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4},this.reconnectAfterMs=function(e){return n.unloaded?100:i.reconnectAfterMs?i.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3},this.logger=i.logger||null,this.longpollerTimeout=i.longpollerTimeout||2e4,this.params=k(i.params||{}),this.endPoint="".concat(t,"/").concat(m.websocket),this.vsn=i.vsn||f,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new S(function(){n.teardown(function(){return n.connect()})},this.reconnectAfterMs)}return c(e,[{key:"protocol",value:function(){return location.protocol.match(/^https/)?"wss":"ws"}},{key:"endPointURL",value:function(){var e=w.appendParams(w.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==e.charAt(0)?e:"/"===e.charAt(1)?"".concat(this.protocol(),":").concat(e):"".concat(this.protocol(),"://").concat(location.host).concat(e)}},{key:"disconnect",value:function(e,t,n){this.closeWasClean=!0,this.reconnectTimer.reset(),this.teardown(e,t,n)}},{key:"connect",value:function(e){var t=this;e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=k(e)),this.conn||(this.closeWasClean=!1,this.conn=new this.transport(this.endPointURL()),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=function(){return t.onConnOpen()},this.conn.onerror=function(e){return t.onConnError(e)},this.conn.onmessage=function(e){return t.onConnMessage(e)},this.conn.onclose=function(e){return t.onConnClose(e)})}},{key:"log",value:function(e,t,n){this.logger(e,t,n)}},{key:"hasLogger",value:function(){return null!==this.logger}},{key:"onOpen",value:function(e){var t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}},{key:"onClose",value:function(e){var t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}},{key:"onError",value:function(e){var t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}},{key:"onMessage",value:function(e){var t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}},{key:"onConnOpen",value:function(){this.hasLogger()&&this.log("transport","connected to ".concat(this.endPointURL())),this.unloaded=!1,this.closeWasClean=!1,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(function(e){return(0,r(e,2)[1])()})}},{key:"resetHeartbeat",value:function(){var e=this;this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(function(){return e.sendHeartbeat()},this.heartbeatIntervalMs))}},{key:"teardown",value:function(e,t,n){this.conn&&(this.conn.onclose=function(){},t?this.conn.close(t,n||""):this.conn.close(),this.conn=null),e&&e()}},{key:"onConnClose",value:function(e){this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),clearInterval(this.heartbeatTimer),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(function(t){return(0,r(t,2)[1])(e)})}},{key:"onConnError",value:function(e){this.hasLogger()&&this.log("transport",e),this.triggerChanError(),this.stateChangeCallbacks.error.forEach(function(t){return(0,r(t,2)[1])(e)})}},{key:"triggerChanError",value:function(){this.channels.forEach(function(e){e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(y.error)})}},{key:"connectionState",value:function(){switch(this.conn&&this.conn.readyState){case d.connecting:return"connecting";case d.open:return"open";case d.closing:return"closing";default:return"closed"}}},{key:"isConnected",value:function(){return"open"===this.connectionState()}},{key:"remove",value:function(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(function(t){return t.joinRef()!==e.joinRef()})}},{key:"off",value:function(e){for(var t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(function(t){var n=r(t,1)[0];return!e.includes(n)})}},{key:"channel",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new j(e,t,this);return this.channels.push(n),n}},{key:"push",value:function(e){var t=this;if(this.hasLogger()){var n=e.topic,i=e.event,o=e.payload,r=e.ref,s=e.join_ref;this.log("push","".concat(n," ").concat(i," (").concat(s,", ").concat(r,")"),o)}this.isConnected()?this.encode(e,function(e){return t.conn.send(e)}):this.sendBuffer.push(function(){return t.encode(e,function(e){return t.conn.send(e)})})}},{key:"makeRef",value:function(){var e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}},{key:"sendHeartbeat",value:function(){if(this.isConnected()){if(this.pendingHeartbeatRef)return this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),void this.abnormalClose("heartbeat timeout");this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef})}}},{key:"abnormalClose",value:function(e){this.closeWasClean=!1,this.conn.close(1e3,e)}},{key:"flushSendBuffer",value:function(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(function(e){return e()}),this.sendBuffer=[])}},{key:"onConnMessage",value:function(e){var t=this;this.decode(e.data,function(e){var n=e.topic,i=e.event,o=e.payload,s=e.ref,a=e.join_ref;s&&s===t.pendingHeartbeatRef&&(t.pendingHeartbeatRef=null),t.hasLogger()&&t.log("receive","".concat(o.status||""," ").concat(n," ").concat(i," ").concat(s&&"("+s+")"||""),o);for(var c=0;c<t.channels.length;c++){var u=t.channels[c];u.isMember(n,i,o,a)&&u.trigger(i,o,s,a)}for(var h=0;h<t.stateChangeCallbacks.message.length;h++){(0,r(t.stateChangeCallbacks.message[h],2)[1])(e)}})}}]),e}(),T=function(){function e(t){s(this,e),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(t),this.readyState=d.connecting,this.poll()}return c(e,[{key:"normalizeEndpoint",value:function(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+m.websocket),"$1/"+m.longpoll)}},{key:"endpointURL",value:function(){return w.appendParams(this.pollEndpoint,{token:this.token})}},{key:"closeAndRetry",value:function(){this.close(),this.readyState=d.connecting}},{key:"ontimeout",value:function(){this.onerror("timeout"),this.closeAndRetry()}},{key:"poll",value:function(){var e=this;this.readyState!==d.open&&this.readyState!==d.connecting||w.request("GET",this.endpointURL(),"application/json",null,this.timeout,this.ontimeout.bind(this),function(t){if(t){var n=t.status,i=t.token,o=t.messages;e.token=i}else n=0;switch(n){case 200:o.forEach(function(t){return e.onmessage({data:t})}),e.poll();break;case 204:e.poll();break;case 410:e.readyState=d.open,e.onopen(),e.poll();break;case 0:case 500:e.onerror(),e.closeAndRetry();break;default:throw new Error("unhandled poll status ".concat(n))}})}},{key:"send",value:function(e){var t=this;w.request("POST",this.endpointURL(),"application/json",e,this.timeout,this.onerror.bind(this,"timeout"),function(e){e&&200===e.status||(t.onerror(e&&e.status),t.closeAndRetry())})}},{key:"close",value:function(e,t){this.readyState=d.closed,this.onclose()}}]),e}(),w=function(){function e(){s(this,e)}return c(e,null,[{key:"request",value:function(e,t,n,i,o,r,s){if(l.XDomainRequest){var a=new XDomainRequest;this.xdomainRequest(a,e,t,i,o,r,s)}else{var c=l.XMLHttpRequest?new l.XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");this.xhrRequest(c,e,t,n,i,o,r,s)}}},{key:"xdomainRequest",value:function(e,t,n,i,o,r,s){var a=this;e.timeout=o,e.open(t,n),e.onload=function(){var t=a.parseJSON(e.responseText);s&&s(t)},r&&(e.ontimeout=r),e.onprogress=function(){},e.send(i)}},{key:"xhrRequest",value:function(e,t,n,i,o,r,s,a){var c=this;e.open(t,n,!0),e.timeout=r,e.setRequestHeader("Content-Type",i),e.onerror=function(){a&&a(null)},e.onreadystatechange=function(){if(e.readyState===c.states.complete&&a){var t=c.parseJSON(e.responseText);a(t)}},s&&(e.ontimeout=s),e.send(o)}},{key:"parseJSON",value:function(e){if(!e||""===e)return null;try{return JSON.parse(e)}catch(t){return console&&console.log("failed to parse JSON response",e),null}}},{key:"serialize",value:function(e,t){var n=[];for(var i in e)if(e.hasOwnProperty(i)){var r=t?"".concat(t,"[").concat(i,"]"):i,s=e[i];"object"===o(s)?n.push(this.serialize(s,r)):n.push(encodeURIComponent(r)+"="+encodeURIComponent(s))}return n.join("&")}},{key:"appendParams",value:function(e,t){if(0===Object.keys(t).length)return e;var n=e.match(/\?/)?"&":"?";return"".concat(e).concat(n).concat(this.serialize(t))}}]),e}();w.states={complete:4};var E=function(){function e(t){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s(this,e);var o=i.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(o.state,function(t){var i=n.caller,o=i.onJoin,r=i.onLeave,s=i.onSync;n.joinRef=n.channel.joinRef(),n.state=e.syncState(n.state,t,o,r),n.pendingDiffs.forEach(function(t){n.state=e.syncDiff(n.state,t,o,r)}),n.pendingDiffs=[],s()}),this.channel.on(o.diff,function(t){var i=n.caller,o=i.onJoin,r=i.onLeave,s=i.onSync;n.inPendingSyncState()?n.pendingDiffs.push(t):(n.state=e.syncDiff(n.state,t,o,r),s())})}return c(e,[{key:"onJoin",value:function(e){this.caller.onJoin=e}},{key:"onLeave",value:function(e){this.caller.onLeave=e}},{key:"onSync",value:function(e){this.caller.onSync=e}},{key:"list",value:function(t){return e.list(this.state,t)}},{key:"inPendingSyncState",value:function(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}}],[{key:"syncState",value:function(e,t,n,i){var o=this,r=this.clone(e),s={},a={};return this.map(r,function(e,n){t[e]||(a[e]=n)}),this.map(t,function(e,t){var n=r[e];if(n){var i=t.metas.map(function(e){return e.phx_ref}),c=n.metas.map(function(e){return e.phx_ref}),u=t.metas.filter(function(e){return c.indexOf(e.phx_ref)<0}),h=n.metas.filter(function(e){return i.indexOf(e.phx_ref)<0});u.length>0&&(s[e]=t,s[e].metas=u),h.length>0&&(a[e]=o.clone(n),a[e].metas=h)}else s[e]=t}),this.syncDiff(r,{joins:s,leaves:a},n,i)}},{key:"syncDiff",value:function(e,t,n,o){var r=t.joins,s=t.leaves,a=this.clone(e);return n||(n=function(){}),o||(o=function(){}),this.map(r,function(e,t){var o=a[e];if(a[e]=t,o){var r,s=a[e].metas.map(function(e){return e.phx_ref}),c=o.metas.filter(function(e){return s.indexOf(e.phx_ref)<0});(r=a[e].metas).unshift.apply(r,i(c))}n(e,o,t)}),this.map(s,function(e,t){var n=a[e];if(n){var i=t.metas.map(function(e){return e.phx_ref});n.metas=n.metas.filter(function(e){return i.indexOf(e.phx_ref)<0}),o(e,n,t),0===n.metas.length&&delete a[e]}}),a}},{key:"list",value:function(e,t){return t||(t=function(e,t){return t}),this.map(e,function(e,n){return t(e,n)})}},{key:"map",value:function(e,t){return Object.getOwnPropertyNames(e).map(function(n){return t(n,e[n])})}},{key:"clone",value:function(e){return JSON.parse(JSON.stringify(e))}}]),e}(),S=function(){function e(t,n){s(this,e),this.callback=t,this.timerCalc=n,this.timer=null,this.tries=0}return c(e,[{key:"reset",value:function(){this.tries=0,clearTimeout(this.timer)}},{key:"scheduleTimeout",value:function(){var e=this;clearTimeout(this.timer),this.timer=setTimeout(function(){e.tries=e.tries+1,e.callback()},this.timerCalc(this.tries+1))}}]),e}()}])});
22,394
8,673
const parsers = require('../../utils/parsers'); const { AirParsingError } = require('./AirErrors'); function ProviderSegmentOrderReducer(acc, { ProviderSegmentOrder }) { const x = parseInt(ProviderSegmentOrder, 10); if (x > acc) { return x; } return acc; } /** * getBaggage -- get baggage information from LFS search * @param baggageAllowance * @returns {{amount: number, units: string}} */ function getBaggage(baggageAllowance) { // Checking for allowance if ( !baggageAllowance || ( !baggageAllowance['air:NumberOfPieces'] && !baggageAllowance['air:MaxWeight'] ) ) { console.warn('Baggage information is not number and is not weight!', JSON.stringify(baggageAllowance)); return { units: 'piece', amount: 0 }; } // Checking for max weight if (baggageAllowance['air:MaxWeight']) { return { units: baggageAllowance['air:MaxWeight'].Unit.toLowerCase(), amount: Number(baggageAllowance['air:MaxWeight'].Value), }; } // Returning pieces return { units: 'piece', amount: Number(baggageAllowance['air:NumberOfPieces']), }; } /** * getBaggageInfo -- get baggage information from airPrice * @param info * @returns {{amount: number, units: string}} */ function getBaggageInfo(info) { // Checking for allowance let baggageInfo = { units: 'piece', amount: 0 }; if (typeof info === 'undefined' || info == null) { return baggageInfo; } if (Object.prototype.hasOwnProperty.call(info, 'air:BagDetails')) { baggageInfo.detail = info['air:BagDetails'].map((detail) => { return { applicableBags: detail.ApplicableBags, basePrice: detail.BasePrice, totalPrice: detail.TotalPrice, approximateBasePrice: detail.ApproximateBasePrice, approximateTotalPrice: detail.ApproximateTotalPrice, restrictionText: detail['air:BaggageRestriction']['air:TextInfo'], }; }); } if (Object.prototype.hasOwnProperty.call(info, 'air:TextInfo')) { const match = info['air:TextInfo'][0].match(/^(\d+)([KP]+)$/); if (match) { if (match[2] === 'P') { baggageInfo = Object.assign(baggageInfo, { units: 'piece', amount: match[1] }); } else if (match[2] === 'K') { baggageInfo = Object.assign(baggageInfo, { units: 'kilograms', amount: match[1] }); } } else { console.warn('Baggage information is not number and is not weight!', JSON.stringify(info)); } } else { console.warn('Unknown', JSON.stringify(info)); } return baggageInfo; } function formatSegment(segment) { return { from: segment.Origin, to: segment.Destination, group: Number(segment.Group), departure: segment.DepartureTime, arrival: segment.ArrivalTime, airline: segment.Carrier, flightNumber: segment.FlightNumber, uapi_segment_ref: segment.Key, }; } function formatServiceSegment(segment, remark) { return { ...parsers.serviceSegment(remark['passive:Text']), carrier: segment.SupplierCode, airport: segment.Origin, date: segment.StartDate, index: segment.index, }; } function formatPrices(prices) { return { basePrice: prices.BasePrice, taxes: prices.Taxes, equivalentBasePrice: prices.EquivalentBasePrice, totalPrice: prices.TotalPrice, }; } function formatTrip(segment, flightDetails) { const flightInfo = flightDetails ? Object.keys(flightDetails).map( detailsKey => flightDetails[detailsKey] ) : []; const plane = flightInfo.map(details => details.Equipment || 'Unknown'); const duration = flightInfo.map(details => details.FlightTime || 0); const techStops = flightInfo.slice(1).map(details => details.Origin); return { ...formatSegment(segment), serviceClass: segment.CabinClass, plane, duration, techStops, }; } function formatAirExchangeBundle(bundle) { return { addCollection: bundle.AddCollection, changeFee: bundle.ChangeFee, exchangeAmount: bundle.ExchangeAmount, refund: bundle.Refund, }; } function formatPassengerCategories(pricingInfo) { const passengerCounts = {}; const passengerCategories = Object.keys(pricingInfo) .reduce((acc, key) => { const passengerFare = pricingInfo[key]; let code = passengerFare['air:PassengerType']; if (Object.prototype.toString.call(code) === '[object String]') { // air:PassengerType in fullCollapseList_obj ParserUapi param passengerCounts[code] = 1; // air:PassengerType in noCollapseList } else if (Array.isArray(code) && code.constructor === Array) { // ParserUapi param const count = code.length; const list = Array.from(new Set((code.map((item) => { if (Object.prototype.toString.call(item) === '[object String]') { return item; } if (Object.prototype.toString.call(item) === '[object Object]' && item.Code) { // air:PassengerType in fullCollapseList_obj like above, // but there is Age or other info, except Code return item.Code; } throw new AirParsingError.PTCIsNotSet(); })))); [code] = list; if (!list[0] || list.length !== 1) { // TODO throw error console.log('Warning: different categories ' + list.join() + ' in single fare calculation ' + key + ' in fare ' + key); } passengerCounts[code] = count; } else { throw new AirParsingError.PTCTypeInvalid(); } return { ...acc, [code]: passengerFare }; }, {}); const passengerFares = Object.keys(passengerCategories) .reduce( (memo, ptc) => Object.assign(memo, { [ptc]: { totalPrice: passengerCategories[ptc].TotalPrice, basePrice: passengerCategories[ptc].BasePrice, equivalentBasePrice: passengerCategories[ptc].EquivalentBasePrice, taxes: passengerCategories[ptc].Taxes, fareCalc: passengerCategories[ptc].FareCalc, }, }), {} ); return { passengerCounts, passengerCategories, passengerFares, }; } function formatFarePricingInfo(fare) { const changePenalty = {}; const cancelPenalty = {}; if (Object.prototype.hasOwnProperty.call(fare, 'air:ChangePenalty')) { const fareChangePenalty = fare['air:ChangePenalty']; if (typeof fareChangePenalty['air:Amount'] !== 'undefined') { changePenalty.amount = fareChangePenalty['air:Amount']; } if (typeof fareChangePenalty['air:Percentage'] !== 'undefined') { changePenalty.percentage = fareChangePenalty['air:Percentage']; } if (typeof fareChangePenalty.PenaltyApplies !== 'undefined') { changePenalty.penaltyApplies = fareChangePenalty.PenaltyApplies; } } if (Object.prototype.hasOwnProperty.call(fare, 'air:CancelPenalty')) { const fareCancelPenalty = fare['air:CancelPenalty']; if (typeof fareCancelPenalty['air:Amount'] !== 'undefined') { cancelPenalty.amount = fareCancelPenalty['air:Amount']; } if (typeof fareCancelPenalty['air:Percentage'] !== 'undefined') { cancelPenalty.percentage = fareCancelPenalty['air:Percentage']; } if (typeof fareCancelPenalty.PenaltyApplies !== 'undefined') { cancelPenalty.penaltyApplies = fareCancelPenalty.PenaltyApplies; } if (typeof fareCancelPenalty.NoShow !== 'undefined') { cancelPenalty.noShow = fareCancelPenalty.NoShow; } } let refundable = false; if (Object.prototype.hasOwnProperty.call(fare, 'Refundable')) { refundable = fare.Refundable; } let latestTicketingTime = null; if (Object.prototype.hasOwnProperty.call(fare, 'LatestTicketingTime')) { latestTicketingTime = fare.LatestTicketingTime; } let eTicketability = false; if (Object.prototype.hasOwnProperty.call(fare, 'eTicketability')) { // eslint-disable-next-line prefer-destructuring eTicketability = fare.eTicketability; } return { latestTicketingTime, eTicketability, refundable, changePenalty, cancelPenalty, }; } function formatLowFaresSearch(searchRequest, searchResult) { const pricesList = searchResult['air:AirPricePointList']; const solutionsList = searchResult['air:AirPricingSolution']; const fareInfos = searchResult['air:FareInfoList']; const segments = searchResult['air:AirSegmentList']; const flightDetails = searchResult['air:FlightDetailsList']; const { provider } = searchRequest; // const legs = _.first(_.toArray(searchResult['air:RouteList']))['air:Leg']; // TODO filter pricesList by CompleteItinerary=true & ETicketability = Yes, etc const fares = []; const isSolutionResult = typeof solutionsList !== 'undefined'; const results = isSolutionResult ? solutionsList : pricesList; Object.entries(results).forEach(([fareKey, price]) => { const [firstKey] = Object.keys(price['air:AirPricingInfo']); const thisFare = price['air:AirPricingInfo'][firstKey]; // get trips from first reservation if (!thisFare.PlatingCarrier) { return; } let directions = []; if (isSolutionResult) { if (Object.prototype.toString.call(price['air:Journey']) === '[object Object]') { price['air:Journey'] = [price['air:Journey']]; } directions = price['air:Journey'].map((leg) => { const trips = leg['air:AirSegmentRef'].map((segmentRef) => { const segment = segments[segmentRef]; const tripFlightDetails = segment['air:FlightDetailsRef'].map(flightDetailsRef => flightDetails[flightDetailsRef]); const [bookingInfo] = thisFare['air:BookingInfo'].filter(info => info.SegmentRef === segmentRef); const fareInfo = fareInfos[bookingInfo.FareInfoRef]; const seatsAvailable = Number(bookingInfo.BookingCount); return Object.assign( formatTrip(segment, tripFlightDetails), { serviceClass: bookingInfo.CabinClass, bookingClass: bookingInfo.BookingCode, baggage: [getBaggage(fareInfo['air:BaggageAllowance'])], fareBasisCode: fareInfo.FareBasis, }, seatsAvailable ? { seatsAvailable } : null ); }); return [{ from: trips[0].from, to: trips[trips.length - 1].to, duration: leg.TravelTime, // TODO get overnight stops, etc from connection platingCarrier: thisFare.PlatingCarrier, segments: trips, }]; }); } else { directions = thisFare['air:FlightOptionsList'].map(direction => Object.values(direction['air:Option']).map((option) => { const trips = option['air:BookingInfo'].map( (segmentInfo) => { const fareInfo = fareInfos[segmentInfo.FareInfoRef]; const segment = segments[segmentInfo.SegmentRef]; const tripFlightDetails = segment['air:FlightDetailsRef'].map( flightDetailsRef => flightDetails[flightDetailsRef] ); const seatsAvailable = ( segment['air:AirAvailInfo'] && segment['air:AirAvailInfo'].ProviderCode === provider) ? (Number( segment['air:AirAvailInfo']['air:BookingCodeInfo'].BookingCounts .match(new RegExp(`${segmentInfo.BookingCode}(\\d+)`))[1] )) : null; return Object.assign( formatTrip(segment, tripFlightDetails), { serviceClass: segmentInfo.CabinClass, bookingClass: segmentInfo.BookingCode, baggage: [getBaggage(fareInfo['air:BaggageAllowance'])], fareBasisCode: fareInfo.FareBasis, }, seatsAvailable ? { seatsAvailable } : null ); } ); return { from: direction.Origin, to: direction.Destination, // duration // TODO get overnight stops, etc from connection platingCarrier: thisFare.PlatingCarrier, segments: trips, }; })); } const { passengerCounts, passengerFares } = this.formatPassengerCategories(price['air:AirPricingInfo']); const result = { totalPrice: price.TotalPrice, basePrice: price.BasePrice, taxes: price.Taxes, platingCarrier: thisFare.PlatingCarrier, directions, bookingComponents: [ { totalPrice: price.TotalPrice, basePrice: price.BasePrice, taxes: price.Taxes, uapi_fare_reference: fareKey, // TODO }, ], passengerFares, passengerCounts, }; fares.push(result); }); fares.sort((a, b) => parseFloat(a.totalPrice.substr(3)) - parseFloat(b.totalPrice.substr(3))); if (searchRequest.faresOnly === false) { const result = { fares }; if ({}.hasOwnProperty.call(searchResult, 'TransactionId')) { result.transactionId = searchResult.TransactionId; } if ({}.hasOwnProperty.call(searchResult, 'SearchId')) { result.searchId = searchResult.SearchId; } if ({}.hasOwnProperty.call(searchResult, 'air:AsyncProviderSpecificResponse')) { result.hasMoreResults = searchResult['air:AsyncProviderSpecificResponse'].MoreResults; result.providerCode = searchResult['air:AsyncProviderSpecificResponse'].ProviderCode; } return result; } return fares; } /** * This function used to transform segments and service segments objects * to arrays. After that this function try to set indexes with same as in * terminal response order. So it needs to check `ProviderSegmentOrder` field for that. * * @param segmentsObject * @param serviceSegmentsObject * @return {*} */ function setIndexesForSegments( segmentsObject = null, serviceSegmentsObject = null ) { const segments = segmentsObject ? Object.keys(segmentsObject).map(k => segmentsObject[k]) : null; const serviceSegments = serviceSegmentsObject ? Object.keys(serviceSegmentsObject).map(k => serviceSegmentsObject[k]) : null; if (segments === null && serviceSegments === null) { return { segments, serviceSegments }; } if (segments !== null && serviceSegments === null) { const segmentsNew = segments.map((segment, key) => ({ ...segment, index: key + 1, })); return { segments: segmentsNew, serviceSegments }; } if (segments === null && serviceSegments !== null) { const serviceSegmentsNew = serviceSegments.map( (segment, key) => ({ ...segment, index: key + 1, }) ); return { segments, serviceSegments: serviceSegmentsNew }; } const maxSegmentsSegmentOrder = segments.reduce(ProviderSegmentOrderReducer, 0); const maxServiceSegmentsSegmentOrder = serviceSegments.reduce(ProviderSegmentOrderReducer, 0); const maxOrder = Math.max( maxSegmentsSegmentOrder, maxServiceSegmentsSegmentOrder ); const allSegments = []; for (let i = 1; i <= maxOrder; i += 1) { segments.forEach(s => (Number(s.ProviderSegmentOrder) === i ? allSegments.push(s) : null)); serviceSegments.forEach(s => ( Number(s.ProviderSegmentOrder) === i ? allSegments.push(s) : null )); } const indexedSegments = allSegments.map((s, k) => ({ ...s, index: k + 1 })); return { segments: indexedSegments.filter(s => s.SegmentType === undefined), serviceSegments: indexedSegments.filter(s => s.SegmentType === 'Service'), }; } module.exports = { formatLowFaresSearch, formatFarePricingInfo, formatPassengerCategories, formatTrip, formatSegment, formatServiceSegment, formatAirExchangeBundle, formatPrices, setIndexesForSegments, getBaggage, getBaggageInfo, };
15,767
4,852
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ define(["require", "exports"], function (require, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.conf = { comments: { lineComment: ';', blockComment: ['#|', '|#'], }, brackets: [['(', ')'], ['{', '}'], ['[', ']']], autoClosingPairs: [ { open: '{', close: '}' }, { open: '[', close: ']' }, { open: '(', close: ')' }, { open: '"', close: '"' }, ], surroundingPairs: [ { open: '{', close: '}' }, { open: '[', close: ']' }, { open: '(', close: ')' }, { open: '"', close: '"' }, ], }; exports.language = { defaultToken: '', ignoreCase: true, tokenPostfix: '.scheme', brackets: [ { open: '(', close: ')', token: 'delimiter.parenthesis' }, { open: '{', close: '}', token: 'delimiter.curly' }, { open: '[', close: ']', token: 'delimiter.square' }, ], keywords: [ 'case', 'do', 'let', 'loop', 'if', 'else', 'when', 'cons', 'car', 'cdr', 'cond', 'lambda', 'lambda*', 'syntax-rules', 'format', 'set!', 'quote', 'eval', 'append', 'list', 'list?', 'member?', 'load', ], constants: ['#t', '#f'], operators: ['eq?', 'eqv?', 'equal?', 'and', 'or', 'not', 'null?'], tokenizer: { root: [ [/#[xXoObB][0-9a-fA-F]+/, 'number.hex'], [/[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?/, 'number.float'], [ /(?:\b(?:(define|define-syntax|define-macro))\b)(\s+)((?:\w|\-|\!|\?)*)/, ['keyword', 'white', 'variable'], ], { include: '@whitespace' }, { include: '@strings' }, [ /[a-zA-Z_#][a-zA-Z0-9_\-\?\!\*]*/, { cases: { '@keywords': 'keyword', '@constants': 'constant', '@operators': 'operators', '@default': 'identifier', }, }, ], ], comment: [ [/[^\|#]+/, 'comment'], [/#\|/, 'comment', '@push'], [/\|#/, 'comment', '@pop'], [/[\|#]/, 'comment'], ], whitespace: [ [/[ \t\r\n]+/, 'white'], [/#\|/, 'comment', '@comment'], [/;.*$/, 'comment'], ], strings: [ [/"$/, 'string', '@popall'], [/"(?=.)/, 'string', '@multiLineString'], ], multiLineString: [ [/[^\\"]+$/, 'string', '@popall'], [/[^\\"]+/, 'string'], [/\\./, 'string.escape'], [/"/, 'string', '@popall'], [/\\$/, 'string'] ], }, }; });
3,803
1,095
import React,{Component} from 'react'; import {Link} from 'react-router-dom'; import api from '../../services/api'; class Following extends Component { constructor(props) { super(props); this.state = { followings: [], loading: true } } async handleGetFollowing(following_url) { const data = await api.get( following_url.replace('{/other_user}','') ); const followingNumber = data.headers.link ? Number( data .headers .link .split('page=')[2] .split(' rel="last"')[0] .replace('>','') .replace(';', '')) * Number(data.data.length) : data.data.length; this.setState({ followings: [...this.state.followings, followingNumber], loading: false }); } async componentDidMount() { const params = this.props.match.params; await this.handleGetFollowing(decodeURIComponent(params.url_followings)); } render() { if(this.state.loading) { return <div className='loading'>CARREGANDO...</div> } return ( <> <div className='box__view'> <span><Link to='/'>Voltar</Link></span> <span style={ { marginTop: 5 } }>TOTAL SEGUINDO: { this.state.followings }</span> </div> </> ) } } export default Following;
1,456
445
import React, { Fragment, PureComponent } from 'react'; import { connect } from 'dva'; import { formatMessage, FormattedMessage } from 'umi/locale'; import { Form, Input, DatePicker, Select, Button, Card, Popconfirm, Divider, Icon, Table, Row, Modal, Col, message, } from 'antd'; import PageHeaderWrapper from '@/components/PageHeaderWrapper'; import styles from '../../System/UserAdmin.less'; const FormItem = Form.Item; import NormalTable from '@/components/NormalTable'; const { Option } = Select; const { TextArea } = Input; const CreateForm = Form.create()(props => { const { ax,addVisible,handleModalVisible,form,form:{getFieldDecorator} } = props; const { dispatch } = ax; const okHandle = () => { form.validateFields((err,values)=>{ const obj = { customername:values.customername, contact:values.contact, phone:values.phone, email:values.email, address:values.address, customertype:values.customertype, industry:values.industry, memo:values.memo, } dispatch({ type:'CM/add', payload: { reqData:{ ...obj } }, callback:(res)=>{ if(res){ message.success("添加成功",1,()=>{ dispatch({ type:'CM/fetch', payload:{ reqData:{ pageIndex:0, pageSize:10 } } }); form.resetFields(); handleModalVisible(false) }) } } }) }) }; return ( <Modal title="新建客户信息" visible={addVisible} onOk={okHandle} width='50%' onCancel={()=>handleModalVisible(false)} > <Row gutter={{ md: 8, lg: 24, xl: 48 }}> <Col md={8} sm={16}> <FormItem label='客户名称'> {getFieldDecorator('customername',{ rules: [ { required: true, } ], })(<Input placeholder='请输入客户名称' />)} </FormItem> </Col> <Col md={8} sm={16}> <FormItem label='联系人'> {getFieldDecorator('contact',{ rules: [ { required: true, } ], })(<Input placeholder='请输入联系人' />)} </FormItem> </Col> <Col md={8} sm={16}> <FormItem label='电话'> {getFieldDecorator('phone',{ rules: [ { required: true, } ], })(<Input placeholder='请输入联系人' type='number'/>)} </FormItem> </Col> </Row> <Row gutter={{ md: 8, lg: 24, xl: 48 }}> <Col md={8} sm={16}> <FormItem label='邮箱'> {getFieldDecorator('email',{ rules: [ { required: true, } ], })(<Input placeholder='请输入邮箱' />)} </FormItem> </Col> <Col md={16} sm={24}> <FormItem label='客户地址'> {getFieldDecorator('address',{ rules: [ { required: true, } ], })(<Input placeholder='请输入客户地址' />)} </FormItem> </Col> </Row> <Row gutter={{ md: 8, lg: 24, xl: 48 }}> <Col md={8} sm={16}> <FormItem label='客户类别'> {getFieldDecorator('customertype',{ rules: [ { required: true, } ], })(<Select style={{width:'100%'}} placeholder="请选择客户类别" > <Option value="合资">合资</Option> <Option value="独资">独资</Option> </Select>)} </FormItem> </Col> <Col md={8} sm={16}> <FormItem label='所属行业'> {getFieldDecorator('industry',{ rules: [ { required: true, } ], })(<Input placeholder='请输入所属行业' />)} </FormItem> </Col> </Row> <Row gutter={{ md: 8, lg: 24, xl: 48 }}> <Col md={24} sm={24}> <FormItem label='备注'> {getFieldDecorator('memo',{ rules: [ { required: true, } ], })(<TextArea rows={4} />)} </FormItem> </Col> </Row> </Modal> ); }); const CreateUpdateForm = Form.create({ name: 'global_state', onFieldsChange(props, changedFields) { //当 Form.Item 子节点的值发生改变时触发,可以把对应的值转存到 Redux store props.fields = changedFields }, mapPropsToFields(props) { const { fields } = props; return { customername:Form.createFormField({ value: fields.customername?fields.customername:'', }), contact:Form.createFormField({ value: fields.contact?fields.contact:'', }), phone:Form.createFormField({ value: fields.phone?fields.phone:'', }), email:Form.createFormField({ value: fields.email? fields.email:'', }), address:Form.createFormField({ value: fields.address?fields.address:'', }), customertype:Form.createFormField({ value: fields.customertype?fields.customertype:'', }), industry:Form.createFormField({ value: fields.industry?fields.industry:'', }), memo:Form.createFormField({ value: fields.memo?fields.memo:'', }), } }})(props => { const { ax,updateVisible,updateChangeVisible,form,form:{getFieldDecorator},fields } = props; const { dispatch } = ax; const okHandle = () => { const { id } = fields; form.validateFields((err,values)=>{ const obj = { customername:values.customername, contact:values.contact, phone:values.phone, email:values.email, address:values.address, customertype:values.customertype, industry:values.industry, memo:values.memo, } dispatch({ type:'CM/update', payload: { reqData:{ id, ...obj } }, callback:(res)=>{ if(res){ message.success("修改成功",1,()=>{ dispatch({ type:'CM/fetch', payload:{ reqData:{ pageIndex:0, pageSize:10 } } }); form.resetFields(); updateChangeVisible(false); }) } } }) }) }; return ( <Modal title="修改客户信息" visible={updateVisible} onOk={okHandle} width='50%' onCancel={()=>updateChangeVisible(false)} > <Row gutter={{ md: 8, lg: 24, xl: 48 }}> <Col md={8} sm={16}> <FormItem label='客户名称'> {getFieldDecorator('customername',{ rules: [ { required: true, } ] })(<Input placeholder='请输入客户名称' />)} </FormItem> </Col> <Col md={8} sm={16}> <FormItem label='联系人'> {getFieldDecorator('contact',{ rules: [ { required: true, } ] })(<Input placeholder='请输入联系人' />)} </FormItem> </Col> <Col md={8} sm={16}> <FormItem label='电话'> {getFieldDecorator('phone',{ rules: [ { required: true, } ] })(<Input placeholder='请输入联系人' type='number'/>)} </FormItem> </Col> </Row> <Row gutter={{ md: 8, lg: 24, xl: 48 }}> <Col md={8} sm={16}> <FormItem label='邮箱'> {getFieldDecorator('email',{ rules: [ { required: true, } ] })(<Input placeholder='请输入邮箱' />)} </FormItem> </Col> <Col md={16} sm={24}> <FormItem label='客户地址'> {getFieldDecorator('address',{ rules: [ { required: true, } ] })(<Input placeholder='请输入客户地址' />)} </FormItem> </Col> </Row> <Row gutter={{ md: 8, lg: 24, xl: 48 }}> <Col md={8} sm={16}> <FormItem label='客户类别'> {getFieldDecorator('customertype',{ rules: [ { required: true, } ] })(<Select style={{width:'100%'}} placeholder="请选择客户类别" > <Option value="合资">合资</Option> <Option value="独资">独资</Option> </Select>)} </FormItem> </Col> <Col md={8} sm={16}> <FormItem label='所属行业'> {getFieldDecorator('industry',{ rules: [ { required: true, } ] })(<Input placeholder='请输入所属行业' />)} </FormItem> </Col> </Row> <Row gutter={{ md: 8, lg: 24, xl: 48 }}> <Col md={24} sm={24}> <FormItem label='备注'> {getFieldDecorator('memo',{ rules: [ { required: true, } ] })(<TextArea rows={4} />)} </FormItem> </Col> </Row> </Modal> ); }); const ViewForm = Form.create({ name: 'global_state', onFieldsChange(props, changedFields) { //当 Form.Item 子节点的值发生改变时触发,可以把对应的值转存到 Redux store props.fields = changedFields }, mapPropsToFields(props) { const { fields } = props; return { customername:Form.createFormField({ value: fields.customername?fields.customername:'', }), contact:Form.createFormField({ value: fields.contact?fields.contact:'', }), phone:Form.createFormField({ value: fields.phone?fields.phone:'', }), email:Form.createFormField({ value: fields.email? fields.email:'', }), address:Form.createFormField({ value: fields.address?fields.address:'', }), customertype:Form.createFormField({ value: fields.customertype?fields.customertype:'', }), industry:Form.createFormField({ value: fields.industry?fields.industry:'', }), memo:Form.createFormField({ value: fields.memo?fields.memo:'', }), } }})(props => { const { viewVisible,viewHandleVisible,form:{getFieldDecorator} } = props; return ( <Modal title="查看客户信息" visible={viewVisible} width='50%' onCancel={()=>viewHandleVisible(false)} footer={null} > <Row gutter={{ md: 8, lg: 24, xl: 48 }}> <Col md={8} sm={16}> <FormItem label='客户名称'> {getFieldDecorator('customername',{ rules: [ { required: true, } ] })(<Input placeholder='请输入客户名称' disabled/>)} </FormItem> </Col> <Col md={8} sm={16}> <FormItem label='联系人'> {getFieldDecorator('contact',{ rules: [ { required: true, } ] })(<Input placeholder='请输入联系人' disabled/>)} </FormItem> </Col> <Col md={8} sm={16}> <FormItem label='电话'> {getFieldDecorator('phone',{ rules: [ { required: true, } ] })(<Input placeholder='请输入联系人' type='number'disabled/>)} </FormItem> </Col> </Row> <Row gutter={{ md: 8, lg: 24, xl: 48 }}> <Col md={8} sm={16}> <FormItem label='邮箱'> {getFieldDecorator('email',{ rules: [ { required: true, } ] })(<Input placeholder='请输入邮箱' disabled/>)} </FormItem> </Col> <Col md={16} sm={24}> <FormItem label='客户地址'> {getFieldDecorator('address',{ rules: [ { required: true, } ] })(<Input placeholder='请输入客户地址' disabled/>)} </FormItem> </Col> </Row> <Row gutter={{ md: 8, lg: 24, xl: 48 }}> <Col md={8} sm={16}> <FormItem label='客户类别'> {getFieldDecorator('customertype',{ rules: [ { required: true, } ] })(<Select placeholder="请选择客户类别" disabled> <Option value="合资">合资</Option> <Option value="独资">独资</Option> </Select>)} </FormItem> </Col> <Col md={8} sm={16}> <FormItem label='所属行业'> {getFieldDecorator('industry',{ rules: [ { required: true, } ] })(<Input placeholder='请输入所属行业' disabled/>)} </FormItem> </Col> </Row> <Row gutter={{ md: 8, lg: 24, xl: 48 }}> <Col md={24} sm={24}> <FormItem label='备注'> {getFieldDecorator('memo',{ rules: [ { required: true, } ] })(<TextArea rows={4} disabled/>)} </FormItem> </Col> </Row> </Modal> ); }); @connect(({ CM, loading }) => ({ CM, loading: loading.models.CM, })) @Form.create() class FindProject extends PureComponent { state ={ addVisible:false, updateVisible:false, viewVisible:false, updata:{}, view:{}, } componentDidMount() { const { dispatch } = this.props; dispatch({ type:'CM/fetch', payload:{ reqData:{ pageIndex:0, pageSize:10 } } }) } //新建模态框 handleModalVisible = (bool)=>{ this.setState({ addVisible:bool }) } //修改模态框 updateChange = (e,record)=>{ e.preventDefault(); this.setState({ updateVisible:true, updata:record }) } updateChangeVisible = (bool)=>{ this.setState({ updateVisible:bool }) } //查看模态框 viewChange = (e,record)=>{ e.preventDefault(); this.setState({ viewVisible:true, view:record }) } viewHandleVisible = (bool) =>{ this.setState({ viewVisible:bool }) } //删除 handleDelete = (record)=>{ const { id } = record; const { dispatch } = this.props; dispatch({ type:'CM/delete', payload:{ reqData:{ id } }, callback:(res)=>{ if(res){ message.success("删除成功",1,()=>{ dispatch({ type:'CM/fetch', payload:{ reqData:{ pageIndex:0, pageSize:10 } } }) }) } } }) } renderForm() { const { form: { getFieldDecorator }, } = this.props; return ( <Form onSubmit={this.findList} layout="inline"> <Row gutter={{ md: 8, lg: 24, xl: 48 }}> <Col md={8} sm={16}> <FormItem label='客户名称'> {getFieldDecorator('projectname')(<Input placeholder='项目名称' />)} </FormItem> </Col> <Col md={8} sm={16}> <FormItem label='客户编码'> {getFieldDecorator('projectcode')(<Input placeholder='客户编码' />)} </FormItem> </Col> <Col md={8} sm={16}> <span> <Button type="primary" htmlType="submit"> 查询 </Button> <Button style={{ marginLeft: 8 }} onClick={this.handleFormReset}> 取消 </Button> </span> </Col> </Row> </Form> ); } render() { const { form:{getFieldDecorator}, CM:{fetchData} } = this.props; const { updata,view } = this.state; const columns = [ { title: '序号', dataIndex: 'index', }, { title: '客户编号', dataIndex: 'customernumber', }, { title: '客户名称', dataIndex: 'customername', }, { title: '客户简称', dataIndex: 'abbreviation', }, { title: '联系人', dataIndex: 'contact', }, { title: '电话', dataIndex: 'phone', }, { title: '客户类别', dataIndex: 'customertype', }, { title: '所属行业', dataIndex: 'industry', }, { title: '操作', dataIndex: 'operating', fixed:'right', render: (text, record) => ( <Fragment> <a href="#javascript;" onClick={(e)=> this.updateChange(e,record)}>修改</a> <Divider type="vertical" /> <Popconfirm title={formatMessage({ id: 'validation.confirmdelete' })} onConfirm={() => this.handleDelete(record)}> <a href="javascript:;">{formatMessage({ id: 'validation.delete' })}</a> </Popconfirm> <Divider type="vertical" /> <a href="#javascript;" onClick={(e)=> this.viewChange(e,record)}>查看</a> </Fragment> ), }, ]; const createProps = { ax:this.props, addVisible:this.state.addVisible, handleModalVisible:this.handleModalVisible, }; const updateProps = { ax:this.props, updateVisible:this.state.updateVisible, updateChangeVisible:this.updateChangeVisible, }; const viewProps = { viewVisible:this.state.viewVisible, viewHandleVisible:this.viewHandleVisible, }; return ( <PageHeaderWrapper> <Card> <div className={styles.userAdmin}> <div className={styles.userAdminForm} style={{marginBottom:'0px'}}>{this.renderForm()}</div> <div className={styles.userAdminOperator}> <Button icon="plus" type="primary" onClick={() => this.handleModalVisible(true)}> 新建 </Button> </div> <NormalTable columns={columns} data={fetchData} /> </div> </Card> <CreateForm {...createProps}/> <CreateUpdateForm {...updateProps} fields={updata}/> <ViewForm {...viewProps} fields={view}/> </PageHeaderWrapper> ); } } export default FindProject;
18,951
5,926
var viewData = {"id":28543,"isExpandedObject":false}; var objectRelations = { "28543" : [{"via": "is geassocieerd met","to": ["28542"]}] }; var objectData = { "28543" : { "id":28543, "typeIconPath":"data/icons/UML/UML_ClassDiagram.png", "data" : [ { "lang":"nl", "name":"WMO319", "type":"Klassendiagram", "categories":[] } ] } , "28542" : { "id":28542, "typeIconPath":"data/icons/ArchiMate/ApplicationDataObject.png", "data" : [ { "lang":"nl", "name":"WMO319", "type":"Dataobject", "categories":[] } ] } }; var viewReferences = {"50404":29997,"50408":28387,"50409":29618,"50410":28222,"50405":28031,"50406":27964,"50407":30200}; var objectReferences = { "50375" : 28921 , "50376" : 29727 , "50377" : 37140 , "50378" : 29793 , "50383" : 32205 , "50384" : 32207 , "50388" : 28985 , "50389" : 32210 , "50386" : 32212 , "50387" : 29008 , "50385" : 27979 , "50390" : 32215 , "50379" : 50380 , "50382" : 28211 , "50381" : 37207 , "52567" : 52567 , "52569" : 52569 , "50404" : 29997 , "50408" : 28387 , "50409" : 29618 , "50410" : 28222 , "50405" : 28031 , "50406" : 27964 , "50407" : 30200 , "52609" : 52609 , "52615" : 52615 , "52617" : 52617 , "52611" : 52611 , "52613" : 52613 }; var viewpointsData = [ {"id":"viewpoint56742","name":"Bericht details view","presentationType":"FmtLabelView"} ]; var vp_legends = { "viewpoint56742": { "labels" : new Array(), "content" : new Array() } }; vp_legends.viewpoint56742.labels[0] = "Labelview"; vp_legends.viewpoint56742.content[0] = new Array(); vp_legends.viewpoint56742.content[0][0] = {value1: "1) ", value2: "Getoond worden informatie over het bericht en de regels die op dit niveau gekoppeld zijn"};
1,764
1,067
let storage = { apiKey: 'a70dbfe19b800809dfdd3e89e8532c9e', token: localStorage.getItem('token') || null, username: localStorage.getItem('username') || null, admin: localStorage.getItem('admin') || null, pageTitlePostfix: ' — ' + document.title, listTypes: [ { title: 'Your Requests', shortTitle: 'User Requests', query: 'user-requests', name: 'user-requests', type: 'user-requests', isProfileContent: true // isCategory: true, }, { title: 'Requested Movies & Shows', shortTitle: 'Requested', query: 'requests', name: 'home-category', type: 'requests', // Maybe change to separate group isCategory: true, isProfileContent: true }, { title: 'Upcoming Movies', shortTitle: 'Upcoming', query: 'upcoming', name: 'home-category', type: 'collection', isCategory: true }, { title: 'Now Playing Movies', shortTitle: 'Now Playing', query: 'nowplaying', name: 'home-category', type: 'collection', isCategory: true }, { title: 'Popular Movies', shortTitle: 'Popular', query: 'popular', name: 'home-category', type: 'collection', isCategory: true }, { title: 'Search Results', query: 'search', isCategory: false }, { title: 'Your Favorite Movies', query: 'favorite', isCategory: false } ], categories: {}, // For Browser History backTitle: '', moviePath: '', createMoviePopup: false, moviePopupOnHistory: false }; // Create categories titles storage.listTypes.forEach(function(listType){ storage.categories[listType.query] = listType.title; }); export default storage;
1,771
564
import React from 'react'; import PropTypes from 'prop-types'; import './styles.css'; function Input({ label, name, type, value, onChange, }) { return ( <div className="input-block"> <label htmlFor={name}>{label}</label> <input id={name} type={type} value={value} onChange={onChange} required /> </div> ); } export default Input; Input.defaultProps = { value: '', onChange: () => { }, }; Input.propTypes = { type: PropTypes.string.isRequired, label: PropTypes.string.isRequired, name: PropTypes.string.isRequired, value: PropTypes.string, onChange: PropTypes.func, };
659
216
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var React = tslib_1.__importStar(require("react")); var StyledIconBase_1 = require("../../StyledIconBase"); exports.Tty = React.forwardRef(function (props, ref) { var attrs = { "fill": "currentColor", "xmlns": "http://www.w3.org/2000/svg", }; return (React.createElement(StyledIconBase_1.StyledIconBase, tslib_1.__assign({ iconAttrs: attrs, iconVerticalAlign: "-.125em", iconViewBox: "0 0 512 512" }, props, { ref: ref }), React.createElement("path", { fill: "currentColor", d: "M5.37 103.822c138.532-138.532 362.936-138.326 501.262 0 6.078 6.078 7.074 15.496 2.583 22.681l-43.214 69.138a18.332 18.332 0 01-22.356 7.305l-86.422-34.569a18.335 18.335 0 01-11.434-18.846L351.741 90c-62.145-22.454-130.636-21.986-191.483 0l5.953 59.532a18.331 18.331 0 01-11.434 18.846l-86.423 34.568a18.334 18.334 0 01-22.356-7.305L2.787 126.502a18.333 18.333 0 012.583-22.68zM96 308v-40c0-6.627-5.373-12-12-12H44c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm-336 96v-40c0-6.627-5.373-12-12-12H92c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zM96 500v-40c0-6.627-5.373-12-12-12H44c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm288 0v-40c0-6.627-5.373-12-12-12H140c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h232c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12z", key: "k0" }))); }); exports.Tty.displayName = 'Tty'; exports.TtyDimensions = { height: undefined, width: undefined };
2,484
1,993
var validator = require('validator'); BoardSanitize = function(validator) { this.sanitize = validator.sanitize this.check = validator.check } BoardSanitize.prototype.rename = function(data) { data.name = this.sanitize(data.name).entityEncode() data.name = this.sanitize(data.name).xss() return data } BoardSanitize.prototype.checkBoardId = function(id) { this.check(id).regex(/[a-z0-9\/]/i).notEmpty() } BoardSanitize.prototype.size = function(data) { var size = 'none'; switch (data) { case 'large': case 'medium': case 'small': size = data; } return size; } var BoardSanitizer = new BoardSanitize(validator) module.exports = BoardSanitizer
697
254
var http = require('http'); var server = http.createServer(function(req, res) { var categoria = req.url; if(categoria == '/tecnologia') { res.end("<html><body>Noticias de tecnologia</body></html>"); }else if(categoria == '/moda') { res.end("<html><body>Noticias de moda</body></html>"); }else { res.end("<html><body>Portal de noticias</body></html>"); } }); server.listen(3000);
431
155
// https://docs.cypress.io/api/introduction/api.html // https://docs.cypress.io/guides/core-concepts/introduction-to-cypress.html#Cypress-Is-Simple // Cypress.on('uncaught:exception', (err, runnable) => { // // returning false here prevents Cypress from // // failing the test // return false // }) // // this would be the last step // cy.getConsoleLog().should(function(log) { // console.log(log) // // log = [['warn', 'warning message'], ['log', 'regular log message'] ['warn', 'another warning message']] // // check that log does not contain any 'warn' or 'error' entry // const disallowedLevels = new Set(['warn', 'error']) // expect(log.some(([level]) => disallowedLevels.has(level)).false) // }) describe('Home', () => { it('Visits the app root url', () => { cy.visit('/') }) it('Check if Page loaded correctly', () => { cy.get('#app') cy.get('span.lang') cy.get('form.login-form') cy.contains('h1', 'Exomia Cloud') cy.get('svg') // Check if Logo is there // Buttons cy.get('input[type="text"]') cy.get('input[type="password"]') cy.get('input[class="confirm"]') cy.get('input[class="subConfirm"]') }) it('Language change test', () => { // Language Tests // English cy.contains('span', 'Imprint') cy.contains('span', 'Privacy') cy.get('input[class="confirm"]').should('have.value', 'Sign in') cy.get('input[class="subConfirm"]').should('have.value', 'Forgot password?') cy.get('span.lang').click() // German cy.contains('span', '©') cy.contains('span', 'Impressum') cy.contains('span', 'Datenschutz') cy.get('input[class="confirm"]').should('have.value', 'Anmelden') cy.get('input[class="subConfirm"]').should('have.value', 'Passwort vergessen ?') }) it('Check Login', () => { // Login cy.get('input[type="text"]').type('admin') cy.get('input[type="password"]').type('1234') cy.get('input[class="confirm"]').click() cy.url().should('include', '/overview') }) })
2,170
695
(window.webpackJsonp=window.webpackJsonp||[]).push([[7],{"VrN/":function(e,t,r){r("0l/t"),r("Vd3H"),r("hEkN"),r("a1Th"),r("h7Nl"),r("Btvt"),r("bWfx"),r("dRSK"),r("pIFo"),r("f3/d"),r("hHhE"),r("V+eJ"),r("OG14"),r("KKXr"),r("Oyvg"),r("xfY5"),r("SRfc"),e.exports=function(){"use strict";var e=navigator.userAgent,t=navigator.platform,r=/gecko\/\d/i.test(e),n=/MSIE \d/.test(e),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),o=/Edge\/(\d+)/.exec(e),l=n||i||o,s=l&&(n?document.documentMode||6:+(o||i)[1]),a=!o&&/WebKit\//.test(e),u=a&&/Qt\/\d+\.\d+/.test(e),c=!o&&/Chrome\//.test(e),h=/Opera\//.test(e),f=/Apple Computer/.test(navigator.vendor),d=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),p=/PhantomJS/.test(e),g=!o&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),v=/Android/.test(e),m=g||v||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=g||/Mac/.test(t),b=/\bCrOS\b/.test(e),w=/win/i.test(t),x=h&&e.match(/Version\/(\d*\.\d*)/);x&&(x=Number(x[1])),x&&x>=15&&(h=!1,a=!0);var C=y&&(u||h&&(null==x||x<12.11)),S=r||l&&s>=9;function L(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var k,T=function(e,t){var r=e.className,n=L(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}};function M(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function N(e,t){return M(e).appendChild(t)}function O(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function A(e,t,r,n){var i=O(e,t,r,n);return i.setAttribute("role","presentation"),i}function D(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if(11==t.nodeType&&(t=t.host),t==e)return!0}while(t=t.parentNode)}function W(){var e;try{e=document.activeElement}catch(Ae){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function H(e,t){var r=e.className;L(t).test(r)||(e.className+=(r?" ":"")+t)}function F(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!L(r[n]).test(t)&&(t+=" "+r[n]);return t}k=document.createRange?function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(Ae){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};var P=function(e){e.select()};function E(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function I(e,t,r){for(var n in t||(t={}),e)!e.hasOwnProperty(n)||!1===r&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function z(e,t,r,n,i){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var o=n||0,l=i||0;;){var s=e.indexOf("\t",o);if(s<0||s>=t)return l+(t-o);l+=s-o,l+=r-l%r,o=s+1}}g?P=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:l&&(P=function(e){try{e.select()}catch(t){}});var R=function(){this.id=null,this.f=null,this.time=0,this.handler=E(this.onTimeout,this)};function B(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}R.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},R.prototype.set=function(e,t){this.f=t;var r=+new Date+e;(!this.id||r<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=r)};var G={toString:function(){return"CodeMirror.Pass"}},U={scroll:!1},V={origin:"*mouse"},K={origin:"+move"};function X(e,t,r){for(var n=0,i=0;;){var o=e.indexOf("\t",n);-1==o&&(o=e.length);var l=o-n;if(o==e.length||i+l>=t)return n+Math.min(l,t-i);if(i+=o-n,n=o+1,(i+=r-i%r)>=t)return n}}var j=[""];function Y(e){for(;j.length<=e;)j.push(_(j)+" ");return j[e]}function _(e){return e[e.length-1]}function $(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function q(){}function Z(e,t){var r;return Object.create?r=Object.create(e):(q.prototype=e,r=new q),t&&I(t,r),r}var J=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Q(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||J.test(e))}function ee(e,t){return t?!!(t.source.indexOf("\\w")>-1&&Q(e))||t.test(e):Q(e)}function te(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var re=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ne(e){return e.charCodeAt(0)>=768&&re.test(e)}function ie(e,t,r){for(;(r<0?t>0:t<e.length)&&ne(e.charAt(t));)t+=r;return t}function oe(e,t,r){for(var n=t>r?-1:1;;){if(t==r)return t;var i=(t+r)/2,o=n<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:r;e(o)?r=o:t=o+n}}var le=null;function se(e,t,r){var n;le=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&"before"==r?n=i:le=i),o.from==t&&(o.from!=o.to&&"before"!=r?n=i:le=i)}return null!=n?n:le}var ae=function(){var e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,t=/[stwN]/,r=/[LRr]/,n=/[Lb1n]/,i=/[1n]/;function o(e,t,r){this.level=e,this.from=t,this.to=r}return function(l,s){var a="ltr"==s?"L":"R";if(0==l.length||"ltr"==s&&!e.test(l))return!1;for(var u,c=l.length,h=[],f=0;f<c;++f)h.push((u=l.charCodeAt(f))<=247?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(u):1424<=u&&u<=1524?"R":1536<=u&&u<=1785?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(u-1536):1774<=u&&u<=2220?"r":8192<=u&&u<=8203?"w":8204==u?"b":"L");for(var d=0,p=a;d<c;++d){var g=h[d];"m"==g?h[d]=p:p=g}for(var v=0,m=a;v<c;++v){var y=h[v];"1"==y&&"r"==m?h[v]="n":r.test(y)&&(m=y,"r"==y&&(h[v]="R"))}for(var b=1,w=h[0];b<c-1;++b){var x=h[b];"+"==x&&"1"==w&&"1"==h[b+1]?h[b]="1":","!=x||w!=h[b+1]||"1"!=w&&"n"!=w||(h[b]=w),w=x}for(var C=0;C<c;++C){var S=h[C];if(","==S)h[C]="N";else if("%"==S){var L=void 0;for(L=C+1;L<c&&"%"==h[L];++L);for(var k=C&&"!"==h[C-1]||L<c&&"1"==h[L]?"1":"N",T=C;T<L;++T)h[T]=k;C=L-1}}for(var M=0,N=a;M<c;++M){var O=h[M];"L"==N&&"1"==O?h[M]="L":r.test(O)&&(N=O)}for(var A=0;A<c;++A)if(t.test(h[A])){var D=void 0;for(D=A+1;D<c&&t.test(h[D]);++D);for(var W="L"==(A?h[A-1]:a),H=W==("L"==(D<c?h[D]:a))?W?"L":"R":a,F=A;F<D;++F)h[F]=H;A=D-1}for(var P,E=[],I=0;I<c;)if(n.test(h[I])){var z=I;for(++I;I<c&&n.test(h[I]);++I);E.push(new o(0,z,I))}else{var R=I,B=E.length,G="rtl"==s?1:0;for(++I;I<c&&"L"!=h[I];++I);for(var U=R;U<I;)if(i.test(h[U])){R<U&&(E.splice(B,0,new o(1,R,U)),B+=G);var V=U;for(++U;U<I&&i.test(h[U]);++U);E.splice(B,0,new o(2,V,U)),B+=G,R=U}else++U;R<I&&E.splice(B,0,new o(1,R,I))}return"ltr"==s&&(1==E[0].level&&(P=l.match(/^\s+/))&&(E[0].from=P[0].length,E.unshift(new o(0,0,P[0].length))),1==_(E).level&&(P=l.match(/\s+$/))&&(_(E).to-=P[0].length,E.push(new o(0,c-P[0].length,c)))),"rtl"==s?E.reverse():E}}();function ue(e,t){var r=e.order;return null==r&&(r=e.order=ae(e.text,t)),r}var ce=[],he=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||ce).concat(r)}};function fe(e,t){return e._handlers&&e._handlers[t]||ce}function de(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers,i=n&&n[t];if(i){var o=B(i,r);o>-1&&(n[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function pe(e,t){var r=fe(e,t);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)}function ge(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),pe(e,r||t.type,e,t),xe(t)||t.codemirrorIgnore}function ve(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)-1==B(r,t[n])&&r.push(t[n])}function me(e,t){return fe(e,t).length>0}function ye(e){e.prototype.on=function(e,t){he(this,e,t)},e.prototype.off=function(e,t){de(this,e,t)}}function be(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function we(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function xe(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Ce(e){be(e),we(e)}function Se(e){return e.target||e.srcElement}function Le(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),y&&e.ctrlKey&&1==t&&(t=3),t}var ke,Te,Me=function(){if(l&&s<9)return!1;var e=O("div");return"draggable"in e||"dragDrop"in e}();function Ne(e){if(null==ke){var t=O("span","​");N(e,O("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(ke=t.offsetWidth<=1&&t.offsetHeight>2&&!(l&&s<8))}var r=ke?O("span","​"):O("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function Oe(e){if(null!=Te)return Te;var t=N(e,document.createTextNode("AخA")),r=k(t,0,1).getBoundingClientRect(),n=k(t,1,2).getBoundingClientRect();return M(e),!(!r||r.left==r.right)&&(Te=n.right-r.right<3)}var Ae,De=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;t<=n;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),l=o.indexOf("\r");-1!=l?(r.push(o.slice(0,l)),t+=l+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},We=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(Ae){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(Ae){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},He="oncopy"in(Ae=O("div"))||(Ae.setAttribute("oncopy","return;"),"function"==typeof Ae.oncopy),Fe=null,Pe={},Ee={};function Ie(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Pe[e]=t}function ze(e){if("string"==typeof e&&Ee.hasOwnProperty(e))e=Ee[e];else if(e&&"string"==typeof e.name&&Ee.hasOwnProperty(e.name)){var t=Ee[e.name];"string"==typeof t&&(t={name:t}),(e=Z(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return ze("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return ze("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Re(e,t){t=ze(t);var r=Pe[t.name];if(!r)return Re(e,"text/plain");var n=r(e,t);if(Be.hasOwnProperty(t.name)){var i=Be[t.name];for(var o in i)i.hasOwnProperty(o)&&(n.hasOwnProperty(o)&&(n["_"+o]=n[o]),n[o]=i[o])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)n[l]=t.modeProps[l];return n}var Be={};function Ge(e,t){I(t,Be.hasOwnProperty(e)?Be[e]:Be[e]={})}function Ue(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function Ve(e,t){for(var r;e.innerMode&&(r=e.innerMode(t))&&r.mode!=e;)t=r.state,e=r.mode;return r||{mode:e,state:t}}function Ke(e,t,r){return!e.startState||e.startState(t,r)}var Xe=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};function je(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(t<o){r=i;break}t-=o}return r.lines[t]}function Ye(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,(function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i})),n}function _e(e,t,r){var n=[];return e.iter(t,r,(function(e){n.push(e.text)})),n}function $e(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function qe(e){if(null==e.parent)return null;for(var t=e.parent,r=B(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function Ze(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(t<o){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var l=0;l<e.lines.length;++l){var s=e.lines[l].height;if(t<s)break;t-=s}return r+l}function Je(e,t){return t>=e.first&&t<e.first+e.size}function Qe(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function et(e,t,r){if(void 0===r&&(r=null),!(this instanceof et))return new et(e,t,r);this.line=e,this.ch=t,this.sticky=r}function tt(e,t){return e.line-t.line||e.ch-t.ch}function rt(e,t){return e.sticky==t.sticky&&0==tt(e,t)}function nt(e){return et(e.line,e.ch)}function it(e,t){return tt(e,t)<0?t:e}function ot(e,t){return tt(e,t)<0?e:t}function lt(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function st(e,t){if(t.line<e.first)return et(e.first,0);var r=e.first+e.size-1;return t.line>r?et(r,je(e,r).text.length):function(e,t){var r=e.ch;return null==r||r>t?et(e.line,t):r<0?et(e.line,0):e}(t,je(e,t.line).text.length)}function at(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=st(e,t[n]);return r}Xe.prototype.eol=function(){return this.pos>=this.string.length},Xe.prototype.sol=function(){return this.pos==this.lineStart},Xe.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Xe.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Xe.prototype.eat=function(e){var t=this.string.charAt(this.pos);if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},Xe.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Xe.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Xe.prototype.skipToEnd=function(){this.pos=this.string.length},Xe.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Xe.prototype.backUp=function(e){this.pos-=e},Xe.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=z(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},Xe.prototype.indentation=function(){return z(this.string,null,this.tabSize)-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},Xe.prototype.match=function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e};if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},Xe.prototype.current=function(){return this.string.slice(this.start,this.pos)},Xe.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Xe.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Xe.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var ut=function(e,t){this.state=e,this.lookAhead=t},ct=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};function ht(e,t,r,n){var i=[e.state.modeGen],o={};wt(e,t.text,e.doc.mode,r,(function(e,t){return i.push(e,t)}),o,n);for(var l=r.state,s=function(n){r.baseTokens=i;var s=e.state.overlays[n],a=1,u=0;r.state=!0,wt(e,t.text,s.mode,r,(function(e,t){for(var r=a;u<e;){var n=i[a];n>e&&i.splice(a,1,e,i[a+1],n),a+=2,u=Math.min(e,n)}if(t)if(s.opaque)i.splice(r,a-r,e,"overlay "+t),a=r+2;else for(;r<a;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"overlay "+t}}),o),r.state=l,r.baseTokens=null,r.baseTokenPos=1},a=0;a<e.state.overlays.length;++a)s(a);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function ft(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=dt(e,qe(t)),i=t.text.length>e.options.maxHighlightLength&&Ue(e.doc.mode,n.state),o=ht(e,t,n);i&&(n.state=i),t.stateAfter=n.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function dt(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return new ct(n,!0,t);var o=function(e,t,r){for(var n,i,o=e.doc,l=r?-1:t-(e.doc.mode.innerMode?1e3:100),s=t;s>l;--s){if(s<=o.first)return o.first;var a=je(o,s-1),u=a.stateAfter;if(u&&(!r||s+(u instanceof ut?u.lookAhead:0)<=o.modeFrontier))return s;var c=z(a.text,null,e.options.tabSize);(null==i||n>c)&&(i=s-1,n=c)}return i}(e,t,r),l=o>n.first&&je(n,o-1).stateAfter,s=l?ct.fromSaved(n,l,o):new ct(n,Ke(n.mode),o);return n.iter(o,t,(function(r){pt(e,r.text,s);var n=s.line;r.stateAfter=n==t-1||n%5==0||n>=i.viewFrom&&n<i.viewTo?s.save():null,s.nextLine()})),r&&(n.modeFrontier=s.line),s}function pt(e,t,r,n){var i=e.doc.mode,o=new Xe(t,e.options.tabSize,r);for(o.start=o.pos=n||0,""==t&&gt(i,r.state);!o.eol();)vt(i,o,r.state),o.start=o.pos}function gt(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var r=Ve(e,t);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function vt(e,t,r,n){for(var i=0;i<10;i++){n&&(n[0]=Ve(e,r).mode);var o=e.token(t,r);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}ct.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ct.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},ct.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ct.fromSaved=function(e,t,r){return t instanceof ut?new ct(e,Ue(e.mode,t.state),r,t.lookAhead):new ct(e,Ue(e.mode,t),r)},ct.prototype.save=function(e){var t=!1!==e?Ue(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ut(t,this.maxLookAhead):t};var mt=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function yt(e,t,r,n){var i,o,l=e.doc,s=l.mode,a=je(l,(t=st(l,t)).line),u=dt(e,t.line,r),c=new Xe(a.text,e.options.tabSize,u);for(n&&(o=[]);(n||c.pos<t.ch)&&!c.eol();)c.start=c.pos,i=vt(s,c,u.state),n&&o.push(new mt(c,i,Ue(l.mode,u.state)));return n?o:new mt(c,i,u.state)}function bt(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+r[2])}return e}function wt(e,t,r,n,i,o,l){var s=r.flattenSpans;null==s&&(s=e.options.flattenSpans);var a,u=0,c=null,h=new Xe(t,e.options.tabSize,n),f=e.options.addModeClass&&[null];for(""==t&&bt(gt(r,n.state),o);!h.eol();){if(h.pos>e.options.maxHighlightLength?(s=!1,l&&pt(e,t,n,h.pos),h.pos=t.length,a=null):a=bt(vt(r,h,n.state,f),o),f){var d=f[0].name;d&&(a="m-"+(a?d+" "+a:d))}if(!s||c!=a){for(;u<h.start;)i(u=Math.min(h.start,u+5e3),c);c=a}h.start=h.pos}for(;u<h.pos;){var p=Math.min(h.pos,u+5e3);i(p,c),u=p}}var xt=!1,Ct=!1;function St(e,t,r){this.marker=e,this.from=t,this.to=r}function Lt(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function kt(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function Tt(e,t){if(t.full)return null;var r=Je(e,t.from.line)&&je(e,t.from.line).markedSpans,n=Je(e,t.to.line)&&je(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,l=0==tt(t.from,t.to),s=function(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker;if(null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t)||o.from==t&&"bookmark"==l.type&&(!r||!o.marker.insertLeft)){var s=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new St(l,o.from,s?null:o.to))}}return n}(r,i,l),a=function(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker;if(null==o.to||(l.inclusiveRight?o.to>=t:o.to>t)||o.from==t&&"bookmark"==l.type&&(!r||o.marker.insertLeft)){var s=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new St(l,s?null:o.from-t,null==o.to?null:o.to-t))}}return n}(n,o,l),u=1==t.text.length,c=_(t.text).length+(u?i:0);if(s)for(var h=0;h<s.length;++h){var f=s[h];if(null==f.to){var d=Lt(a,f.marker);d?u&&(f.to=null==d.to?null:d.to+c):f.to=i}}if(a)for(var p=0;p<a.length;++p){var g=a[p];null!=g.to&&(g.to+=c),null==g.from?Lt(s,g.marker)||(g.from=c,u&&(s||(s=[])).push(g)):(g.from+=c,u&&(s||(s=[])).push(g))}s&&(s=Mt(s)),a&&a!=s&&(a=Mt(a));var v=[s];if(!u){var m,y=t.text.length-2;if(y>0&&s)for(var b=0;b<s.length;++b)null==s[b].to&&(m||(m=[])).push(new St(s[b].marker,null,null));for(var w=0;w<y;++w)v.push(m);v.push(a)}return v}function Mt(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&!1!==r.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function Nt(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function Ot(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function At(e){return e.inclusiveLeft?-1:0}function Dt(e){return e.inclusiveRight?1:0}function Wt(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=tt(n.from,i.from)||At(e)-At(t);if(o)return-o;var l=tt(n.to,i.to)||Dt(e)-Dt(t);return l||t.id-e.id}function Ht(e,t){var r,n=Ct&&e.markedSpans;if(n)for(var i=void 0,o=0;o<n.length;++o)(i=n[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!r||Wt(r,i.marker)<0)&&(r=i.marker);return r}function Ft(e){return Ht(e,!0)}function Pt(e){return Ht(e,!1)}function Et(e,t){var r,n=Ct&&e.markedSpans;if(n)for(var i=0;i<n.length;++i){var o=n[i];o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!r||Wt(r,o.marker)<0)&&(r=o.marker)}return r}function It(e,t,r,n,i){var o=je(e,t),l=Ct&&o.markedSpans;if(l)for(var s=0;s<l.length;++s){var a=l[s];if(a.marker.collapsed){var u=a.marker.find(0),c=tt(u.from,r)||At(a.marker)-At(i),h=tt(u.to,n)||Dt(a.marker)-Dt(i);if(!(c>=0&&h<=0||c<=0&&h>=0)&&(c<=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?tt(u.to,r)>=0:tt(u.to,r)>0)||c>=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?tt(u.from,n)<=0:tt(u.from,n)<0)))return!0}}}function zt(e){for(var t;t=Ft(e);)e=t.find(-1,!0).line;return e}function Rt(e,t){var r=je(e,t),n=zt(r);return r==n?t:qe(n)}function Bt(e,t){if(t>e.lastLine())return t;var r,n=je(e,t);if(!Gt(e,n))return t;for(;r=Pt(n);)n=r.find(1,!0).line;return qe(n)+1}function Gt(e,t){var r=Ct&&t.markedSpans;if(r)for(var n=void 0,i=0;i<r.length;++i)if((n=r[i]).marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&Ut(e,t,n))return!0}}function Ut(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return Ut(e,n.line,Lt(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if((i=t.markedSpans[o]).marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&Ut(e,t,i))return!0}function Vt(e){for(var t=0,r=(e=zt(e)).parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;o=(r=o).parent)for(var l=0;l<o.children.length;++l){var s=o.children[l];if(s==r)break;t+=s.height}return t}function Kt(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=Ft(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=Pt(n);){var o=t.find(0,!0);r-=n.text.length-o.from.ch,r+=(n=o.to.line).text.length-o.to.ch}return r}function Xt(e){var t=e.display,r=e.doc;t.maxLine=je(r,r.first),t.maxLineLength=Kt(t.maxLine),t.maxLineChanged=!0,r.iter((function(e){var r=Kt(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)}))}var jt=function(e,t,r){this.text=e,Ot(this,t),this.height=r?r(this):1};function Yt(e){e.parent=null,Nt(e)}jt.prototype.lineNo=function(){return qe(this)},ye(jt);var _t={},$t={};function qt(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?$t:_t;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Zt(e,t){var r=A("span",null,null,a?"padding-right: .1px":null),n={pre:A("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,l=void 0;n.pos=0,n.addToken=Qt,Oe(e.display.measure)&&(l=ue(o,e.doc.direction))&&(n.addToken=er(n.addToken,l)),n.map=[],rr(o,n,ft(e,o,t!=e.display.externalMeasured&&qe(o))),o.styleClasses&&(o.styleClasses.bgClass&&(n.bgClass=F(o.styleClasses.bgClass,n.bgClass||"")),o.styleClasses.textClass&&(n.textClass=F(o.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Ne(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(a){var s=n.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return pe(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=F(n.pre.className,n.textClass||"")),n}function Jt(e){var t=O("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Qt(e,t,r,n,i,o,a){if(t){var u,c=e.splitSpaces?function(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!r||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),n+=o,r=" "==o}return n}(t,e.trailingSpace):t,h=e.cm.state.specialChars,f=!1;if(h.test(t)){u=document.createDocumentFragment();for(var d=0;;){h.lastIndex=d;var p=h.exec(t),g=p?p.index-d:t.length-d;if(g){var v=document.createTextNode(c.slice(d,d+g));l&&s<9?u.appendChild(O("span",[v])):u.appendChild(v),e.map.push(e.pos,e.pos+g,v),e.col+=g,e.pos+=g}if(!p)break;d+=g+1;var m=void 0;if("\t"==p[0]){var y=e.cm.options.tabSize,b=y-e.col%y;(m=u.appendChild(O("span",Y(b),"cm-tab"))).setAttribute("role","presentation"),m.setAttribute("cm-text","\t"),e.col+=b}else"\r"==p[0]||"\n"==p[0]?((m=u.appendChild(O("span","\r"==p[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",p[0]),e.col+=1):((m=e.cm.options.specialCharPlaceholder(p[0])).setAttribute("cm-text",p[0]),l&&s<9?u.appendChild(O("span",[m])):u.appendChild(m),e.col+=1);e.map.push(e.pos,e.pos+1,m),e.pos++}}else e.col+=t.length,u=document.createTextNode(c),e.map.push(e.pos,e.pos+t.length,u),l&&s<9&&(f=!0),e.pos+=t.length;if(e.trailingSpace=32==c.charCodeAt(t.length-1),r||n||i||f||o){var w=r||"";n&&(w+=n),i&&(w+=i);var x=O("span",[u],w,o);if(a)for(var C in a)a.hasOwnProperty(C)&&"style"!=C&&"class"!=C&&x.setAttribute(C,a[C]);return e.content.appendChild(x)}e.content.appendChild(u)}}function er(e,t){return function(r,n,i,o,l,s,a){i=i?i+" cm-force-border":"cm-force-border";for(var u=r.pos,c=u+n.length;;){for(var h=void 0,f=0;f<t.length&&!((h=t[f]).to>u&&h.from<=u);f++);if(h.to>=c)return e(r,n,i,o,l,s,a);e(r,n.slice(0,h.to-u),i,o,null,s,a),o=null,n=n.slice(h.to-u),u=h.to}}}function tr(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function rr(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var l,s,a,u,c,h,f,d=i.length,p=0,g=1,v="",m=0;;){if(m==p){a=u=c=s="",f=null,h=null,m=1/0;for(var y=[],b=void 0,w=0;w<n.length;++w){var x=n[w],C=x.marker;if("bookmark"==C.type&&x.from==p&&C.widgetNode)y.push(C);else if(x.from<=p&&(null==x.to||x.to>p||C.collapsed&&x.to==p&&x.from==p)){if(null!=x.to&&x.to!=p&&m>x.to&&(m=x.to,u=""),C.className&&(a+=" "+C.className),C.css&&(s=(s?s+";":"")+C.css),C.startStyle&&x.from==p&&(c+=" "+C.startStyle),C.endStyle&&x.to==m&&(b||(b=[])).push(C.endStyle,x.to),C.title&&((f||(f={})).title=C.title),C.attributes)for(var S in C.attributes)(f||(f={}))[S]=C.attributes[S];C.collapsed&&(!h||Wt(h.marker,C)<0)&&(h=x)}else x.from>p&&m>x.from&&(m=x.from)}if(b)for(var L=0;L<b.length;L+=2)b[L+1]==m&&(u+=" "+b[L]);if(!h||h.from==p)for(var k=0;k<y.length;++k)tr(t,0,y[k]);if(h&&(h.from||0)==p){if(tr(t,(null==h.to?d+1:h.to)-p,h.marker,null==h.from),null==h.to)return;h.to==p&&(h=!1)}}if(p>=d)break;for(var T=Math.min(d,m);;){if(v){var M=p+v.length;if(!h){var N=M>T?v.slice(0,T-p):v;t.addToken(t,N,l?l+a:a,c,p+N.length==m?u:"",s,f)}if(M>=T){v=v.slice(T-p),p=T;break}p=M,c=""}v=i.slice(o,o=r[g++]),l=qt(r[g++],t.cm.options)}}else for(var O=1;O<r.length;O+=2)t.addToken(t,i.slice(o,o=r[O]),qt(r[O+1],t.cm.options))}function nr(e,t,r){this.line=t,this.rest=function(e){for(var t,r;t=Pt(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}(t),this.size=this.rest?qe(_(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Gt(e,t)}function ir(e,t,r){for(var n,i=[],o=t;o<r;o=n){var l=new nr(e.doc,je(e.doc,o),o);n=o+l.size,i.push(l)}return i}var or=null,lr=null;function sr(e,t){var r=fe(e,t);if(r.length){var n,i=Array.prototype.slice.call(arguments,2);or?n=or.delayedCallbacks:lr?n=lr:(n=lr=[],setTimeout(ar,0));for(var o=function(e){n.push((function(){return r[e].apply(null,i)}))},l=0;l<r.length;++l)o(l)}}function ar(){var e=lr;lr=null;for(var t=0;t<e.length;++t)e[t]()}function ur(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?fr(e,t):"gutter"==o?pr(e,t,r,n):"class"==o?dr(e,t):"widget"==o&&gr(e,t,n)}t.changes=null}function cr(e){return e.node==e.text&&(e.node=O("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),l&&s<8&&(e.node.style.zIndex=2)),e.node}function hr(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Zt(e,t)}function fr(e,t){var r=t.text.className,n=hr(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,dr(e,t)):r&&(t.text.className=r)}function dr(e,t){!function(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var n=cr(t);t.background=n.insertBefore(O("div",null,r),n.firstChild),e.display.input.setUneditable(t.background)}}(e,t),t.line.wrapClass?cr(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function pr(e,t,r,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=cr(t);t.gutterBackground=O("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var l=cr(t),s=t.gutter=O("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(s),l.insertBefore(s,t.text),t.line.gutterClass&&(s.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=s.appendChild(O("div",Qe(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var a=0;a<e.display.gutterSpecs.length;++a){var u=e.display.gutterSpecs[a].className,c=o.hasOwnProperty(u)&&o[u];c&&s.appendChild(O("div",[c],"CodeMirror-gutter-elt","left: "+n.gutterLeft[u]+"px; width: "+n.gutterWidth[u]+"px"))}}}function gr(e,t,r){t.alignable&&(t.alignable=null);for(var n=L("CodeMirror-linewidget"),i=t.node.firstChild,o=void 0;i;i=o)o=i.nextSibling,n.test(i.className)&&t.node.removeChild(i);mr(e,t,r)}function vr(e,t,r,n){var i=hr(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),dr(e,t),pr(e,t,r,n),mr(e,t,n),t.node}function mr(e,t,r){if(yr(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)yr(e,t.rest[n],t,r,!1)}function yr(e,t,r,n,i){if(t.widgets)for(var o=cr(r),l=0,s=t.widgets;l<s.length;++l){var a=s[l],u=O("div",[a.node],"CodeMirror-linewidget"+(a.className?" "+a.className:""));a.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),br(a,u,r,n),e.display.input.setUneditable(u),i&&a.above?o.insertBefore(u,r.gutter||r.text):o.appendChild(u),sr(a,"redraw")}}function br(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function wr(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!D(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),N(t.display.measure,O("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function xr(e,t){for(var r=Se(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function Cr(e){return e.lineSpace.offsetTop}function Sr(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Lr(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=N(e.measure,O("pre","x","CodeMirror-line-like")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n),n}function kr(e){return 30-e.display.nativeBarWidth}function Tr(e){return e.display.scroller.clientWidth-kr(e)-e.display.barWidth}function Mr(e){return e.display.scroller.clientHeight-kr(e)-e.display.barHeight}function Nr(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var i=0;i<e.rest.length;i++)if(qe(e.rest[i])>r)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Or(e,t,r,n){return Wr(e,Dr(e,t),r,n)}function Ar(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[cn(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function Dr(e,t){var r=qe(t),n=Ar(e,r);n&&!n.text?n=null:n&&n.changes&&(ur(e,n,r,on(e)),e.curOp.forceUpdate=!0),n||(n=function(e,t){var r=qe(t=zt(t)),n=e.display.externalMeasured=new nr(e.doc,t,r);n.lineN=r;var i=n.built=Zt(e,n);return n.text=i.pre,N(e.display.lineMeasure,i.pre),n}(e,t));var i=Nr(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Wr(e,t,r,n,i){t.before&&(r=-1);var o,a=r+(n||"");return t.cache.hasOwnProperty(a)?o=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(function(e,t,r){var n=e.options.lineWrapping,i=n&&Tr(e);if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var l=t.text.firstChild.getClientRects(),s=0;s<l.length-1;s++){var a=l[s],u=l[s+1];Math.abs(a.bottom-u.bottom)>2&&o.push((a.bottom+u.top)/2-r.top)}}o.push(r.bottom-r.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,r,n){var i,o=Pr(t.map,r,n),a=o.node,u=o.start,c=o.end,h=o.collapse;if(3==a.nodeType){for(var f=0;f<4;f++){for(;u&&ne(t.line.text.charAt(o.coverStart+u));)--u;for(;o.coverStart+c<o.coverEnd&&ne(t.line.text.charAt(o.coverStart+c));)++c;if((i=l&&s<9&&0==u&&c==o.coverEnd-o.coverStart?a.parentNode.getBoundingClientRect():Er(k(a,u,c).getClientRects(),n)).left||i.right||0==u)break;c=u,u-=1,h="right"}l&&s<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=Fe)return Fe;var t=N(e,O("span","x")),r=t.getBoundingClientRect(),n=k(t,0,1).getBoundingClientRect();return Fe=Math.abs(r.left-n.left)>1}(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}(e.display.measure,i))}else{var d;u>0&&(h=n="right"),i=e.options.lineWrapping&&(d=a.getClientRects()).length>1?d["right"==n?d.length-1:0]:a.getBoundingClientRect()}if(l&&s<9&&!u&&(!i||!i.left&&!i.right)){var p=a.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+nn(e.display),top:p.top,bottom:p.bottom}:Fr}for(var g=i.top-t.rect.top,v=i.bottom-t.rect.top,m=(g+v)/2,y=t.view.measure.heights,b=0;b<y.length-1&&!(m<y[b]);b++);var w=b?y[b-1]:0,x=y[b],C={left:("right"==h?i.right:i.left)-t.rect.left,right:("left"==h?i.left:i.right)-t.rect.left,top:w,bottom:x};return i.left||i.right||(C.bogus=!0),e.options.singleCursorHeightPerLine||(C.rtop=g,C.rbottom=v),C}(e,t,r,n)).bogus||(t.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var Hr,Fr={left:0,right:0,top:0,bottom:0};function Pr(e,t,r){for(var n,i,o,l,s,a,u=0;u<e.length;u+=3)if(s=e[u],a=e[u+1],t<s?(i=0,o=1,l="left"):t<a?o=1+(i=t-s):(u==e.length-3||t==a&&e[u+3]>t)&&(i=(o=a-s)-1,t>=a&&(l="right")),null!=i){if(n=e[u+2],s==a&&r==(n.insertLeft?"left":"right")&&(l=r),"left"==r&&0==i)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)n=e[2+(u-=3)],l="left";if("right"==r&&i==a-s)for(;u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft;)n=e[(u+=3)+2],l="right";break}return{node:n,start:i,end:o,collapse:l,coverStart:s,coverEnd:a}}function Er(e,t){var r=Fr;if("left"==t)for(var n=0;n<e.length&&(r=e[n]).left==r.right;n++);else for(var i=e.length-1;i>=0&&(r=e[i]).left==r.right;i--);return r}function Ir(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function zr(e){e.display.externalMeasure=null,M(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Ir(e.display.view[t])}function Rr(e){zr(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Br(){return c&&v?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Gr(){return c&&v?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Ur(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=wr(e.widgets[r]));return t}function Vr(e,t,r,n,i){if(!i){var o=Ur(t);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var l=Vt(t);if("local"==n?l+=Cr(e.display):l-=e.display.viewOffset,"page"==n||"window"==n){var s=e.display.lineSpace.getBoundingClientRect();l+=s.top+("window"==n?0:Gr());var a=s.left+("window"==n?0:Br());r.left+=a,r.right+=a}return r.top+=l,r.bottom+=l,r}function Kr(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=Br(),i-=Gr();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var l=e.display.lineSpace.getBoundingClientRect();return{left:n-l.left,top:i-l.top}}function Xr(e,t,r,n,i){return n||(n=je(e.doc,t.line)),Vr(e,n,Or(e,n,t.ch,i),r)}function jr(e,t,r,n,i,o){function l(t,l){var s=Wr(e,i,t,l?"right":"left",o);return l?s.left=s.right:s.right=s.left,Vr(e,n,s,r)}n=n||je(e.doc,t.line),i||(i=Dr(e,n));var s=ue(n,e.doc.direction),a=t.ch,u=t.sticky;if(a>=n.text.length?(a=n.text.length,u="before"):a<=0&&(a=0,u="after"),!s)return l("before"==u?a-1:a,"before"==u);function c(e,t,r){return l(r?e-1:e,1==s[t].level!=r)}var h=se(s,a,u),f=le,d=c(a,h,"before"==u);return null!=f&&(d.other=c(a,f,"before"!=u)),d}function Yr(e,t){var r=0;t=st(e.doc,t),e.options.lineWrapping||(r=nn(e.display)*t.ch);var n=je(e.doc,t.line),i=Vt(n)+Cr(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function _r(e,t,r,n,i){var o=et(e,t,r);return o.xRel=i,n&&(o.outside=n),o}function $r(e,t,r){var n=e.doc;if((r+=e.display.viewOffset)<0)return _r(n.first,0,null,-1,-1);var i=Ze(n,r),o=n.first+n.size-1;if(i>o)return _r(n.first+n.size-1,je(n,o).text.length,null,1,1);t<0&&(t=0);for(var l=je(n,i);;){var s=Qr(e,l,i,t,r),a=Et(l,s.ch+(s.xRel>0||s.outside>0?1:0));if(!a)return s;var u=a.find(1);if(u.line==i)return u;l=je(n,i=u.line)}}function qr(e,t,r,n){n-=Ur(t);var i=t.text.length,o=oe((function(t){return Wr(e,r,t-1).bottom<=n}),i,0);return{begin:o,end:i=oe((function(t){return Wr(e,r,t).top>n}),o,i)}}function Zr(e,t,r,n){return r||(r=Dr(e,t)),qr(e,t,r,Vr(e,t,Wr(e,r,n),"line").top)}function Jr(e,t,r,n){return!(e.bottom<=r)&&(e.top>r||(n?e.left:e.right)>t)}function Qr(e,t,r,n,i){i-=Vt(t);var o=Dr(e,t),l=Ur(t),s=0,a=t.text.length,u=!0,c=ue(t,e.doc.direction);if(c){var h=(e.options.lineWrapping?tn:en)(e,t,r,o,c,n,i);s=(u=1!=h.level)?h.from:h.to-1,a=u?h.to:h.from-1}var f,d,p=null,g=null,v=oe((function(t){var r=Wr(e,o,t);return r.top+=l,r.bottom+=l,!!Jr(r,n,i,!1)&&(r.top<=i&&r.left<=n&&(p=t,g=r),!0)}),s,a),m=!1;if(g){var y=n-g.left<g.right-n,b=y==u;v=p+(b?0:1),d=b?"after":"before",f=y?g.left:g.right}else{u||v!=a&&v!=s||v++,d=0==v?"after":v==t.text.length?"before":Wr(e,o,v-(u?1:0)).bottom+l<=i==u?"after":"before";var w=jr(e,et(r,v,d),"line",t,o);f=w.left,m=i<w.top?-1:i>=w.bottom?1:0}return _r(r,v=ie(t.text,v,1),d,m,n-f)}function en(e,t,r,n,i,o,l){var s=oe((function(s){var a=i[s],u=1!=a.level;return Jr(jr(e,et(r,u?a.to:a.from,u?"before":"after"),"line",t,n),o,l,!0)}),0,i.length-1),a=i[s];if(s>0){var u=1!=a.level,c=jr(e,et(r,u?a.from:a.to,u?"after":"before"),"line",t,n);Jr(c,o,l,!0)&&c.top>l&&(a=i[s-1])}return a}function tn(e,t,r,n,i,o,l){var s=qr(e,t,n,l),a=s.begin,u=s.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var c=null,h=null,f=0;f<i.length;f++){var d=i[f];if(!(d.from>=u||d.to<=a)){var p=Wr(e,n,1!=d.level?Math.min(u,d.to)-1:Math.max(a,d.from)).right,g=p<o?o-p+1e9:p-o;(!c||h>g)&&(c=d,h=g)}}return c||(c=i[i.length-1]),c.from<a&&(c={from:a,to:c.to,level:c.level}),c.to>u&&(c={from:c.from,to:u,level:c.level}),c}function rn(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Hr){Hr=O("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Hr.appendChild(document.createTextNode("x")),Hr.appendChild(O("br"));Hr.appendChild(document.createTextNode("x"))}N(e.measure,Hr);var r=Hr.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),M(e.measure),r||1}function nn(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=O("span","xxxxxxxxxx"),r=O("pre",[t],"CodeMirror-line-like");N(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function on(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l){var s=e.display.gutterSpecs[l].className;r[s]=o.offsetLeft+o.clientLeft+i,n[s]=o.clientWidth}return{fixedPos:ln(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function ln(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function sn(e){var t=rn(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/nn(e.display)-3);return function(i){if(Gt(e.doc,i))return 0;var o=0;if(i.widgets)for(var l=0;l<i.widgets.length;l++)i.widgets[l].height&&(o+=i.widgets[l].height);return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function an(e){var t=e.doc,r=sn(e);t.iter((function(e){var t=r(e);t!=e.height&&$e(e,t)}))}function un(e,t,r,n){var i=e.display;if(!r&&"true"==Se(t).getAttribute("cm-not-content"))return null;var o,l,s=i.lineSpace.getBoundingClientRect();try{o=t.clientX-s.left,l=t.clientY-s.top}catch(t){return null}var a,u=$r(e,o,l);if(n&&u.xRel>0&&(a=je(e.doc,u.line).text).length==u.ch){var c=z(a,a.length,e.options.tabSize)-a.length;u=et(u.line,Math.max(0,Math.round((o-Lr(e.display).left)/nn(e.display))-c))}return u}function cn(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if((t-=r[n].size)<0)return n}function hn(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Ct&&Rt(e.doc,t)<i.viewTo&&dn(e);else if(r<=i.viewFrom)Ct&&Bt(e.doc,r+n)>i.viewFrom?dn(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)dn(e);else if(t<=i.viewFrom){var o=pn(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):dn(e)}else if(r>=i.viewTo){var l=pn(e,t,t,-1);l?(i.view=i.view.slice(0,l.index),i.viewTo=l.lineN):dn(e)}else{var s=pn(e,t,t,-1),a=pn(e,r,r+n,1);s&&a?(i.view=i.view.slice(0,s.index).concat(ir(e,s.lineN,a.lineN)).concat(i.view.slice(a.index)),i.viewTo+=n):dn(e)}var u=i.externalMeasured;u&&(r<u.lineN?u.lineN+=n:t<u.lineN+u.size&&(i.externalMeasured=null))}function fn(e,t,r){e.curOp.viewChanged=!0;var n=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var o=n.view[cn(e,t)];if(null!=o.node){var l=o.changes||(o.changes=[]);-1==B(l,r)&&l.push(r)}}}function dn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function pn(e,t,r,n){var i,o=cn(e,t),l=e.display.view;if(!Ct||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var s=e.display.viewFrom,a=0;a<o;a++)s+=l[a].size;if(s!=t){if(n>0){if(o==l.length-1)return null;i=s+l[o].size-t,o++}else i=s-t;t+=i,r+=i}for(;Rt(e.doc,r)!=r;){if(o==(n<0?0:l.length-1))return null;r+=n*l[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function gn(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++r}return r}function vn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function mn(e,t){void 0===t&&(t=!0);for(var r=e.doc,n={},i=n.cursors=document.createDocumentFragment(),o=n.selection=document.createDocumentFragment(),l=0;l<r.sel.ranges.length;l++)if(t||l!=r.sel.primIndex){var s=r.sel.ranges[l];if(!(s.from().line>=e.display.viewTo||s.to().line<e.display.viewFrom)){var a=s.empty();(a||e.options.showCursorWhenSelecting)&&yn(e,s.head,i),a||wn(e,s,o)}}return n}function yn(e,t,r){var n=jr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(O("div"," ","CodeMirror-cursor"));if(i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var o=r.appendChild(O("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=n.other.left+"px",o.style.top=n.other.top+"px",o.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function bn(e,t){return e.top-t.top||e.left-t.left}function wn(e,t,r){var n=e.display,i=e.doc,o=document.createDocumentFragment(),l=Lr(e.display),s=l.left,a=Math.max(n.sizerWidth,Tr(e)-n.sizer.offsetLeft)-l.right,u="ltr"==i.direction;function c(e,t,r,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),o.appendChild(O("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==r?a-e:r)+"px;\n height: "+(n-t)+"px"))}function h(t,r,n){var o,l,h=je(i,t),f=h.text.length;function d(r,n){return Xr(e,et(t,r),"div",h,n)}function p(t,r,n){var i=Zr(e,h,null,t),o="ltr"==r==("after"==n)?"left":"right";return d("after"==n?i.begin:i.end-(/\s/.test(h.text.charAt(i.end-1))?2:1),o)[o]}var g=ue(h,i.direction);return function(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var l=e[o];(l.from<r&&l.to>t||t==r&&l.to==t)&&(n(Math.max(l.from,t),Math.min(l.to,r),1==l.level?"rtl":"ltr",o),i=!0)}i||n(t,r,"ltr")}(g,r||0,null==n?f:n,(function(e,t,i,h){var v="ltr"==i,m=d(e,v?"left":"right"),y=d(t-1,v?"right":"left"),b=null==r&&0==e,w=null==n&&t==f,x=0==h,C=!g||h==g.length-1;if(y.top-m.top<=3){var S=(u?w:b)&&C,L=(u?b:w)&&x?s:(v?m:y).left,k=S?a:(v?y:m).right;c(L,m.top,k-L,m.bottom)}else{var T,M,N,O;v?(T=u&&b&&x?s:m.left,M=u?a:p(e,i,"before"),N=u?s:p(t,i,"after"),O=u&&w&&C?a:y.right):(T=u?p(e,i,"before"):s,M=!u&&b&&x?a:m.right,N=!u&&w&&C?s:y.left,O=u?p(t,i,"after"):a),c(T,m.top,M-T,m.bottom),m.bottom<y.top&&c(s,m.bottom,null,y.top),c(N,y.top,O-N,y.bottom)}(!o||bn(m,o)<0)&&(o=m),bn(y,o)<0&&(o=y),(!l||bn(m,l)<0)&&(l=m),bn(y,l)<0&&(l=y)})),{start:o,end:l}}var f=t.from(),d=t.to();if(f.line==d.line)h(f.line,f.ch,d.ch);else{var p=je(i,f.line),g=je(i,d.line),v=zt(p)==zt(g),m=h(f.line,f.ch,v?p.text.length+1:null).end,y=h(d.line,v?0:null,d.ch).start;v&&(m.top<y.top-2?(c(m.right,m.top,null,m.bottom),c(s,y.top,y.left,y.bottom)):c(m.right,m.top,y.left-m.right,m.bottom)),m.bottom<y.top&&c(s,m.bottom,null,y.top)}r.appendChild(o)}function xn(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval((function(){return t.cursorDiv.style.visibility=(r=!r)?"":"hidden"}),e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Cn(e){e.state.focused||(e.display.input.focus(),Ln(e))}function Sn(e){e.state.delayingBlurEvent=!0,setTimeout((function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,kn(e))}),100)}function Ln(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(pe(e,"focus",e,t),e.state.focused=!0,H(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),a&&setTimeout((function(){return e.display.input.reset(!0)}),20)),e.display.input.receivedFocus()),xn(e))}function kn(e,t){e.state.delayingBlurEvent||(e.state.focused&&(pe(e,"blur",e,t),e.state.focused=!1,T(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout((function(){e.state.focused||(e.display.shift=!1)}),150))}function Tn(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i=t.view[n],o=e.options.lineWrapping,a=void 0,u=0;if(!i.hidden){if(l&&s<8){var c=i.node.offsetTop+i.node.offsetHeight;a=c-r,r=c}else{var h=i.node.getBoundingClientRect();a=h.bottom-h.top,!o&&i.text.firstChild&&(u=i.text.firstChild.getBoundingClientRect().right-h.left-1)}var f=i.line.height-a;if((f>.005||f<-.005)&&($e(i.line,a),Mn(i.line),i.rest))for(var d=0;d<i.rest.length;d++)Mn(i.rest[d]);if(u>e.display.sizerWidth){var p=Math.ceil(u/nn(e.display));p>e.display.maxLineLength&&(e.display.maxLineLength=p,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}}function Mn(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],n=r.node.parentNode;n&&(r.height=n.offsetHeight)}}function Nn(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-Cr(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=Ze(t,n),l=Ze(t,i);if(r&&r.ensure){var s=r.ensure.from.line,a=r.ensure.to.line;s<o?(o=s,l=Ze(t,Vt(je(t,s))+e.wrapper.clientHeight)):Math.min(a,t.lastLine())>=l&&(o=Ze(t,Vt(je(t,a))-e.wrapper.clientHeight),l=a)}return{from:o,to:Math.max(l,o+1)}}function On(e,t){var r=e.display,n=rn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:r.scroller.scrollTop,o=Mr(e),l={};t.bottom-t.top>o&&(t.bottom=t.top+o);var s=e.doc.height+Sr(r),a=t.top<n,u=t.bottom>s-n;if(t.top<i)l.scrollTop=a?0:t.top;else if(t.bottom>i+o){var c=Math.min(t.top,(u?s:t.bottom)-o);c!=i&&(l.scrollTop=c)}var h=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft,f=Tr(e)-(e.options.fixedGutter?r.gutters.offsetWidth:0),d=t.right-t.left>f;return d&&(t.right=t.left+f),t.left<10?l.scrollLeft=0:t.left<h?l.scrollLeft=Math.max(0,t.left-(d?0:10)):t.right>f+h-3&&(l.scrollLeft=t.right+(d?0:10)-f),l}function An(e,t){null!=t&&(Hn(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Dn(e){Hn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Wn(e,t,r){null==t&&null==r||Hn(e),null!=t&&(e.curOp.scrollLeft=t),null!=r&&(e.curOp.scrollTop=r)}function Hn(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Fn(e,Yr(e,t.from),Yr(e,t.to),t.margin))}function Fn(e,t,r,n){var i=On(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});Wn(e,i.scrollLeft,i.scrollTop)}function Pn(e,t){Math.abs(e.doc.scrollTop-t)<2||(r||ai(e,{top:t}),En(e,t,!0),r&&ai(e),ni(e,100))}function En(e,t,r){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),(e.display.scroller.scrollTop!=t||r)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function In(e,t,r,n){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n||(e.doc.scrollLeft=t,hi(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function zn(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Sr(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+kr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var Rn=function(e,t,r){this.cm=r;var n=this.vert=O("div",[O("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=O("div",[O("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=i.tabIndex=-1,e(n),e(i),he(n,"scroll",(function(){n.clientHeight&&t(n.scrollTop,"vertical")})),he(i,"scroll",(function(){i.clientWidth&&t(i.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,l&&s<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Rn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},Rn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Rn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Rn.prototype.zeroWidthHack=function(){var e=y&&!d?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new R,this.disableVert=new R},Rn.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto",t.set(1e3,(function n(){var i=e.getBoundingClientRect();("vert"==r?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1))!=e?e.style.pointerEvents="none":t.set(1e3,n)}))},Rn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Bn=function(){};function Gn(e,t){t||(t=zn(e));var r=e.display.barWidth,n=e.display.barHeight;Un(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&Tn(e),Un(e,zn(e)),r=e.display.barWidth,n=e.display.barHeight}function Un(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}Bn.prototype.update=function(){return{bottom:0,right:0}},Bn.prototype.setScrollLeft=function(){},Bn.prototype.setScrollTop=function(){},Bn.prototype.clear=function(){};var Vn={native:Rn,null:Bn};function Kn(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&T(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Vn[e.options.scrollbarStyle]((function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),he(t,"mousedown",(function(){e.state.focused&&setTimeout((function(){return e.display.input.focus()}),0)})),t.setAttribute("cm-not-content","true")}),(function(t,r){"horizontal"==r?In(e,t):Pn(e,t)}),e),e.display.scrollbars.addClass&&H(e.display.wrapper,e.display.scrollbars.addClass)}var Xn=0;function jn(e){var t;e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Xn},t=e.curOp,or?or.ops.push(t):t.ownsGroup=or={ops:[t],delayedCallbacks:[]}}function Yn(e){var t=e.curOp;t&&function(e,t){var r=e.ownsGroup;if(r)try{!function(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}(r)}finally{or=null,t(r)}}(t,(function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;!function(e){for(var t=e.ops,r=0;r<t.length;r++)_n(t[r]);for(var n=0;n<t.length;n++)$n(t[n]);for(var i=0;i<t.length;i++)qn(t[i]);for(var o=0;o<t.length;o++)Zn(t[o]);for(var l=0;l<t.length;l++)Jn(t[l])}(e)}))}function _n(e){var t=e.cm,r=t.display;!function(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=kr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=kr(e)+"px",t.scrollbarsClipped=!0)}(t),e.updateMaxLine&&Xt(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new oi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function $n(e){e.updatedDisplay=e.mustUpdate&&li(e.cm,e.update)}function qn(e){var t=e.cm,r=t.display;e.updatedDisplay&&Tn(t),e.barMeasure=zn(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Or(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+kr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Tr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function Zn(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&In(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==W();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Gn(t,e.barMeasure),e.updatedDisplay&&ci(t,e.barMeasure),e.selectionChanged&&xn(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&Cn(e.cm)}function Jn(e){var t=e.cm,r=t.display,n=t.doc;e.updatedDisplay&&si(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null!=e.scrollTop&&En(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&In(t,e.scrollLeft,!0,!0),e.scrollToPos&&function(e,t){if(!ge(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!p){var o=O("div","​",null,"position: absolute;\n top: "+(t.top-r.viewOffset-Cr(e.display))+"px;\n height: "+(t.bottom-t.top+kr(e)+r.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}(t,function(e,t,r,n){var i;null==n&&(n=0),e.options.lineWrapping||t!=r||(r="before"==(t=t.ch?et(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?et(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var l=!1,s=jr(e,t),a=r&&r!=t?jr(e,r):s,u=On(e,i={left:Math.min(s.left,a.left),top:Math.min(s.top,a.top)-n,right:Math.max(s.left,a.left),bottom:Math.max(s.bottom,a.bottom)+n}),c=e.doc.scrollTop,h=e.doc.scrollLeft;if(null!=u.scrollTop&&(Pn(e,u.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(l=!0)),null!=u.scrollLeft&&(In(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-h)>1&&(l=!0)),!l)break}return i}(t,st(n,e.scrollToPos.from),st(n,e.scrollToPos.to),e.scrollToPos.margin));var i=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(i)for(var l=0;l<i.length;++l)i[l].lines.length||pe(i[l],"hide");if(o)for(var s=0;s<o.length;++s)o[s].lines.length&&pe(o[s],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&pe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Qn(e,t){if(e.curOp)return t();jn(e);try{return t()}finally{Yn(e)}}function ei(e,t){return function(){if(e.curOp)return t.apply(e,arguments);jn(e);try{return t.apply(e,arguments)}finally{Yn(e)}}}function ti(e){return function(){if(this.curOp)return e.apply(this,arguments);jn(this);try{return e.apply(this,arguments)}finally{Yn(this)}}}function ri(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);jn(t);try{return e.apply(this,arguments)}finally{Yn(t)}}}function ni(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,E(ii,e))}function ii(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var r=+new Date+e.options.workTime,n=dt(e,t.highlightFrontier),i=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),(function(o){if(n.line>=e.display.viewFrom){var l=o.styles,s=o.text.length>e.options.maxHighlightLength?Ue(t.mode,n.state):null,a=ht(e,o,n,!0);s&&(n.state=s),o.styles=a.styles;var u=o.styleClasses,c=a.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var h=!l||l.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),f=0;!h&&f<l.length;++f)h=l[f]!=o.styles[f];h&&i.push(n.line),o.stateAfter=n.save(),n.nextLine()}else o.text.length<=e.options.maxHighlightLength&&pt(e,o.text,n),o.stateAfter=n.line%5==0?n.save():null,n.nextLine();if(+new Date>r)return ni(e,e.options.workDelay),!0})),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),i.length&&Qn(e,(function(){for(var t=0;t<i.length;t++)fn(e,i[t],"text")}))}}var oi=function(e,t,r){var n=e.display;this.viewport=t,this.visible=Nn(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Tr(e),this.force=r,this.dims=on(e),this.events=[]};function li(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return dn(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==gn(e))return!1;fi(e)&&(dn(e),t.dims=on(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),l=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(n.first,r.viewFrom)),r.viewTo>l&&r.viewTo-l<20&&(l=Math.min(i,r.viewTo)),Ct&&(o=Rt(e.doc,o),l=Bt(e.doc,l));var s=o!=r.viewFrom||l!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;!function(e,t,r){var n=e.display;0==n.view.length||t>=n.viewTo||r<=n.viewFrom?(n.view=ir(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=ir(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(cn(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(ir(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,cn(e,r)))),n.viewTo=r}(e,o,l),r.viewOffset=Vt(je(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var u=gn(e);if(!s&&0==u&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var c=function(e){if(e.hasFocus())return null;var t=W();if(!t||!D(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&D(e.display.lineDiv,n.anchorNode)&&(r.anchorNode=n.anchorNode,r.anchorOffset=n.anchorOffset,r.focusNode=n.focusNode,r.focusOffset=n.focusOffset)}return r}(e);return u>4&&(r.lineDiv.style.display="none"),function(e,t,r){var n=e.display,i=e.options.lineNumbers,o=n.lineDiv,l=o.firstChild;function s(t){var r=t.nextSibling;return a&&y&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var u=n.view,c=n.viewFrom,h=0;h<u.length;h++){var f=u[h];if(f.hidden);else if(f.node&&f.node.parentNode==o){for(;l!=f.node;)l=s(l);var d=i&&null!=t&&t<=c&&f.lineNumber;f.changes&&(B(f.changes,"gutter")>-1&&(d=!1),ur(e,f,c,r)),d&&(M(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(Qe(e.options,c)))),l=f.node.nextSibling}else{var p=vr(e,f,c,r);o.insertBefore(p,l)}c+=f.size}for(;l;)l=s(l)}(e,r.updateLineNumbers,t.dims),u>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,function(e){if(e&&e.activeElt&&e.activeElt!=W()&&(e.activeElt.focus(),e.anchorNode&&D(document.body,e.anchorNode)&&D(document.body,e.focusNode))){var t=window.getSelection(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}(c),M(r.cursorDiv),M(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,s&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,ni(e,400)),r.updateLineNumbers=null,!0}function si(e,t){for(var r=t.viewport,n=!0;;n=!1){if(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Tr(e))n&&(t.visible=Nn(e.display,e.doc,r));else if(r&&null!=r.top&&(r={top:Math.min(e.doc.height+Sr(e.display)-Mr(e),r.top)}),t.visible=Nn(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!li(e,t))break;Tn(e);var i=zn(e);vn(e),Gn(e,i),ci(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function ai(e,t){var r=new oi(e,t);if(li(e,r)){Tn(e),si(e,r);var n=zn(e);vn(e),Gn(e,n),ci(e,n),r.finish()}}function ui(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function ci(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+kr(e)+"px"}function hi(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=ln(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",l=0;l<r.length;l++)if(!r[l].hidden){e.options.fixedGutter&&(r[l].gutter&&(r[l].gutter.style.left=o),r[l].gutterBackground&&(r[l].gutterBackground.style.left=o));var s=r[l].alignable;if(s)for(var a=0;a<s.length;a++)s[a].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function fi(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=Qe(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(O("div",[O("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,l=i.offsetWidth-o;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-l)+1,n.lineNumWidth=n.lineNumInnerWidth+l,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",ui(e.display),!0}return!1}function di(e,t){for(var r=[],n=!1,i=0;i<e.length;i++){var o=e[i],l=null;if("string"!=typeof o&&(l=o.style,o=o.className),"CodeMirror-linenumbers"==o){if(!t)continue;n=!0}r.push({className:o,style:l})}return t&&!n&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function pi(e){var t=e.gutters,r=e.gutterSpecs;M(t),e.lineGutter=null;for(var n=0;n<r.length;++n){var i=r[n],o=i.className,l=i.style,s=t.appendChild(O("div",null,"CodeMirror-gutter "+o));l&&(s.style.cssText=l),"CodeMirror-linenumbers"==o&&(e.lineGutter=s,s.style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",ui(e)}function gi(e){pi(e.display),hn(e),hi(e)}function vi(e,t,n,i){var o=this;this.input=n,o.scrollbarFiller=O("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=O("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=A("div",null,"CodeMirror-code"),o.selectionDiv=O("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=O("div",null,"CodeMirror-cursors"),o.measure=O("div",null,"CodeMirror-measure"),o.lineMeasure=O("div",null,"CodeMirror-measure"),o.lineSpace=A("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var u=A("div",[o.lineSpace],"CodeMirror-lines");o.mover=O("div",[u],null,"position: relative"),o.sizer=O("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=O("div",null,null,"position: absolute; height: 30px; width: 1px;"),o.gutters=O("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=O("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=O("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),l&&s<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),a||r&&m||(o.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(o.wrapper):e(o.wrapper)),o.viewFrom=o.viewTo=t.first,o.reportedViewFrom=o.reportedViewTo=t.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,o.gutterSpecs=di(i.gutters,i.lineNumbers),pi(o),n.init(o)}oi.prototype.signal=function(e,t){me(e,t)&&this.events.push(arguments)},oi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)pe.apply(null,this.events[e])};var mi=0,yi=null;function bi(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}}function wi(e){var t=bi(e);return t.x*=yi,t.y*=yi,t}function xi(e,t){var n=bi(t),i=n.x,o=n.y,l=e.display,s=l.scroller,u=s.scrollWidth>s.clientWidth,c=s.scrollHeight>s.clientHeight;if(i&&u||o&&c){if(o&&y&&a)e:for(var f=t.target,d=l.view;f!=s;f=f.parentNode)for(var p=0;p<d.length;p++)if(d[p].node==f){e.display.currentWheelTarget=f;break e}if(i&&!r&&!h&&null!=yi)return o&&c&&Pn(e,Math.max(0,s.scrollTop+o*yi)),In(e,Math.max(0,s.scrollLeft+i*yi)),(!o||o&&c)&&be(t),void(l.wheelStartX=null);if(o&&null!=yi){var g=o*yi,v=e.doc.scrollTop,m=v+l.wrapper.clientHeight;g<0?v=Math.max(0,v+g-50):m=Math.min(e.doc.height,m+g+50),ai(e,{top:v,bottom:m})}mi<20&&(null==l.wheelStartX?(l.wheelStartX=s.scrollLeft,l.wheelStartY=s.scrollTop,l.wheelDX=i,l.wheelDY=o,setTimeout((function(){if(null!=l.wheelStartX){var e=s.scrollLeft-l.wheelStartX,t=s.scrollTop-l.wheelStartY,r=t&&l.wheelDY&&t/l.wheelDY||e&&l.wheelDX&&e/l.wheelDX;l.wheelStartX=l.wheelStartY=null,r&&(yi=(yi*mi+r)/(mi+1),++mi)}}),200)):(l.wheelDX+=i,l.wheelDY+=o))}}l?yi=-.53:r?yi=15:c?yi=-.7:f&&(yi=-1/3);var Ci=function(e,t){this.ranges=e,this.primIndex=t};Ci.prototype.primary=function(){return this.ranges[this.primIndex]},Ci.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var r=this.ranges[t],n=e.ranges[t];if(!rt(r.anchor,n.anchor)||!rt(r.head,n.head))return!1}return!0},Ci.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Si(nt(this.ranges[t].anchor),nt(this.ranges[t].head));return new Ci(e,this.primIndex)},Ci.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Ci.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(tt(t,n.from())>=0&&tt(e,n.to())<=0)return r}return-1};var Si=function(e,t){this.anchor=e,this.head=t};function Li(e,t,r){var n=e&&e.options.selectionsMayTouch,i=t[r];t.sort((function(e,t){return tt(e.from(),t.from())})),r=B(t,i);for(var o=1;o<t.length;o++){var l=t[o],s=t[o-1],a=tt(s.to(),l.from());if(n&&!l.empty()?a>0:a>=0){var u=ot(s.from(),l.from()),c=it(s.to(),l.to()),h=s.empty()?l.from()==l.head:s.from()==s.head;o<=r&&--r,t.splice(--o,2,new Si(h?c:u,h?u:c))}}return new Ci(t,r)}function ki(e,t){return new Ci([new Si(e,t||e)],0)}function Ti(e){return e.text?et(e.from.line+e.text.length-1,_(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Mi(e,t){if(tt(e,t.from)<0)return e;if(tt(e,t.to)<=0)return Ti(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=Ti(t).ch-t.to.ch),et(r,n)}function Ni(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new Si(Mi(i.anchor,t),Mi(i.head,t)))}return Li(e.cm,r,e.sel.primIndex)}function Oi(e,t,r){return e.line==t.line?et(r.line,e.ch-t.ch+r.ch):et(r.line+(e.line-t.line),e.ch)}function Ai(e){e.doc.mode=Re(e.options,e.doc.modeOption),Di(e)}function Di(e){e.doc.iter((function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)})),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,ni(e,100),e.state.modeGen++,e.curOp&&hn(e)}function Wi(e,t){return 0==t.from.ch&&0==t.to.ch&&""==_(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Hi(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){!function(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Nt(e),Ot(e,r);var i=n?n(e):1;i!=e.height&&$e(e,i)}(e,r,i,n),sr(e,"change",e,t)}function l(e,t){for(var r=[],o=e;o<t;++o)r.push(new jt(u[o],i(o),n));return r}var s=t.from,a=t.to,u=t.text,c=je(e,s.line),h=je(e,a.line),f=_(u),d=i(u.length-1),p=a.line-s.line;if(t.full)e.insert(0,l(0,u.length)),e.remove(u.length,e.size-u.length);else if(Wi(e,t)){var g=l(0,u.length-1);o(h,h.text,d),p&&e.remove(s.line,p),g.length&&e.insert(s.line,g)}else if(c==h)if(1==u.length)o(c,c.text.slice(0,s.ch)+f+c.text.slice(a.ch),d);else{var v=l(1,u.length-1);v.push(new jt(f+c.text.slice(a.ch),d,n)),o(c,c.text.slice(0,s.ch)+u[0],i(0)),e.insert(s.line+1,v)}else if(1==u.length)o(c,c.text.slice(0,s.ch)+u[0]+h.text.slice(a.ch),i(0)),e.remove(s.line+1,p);else{o(c,c.text.slice(0,s.ch)+u[0],i(0)),o(h,f+h.text.slice(a.ch),d);var m=l(1,u.length-1);p>1&&e.remove(s.line+1,p-1),e.insert(s.line+1,m)}sr(e,"change",e,t)}function Fi(e,t,r){!function e(n,i,o){if(n.linked)for(var l=0;l<n.linked.length;++l){var s=n.linked[l];if(s.doc!=i){var a=o&&s.sharedHist;r&&!a||(t(s.doc,a),e(s.doc,n,a))}}}(e,null,!0)}function Pi(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,an(e),Ai(e),Ei(e),e.options.lineWrapping||Xt(e),e.options.mode=t.modeOption,hn(e)}function Ei(e){("rtl"==e.doc.direction?H:T)(e.display.lineDiv,"CodeMirror-rtl")}function Ii(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function zi(e,t){var r={from:nt(t.from),to:Ti(t),text:Ye(e,t.from,t.to)};return Vi(e,r,t.from.line,t.to.line+1),Fi(e,(function(e){return Vi(e,r,t.from.line,t.to.line+1)}),!0),r}function Ri(e){for(;e.length&&_(e).ranges;)e.pop()}function Bi(e,t,r,n){var i=e.history;i.undone.length=0;var o,l,s=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>s-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=function(e,t){return t?(Ri(e.done),_(e.done)):e.done.length&&!_(e.done).ranges?_(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),_(e.done)):void 0}(i,i.lastOp==n)))l=_(o.changes),0==tt(t.from,t.to)&&0==tt(t.from,l.to)?l.to=Ti(t):o.changes.push(zi(e,t));else{var a=_(i.done);for(a&&a.ranges||Ui(e.sel,i.done),o={changes:[zi(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=s,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,l||pe(e,"historyAdded")}function Gi(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||function(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,o,_(i.done),t))?i.done[i.done.length-1]=t:Ui(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&!1!==n.clearRedo&&Ri(i.undone)}function Ui(e,t){var r=_(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Vi(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),(function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o}))}function Ki(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function Xi(e,t){var r=function(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=[],i=0;i<t.text.length;++i)n.push(Ki(r[i]));return n}(e,t),n=Tt(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],l=n[i];if(o&&l)e:for(var s=0;s<l.length;++s){for(var a=l[s],u=0;u<o.length;++u)if(o[u].marker==a.marker)continue e;o.push(a)}else l&&(r[i]=l)}return r}function ji(e,t,r){for(var n=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)n.push(r?Ci.prototype.deepCopy.call(o):o);else{var l=o.changes,s=[];n.push({changes:s});for(var a=0;a<l.length;++a){var u=l[a],c=void 0;if(s.push({from:u.from,to:u.to,text:u.text}),t)for(var h in u)(c=h.match(/^spans_(\d+)$/))&&B(t,Number(c[1]))>-1&&(_(s)[h]=u[h],delete u[h])}}}return n}function Yi(e,t,r,n){if(n){var i=e.anchor;if(r){var o=tt(t,i)<0;o!=tt(r,i)<0?(i=t,t=r):o!=tt(t,r)<0&&(t=r)}return new Si(i,t)}return new Si(r||t,t)}function _i(e,t,r,n,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Qi(e,new Ci([Yi(e.sel.primary(),t,r,i)],0),n)}function $i(e,t,r){for(var n=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)n[o]=Yi(e.sel.ranges[o],t[o],null,i);Qi(e,Li(e.cm,n,e.sel.primIndex),r)}function qi(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,Qi(e,Li(e.cm,i,e.sel.primIndex),n)}function Zi(e,t,r,n){Qi(e,ki(t,r),n)}function Ji(e,t,r){var n=e.history.done,i=_(n);i&&i.ranges?(n[n.length-1]=t,eo(e,t,r)):Qi(e,t,r)}function Qi(e,t,r){eo(e,t,r),Gi(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function eo(e,t,r){(me(e,"beforeSelectionChange")||e.cm&&me(e.cm,"beforeSelectionChange"))&&(t=function(e,t,r){var n={ranges:t.ranges,update:function(t){this.ranges=[];for(var r=0;r<t.length;r++)this.ranges[r]=new Si(st(e,t[r].anchor),st(e,t[r].head))},origin:r&&r.origin};return pe(e,"beforeSelectionChange",e,n),e.cm&&pe(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?Li(e.cm,n.ranges,n.ranges.length-1):t}(e,t,r));var n=r&&r.bias||(tt(t.primary().head,e.sel.primary().head)<0?-1:1);to(e,no(e,t,n,!0)),r&&!1===r.scroll||!e.cm||Dn(e.cm)}function to(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ve(e.cm)),sr(e,"cursorActivity",e))}function ro(e){to(e,no(e,e.sel,null,!1))}function no(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var l=t.ranges[o],s=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],a=oo(e,l.anchor,s&&s.anchor,r,n),u=oo(e,l.head,s&&s.head,r,n);(i||a!=l.anchor||u!=l.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new Si(a,u))}return i?Li(e.cm,i,t.primIndex):t}function io(e,t,r,n,i){var o=je(e,t.line);if(o.markedSpans)for(var l=0;l<o.markedSpans.length;++l){var s=o.markedSpans[l],a=s.marker,u="selectLeft"in a?!a.selectLeft:a.inclusiveLeft,c="selectRight"in a?!a.selectRight:a.inclusiveRight;if((null==s.from||(u?s.from<=t.ch:s.from<t.ch))&&(null==s.to||(c?s.to>=t.ch:s.to>t.ch))){if(i&&(pe(a,"beforeCursorEnter"),a.explicitlyCleared)){if(o.markedSpans){--l;continue}break}if(!a.atomic)continue;if(r){var h=a.find(n<0?1:-1),f=void 0;if((n<0?c:u)&&(h=lo(e,h,-n,h&&h.line==t.line?o:null)),h&&h.line==t.line&&(f=tt(h,r))&&(n<0?f<0:f>0))return io(e,h,t,n,i)}var d=a.find(n<0?-1:1);return(n<0?u:c)&&(d=lo(e,d,n,d.line==t.line?o:null)),d?io(e,d,t,n,i):null}}return t}function oo(e,t,r,n,i){var o=n||1,l=io(e,t,r,o,i)||!i&&io(e,t,r,o,!0)||io(e,t,r,-o,i)||!i&&io(e,t,r,-o,!0);return l||(e.cantEdit=!0,et(e.first,0))}function lo(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?st(e,et(t.line-1)):null:r>0&&t.ch==(n||je(e,t.line)).text.length?t.line<e.first+e.size-1?et(t.line+1,0):null:new et(t.line,t.ch+r)}function so(e){e.setSelection(et(e.firstLine(),0),et(e.lastLine()),U)}function ao(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return n.canceled=!0}};return r&&(n.update=function(t,r,i,o){t&&(n.from=st(e,t)),r&&(n.to=st(e,r)),i&&(n.text=i),void 0!==o&&(n.origin=o)}),pe(e,"beforeChange",e,n),e.cm&&pe(e.cm,"beforeChange",e.cm,n),n.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:n.from,to:n.to,text:n.text,origin:n.origin}}function uo(e,t,r){if(e.cm){if(!e.cm.curOp)return ei(e.cm,uo)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(me(e,"beforeChange")||e.cm&&me(e.cm,"beforeChange"))||(t=ao(e,t,!0))){var n=xt&&!r&&function(e,t,r){var n=null;if(e.iter(t.line,r.line+1,(function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&-1!=B(n,r)||(n||(n=[])).push(r)}})),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var l=n[o],s=l.find(0),a=0;a<i.length;++a){var u=i[a];if(!(tt(u.to,s.from)<0||tt(u.from,s.to)>0)){var c=[a,1],h=tt(u.from,s.from),f=tt(u.to,s.to);(h<0||!l.inclusiveLeft&&!h)&&c.push({from:u.from,to:s.from}),(f>0||!l.inclusiveRight&&!f)&&c.push({from:s.to,to:u.to}),i.splice.apply(i,c),a+=c.length-3}}return i}(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)co(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else co(e,t)}}function co(e,t){if(1!=t.text.length||""!=t.text[0]||0!=tt(t.from,t.to)){var r=Ni(e,t);Bi(e,t,r,e.cm?e.cm.curOp.id:NaN),po(e,t,r,Tt(e,t));var n=[];Fi(e,(function(e,r){r||-1!=B(n,e.history)||(yo(e.history,t),n.push(e.history)),po(e,t,null,Tt(e,t))}))}}function ho(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(!n||r){for(var i,o=e.history,l=e.sel,s="undo"==t?o.done:o.undone,a="undo"==t?o.undone:o.done,u=0;u<s.length&&(i=s[u],r?!i.ranges||i.equals(e.sel):i.ranges);u++);if(u!=s.length){for(o.lastOrigin=o.lastSelOrigin=null;;){if(!(i=s.pop()).ranges){if(n)return void s.push(i);break}if(Ui(i,a),r&&!i.equals(e.sel))return void Qi(e,i,{clearRedo:!1});l=i}var c=[];Ui(l,a),a.push({changes:c,generation:o.generation}),o.generation=i.generation||++o.maxGeneration;for(var h=me(e,"beforeChange")||e.cm&&me(e.cm,"beforeChange"),f=function(r){var n=i.changes[r];if(n.origin=t,h&&!ao(e,n,!1))return s.length=0,{};c.push(zi(e,n));var o=r?Ni(e,n):_(s);po(e,n,o,Xi(e,n)),!r&&e.cm&&e.cm.scrollIntoView({from:n.from,to:Ti(n)});var l=[];Fi(e,(function(e,t){t||-1!=B(l,e.history)||(yo(e.history,n),l.push(e.history)),po(e,n,null,Xi(e,n))}))},d=i.changes.length-1;d>=0;--d){var p=f(d);if(p)return p.v}}}}function fo(e,t){if(0!=t&&(e.first+=t,e.sel=new Ci($(e.sel.ranges,(function(e){return new Si(et(e.anchor.line+t,e.anchor.ch),et(e.head.line+t,e.head.ch))})),e.sel.primIndex),e.cm)){hn(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)fn(e.cm,n,"gutter")}}function po(e,t,r,n){if(e.cm&&!e.cm.curOp)return ei(e.cm,po)(e,t,r,n);if(t.to.line<e.first)fo(e,t.text.length-1-(t.to.line-t.from.line));else if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);fo(e,i),t={from:et(e.first,0),to:et(t.to.line+i,t.to.ch),text:[_(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:et(o,je(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ye(e,t.from,t.to),r||(r=Ni(e,t)),e.cm?function(e,t,r){var n=e.doc,i=e.display,o=t.from,l=t.to,s=!1,a=o.line;e.options.lineWrapping||(a=qe(zt(je(n,o.line))),n.iter(a,l.line+1,(function(e){if(e==i.maxLine)return s=!0,!0}))),n.sel.contains(t.from,t.to)>-1&&ve(e),Hi(n,t,r,sn(e)),e.options.lineWrapping||(n.iter(a,o.line+t.text.length,(function(e){var t=Kt(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)})),s&&(e.curOp.updateMaxLine=!0)),function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var r=e.first,n=t-1;n>r;n--){var i=je(e,n).stateAfter;if(i&&(!(i instanceof ut)||n+i.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}}(n,o.line),ni(e,400);var u=t.text.length-(l.line-o.line)-1;t.full?hn(e):o.line!=l.line||1!=t.text.length||Wi(e.doc,t)?hn(e,o.line,l.line+1,u):fn(e,o.line,"text");var c=me(e,"changes"),h=me(e,"change");if(h||c){var f={from:o,to:l,text:t.text,removed:t.removed,origin:t.origin};h&&sr(e,"change",e,f),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(f)}e.display.selForContextMenu=null}(e.cm,t,n):Hi(e,t,n),eo(e,r,U),e.cantEdit&&oo(e,et(e.firstLine(),0))&&(e.cantEdit=!1)}}function go(e,t,r,n,i){var o;n||(n=r),tt(n,r)<0&&(r=(o=[n,r])[0],n=o[1]),"string"==typeof t&&(t=e.splitLines(t)),uo(e,{from:r,to:n,text:t,origin:i})}function vo(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function mo(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],l=!0;if(o.ranges){o.copied||((o=e[i]=o.deepCopy()).copied=!0);for(var s=0;s<o.ranges.length;s++)vo(o.ranges[s].anchor,t,r,n),vo(o.ranges[s].head,t,r,n)}else{for(var a=0;a<o.changes.length;++a){var u=o.changes[a];if(r<u.from.line)u.from=et(u.from.line+n,u.from.ch),u.to=et(u.to.line+n,u.to.ch);else if(t<=u.to.line){l=!1;break}}l||(e.splice(0,i+1),i=0)}}}function yo(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;mo(e.done,r,n,i),mo(e.undone,r,n,i)}function bo(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=je(e,lt(e,t)):i=qe(t),null==i?null:(n(o,i)&&e.cm&&fn(e.cm,i,r),o)}function wo(e){this.lines=e,this.parent=null;for(var t=0,r=0;r<e.length;++r)e[r].parent=this,t+=e[r].height;this.height=t}function xo(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var i=e[n];t+=i.chunkSize(),r+=i.height,i.parent=this}this.size=t,this.height=r,this.parent=null}Si.prototype.from=function(){return ot(this.anchor,this.head)},Si.prototype.to=function(){return it(this.anchor,this.head)},Si.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},wo.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;r<n;++r){var i=this.lines[r];this.height-=i.height,Yt(i),sr(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;e<n;++e)if(r(this.lines[e]))return!0}},xo.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],i=n.chunkSize();if(e<i){var o=Math.min(t,i-e),l=n.height;if(n.removeInner(e,o),this.height-=l-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof wo))){var s=[];this.collapse(s),this.children=[new wo(s)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<=o){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(var l=i.lines.length%25+25,s=l;s<i.lines.length;){var a=new wo(i.lines.slice(s,s+=25));i.height-=a.height,this.children.splice(++n,0,a),a.parent=this}i.lines=i.lines.slice(0,l),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=new xo(e.children.splice(e.children.length-5,5));if(e.parent){e.size-=t.size,e.height-=t.height;var r=B(e.parent.children,e);e.parent.children.splice(r+1,0,t)}else{var n=new xo(e.children);n.parent=e,e.children=[n,t],e=n}t.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<o){var l=Math.min(t,o-e);if(i.iterN(e,l,r))return!0;if(0==(t-=l))break;e=0}else e-=o}}};var Co=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};function So(e,t,r){Vt(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&An(e,r)}Co.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=qe(r);if(null!=n&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(r.widgets=null);var o=wr(this);$e(r,Math.max(0,r.height-o)),e&&(Qn(e,(function(){So(e,r,-o),fn(e,n,"widget")})),sr(e,"lineWidgetCleared",e,this,n))}},Co.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var i=wr(this)-t;i&&(Gt(this.doc,n)||$e(n,n.height+i),r&&Qn(r,(function(){r.curOp.forceUpdate=!0,So(r,n,i),sr(r,"lineWidgetChanged",r,e,qe(n))})))},ye(Co);var Lo=0,ko=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++Lo};function To(e,t,r,n,i){if(n&&n.shared)return function(e,t,r,n,i){(n=I(n)).shared=!1;var o=[To(e,t,r,n,i)],l=o[0],s=n.widgetNode;return Fi(e,(function(e){s&&(n.widgetNode=s.cloneNode(!0)),o.push(To(e,st(e,t),st(e,r),n,i));for(var a=0;a<e.linked.length;++a)if(e.linked[a].isParent)return;l=_(o)})),new Mo(o,l)}(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return ei(e.cm,To)(e,t,r,n,i);var o=new ko(e,i),l=tt(t,r);if(n&&I(n,o,!1),l>0||0==l&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=A("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(It(e,t.line,t,r,o)||t.line!=r.line&&It(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ct=!0}o.addToHistory&&Bi(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var s,a=t.line,u=e.cm;if(e.iter(a,r.line+1,(function(e){u&&o.collapsed&&!u.options.lineWrapping&&zt(e)==u.display.maxLine&&(s=!0),o.collapsed&&a!=t.line&&$e(e,0),function(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}(e,new St(o,a==t.line?t.ch:null,a==r.line?r.ch:null)),++a})),o.collapsed&&e.iter(t.line,r.line+1,(function(t){Gt(e,t)&&$e(t,0)})),o.clearOnEnter&&he(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(xt=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++Lo,o.atomic=!0),u){if(s&&(u.curOp.updateMaxLine=!0),o.collapsed)hn(u,t.line,r.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var c=t.line;c<=r.line;c++)fn(u,c,"text");o.atomic&&ro(u.doc),sr(u,"markerAdded",u,o)}return o}ko.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&jn(e),me(this,"clear")){var r=this.find();r&&sr(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;o<this.lines.length;++o){var l=this.lines[o],s=Lt(l.markedSpans,this);e&&!this.collapsed?fn(e,qe(l),"text"):e&&(null!=s.to&&(i=qe(l)),null!=s.from&&(n=qe(l))),l.markedSpans=kt(l.markedSpans,s),null==s.from&&this.collapsed&&!Gt(this.doc,l)&&e&&$e(l,rn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var a=0;a<this.lines.length;++a){var u=zt(this.lines[a]),c=Kt(u);c>e.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&hn(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&ro(e.doc)),e&&sr(e,"markerCleared",e,this,n,i),t&&Yn(e),this.parent&&this.parent.clear()}},ko.prototype.find=function(e,t){var r,n;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i<this.lines.length;++i){var o=this.lines[i],l=Lt(o.markedSpans,this);if(null!=l.from&&(r=et(t?o:qe(o),l.from),-1==e))return r;if(null!=l.to&&(n=et(t?o:qe(o),l.to),1==e))return n}return r&&{from:r,to:n}},ko.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,n=this.doc.cm;t&&n&&Qn(n,(function(){var i=t.line,o=qe(t.line),l=Ar(n,o);if(l&&(Ir(l),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!Gt(r.doc,i)&&null!=r.height){var s=r.height;r.height=null;var a=wr(r)-s;a&&$e(i,i.height+a)}sr(n,"markerChanged",n,e)}))},ko.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=B(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},ko.prototype.detachLine=function(e){if(this.lines.splice(B(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ye(ko);var Mo=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};function No(e){return e.findMarks(et(e.first,0),e.clipPos(et(e.lastLine())),(function(e){return e.parent}))}function Oo(e){for(var t=function(t){var r=e[t],n=[r.primary.doc];Fi(r.primary.doc,(function(e){return n.push(e)}));for(var i=0;i<r.markers.length;i++){var o=r.markers[i];-1==B(n,o.doc)&&(o.parent=null,r.markers.splice(i--,1))}},r=0;r<e.length;r++)t(r)}Mo.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();sr(this,"clear")}},Mo.prototype.find=function(e,t){return this.primary.find(e,t)},ye(Mo);var Ao=0,Do=function e(t,r,n,i,o){if(!(this instanceof e))return new e(t,r,n,i,o);null==n&&(n=0),xo.call(this,[new wo([new jt("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var l=et(n,0);this.sel=ki(l),this.history=new Ii(null),this.id=++Ao,this.modeOption=r,this.lineSep=i,this.direction="rtl"==o?"rtl":"ltr",this.extend=!1,"string"==typeof t&&(t=this.splitLines(t)),Hi(this,{from:l,to:l,text:t}),Qi(this,ki(l),U)};(Do.prototype=Z(xo.prototype,{constructor:Do,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=_e(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:ri((function(e){var t=et(this.first,0),r=this.first+this.size-1;uo(this,{from:t,to:et(r,je(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Wn(this.cm,0,0),Qi(this,ki(t),U)})),replaceRange:function(e,t,r,n){go(this,e,t=st(this,t),r=r?st(this,r):t,n)},getRange:function(e,t,r){var n=Ye(this,st(this,e),st(this,t));return!1===r?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Je(this,e))return je(this,e)},getLineNumber:function(e){return qe(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=je(this,e)),zt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return st(this,e)},getCursor:function(e){var t=this.sel.primary();return null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:ri((function(e,t,r){Zi(this,st(this,"number"==typeof e?et(e,t||0):e),null,r)})),setSelection:ri((function(e,t,r){Zi(this,st(this,e),st(this,t||e),r)})),extendSelection:ri((function(e,t,r){_i(this,st(this,e),t&&st(this,t),r)})),extendSelections:ri((function(e,t){$i(this,at(this,e),t)})),extendSelectionsBy:ri((function(e,t){$i(this,at(this,$(this.sel.ranges,e)),t)})),setSelections:ri((function(e,t,r){if(e.length){for(var n=[],i=0;i<e.length;i++)n[i]=new Si(st(this,e[i].anchor),st(this,e[i].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Qi(this,Li(this.cm,n,t),r)}})),addSelection:ri((function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new Si(st(this,e),st(this,t||e))),Qi(this,Li(this.cm,n,n.length-1),r)})),getSelection:function(e){for(var t,r=this.sel.ranges,n=0;n<r.length;n++){var i=Ye(this,r[n].from(),r[n].to());t=t?t.concat(i):i}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i=Ye(this,r[n].from(),r[n].to());!1!==e&&(i=i.join(e||this.lineSeparator())),t[n]=i}return t},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:ri((function(e,t,r){for(var n=[],i=this.sel,o=0;o<i.ranges.length;o++){var l=i.ranges[o];n[o]={from:l.from(),to:l.to(),text:this.splitLines(e[o]),origin:r}}for(var s=t&&"end"!=t&&function(e,t,r){for(var n=[],i=et(e.first,0),o=i,l=0;l<t.length;l++){var s=t[l],a=Oi(s.from,i,o),u=Oi(Ti(s),i,o);if(i=s.to,o=u,"around"==r){var c=e.sel.ranges[l],h=tt(c.head,c.anchor)<0;n[l]=new Si(h?u:a,h?a:u)}else n[l]=new Si(a,a)}return new Ci(n,e.sel.primIndex)}(this,n,t),a=n.length-1;a>=0;a--)uo(this,n[a]);s?Ji(this,s):this.cm&&Dn(this.cm)})),undo:ri((function(){ho(this,"undo")})),redo:ri((function(){ho(this,"redo")})),undoSelection:ri((function(){ho(this,"undo",!0)})),redoSelection:ri((function(){ho(this,"redo",!0)})),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){var e=this;this.history=new Ii(this.history.maxGeneration),Fi(this,(function(t){return t.history=e.history}),!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:ji(this.history.done),undone:ji(this.history.undone)}},setHistory:function(e){var t=this.history=new Ii(this.history.maxGeneration);t.done=ji(e.done.slice(0),null,!0),t.undone=ji(e.undone.slice(0),null,!0)},setGutterMarker:ri((function(e,t,r){return bo(this,e,"gutter",(function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&te(n)&&(e.gutterMarkers=null),!0}))})),clearGutter:ri((function(e){var t=this;this.iter((function(r){r.gutterMarkers&&r.gutterMarkers[e]&&bo(t,r,"gutter",(function(){return r.gutterMarkers[e]=null,te(r.gutterMarkers)&&(r.gutterMarkers=null),!0}))}))})),lineInfo:function(e){var t;if("number"==typeof e){if(!Je(this,e))return null;if(t=e,!(e=je(this,e)))return null}else if(null==(t=qe(e)))return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:ri((function(e,t,r){return bo(this,e,"gutter"==t?"gutter":"class",(function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[n]){if(L(r).test(e[n]))return!1;e[n]+=" "+r}else e[n]=r;return!0}))})),removeLineClass:ri((function(e,t,r){return bo(this,e,"gutter"==t?"gutter":"class",(function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",i=e[n];if(!i)return!1;if(null==r)e[n]=null;else{var o=i.match(L(r));if(!o)return!1;var l=o.index+o[0].length;e[n]=i.slice(0,o.index)+(o.index&&l!=i.length?" ":"")+i.slice(l)||null}return!0}))})),addLineWidget:ri((function(e,t,r){return function(e,t,r,n){var i=new Co(e,r,n),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),bo(e,t,"widget",(function(t){var r=t.widgets||(t.widgets=[]);if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!Gt(e,t)){var n=Vt(t)<e.scrollTop;$e(t,t.height+wr(i)),n&&An(o,i.height),o.curOp.forceUpdate=!0}return!0})),o&&sr(o,"lineWidgetAdded",o,i,"number"==typeof t?t:qe(t)),i}(this,e,t,r)})),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return To(this,st(this,e),st(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return To(this,e=st(this,e),e,r,"bookmark")},findMarksAt:function(e){var t=[],r=je(this,(e=st(this,e)).line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=st(this,e),t=st(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,(function(o){var l=o.markedSpans;if(l)for(var s=0;s<l.length;s++){var a=l[s];null!=a.to&&i==e.line&&e.ch>=a.to||null==a.from&&i!=e.line||null!=a.from&&i==t.line&&a.from>=t.ch||r&&!r(a.marker)||n.push(a.marker.parent||a.marker)}++i})),n},getAllMarks:function(){var e=[];return this.iter((function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)})),e},posFromIndex:function(e){var t,r=this.first,n=this.lineSeparator().length;return this.iter((function(i){var o=i.text.length+n;if(o>e)return t=e,!0;e-=o,++r})),st(this,et(r,t))},indexFromPos:function(e){var t=(e=st(this,e)).ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,(function(e){t+=e.text.length+r})),t},copy:function(e){var t=new Do(_e(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);var n=new Do(_e(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),l=e.clipPos(i.to);if(tt(o,l)){var s=To(e,o,l,n.primary,n.primary.type);n.markers.push(s),s.parent=n}}}(n,No(this)),n},unlinkDoc:function(e){if(e instanceof Ml&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t)if(this.linked[t].doc==e){this.linked.splice(t,1),e.unlinkDoc(this),Oo(No(this));break}if(e.history==this.history){var r=[e.id];Fi(e,(function(e){return r.push(e.id)}),!0),e.history=new Ii(null),e.history.done=ji(this.history.done,r),e.history.undone=ji(this.history.undone,r)}},iterLinkedDocs:function(e){Fi(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):De(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:ri((function(e){var t;"rtl"!=e&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter((function(e){return e.order=null})),this.cm&&Qn(t=this.cm,(function(){Ei(t),hn(t)})))}))})).eachLine=Do.prototype.iter;var Wo=0;function Ho(e){var t=this;if(Fo(t),!ge(t,e)&&!xr(t.display,e)){be(e),l&&(Wo=+new Date);var r=un(t,e,!0),n=e.dataTransfer.files;if(r&&!t.isReadOnly())if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),s=0,a=function(){++s==i&&ei(t,(function(){var e={from:r=st(t.doc,r),to:r,text:t.doc.splitLines(o.filter((function(e){return null!=e})).join(t.doc.lineSeparator())),origin:"paste"};uo(t.doc,e),Ji(t.doc,ki(st(t.doc,r),st(t.doc,Ti(e))))}))()},u=function(e,r){if(t.options.allowDropFileTypes&&-1==B(t.options.allowDropFileTypes,e.type))a();else{var n=new FileReader;n.onerror=function(){return a()},n.onload=function(){var e=n.result;/[\x00-\x08\x0e-\x1f]{2}/.test(e)||(o[r]=e),a()},n.readAsText(e)}},c=0;c<n.length;c++)u(n[c],c);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout((function(){return t.display.input.focus()}),20);try{var h=e.dataTransfer.getData("Text");if(h){var f;if(t.state.draggingText&&!t.state.draggingText.copy&&(f=t.listSelections()),eo(t.doc,ki(r,r)),f)for(var d=0;d<f.length;++d)go(t.doc,"",f[d].anchor,f[d].head,"drag");t.replaceSelection(h,"around","paste"),t.display.input.focus()}}catch(e){}}}}function Fo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Po(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),r=[],n=0;n<t.length;n++){var i=t[n].CodeMirror;i&&r.push(i)}r.length&&r[0].operation((function(){for(var t=0;t<r.length;t++)e(r[t])}))}}var Eo=!1;function Io(){var e;Eo||(he(window,"resize",(function(){null==e&&(e=setTimeout((function(){e=null,Po(zo)}),100))})),he(window,"blur",(function(){return Po(kn)})),Eo=!0)}function zo(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Ro={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Bo=0;Bo<10;Bo++)Ro[Bo+48]=Ro[Bo+96]=String(Bo);for(var Go=65;Go<=90;Go++)Ro[Go]=String.fromCharCode(Go);for(var Uo=1;Uo<=12;Uo++)Ro[Uo+111]=Ro[Uo+63235]="F"+Uo;var Vo={};function Ko(e){var t,r,n,i,o=e.split(/-(?!$)/);e=o[o.length-1];for(var l=0;l<o.length-1;l++){var s=o[l];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))r=!0;else{if(!/^s(hift)?$/i.test(s))throw new Error("Unrecognized modifier name: "+s);n=!0}}return t&&(e="Alt-"+e),r&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Xo(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==n){delete e[r];continue}for(var i=$(r.split(" "),Ko),o=0;o<i.length;o++){var l=void 0,s=void 0;o==i.length-1?(s=i.join(" "),l=n):(s=i.slice(0,o+1).join(" "),l="...");var a=t[s];if(a){if(a!=l)throw new Error("Inconsistent bindings for "+s)}else t[s]=l}delete e[r]}for(var u in t)e[u]=t[u];return e}function jo(e,t,r,n){var i=(t=qo(t)).call?t.call(e,n):t[e];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&r(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return jo(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var l=jo(e,t.fallthrough[o],r,n);if(l)return l}}}function Yo(e){var t="string"==typeof e?e:Ro[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function _o(e,t,r){var n=e;return t.altKey&&"Alt"!=n&&(e="Alt-"+e),(C?t.metaKey:t.ctrlKey)&&"Ctrl"!=n&&(e="Ctrl-"+e),(C?t.ctrlKey:t.metaKey)&&"Cmd"!=n&&(e="Cmd-"+e),!r&&t.shiftKey&&"Shift"!=n&&(e="Shift-"+e),e}function $o(e,t){if(h&&34==e.keyCode&&e.char)return!1;var r=Ro[e.keyCode];return null!=r&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(r=e.code),_o(r,e,t))}function qo(e){return"string"==typeof e?Vo[e]:e}function Zo(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=t(r[i]);n.length&&tt(o.from,_(n).to)<=0;){var l=n.pop();if(tt(l.from,o.from)<0){o.from=l.from;break}}n.push(o)}Qn(e,(function(){for(var t=n.length-1;t>=0;t--)go(e.doc,"",n[t].from,n[t].to,"+delete");Dn(e)}))}function Jo(e,t,r){var n=ie(e.text,t+r,r);return n<0||n>e.text.length?null:n}function Qo(e,t,r){var n=Jo(e,t.ch,r);return null==n?null:new et(t.line,n,r<0?"after":"before")}function el(e,t,r,n,i){if(e){"rtl"==t.doc.direction&&(i=-i);var o=ue(r,t.doc.direction);if(o){var l,s=i<0?_(o):o[0],a=i<0==(1==s.level)?"after":"before";if(s.level>0||"rtl"==t.doc.direction){var u=Dr(t,r);l=i<0?r.text.length-1:0;var c=Wr(t,u,l).top;l=oe((function(e){return Wr(t,u,e).top==c}),i<0==(1==s.level)?s.from:s.to-1,l),"before"==a&&(l=Jo(r,l,1))}else l=i<0?s.to:s.from;return new et(n,l,a)}}return new et(n,i<0?r.text.length:0,i<0?"before":"after")}Vo.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Vo.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Vo.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Vo.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Vo.default=y?Vo.macDefault:Vo.pcDefault;var tl={selectAll:so,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),U)},killLine:function(e){return Zo(e,(function(t){if(t.empty()){var r=je(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:et(t.head.line+1,0)}:{from:t.head,to:et(t.head.line,r)}}return{from:t.from(),to:t.to()}}))},deleteLine:function(e){return Zo(e,(function(t){return{from:et(t.from().line,0),to:st(e.doc,et(t.to().line+1,0))}}))},delLineLeft:function(e){return Zo(e,(function(e){return{from:et(e.from().line,0),to:e.from()}}))},delWrappedLineLeft:function(e){return Zo(e,(function(t){var r=e.charCoords(t.head,"div").top+5;return{from:e.coordsChar({left:0,top:r},"div"),to:t.from()}}))},delWrappedLineRight:function(e){return Zo(e,(function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:n}}))},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(et(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(et(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy((function(t){return rl(e,t.head.line)}),{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy((function(t){return nl(e,t.head)}),{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy((function(t){return function(e,t){var r=je(e.doc,t),n=function(e){for(var t;t=Pt(e);)e=t.find(1,!0).line;return e}(r);return n!=r&&(t=qe(n)),el(!0,e,r,t,-1)}(e,t.head.line)}),{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy((function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")}),K)},goLineLeft:function(e){return e.extendSelectionsBy((function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")}),K)},goLineLeftSmart:function(e){return e.extendSelectionsBy((function(t){var r=e.cursorCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return n.ch<e.getLine(n.line).search(/\S/)?nl(e,t.head):n}),K)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"char")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var o=r[i].from(),l=z(e.getLine(o.line),o.ch,n);t.push(Y(n-l%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Qn(e,(function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++)if(t[n].empty()){var i=t[n].head,o=je(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new et(i.line,i.ch-1)),i.ch>0)i=new et(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),et(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var l=je(e.doc,i.line-1).text;l&&(i=new et(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+l.charAt(l.length-1),et(i.line-1,l.length-1),i,"+transpose"))}r.push(new Si(i,i))}e.setSelections(r)}))},newlineAndIndent:function(e){return Qn(e,(function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;n<t.length;n++)e.indentLine(t[n].from().line,null,!0);Dn(e)}))},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function rl(e,t){var r=je(e.doc,t),n=zt(r);return n!=r&&(t=qe(n)),el(!0,e,n,t,1)}function nl(e,t){var r=rl(e,t.line),n=je(e.doc,r.line),i=ue(n,e.doc.direction);if(!i||0==i[0].level){var o=Math.max(r.ch,n.text.search(/\S/)),l=t.line==r.line&&t.ch<=o&&t.ch;return et(r.line,l?0:o,r.sticky)}return r}function il(e,t,r){if("string"==typeof t&&!(t=tl[t]))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=G}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}var ol=new R;function ll(e,t,r,n){var i=e.state.keySeq;if(i){if(Yo(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:ol.set(50,(function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())})),sl(e,i+" "+t,r,n))return!0}return sl(e,t,r,n)}function sl(e,t,r,n){var i=function(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=jo(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&jo(t,e.options.extraKeys,r,e)||jo(t,e.options.keyMap,r,e)}(e,t,n);return"multi"==i&&(e.state.keySeq=t),"handled"==i&&sr(e,"keyHandled",e,t,r),"handled"!=i&&"multi"!=i||(be(r),xn(e)),!!i}function al(e,t){var r=$o(t,!0);return!!r&&(t.shiftKey&&!e.state.keySeq?ll(e,"Shift-"+r,t,(function(t){return il(e,t,!0)}))||ll(e,r,t,(function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return il(e,t)})):ll(e,r,t,(function(t){return il(e,t)})))}var ul=null;function cl(e){var t=this;if(t.curOp.focus=W(),!ge(t,e)){l&&s<11&&27==e.keyCode&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=16==n||e.shiftKey;var i=al(t,e);h&&(ul=i?n:null,i||88!=n||He||!(y?e.metaKey:e.ctrlKey)||t.replaceSelection("",null,"cut")),r&&!y&&!i&&46==n&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=n||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||function(e){var t=e.display.lineDiv;function r(e){18!=e.keyCode&&e.altKey||(T(t,"CodeMirror-crosshair"),de(document,"keyup",r),de(document,"mouseover",r))}H(t,"CodeMirror-crosshair"),he(document,"keyup",r),he(document,"mouseover",r)}(t)}}function hl(e){16==e.keyCode&&(this.doc.sel.shift=!1),ge(this,e)}function fl(e){var t=this;if(!(xr(t.display,e)||ge(t,e)||e.ctrlKey&&!e.altKey||y&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(h&&r==ul)return ul=null,void be(e);if(!h||e.which&&!(e.which<10)||!al(t,e)){var i=String.fromCharCode(null==n?r:n);"\b"!=i&&(function(e,t,r){return ll(e,"'"+r+"'",t,(function(t){return il(e,t,!0)}))}(t,e,i)||t.display.input.onKeyPress(e))}}}var dl,pl,gl=function(e,t,r){this.time=e,this.pos=t,this.button=r};function vl(e){var t=this,r=t.display;if(!(ge(t,e)||r.activeTouch&&r.input.supportsTouch()))if(r.input.ensurePolled(),r.shift=e.shiftKey,xr(r,e))a||(r.scroller.draggable=!1,setTimeout((function(){return r.scroller.draggable=!0}),100));else if(!bl(t,e)){var n=un(t,e),i=Le(e),o=n?function(e,t){var r=+new Date;return pl&&pl.compare(r,e,t)?(dl=pl=null,"triple"):dl&&dl.compare(r,e,t)?(pl=new gl(r,e,t),dl=null,"double"):(dl=new gl(r,e,t),pl=null,"single")}(n,i):"single";window.focus(),1==i&&t.state.selectingText&&t.state.selectingText(e),n&&function(e,t,r,n,i){var o="Click";return"double"==n?o="Double"+o:"triple"==n&&(o="Triple"+o),ll(e,_o(o=(1==t?"Left":2==t?"Middle":"Right")+o,i),i,(function(t){if("string"==typeof t&&(t=tl[t]),!t)return!1;var n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n=t(e,r)!=G}finally{e.state.suppressEdits=!1}return n}))}(t,i,n,o,e)||(1==i?n?function(e,t,r,n){l?setTimeout(E(Cn,e),0):e.curOp.focus=W();var i,o=function(e,t,r){var n=e.getOption("configureMouse"),i=n?n(e,t,r):{};if(null==i.unit){var o=b?r.shiftKey&&r.metaKey:r.altKey;i.unit=o?"rectangle":"single"==t?"char":"double"==t?"word":"line"}return(null==i.extend||e.doc.extend)&&(i.extend=e.doc.extend||r.shiftKey),null==i.addNew&&(i.addNew=y?r.metaKey:r.ctrlKey),null==i.moveOnDrag&&(i.moveOnDrag=!(y?r.altKey:r.ctrlKey)),i}(e,r,n),u=e.doc.sel;e.options.dragDrop&&Me&&!e.isReadOnly()&&"single"==r&&(i=u.contains(t))>-1&&(tt((i=u.ranges[i]).from(),t)<0||t.xRel>0)&&(tt(i.to(),t)>0||t.xRel<0)?function(e,t,r,n){var i=e.display,o=!1,u=ei(e,(function(t){a&&(i.scroller.draggable=!1),e.state.draggingText=!1,de(i.wrapper.ownerDocument,"mouseup",u),de(i.wrapper.ownerDocument,"mousemove",c),de(i.scroller,"dragstart",h),de(i.scroller,"drop",u),o||(be(t),n.addNew||_i(e.doc,r,null,null,n.extend),a||l&&9==s?setTimeout((function(){i.wrapper.ownerDocument.body.focus(),i.input.focus()}),20):i.input.focus())})),c=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},h=function(){return o=!0};a&&(i.scroller.draggable=!0),e.state.draggingText=u,u.copy=!n.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),he(i.wrapper.ownerDocument,"mouseup",u),he(i.wrapper.ownerDocument,"mousemove",c),he(i.scroller,"dragstart",h),he(i.scroller,"drop",u),Sn(e),setTimeout((function(){return i.input.focus()}),20)}(e,n,t,o):function(e,t,r,n){var i=e.display,o=e.doc;be(t);var l,s,a=o.sel,u=a.ranges;if(n.addNew&&!n.extend?(s=o.sel.contains(r),l=s>-1?u[s]:new Si(r,r)):(l=o.sel.primary(),s=o.sel.primIndex),"rectangle"==n.unit)n.addNew||(l=new Si(r,r)),r=un(e,t,!0,!0),s=-1;else{var c=ml(e,r,n.unit);l=n.extend?Yi(l,c.anchor,c.head,n.extend):c}n.addNew?-1==s?(s=u.length,Qi(o,Li(e,u.concat([l]),s),{scroll:!1,origin:"*mouse"})):u.length>1&&u[s].empty()&&"char"==n.unit&&!n.extend?(Qi(o,Li(e,u.slice(0,s).concat(u.slice(s+1)),0),{scroll:!1,origin:"*mouse"}),a=o.sel):qi(o,s,l,V):(s=0,Qi(o,new Ci([l],0),V),a=o.sel);var h=r;function f(t){if(0!=tt(h,t))if(h=t,"rectangle"==n.unit){for(var i=[],u=e.options.tabSize,c=z(je(o,r.line).text,r.ch,u),f=z(je(o,t.line).text,t.ch,u),d=Math.min(c,f),p=Math.max(c,f),g=Math.min(r.line,t.line),v=Math.min(e.lastLine(),Math.max(r.line,t.line));g<=v;g++){var m=je(o,g).text,y=X(m,d,u);d==p?i.push(new Si(et(g,y),et(g,y))):m.length>y&&i.push(new Si(et(g,y),et(g,X(m,p,u))))}i.length||i.push(new Si(r,r)),Qi(o,Li(e,a.ranges.slice(0,s).concat(i),s),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b,w=l,x=ml(e,t,n.unit),C=w.anchor;tt(x.anchor,C)>0?(b=x.head,C=ot(w.from(),x.anchor)):(b=x.anchor,C=it(w.to(),x.head));var S=a.ranges.slice(0);S[s]=function(e,t){var r=t.anchor,n=t.head,i=je(e.doc,r.line);if(0==tt(r,n)&&r.sticky==n.sticky)return t;var o=ue(i);if(!o)return t;var l=se(o,r.ch,r.sticky),s=o[l];if(s.from!=r.ch&&s.to!=r.ch)return t;var a,u=l+(s.from==r.ch==(1!=s.level)?0:1);if(0==u||u==o.length)return t;if(n.line!=r.line)a=(n.line-r.line)*("ltr"==e.doc.direction?1:-1)>0;else{var c=se(o,n.ch,n.sticky),h=c-l||(n.ch-r.ch)*(1==s.level?-1:1);a=c==u-1||c==u?h<0:h>0}var f=o[u+(a?-1:0)],d=a==(1==f.level),p=d?f.from:f.to,g=d?"after":"before";return r.ch==p&&r.sticky==g?t:new Si(new et(r.line,p,g),n)}(e,new Si(st(o,C),b)),Qi(o,Li(e,S,s),V)}}var d=i.wrapper.getBoundingClientRect(),p=0;function g(t){e.state.selectingText=!1,p=1/0,t&&(be(t),i.input.focus()),de(i.wrapper.ownerDocument,"mousemove",v),de(i.wrapper.ownerDocument,"mouseup",m),o.history.lastSelOrigin=null}var v=ei(e,(function(t){0!==t.buttons&&Le(t)?function t(r){var l=++p,s=un(e,r,!0,"rectangle"==n.unit);if(s)if(0!=tt(s,h)){e.curOp.focus=W(),f(s);var a=Nn(i,o);(s.line>=a.to||s.line<a.from)&&setTimeout(ei(e,(function(){p==l&&t(r)})),150)}else{var u=r.clientY<d.top?-20:r.clientY>d.bottom?20:0;u&&setTimeout(ei(e,(function(){p==l&&(i.scroller.scrollTop+=u,t(r))})),50)}}(t):g(t)})),m=ei(e,g);e.state.selectingText=m,he(i.wrapper.ownerDocument,"mousemove",v),he(i.wrapper.ownerDocument,"mouseup",m)}(e,n,t,o)}(t,n,o,e):Se(e)==r.scroller&&be(e):2==i?(n&&_i(t.doc,n),setTimeout((function(){return r.input.focus()}),20)):3==i&&(S?t.display.input.onContextMenu(e):Sn(t)))}}function ml(e,t,r){if("char"==r)return new Si(t,t);if("word"==r)return e.findWordAt(t);if("line"==r)return new Si(et(t.line,0),st(e.doc,et(t.line+1,0)));var n=r(e,t);return new Si(n.from,n.to)}function yl(e,t,r,n){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&be(t);var l=e.display,s=l.lineDiv.getBoundingClientRect();if(o>s.bottom||!me(e,r))return xe(t);o-=s.top-l.viewOffset;for(var a=0;a<e.display.gutterSpecs.length;++a){var u=l.gutters.childNodes[a];if(u&&u.getBoundingClientRect().right>=i)return pe(e,r,e,Ze(e.doc,o),e.display.gutterSpecs[a].className,t),xe(t)}}function bl(e,t){return yl(e,t,"gutterClick",!0)}function wl(e,t){xr(e.display,t)||function(e,t){return!!me(e,"gutterContextMenu")&&yl(e,t,"gutterContextMenu",!1)}(e,t)||ge(e,t,"contextmenu")||S||e.display.input.onContextMenu(t)}function xl(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Rr(e)}gl.prototype.compare=function(e,t,r){return this.time+400>e&&0==tt(t,this.pos)&&r==this.button};var Cl={toString:function(){return"CodeMirror.Init"}},Sl={},Ll={};function kl(e,t,r){if(!t!=!(r&&r!=Cl)){var n=e.display.dragFunctions,i=t?he:de;i(e.display.scroller,"dragstart",n.start),i(e.display.scroller,"dragenter",n.enter),i(e.display.scroller,"dragover",n.over),i(e.display.scroller,"dragleave",n.leave),i(e.display.scroller,"drop",n.drop)}}function Tl(e){e.options.lineWrapping?(H(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(T(e.display.wrapper,"CodeMirror-wrap"),Xt(e)),an(e),hn(e),Rr(e),setTimeout((function(){return Gn(e)}),100)}function Ml(e,t){var r=this;if(!(this instanceof Ml))return new Ml(e,t);this.options=t=t?I(t):{},I(Sl,t,!1);var n=t.value;"string"==typeof n?n=new Do(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var i=new Ml.inputStyles[t.inputStyle](this),o=this.display=new vi(e,n,i,t);for(var u in o.wrapper.CodeMirror=this,xl(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Kn(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new R,keySeq:null,specialChars:null},t.autofocus&&!m&&o.input.focus(),l&&s<11&&setTimeout((function(){return r.display.input.reset(!0)}),20),function(e){var t=e.display;he(t.scroller,"mousedown",ei(e,vl)),he(t.scroller,"dblclick",l&&s<11?ei(e,(function(t){if(!ge(e,t)){var r=un(e,t);if(r&&!bl(e,t)&&!xr(e.display,t)){be(t);var n=e.findWordAt(r);_i(e.doc,n.anchor,n.head)}}})):function(t){return ge(e,t)||be(t)}),he(t.scroller,"contextmenu",(function(t){return wl(e,t)})),he(t.input.getField(),"contextmenu",(function(r){t.scroller.contains(r.target)||wl(e,r)}));var r,n={end:0};function i(){t.activeTouch&&(r=setTimeout((function(){return t.activeTouch=null}),1e3),(n=t.activeTouch).end=+new Date)}function o(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return r*r+n*n>400}he(t.scroller,"touchstart",(function(i){if(!ge(e,i)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(i)&&!bl(e,i)){t.input.ensurePolled(),clearTimeout(r);var o=+new Date;t.activeTouch={start:o,moved:!1,prev:o-n.end<=300?n:null},1==i.touches.length&&(t.activeTouch.left=i.touches[0].pageX,t.activeTouch.top=i.touches[0].pageY)}})),he(t.scroller,"touchmove",(function(){t.activeTouch&&(t.activeTouch.moved=!0)})),he(t.scroller,"touchend",(function(r){var n=t.activeTouch;if(n&&!xr(t,r)&&null!=n.left&&!n.moved&&new Date-n.start<300){var l,s=e.coordsChar(t.activeTouch,"page");l=!n.prev||o(n,n.prev)?new Si(s,s):!n.prev.prev||o(n,n.prev.prev)?e.findWordAt(s):new Si(et(s.line,0),st(e.doc,et(s.line+1,0))),e.setSelection(l.anchor,l.head),e.focus(),be(r)}i()})),he(t.scroller,"touchcancel",i),he(t.scroller,"scroll",(function(){t.scroller.clientHeight&&(Pn(e,t.scroller.scrollTop),In(e,t.scroller.scrollLeft,!0),pe(e,"scroll",e))})),he(t.scroller,"mousewheel",(function(t){return xi(e,t)})),he(t.scroller,"DOMMouseScroll",(function(t){return xi(e,t)})),he(t.wrapper,"scroll",(function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0})),t.dragFunctions={enter:function(t){ge(e,t)||Ce(t)},over:function(t){ge(e,t)||(function(e,t){var r=un(e,t);if(r){var n=document.createDocumentFragment();yn(e,r,n),e.display.dragCursor||(e.display.dragCursor=O("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),N(e.display.dragCursor,n)}}(e,t),Ce(t))},start:function(t){return function(e,t){if(l&&(!e.state.draggingText||+new Date-Wo<100))Ce(t);else if(!ge(e,t)&&!xr(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!f)){var r=O("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",h&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),h&&r.parentNode.removeChild(r)}}(e,t)},drop:ei(e,Ho),leave:function(t){ge(e,t)||Fo(e)}};var a=t.input.getField();he(a,"keyup",(function(t){return hl.call(e,t)})),he(a,"keydown",ei(e,cl)),he(a,"keypress",ei(e,fl)),he(a,"focus",(function(t){return Ln(e,t)})),he(a,"blur",(function(t){return kn(e,t)}))}(this),Io(),jn(this),this.curOp.forceUpdate=!0,Pi(this,n),t.autofocus&&!m||this.hasFocus()?setTimeout(E(Ln,this),20):kn(this),Ll)Ll.hasOwnProperty(u)&&Ll[u](this,t[u],Cl);fi(this),t.finishInit&&t.finishInit(this);for(var c=0;c<Nl.length;++c)Nl[c](this);Yn(this),a&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}Ml.defaults=Sl,Ml.optionHandlers=Ll;var Nl=[];function Ol(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=dt(e,t).state:r="prev");var l=e.options.tabSize,s=je(o,t),a=z(s.text,null,l);s.stateAfter&&(s.stateAfter=null);var u,c=s.text.match(/^\s*/)[0];if(n||/\S/.test(s.text)){if("smart"==r&&((u=o.mode.indent(i,s.text.slice(c.length),s.text))==G||u>150)){if(!n)return;r="prev"}}else u=0,r="not";"prev"==r?u=t>o.first?z(je(o,t-1).text,null,l):0:"add"==r?u=a+e.options.indentUnit:"subtract"==r?u=a-e.options.indentUnit:"number"==typeof r&&(u=a+r),u=Math.max(0,u);var h="",f=0;if(e.options.indentWithTabs)for(var d=Math.floor(u/l);d;--d)f+=l,h+="\t";if(f<u&&(h+=Y(u-f)),h!=c)return go(o,h,et(t,0),et(t,c.length),"+input"),s.stateAfter=null,!0;for(var p=0;p<o.sel.ranges.length;p++){var g=o.sel.ranges[p];if(g.head.line==t&&g.head.ch<c.length){var v=et(t,c.length);qi(o,p,new Si(v,v));break}}}Ml.defineInitHook=function(e){return Nl.push(e)};var Al=null;function Dl(e){Al=e}function Wl(e,t,r,n,i){var o=e.doc;e.display.shift=!1,n||(n=o.sel);var l=+new Date-200,s="paste"==i||e.state.pasteIncoming>l,a=De(t),u=null;if(s&&n.ranges.length>1)if(Al&&Al.text.join("\n")==t){if(n.ranges.length%Al.text.length==0){u=[];for(var c=0;c<Al.text.length;c++)u.push(o.splitLines(Al.text[c]))}}else a.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(u=$(a,(function(e){return[e]})));for(var h=e.curOp.updateInput,f=n.ranges.length-1;f>=0;f--){var d=n.ranges[f],p=d.from(),g=d.to();d.empty()&&(r&&r>0?p=et(p.line,p.ch-r):e.state.overwrite&&!s?g=et(g.line,Math.min(je(o,g.line).text.length,g.ch+_(a).length)):s&&Al&&Al.lineWise&&Al.text.join("\n")==t&&(p=g=et(p.line,0)));var v={from:p,to:g,text:u?u[f%u.length]:a,origin:i||(s?"paste":e.state.cutIncoming>l?"cut":"+input")};uo(e.doc,v),sr(e,"inputRead",e,v)}t&&!s&&Fl(e,t),Dn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=h),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Hl(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Qn(t,(function(){return Wl(t,r,0,null,"paste")})),!0}function Fl(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(!(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)){var o=e.getModeAt(i.head),l=!1;if(o.electricChars){for(var s=0;s<o.electricChars.length;s++)if(t.indexOf(o.electricChars.charAt(s))>-1){l=Ol(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(je(e.doc,i.head.line).text.slice(0,i.head.ch))&&(l=Ol(e,i.head.line,"smart"));l&&sr(e,"electricInput",e,i.head.line)}}}function Pl(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var i=e.doc.sel.ranges[n].head.line,o={anchor:et(i,0),head:et(i+1,0)};r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function El(e,t,r,n){e.setAttribute("autocorrect",r?"":"off"),e.setAttribute("autocapitalize",n?"":"off"),e.setAttribute("spellcheck",!!t)}function Il(){var e=O("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=O("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return a?e.style.width="1000px":e.setAttribute("wrap","off"),g&&(e.style.border="1px solid black"),El(e),t}function zl(e,t,r,n,i){var o=t,l=r,s=je(e,t.line),a=i&&"rtl"==e.direction?-r:r;function u(n){var o,l;if(null==(o=i?function(e,t,r,n){var i=ue(t,e.doc.direction);if(!i)return Qo(t,r,n);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var o=se(i,r.ch,r.sticky),l=i[o];if("ltr"==e.doc.direction&&l.level%2==0&&(n>0?l.to>r.ch:l.from<r.ch))return Qo(t,r,n);var s,a=function(e,r){return Jo(t,e instanceof et?e.ch:e,r)},u=function(r){return e.options.lineWrapping?(s=s||Dr(e,t),Zr(e,t,s,r)):{begin:0,end:t.text.length}},c=u("before"==r.sticky?a(r,-1):r.ch);if("rtl"==e.doc.direction||1==l.level){var h=1==l.level==n<0,f=a(r,h?1:-1);if(null!=f&&(h?f<=l.to&&f<=c.end:f>=l.from&&f>=c.begin)){var d=h?"before":"after";return new et(r.line,f,d)}}var p=function(e,t,n){for(var o=function(e,t){return t?new et(r.line,a(e,1),"before"):new et(r.line,e,"after")};e>=0&&e<i.length;e+=t){var l=i[e],s=t>0==(1!=l.level),u=s?n.begin:a(n.end,-1);if(l.from<=u&&u<l.to)return o(u,s);if(u=s?l.from:a(l.to,-1),n.begin<=u&&u<n.end)return o(u,s)}},g=p(o+n,n,c);if(g)return g;var v=n>0?c.end:a(c.begin,-1);return null==v||n>0&&v==t.text.length||!(g=p(n>0?0:i.length-1,n,u(v)))?null:g}(e.cm,s,t,r):Qo(s,t,r))){if(n||(l=t.line+a)<e.first||l>=e.first+e.size||(t=new et(l,t.ch,t.sticky),!(s=je(e,l))))return!1;t=el(i,e.cm,s,t.line,a)}else t=o;return!0}if("char"==n)u();else if("column"==n)u(!0);else if("word"==n||"group"==n)for(var c=null,h="group"==n,f=e.cm&&e.cm.getHelper(t,"wordChars"),d=!0;!(r<0)||u(!d);d=!1){var p=s.text.charAt(t.ch)||"\n",g=ee(p,f)?"w":h&&"\n"==p?"n":!h||/\s/.test(p)?null:"p";if(!h||d||g||(g="s"),c&&c!=g){r<0&&(r=1,u(),t.sticky="after");break}if(g&&(c=g),r>0&&!u(!d))break}var v=oo(e,t,o,l,!0);return rt(o,v)&&(v.hitSide=!0),v}function Rl(e,t,r,n){var i,o,l=e.doc,s=t.left;if("page"==n){var a=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=Math.max(a-.5*rn(e.display),3);i=(r>0?t.bottom:t.top)+r*u}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(;(o=$r(e,s,i)).outside;){if(r<0?i<=0:i>=l.height){o.hitSide=!0;break}i+=5*r}return o}var Bl=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new R,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Gl(e,t){var r=Ar(e,t.line);if(!r||r.hidden)return null;var n=je(e.doc,t.line),i=Nr(r,n,t.line),o=ue(n,e.doc.direction),l="left";o&&(l=se(o,t.ch)%2?"right":"left");var s=Pr(i.map,t.ch,l);return s.offset="right"==s.collapse?s.end:s.start,s}function Ul(e,t){return t&&(e.bad=!0),e}function Vl(e,t,r){var n;if(t==e.display.lineDiv){if(!(n=e.display.lineDiv.childNodes[r]))return Ul(e.clipPos(et(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==n)return Kl(o,t,r)}}function Kl(e,t,r){var n=e.text.firstChild,i=!1;if(!t||!D(n,t))return Ul(et(qe(e.line),0),!0);if(t==n&&(i=!0,t=n.childNodes[r],r=0,!t)){var o=e.rest?_(e.rest):e.line;return Ul(et(qe(o),o.text.length),i)}var l=3==t.nodeType?t:null,s=t;for(l||1!=t.childNodes.length||3!=t.firstChild.nodeType||(l=t.firstChild,r&&(r=l.nodeValue.length));s.parentNode!=n;)s=s.parentNode;var a=e.measure,u=a.maps;function c(t,r,n){for(var i=-1;i<(u?u.length:0);i++)for(var o=i<0?a.map:u[i],l=0;l<o.length;l+=3){var s=o[l+2];if(s==t||s==r){var c=qe(i<0?e.line:e.rest[i]),h=o[l]+n;return(n<0||s!=t)&&(h=o[l+(n?1:0)]),et(c,h)}}}var h=c(l,s,r);if(h)return Ul(h,i);for(var f=s.nextSibling,d=l?l.nodeValue.length-r:0;f;f=f.nextSibling){if(h=c(f,f.firstChild,0))return Ul(et(h.line,h.ch-d),i);d+=f.textContent.length}for(var p=s.previousSibling,g=r;p;p=p.previousSibling){if(h=c(p,p.firstChild,-1))return Ul(et(h.line,h.ch+g),i);g+=p.textContent.length}}Bl.prototype.init=function(e){var t=this,r=this,n=r.cm,i=r.div=e.lineDiv;function o(e){if(!ge(n,e)){if(n.somethingSelected())Dl({lineWise:!1,text:n.getSelections()}),"cut"==e.type&&n.replaceSelection("",null,"cut");else{if(!n.options.lineWiseCopyCut)return;var t=Pl(n);Dl({lineWise:!0,text:t.text}),"cut"==e.type&&n.operation((function(){n.setSelections(t.ranges,0,U),n.replaceSelection("",null,"cut")}))}if(e.clipboardData){e.clipboardData.clearData();var o=Al.text.join("\n");if(e.clipboardData.setData("Text",o),e.clipboardData.getData("Text")==o)return void e.preventDefault()}var l=Il(),s=l.firstChild;n.display.lineSpace.insertBefore(l,n.display.lineSpace.firstChild),s.value=Al.text.join("\n");var a=document.activeElement;P(s),setTimeout((function(){n.display.lineSpace.removeChild(l),a.focus(),a==i&&r.showPrimarySelection()}),50)}}El(i,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize),he(i,"paste",(function(e){ge(n,e)||Hl(e,n)||s<=11&&setTimeout(ei(n,(function(){return t.updateFromDOM()})),20)})),he(i,"compositionstart",(function(e){t.composing={data:e.data,done:!1}})),he(i,"compositionupdate",(function(e){t.composing||(t.composing={data:e.data,done:!1})})),he(i,"compositionend",(function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)})),he(i,"touchstart",(function(){return r.forceCompositionEnd()})),he(i,"input",(function(){t.composing||t.readFromDOMSoon()})),he(i,"copy",o),he(i,"cut",o)},Bl.prototype.prepareSelection=function(){var e=mn(this.cm,!1);return e.focus=document.activeElement==this.div,e},Bl.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Bl.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Bl.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),i=n.from(),o=n.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||o.line<t.display.viewFrom)e.removeAllRanges();else{var l=Vl(t,e.anchorNode,e.anchorOffset),s=Vl(t,e.focusNode,e.focusOffset);if(!l||l.bad||!s||s.bad||0!=tt(ot(l,s),i)||0!=tt(it(l,s),o)){var a=t.display.view,u=i.line>=t.display.viewFrom&&Gl(t,i)||{node:a[0].measure.map[2],offset:0},c=o.line<t.display.viewTo&&Gl(t,o);if(!c){var h=a[a.length-1].measure,f=h.maps?h.maps[h.maps.length-1]:h.map;c={node:f[f.length-1],offset:f[f.length-2]-f[f.length-3]}}if(u&&c){var d,p=e.rangeCount&&e.getRangeAt(0);try{d=k(u.node,u.offset,c.offset,c.node)}catch(Ae){}d&&(!r&&t.state.focused?(e.collapse(u.node,u.offset),d.collapsed||(e.removeAllRanges(),e.addRange(d))):(e.removeAllRanges(),e.addRange(d)),p&&null==e.anchorNode?e.addRange(p):r&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},Bl.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout((function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation((function(){return e.cm.curOp.selectionChanged=!0}))}),20)},Bl.prototype.showMultipleSelections=function(e){N(this.cm.display.cursorDiv,e.cursors),N(this.cm.display.selectionDiv,e.selection)},Bl.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Bl.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return D(this.div,t)},Bl.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&document.activeElement==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Bl.prototype.blur=function(){this.div.blur()},Bl.prototype.getField=function(){return this.div},Bl.prototype.supportsTouch=function(){return!0},Bl.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Qn(this.cm,(function(){return e.cm.curOp.selectionChanged=!0})),this.polling.set(this.cm.options.pollInterval,(function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}))},Bl.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Bl.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=this.getSelection(),t=this.cm;if(v&&c&&this.cm.display.gutterSpecs.length&&function(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var r=Vl(t,e.anchorNode,e.anchorOffset),n=Vl(t,e.focusNode,e.focusOffset);r&&n&&Qn(t,(function(){Qi(t.doc,ki(r,n),U),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)}))}}},Bl.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t,r,n=this.cm,i=n.display,o=n.doc.sel.primary(),l=o.from(),s=o.to();if(0==l.ch&&l.line>n.firstLine()&&(l=et(l.line-1,je(n.doc,l.line-1).length)),s.ch==je(n.doc,s.line).text.length&&s.line<n.lastLine()&&(s=et(s.line+1,0)),l.line<i.viewFrom||s.line>i.viewTo-1)return!1;l.line==i.viewFrom||0==(e=cn(n,l.line))?(t=qe(i.view[0].line),r=i.view[0].node):(t=qe(i.view[e].line),r=i.view[e-1].node.nextSibling);var a,u,c=cn(n,s.line);if(c==i.view.length-1?(a=i.viewTo-1,u=i.lineDiv.lastChild):(a=qe(i.view[c+1].line)-1,u=i.view[c+1].node.previousSibling),!r)return!1;for(var h=n.doc.splitLines(function(e,t,r,n,i){var o="",l=!1,s=e.doc.lineSeparator(),a=!1;function u(){l&&(o+=s,a&&(o+=s),l=a=!1)}function c(e){e&&(u(),o+=e)}function h(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(r)return void c(r);var o,f=t.getAttribute("cm-marker");if(f){var d=e.findMarks(et(n,0),et(i+1,0),(v=+f,function(e){return e.id==v}));return void(d.length&&(o=d[0].find(0))&&c(Ye(e.doc,o.from,o.to).join(s)))}if("false"==t.getAttribute("contenteditable"))return;var p=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;p&&u();for(var g=0;g<t.childNodes.length;g++)h(t.childNodes[g]);/^(pre|p)$/i.test(t.nodeName)&&(a=!0),p&&(l=!0)}else 3==t.nodeType&&c(t.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "));var v}for(;h(t),t!=r;)t=t.nextSibling,a=!1;return o}(n,r,u,t,a)),f=Ye(n.doc,et(t,0),et(a,je(n.doc,a).text.length));h.length>1&&f.length>1;)if(_(h)==_(f))h.pop(),f.pop(),a--;else{if(h[0]!=f[0])break;h.shift(),f.shift(),t++}for(var d=0,p=0,g=h[0],v=f[0],m=Math.min(g.length,v.length);d<m&&g.charCodeAt(d)==v.charCodeAt(d);)++d;for(var y=_(h),b=_(f),w=Math.min(y.length-(1==h.length?d:0),b.length-(1==f.length?d:0));p<w&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;if(1==h.length&&1==f.length&&t==l.line)for(;d&&d>l.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)d--,p++;h[h.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),h[0]=h[0].slice(d).replace(/\u200b+$/,"");var x=et(t,d),C=et(a,f.length?_(f).length-p:0);return h.length>1||h[0]||tt(x,C)?(go(n.doc,h,x,C,"+input"),!0):void 0},Bl.prototype.ensurePolled=function(){this.forceCompositionEnd()},Bl.prototype.reset=function(){this.forceCompositionEnd()},Bl.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Bl.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()}),80))},Bl.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Qn(this.cm,(function(){return hn(e.cm)}))},Bl.prototype.setUneditable=function(e){e.contentEditable="false"},Bl.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||ei(this.cm,Wl)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Bl.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Bl.prototype.onContextMenu=function(){},Bl.prototype.resetPosition=function(){},Bl.prototype.needsContentAttribute=!0;var Xl=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new R,this.hasSelection=!1,this.composing=null};Xl.prototype.init=function(e){var t=this,r=this,n=this.cm;this.createField(e);var i=this.textarea;function o(e){if(!ge(n,e)){if(n.somethingSelected())Dl({lineWise:!1,text:n.getSelections()});else{if(!n.options.lineWiseCopyCut)return;var t=Pl(n);Dl({lineWise:!0,text:t.text}),"cut"==e.type?n.setSelections(t.ranges,null,U):(r.prevInput="",i.value=t.text.join("\n"),P(i))}"cut"==e.type&&(n.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),g&&(i.style.width="0px"),he(i,"input",(function(){l&&s>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()})),he(i,"paste",(function(e){ge(n,e)||Hl(e,n)||(n.state.pasteIncoming=+new Date,r.fastPoll())})),he(i,"cut",o),he(i,"copy",o),he(e.scroller,"paste",(function(t){if(!xr(e,t)&&!ge(n,t)){if(!i.dispatchEvent)return n.state.pasteIncoming=+new Date,void r.focus();var o=new Event("paste");o.clipboardData=t.clipboardData,i.dispatchEvent(o)}})),he(e.lineSpace,"selectstart",(function(t){xr(e,t)||be(t)})),he(i,"compositionstart",(function(){var e=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}})),he(i,"compositionend",(function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)}))},Xl.prototype.createField=function(e){this.wrapper=Il(),this.textarea=this.wrapper.firstChild},Xl.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=mn(e);if(e.options.moveInputWithCursor){var i=jr(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+l.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+l.left-o.left))}return n},Xl.prototype.showSelection=function(e){var t=this.cm.display;N(t.cursorDiv,e.cursors),N(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Xl.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&P(this.textarea),l&&s>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",l&&s>=9&&(this.hasSelection=null))}},Xl.prototype.getField=function(){return this.textarea},Xl.prototype.supportsTouch=function(){return!1},Xl.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!m||W()!=this.textarea))try{this.textarea.focus()}catch(Ae){}},Xl.prototype.blur=function(){this.textarea.blur()},Xl.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Xl.prototype.receivedFocus=function(){this.slowPoll()},Xl.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){e.poll(),e.cm.state.focused&&e.slowPoll()}))},Xl.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0,t.polling.set(20,(function r(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,r))}))},Xl.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||We(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=r.value;if(i==n&&!t.somethingSelected())return!1;if(l&&s>=9&&this.hasSelection===i||y&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||n||(n="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var a=0,u=Math.min(n.length,i.length);a<u&&n.charCodeAt(a)==i.charCodeAt(a);)++a;return Qn(t,(function(){Wl(t,i.slice(a),n.length-a,null,e.composing?"*compose":null),i.length>1e3||i.indexOf("\n")>-1?r.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},Xl.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Xl.prototype.onKeyPress=function(){l&&s>=9&&(this.hasSelection=null),this.fastPoll()},Xl.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=un(r,e),u=n.scroller.scrollTop;if(o&&!h){r.options.resetSelectionOnContextMenu&&-1==r.doc.sel.contains(o)&&ei(r,Qi)(r.doc,ki(o),U);var c,f=i.style.cssText,d=t.wrapper.style.cssText,p=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-p.top-5)+"px; left: "+(e.clientX-p.left-5)+"px;\n z-index: 1000; background: "+(l?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",a&&(c=window.scrollY),n.input.focus(),a&&window.scrollTo(null,c),n.input.reset(),r.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=v,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll),l&&s>=9&&g(),S?(Ce(e),he(window,"mouseup",(function e(){de(window,"mouseup",e),setTimeout(v,20)}))):setTimeout(v,50)}function g(){if(null!=i.selectionStart){var e=r.somethingSelected(),o="​"+(e?i.value:"");i.value="⇚",i.value=o,t.prevInput=e?"":"​",i.selectionStart=1,i.selectionEnd=o.length,n.selForContextMenu=r.doc.sel}}function v(){if(t.contextMenuPending==v&&(t.contextMenuPending=!1,t.wrapper.style.cssText=d,i.style.cssText=f,l&&s<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=u),null!=i.selectionStart)){(!l||l&&s<9)&&g();var e=0;n.detectingSelectAll=setTimeout((function o(){n.selForContextMenu==r.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&"​"==t.prevInput?ei(r,so)(r):e++<10?n.detectingSelectAll=setTimeout(o,500):(n.selForContextMenu=null,n.input.reset())}),200)}}},Xl.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},Xl.prototype.setUneditable=function(){},Xl.prototype.needsContentAttribute=!1,function(e){var t=e.optionHandlers;function r(r,n,i,o){e.defaults[r]=n,i&&(t[r]=o?function(e,t,r){r!=Cl&&i(e,t,r)}:i)}e.defineOption=r,e.Init=Cl,r("value","",(function(e,t){return e.setValue(t)}),!0),r("mode",null,(function(e,t){e.doc.modeOption=t,Ai(e)}),!0),r("indentUnit",2,Ai,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,(function(e){Di(e),Rr(e),hn(e)}),!0),r("lineSeparator",null,(function(e,t){if(e.doc.lineSep=t,t){var r=[],n=e.doc.first;e.doc.iter((function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,r.push(et(n,o))}n++}));for(var i=r.length-1;i>=0;i--)go(e.doc,t,r[i],et(r[i].line,r[i].ch+t.length))}})),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(e,t,r){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),r!=Cl&&e.refresh()})),r("specialCharPlaceholder",Jt,(function(e){return e.refresh()}),!0),r("electricChars",!0),r("inputStyle",m?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),r("spellcheck",!1,(function(e,t){return e.getInputField().spellcheck=t}),!0),r("autocorrect",!1,(function(e,t){return e.getInputField().autocorrect=t}),!0),r("autocapitalize",!1,(function(e,t){return e.getInputField().autocapitalize=t}),!0),r("rtlMoveVisually",!w),r("wholeLineUpdateBefore",!0),r("theme","default",(function(e){xl(e),gi(e)}),!0),r("keyMap","default",(function(e,t,r){var n=qo(t),i=r!=Cl&&qo(r);i&&i.detach&&i.detach(e,n),n.attach&&n.attach(e,i||null)})),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Tl,!0),r("gutters",[],(function(e,t){e.display.gutterSpecs=di(t,e.options.lineNumbers),gi(e)}),!0),r("fixedGutter",!0,(function(e,t){e.display.gutters.style.left=t?ln(e.display)+"px":"0",e.refresh()}),!0),r("coverGutterNextToScrollbar",!1,(function(e){return Gn(e)}),!0),r("scrollbarStyle","native",(function(e){Kn(e),Gn(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)}),!0),r("lineNumbers",!1,(function(e,t){e.display.gutterSpecs=di(e.options.gutters,t),gi(e)}),!0),r("firstLineNumber",1,gi,!0),r("lineNumberFormatter",(function(e){return e}),gi,!0),r("showCursorWhenSelecting",!1,vn,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,(function(e,t){"nocursor"==t&&(kn(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)})),r("disableInput",!1,(function(e,t){t||e.display.input.reset()}),!0),r("dragDrop",!0,kl),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,vn,!0),r("singleCursorHeightPerLine",!0,vn,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,Di,!0),r("addModeClass",!1,Di,!0),r("pollInterval",100),r("undoDepth",200,(function(e,t){return e.doc.history.undoDepth=t})),r("historyEventDelay",1250),r("viewportMargin",10,(function(e){return e.refresh()}),!0),r("maxHighlightLength",1e4,Di,!0),r("moveInputWithCursor",!0,(function(e,t){t||e.display.input.resetPosition()})),r("tabindex",null,(function(e,t){return e.display.input.getField().tabIndex=t||""})),r("autofocus",null),r("direction","ltr",(function(e,t){return e.doc.setDirection(t)}),!0),r("phrases",null)}(Ml),function(e){var t=e.optionHandlers,r=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,r){var n=this.options,i=n[e];n[e]==r&&"mode"!=e||(n[e]=r,t.hasOwnProperty(e)&&ei(this,t[e])(this,r,i),pe(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](qo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||t[r].name==e)return t.splice(r,1),!0},addOverlay:ti((function(t,r){var n=t.token?t:e.getMode(this.options,t);if(n.startState)throw new Error("Overlays may not be stateful.");!function(e,t,r){for(var n=0,i=r(t);n<e.length&&r(e[n])<=i;)n++;e.splice(n,0,t)}(this.state.overlays,{mode:n,modeSpec:t,opaque:r&&r.opaque,priority:r&&r.priority||0},(function(e){return e.priority})),this.state.modeGen++,hn(this)})),removeOverlay:ti((function(e){for(var t=this.state.overlays,r=0;r<t.length;++r){var n=t[r].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(r,1),this.state.modeGen++,void hn(this)}})),indentLine:ti((function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),Je(this.doc,e)&&Ol(this,e,t,r)})),indentSelection:ti((function(e){for(var t=this.doc.sel.ranges,r=-1,n=0;n<t.length;n++){var i=t[n];if(i.empty())i.head.line>r&&(Ol(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&Dn(this));else{var o=i.from(),l=i.to(),s=Math.max(r,o.line);r=Math.min(this.lastLine(),l.line-(l.ch?0:1))+1;for(var a=s;a<r;++a)Ol(this,a,e);var u=this.doc.sel.ranges;0==o.ch&&t.length==u.length&&u[n].from().ch>0&&qi(this.doc,n,new Si(o,u[n].to()),U)}}})),getTokenAt:function(e,t){return yt(this,e,t)},getLineTokens:function(e,t){return yt(this,et(e),t,!0)},getTokenTypeAt:function(e){e=st(this.doc,e);var t,r=ft(this,je(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var l=n+i>>1;if((l?r[2*l-1]:0)>=o)i=l;else{if(!(r[2*l+1]<o)){t=r[2*l+2];break}n=l+1}}var s=t?t.indexOf("overlay "):-1;return s<0?t:0==s?null:t.slice(0,s-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=[];if(!r.hasOwnProperty(t))return n;var i=r[t],o=this.getModeAt(e);if("string"==typeof o[t])i[o[t]]&&n.push(i[o[t]]);else if(o[t])for(var l=0;l<o[t].length;l++){var s=i[o[t][l]];s&&n.push(s)}else o.helperType&&i[o.helperType]?n.push(i[o.helperType]):i[o.name]&&n.push(i[o.name]);for(var a=0;a<i._global.length;a++){var u=i._global[a];u.pred(o,this)&&-1==B(n,u.val)&&n.push(u.val)}return n},getStateAfter:function(e,t){var r=this.doc;return dt(this,(e=lt(r,null==e?r.first+r.size-1:e))+1,t).state},cursorCoords:function(e,t){var r=this.doc.sel.primary();return jr(this,null==e?r.head:"object"==typeof e?st(this.doc,e):e?r.from():r.to(),t||"page")},charCoords:function(e,t){return Xr(this,st(this.doc,e),t||"page")},coordsChar:function(e,t){return $r(this,(e=Kr(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=Kr(this,{top:e,left:0},t||"page").top,Ze(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,r){var n,i=!1;if("number"==typeof e){var o=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>o&&(e=o,i=!0),n=je(this.doc,e)}else n=e;return Vr(this,n,{top:0,left:0},t||"page",r||i).top+(i?this.doc.height-Vt(n):0)},defaultTextHeight:function(){return rn(this.display)},defaultCharWidth:function(){return nn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o,l,s,a=this.display,u=(e=jr(this,st(this.doc,e))).bottom,c=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),a.sizer.appendChild(t),"over"==n)u=e.top;else if("above"==n||"near"==n){var h=Math.max(a.wrapper.clientHeight,this.doc.height),f=Math.max(a.sizer.clientWidth,a.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>h)&&e.top>t.offsetHeight?u=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=h&&(u=e.bottom),c+t.offsetWidth>f&&(c=f-t.offsetWidth)}t.style.top=u+"px",t.style.left=t.style.right="","right"==i?(c=a.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?c=0:"middle"==i&&(c=(a.sizer.clientWidth-t.offsetWidth)/2),t.style.left=c+"px"),r&&(o=this,l={left:c,top:u,right:c+t.offsetWidth,bottom:u+t.offsetHeight},null!=(s=On(o,l)).scrollTop&&Pn(o,s.scrollTop),null!=s.scrollLeft&&In(o,s.scrollLeft))},triggerOnKeyDown:ti(cl),triggerOnKeyPress:ti(fl),triggerOnKeyUp:hl,triggerOnMouseDown:ti(vl),execCommand:function(e){if(tl.hasOwnProperty(e))return tl[e].call(null,this)},triggerElectric:ti((function(e){Fl(this,e)})),findPosH:function(e,t,r,n){var i=1;t<0&&(i=-1,t=-t);for(var o=st(this.doc,e),l=0;l<t&&!(o=zl(this.doc,o,i,r,n)).hitSide;++l);return o},moveH:ti((function(e,t){var r=this;this.extendSelectionsBy((function(n){return r.display.shift||r.doc.extend||n.empty()?zl(r.doc,n.head,e,t,r.options.rtlMoveVisually):e<0?n.from():n.to()}),K)})),deleteH:ti((function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):Zo(this,(function(r){var i=zl(n,r.head,e,t,!1);return e<0?{from:i,to:r.head}:{from:r.head,to:i}}))})),findPosV:function(e,t,r,n){var i=1,o=n;t<0&&(i=-1,t=-t);for(var l=st(this.doc,e),s=0;s<t;++s){var a=jr(this,l,"div");if(null==o?o=a.left:a.left=o,(l=Rl(this,a,i,r)).hitSide)break}return l},moveV:ti((function(e,t){var r=this,n=this.doc,i=[],o=!this.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy((function(l){if(o)return e<0?l.from():l.to();var s=jr(r,l.head,"div");null!=l.goalColumn&&(s.left=l.goalColumn),i.push(s.left);var a=Rl(r,s,e,t);return"page"==t&&l==n.sel.primary()&&An(r,Xr(r,a,"div").top-s.top),a}),K),i.length)for(var l=0;l<n.sel.ranges.length;l++)n.sel.ranges[l].goalColumn=i[l]})),findWordAt:function(e){var t=je(this.doc,e.line).text,r=e.ch,n=e.ch;if(t){var i=this.getHelper(e,"wordChars");"before"!=e.sticky&&n!=t.length||!r?++n:--r;for(var o=t.charAt(r),l=ee(o,i)?function(e){return ee(e,i)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!ee(e)};r>0&&l(t.charAt(r-1));)--r;for(;n<t.length&&l(t.charAt(n));)++n}return new Si(et(e.line,r),et(e.line,n))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?H(this.display.cursorDiv,"CodeMirror-overwrite"):T(this.display.cursorDiv,"CodeMirror-overwrite"),pe(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==W()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:ti((function(e,t){Wn(this,e,t)})),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-kr(this)-this.display.barHeight,width:e.scrollWidth-kr(this)-this.display.barWidth,clientHeight:Mr(this),clientWidth:Tr(this)}},scrollIntoView:ti((function(e,t){null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:et(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line?function(e,t){Hn(e),e.curOp.scrollToPos=t}(this,e):Fn(this,e.from,e.to,e.margin)})),setSize:ti((function(e,t){var r=this,n=function(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e};null!=e&&(this.display.wrapper.style.width=n(e)),null!=t&&(this.display.wrapper.style.height=n(t)),this.options.lineWrapping&&zr(this);var i=this.display.viewFrom;this.doc.iter(i,this.display.viewTo,(function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){fn(r,i,"widget");break}++i})),this.curOp.forceUpdate=!0,pe(this,"refresh",this)})),operation:function(e){return Qn(this,e)},startOperation:function(){return jn(this)},endOperation:function(){return Yn(this)},refresh:ti((function(){var e=this.display.cachedTextHeight;hn(this),this.curOp.forceUpdate=!0,Rr(this),Wn(this,this.doc.scrollLeft,this.doc.scrollTop),ui(this.display),(null==e||Math.abs(e-rn(this.display))>.5)&&an(this),pe(this,"refresh",this)})),swapDoc:ti((function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),Pi(this,e),Rr(this),this.display.input.reset(),Wn(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,sr(this,"swapDoc",this,t),t})),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ye(e),e.registerHelper=function(t,n,i){r.hasOwnProperty(t)||(r[t]=e[t]={_global:[]}),r[t][n]=i},e.registerGlobalHelper=function(t,n,i,o){e.registerHelper(t,n,o),r[t]._global.push({pred:i,val:o})}}(Ml);var jl="iter insert remove copy getEditor constructor".split(" ");for(var Yl in Do.prototype)Do.prototype.hasOwnProperty(Yl)&&B(jl,Yl)<0&&(Ml.prototype[Yl]=function(e){return function(){return e.apply(this.doc,arguments)}}(Do.prototype[Yl]));return ye(Do),Ml.inputStyles={textarea:Xl,contenteditable:Bl},Ml.defineMode=function(e){Ml.defaults.mode||"null"==e||(Ml.defaults.mode=e),Ie.apply(this,arguments)},Ml.defineMIME=function(e,t){Ee[e]=t},Ml.defineMode("null",(function(){return{token:function(e){return e.skipToEnd()}}})),Ml.defineMIME("text/plain","null"),Ml.defineExtension=function(e,t){Ml.prototype[e]=t},Ml.defineDocExtension=function(e,t){Do.prototype[e]=t},Ml.fromTextArea=function(e,t){if((t=t?I(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var r=W();t.autofocus=r==e||null!=e.getAttribute("autofocus")&&r==document.body}function n(){e.value=s.getValue()}var i;if(e.form&&(he(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var l=o.submit=function(){n(),o.submit=i,o.submit(),o.submit=l}}catch(Ae){}}t.finishInit=function(r){r.save=n,r.getTextArea=function(){return e},r.toTextArea=function(){r.toTextArea=isNaN,n(),e.parentNode.removeChild(r.getWrapperElement()),e.style.display="",e.form&&(de(e.form,"submit",n),t.leaveSubmitMethodAlone||"function"!=typeof e.form.submit||(e.form.submit=i))}},e.style.display="none";var s=Ml((function(t){return e.parentNode.insertBefore(t,e.nextSibling)}),t);return s},function(e){e.off=de,e.on=he,e.wheelEventPixels=wi,e.Doc=Do,e.splitLines=De,e.countColumn=z,e.findColumn=X,e.isWordChar=Q,e.Pass=G,e.signal=pe,e.Line=jt,e.changeEnd=Ti,e.scrollbarModel=Vn,e.Pos=et,e.cmpPos=tt,e.modes=Pe,e.mimeModes=Ee,e.resolveMode=ze,e.getMode=Re,e.modeExtensions=Be,e.extendMode=Ge,e.copyState=Ue,e.startState=Ke,e.innerMode=Ve,e.commands=tl,e.keyMap=Vo,e.keyName=$o,e.isModifierKey=Yo,e.lookupKey=jo,e.normalizeKeyMap=Xo,e.StringStream=Xe,e.SharedTextMarker=Mo,e.TextMarker=ko,e.LineWidget=Co,e.e_preventDefault=be,e.e_stopPropagation=we,e.e_stop=Ce,e.addClass=H,e.contains=D,e.rmClass=T,e.keyNames=Ro}(Ml),Ml.version="5.52.2",Ml}()}}]); //# sourceMappingURL=f65a48b9-c17f53720034fc9d5f50.js.map
170,640
81,186
defineSuite([ 'Scene/DiscardMissingTileImagePolicy', 'Core/Cartesian2', 'Core/loadImage', 'Core/loadWithXhr', 'Specs/pollToPromise', 'ThirdParty/when' ], function( DiscardMissingTileImagePolicy, Cartesian2, loadImage, loadWithXhr, pollToPromise, when) { 'use strict'; afterEach(function() { loadImage.createImage = loadImage.defaultCreateImage; loadWithXhr.load = loadWithXhr.defaultLoad; }); describe('construction', function() { it('throws if missingImageUrl is not provided', function() { function constructWithoutMissingImageUrl() { return new DiscardMissingTileImagePolicy({ pixelsToCheck : [new Cartesian2(0, 0)] }); } expect(constructWithoutMissingImageUrl).toThrowDeveloperError(); }); it('throws if pixelsToCheck is not provided', function() { function constructWithoutPixelsToCheck() { return new DiscardMissingTileImagePolicy({ missingImageUrl : 'http://some.host.invalid/missingImage.png' }); } expect(constructWithoutPixelsToCheck).toThrowDeveloperError(); }); it('requests the missing image url', function() { var missingImageUrl = 'http://some.host.invalid/missingImage.png'; spyOn(loadImage, 'createImage').and.callFake(function(url, crossOrigin, deferred) { if (/^blob:/.test(url)) { // load blob url normally loadImage.defaultCreateImage(url, crossOrigin, deferred); } else { expect(url).toEqual(missingImageUrl); loadImage.defaultCreateImage('Data/Images/Red16x16.png', crossOrigin, deferred); } }); loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) { expect(url).toEqual(missingImageUrl); return loadWithXhr.defaultLoad('Data/Images/Red16x16.png', responseType, method, data, headers, deferred); }; var policy = new DiscardMissingTileImagePolicy({ missingImageUrl : missingImageUrl, pixelsToCheck : [new Cartesian2(0, 0)] }); return pollToPromise(function() { return policy.isReady(); }).then(function() { expect(loadImage.createImage).toHaveBeenCalled(); }); }); }); describe('shouldDiscardImage', function() { it('discards an image that is identical to the missing image', function() { var promises = []; promises.push(loadImage('Data/Images/Red16x16.png')); promises.push(loadImage('Data/Images/Green4x4.png')); var missingImageUrl = 'Data/Images/Red16x16.png'; var policy = new DiscardMissingTileImagePolicy({ missingImageUrl : missingImageUrl, pixelsToCheck : [new Cartesian2(0, 0)] }); promises.push(pollToPromise(function() { return policy.isReady(); })); return when.all(promises, function(results) { var redImage = results[0]; var greenImage = results[1]; expect(policy.shouldDiscardImage(redImage)).toEqual(true); expect(policy.shouldDiscardImage(greenImage)).toEqual(false); }); }); it('discards an image that is identical to the missing image even if the missing image is transparent', function() { var promises = []; promises.push(loadImage('Data/Images/Transparent.png')); var missingImageUrl = 'Data/Images/Transparent.png'; var policy = new DiscardMissingTileImagePolicy({ missingImageUrl : missingImageUrl, pixelsToCheck : [new Cartesian2(0, 0)] }); promises.push(pollToPromise(function() { return policy.isReady(); })); return when.all(promises, function(results) { var transparentImage = results[0]; expect(policy.shouldDiscardImage(transparentImage)).toEqual(true); }); }); it('does not discard at all when the missing image is transparent and disableCheckIfAllPixelsAreTransparent is set', function() { var promises = []; promises.push(loadImage('Data/Images/Transparent.png')); var missingImageUrl = 'Data/Images/Transparent.png'; var policy = new DiscardMissingTileImagePolicy({ missingImageUrl : missingImageUrl, pixelsToCheck : [new Cartesian2(0, 0)], disableCheckIfAllPixelsAreTransparent : true }); promises.push(pollToPromise(function() { return policy.isReady(); })); return when.all(promises, function(results) { var transparentImage = results[0]; expect(policy.shouldDiscardImage(transparentImage)).toEqual(false); }); }); it('throws if called before the policy is ready', function() { var policy = new DiscardMissingTileImagePolicy({ missingImageUrl : 'Data/Images/Transparent.png', pixelsToCheck : [new Cartesian2(0, 0)], disableCheckIfAllPixelsAreTransparent : true }); expect(function() { policy.shouldDiscardImage(new Image()); }).toThrowDeveloperError(); }); }); });
5,810
1,489
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NestingContext = void 0; var React = require("react"); exports.NestingContext = React.createContext(null);
192
59
import qs from 'qs'; /** * 创建一个地址附带查询参数 * @param {String} baseUrl 基础地址 * @param {Object} params key-value 对象,选填 * @return {void} */ export default function createUrl(baseUrl, params) { const paramsStr = qs.stringify(params || {}); if (!paramsStr) { return baseUrl; } let subStr = ''; // 没有问号 if (baseUrl.lastIndexOf('?') === -1) { subStr = '?'; } else { // 最后一个字符 const lastChar = baseUrl.slice(-1); // 如果最后接在最后一个字符不是是?并且是&加上一个& if (lastChar !== '&' && lastChar !== '?') { subStr = '&'; } } return baseUrl + subStr + paramsStr; }
645
274
var path = require('path'); var webpack = require('webpack'); var HtmlWebpackPlugin = require('html-webpack-plugin'); var CopyWebpackPlugin = require('copy-webpack-plugin'); var gulpConfig = require('../.azdata/gulp-config'); var baseFolderName = 'assets'; var projRoot = path.resolve(__dirname, '..'); var commonConfig = gulpConfig.getSubmodule('commonLibrary'); var commonConfigJsEntryFolder = commonConfig.joinPathByKeys(['entry', 'js']); var frontEndConfig = gulpConfig.getSubmodule('frontEnd'); var frontEndJsEntryFolder = frontEndConfig.joinPathByKeys(['entry', 'js']); var frontEndJsEntryFilename = frontEndConfig.joinPathByKeys(['entry', 'js', 'filename']); var frontEndJsPublicFolder = frontEndConfig.joinPathByKeys(['entry', 'static']); var frontEndJsOutputFolder = frontEndConfig.joinPathByKeys(['output', 'default']); module.exports = function({ mode }) { return { mode, devtool: 'inline-source-map', entry: { app: [ path.resolve(projRoot, frontEndJsEntryFilename), ], }, output: { // path: path.resolve(projRoot, frontEndJsPublicFolder), path: path.resolve(projRoot, frontEndJsOutputFolder), pathinfo: mode === 'development', filename: baseFolderName + '/js/[name].js', publicPath: '/', }, resolve: { // extensions: ['', '.jsx', '.js', '.scss', '.css', '.json', '.md'], alias: {}, extensions: ['.js', '.jsx', '.ts', '.tsx'], }, module: { rules: [ { test: /\.(js|jsx|ts|tsx)$/, include: [ path.resolve(projRoot, frontEndJsEntryFolder), path.resolve(projRoot, commonConfigJsEntryFolder), /node_modules\/koa-compose/, ], use: [{ loader: 'babel-loader', options: { cacheDirectory: true, presets: [ ['@babel/preset-env', { targets: { browsers: ['defaults', 'not dead'], }, }], '@babel/typescript', '@babel/preset-react', ], plugins: [ '@babel/proposal-class-properties', '@babel/proposal-object-rest-spread', ], }, }], exclude: /node_modules(?!(\/|\\)koa-compose)/, }, { test: /\.css$/, use: [ 'style-loader', 'css-loader', ], }, { test: /\.(jpg|png|gif)(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: [{ loader: 'file-loader', options: { name: baseFolderName + '/images/[name].[ext]', }, }], }, { test: /\.(woff|woff2|eot|ttf|svg)(\?v=\d+\.\d+\.\d+)?$/, use: [{ loader: 'file-loader', options: { // name: baseFolderName + '/fonts/[name].[ext]', name: baseFolderName + '/fonts/[hash].[ext]', }, }], }, ], }, plugins: [ new webpack.DefinePlugin({'process.env': {'NODE_ENV': JSON.stringify(mode)}}), new CopyWebpackPlugin([ { from: path.resolve(projRoot, frontEndJsPublicFolder), to: path.resolve(projRoot, frontEndJsOutputFolder), }, ]), new HtmlWebpackPlugin({ chunks: ['app'], template: path.resolve(projRoot, frontEndJsEntryFolder, 'index.html'), filename: 'index.html', }), ], }; };
3,554
1,048
import * as tslib_1 from "tslib"; import * as React from 'react'; import { StyledIconBase } from '../../StyledIconBase'; export var Tusd = React.forwardRef(function (props, ref) { var attrs = { "fill": "currentColor", }; return (React.createElement(StyledIconBase, tslib_1.__assign({ iconAttrs: attrs, iconVerticalAlign: "middle", iconViewBox: "0 0 32 32" }, props, { ref: ref }), React.createElement("path", { d: "M16 32C7.163 32 0 24.837 0 16S7.163 0 16 0s16 7.163 16 16-7.163 16-16 16zm1.057-12.972v-5.86h.77c2.545 0 3.172-2.373 3.172-2.373h-6.683c-3.172 0-3.71 2.374-3.71 2.374h3.943v8.817s2.508-.753 2.508-2.958zm7.338 4.566c2.248-2.336 3.11-5.58 2.301-8.683a9.339 9.339 0 0 0-2.48-4.28c-.108-.106-.216-.214-.342-.32l-.108-.107a2.185 2.185 0 0 0-.234-.196l-.144-.107-.215-.16-.127-.09a4.15 4.15 0 0 1-.251-.178l-.163-.106a1.38 1.38 0 0 0-.215-.125l-.162-.107c-.072-.036-.144-.09-.216-.125l-.162-.09a2.52 2.52 0 0 0-.234-.106l-.055-.018c.198.16.395.339.575.517a8.75 8.75 0 0 1 0 12.427c-4.386 4.35-11.505 4.35-15.893 0-.162-.16-.306-.32-.467-.48l-.126-.143a5.762 5.762 0 0 1-.27-.339 11.856 11.856 0 0 0 2.176 2.995c4.584 4.546 12.026 4.546 16.61 0a.614.614 0 0 0 .202-.18zM10.4 22.386a8.168 8.168 0 0 1-.576-.517 8.758 8.758 0 0 1 0-12.439c4.391-4.354 11.516-4.354 15.907 0 .306.304.593.625.863.964a11.784 11.784 0 0 0-2.177-2.98c-4.588-4.551-12.038-4.551-16.626 0-.054.053-.108.125-.18.178-3.041 3.177-3.455 7.924-1.025 11.529.954 1.39 2.284 2.55 3.814 3.265z", key: "k0" }))); }); Tusd.displayName = 'Tusd'; export var TusdDimensions = { height: 32, width: 32 };
1,598
1,191
import NativeModule from 'module' import vm from 'vm' function createContext (context) { const sandbox = { Buffer, clearImmediate, clearInterval, clearTimeout, setImmediate, setInterval, setTimeout, console, process, __VUE_SSR_CONTEXT__: context } sandbox.global = sandbox return sandbox } export default function runInVm (code, _context = {}) { return new Promise((resolve, reject) => { const wrapper = NativeModule.wrap(code) const context = createContext(_context) const compiledWrapper = vm.runInNewContext(wrapper, context, { filename: '__vue_ssr_bundle__', displayErrors: true }) const m = { exports: {}} compiledWrapper.call(m.exports, m.exports, require, m) const res = Object.prototype.hasOwnProperty.call(m.exports, 'default') ? m.exports.default : m resolve(typeof res === 'function' ? res(_context) : res) }) }
933
288
'use strict'; const gulp = require('gulp'); const sass = require('gulp-sass'); const prefix = require('gulp-autoprefixer'); const plumber = require('gulp-plumber'); const browserSync = require('browser-sync').create(); gulp.task('sass', () =>{ gulp.src('./sass/**/*.scss') .pipe(plumber()) .pipe(sass()) .pipe(prefix("last 2 version")) .pipe(gulp.dest('./css')) .pipe(browserSync.stream()); }); gulp.task('watch', () => { //watch sass files gulp.watch('sass/**/*.scss', ['sass']); gulp.watch("./*.html").on('change', browserSync.reload); }); gulp.task('browser-sync', () =>{ browserSync.init({ server: "./" }); }); gulp.task('dev', ['browser-sync','watch']);
709
261
import style from "./ButtonA.module.css"; import React from "react"; export default function Round1(props) { return ( <button type="button" class={style.btn}> {props.text} </button> ); }
207
68
/** * Copyright 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @noflow * @providesModule ReactNativeStack-dev */ "use strict"; __DEV__ && function() { var invariant = require("fbjs/lib/invariant"), React = require("react"), warning = require("fbjs/lib/warning"), ExecutionEnvironment = require("fbjs/lib/ExecutionEnvironment"), performanceNow = require("fbjs/lib/performanceNow"), emptyObject = require("fbjs/lib/emptyObject"), UIManager = require('../ReactNative/UIManager'), checkPropTypes = require("prop-types/checkPropTypes"), shallowEqual = require("fbjs/lib/shallowEqual"); require('../Core/InitializeCore'); var RCTEventEmitter = require('../EventEmitter/RCTEventEmitter'), emptyFunction = require("fbjs/lib/emptyFunction"), deepDiffer = require('../Utilities/differ/deepDiffer'), flattenStyle = require('../StyleSheet/flattenStyle'), TextInputState = require('../Components/TextInput/TextInputState'), deepFreezeAndThrowOnMutationInDev = require('../Utilities/deepFreezeAndThrowOnMutationInDev'), instanceCache = {}, instanceProps = {}; function getRenderedHostOrTextFromComponent(component) { for (var rendered; rendered = component._renderedComponent; ) component = rendered; return component; } function precacheNode(inst, tag) { var nativeInst = getRenderedHostOrTextFromComponent(inst); instanceCache[tag] = nativeInst; } function precacheFiberNode(hostInst, tag) { instanceCache[tag] = hostInst; } function uncacheNode(inst) { var tag = inst._rootNodeID; tag && delete instanceCache[tag]; } function uncacheFiberNode(tag) { delete instanceCache[tag], delete instanceProps[tag]; } function getInstanceFromTag(tag) { return instanceCache[tag] || null; } function getTagFromInstance(inst) { var tag = "number" != typeof inst.tag ? inst._rootNodeID : inst.stateNode._nativeTag; return invariant(tag, "All native instances should have a tag."), tag; } function getFiberCurrentPropsFromNode(stateNode) { return instanceProps[stateNode._nativeTag] || null; } function updateFiberProps(tag, props) { instanceProps[tag] = props; } var ReactNativeComponentTree = { getClosestInstanceFromNode: getInstanceFromTag, getInstanceFromNode: getInstanceFromTag, getNodeFromInstance: getTagFromInstance, precacheFiberNode: precacheFiberNode, precacheNode: precacheNode, uncacheFiberNode: uncacheFiberNode, uncacheNode: uncacheNode, getFiberCurrentPropsFromNode: getFiberCurrentPropsFromNode, updateFiberProps: updateFiberProps }, ReactNativeComponentTree_1 = ReactNativeComponentTree, ReactInvalidSetStateWarningHook = {}, warning$2 = warning, processingChildContext = !1, warnInvalidSetState = function() { warning$2(!processingChildContext, "setState(...): Cannot call setState() inside getChildContext()"); }; ReactInvalidSetStateWarningHook = { onBeginProcessingChildContext: function() { processingChildContext = !0; }, onEndProcessingChildContext: function() { processingChildContext = !1; }, onSetState: function() { warnInvalidSetState(); } }; var ReactInvalidSetStateWarningHook_1 = ReactInvalidSetStateWarningHook, ReactHostOperationHistoryHook = null, history = []; ReactHostOperationHistoryHook = { onHostOperation: function(operation) { history.push(operation); }, clearHistory: function() { ReactHostOperationHistoryHook._preventClearing || (history = []); }, getHistory: function() { return history; } }; var ReactHostOperationHistoryHook_1 = ReactHostOperationHistoryHook, ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, ReactGlobalSharedState = { ReactCurrentOwner: ReactInternals.ReactCurrentOwner }; Object.assign(ReactGlobalSharedState, { ReactComponentTreeHook: ReactInternals.ReactComponentTreeHook, ReactDebugCurrentFrame: ReactInternals.ReactDebugCurrentFrame }); var ReactGlobalSharedState_1 = ReactGlobalSharedState, ReactComponentTreeHook = ReactGlobalSharedState_1.ReactComponentTreeHook, warning$1 = warning, ReactDebugTool$1 = null, hooks = [], didHookThrowForEvent = {}, callHook = function(event, fn, context, arg1, arg2, arg3, arg4, arg5) { try { fn.call(context, arg1, arg2, arg3, arg4, arg5); } catch (e) { warning$1(didHookThrowForEvent[event], "Exception thrown by hook while handling %s: %s", event, e + "\n" + e.stack), didHookThrowForEvent[event] = !0; } }, emitEvent = function(event, arg1, arg2, arg3, arg4, arg5) { for (var i = 0; i < hooks.length; i++) { var hook = hooks[i], fn = hook[event]; fn && callHook(event, fn, hook, arg1, arg2, arg3, arg4, arg5); } }, isProfiling = !1, flushHistory = [], lifeCycleTimerStack = [], currentFlushNesting = 0, currentFlushMeasurements = [], currentFlushStartTime = 0, currentTimerDebugID = null, currentTimerStartTime = 0, currentTimerNestedFlushDuration = 0, currentTimerType = null, lifeCycleTimerHasWarned = !1, clearHistory = function() { ReactComponentTreeHook.purgeUnmountedComponents(), ReactHostOperationHistoryHook_1.clearHistory(); }, getTreeSnapshot = function(registeredIDs) { return registeredIDs.reduce(function(tree, id) { var ownerID = ReactComponentTreeHook.getOwnerID(id), parentID = ReactComponentTreeHook.getParentID(id); return tree[id] = { displayName: ReactComponentTreeHook.getDisplayName(id), text: ReactComponentTreeHook.getText(id), updateCount: ReactComponentTreeHook.getUpdateCount(id), childIDs: ReactComponentTreeHook.getChildIDs(id), ownerID: ownerID || parentID && ReactComponentTreeHook.getOwnerID(parentID) || 0, parentID: parentID }, tree; }, {}); }, resetMeasurements = function() { var previousStartTime = currentFlushStartTime, previousMeasurements = currentFlushMeasurements, previousOperations = ReactHostOperationHistoryHook_1.getHistory(); if (0 === currentFlushNesting) return currentFlushStartTime = 0, currentFlushMeasurements = [], void clearHistory(); if (previousMeasurements.length || previousOperations.length) { var registeredIDs = ReactComponentTreeHook.getRegisteredIDs(); flushHistory.push({ duration: performanceNow() - previousStartTime, measurements: previousMeasurements || [], operations: previousOperations || [], treeSnapshot: getTreeSnapshot(registeredIDs) }); } clearHistory(), currentFlushStartTime = performanceNow(), currentFlushMeasurements = []; }, checkDebugID = function(debugID) { arguments.length > 1 && void 0 !== arguments[1] && arguments[1] && 0 === debugID || debugID || warning$1(!1, "ReactDebugTool: debugID may not be empty."); }, beginLifeCycleTimer = function(debugID, timerType) { 0 !== currentFlushNesting && (currentTimerType && !lifeCycleTimerHasWarned && (warning$1(!1, "There is an internal error in the React performance measurement code." + "\n\nDid not expect %s timer to start while %s timer is still in " + "progress for %s instance.", timerType, currentTimerType || "no", debugID === currentTimerDebugID ? "the same" : "another"), lifeCycleTimerHasWarned = !0), currentTimerStartTime = performanceNow(), currentTimerNestedFlushDuration = 0, currentTimerDebugID = debugID, currentTimerType = timerType); }, endLifeCycleTimer = function(debugID, timerType) { 0 !== currentFlushNesting && (currentTimerType === timerType || lifeCycleTimerHasWarned || (warning$1(!1, "There is an internal error in the React performance measurement code. " + "We did not expect %s timer to stop while %s timer is still in " + "progress for %s instance. Please report this as a bug in React.", timerType, currentTimerType || "no", debugID === currentTimerDebugID ? "the same" : "another"), lifeCycleTimerHasWarned = !0), isProfiling && currentFlushMeasurements.push({ timerType: timerType, instanceID: debugID, duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration }), currentTimerStartTime = 0, currentTimerNestedFlushDuration = 0, currentTimerDebugID = null, currentTimerType = null); }, pauseCurrentLifeCycleTimer = function() { var currentTimer = { startTime: currentTimerStartTime, nestedFlushStartTime: performanceNow(), debugID: currentTimerDebugID, timerType: currentTimerType }; lifeCycleTimerStack.push(currentTimer), currentTimerStartTime = 0, currentTimerNestedFlushDuration = 0, currentTimerDebugID = null, currentTimerType = null; }, resumeCurrentLifeCycleTimer = function() { var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop(), startTime = _lifeCycleTimerStack$.startTime, nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime, debugID = _lifeCycleTimerStack$.debugID, timerType = _lifeCycleTimerStack$.timerType, nestedFlushDuration = performanceNow() - nestedFlushStartTime; currentTimerStartTime = startTime, currentTimerNestedFlushDuration += nestedFlushDuration, currentTimerDebugID = debugID, currentTimerType = timerType; }, lastMarkTimeStamp = 0, canUsePerformanceMeasure = "undefined" != typeof performance && "function" == typeof performance.mark && "function" == typeof performance.clearMarks && "function" == typeof performance.measure && "function" == typeof performance.clearMeasures, shouldMark = function(debugID) { if (!isProfiling || !canUsePerformanceMeasure) return !1; var element = ReactComponentTreeHook.getElement(debugID); return null != element && "object" == typeof element && !("string" == typeof element.type); }, markBegin = function(debugID, markType) { if (shouldMark(debugID)) { var markName = debugID + "::" + markType; lastMarkTimeStamp = performanceNow(), performance.mark(markName); } }, markEnd = function(debugID, markType) { if (shouldMark(debugID)) { var markName = debugID + "::" + markType, displayName = ReactComponentTreeHook.getDisplayName(debugID) || "Unknown"; if (performanceNow() - lastMarkTimeStamp > .1) { var measurementName = displayName + " [" + markType + "]"; performance.measure(measurementName, markName); } performance.clearMarks(markName), measurementName && performance.clearMeasures(measurementName); } }; ReactDebugTool$1 = { addHook: function(hook) { hooks.push(hook); }, removeHook: function(hook) { for (var i = 0; i < hooks.length; i++) hooks[i] === hook && (hooks.splice(i, 1), i--); }, isProfiling: function() { return isProfiling; }, beginProfiling: function() { isProfiling || (isProfiling = !0, flushHistory.length = 0, resetMeasurements(), ReactDebugTool$1.addHook(ReactHostOperationHistoryHook_1)); }, endProfiling: function() { isProfiling && (isProfiling = !1, resetMeasurements(), ReactDebugTool$1.removeHook(ReactHostOperationHistoryHook_1)); }, getFlushHistory: function() { return flushHistory; }, onBeginFlush: function() { currentFlushNesting++, resetMeasurements(), pauseCurrentLifeCycleTimer(), emitEvent("onBeginFlush"); }, onEndFlush: function() { resetMeasurements(), currentFlushNesting--, resumeCurrentLifeCycleTimer(), emitEvent("onEndFlush"); }, onBeginLifeCycleTimer: function(debugID, timerType) { checkDebugID(debugID), emitEvent("onBeginLifeCycleTimer", debugID, timerType), markBegin(debugID, timerType), beginLifeCycleTimer(debugID, timerType); }, onEndLifeCycleTimer: function(debugID, timerType) { checkDebugID(debugID), endLifeCycleTimer(debugID, timerType), markEnd(debugID, timerType), emitEvent("onEndLifeCycleTimer", debugID, timerType); }, onBeginProcessingChildContext: function() { emitEvent("onBeginProcessingChildContext"); }, onEndProcessingChildContext: function() { emitEvent("onEndProcessingChildContext"); }, onHostOperation: function(operation) { checkDebugID(operation.instanceID), emitEvent("onHostOperation", operation); }, onSetState: function() { emitEvent("onSetState"); }, onSetChildren: function(debugID, childDebugIDs) { checkDebugID(debugID), childDebugIDs.forEach(checkDebugID), emitEvent("onSetChildren", debugID, childDebugIDs); }, onBeforeMountComponent: function(debugID, element, parentDebugID) { checkDebugID(debugID), checkDebugID(parentDebugID, !0), emitEvent("onBeforeMountComponent", debugID, element, parentDebugID), markBegin(debugID, "mount"); }, onMountComponent: function(debugID) { checkDebugID(debugID), markEnd(debugID, "mount"), emitEvent("onMountComponent", debugID); }, onBeforeUpdateComponent: function(debugID, element) { checkDebugID(debugID), emitEvent("onBeforeUpdateComponent", debugID, element), markBegin(debugID, "update"); }, onUpdateComponent: function(debugID) { checkDebugID(debugID), markEnd(debugID, "update"), emitEvent("onUpdateComponent", debugID); }, onBeforeUnmountComponent: function(debugID) { checkDebugID(debugID), emitEvent("onBeforeUnmountComponent", debugID), markBegin(debugID, "unmount"); }, onUnmountComponent: function(debugID) { checkDebugID(debugID), markEnd(debugID, "unmount"), emitEvent("onUnmountComponent", debugID); }, onTestEvent: function() { emitEvent("onTestEvent"); } }, ReactDebugTool$1.addHook(ReactInvalidSetStateWarningHook_1), ReactDebugTool$1.addHook(ReactComponentTreeHook), /[?&]react_perf\b/.test(ExecutionEnvironment.canUseDOM && window.location.href || "") && ReactDebugTool$1.beginProfiling(); var ReactDebugTool_1 = ReactDebugTool$1, debugTool = null; debugTool = ReactDebugTool_1; var ReactInstrumentation = { debugTool: debugTool }; function ReactNativeContainerInfo(tag) { return { _tag: tag }; } var ReactNativeContainerInfo_1 = ReactNativeContainerInfo, INITIAL_TAG_COUNT = 1, ReactNativeTagHandles = { tagsStartAt: INITIAL_TAG_COUNT, tagCount: INITIAL_TAG_COUNT, allocateTag: function() { for (;this.reactTagIsNativeTopRootID(ReactNativeTagHandles.tagCount); ) ReactNativeTagHandles.tagCount++; var tag = ReactNativeTagHandles.tagCount; return ReactNativeTagHandles.tagCount++, tag; }, assertRootTag: function(tag) { invariant(this.reactTagIsNativeTopRootID(tag), "Expect a native root tag, instead got %s", tag); }, reactTagIsNativeTopRootID: function(reactTag) { return reactTag % 10 == 1; } }, ReactNativeTagHandles_1 = ReactNativeTagHandles, ReactTypeOfWork = { IndeterminateComponent: 0, FunctionalComponent: 1, ClassComponent: 2, HostRoot: 3, HostPortal: 4, HostComponent: 5, HostText: 6, CoroutineComponent: 7, CoroutineHandlerPhase: 8, YieldComponent: 9, Fragment: 10 }, ClassComponent = ReactTypeOfWork.ClassComponent; function isValidOwner(object) { return !(!object || "function" != typeof object.attachRef || "function" != typeof object.detachRef); } var ReactOwner = { addComponentAsRefTo: function(component, ref, owner) { if (owner && owner.tag === ClassComponent) { var inst = owner.stateNode; (inst.refs === emptyObject ? inst.refs = {} : inst.refs)[ref] = component.getPublicInstance(); } else invariant(isValidOwner(owner), "addComponentAsRefTo(...): Only a ReactOwner can have refs. You might " + "be adding a ref to a component that was not created inside a component's " + "`render` method, or you have multiple copies of React loaded " + "(details: https://fb.me/react-refs-must-have-owner)."), owner.attachRef(ref, component); }, removeComponentAsRefFrom: function(component, ref, owner) { if (owner && owner.tag === ClassComponent) { var inst = owner.stateNode; inst && inst.refs[ref] === component.getPublicInstance() && delete inst.refs[ref]; } else { invariant(isValidOwner(owner), "removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might " + "be removing a ref to a component that was not created inside a component's " + "`render` method, or you have multiple copies of React loaded " + "(details: https://fb.me/react-refs-must-have-owner)."); var ownerPublicInstance = owner.getPublicInstance(); ownerPublicInstance && ownerPublicInstance.refs[ref] === component.getPublicInstance() && owner.detachRef(ref); } } }, ReactOwner_1 = ReactOwner, ReactCompositeComponentTypes$1 = { ImpureClass: 0, PureClass: 1, StatelessFunctional: 2 }, ReactRef = {}, ReactCompositeComponentTypes = ReactCompositeComponentTypes$1, _require = ReactGlobalSharedState_1, ReactComponentTreeHook$1 = _require.ReactComponentTreeHook, warning$4 = warning, warnedAboutStatelessRefs = {}; function attachRef(ref, component, owner) { if (component._compositeType === ReactCompositeComponentTypes.StatelessFunctional) { var info = "", ownerName = void 0; owner && ("function" == typeof owner.getName && (ownerName = owner.getName()), ownerName && (info += "\n\nCheck the render method of `" + ownerName + "`.")); var warningKey = ownerName || component._debugID, element = component._currentElement; element && element._source && (warningKey = element._source.fileName + ":" + element._source.lineNumber), warnedAboutStatelessRefs[warningKey] || (warnedAboutStatelessRefs[warningKey] = !0, warning$4(!1, "Stateless function components cannot be given refs. " + "Attempts to access this ref will fail.%s%s", info, ReactComponentTreeHook$1.getStackAddendumByID(component._debugID))); } "function" == typeof ref ? ref(component.getPublicInstance()) : ReactOwner_1.addComponentAsRefTo(component, ref, owner); } function detachRef(ref, component, owner) { "function" == typeof ref ? ref(null) : ReactOwner_1.removeComponentAsRefFrom(component, ref, owner); } ReactRef.attachRefs = function(instance, element) { if (null !== element && "object" == typeof element) { var ref = element.ref; null != ref && attachRef(ref, instance, element._owner); } }, ReactRef.shouldUpdateRefs = function(prevElement, nextElement) { var prevRef = null, prevOwner = null; null !== prevElement && "object" == typeof prevElement && (prevRef = prevElement.ref, prevOwner = prevElement._owner); var nextRef = null, nextOwner = null; return null !== nextElement && "object" == typeof nextElement && (nextRef = nextElement.ref, nextOwner = nextElement._owner), prevRef !== nextRef || "string" == typeof nextRef && nextOwner !== prevOwner; }, ReactRef.detachRefs = function(instance, element) { if (null !== element && "object" == typeof element) { var ref = element.ref; null != ref && detachRef(ref, instance, element._owner); } }; var ReactRef_1 = ReactRef; function attachRefs() { ReactRef_1.attachRefs(this, this._currentElement); } var ReactReconciler = { mountComponent: function(internalInstance, transaction, hostParent, hostContainerInfo, context, parentDebugID) { 0 !== internalInstance._debugID && ReactInstrumentation.debugTool.onBeforeMountComponent(internalInstance._debugID, internalInstance._currentElement, parentDebugID); var markup = internalInstance.mountComponent(transaction, hostParent, hostContainerInfo, context, parentDebugID); return internalInstance._currentElement && null != internalInstance._currentElement.ref && transaction.getReactMountReady().enqueue(attachRefs, internalInstance), 0 !== internalInstance._debugID && ReactInstrumentation.debugTool.onMountComponent(internalInstance._debugID), markup; }, getHostNode: function(internalInstance) { return internalInstance.getHostNode(); }, unmountComponent: function(internalInstance, safely, skipLifecycle) { 0 !== internalInstance._debugID && ReactInstrumentation.debugTool.onBeforeUnmountComponent(internalInstance._debugID), ReactRef_1.detachRefs(internalInstance, internalInstance._currentElement), internalInstance.unmountComponent(safely, skipLifecycle), 0 !== internalInstance._debugID && ReactInstrumentation.debugTool.onUnmountComponent(internalInstance._debugID); }, receiveComponent: function(internalInstance, nextElement, transaction, context) { var prevElement = internalInstance._currentElement; if (nextElement !== prevElement || context !== internalInstance._context) { 0 !== internalInstance._debugID && ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, nextElement); var refsChanged = ReactRef_1.shouldUpdateRefs(prevElement, nextElement); refsChanged && ReactRef_1.detachRefs(internalInstance, prevElement), internalInstance.receiveComponent(nextElement, transaction, context), refsChanged && internalInstance._currentElement && null != internalInstance._currentElement.ref && transaction.getReactMountReady().enqueue(attachRefs, internalInstance), 0 !== internalInstance._debugID && ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID); } }, performUpdateIfNecessary: function(internalInstance, transaction, updateBatchNumber) { if (internalInstance._updateBatchNumber !== updateBatchNumber) return void warning(null == internalInstance._updateBatchNumber || internalInstance._updateBatchNumber === updateBatchNumber + 1, "performUpdateIfNecessary: Unexpected batch number (current %s, " + "pending %s)", updateBatchNumber, internalInstance._updateBatchNumber); 0 !== internalInstance._debugID && ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, internalInstance._currentElement), internalInstance.performUpdateIfNecessary(transaction), 0 !== internalInstance._debugID && ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID); } }, ReactReconciler_1 = ReactReconciler, ReactInstanceMap = { remove: function(key) { key._reactInternalInstance = void 0; }, get: function(key) { return key._reactInternalInstance; }, has: function(key) { return void 0 !== key._reactInternalInstance; }, set: function(key, value) { key._reactInternalInstance = value; } }, ReactInstanceMap_1 = ReactInstanceMap, oneArgumentPooler = function(copyFieldsFrom) { var Klass = this; if (Klass.instancePool.length) { var instance = Klass.instancePool.pop(); return Klass.call(instance, copyFieldsFrom), instance; } return new Klass(copyFieldsFrom); }, twoArgumentPooler = function(a1, a2) { var Klass = this; if (Klass.instancePool.length) { var instance = Klass.instancePool.pop(); return Klass.call(instance, a1, a2), instance; } return new Klass(a1, a2); }, threeArgumentPooler = function(a1, a2, a3) { var Klass = this; if (Klass.instancePool.length) { var instance = Klass.instancePool.pop(); return Klass.call(instance, a1, a2, a3), instance; } return new Klass(a1, a2, a3); }, fourArgumentPooler = function(a1, a2, a3, a4) { var Klass = this; if (Klass.instancePool.length) { var instance = Klass.instancePool.pop(); return Klass.call(instance, a1, a2, a3, a4), instance; } return new Klass(a1, a2, a3, a4); }, standardReleaser = function(instance) { var Klass = this; invariant(instance instanceof Klass, "Trying to release an instance into a pool of a different type."), instance.destructor(), Klass.instancePool.length < Klass.poolSize && Klass.instancePool.push(instance); }, DEFAULT_POOL_SIZE = 10, DEFAULT_POOLER = oneArgumentPooler, addPoolingTo = function(CopyConstructor, pooler) { var NewKlass = CopyConstructor; return NewKlass.instancePool = [], NewKlass.getPooled = pooler || DEFAULT_POOLER, NewKlass.poolSize || (NewKlass.poolSize = DEFAULT_POOL_SIZE), NewKlass.release = standardReleaser, NewKlass; }, PooledClass = { addPoolingTo: addPoolingTo, oneArgumentPooler: oneArgumentPooler, twoArgumentPooler: twoArgumentPooler, threeArgumentPooler: threeArgumentPooler, fourArgumentPooler: fourArgumentPooler }, PooledClass_1 = PooledClass, OBSERVED_ERROR = {}, TransactionImpl = { reinitializeTransaction: function() { this.transactionWrappers = this.getTransactionWrappers(), this.wrapperInitData ? this.wrapperInitData.length = 0 : this.wrapperInitData = [], this._isInTransaction = !1; }, _isInTransaction: !1, getTransactionWrappers: null, isInTransaction: function() { return !!this._isInTransaction; }, perform: function(method, scope, a, b, c, d, e, f) { invariant(!this.isInTransaction(), "Transaction.perform(...): Cannot initialize a transaction when there " + "is already an outstanding transaction."); var errorThrown, ret; try { this._isInTransaction = !0, errorThrown = !0, this.initializeAll(0), ret = method.call(scope, a, b, c, d, e, f), errorThrown = !1; } finally { try { if (errorThrown) try { this.closeAll(0); } catch (err) {} else this.closeAll(0); } finally { this._isInTransaction = !1; } } return ret; }, initializeAll: function(startIndex) { for (var transactionWrappers = this.transactionWrappers, i = startIndex; i < transactionWrappers.length; i++) { var wrapper = transactionWrappers[i]; try { this.wrapperInitData[i] = OBSERVED_ERROR, this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null; } finally { if (this.wrapperInitData[i] === OBSERVED_ERROR) try { this.initializeAll(i + 1); } catch (err) {} } } }, closeAll: function(startIndex) { invariant(this.isInTransaction(), "Transaction.closeAll(): Cannot close transaction when none are open."); for (var transactionWrappers = this.transactionWrappers, i = startIndex; i < transactionWrappers.length; i++) { var errorThrown, wrapper = transactionWrappers[i], initData = this.wrapperInitData[i]; try { errorThrown = !0, initData !== OBSERVED_ERROR && wrapper.close && wrapper.close.call(this, initData), errorThrown = !1; } finally { if (errorThrown) try { this.closeAll(i + 1); } catch (e) {} } } this.wrapperInitData.length = 0; } }, Transaction = TransactionImpl, dirtyComponents = [], updateBatchNumber = 0, batchingStrategy = null; function ensureInjected() { invariant(ReactUpdates.ReactReconcileTransaction && batchingStrategy, "ReactUpdates: must inject a reconcile transaction class and batching " + "strategy"); } var NESTED_UPDATES = { initialize: function() { this.dirtyComponentsLength = dirtyComponents.length; }, close: function() { this.dirtyComponentsLength !== dirtyComponents.length ? (dirtyComponents.splice(0, this.dirtyComponentsLength), flushBatchedUpdates()) : dirtyComponents.length = 0; } }, TRANSACTION_WRAPPERS = [ NESTED_UPDATES ]; function ReactUpdatesFlushTransaction() { this.reinitializeTransaction(), this.dirtyComponentsLength = null, this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled(!0); } Object.assign(ReactUpdatesFlushTransaction.prototype, Transaction, { getTransactionWrappers: function() { return TRANSACTION_WRAPPERS; }, destructor: function() { this.dirtyComponentsLength = null, ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction), this.reconcileTransaction = null; }, perform: function(method, scope, a) { return Transaction.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a); } }), PooledClass_1.addPoolingTo(ReactUpdatesFlushTransaction); function batchedUpdates(callback, a, b, c, d, e) { return ensureInjected(), batchingStrategy.batchedUpdates(callback, a, b, c, d, e); } function mountOrderComparator(c1, c2) { return c1._mountOrder - c2._mountOrder; } function runBatchedUpdates(transaction) { var len = transaction.dirtyComponentsLength; invariant(len === dirtyComponents.length, "Expected flush transaction's stored dirty-components length (%s) to " + "match dirty-components array length (%s).", len, dirtyComponents.length), dirtyComponents.sort(mountOrderComparator), updateBatchNumber++; for (var i = 0; i < len; i++) { var component = dirtyComponents[i]; ReactReconciler_1.performUpdateIfNecessary(component, transaction.reconcileTransaction, updateBatchNumber); } } var flushBatchedUpdates = function() { for (;dirtyComponents.length; ) { var transaction = ReactUpdatesFlushTransaction.getPooled(); transaction.perform(runBatchedUpdates, null, transaction), ReactUpdatesFlushTransaction.release(transaction); } }; function enqueueUpdate$1(component) { if (ensureInjected(), !batchingStrategy.isBatchingUpdates) return void batchingStrategy.batchedUpdates(enqueueUpdate$1, component); dirtyComponents.push(component), null == component._updateBatchNumber && (component._updateBatchNumber = updateBatchNumber + 1); } var ReactUpdatesInjection = { injectReconcileTransaction: function(ReconcileTransaction) { invariant(ReconcileTransaction, "ReactUpdates: must provide a reconcile transaction class"), ReactUpdates.ReactReconcileTransaction = ReconcileTransaction; }, injectBatchingStrategy: function(_batchingStrategy) { invariant(_batchingStrategy, "ReactUpdates: must provide a batching strategy"), invariant("function" == typeof _batchingStrategy.batchedUpdates, "ReactUpdates: must provide a batchedUpdates() function"), invariant("boolean" == typeof _batchingStrategy.isBatchingUpdates, "ReactUpdates: must provide an isBatchingUpdates boolean attribute"), batchingStrategy = _batchingStrategy; }, getBatchingStrategy: function() { return batchingStrategy; } }, ReactUpdates = { ReactReconcileTransaction: null, batchedUpdates: batchedUpdates, enqueueUpdate: enqueueUpdate$1, flushBatchedUpdates: flushBatchedUpdates, injection: ReactUpdatesInjection }, ReactUpdates_1 = ReactUpdates, ReactCurrentOwner = ReactGlobalSharedState_1.ReactCurrentOwner, warning$5 = warning, warnOnInvalidCallback = function(callback, callerName) { warning$5(null === callback || "function" == typeof callback, "%s(...): Expected the last optional `callback` argument to be a " + "function. Instead received: %s.", callerName, "" + callback); }; function enqueueUpdate(internalInstance) { ReactUpdates_1.enqueueUpdate(internalInstance); } function getInternalInstanceReadyForUpdate(publicInstance, callerName) { var internalInstance = ReactInstanceMap_1.get(publicInstance); if (!internalInstance) { var ctor = publicInstance.constructor; return warning$5(!1, "Can only update a mounted or mounting component. This usually means " + "you called setState, replaceState, or forceUpdate on an unmounted " + "component. This is a no-op.\n\nPlease check the code for the " + "%s component.", ctor && (ctor.displayName || ctor.name) || "ReactClass"), null; } return warning$5(null == ReactCurrentOwner.current, "Cannot update during an existing state transition (such as within " + "`render` or another component's constructor). Render methods should " + "be a pure function of props and state; constructor side-effects are " + "an anti-pattern, but can be moved to `componentWillMount`."), internalInstance; } var ReactUpdateQueue = { isMounted: function(publicInstance) { var owner = ReactCurrentOwner.current; null !== owner && (warning$5(owner._warnedAboutRefsInRender, "%s is accessing isMounted inside its render() function. " + "render() should be a pure function of props and state. It should " + "never access something that requires stale data from the previous " + "render, such as refs. Move this logic to componentDidMount and " + "componentDidUpdate instead.", owner.getName() || "A component"), owner._warnedAboutRefsInRender = !0); var internalInstance = ReactInstanceMap_1.get(publicInstance); return !!internalInstance && !!internalInstance._renderedComponent; }, enqueueCallbackInternal: function(internalInstance, callback) { internalInstance._pendingCallbacks ? internalInstance._pendingCallbacks.push(callback) : internalInstance._pendingCallbacks = [ callback ], enqueueUpdate(internalInstance); }, enqueueForceUpdate: function(publicInstance, callback, callerName) { var internalInstance = getInternalInstanceReadyForUpdate(publicInstance); internalInstance && (callback = void 0 === callback ? null : callback, null !== callback && (warnOnInvalidCallback(callback, callerName), internalInstance._pendingCallbacks ? internalInstance._pendingCallbacks.push(callback) : internalInstance._pendingCallbacks = [ callback ]), internalInstance._pendingForceUpdate = !0, enqueueUpdate(internalInstance)); }, enqueueReplaceState: function(publicInstance, completeState, callback, callerName) { var internalInstance = getInternalInstanceReadyForUpdate(publicInstance); internalInstance && (internalInstance._pendingStateQueue = [ completeState ], internalInstance._pendingReplaceState = !0, callback = void 0 === callback ? null : callback, null !== callback && (warnOnInvalidCallback(callback, callerName), internalInstance._pendingCallbacks ? internalInstance._pendingCallbacks.push(callback) : internalInstance._pendingCallbacks = [ callback ]), enqueueUpdate(internalInstance)); }, enqueueSetState: function(publicInstance, partialState, callback, callerName) { ReactInstrumentation.debugTool.onSetState(), warning$5(null != partialState, "setState(...): You passed an undefined or null state object; " + "instead, use forceUpdate()."); var internalInstance = getInternalInstanceReadyForUpdate(publicInstance); if (internalInstance) { (internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = [])).push(partialState), callback = void 0 === callback ? null : callback, null !== callback && (warnOnInvalidCallback(callback, callerName), internalInstance._pendingCallbacks ? internalInstance._pendingCallbacks.push(callback) : internalInstance._pendingCallbacks = [ callback ]), enqueueUpdate(internalInstance); } }, enqueueElementInternal: function(internalInstance, nextElement, nextContext) { internalInstance._pendingElement = nextElement, internalInstance._context = nextContext, enqueueUpdate(internalInstance); } }, ReactUpdateQueue_1 = ReactUpdateQueue, injected = !1, ReactComponentEnvironment = { replaceNodeWithMarkup: null, processChildrenUpdates: null, injection: { injectEnvironment: function(environment) { invariant(!injected, "ReactCompositeComponent: injectEnvironment() can only be called once."), ReactComponentEnvironment.replaceNodeWithMarkup = environment.replaceNodeWithMarkup, ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates, injected = !0; } } }, ReactComponentEnvironment_1 = ReactComponentEnvironment, ReactErrorUtils = { _caughtError: null, _hasCaughtError: !1, _rethrowError: null, _hasRethrowError: !1, injection: { injectErrorUtils: function(injectedErrorUtils) { invariant("function" == typeof injectedErrorUtils.invokeGuardedCallback, "Injected invokeGuardedCallback() must be a function."), invokeGuardedCallback = injectedErrorUtils.invokeGuardedCallback; } }, invokeGuardedCallback: function(name, func, context, a, b, c, d, e, f) { invokeGuardedCallback.apply(ReactErrorUtils, arguments); }, invokeGuardedCallbackAndCatchFirstError: function(name, func, context, a, b, c, d, e, f) { if (ReactErrorUtils.invokeGuardedCallback.apply(this, arguments), ReactErrorUtils.hasCaughtError()) { var error = ReactErrorUtils.clearCaughtError(); ReactErrorUtils._hasRethrowError || (ReactErrorUtils._hasRethrowError = !0, ReactErrorUtils._rethrowError = error); } }, rethrowCaughtError: function() { return rethrowCaughtError.apply(ReactErrorUtils, arguments); }, hasCaughtError: function() { return ReactErrorUtils._hasCaughtError; }, clearCaughtError: function() { if (ReactErrorUtils._hasCaughtError) { var error = ReactErrorUtils._caughtError; return ReactErrorUtils._caughtError = null, ReactErrorUtils._hasCaughtError = !1, error; } invariant(!1, "clearCaughtError was called but no error was captured. This error " + "is likely caused by a bug in React. Please file an issue."); } }, invokeGuardedCallback = function(name, func, context, a, b, c, d, e, f) { ReactErrorUtils._hasCaughtError = !1, ReactErrorUtils._caughtError = null; var funcArgs = Array.prototype.slice.call(arguments, 3); try { func.apply(context, funcArgs); } catch (error) { ReactErrorUtils._caughtError = error, ReactErrorUtils._hasCaughtError = !0; } }; if ("undefined" != typeof window && "function" == typeof window.dispatchEvent && "undefined" != typeof document && "function" == typeof document.createEvent) { var fakeNode = document.createElement("react"); invokeGuardedCallback = function(name, func, context, a, b, c, d, e, f) { var didError = !0, funcArgs = Array.prototype.slice.call(arguments, 3); function callCallback() { fakeNode.removeEventListener(evtType, callCallback, !1), func.apply(context, funcArgs), didError = !1; } var error = void 0, didSetError = !1, isCrossOriginError = !1; function onError(event) { error = event.error, didSetError = !0, null === error && 0 === event.colno && 0 === event.lineno && (isCrossOriginError = !0); } var evtType = "react-" + (name || "invokeguardedcallback"); window.addEventListener("error", onError), fakeNode.addEventListener(evtType, callCallback, !1); var evt = document.createEvent("Event"); evt.initEvent(evtType, !1, !1), fakeNode.dispatchEvent(evt), didError ? (didSetError ? isCrossOriginError && (error = new Error("A cross-origin error was thrown. React doesn't have access to " + "the actual error because it catches errors using a global " + 'error handler, in order to preserve the "Pause on exceptions" ' + "behavior of the DevTools. This is only an issue in DEV-mode; " + "in production, React uses a normal try-catch statement.\n\n" + "If you are using React from a CDN, ensure that the <script> tag " + "has a `crossorigin` attribute, and that it is served with the " + "`Access-Control-Allow-Origin: *` HTTP header. " + "See https://fb.me/react-cdn-crossorigin")) : error = new Error("An error was thrown inside one of your components, but React " + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + "your browser. Try triggering the error in production mode, " + "or switching to a modern browser. If you suspect that this is " + "actually an issue with React, please file an issue."), ReactErrorUtils._hasCaughtError = !0, ReactErrorUtils._caughtError = error) : (ReactErrorUtils._hasCaughtError = !1, ReactErrorUtils._caughtError = null), window.removeEventListener("error", onError); }; } var rethrowCaughtError = function() { if (ReactErrorUtils._hasRethrowError) { var error = ReactErrorUtils._rethrowError; throw ReactErrorUtils._rethrowError = null, ReactErrorUtils._hasRethrowError = !1, error; } }, ReactErrorUtils_1 = ReactErrorUtils, ReactNodeTypes = { HOST: 0, COMPOSITE: 1, EMPTY: 2, getType: function(node) { return null === node || !1 === node ? ReactNodeTypes.EMPTY : React.isValidElement(node) ? "function" == typeof node.type ? ReactNodeTypes.COMPOSITE : ReactNodeTypes.HOST : void invariant(!1, "Unexpected node: %s", node); } }, ReactNodeTypes_1 = ReactNodeTypes, ReactDebugCurrentStack$1 = {}, _require$2 = ReactGlobalSharedState_1, ReactComponentTreeHook$2 = _require$2.ReactComponentTreeHook, getStackAddendumByID = ReactComponentTreeHook$2.getStackAddendumByID, getCurrentStackAddendum = ReactComponentTreeHook$2.getCurrentStackAddendum; ReactDebugCurrentStack$1.current = null, ReactDebugCurrentStack$1.getStackAddendum = function() { var current = ReactDebugCurrentStack$1.current; return null !== current ? getStackAddendumByID(current) : getCurrentStackAddendum(); }; var ReactDebugCurrentStack_1 = ReactDebugCurrentStack$1; function shouldUpdateReactComponent(prevElement, nextElement) { var prevEmpty = null === prevElement || !1 === prevElement, nextEmpty = null === nextElement || !1 === nextElement; if (prevEmpty || nextEmpty) return prevEmpty === nextEmpty; var prevType = typeof prevElement, nextType = typeof nextElement; return "string" === prevType || "number" === prevType ? "string" === nextType || "number" === nextType : "object" === nextType && prevElement.type === nextElement.type && prevElement.key === nextElement.key; } var shouldUpdateReactComponent_1 = shouldUpdateReactComponent, ReactCurrentOwner$1 = ReactGlobalSharedState_1.ReactCurrentOwner, _require2 = ReactGlobalSharedState_1, ReactDebugCurrentFrame = _require2.ReactDebugCurrentFrame, ReactDebugCurrentStack = ReactDebugCurrentStack_1, warningAboutMissingGetChildContext = {}; function StatelessComponent(Component) {} StatelessComponent.prototype.render = function() { return (0, ReactInstanceMap_1.get(this)._currentElement.type)(this.props, this.context, this.updater); }; function shouldConstruct(Component) { return !(!Component.prototype || !Component.prototype.isReactComponent); } function isPureComponent(Component) { return !(!Component.prototype || !Component.prototype.isPureReactComponent); } function measureLifeCyclePerf(fn, debugID, timerType) { if (0 === debugID) return fn(); ReactInstrumentation.debugTool.onBeginLifeCycleTimer(debugID, timerType); try { return fn(); } finally { ReactInstrumentation.debugTool.onEndLifeCycleTimer(debugID, timerType); } } var emptyComponentFactory, nextMountID = 1, ReactCompositeComponent = { construct: function(element) { this._currentElement = element, this._rootNodeID = 0, this._compositeType = null, this._instance = null, this._hostParent = null, this._hostContainerInfo = null, this._updateBatchNumber = null, this._pendingElement = null, this._pendingStateQueue = null, this._pendingReplaceState = !1, this._pendingForceUpdate = !1, this._renderedNodeType = null, this._renderedComponent = null, this._context = null, this._mountOrder = 0, this._topLevelWrapper = null, this._pendingCallbacks = null, this._calledComponentWillUnmount = !1, this._warnedAboutRefsInRender = !1; }, mountComponent: function(transaction, hostParent, hostContainerInfo, context) { var _this = this; this._context = context, this._mountOrder = nextMountID++, this._hostParent = hostParent, this._hostContainerInfo = hostContainerInfo; var renderedElement, publicProps = this._currentElement.props, publicContext = this._processContext(context), Component = this._currentElement.type, updateQueue = transaction.getUpdateQueue(), doConstruct = shouldConstruct(Component), inst = this._constructComponent(doConstruct, publicProps, publicContext, updateQueue); doConstruct || null != inst && null != inst.render ? isPureComponent(Component) ? this._compositeType = ReactCompositeComponentTypes$1.PureClass : this._compositeType = ReactCompositeComponentTypes$1.ImpureClass : (renderedElement = inst, warning(!Component.childContextTypes, "%s(...): childContextTypes cannot be defined on a functional component.", Component.displayName || Component.name || "Component"), invariant(null === inst || !1 === inst || React.isValidElement(inst), "%s(...): A valid React element (or null) must be returned. You may have " + "returned undefined, an array or some other invalid object.", Component.displayName || Component.name || "Component"), inst = new StatelessComponent(Component), this._compositeType = ReactCompositeComponentTypes$1.StatelessFunctional), null == inst.render && warning(!1, "%s(...): No `render` method found on the returned component " + "instance: you may have forgotten to define `render`.", Component.displayName || Component.name || "Component"); var propsMutated = inst.props !== publicProps, componentName = Component.displayName || Component.name || "Component"; warning(void 0 === inst.props || !propsMutated, "%s(...): When calling super() in `%s`, make sure to pass " + "up the same props that your component's constructor was passed.", componentName, componentName), inst.props = publicProps, inst.context = publicContext, inst.refs = emptyObject, inst.updater = updateQueue, this._instance = inst, ReactInstanceMap_1.set(inst, this), warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved || inst.state, "getInitialState was defined on %s, a plain JavaScript class. " + "This is only supported for classes created using React.createClass. " + "Did you mean to define a state property instead?", this.getName() || "a component"), warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, "getDefaultProps was defined on %s, a plain JavaScript class. " + "This is only supported for classes created using React.createClass. " + "Use a static property to define defaultProps instead.", this.getName() || "a component"), warning(!inst.propTypes, "propTypes was defined as an instance property on %s. Use a static " + "property to define propTypes instead.", this.getName() || "a component"), warning(!inst.contextTypes, "contextTypes was defined as an instance property on %s. Use a " + "static property to define contextTypes instead.", this.getName() || "a component"), warning("function" != typeof inst.componentShouldUpdate, "%s has a method called " + "componentShouldUpdate(). Did you mean shouldComponentUpdate()? " + "The name is phrased as a question because the function is " + "expected to return a value.", this.getName() || "A component"), warning("function" != typeof inst.componentDidUnmount, "%s has a method called " + "componentDidUnmount(). But there is no such lifecycle method. " + "Did you mean componentWillUnmount()?", this.getName() || "A component"), warning("function" != typeof inst.componentWillRecieveProps, "%s has a method called " + "componentWillRecieveProps(). Did you mean componentWillReceiveProps()?", this.getName() || "A component"), isPureComponent(Component) && void 0 !== inst.shouldComponentUpdate && warning(!1, "%s has a method called shouldComponentUpdate(). " + "shouldComponentUpdate should not be used when extending React.PureComponent. " + "Please extend React.Component if shouldComponentUpdate is used.", this.getName() || "A pure component"), warning(!inst.defaultProps, "Setting defaultProps as an instance property on %s is not supported and will be ignored." + " Instead, define defaultProps as a static property on %s.", this.getName() || "a component", this.getName() || "a component"); var initialState = inst.state; void 0 === initialState && (inst.state = initialState = null), invariant("object" == typeof initialState && !Array.isArray(initialState), "%s.state: must be set to an object or null", this.getName() || "ReactCompositeComponent"), this._pendingStateQueue = null, this._pendingReplaceState = !1, this._pendingForceUpdate = !1, inst.componentWillMount && (measureLifeCyclePerf(function() { return inst.componentWillMount(); }, this._debugID, "componentWillMount"), this._pendingStateQueue && (inst.state = this._processPendingState(inst.props, inst.context))); var markup; markup = inst.componentDidCatch ? this.performInitialMountWithErrorHandling(renderedElement, hostParent, hostContainerInfo, transaction, context) : this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context), inst.componentDidMount && transaction.getReactMountReady().enqueue(function() { measureLifeCyclePerf(function() { return inst.componentDidMount(); }, _this._debugID, "componentDidMount"); }); var callbacks = this._pendingCallbacks; if (callbacks) { this._pendingCallbacks = null; for (var i = 0; i < callbacks.length; i++) transaction.getReactMountReady().enqueue(callbacks[i], inst); } return markup; }, _constructComponent: function(doConstruct, publicProps, publicContext, updateQueue) { ReactCurrentOwner$1.current = this, ReactDebugCurrentFrame.getCurrentStack = ReactDebugCurrentStack.getStackAddendum; try { return this._constructComponentWithoutOwner(doConstruct, publicProps, publicContext, updateQueue); } finally { ReactCurrentOwner$1.current = null, ReactDebugCurrentFrame.getCurrentStack = null; } }, _constructComponentWithoutOwner: function(doConstruct, publicProps, publicContext, updateQueue) { var Component = this._currentElement.type; return doConstruct ? measureLifeCyclePerf(function() { return new Component(publicProps, publicContext, updateQueue); }, this._debugID, "ctor") : measureLifeCyclePerf(function() { return Component(publicProps, publicContext, updateQueue); }, this._debugID, "render"); }, performInitialMountWithErrorHandling: function(renderedElement, hostParent, hostContainerInfo, transaction, context) { var markup, checkpoint = transaction.checkpoint(); try { markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context); } catch (e) { transaction.rollback(checkpoint), this._instance.componentDidCatch(e), this._pendingStateQueue && (this._instance.state = this._processPendingState(this._instance.props, this._instance.context)), checkpoint = transaction.checkpoint(), this._renderedComponent.unmountComponent(!0, !0), transaction.rollback(checkpoint), markup = this.performInitialMount(renderedElement, hostParent, hostContainerInfo, transaction, context); } return markup; }, performInitialMount: function(renderedElement, hostParent, hostContainerInfo, transaction, context) { void 0 === renderedElement && (renderedElement = this._renderValidatedComponent()); var nodeType = ReactNodeTypes_1.getType(renderedElement); this._renderedNodeType = nodeType; var child = this._instantiateReactComponent(renderedElement, nodeType !== ReactNodeTypes_1.EMPTY); this._renderedComponent = child; var debugID = 0; debugID = this._debugID; var markup = ReactReconciler_1.mountComponent(child, transaction, hostParent, hostContainerInfo, this._processChildContext(context), debugID); if (0 !== debugID) { var childDebugIDs = 0 !== child._debugID ? [ child._debugID ] : []; ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs); } return markup; }, getHostNode: function() { return ReactReconciler_1.getHostNode(this._renderedComponent); }, unmountComponent: function(safely, skipLifecycle) { if (this._renderedComponent) { var inst = this._instance; if (inst.componentWillUnmount && !inst._calledComponentWillUnmount) if (inst._calledComponentWillUnmount = !0, safely) { if (!skipLifecycle) { var name = this.getName() + ".componentWillUnmount()"; ReactErrorUtils_1.invokeGuardedCallbackAndCatchFirstError(name, inst.componentWillUnmount, inst); } } else measureLifeCyclePerf(function() { return inst.componentWillUnmount(); }, this._debugID, "componentWillUnmount"); this._renderedComponent && (ReactReconciler_1.unmountComponent(this._renderedComponent, safely, skipLifecycle), this._renderedNodeType = null, this._renderedComponent = null, this._instance = null), this._pendingStateQueue = null, this._pendingReplaceState = !1, this._pendingForceUpdate = !1, this._pendingCallbacks = null, this._pendingElement = null, this._context = null, this._rootNodeID = 0, this._topLevelWrapper = null, ReactInstanceMap_1.remove(inst); } }, _maskContext: function(context) { var Component = this._currentElement.type, contextTypes = Component.contextTypes; if (!contextTypes) return emptyObject; var maskedContext = {}; for (var contextName in contextTypes) maskedContext[contextName] = context[contextName]; return maskedContext; }, _processContext: function(context) { var maskedContext = this._maskContext(context), Component = this._currentElement.type; return Component.contextTypes && this._checkContextTypes(Component.contextTypes, maskedContext, "context"), maskedContext; }, _processChildContext: function(currentContext) { var childContext, Component = this._currentElement.type, inst = this._instance; if ("function" == typeof inst.getChildContext) { ReactInstrumentation.debugTool.onBeginProcessingChildContext(); try { childContext = inst.getChildContext(); } finally { ReactInstrumentation.debugTool.onEndProcessingChildContext(); } invariant("object" == typeof Component.childContextTypes, "%s.getChildContext(): childContextTypes must be defined in order to " + "use getChildContext().", this.getName() || "ReactCompositeComponent"), this._checkContextTypes(Component.childContextTypes, childContext, "child context"); for (var name in childContext) invariant(name in Component.childContextTypes, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || "ReactCompositeComponent", name); return Object.assign({}, currentContext, childContext); } var componentName = this.getName(); return warningAboutMissingGetChildContext[componentName] || (warningAboutMissingGetChildContext[componentName] = !0, warning(!Component.childContextTypes, "%s.childContextTypes is specified but there is no getChildContext() method " + "on the instance. You can either define getChildContext() on %s or remove " + "childContextTypes from it.", componentName, componentName)), currentContext; }, _checkContextTypes: function(typeSpecs, values, location) { ReactDebugCurrentStack.current = this._debugID, checkPropTypes(typeSpecs, values, location, this.getName(), ReactDebugCurrentStack.getStackAddendum), ReactDebugCurrentStack.current = null; }, receiveComponent: function(nextElement, transaction, nextContext) { var prevElement = this._currentElement, prevContext = this._context; this._pendingElement = null, this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext); }, performUpdateIfNecessary: function(transaction) { if (null != this._pendingElement) ReactReconciler_1.receiveComponent(this, this._pendingElement, transaction, this._context); else if (null !== this._pendingStateQueue || this._pendingForceUpdate) this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context); else { var callbacks = this._pendingCallbacks; if (this._pendingCallbacks = null, callbacks) for (var j = 0; j < callbacks.length; j++) transaction.getReactMountReady().enqueue(callbacks[j], this.getPublicInstance()); this._updateBatchNumber = null; } }, updateComponent: function(transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) { var inst = this._instance; invariant(null != inst, "Attempted to update component `%s` that has already been unmounted " + "(or failed to mount).", this.getName() || "ReactCompositeComponent"); var nextContext, willReceive = !1; this._context === nextUnmaskedContext ? nextContext = inst.context : (nextContext = this._processContext(nextUnmaskedContext), willReceive = !0); var prevProps = prevParentElement.props, nextProps = nextParentElement.props; if (prevParentElement !== nextParentElement && (willReceive = !0), willReceive && inst.componentWillReceiveProps) { var beforeState = inst.state; measureLifeCyclePerf(function() { return inst.componentWillReceiveProps(nextProps, nextContext); }, this._debugID, "componentWillReceiveProps"); var afterState = inst.state; beforeState !== afterState && (inst.state = beforeState, inst.updater.enqueueReplaceState(inst, afterState), warning(!1, "%s.componentWillReceiveProps(): Assigning directly to " + "this.state is deprecated (except inside a component's " + "constructor). Use setState instead.", this.getName() || "ReactCompositeComponent")); } var callbacks = this._pendingCallbacks; this._pendingCallbacks = null; var nextState = this._processPendingState(nextProps, nextContext), shouldUpdate = !0; if (!this._pendingForceUpdate) { var prevState = inst.state; shouldUpdate = willReceive || nextState !== prevState, inst.shouldComponentUpdate ? shouldUpdate = measureLifeCyclePerf(function() { return inst.shouldComponentUpdate(nextProps, nextState, nextContext); }, this._debugID, "shouldComponentUpdate") : this._compositeType === ReactCompositeComponentTypes$1.PureClass && (shouldUpdate = !shallowEqual(prevProps, nextProps) || !shallowEqual(inst.state, nextState)); } if (warning(void 0 !== shouldUpdate, "%s.shouldComponentUpdate(): Returned undefined instead of a " + "boolean value. Make sure to return true or false.", this.getName() || "ReactCompositeComponent"), this._updateBatchNumber = null, shouldUpdate ? (this._pendingForceUpdate = !1, this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext)) : (this._currentElement = nextParentElement, this._context = nextUnmaskedContext, inst.props = nextProps, inst.state = nextState, inst.context = nextContext), callbacks) for (var j = 0; j < callbacks.length; j++) transaction.getReactMountReady().enqueue(callbacks[j], this.getPublicInstance()); }, _processPendingState: function(props, context) { var inst = this._instance, queue = this._pendingStateQueue, replace = this._pendingReplaceState; if (this._pendingReplaceState = !1, this._pendingStateQueue = null, !queue) return inst.state; if (replace && 1 === queue.length) return queue[0]; for (var nextState = replace ? queue[0] : inst.state, dontMutate = !0, i = replace ? 1 : 0; i < queue.length; i++) { var partial = queue[i], partialState = "function" == typeof partial ? partial.call(inst, nextState, props, context) : partial; partialState && (dontMutate ? (dontMutate = !1, nextState = Object.assign({}, nextState, partialState)) : Object.assign(nextState, partialState)); } return nextState; }, _performComponentUpdate: function(nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) { var prevProps, prevState, _this2 = this, inst = this._instance, hasComponentDidUpdate = !!inst.componentDidUpdate; hasComponentDidUpdate && (prevProps = inst.props, prevState = inst.state), inst.componentWillUpdate && measureLifeCyclePerf(function() { return inst.componentWillUpdate(nextProps, nextState, nextContext); }, this._debugID, "componentWillUpdate"), this._currentElement = nextElement, this._context = unmaskedContext, inst.props = nextProps, inst.state = nextState, inst.context = nextContext, inst.componentDidCatch ? this._updateRenderedComponentWithErrorHandling(transaction, unmaskedContext) : this._updateRenderedComponent(transaction, unmaskedContext), hasComponentDidUpdate && transaction.getReactMountReady().enqueue(function() { measureLifeCyclePerf(inst.componentDidUpdate.bind(inst, prevProps, prevState), _this2._debugID, "componentDidUpdate"); }); }, _updateRenderedComponentWithErrorHandling: function(transaction, context) { var checkpoint = transaction.checkpoint(); try { this._updateRenderedComponent(transaction, context); } catch (e) { transaction.rollback(checkpoint), this._instance.componentDidCatch(e), this._pendingStateQueue && (this._instance.state = this._processPendingState(this._instance.props, this._instance.context)), checkpoint = transaction.checkpoint(), this._updateRenderedComponentWithNextElement(transaction, context, null, !0), this._updateRenderedComponent(transaction, context); } }, _updateRenderedComponent: function(transaction, context) { var nextRenderedElement = this._renderValidatedComponent(); this._updateRenderedComponentWithNextElement(transaction, context, nextRenderedElement, !1); }, _updateRenderedComponentWithNextElement: function(transaction, context, nextRenderedElement, safely) { var prevComponentInstance = this._renderedComponent, prevRenderedElement = prevComponentInstance._currentElement, debugID = 0; if (debugID = this._debugID, shouldUpdateReactComponent_1(prevRenderedElement, nextRenderedElement)) ReactReconciler_1.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context)); else { var oldHostNode = ReactReconciler_1.getHostNode(prevComponentInstance), nodeType = ReactNodeTypes_1.getType(nextRenderedElement); this._renderedNodeType = nodeType; var child = this._instantiateReactComponent(nextRenderedElement, nodeType !== ReactNodeTypes_1.EMPTY); this._renderedComponent = child; var nextMarkup = ReactReconciler_1.mountComponent(child, transaction, this._hostParent, this._hostContainerInfo, this._processChildContext(context), debugID); if (ReactReconciler_1.unmountComponent(prevComponentInstance, safely, !1), 0 !== debugID) { var childDebugIDs = 0 !== child._debugID ? [ child._debugID ] : []; ReactInstrumentation.debugTool.onSetChildren(debugID, childDebugIDs); } this._replaceNodeWithMarkup(oldHostNode, nextMarkup, prevComponentInstance); } }, _replaceNodeWithMarkup: function(oldHostNode, nextMarkup, prevInstance) { ReactComponentEnvironment_1.replaceNodeWithMarkup(oldHostNode, nextMarkup, prevInstance); }, _renderValidatedComponentWithoutOwnerOrContext: function() { var renderedElement, inst = this._instance; return renderedElement = measureLifeCyclePerf(function() { return inst.render(); }, this._debugID, "render"), void 0 === renderedElement && inst.render._isMockFunction && (renderedElement = null), renderedElement; }, _renderValidatedComponent: function() { var renderedElement; if (0 && this._compositeType === ReactCompositeComponentTypes$1.StatelessFunctional) renderedElement = this._renderValidatedComponentWithoutOwnerOrContext(); else { ReactCurrentOwner$1.current = this, ReactDebugCurrentFrame.getCurrentStack = ReactDebugCurrentStack.getStackAddendum; try { renderedElement = this._renderValidatedComponentWithoutOwnerOrContext(); } finally { ReactCurrentOwner$1.current = null, ReactDebugCurrentFrame.getCurrentStack = null; } } return invariant(null === renderedElement || !1 === renderedElement || React.isValidElement(renderedElement), "%s.render(): A valid React element (or null) must be returned. You may have " + "returned undefined, an array or some other invalid object.", this.getName() || "ReactCompositeComponent"), renderedElement; }, attachRef: function(ref, component) { var inst = this.getPublicInstance(); invariant(null != inst, "Stateless function components cannot have refs."); var publicComponentInstance = component.getPublicInstance(); (inst.refs === emptyObject ? inst.refs = {} : inst.refs)[ref] = publicComponentInstance; }, detachRef: function(ref) { delete this.getPublicInstance().refs[ref]; }, getName: function() { var type = this._currentElement.type, constructor = this._instance && this._instance.constructor; return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null; }, getPublicInstance: function() { var inst = this._instance; return this._compositeType === ReactCompositeComponentTypes$1.StatelessFunctional ? null : inst; }, _instantiateReactComponent: null }, ReactCompositeComponent_1 = ReactCompositeComponent, ReactEmptyComponentInjection = { injectEmptyComponentFactory: function(factory) { emptyComponentFactory = factory; } }, ReactEmptyComponent = { create: function(instantiate) { return emptyComponentFactory(instantiate); } }; ReactEmptyComponent.injection = ReactEmptyComponentInjection; var ReactEmptyComponent_1 = ReactEmptyComponent, genericComponentClass = null, textComponentClass = null, ReactHostComponentInjection = { injectGenericComponentClass: function(componentClass) { genericComponentClass = componentClass; }, injectTextComponentClass: function(componentClass) { textComponentClass = componentClass; } }; function createInternalComponent(element) { return invariant(genericComponentClass, "There is no registered component for the tag %s", element.type), new genericComponentClass(element); } function createInstanceForText(text) { return new textComponentClass(text); } function isTextComponent(component) { return component instanceof textComponentClass; } var ReactHostComponent = { createInternalComponent: createInternalComponent, createInstanceForText: createInstanceForText, isTextComponent: isTextComponent, injection: ReactHostComponentInjection }, ReactHostComponent_1 = ReactHostComponent, nextDebugID = 1, ReactCompositeComponentWrapper = function(element) { this.construct(element); }; function getDeclarationErrorAddendum(owner) { if (owner) { var name = owner.getName(); if (name) return "\n\nCheck the render method of `" + name + "`."; } return ""; } function isInternalComponentType(type) { return "function" == typeof type && void 0 !== type.prototype && "function" == typeof type.prototype.mountComponent && "function" == typeof type.prototype.receiveComponent; } function instantiateReactComponent(node, shouldHaveDebugID) { var instance; if (null === node || !1 === node) instance = ReactEmptyComponent_1.create(instantiateReactComponent); else if ("object" == typeof node) { var element = node, type = element.type; if ("function" != typeof type && "string" != typeof type) { var info = ""; (void 0 === type || "object" == typeof type && null !== type && 0 === Object.keys(type).length) && (info += " You likely forgot to export your component from the file " + "it's defined in."), info += getDeclarationErrorAddendum(element._owner), invariant(!1, "Element type is invalid: expected a string (for built-in components) " + "or a class/function (for composite components) but got: %s.%s", null == type ? type : typeof type, info); } "string" == typeof element.type ? instance = ReactHostComponent_1.createInternalComponent(element) : isInternalComponentType(element.type) ? (instance = new element.type(element), instance.getHostNode || (instance.getHostNode = instance.getNativeNode)) : instance = new ReactCompositeComponentWrapper(element); } else "string" == typeof node || "number" == typeof node ? instance = ReactHostComponent_1.createInstanceForText(node) : invariant(!1, "Encountered invalid React node of type %s", typeof node); return warning("function" == typeof instance.mountComponent && "function" == typeof instance.receiveComponent && "function" == typeof instance.getHostNode && "function" == typeof instance.unmountComponent, "Only React Components can be mounted."), instance._mountIndex = 0, instance._mountImage = null, instance._debugID = shouldHaveDebugID ? nextDebugID++ : 0, Object.preventExtensions && Object.preventExtensions(instance), instance; } Object.assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent_1, { _instantiateReactComponent: instantiateReactComponent }); var instantiateReactComponent_1 = instantiateReactComponent, DevOnlyStubShim = null, ReactNativeFeatureFlags = require('../ReactNative/ReactNativeFeatureFlags'), ReactCurrentOwner$2 = ReactGlobalSharedState_1.ReactCurrentOwner, injectedFindNode = ReactNativeFeatureFlags.useFiber ? function(fiber) { return DevOnlyStubShim.findHostInstance(fiber); } : function(instance) { return instance; }; function findNodeHandle(componentOrHandle) { var owner = ReactCurrentOwner$2.current; if (null !== owner && (warning(owner._warnedAboutRefsInRender, "%s is accessing findNodeHandle inside its render(). " + "render() should be a pure function of props and state. It should " + "never access something that requires stale data from the previous " + "render, such as refs. Move this logic to componentDidMount and " + "componentDidUpdate instead.", owner.getName() || "A component"), owner._warnedAboutRefsInRender = !0), null == componentOrHandle) return null; if ("number" == typeof componentOrHandle) return componentOrHandle; var component = componentOrHandle, internalInstance = ReactInstanceMap_1.get(component); return internalInstance ? injectedFindNode(internalInstance) : component || (invariant("object" == typeof component && ("_rootNodeID" in component || "_nativeTag" in component) || null != component.render && "function" == typeof component.render, "findNodeHandle(...): Argument is not a component " + "(type: %s, keys: %s)", typeof component, Object.keys(component)), void invariant(!1, "findNodeHandle(...): Unable to find node handle for unmounted " + "component.")); } var findNodeHandle_1 = findNodeHandle, TopLevelWrapper = function() {}; TopLevelWrapper.prototype.isReactComponent = {}, TopLevelWrapper.displayName = "TopLevelWrapper", TopLevelWrapper.prototype.render = function() { return this.props.child; }, TopLevelWrapper.isReactTopLevelWrapper = !0; function mountComponentIntoNode(componentInstance, containerTag, transaction) { var markup = ReactReconciler_1.mountComponent(componentInstance, transaction, null, ReactNativeContainerInfo_1(containerTag), emptyObject, 0); componentInstance._renderedComponent._topLevelWrapper = componentInstance, ReactNativeMount._mountImageIntoNode(markup, containerTag); } function batchedMountComponentIntoNode(componentInstance, containerTag) { var transaction = ReactUpdates_1.ReactReconcileTransaction.getPooled(); transaction.perform(mountComponentIntoNode, null, componentInstance, containerTag, transaction), ReactUpdates_1.ReactReconcileTransaction.release(transaction); } var ReactNativeMount = { _instancesByContainerID: {}, findNodeHandle: findNodeHandle_1, renderComponent: function(nextElement, containerTag, callback) { var nextWrappedElement = React.createElement(TopLevelWrapper, { child: nextElement }), topRootNodeID = containerTag, prevComponent = ReactNativeMount._instancesByContainerID[topRootNodeID]; if (prevComponent) { var prevWrappedElement = prevComponent._currentElement, prevElement = prevWrappedElement.props.child; if (shouldUpdateReactComponent_1(prevElement, nextElement)) return ReactUpdateQueue_1.enqueueElementInternal(prevComponent, nextWrappedElement, emptyObject), callback && ReactUpdateQueue_1.enqueueCallbackInternal(prevComponent, callback), prevComponent; ReactNativeMount.unmountComponentAtNode(containerTag); } if (!ReactNativeTagHandles_1.reactTagIsNativeTopRootID(containerTag)) return console.error("You cannot render into anything but a top root"), null; ReactNativeTagHandles_1.assertRootTag(containerTag); var instance = instantiateReactComponent_1(nextWrappedElement, !1); if (ReactNativeMount._instancesByContainerID[containerTag] = instance, callback) { var nonNullCallback = callback; instance._pendingCallbacks = [ function() { nonNullCallback.call(instance._renderedComponent.getPublicInstance()); } ]; } return ReactUpdates_1.batchedUpdates(batchedMountComponentIntoNode, instance, containerTag), instance._renderedComponent.getPublicInstance(); }, _mountImageIntoNode: function(mountImage, containerID) { var childTag = mountImage; UIManager.setChildren(containerID, [ childTag ]); }, unmountComponentAtNodeAndRemoveContainer: function(containerTag) { ReactNativeMount.unmountComponentAtNode(containerTag), UIManager.removeRootView(containerTag); }, unmountComponentAtNode: function(containerTag) { if (!ReactNativeTagHandles_1.reactTagIsNativeTopRootID(containerTag)) return console.error("You cannot render into anything but a top root"), !1; var instance = ReactNativeMount._instancesByContainerID[containerTag]; return !!instance && (ReactInstrumentation.debugTool.onBeginFlush(), ReactNativeMount.unmountComponentFromNode(instance, containerTag), delete ReactNativeMount._instancesByContainerID[containerTag], ReactInstrumentation.debugTool.onEndFlush(), !0); }, unmountComponentFromNode: function(instance, containerID) { ReactReconciler_1.unmountComponent(instance), UIManager.removeSubviewsFromContainerWithID(containerID); } }, ReactNativeMount_1 = ReactNativeMount; function getComponentName(instanceOrFiber) { if ("function" == typeof instanceOrFiber.getName) { return instanceOrFiber.getName(); } if ("number" == typeof instanceOrFiber.tag) { var fiber = instanceOrFiber, type = fiber.type; if ("string" == typeof type) return type; if ("function" == typeof type) return type.displayName || type.name; } return null; } var getComponentName_1 = getComponentName, getInspectorDataForViewTag = void 0, traverseOwnerTreeUp = function(hierarchy, instance) { instance && (hierarchy.unshift(instance), traverseOwnerTreeUp(hierarchy, instance._currentElement._owner)); }, getOwnerHierarchy = function(instance) { var hierarchy = []; return traverseOwnerTreeUp(hierarchy, instance), hierarchy; }, lastNotNativeInstance = function(hierarchy) { for (var i = hierarchy.length - 1; i > 1; i--) { var instance = hierarchy[i]; if (!instance.viewConfig) return instance; } return hierarchy[0]; }, getHostProps = function(component) { var instance = component._instance; return instance ? instance.props || emptyObject : emptyObject; }, createHierarchy = function(componentHierarchy) { return componentHierarchy.map(function(component) { return { name: getComponentName_1(component), getInspectorData: function() { return { measure: function(callback) { return UIManager.measure(component.getHostNode(), callback); }, props: getHostProps(component), source: component._currentElement && component._currentElement._source }; } }; }); }; getInspectorDataForViewTag = function(viewTag) { var component = ReactNativeComponentTree_1.getClosestInstanceFromNode(viewTag); if (!component) return { hierarchy: [], props: emptyObject, selection: null, source: null }; var componentHierarchy = getOwnerHierarchy(component), instance = lastNotNativeInstance(componentHierarchy), hierarchy = createHierarchy(componentHierarchy), props = getHostProps(instance), source = instance._currentElement && instance._currentElement._source; return { hierarchy: hierarchy, props: props, selection: componentHierarchy.indexOf(instance), source: source }; }; var ReactNativeStackInspector = { getInspectorDataForViewTag: getInspectorDataForViewTag }, findNumericNodeHandleStack = function(componentOrHandle) { var nodeHandle = findNodeHandle_1(componentOrHandle); return null == nodeHandle || "number" == typeof nodeHandle ? nodeHandle : nodeHandle.getHostNode(); }, eventPluginOrder = null, namesToPlugins = {}; function recomputePluginOrdering() { if (eventPluginOrder) for (var pluginName in namesToPlugins) { var pluginModule = namesToPlugins[pluginName], pluginIndex = eventPluginOrder.indexOf(pluginName); if (invariant(pluginIndex > -1, "EventPluginRegistry: Cannot inject event plugins that do not exist in " + "the plugin ordering, `%s`.", pluginName), !EventPluginRegistry.plugins[pluginIndex]) { invariant(pluginModule.extractEvents, "EventPluginRegistry: Event plugins must implement an `extractEvents` " + "method, but `%s` does not.", pluginName), EventPluginRegistry.plugins[pluginIndex] = pluginModule; var publishedEvents = pluginModule.eventTypes; for (var eventName in publishedEvents) invariant(publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName), "EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.", eventName, pluginName); } } } function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { invariant(!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName), "EventPluginHub: More than one plugin attempted to publish the same " + "event name, `%s`.", eventName), EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig; var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; if (phasedRegistrationNames) { for (var phaseName in phasedRegistrationNames) if (phasedRegistrationNames.hasOwnProperty(phaseName)) { var phasedRegistrationName = phasedRegistrationNames[phaseName]; publishRegistrationName(phasedRegistrationName, pluginModule, eventName); } return !0; } return !!dispatchConfig.registrationName && (publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName), !0); } function publishRegistrationName(registrationName, pluginModule, eventName) { invariant(!EventPluginRegistry.registrationNameModules[registrationName], "EventPluginHub: More than one plugin attempted to publish the same " + "registration name, `%s`.", registrationName), EventPluginRegistry.registrationNameModules[registrationName] = pluginModule, EventPluginRegistry.registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies; var lowerCasedName = registrationName.toLowerCase(); EventPluginRegistry.possibleRegistrationNames[lowerCasedName] = registrationName, "onDoubleClick" === registrationName && (EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName); } var ComponentTree, EventPluginRegistry = { plugins: [], eventNameDispatchConfigs: {}, registrationNameModules: {}, registrationNameDependencies: {}, possibleRegistrationNames: {}, injectEventPluginOrder: function(injectedEventPluginOrder) { invariant(!eventPluginOrder, "EventPluginRegistry: Cannot inject event plugin ordering more than " + "once. You are likely trying to load more than one copy of React."), eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder), recomputePluginOrdering(); }, injectEventPluginsByName: function(injectedNamesToPlugins) { var isOrderingDirty = !1; for (var pluginName in injectedNamesToPlugins) if (injectedNamesToPlugins.hasOwnProperty(pluginName)) { var pluginModule = injectedNamesToPlugins[pluginName]; namesToPlugins.hasOwnProperty(pluginName) && namesToPlugins[pluginName] === pluginModule || (invariant(!namesToPlugins[pluginName], "EventPluginRegistry: Cannot inject two different event plugins " + "using the same name, `%s`.", pluginName), namesToPlugins[pluginName] = pluginModule, isOrderingDirty = !0); } isOrderingDirty && recomputePluginOrdering(); } }, EventPluginRegistry_1 = EventPluginRegistry, warning$6 = warning, injection = { injectComponentTree: function(Injected) { ComponentTree = Injected, warning$6(Injected && Injected.getNodeFromInstance && Injected.getInstanceFromNode, "EventPluginUtils.injection.injectComponentTree(...): Injected " + "module is missing getNodeFromInstance or getInstanceFromNode."); } }; function isEndish(topLevelType) { return "topMouseUp" === topLevelType || "topTouchEnd" === topLevelType || "topTouchCancel" === topLevelType; } function isMoveish(topLevelType) { return "topMouseMove" === topLevelType || "topTouchMove" === topLevelType; } function isStartish(topLevelType) { return "topMouseDown" === topLevelType || "topTouchStart" === topLevelType; } var validateEventDispatches; validateEventDispatches = function(event) { var dispatchListeners = event._dispatchListeners, dispatchInstances = event._dispatchInstances, listenersIsArr = Array.isArray(dispatchListeners), listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0, instancesIsArr = Array.isArray(dispatchInstances), instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0; warning$6(instancesIsArr === listenersIsArr && instancesLen === listenersLen, "EventPluginUtils: Invalid `event`."); }; function executeDispatch(event, simulated, listener, inst) { var type = event.type || "unknown-event"; event.currentTarget = EventPluginUtils.getNodeFromInstance(inst), ReactErrorUtils_1.invokeGuardedCallbackAndCatchFirstError(type, listener, void 0, event), event.currentTarget = null; } function executeDispatchesInOrder(event, simulated) { var dispatchListeners = event._dispatchListeners, dispatchInstances = event._dispatchInstances; if (validateEventDispatches(event), Array.isArray(dispatchListeners)) for (var i = 0; i < dispatchListeners.length && !event.isPropagationStopped(); i++) executeDispatch(event, simulated, dispatchListeners[i], dispatchInstances[i]); else dispatchListeners && executeDispatch(event, simulated, dispatchListeners, dispatchInstances); event._dispatchListeners = null, event._dispatchInstances = null; } function executeDispatchesInOrderStopAtTrueImpl(event) { var dispatchListeners = event._dispatchListeners, dispatchInstances = event._dispatchInstances; if (validateEventDispatches(event), Array.isArray(dispatchListeners)) { for (var i = 0; i < dispatchListeners.length && !event.isPropagationStopped(); i++) if (dispatchListeners[i](event, dispatchInstances[i])) return dispatchInstances[i]; } else if (dispatchListeners && dispatchListeners(event, dispatchInstances)) return dispatchInstances; return null; } function executeDispatchesInOrderStopAtTrue(event) { var ret = executeDispatchesInOrderStopAtTrueImpl(event); return event._dispatchInstances = null, event._dispatchListeners = null, ret; } function executeDirectDispatch(event) { validateEventDispatches(event); var dispatchListener = event._dispatchListeners, dispatchInstance = event._dispatchInstances; invariant(!Array.isArray(dispatchListener), "executeDirectDispatch(...): Invalid `event`."), event.currentTarget = dispatchListener ? EventPluginUtils.getNodeFromInstance(dispatchInstance) : null; var res = dispatchListener ? dispatchListener(event) : null; return event.currentTarget = null, event._dispatchListeners = null, event._dispatchInstances = null, res; } function hasDispatches(event) { return !!event._dispatchListeners; } var EventPluginUtils = { isEndish: isEndish, isMoveish: isMoveish, isStartish: isStartish, executeDirectDispatch: executeDirectDispatch, executeDispatchesInOrder: executeDispatchesInOrder, executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue, hasDispatches: hasDispatches, getFiberCurrentPropsFromNode: function(node) { return ComponentTree.getFiberCurrentPropsFromNode(node); }, getInstanceFromNode: function(node) { return ComponentTree.getInstanceFromNode(node); }, getNodeFromInstance: function(node) { return ComponentTree.getNodeFromInstance(node); }, injection: injection }, EventPluginUtils_1 = EventPluginUtils; function accumulateInto(current, next) { return invariant(null != next, "accumulateInto(...): Accumulated items must not be null or undefined."), null == current ? next : Array.isArray(current) ? Array.isArray(next) ? (current.push.apply(current, next), current) : (current.push(next), current) : Array.isArray(next) ? [ current ].concat(next) : [ current, next ]; } var accumulateInto_1 = accumulateInto; function forEachAccumulated(arr, cb, scope) { Array.isArray(arr) ? arr.forEach(cb, scope) : arr && cb.call(scope, arr); } var forEachAccumulated_1 = forEachAccumulated, eventQueue = null, executeDispatchesAndRelease = function(event, simulated) { event && (EventPluginUtils_1.executeDispatchesInOrder(event, simulated), event.isPersistent() || event.constructor.release(event)); }, executeDispatchesAndReleaseSimulated = function(e) { return executeDispatchesAndRelease(e, !0); }, executeDispatchesAndReleaseTopLevel = function(e) { return executeDispatchesAndRelease(e, !1); }; function isInteractive(tag) { return "button" === tag || "input" === tag || "select" === tag || "textarea" === tag; } function shouldPreventMouseEvent(name, type, props) { switch (name) { case "onClick": case "onClickCapture": case "onDoubleClick": case "onDoubleClickCapture": case "onMouseDown": case "onMouseDownCapture": case "onMouseMove": case "onMouseMoveCapture": case "onMouseUp": case "onMouseUpCapture": return !(!props.disabled || !isInteractive(type)); default: return !1; } } var EventPluginHub = { injection: { injectEventPluginOrder: EventPluginRegistry_1.injectEventPluginOrder, injectEventPluginsByName: EventPluginRegistry_1.injectEventPluginsByName }, getListener: function(inst, registrationName) { var listener; if ("number" == typeof inst.tag) { var stateNode = inst.stateNode; if (!stateNode) return null; var props = EventPluginUtils_1.getFiberCurrentPropsFromNode(stateNode); if (!props) return null; if (listener = props[registrationName], shouldPreventMouseEvent(registrationName, inst.type, props)) return null; } else { var currentElement = inst._currentElement; if ("string" == typeof currentElement || "number" == typeof currentElement) return null; if (!inst._rootNodeID) return null; var _props = currentElement.props; if (listener = _props[registrationName], shouldPreventMouseEvent(registrationName, currentElement.type, _props)) return null; } return invariant(!listener || "function" == typeof listener, "Expected %s listener to be a function, instead got type %s", registrationName, typeof listener), listener; }, extractEvents: function(topLevelType, targetInst, nativeEvent, nativeEventTarget) { for (var events, plugins = EventPluginRegistry_1.plugins, i = 0; i < plugins.length; i++) { var possiblePlugin = plugins[i]; if (possiblePlugin) { var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget); extractedEvents && (events = accumulateInto_1(events, extractedEvents)); } } return events; }, enqueueEvents: function(events) { events && (eventQueue = accumulateInto_1(eventQueue, events)); }, processEventQueue: function(simulated) { var processingEventQueue = eventQueue; eventQueue = null, simulated ? forEachAccumulated_1(processingEventQueue, executeDispatchesAndReleaseSimulated) : forEachAccumulated_1(processingEventQueue, executeDispatchesAndReleaseTopLevel), invariant(!eventQueue, "processEventQueue(): Additional events were enqueued while processing " + "an event queue. Support for this has not yet been implemented."), ReactErrorUtils_1.rethrowCaughtError(); } }, EventPluginHub_1 = EventPluginHub, HostComponent = ReactTypeOfWork.HostComponent; function getParent(inst) { if (void 0 !== inst._hostParent) return inst._hostParent; if ("number" == typeof inst.tag) { do { inst = inst.return; } while (inst && inst.tag !== HostComponent); if (inst) return inst; } return null; } function getLowestCommonAncestor(instA, instB) { for (var depthA = 0, tempA = instA; tempA; tempA = getParent(tempA)) depthA++; for (var depthB = 0, tempB = instB; tempB; tempB = getParent(tempB)) depthB++; for (;depthA - depthB > 0; ) instA = getParent(instA), depthA--; for (;depthB - depthA > 0; ) instB = getParent(instB), depthB--; for (var depth = depthA; depth--; ) { if (instA === instB || instA === instB.alternate) return instA; instA = getParent(instA), instB = getParent(instB); } return null; } function isAncestor(instA, instB) { for (;instB; ) { if (instA === instB || instA === instB.alternate) return !0; instB = getParent(instB); } return !1; } function getParentInstance(inst) { return getParent(inst); } function traverseTwoPhase(inst, fn, arg) { for (var path = []; inst; ) path.push(inst), inst = getParent(inst); var i; for (i = path.length; i-- > 0; ) fn(path[i], "captured", arg); for (i = 0; i < path.length; i++) fn(path[i], "bubbled", arg); } function traverseEnterLeave(from, to, fn, argFrom, argTo) { for (var common = from && to ? getLowestCommonAncestor(from, to) : null, pathFrom = []; from && from !== common; ) pathFrom.push(from), from = getParent(from); for (var pathTo = []; to && to !== common; ) pathTo.push(to), to = getParent(to); var i; for (i = 0; i < pathFrom.length; i++) fn(pathFrom[i], "bubbled", argFrom); for (i = pathTo.length; i-- > 0; ) fn(pathTo[i], "captured", argTo); } var ReactTreeTraversal = { isAncestor: isAncestor, getLowestCommonAncestor: getLowestCommonAncestor, getParentInstance: getParentInstance, traverseTwoPhase: traverseTwoPhase, traverseEnterLeave: traverseEnterLeave }, getListener = EventPluginHub_1.getListener, warning$7 = warning; function listenerAtPhase(inst, event, propagationPhase) { var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; return getListener(inst, registrationName); } function accumulateDirectionalDispatches(inst, phase, event) { warning$7(inst, "Dispatching inst must not be null"); var listener = listenerAtPhase(inst, event, phase); listener && (event._dispatchListeners = accumulateInto_1(event._dispatchListeners, listener), event._dispatchInstances = accumulateInto_1(event._dispatchInstances, inst)); } function accumulateTwoPhaseDispatchesSingle(event) { event && event.dispatchConfig.phasedRegistrationNames && ReactTreeTraversal.traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event); } function accumulateTwoPhaseDispatchesSingleSkipTarget(event) { if (event && event.dispatchConfig.phasedRegistrationNames) { var targetInst = event._targetInst, parentInst = targetInst ? ReactTreeTraversal.getParentInstance(targetInst) : null; ReactTreeTraversal.traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event); } } function accumulateDispatches(inst, ignoredDirection, event) { if (inst && event && event.dispatchConfig.registrationName) { var registrationName = event.dispatchConfig.registrationName, listener = getListener(inst, registrationName); listener && (event._dispatchListeners = accumulateInto_1(event._dispatchListeners, listener), event._dispatchInstances = accumulateInto_1(event._dispatchInstances, inst)); } } function accumulateDirectDispatchesSingle(event) { event && event.dispatchConfig.registrationName && accumulateDispatches(event._targetInst, null, event); } function accumulateTwoPhaseDispatches(events) { forEachAccumulated_1(events, accumulateTwoPhaseDispatchesSingle); } function accumulateTwoPhaseDispatchesSkipTarget(events) { forEachAccumulated_1(events, accumulateTwoPhaseDispatchesSingleSkipTarget); } function accumulateEnterLeaveDispatches(leave, enter, from, to) { ReactTreeTraversal.traverseEnterLeave(from, to, accumulateDispatches, leave, enter); } function accumulateDirectDispatches(events) { forEachAccumulated_1(events, accumulateDirectDispatchesSingle); } var EventPropagators = { accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches, accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget, accumulateDirectDispatches: accumulateDirectDispatches, accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches }, EventPropagators_1 = EventPropagators, didWarnForAddedNewProperty = !1, isProxySupported = "function" == typeof Proxy, EVENT_POOL_SIZE = 10, warning$8 = warning, shouldBeReleasedProperties = [ "dispatchConfig", "_targetInst", "nativeEvent", "isDefaultPrevented", "isPropagationStopped", "_dispatchListeners", "_dispatchInstances" ], EventInterface = { type: null, target: null, currentTarget: emptyFunction.thatReturnsNull, eventPhase: null, bubbles: null, cancelable: null, timeStamp: function(event) { return event.timeStamp || Date.now(); }, defaultPrevented: null, isTrusted: null }; function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) { delete this.nativeEvent, delete this.preventDefault, delete this.stopPropagation, this.dispatchConfig = dispatchConfig, this._targetInst = targetInst, this.nativeEvent = nativeEvent; var Interface = this.constructor.Interface; for (var propName in Interface) if (Interface.hasOwnProperty(propName)) { delete this[propName]; var normalize = Interface[propName]; normalize ? this[propName] = normalize(nativeEvent) : "target" === propName ? this.target = nativeEventTarget : this[propName] = nativeEvent[propName]; } var defaultPrevented = null != nativeEvent.defaultPrevented ? nativeEvent.defaultPrevented : !1 === nativeEvent.returnValue; return this.isDefaultPrevented = defaultPrevented ? emptyFunction.thatReturnsTrue : emptyFunction.thatReturnsFalse, this.isPropagationStopped = emptyFunction.thatReturnsFalse, this; } Object.assign(SyntheticEvent.prototype, { preventDefault: function() { this.defaultPrevented = !0; var event = this.nativeEvent; event && (event.preventDefault ? event.preventDefault() : "unknown" != typeof event.returnValue && (event.returnValue = !1), this.isDefaultPrevented = emptyFunction.thatReturnsTrue); }, stopPropagation: function() { var event = this.nativeEvent; event && (event.stopPropagation ? event.stopPropagation() : "unknown" != typeof event.cancelBubble && (event.cancelBubble = !0), this.isPropagationStopped = emptyFunction.thatReturnsTrue); }, persist: function() { this.isPersistent = emptyFunction.thatReturnsTrue; }, isPersistent: emptyFunction.thatReturnsFalse, destructor: function() { var Interface = this.constructor.Interface; for (var propName in Interface) Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName])); for (var i = 0; i < shouldBeReleasedProperties.length; i++) this[shouldBeReleasedProperties[i]] = null; Object.defineProperty(this, "nativeEvent", getPooledWarningPropertyDefinition("nativeEvent", null)), Object.defineProperty(this, "preventDefault", getPooledWarningPropertyDefinition("preventDefault", emptyFunction)), Object.defineProperty(this, "stopPropagation", getPooledWarningPropertyDefinition("stopPropagation", emptyFunction)); } }), SyntheticEvent.Interface = EventInterface, SyntheticEvent.augmentClass = function(Class, Interface) { var Super = this, E = function() {}; E.prototype = Super.prototype; var prototype = new E(); Object.assign(prototype, Class.prototype), Class.prototype = prototype, Class.prototype.constructor = Class, Class.Interface = Object.assign({}, Super.Interface, Interface), Class.augmentClass = Super.augmentClass, addEventPoolingTo(Class); }, isProxySupported && (SyntheticEvent = new Proxy(SyntheticEvent, { construct: function(target, args) { return this.apply(target, Object.create(target.prototype), args); }, apply: function(constructor, that, args) { return new Proxy(constructor.apply(that, args), { set: function(target, prop, value) { return "isPersistent" === prop || target.constructor.Interface.hasOwnProperty(prop) || -1 !== shouldBeReleasedProperties.indexOf(prop) || (warning$8(didWarnForAddedNewProperty || target.isPersistent(), "This synthetic event is reused for performance reasons. If you're " + "seeing this, you're adding a new property in the synthetic event object. " + "The property is never released. See " + "https://fb.me/react-event-pooling for more information."), didWarnForAddedNewProperty = !0), target[prop] = value, !0; } }); } })), addEventPoolingTo(SyntheticEvent); var SyntheticEvent_1 = SyntheticEvent; function getPooledWarningPropertyDefinition(propName, getVal) { var isFunction = "function" == typeof getVal; return { configurable: !0, set: set, get: get }; function set(val) { return warn(isFunction ? "setting the method" : "setting the property", "This is effectively a no-op"), val; } function get() { return warn(isFunction ? "accessing the method" : "accessing the property", isFunction ? "This is a no-op function" : "This is set to null"), getVal; } function warn(action, result) { warning$8(!1, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + "If you must keep the original synthetic event around, use event.persist(). " + "See https://fb.me/react-event-pooling for more information.", action, propName, result); } } function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) { var EventConstructor = this; if (EventConstructor.eventPool.length) { var instance = EventConstructor.eventPool.pop(); return EventConstructor.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst), instance; } return new EventConstructor(dispatchConfig, targetInst, nativeEvent, nativeInst); } function releasePooledEvent(event) { var EventConstructor = this; invariant(event instanceof EventConstructor, "Trying to release an event instance into a pool of a different type."), event.destructor(), EventConstructor.eventPool.length < EVENT_POOL_SIZE && EventConstructor.eventPool.push(event); } function addEventPoolingTo(EventConstructor) { EventConstructor.eventPool = [], EventConstructor.getPooled = getPooledEvent, EventConstructor.release = releasePooledEvent; } var customBubblingEventTypes = UIManager.customBubblingEventTypes, customDirectEventTypes = UIManager.customDirectEventTypes, allTypesByEventName = {}; for (var bubblingTypeName in customBubblingEventTypes) allTypesByEventName[bubblingTypeName] = customBubblingEventTypes[bubblingTypeName]; for (var directTypeName in customDirectEventTypes) warning(!customBubblingEventTypes[directTypeName], "Event cannot be both direct and bubbling: %s", directTypeName), allTypesByEventName[directTypeName] = customDirectEventTypes[directTypeName]; var ReactNativeBridgeEventPlugin = { eventTypes: Object.assign({}, customBubblingEventTypes, customDirectEventTypes), extractEvents: function(topLevelType, targetInst, nativeEvent, nativeEventTarget) { var bubbleDispatchConfig = customBubblingEventTypes[topLevelType], directDispatchConfig = customDirectEventTypes[topLevelType], event = SyntheticEvent_1.getPooled(bubbleDispatchConfig || directDispatchConfig, targetInst, nativeEvent, nativeEventTarget); if (bubbleDispatchConfig) EventPropagators_1.accumulateTwoPhaseDispatches(event); else { if (!directDispatchConfig) return null; EventPropagators_1.accumulateDirectDispatches(event); } return event; } }, ReactNativeBridgeEventPlugin_1 = ReactNativeBridgeEventPlugin; function runEventQueueInBatch(events) { EventPluginHub_1.enqueueEvents(events), EventPluginHub_1.processEventQueue(!1); } var ReactEventEmitterMixin = { handleTopLevel: function(topLevelType, targetInst, nativeEvent, nativeEventTarget) { runEventQueueInBatch(EventPluginHub_1.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget)); } }, ReactEventEmitterMixin_1 = ReactEventEmitterMixin, fiberHostComponent = null, ReactControlledComponentInjection = { injectFiberControlledHostComponent: function(hostComponentImpl) { fiberHostComponent = hostComponentImpl; } }, restoreTarget = null, restoreQueue = null; function restoreStateOfTarget(target) { var internalInstance = EventPluginUtils_1.getInstanceFromNode(target); if (internalInstance) { if ("number" == typeof internalInstance.tag) { invariant(fiberHostComponent && "function" == typeof fiberHostComponent.restoreControlledState, "Fiber needs to be injected to handle a fiber target for controlled " + "events. This error is likely caused by a bug in React. Please file an issue."); var props = EventPluginUtils_1.getFiberCurrentPropsFromNode(internalInstance.stateNode); return void fiberHostComponent.restoreControlledState(internalInstance.stateNode, internalInstance.type, props); } invariant("function" == typeof internalInstance.restoreControlledState, "The internal instance must be a React host component. " + "This error is likely caused by a bug in React. Please file an issue."), internalInstance.restoreControlledState(); } } var ReactControlledComponent = { injection: ReactControlledComponentInjection, enqueueStateRestore: function(target) { restoreTarget ? restoreQueue ? restoreQueue.push(target) : restoreQueue = [ target ] : restoreTarget = target; }, restoreStateIfNeeded: function() { if (restoreTarget) { var target = restoreTarget, queuedTargets = restoreQueue; if (restoreTarget = null, restoreQueue = null, restoreStateOfTarget(target), queuedTargets) for (var i = 0; i < queuedTargets.length; i++) restoreStateOfTarget(queuedTargets[i]); } } }, ReactControlledComponent_1 = ReactControlledComponent, stackBatchedUpdates = function(fn, a, b, c, d, e) { return fn(a, b, c, d, e); }, fiberBatchedUpdates = function(fn, bookkeeping) { return fn(bookkeeping); }; function performFiberBatchedUpdates(fn, bookkeeping) { return fiberBatchedUpdates(fn, bookkeeping); } function batchedUpdates$1(fn, bookkeeping) { return stackBatchedUpdates(performFiberBatchedUpdates, fn, bookkeeping); } var isNestingBatched = !1; function batchedUpdatesWithControlledComponents(fn, bookkeeping) { if (isNestingBatched) return batchedUpdates$1(fn, bookkeeping); isNestingBatched = !0; try { return batchedUpdates$1(fn, bookkeeping); } finally { isNestingBatched = !1, ReactControlledComponent_1.restoreStateIfNeeded(); } } var ReactGenericBatchingInjection = { injectStackBatchedUpdates: function(_batchedUpdates) { stackBatchedUpdates = _batchedUpdates; }, injectFiberBatchedUpdates: function(_batchedUpdates) { fiberBatchedUpdates = _batchedUpdates; } }, ReactGenericBatching = { batchedUpdates: batchedUpdatesWithControlledComponents, injection: ReactGenericBatchingInjection }, ReactGenericBatching_1 = ReactGenericBatching, EMPTY_NATIVE_EVENT = {}, touchSubsequence = function(touches, indices) { for (var ret = [], i = 0; i < indices.length; i++) ret.push(touches[indices[i]]); return ret; }, removeTouchesAtIndices = function(touches, indices) { for (var rippedOut = [], temp = touches, i = 0; i < indices.length; i++) { var index = indices[i]; rippedOut.push(touches[index]), temp[index] = null; } for (var fillAt = 0, j = 0; j < temp.length; j++) { var cur = temp[j]; null !== cur && (temp[fillAt++] = cur); } return temp.length = fillAt, rippedOut; }, ReactNativeEventEmitter = Object.assign({}, ReactEventEmitterMixin_1, { registrationNames: EventPluginRegistry_1.registrationNameModules, getListener: EventPluginHub_1.getListener, _receiveRootNodeIDEvent: function(rootNodeID, topLevelType, nativeEventParam) { var nativeEvent = nativeEventParam || EMPTY_NATIVE_EVENT, inst = ReactNativeComponentTree_1.getInstanceFromNode(rootNodeID); ReactGenericBatching_1.batchedUpdates(function() { ReactNativeEventEmitter.handleTopLevel(topLevelType, inst, nativeEvent, nativeEvent.target); }); }, receiveEvent: function(tag, topLevelType, nativeEventParam) { var rootNodeID = tag; ReactNativeEventEmitter._receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam); }, receiveTouches: function(eventTopLevelType, touches, changedIndices) { for (var changedTouches = "topTouchEnd" === eventTopLevelType || "topTouchCancel" === eventTopLevelType ? removeTouchesAtIndices(touches, changedIndices) : touchSubsequence(touches, changedIndices), jj = 0; jj < changedTouches.length; jj++) { var touch = changedTouches[jj]; touch.changedTouches = changedTouches, touch.touches = touches; var nativeEvent = touch, rootNodeID = null, target = nativeEvent.target; null !== target && void 0 !== target && (target < ReactNativeTagHandles_1.tagsStartAt ? warning(!1, "A view is reporting that a touch occurred on tag zero.") : rootNodeID = target), ReactNativeEventEmitter._receiveRootNodeIDEvent(rootNodeID, eventTopLevelType, nativeEvent); } } }), ReactNativeEventEmitter_1 = ReactNativeEventEmitter, ReactNativeEventPluginOrder = [ "ResponderEventPlugin", "ReactNativeBridgeEventPlugin" ], ReactNativeEventPluginOrder_1 = ReactNativeEventPluginOrder, ReactNativeGlobalResponderHandler = { onChange: function(from, to, blockNativeResponder) { if (null !== to) { var tag = "number" != typeof to.tag ? to._rootNodeID : to.stateNode._nativeTag; UIManager.setJSResponder(tag, blockNativeResponder); } else UIManager.clearJSResponder(); } }, ReactNativeGlobalResponderHandler_1 = ReactNativeGlobalResponderHandler, ResponderEventInterface = { touchHistory: function(nativeEvent) { return null; } }; function ResponderSyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { return SyntheticEvent_1.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); } SyntheticEvent_1.augmentClass(ResponderSyntheticEvent, ResponderEventInterface); var ResponderSyntheticEvent_1 = ResponderSyntheticEvent, isEndish$2 = EventPluginUtils_1.isEndish, isMoveish$2 = EventPluginUtils_1.isMoveish, isStartish$2 = EventPluginUtils_1.isStartish, warning$9 = warning, MAX_TOUCH_BANK = 20, touchBank = [], touchHistory = { touchBank: touchBank, numberActiveTouches: 0, indexOfSingleActiveTouch: -1, mostRecentTimeStamp: 0 }; function timestampForTouch(touch) { return touch.timeStamp || touch.timestamp; } function createTouchRecord(touch) { return { touchActive: !0, startPageX: touch.pageX, startPageY: touch.pageY, startTimeStamp: timestampForTouch(touch), currentPageX: touch.pageX, currentPageY: touch.pageY, currentTimeStamp: timestampForTouch(touch), previousPageX: touch.pageX, previousPageY: touch.pageY, previousTimeStamp: timestampForTouch(touch) }; } function resetTouchRecord(touchRecord, touch) { touchRecord.touchActive = !0, touchRecord.startPageX = touch.pageX, touchRecord.startPageY = touch.pageY, touchRecord.startTimeStamp = timestampForTouch(touch), touchRecord.currentPageX = touch.pageX, touchRecord.currentPageY = touch.pageY, touchRecord.currentTimeStamp = timestampForTouch(touch), touchRecord.previousPageX = touch.pageX, touchRecord.previousPageY = touch.pageY, touchRecord.previousTimeStamp = timestampForTouch(touch); } function getTouchIdentifier(_ref) { var identifier = _ref.identifier; return invariant(null != identifier, "Touch object is missing identifier."), warning$9(identifier <= MAX_TOUCH_BANK, "Touch identifier %s is greater than maximum supported %s which causes " + "performance issues backfilling array locations for all of the indices.", identifier, MAX_TOUCH_BANK), identifier; } function recordTouchStart(touch) { var identifier = getTouchIdentifier(touch), touchRecord = touchBank[identifier]; touchRecord ? resetTouchRecord(touchRecord, touch) : touchBank[identifier] = createTouchRecord(touch), touchHistory.mostRecentTimeStamp = timestampForTouch(touch); } function recordTouchMove(touch) { var touchRecord = touchBank[getTouchIdentifier(touch)]; touchRecord ? (touchRecord.touchActive = !0, touchRecord.previousPageX = touchRecord.currentPageX, touchRecord.previousPageY = touchRecord.currentPageY, touchRecord.previousTimeStamp = touchRecord.currentTimeStamp, touchRecord.currentPageX = touch.pageX, touchRecord.currentPageY = touch.pageY, touchRecord.currentTimeStamp = timestampForTouch(touch), touchHistory.mostRecentTimeStamp = timestampForTouch(touch)) : console.error("Cannot record touch move without a touch start.\n" + "Touch Move: %s\n", "Touch Bank: %s", printTouch(touch), printTouchBank()); } function recordTouchEnd(touch) { var touchRecord = touchBank[getTouchIdentifier(touch)]; touchRecord ? (touchRecord.touchActive = !1, touchRecord.previousPageX = touchRecord.currentPageX, touchRecord.previousPageY = touchRecord.currentPageY, touchRecord.previousTimeStamp = touchRecord.currentTimeStamp, touchRecord.currentPageX = touch.pageX, touchRecord.currentPageY = touch.pageY, touchRecord.currentTimeStamp = timestampForTouch(touch), touchHistory.mostRecentTimeStamp = timestampForTouch(touch)) : console.error("Cannot record touch end without a touch start.\n" + "Touch End: %s\n", "Touch Bank: %s", printTouch(touch), printTouchBank()); } function printTouch(touch) { return JSON.stringify({ identifier: touch.identifier, pageX: touch.pageX, pageY: touch.pageY, timestamp: timestampForTouch(touch) }); } function printTouchBank() { var printed = JSON.stringify(touchBank.slice(0, MAX_TOUCH_BANK)); return touchBank.length > MAX_TOUCH_BANK && (printed += " (original size: " + touchBank.length + ")"), printed; } var ResponderTouchHistoryStore = { recordTouchTrack: function(topLevelType, nativeEvent) { if (isMoveish$2(topLevelType)) nativeEvent.changedTouches.forEach(recordTouchMove); else if (isStartish$2(topLevelType)) nativeEvent.changedTouches.forEach(recordTouchStart), touchHistory.numberActiveTouches = nativeEvent.touches.length, 1 === touchHistory.numberActiveTouches && (touchHistory.indexOfSingleActiveTouch = nativeEvent.touches[0].identifier); else if (isEndish$2(topLevelType) && (nativeEvent.changedTouches.forEach(recordTouchEnd), touchHistory.numberActiveTouches = nativeEvent.touches.length, 1 === touchHistory.numberActiveTouches)) { for (var i = 0; i < touchBank.length; i++) { var touchTrackToCheck = touchBank[i]; if (null != touchTrackToCheck && touchTrackToCheck.touchActive) { touchHistory.indexOfSingleActiveTouch = i; break; } } var activeRecord = touchBank[touchHistory.indexOfSingleActiveTouch]; warning$9(null != activeRecord && activeRecord.touchActive, "Cannot find single active touch."); } }, touchHistory: touchHistory }, ResponderTouchHistoryStore_1 = ResponderTouchHistoryStore; function accumulate(current, next) { return invariant(null != next, "accumulate(...): Accumulated items must be not be null or undefined."), null == current ? next : Array.isArray(current) ? current.concat(next) : Array.isArray(next) ? [ current ].concat(next) : [ current, next ]; } var accumulate_1 = accumulate, isStartish$1 = EventPluginUtils_1.isStartish, isMoveish$1 = EventPluginUtils_1.isMoveish, isEndish$1 = EventPluginUtils_1.isEndish, executeDirectDispatch$1 = EventPluginUtils_1.executeDirectDispatch, hasDispatches$1 = EventPluginUtils_1.hasDispatches, executeDispatchesInOrderStopAtTrue$1 = EventPluginUtils_1.executeDispatchesInOrderStopAtTrue, responderInst = null, trackedTouchCount = 0, previousActiveTouches = 0, changeResponder = function(nextResponderInst, blockHostResponder) { var oldResponderInst = responderInst; responderInst = nextResponderInst, null !== ResponderEventPlugin.GlobalResponderHandler && ResponderEventPlugin.GlobalResponderHandler.onChange(oldResponderInst, nextResponderInst, blockHostResponder); }, eventTypes = { startShouldSetResponder: { phasedRegistrationNames: { bubbled: "onStartShouldSetResponder", captured: "onStartShouldSetResponderCapture" } }, scrollShouldSetResponder: { phasedRegistrationNames: { bubbled: "onScrollShouldSetResponder", captured: "onScrollShouldSetResponderCapture" } }, selectionChangeShouldSetResponder: { phasedRegistrationNames: { bubbled: "onSelectionChangeShouldSetResponder", captured: "onSelectionChangeShouldSetResponderCapture" } }, moveShouldSetResponder: { phasedRegistrationNames: { bubbled: "onMoveShouldSetResponder", captured: "onMoveShouldSetResponderCapture" } }, responderStart: { registrationName: "onResponderStart" }, responderMove: { registrationName: "onResponderMove" }, responderEnd: { registrationName: "onResponderEnd" }, responderRelease: { registrationName: "onResponderRelease" }, responderTerminationRequest: { registrationName: "onResponderTerminationRequest" }, responderGrant: { registrationName: "onResponderGrant" }, responderReject: { registrationName: "onResponderReject" }, responderTerminate: { registrationName: "onResponderTerminate" } }; function setResponderAndExtractTransfer(topLevelType, targetInst, nativeEvent, nativeEventTarget) { var shouldSetEventType = isStartish$1(topLevelType) ? eventTypes.startShouldSetResponder : isMoveish$1(topLevelType) ? eventTypes.moveShouldSetResponder : "topSelectionChange" === topLevelType ? eventTypes.selectionChangeShouldSetResponder : eventTypes.scrollShouldSetResponder, bubbleShouldSetFrom = responderInst ? ReactTreeTraversal.getLowestCommonAncestor(responderInst, targetInst) : targetInst, skipOverBubbleShouldSetFrom = bubbleShouldSetFrom === responderInst, shouldSetEvent = ResponderSyntheticEvent_1.getPooled(shouldSetEventType, bubbleShouldSetFrom, nativeEvent, nativeEventTarget); shouldSetEvent.touchHistory = ResponderTouchHistoryStore_1.touchHistory, skipOverBubbleShouldSetFrom ? EventPropagators_1.accumulateTwoPhaseDispatchesSkipTarget(shouldSetEvent) : EventPropagators_1.accumulateTwoPhaseDispatches(shouldSetEvent); var wantsResponderInst = executeDispatchesInOrderStopAtTrue$1(shouldSetEvent); if (shouldSetEvent.isPersistent() || shouldSetEvent.constructor.release(shouldSetEvent), !wantsResponderInst || wantsResponderInst === responderInst) return null; var extracted, grantEvent = ResponderSyntheticEvent_1.getPooled(eventTypes.responderGrant, wantsResponderInst, nativeEvent, nativeEventTarget); grantEvent.touchHistory = ResponderTouchHistoryStore_1.touchHistory, EventPropagators_1.accumulateDirectDispatches(grantEvent); var blockHostResponder = !0 === executeDirectDispatch$1(grantEvent); if (responderInst) { var terminationRequestEvent = ResponderSyntheticEvent_1.getPooled(eventTypes.responderTerminationRequest, responderInst, nativeEvent, nativeEventTarget); terminationRequestEvent.touchHistory = ResponderTouchHistoryStore_1.touchHistory, EventPropagators_1.accumulateDirectDispatches(terminationRequestEvent); var shouldSwitch = !hasDispatches$1(terminationRequestEvent) || executeDirectDispatch$1(terminationRequestEvent); if (terminationRequestEvent.isPersistent() || terminationRequestEvent.constructor.release(terminationRequestEvent), shouldSwitch) { var terminateEvent = ResponderSyntheticEvent_1.getPooled(eventTypes.responderTerminate, responderInst, nativeEvent, nativeEventTarget); terminateEvent.touchHistory = ResponderTouchHistoryStore_1.touchHistory, EventPropagators_1.accumulateDirectDispatches(terminateEvent), extracted = accumulate_1(extracted, [ grantEvent, terminateEvent ]), changeResponder(wantsResponderInst, blockHostResponder); } else { var rejectEvent = ResponderSyntheticEvent_1.getPooled(eventTypes.responderReject, wantsResponderInst, nativeEvent, nativeEventTarget); rejectEvent.touchHistory = ResponderTouchHistoryStore_1.touchHistory, EventPropagators_1.accumulateDirectDispatches(rejectEvent), extracted = accumulate_1(extracted, rejectEvent); } } else extracted = accumulate_1(extracted, grantEvent), changeResponder(wantsResponderInst, blockHostResponder); return extracted; } function canTriggerTransfer(topLevelType, topLevelInst, nativeEvent) { return topLevelInst && ("topScroll" === topLevelType && !nativeEvent.responderIgnoreScroll || trackedTouchCount > 0 && "topSelectionChange" === topLevelType || isStartish$1(topLevelType) || isMoveish$1(topLevelType)); } function noResponderTouches(nativeEvent) { var touches = nativeEvent.touches; if (!touches || 0 === touches.length) return !0; for (var i = 0; i < touches.length; i++) { var activeTouch = touches[i], target = activeTouch.target; if (null !== target && void 0 !== target && 0 !== target) { var targetInst = EventPluginUtils_1.getInstanceFromNode(target); if (ReactTreeTraversal.isAncestor(responderInst, targetInst)) return !1; } } return !0; } var ResponderEventPlugin = { _getResponder: function() { return responderInst; }, eventTypes: eventTypes, extractEvents: function(topLevelType, targetInst, nativeEvent, nativeEventTarget) { if (isStartish$1(topLevelType)) trackedTouchCount += 1; else if (isEndish$1(topLevelType)) { if (!(trackedTouchCount >= 0)) return console.error("Ended a touch event which was not counted in `trackedTouchCount`."), null; trackedTouchCount -= 1; } ResponderTouchHistoryStore_1.recordTouchTrack(topLevelType, nativeEvent); var extracted = canTriggerTransfer(topLevelType, targetInst, nativeEvent) ? setResponderAndExtractTransfer(topLevelType, targetInst, nativeEvent, nativeEventTarget) : null, isResponderTouchStart = responderInst && isStartish$1(topLevelType), isResponderTouchMove = responderInst && isMoveish$1(topLevelType), isResponderTouchEnd = responderInst && isEndish$1(topLevelType), incrementalTouch = isResponderTouchStart ? eventTypes.responderStart : isResponderTouchMove ? eventTypes.responderMove : isResponderTouchEnd ? eventTypes.responderEnd : null; if (incrementalTouch) { var gesture = ResponderSyntheticEvent_1.getPooled(incrementalTouch, responderInst, nativeEvent, nativeEventTarget); gesture.touchHistory = ResponderTouchHistoryStore_1.touchHistory, EventPropagators_1.accumulateDirectDispatches(gesture), extracted = accumulate_1(extracted, gesture); } var isResponderTerminate = responderInst && "topTouchCancel" === topLevelType, isResponderRelease = responderInst && !isResponderTerminate && isEndish$1(topLevelType) && noResponderTouches(nativeEvent), finalTouch = isResponderTerminate ? eventTypes.responderTerminate : isResponderRelease ? eventTypes.responderRelease : null; if (finalTouch) { var finalEvent = ResponderSyntheticEvent_1.getPooled(finalTouch, responderInst, nativeEvent, nativeEventTarget); finalEvent.touchHistory = ResponderTouchHistoryStore_1.touchHistory, EventPropagators_1.accumulateDirectDispatches(finalEvent), extracted = accumulate_1(extracted, finalEvent), changeResponder(null); } var numberActiveTouches = ResponderTouchHistoryStore_1.touchHistory.numberActiveTouches; return ResponderEventPlugin.GlobalInteractionHandler && numberActiveTouches !== previousActiveTouches && ResponderEventPlugin.GlobalInteractionHandler.onChange(numberActiveTouches), previousActiveTouches = numberActiveTouches, extracted; }, GlobalResponderHandler: null, GlobalInteractionHandler: null, injection: { injectGlobalResponderHandler: function(GlobalResponderHandler) { ResponderEventPlugin.GlobalResponderHandler = GlobalResponderHandler; }, injectGlobalInteractionHandler: function(GlobalInteractionHandler) { ResponderEventPlugin.GlobalInteractionHandler = GlobalInteractionHandler; } } }, ResponderEventPlugin_1 = ResponderEventPlugin; RCTEventEmitter.register(ReactNativeEventEmitter_1), EventPluginHub_1.injection.injectEventPluginOrder(ReactNativeEventPluginOrder_1), EventPluginUtils_1.injection.injectComponentTree(ReactNativeComponentTree_1), ResponderEventPlugin_1.injection.injectGlobalResponderHandler(ReactNativeGlobalResponderHandler_1), EventPluginHub_1.injection.injectEventPluginsByName({ ResponderEventPlugin: ResponderEventPlugin_1, ReactNativeBridgeEventPlugin: ReactNativeBridgeEventPlugin_1 }); var RESET_BATCHED_UPDATES = { initialize: emptyFunction, close: function() { ReactDefaultBatchingStrategy.isBatchingUpdates = !1; } }, FLUSH_BATCHED_UPDATES = { initialize: emptyFunction, close: ReactUpdates_1.flushBatchedUpdates.bind(ReactUpdates_1) }, TRANSACTION_WRAPPERS$1 = [ FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES ]; function ReactDefaultBatchingStrategyTransaction() { this.reinitializeTransaction(); } Object.assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction, { getTransactionWrappers: function() { return TRANSACTION_WRAPPERS$1; } }); var transaction = new ReactDefaultBatchingStrategyTransaction(), ReactDefaultBatchingStrategy = { isBatchingUpdates: !1, batchedUpdates: function(callback, a, b, c, d, e) { var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates; return ReactDefaultBatchingStrategy.isBatchingUpdates = !0, alreadyBatchingUpdates ? callback(a, b, c, d, e) : transaction.perform(callback, null, a, b, c, d, e); } }, ReactDefaultBatchingStrategy_1 = ReactDefaultBatchingStrategy, dangerouslyProcessChildrenUpdates = function(inst, childrenUpdates) { if (childrenUpdates.length) { for (var moveFromIndices, moveToIndices, addChildTags, addAtIndices, removeAtIndices, containerTag = ReactNativeComponentTree_1.getNodeFromInstance(inst), i = 0; i < childrenUpdates.length; i++) { var update = childrenUpdates[i]; if ("MOVE_EXISTING" === update.type) (moveFromIndices || (moveFromIndices = [])).push(update.fromIndex), (moveToIndices || (moveToIndices = [])).push(update.toIndex); else if ("REMOVE_NODE" === update.type) (removeAtIndices || (removeAtIndices = [])).push(update.fromIndex); else if ("INSERT_MARKUP" === update.type) { var mountImage = update.content, tag = mountImage; (addAtIndices || (addAtIndices = [])).push(update.toIndex), (addChildTags || (addChildTags = [])).push(tag); } } UIManager.manageChildren(containerTag, moveFromIndices, moveToIndices, addChildTags, addAtIndices, removeAtIndices); } }, ReactNativeDOMIDOperations = { dangerouslyProcessChildrenUpdates: dangerouslyProcessChildrenUpdates, dangerouslyReplaceNodeWithMarkupByID: function(id, mountImage) { var oldTag = id; UIManager.replaceExistingNonRootView(oldTag, mountImage); } }, ReactNativeDOMIDOperations_1 = ReactNativeDOMIDOperations; function validateCallback(callback) { invariant(!callback || "function" == typeof callback, "Invalid argument passed as callback. Expected a function. Instead " + "received: %s", callback); } var validateCallback_1 = validateCallback; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); } var CallbackQueue = function() { function CallbackQueue() { _classCallCheck(this, CallbackQueue), this._callbacks = null, this._contexts = null; } return CallbackQueue.prototype.enqueue = function(callback, context) { this._callbacks = this._callbacks || [], this._callbacks.push(callback), this._contexts = this._contexts || [], this._contexts.push(context); }, CallbackQueue.prototype.notifyAll = function() { var callbacks = this._callbacks, contexts = this._contexts; if (callbacks && contexts) { invariant(callbacks.length === contexts.length, "Mismatched list of contexts in callback queue"), this._callbacks = null, this._contexts = null; for (var i = 0; i < callbacks.length; i++) validateCallback_1(callbacks[i]), callbacks[i].call(contexts[i]); callbacks.length = 0, contexts.length = 0; } }, CallbackQueue.prototype.checkpoint = function() { return this._callbacks ? this._callbacks.length : 0; }, CallbackQueue.prototype.rollback = function(len) { this._callbacks && this._contexts && (this._callbacks.length = len, this._contexts.length = len); }, CallbackQueue.prototype.reset = function() { this._callbacks = null, this._contexts = null; }, CallbackQueue.prototype.destructor = function() { this.reset(); }, CallbackQueue; }(), CallbackQueue_1 = PooledClass_1.addPoolingTo(CallbackQueue), ON_DOM_READY_QUEUEING = { initialize: function() { this.reactMountReady.reset(); }, close: function() { this.reactMountReady.notifyAll(); } }, TRANSACTION_WRAPPERS$2 = [ ON_DOM_READY_QUEUEING ]; TRANSACTION_WRAPPERS$2.push({ initialize: ReactInstrumentation.debugTool.onBeginFlush, close: ReactInstrumentation.debugTool.onEndFlush }); function ReactNativeReconcileTransaction() { this.reinitializeTransaction(), this.reactMountReady = CallbackQueue_1.getPooled(); } var Mixin = { getTransactionWrappers: function() { return TRANSACTION_WRAPPERS$2; }, getReactMountReady: function() { return this.reactMountReady; }, getUpdateQueue: function() { return ReactUpdateQueue_1; }, checkpoint: function() { return this.reactMountReady.checkpoint(); }, rollback: function(checkpoint) { this.reactMountReady.rollback(checkpoint); }, destructor: function() { CallbackQueue_1.release(this.reactMountReady), this.reactMountReady = null; } }; Object.assign(ReactNativeReconcileTransaction.prototype, Transaction, ReactNativeReconcileTransaction, Mixin), PooledClass_1.addPoolingTo(ReactNativeReconcileTransaction); var ReactNativeReconcileTransaction_1 = ReactNativeReconcileTransaction, ReactNativeComponentEnvironment = { processChildrenUpdates: ReactNativeDOMIDOperations_1.dangerouslyProcessChildrenUpdates, replaceNodeWithMarkup: ReactNativeDOMIDOperations_1.dangerouslyReplaceNodeWithMarkupByID, clearNode: function() {}, ReactReconcileTransaction: ReactNativeReconcileTransaction_1 }, ReactNativeComponentEnvironment_1 = ReactNativeComponentEnvironment, ReactNativeTextComponent = function(text) { this._currentElement = text, this._stringText = "" + text, this._hostParent = null, this._rootNodeID = 0; }; Object.assign(ReactNativeTextComponent.prototype, { mountComponent: function(transaction, hostParent, hostContainerInfo, context) { invariant(context.isInAParentText, 'RawText "%s" must be wrapped in an explicit <Text> component.', this._stringText), this._hostParent = hostParent; var tag = ReactNativeTagHandles_1.allocateTag(); this._rootNodeID = tag; var nativeTopRootTag = hostContainerInfo._tag; return UIManager.createView(tag, "RCTRawText", nativeTopRootTag, { text: this._stringText }), ReactNativeComponentTree_1.precacheNode(this, tag), tag; }, getHostNode: function() { return this._rootNodeID; }, receiveComponent: function(nextText, transaction, context) { if (nextText !== this._currentElement) { this._currentElement = nextText; var nextStringText = "" + nextText; nextStringText !== this._stringText && (this._stringText = nextStringText, UIManager.updateView(this._rootNodeID, "RCTRawText", { text: this._stringText })); } }, unmountComponent: function() { ReactNativeComponentTree_1.uncacheNode(this), this._currentElement = null, this._stringText = null, this._rootNodeID = 0; } }); var ReactNativeTextComponent_1 = ReactNativeTextComponent, ReactSimpleEmptyComponent = function(placeholderElement, instantiate) { this._currentElement = null, this._renderedComponent = instantiate(placeholderElement); }; Object.assign(ReactSimpleEmptyComponent.prototype, { mountComponent: function(transaction, hostParent, hostContainerInfo, context, parentDebugID) { return ReactReconciler_1.mountComponent(this._renderedComponent, transaction, hostParent, hostContainerInfo, context, parentDebugID); }, receiveComponent: function() {}, getHostNode: function() { return ReactReconciler_1.getHostNode(this._renderedComponent); }, unmountComponent: function(safely, skipLifecycle) { ReactReconciler_1.unmountComponent(this._renderedComponent, safely, skipLifecycle), this._renderedComponent = null; } }); var ReactSimpleEmptyComponent_1 = ReactSimpleEmptyComponent; ReactGenericBatching_1.injection.injectStackBatchedUpdates(ReactUpdates_1.batchedUpdates), ReactUpdates_1.injection.injectReconcileTransaction(ReactNativeComponentEnvironment_1.ReactReconcileTransaction), ReactUpdates_1.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy_1), ReactComponentEnvironment_1.injection.injectEnvironment(ReactNativeComponentEnvironment_1); var EmptyComponent = function(instantiate) { var View = require('../Components/View/View'); return new ReactSimpleEmptyComponent_1(React.createElement(View, { collapsable: !0, style: { position: "absolute" } }), instantiate); }; ReactEmptyComponent_1.injection.injectEmptyComponentFactory(EmptyComponent), ReactHostComponent_1.injection.injectTextComponentClass(ReactNativeTextComponent_1), ReactHostComponent_1.injection.injectGenericComponentClass(function(tag) { var info = ""; "string" == typeof tag && /^[a-z]/.test(tag) && (info += " Each component name should start with an uppercase letter."), invariant(!1, "Expected a component class, got %s.%s", tag, info); }); function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); } var objects = {}, uniqueID = 1, emptyObject$3 = {}, ReactNativePropRegistry = function() { function ReactNativePropRegistry() { _classCallCheck$2(this, ReactNativePropRegistry); } return ReactNativePropRegistry.register = function(object) { var id = ++uniqueID; return Object.freeze(object), objects[id] = object, id; }, ReactNativePropRegistry.getByID = function(id) { if (!id) return emptyObject$3; var object = objects[id]; return object || (console.warn("Invalid style with id `" + id + "`. Skipping ..."), emptyObject$3); }, ReactNativePropRegistry; }(), ReactNativePropRegistry_1 = ReactNativePropRegistry, emptyObject$2 = {}, removedKeys = null, removedKeyCount = 0; function defaultDiffer(prevProp, nextProp) { return "object" != typeof nextProp || null === nextProp || deepDiffer(prevProp, nextProp); } function resolveObject(idOrObject) { return "number" == typeof idOrObject ? ReactNativePropRegistry_1.getByID(idOrObject) : idOrObject; } function restoreDeletedValuesInNestedArray(updatePayload, node, validAttributes) { if (Array.isArray(node)) for (var i = node.length; i-- && removedKeyCount > 0; ) restoreDeletedValuesInNestedArray(updatePayload, node[i], validAttributes); else if (node && removedKeyCount > 0) { var obj = resolveObject(node); for (var propKey in removedKeys) if (removedKeys[propKey]) { var nextProp = obj[propKey]; if (void 0 !== nextProp) { var attributeConfig = validAttributes[propKey]; if (attributeConfig) { if ("function" == typeof nextProp && (nextProp = !0), void 0 === nextProp && (nextProp = null), "object" != typeof attributeConfig) updatePayload[propKey] = nextProp; else if ("function" == typeof attributeConfig.diff || "function" == typeof attributeConfig.process) { var nextValue = "function" == typeof attributeConfig.process ? attributeConfig.process(nextProp) : nextProp; updatePayload[propKey] = nextValue; } removedKeys[propKey] = !1, removedKeyCount--; } } } } } function diffNestedArrayProperty(updatePayload, prevArray, nextArray, validAttributes) { var i, minLength = prevArray.length < nextArray.length ? prevArray.length : nextArray.length; for (i = 0; i < minLength; i++) updatePayload = diffNestedProperty(updatePayload, prevArray[i], nextArray[i], validAttributes); for (;i < prevArray.length; i++) updatePayload = clearNestedProperty(updatePayload, prevArray[i], validAttributes); for (;i < nextArray.length; i++) updatePayload = addNestedProperty(updatePayload, nextArray[i], validAttributes); return updatePayload; } function diffNestedProperty(updatePayload, prevProp, nextProp, validAttributes) { return updatePayload || prevProp !== nextProp ? prevProp && nextProp ? Array.isArray(prevProp) || Array.isArray(nextProp) ? Array.isArray(prevProp) && Array.isArray(nextProp) ? diffNestedArrayProperty(updatePayload, prevProp, nextProp, validAttributes) : Array.isArray(prevProp) ? diffProperties(updatePayload, flattenStyle(prevProp), resolveObject(nextProp), validAttributes) : diffProperties(updatePayload, resolveObject(prevProp), flattenStyle(nextProp), validAttributes) : diffProperties(updatePayload, resolveObject(prevProp), resolveObject(nextProp), validAttributes) : nextProp ? addNestedProperty(updatePayload, nextProp, validAttributes) : prevProp ? clearNestedProperty(updatePayload, prevProp, validAttributes) : updatePayload : updatePayload; } function addNestedProperty(updatePayload, nextProp, validAttributes) { if (!nextProp) return updatePayload; if (!Array.isArray(nextProp)) return addProperties(updatePayload, resolveObject(nextProp), validAttributes); for (var i = 0; i < nextProp.length; i++) updatePayload = addNestedProperty(updatePayload, nextProp[i], validAttributes); return updatePayload; } function clearNestedProperty(updatePayload, prevProp, validAttributes) { if (!prevProp) return updatePayload; if (!Array.isArray(prevProp)) return clearProperties(updatePayload, resolveObject(prevProp), validAttributes); for (var i = 0; i < prevProp.length; i++) updatePayload = clearNestedProperty(updatePayload, prevProp[i], validAttributes); return updatePayload; } function diffProperties(updatePayload, prevProps, nextProps, validAttributes) { var attributeConfig, nextProp, prevProp; for (var propKey in nextProps) if (attributeConfig = validAttributes[propKey]) if (prevProp = prevProps[propKey], nextProp = nextProps[propKey], "function" == typeof nextProp && (nextProp = !0, "function" == typeof prevProp && (prevProp = !0)), void 0 === nextProp && (nextProp = null, void 0 === prevProp && (prevProp = null)), removedKeys && (removedKeys[propKey] = !1), updatePayload && void 0 !== updatePayload[propKey]) { if ("object" != typeof attributeConfig) updatePayload[propKey] = nextProp; else if ("function" == typeof attributeConfig.diff || "function" == typeof attributeConfig.process) { var nextValue = "function" == typeof attributeConfig.process ? attributeConfig.process(nextProp) : nextProp; updatePayload[propKey] = nextValue; } } else if (prevProp !== nextProp) if ("object" != typeof attributeConfig) defaultDiffer(prevProp, nextProp) && ((updatePayload || (updatePayload = {}))[propKey] = nextProp); else if ("function" == typeof attributeConfig.diff || "function" == typeof attributeConfig.process) { var shouldUpdate = void 0 === prevProp || ("function" == typeof attributeConfig.diff ? attributeConfig.diff(prevProp, nextProp) : defaultDiffer(prevProp, nextProp)); shouldUpdate && (nextValue = "function" == typeof attributeConfig.process ? attributeConfig.process(nextProp) : nextProp, (updatePayload || (updatePayload = {}))[propKey] = nextValue); } else removedKeys = null, removedKeyCount = 0, updatePayload = diffNestedProperty(updatePayload, prevProp, nextProp, attributeConfig), removedKeyCount > 0 && updatePayload && (restoreDeletedValuesInNestedArray(updatePayload, nextProp, attributeConfig), removedKeys = null); for (propKey in prevProps) void 0 === nextProps[propKey] && (attributeConfig = validAttributes[propKey]) && (updatePayload && void 0 !== updatePayload[propKey] || void 0 !== (prevProp = prevProps[propKey]) && ("object" != typeof attributeConfig || "function" == typeof attributeConfig.diff || "function" == typeof attributeConfig.process ? ((updatePayload || (updatePayload = {}))[propKey] = null, removedKeys || (removedKeys = {}), removedKeys[propKey] || (removedKeys[propKey] = !0, removedKeyCount++)) : updatePayload = clearNestedProperty(updatePayload, prevProp, attributeConfig))); return updatePayload; } function addProperties(updatePayload, props, validAttributes) { return diffProperties(updatePayload, emptyObject$2, props, validAttributes); } function clearProperties(updatePayload, prevProps, validAttributes) { return diffProperties(updatePayload, prevProps, emptyObject$2, validAttributes); } var ReactNativeAttributePayload = { create: function(props, validAttributes) { return addProperties(null, props, validAttributes); }, diff: function(prevProps, nextProps, validAttributes) { return diffProperties(null, prevProps, nextProps, validAttributes); } }, ReactNativeAttributePayload_1 = ReactNativeAttributePayload; function mountSafeCallback$1(context, callback) { return function() { if (callback) { if ("boolean" == typeof context.__isMounted) { if (!context.__isMounted) return; } else if ("function" == typeof context.isMounted && !context.isMounted()) return; return callback.apply(context, arguments); } }; } function throwOnStylesProp(component, props) { if (void 0 !== props.styles) { var owner = component._owner || null, name = component.constructor.displayName, msg = "`styles` is not a supported property of `" + name + "`, did " + "you mean `style` (singular)?"; throw owner && owner.constructor && owner.constructor.displayName && (msg += "\n\nCheck the `" + owner.constructor.displayName + "` parent " + " component."), new Error(msg); } } function warnForStyleProps(props, validAttributes) { for (var key in validAttributes.style) validAttributes[key] || void 0 === props[key] || console.error("You are setting the style `{ " + key + ": ... }` as a prop. You " + "should nest it in a style object. " + "E.g. `{ style: { " + key + ": ... } }`"); } var NativeMethodsMixinUtils = { mountSafeCallback: mountSafeCallback$1, throwOnStylesProp: throwOnStylesProp, warnForStyleProps: warnForStyleProps }; function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); } function _possibleConstructorReturn(self, call) { if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !call || "object" != typeof call && "function" != typeof call ? self : call; } function _inherits(subClass, superClass) { if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: !1, writable: !0, configurable: !0 } }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass); } var ReactNativeFeatureFlags$1 = require('../ReactNative/ReactNativeFeatureFlags'), mountSafeCallback = NativeMethodsMixinUtils.mountSafeCallback, findNumericNodeHandle = ReactNativeFeatureFlags$1.useFiber ? DevOnlyStubShim : findNumericNodeHandleStack, ReactNativeComponent = function(_React$Component) { _inherits(ReactNativeComponent, _React$Component); function ReactNativeComponent() { return _classCallCheck$1(this, ReactNativeComponent), _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } return ReactNativeComponent.prototype.blur = function() { TextInputState.blurTextInput(findNumericNodeHandle(this)); }, ReactNativeComponent.prototype.focus = function() { TextInputState.focusTextInput(findNumericNodeHandle(this)); }, ReactNativeComponent.prototype.measure = function(callback) { UIManager.measure(findNumericNodeHandle(this), mountSafeCallback(this, callback)); }, ReactNativeComponent.prototype.measureInWindow = function(callback) { UIManager.measureInWindow(findNumericNodeHandle(this), mountSafeCallback(this, callback)); }, ReactNativeComponent.prototype.measureLayout = function(relativeToNativeNode, onSuccess, onFail) { UIManager.measureLayout(findNumericNodeHandle(this), relativeToNativeNode, mountSafeCallback(this, onFail), mountSafeCallback(this, onSuccess)); }, ReactNativeComponent.prototype.setNativeProps = function(nativeProps) { injectedSetNativeProps(this, nativeProps); }, ReactNativeComponent; }(React.Component); function setNativePropsFiber(componentOrHandle, nativeProps) { var maybeInstance = void 0; try { maybeInstance = findNodeHandle_1(componentOrHandle); } catch (error) {} if (null != maybeInstance) { var viewConfig = maybeInstance.viewConfig, updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes); UIManager.updateView(maybeInstance._nativeTag, viewConfig.uiViewClassName, updatePayload); } } function setNativePropsStack(componentOrHandle, nativeProps) { var maybeInstance = findNodeHandle_1(componentOrHandle); if (null != maybeInstance) { var viewConfig = void 0; if (void 0 !== maybeInstance.viewConfig) viewConfig = maybeInstance.viewConfig; else if (void 0 !== maybeInstance._instance && void 0 !== maybeInstance._instance.viewConfig) viewConfig = maybeInstance._instance.viewConfig; else { for (;void 0 !== maybeInstance._renderedComponent; ) maybeInstance = maybeInstance._renderedComponent; viewConfig = maybeInstance.viewConfig; } var tag = "function" == typeof maybeInstance.getHostNode ? maybeInstance.getHostNode() : maybeInstance._rootNodeID, updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes); UIManager.updateView(tag, viewConfig.uiViewClassName, updatePayload); } } var injectedSetNativeProps = void 0; injectedSetNativeProps = ReactNativeFeatureFlags$1.useFiber ? setNativePropsFiber : setNativePropsStack; var ReactNativeComponent_1 = ReactNativeComponent, ReactNativeFeatureFlags$2 = require('../ReactNative/ReactNativeFeatureFlags'), mountSafeCallback$2 = NativeMethodsMixinUtils.mountSafeCallback, throwOnStylesProp$1 = NativeMethodsMixinUtils.throwOnStylesProp, warnForStyleProps$1 = NativeMethodsMixinUtils.warnForStyleProps, findNumericNodeHandle$1 = ReactNativeFeatureFlags$2.useFiber ? DevOnlyStubShim : findNumericNodeHandleStack, NativeMethodsMixin = { measure: function(callback) { UIManager.measure(findNumericNodeHandle$1(this), mountSafeCallback$2(this, callback)); }, measureInWindow: function(callback) { UIManager.measureInWindow(findNumericNodeHandle$1(this), mountSafeCallback$2(this, callback)); }, measureLayout: function(relativeToNativeNode, onSuccess, onFail) { UIManager.measureLayout(findNumericNodeHandle$1(this), relativeToNativeNode, mountSafeCallback$2(this, onFail), mountSafeCallback$2(this, onSuccess)); }, setNativeProps: function(nativeProps) { injectedSetNativeProps$1(this, nativeProps); }, focus: function() { TextInputState.focusTextInput(findNumericNodeHandle$1(this)); }, blur: function() { TextInputState.blurTextInput(findNumericNodeHandle$1(this)); } }; function setNativePropsFiber$1(componentOrHandle, nativeProps) { var maybeInstance = void 0; try { maybeInstance = findNodeHandle_1(componentOrHandle); } catch (error) {} if (null != maybeInstance) { var viewConfig = maybeInstance.viewConfig; warnForStyleProps$1(nativeProps, viewConfig.validAttributes); var updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes); UIManager.updateView(maybeInstance._nativeTag, viewConfig.uiViewClassName, updatePayload); } } function setNativePropsStack$1(componentOrHandle, nativeProps) { var maybeInstance = findNodeHandle_1(componentOrHandle); if (null != maybeInstance) { var viewConfig = void 0; if (void 0 !== maybeInstance.viewConfig) viewConfig = maybeInstance.viewConfig; else if (void 0 !== maybeInstance._instance && void 0 !== maybeInstance._instance.viewConfig) viewConfig = maybeInstance._instance.viewConfig; else { for (;void 0 !== maybeInstance._renderedComponent; ) maybeInstance = maybeInstance._renderedComponent; viewConfig = maybeInstance.viewConfig; } var tag = "function" == typeof maybeInstance.getHostNode ? maybeInstance.getHostNode() : maybeInstance._rootNodeID; warnForStyleProps$1(nativeProps, viewConfig.validAttributes); var updatePayload = ReactNativeAttributePayload_1.create(nativeProps, viewConfig.validAttributes); UIManager.updateView(tag, viewConfig.uiViewClassName, updatePayload); } } var injectedSetNativeProps$1 = void 0; injectedSetNativeProps$1 = ReactNativeFeatureFlags$2.useFiber ? setNativePropsFiber$1 : setNativePropsStack$1; var NativeMethodsMixin_DEV = NativeMethodsMixin; invariant(!NativeMethodsMixin_DEV.componentWillMount && !NativeMethodsMixin_DEV.componentWillReceiveProps, "Do not override existing functions."), NativeMethodsMixin_DEV.componentWillMount = function() { throwOnStylesProp$1(this, this.props); }, NativeMethodsMixin_DEV.componentWillReceiveProps = function(newProps) { throwOnStylesProp$1(this, newProps); }; var NativeMethodsMixin_1 = NativeMethodsMixin, TouchHistoryMath = { centroidDimension: function(touchHistory, touchesChangedAfter, isXAxis, ofCurrent) { var touchBank = touchHistory.touchBank, total = 0, count = 0, oneTouchData = 1 === touchHistory.numberActiveTouches ? touchHistory.touchBank[touchHistory.indexOfSingleActiveTouch] : null; if (null !== oneTouchData) oneTouchData.touchActive && oneTouchData.currentTimeStamp > touchesChangedAfter && (total += ofCurrent && isXAxis ? oneTouchData.currentPageX : ofCurrent && !isXAxis ? oneTouchData.currentPageY : !ofCurrent && isXAxis ? oneTouchData.previousPageX : oneTouchData.previousPageY, count = 1); else for (var i = 0; i < touchBank.length; i++) { var touchTrack = touchBank[i]; if (null !== touchTrack && void 0 !== touchTrack && touchTrack.touchActive && touchTrack.currentTimeStamp >= touchesChangedAfter) { var toAdd; toAdd = ofCurrent && isXAxis ? touchTrack.currentPageX : ofCurrent && !isXAxis ? touchTrack.currentPageY : !ofCurrent && isXAxis ? touchTrack.previousPageX : touchTrack.previousPageY, total += toAdd, count++; } } return count > 0 ? total / count : TouchHistoryMath.noCentroid; }, currentCentroidXOfTouchesChangedAfter: function(touchHistory, touchesChangedAfter) { return TouchHistoryMath.centroidDimension(touchHistory, touchesChangedAfter, !0, !0); }, currentCentroidYOfTouchesChangedAfter: function(touchHistory, touchesChangedAfter) { return TouchHistoryMath.centroidDimension(touchHistory, touchesChangedAfter, !1, !0); }, previousCentroidXOfTouchesChangedAfter: function(touchHistory, touchesChangedAfter) { return TouchHistoryMath.centroidDimension(touchHistory, touchesChangedAfter, !0, !1); }, previousCentroidYOfTouchesChangedAfter: function(touchHistory, touchesChangedAfter) { return TouchHistoryMath.centroidDimension(touchHistory, touchesChangedAfter, !1, !1); }, currentCentroidX: function(touchHistory) { return TouchHistoryMath.centroidDimension(touchHistory, 0, !0, !0); }, currentCentroidY: function(touchHistory) { return TouchHistoryMath.centroidDimension(touchHistory, 0, !1, !0); }, noCentroid: -1 }, TouchHistoryMath_1 = TouchHistoryMath; function escape(key) { var escaperLookup = { "=": "=0", ":": "=2" }; return "$" + ("" + key).replace(/[=:]/g, function(match) { return escaperLookup[match]; }); } var unescapeInDev = emptyFunction; unescapeInDev = function(key) { var unescapeRegex = /(=0|=2)/g, unescaperLookup = { "=0": "=", "=2": ":" }; return ("" + ("." === key[0] && "$" === key[1] ? key.substring(2) : key.substring(1))).replace(unescapeRegex, function(match) { return unescaperLookup[match]; }); }; var KeyEscapeUtils = { escape: escape, unescapeInDev: unescapeInDev }, KeyEscapeUtils_1 = KeyEscapeUtils, ITERATOR_SYMBOL = "function" == typeof Symbol && Symbol.iterator, FAUX_ITERATOR_SYMBOL = "@@iterator", REACT_ELEMENT_TYPE = "function" == typeof Symbol && Symbol.for && Symbol.for("react.element") || 60103, getCurrentStackAddendum$1 = ReactGlobalSharedState_1.ReactComponentTreeHook.getCurrentStackAddendum, SEPARATOR = ".", SUBSEPARATOR = ":", didWarnAboutMaps = !1; function getComponentKey(component, index) { return component && "object" == typeof component && null != component.key ? KeyEscapeUtils_1.escape(component.key) : index.toString(36); } function traverseStackChildrenImpl(children, nameSoFar, callback, traverseContext) { var type = typeof children; if ("undefined" !== type && "boolean" !== type || (children = null), null === children || "string" === type || "number" === type || "object" === type && children.$$typeof === REACT_ELEMENT_TYPE) return callback(traverseContext, children, "" === nameSoFar ? SEPARATOR + getComponentKey(children, 0) : nameSoFar), 1; var child, nextName, subtreeCount = 0, nextNamePrefix = "" === nameSoFar ? SEPARATOR : nameSoFar + SUBSEPARATOR; if (Array.isArray(children)) for (var i = 0; i < children.length; i++) child = children[i], nextName = nextNamePrefix + getComponentKey(child, i), subtreeCount += traverseStackChildrenImpl(child, nextName, callback, traverseContext); else { var iteratorFn = ITERATOR_SYMBOL && children[ITERATOR_SYMBOL] || children[FAUX_ITERATOR_SYMBOL]; if ("function" == typeof iteratorFn) { iteratorFn === children.entries && (warning(didWarnAboutMaps, "Using Maps as children is unsupported and will likely yield " + "unexpected results. Convert it to a sequence/iterable of keyed " + "ReactElements instead.%s", getCurrentStackAddendum$1()), didWarnAboutMaps = !0); for (var step, iterator = iteratorFn.call(children), ii = 0; !(step = iterator.next()).done; ) child = step.value, nextName = nextNamePrefix + getComponentKey(child, ii++), subtreeCount += traverseStackChildrenImpl(child, nextName, callback, traverseContext); } else if ("object" === type) { var addendum = ""; addendum = " If you meant to render a collection of children, use an array " + "instead." + getCurrentStackAddendum$1(); var childrenString = "" + children; invariant(!1, "Objects are not valid as a React child (found: %s).%s", "[object Object]" === childrenString ? "object with keys {" + Object.keys(children).join(", ") + "}" : childrenString, addendum); } } return subtreeCount; } function traverseStackChildren(children, callback, traverseContext) { return null == children ? 0 : traverseStackChildrenImpl(children, "", callback, traverseContext); } var ReactComponentTreeHook$3, traverseStackChildren_1 = traverseStackChildren; "undefined" != typeof process && process.env && "development" == "test" && (ReactComponentTreeHook$3 = ReactGlobalSharedState_1.ReactComponentTreeHook); function instantiateChild(childInstances, child, name, selfDebugID) { var keyUnique = void 0 === childInstances[name]; ReactComponentTreeHook$3 || (ReactComponentTreeHook$3 = ReactGlobalSharedState_1.ReactComponentTreeHook), keyUnique || warning(!1, "flattenChildren(...): " + "Encountered two children with the same key, `%s`. " + "Keys should be unique so that components maintain their identity " + "across updates. Non-unique keys may cause children to be " + "duplicated and/or omitted — the behavior is unsupported and " + "could change in a future version.%s", KeyEscapeUtils_1.unescapeInDev(name), ReactComponentTreeHook$3.getStackAddendumByID(selfDebugID)), null != child && keyUnique && (childInstances[name] = instantiateReactComponent_1(child, !0)); } var ReactComponentTreeHook$4, ReactChildReconciler = { instantiateChildren: function(nestedChildNodes, transaction, context, selfDebugID) { if (null == nestedChildNodes) return null; var childInstances = {}; return traverseStackChildren_1(nestedChildNodes, function(childInsts, child, name) { return instantiateChild(childInsts, child, name, selfDebugID); }, childInstances), childInstances; }, updateChildren: function(prevChildren, nextChildren, mountImages, removedNodes, transaction, hostParent, hostContainerInfo, context, selfDebugID) { if (nextChildren || prevChildren) { var name, prevChild; for (name in nextChildren) if (nextChildren.hasOwnProperty(name)) { prevChild = prevChildren && prevChildren[name]; var prevElement = prevChild && prevChild._currentElement, nextElement = nextChildren[name]; if (null != prevChild && shouldUpdateReactComponent_1(prevElement, nextElement)) ReactReconciler_1.receiveComponent(prevChild, nextElement, transaction, context), nextChildren[name] = prevChild; else { var nextChildInstance = instantiateReactComponent_1(nextElement, !0); nextChildren[name] = nextChildInstance; var nextChildMountImage = ReactReconciler_1.mountComponent(nextChildInstance, transaction, hostParent, hostContainerInfo, context, selfDebugID); mountImages.push(nextChildMountImage), prevChild && (removedNodes[name] = ReactReconciler_1.getHostNode(prevChild), ReactReconciler_1.unmountComponent(prevChild, !1, !1)); } } for (name in prevChildren) !prevChildren.hasOwnProperty(name) || nextChildren && nextChildren.hasOwnProperty(name) || (prevChild = prevChildren[name], removedNodes[name] = ReactReconciler_1.getHostNode(prevChild), ReactReconciler_1.unmountComponent(prevChild, !1, !1)); } }, unmountChildren: function(renderedChildren, safely, skipLifecycle) { for (var name in renderedChildren) if (renderedChildren.hasOwnProperty(name)) { var renderedChild = renderedChildren[name]; ReactReconciler_1.unmountComponent(renderedChild, safely, skipLifecycle); } } }, ReactChildReconciler_1 = ReactChildReconciler; "undefined" != typeof process && process.env && "development" == "test" && (ReactComponentTreeHook$4 = ReactGlobalSharedState_1.ReactComponentTreeHook); function flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID) { if (traverseContext && "object" == typeof traverseContext) { var result = traverseContext, keyUnique = void 0 === result[name]; ReactComponentTreeHook$4 || (ReactComponentTreeHook$4 = ReactGlobalSharedState_1.ReactComponentTreeHook), keyUnique || warning(!1, "flattenChildren(...): Encountered two children with the same key, " + "`%s`. " + "Keys should be unique so that components maintain their identity " + "across updates. Non-unique keys may cause children to be " + "duplicated and/or omitted — the behavior is unsupported and " + "could change in a future version.%s", KeyEscapeUtils_1.unescapeInDev(name), ReactComponentTreeHook$4.getStackAddendumByID(selfDebugID)), keyUnique && null != child && (result[name] = child); } } function flattenStackChildren(children, selfDebugID) { if (null == children) return children; var result = {}; return traverseStackChildren_1(children, function(traverseContext, child, name) { return flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID); }, result), result; } var flattenStackChildren_1 = flattenStackChildren, ReactCurrentOwner$3 = ReactGlobalSharedState_1.ReactCurrentOwner, _require2$1 = ReactGlobalSharedState_1, ReactDebugCurrentFrame$1 = _require2$1.ReactDebugCurrentFrame, ReactDebugCurrentStack$2 = ReactDebugCurrentStack_1; function makeInsertMarkup(markup, afterNode, toIndex) { return { type: "INSERT_MARKUP", content: markup, fromIndex: null, fromNode: null, toIndex: toIndex, afterNode: afterNode }; } function makeMove(child, afterNode, toIndex) { return { type: "MOVE_EXISTING", content: null, fromIndex: child._mountIndex, fromNode: ReactReconciler_1.getHostNode(child), toIndex: toIndex, afterNode: afterNode }; } function makeRemove(child, node) { return { type: "REMOVE_NODE", content: null, fromIndex: child._mountIndex, fromNode: node, toIndex: null, afterNode: null }; } function makeSetMarkup(markup) { return { type: "SET_MARKUP", content: markup, fromIndex: null, fromNode: null, toIndex: null, afterNode: null }; } function makeTextContent(textContent) { return { type: "TEXT_CONTENT", content: textContent, fromIndex: null, fromNode: null, toIndex: null, afterNode: null }; } function enqueue(queue, update) { return update && (queue = queue || [], queue.push(update)), queue; } function processQueue(inst, updateQueue) { ReactComponentEnvironment_1.processChildrenUpdates(inst, updateQueue); } var setChildrenForInstrumentation = emptyFunction, getDebugID = function(inst) { if (!inst._debugID) { var internal; (internal = ReactInstanceMap_1.get(inst)) && (inst = internal); } return inst._debugID; }; setChildrenForInstrumentation = function(children) { var debugID = getDebugID(this); 0 !== debugID && ReactInstrumentation.debugTool.onSetChildren(debugID, children ? Object.keys(children).map(function(key) { return children[key]._debugID; }) : []); }; var ReactMultiChild = { _reconcilerInstantiateChildren: function(nestedChildren, transaction, context) { var selfDebugID = getDebugID(this); if (this._currentElement) try { return ReactCurrentOwner$3.current = this._currentElement._owner, ReactDebugCurrentFrame$1.getCurrentStack = ReactDebugCurrentStack$2.getStackAddendum, ReactChildReconciler_1.instantiateChildren(nestedChildren, transaction, context, selfDebugID); } finally { ReactCurrentOwner$3.current = null, ReactDebugCurrentFrame$1.getCurrentStack = null; } return ReactChildReconciler_1.instantiateChildren(nestedChildren, transaction, context); }, _reconcilerUpdateChildren: function(prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context) { var nextChildren, selfDebugID = 0; if (selfDebugID = getDebugID(this), this._currentElement) { try { ReactCurrentOwner$3.current = this._currentElement._owner, ReactDebugCurrentFrame$1.getCurrentStack = ReactDebugCurrentStack$2.getStackAddendum, nextChildren = flattenStackChildren_1(nextNestedChildrenElements, selfDebugID); } finally { ReactCurrentOwner$3.current = null, ReactDebugCurrentFrame$1.getCurrentStack = null; } return ReactChildReconciler_1.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID), nextChildren; } return nextChildren = flattenStackChildren_1(nextNestedChildrenElements, selfDebugID), ReactChildReconciler_1.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID), nextChildren; }, mountChildren: function(nestedChildren, transaction, context) { var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context); this._renderedChildren = children; var mountImages = [], index = 0; for (var name in children) if (children.hasOwnProperty(name)) { var child = children[name], selfDebugID = 0; selfDebugID = getDebugID(this); var mountImage = ReactReconciler_1.mountComponent(child, transaction, this, this._hostContainerInfo, context, selfDebugID); child._mountIndex = index++, mountImages.push(mountImage); } return setChildrenForInstrumentation.call(this, children), mountImages; }, updateTextContent: function(nextContent) { var prevChildren = this._renderedChildren; ReactChildReconciler_1.unmountChildren(prevChildren, !1, !1); for (var name in prevChildren) prevChildren.hasOwnProperty(name) && invariant(!1, "updateTextContent called on non-empty component."); processQueue(this, [ makeTextContent(nextContent) ]); }, updateMarkup: function(nextMarkup) { var prevChildren = this._renderedChildren; ReactChildReconciler_1.unmountChildren(prevChildren, !1, !1); for (var name in prevChildren) prevChildren.hasOwnProperty(name) && invariant(!1, "updateTextContent called on non-empty component."); processQueue(this, [ makeSetMarkup(nextMarkup) ]); }, updateChildren: function(nextNestedChildrenElements, transaction, context) { this._updateChildren(nextNestedChildrenElements, transaction, context); }, _updateChildren: function(nextNestedChildrenElements, transaction, context) { var prevChildren = this._renderedChildren, removedNodes = {}, mountImages = [], nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context); if (nextChildren || prevChildren) { var name, updates = null, nextIndex = 0, lastIndex = 0, nextMountIndex = 0, lastPlacedNode = null; for (name in nextChildren) if (nextChildren.hasOwnProperty(name)) { var prevChild = prevChildren && prevChildren[name], nextChild = nextChildren[name]; prevChild === nextChild ? (updates = enqueue(updates, this.moveChild(prevChild, lastPlacedNode, nextIndex, lastIndex)), lastIndex = Math.max(prevChild._mountIndex, lastIndex), prevChild._mountIndex = nextIndex) : (prevChild && (lastIndex = Math.max(prevChild._mountIndex, lastIndex)), updates = enqueue(updates, this._mountChildAtIndex(nextChild, mountImages[nextMountIndex], lastPlacedNode, nextIndex, transaction, context)), nextMountIndex++), nextIndex++, lastPlacedNode = ReactReconciler_1.getHostNode(nextChild); } for (name in removedNodes) removedNodes.hasOwnProperty(name) && (updates = enqueue(updates, this._unmountChild(prevChildren[name], removedNodes[name]))); updates && processQueue(this, updates), this._renderedChildren = nextChildren, setChildrenForInstrumentation.call(this, nextChildren); } }, unmountChildren: function(safely, skipLifecycle) { var renderedChildren = this._renderedChildren; ReactChildReconciler_1.unmountChildren(renderedChildren, safely, skipLifecycle), this._renderedChildren = null; }, moveChild: function(child, afterNode, toIndex, lastIndex) { if (child._mountIndex < lastIndex) return makeMove(child, afterNode, toIndex); }, createChild: function(child, afterNode, mountImage) { return makeInsertMarkup(mountImage, afterNode, child._mountIndex); }, removeChild: function(child, node) { return makeRemove(child, node); }, _mountChildAtIndex: function(child, mountImage, afterNode, index, transaction, context) { return child._mountIndex = index, this.createChild(child, afterNode, mountImage); }, _unmountChild: function(child, node) { var update = this.removeChild(child, node); return child._mountIndex = null, update; } }, ReactMultiChild_1 = ReactMultiChild, ReactNativeBaseComponent = function(viewConfig) { this.viewConfig = viewConfig; }; ReactNativeBaseComponent.Mixin = { getPublicInstance: function() { return this; }, unmountComponent: function(safely, skipLifecycle) { ReactNativeComponentTree_1.uncacheNode(this), this.unmountChildren(safely, skipLifecycle), this._rootNodeID = 0; }, initializeChildren: function(children, containerTag, transaction, context) { var mountImages = this.mountChildren(children, transaction, context); if (mountImages.length) { for (var createdTags = [], i = 0, l = mountImages.length; i < l; i++) { var mountImage = mountImages[i], childTag = mountImage; createdTags[i] = childTag; } UIManager.setChildren(containerTag, createdTags); } }, receiveComponent: function(nextElement, transaction, context) { var prevElement = this._currentElement; this._currentElement = nextElement; for (var key in this.viewConfig.validAttributes) nextElement.props.hasOwnProperty(key) && deepFreezeAndThrowOnMutationInDev(nextElement.props[key]); var updatePayload = ReactNativeAttributePayload_1.diff(prevElement.props, nextElement.props, this.viewConfig.validAttributes); updatePayload && UIManager.updateView(this._rootNodeID, this.viewConfig.uiViewClassName, updatePayload), this.updateChildren(nextElement.props.children, transaction, context); }, getName: function() { return this.constructor.displayName || this.constructor.name || "Unknown"; }, getHostNode: function() { return this._rootNodeID; }, mountComponent: function(transaction, hostParent, hostContainerInfo, context) { var tag = ReactNativeTagHandles_1.allocateTag(); this._rootNodeID = tag, this._hostParent = hostParent, this._hostContainerInfo = hostContainerInfo; for (var key in this.viewConfig.validAttributes) this._currentElement.props.hasOwnProperty(key) && deepFreezeAndThrowOnMutationInDev(this._currentElement.props[key]); var updatePayload = ReactNativeAttributePayload_1.create(this._currentElement.props, this.viewConfig.validAttributes), nativeTopRootTag = hostContainerInfo._tag; return UIManager.createView(tag, this.viewConfig.uiViewClassName, nativeTopRootTag, updatePayload), ReactNativeComponentTree_1.precacheNode(this, tag), this.initializeChildren(this._currentElement.props.children, tag, transaction, context), tag; } }, Object.assign(ReactNativeBaseComponent.prototype, ReactMultiChild_1, ReactNativeBaseComponent.Mixin, NativeMethodsMixin_1); var ReactNativeBaseComponent_1 = ReactNativeBaseComponent, createReactNativeComponentClassStack = function(viewConfig) { var Constructor = function(element) { this._currentElement = element, this._topLevelWrapper = null, this._hostParent = null, this._hostContainerInfo = null, this._rootNodeID = 0, this._renderedChildren = null; }; return Constructor.displayName = viewConfig.uiViewClassName, Constructor.viewConfig = viewConfig, Constructor.propTypes = viewConfig.propTypes, Constructor.prototype = new ReactNativeBaseComponent_1(viewConfig), Constructor.prototype.constructor = Constructor, Constructor; }, createReactNativeComponentClassStack_1 = createReactNativeComponentClassStack, ReactNativeFeatureFlags$3 = require('../ReactNative/ReactNativeFeatureFlags'), createReactNativeComponentClass = ReactNativeFeatureFlags$3.useFiber ? DevOnlyStubShim : createReactNativeComponentClassStack_1, ReactNativeFeatureFlags$4 = require('../ReactNative/ReactNativeFeatureFlags'), findNumericNodeHandle$2 = ReactNativeFeatureFlags$4.useFiber ? DevOnlyStubShim : findNumericNodeHandleStack; function takeSnapshot(view, options) { return "number" != typeof view && "window" !== view && (view = findNumericNodeHandle$2(view) || "window"), UIManager.__takeSnapshot(view, options); } var takeSnapshot_1 = takeSnapshot, lowPriorityWarning = function() {}, printWarning = function(format) { for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) args[_key - 1] = arguments[_key]; var argIndex = 0, message = "Warning: " + format.replace(/%s/g, function() { return args[argIndex++]; }); "undefined" != typeof console && console.warn(message); try { throw new Error(message); } catch (x) {} }; lowPriorityWarning = function(condition, format) { if (void 0 === format) throw new Error("`warning(condition, format, ...args)` requires a warning " + "message argument"); if (!condition) { for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) args[_key2 - 2] = arguments[_key2]; printWarning.apply(void 0, [ format ].concat(args)); } }; var lowPriorityWarning_1 = lowPriorityWarning; function roundFloat(val) { var base = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2, n = Math.pow(10, base); return Math.floor(val * n) / n; } function consoleTable(table) { console.table(table); } function getLastMeasurements() { return ReactDebugTool_1.getFlushHistory(); } function getExclusive() { var flushHistory = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : getLastMeasurements(), aggregatedStats = {}, affectedIDs = {}; function updateAggregatedStats(treeSnapshot, instanceID, timerType, applyUpdate) { var displayName = treeSnapshot[instanceID].displayName, key = displayName, stats = aggregatedStats[key]; stats || (affectedIDs[key] = {}, stats = aggregatedStats[key] = { key: key, instanceCount: 0, counts: {}, durations: {}, totalDuration: 0 }), stats.durations[timerType] || (stats.durations[timerType] = 0), stats.counts[timerType] || (stats.counts[timerType] = 0), affectedIDs[key][instanceID] = !0, applyUpdate(stats); } return flushHistory.forEach(function(flush) { var measurements = flush.measurements, treeSnapshot = flush.treeSnapshot; measurements.forEach(function(measurement) { var duration = measurement.duration, instanceID = measurement.instanceID, timerType = measurement.timerType; updateAggregatedStats(treeSnapshot, instanceID, timerType, function(stats) { stats.totalDuration += duration, stats.durations[timerType] += duration, stats.counts[timerType]++; }); }); }), Object.keys(aggregatedStats).map(function(key) { return Object.assign({}, aggregatedStats[key], { instanceCount: Object.keys(affectedIDs[key]).length }); }).sort(function(a, b) { return b.totalDuration - a.totalDuration; }); } function getInclusive() { var flushHistory = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : getLastMeasurements(), aggregatedStats = {}, affectedIDs = {}; function updateAggregatedStats(treeSnapshot, instanceID, applyUpdate) { var _treeSnapshot$instanc = treeSnapshot[instanceID], displayName = _treeSnapshot$instanc.displayName, ownerID = _treeSnapshot$instanc.ownerID, owner = treeSnapshot[ownerID], key = (owner ? owner.displayName + " > " : "") + displayName, stats = aggregatedStats[key]; stats || (affectedIDs[key] = {}, stats = aggregatedStats[key] = { key: key, instanceCount: 0, inclusiveRenderDuration: 0, renderCount: 0 }), affectedIDs[key][instanceID] = !0, applyUpdate(stats); } var isCompositeByID = {}; return flushHistory.forEach(function(flush) { flush.measurements.forEach(function(measurement) { var instanceID = measurement.instanceID; "render" === measurement.timerType && (isCompositeByID[instanceID] = !0); }); }), flushHistory.forEach(function(flush) { var measurements = flush.measurements, treeSnapshot = flush.treeSnapshot; measurements.forEach(function(measurement) { var duration = measurement.duration, instanceID = measurement.instanceID; if ("render" === measurement.timerType) { updateAggregatedStats(treeSnapshot, instanceID, function(stats) { stats.renderCount++; }); for (var nextParentID = instanceID; nextParentID; ) isCompositeByID[nextParentID] && updateAggregatedStats(treeSnapshot, nextParentID, function(stats) { stats.inclusiveRenderDuration += duration; }), nextParentID = treeSnapshot[nextParentID].parentID; } }); }), Object.keys(aggregatedStats).map(function(key) { return Object.assign({}, aggregatedStats[key], { instanceCount: Object.keys(affectedIDs[key]).length }); }).sort(function(a, b) { return b.inclusiveRenderDuration - a.inclusiveRenderDuration; }); } function getWasted() { var flushHistory = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : getLastMeasurements(), aggregatedStats = {}, affectedIDs = {}; function updateAggregatedStats(treeSnapshot, instanceID, applyUpdate) { var _treeSnapshot$instanc2 = treeSnapshot[instanceID], displayName = _treeSnapshot$instanc2.displayName, ownerID = _treeSnapshot$instanc2.ownerID, owner = treeSnapshot[ownerID], key = (owner ? owner.displayName + " > " : "") + displayName, stats = aggregatedStats[key]; stats || (affectedIDs[key] = {}, stats = aggregatedStats[key] = { key: key, instanceCount: 0, inclusiveRenderDuration: 0, renderCount: 0 }), affectedIDs[key][instanceID] = !0, applyUpdate(stats); } return flushHistory.forEach(function(flush) { var measurements = flush.measurements, treeSnapshot = flush.treeSnapshot, operations = flush.operations, isDefinitelyNotWastedByID = {}; operations.forEach(function(operation) { for (var instanceID = operation.instanceID, nextParentID = instanceID; nextParentID; ) isDefinitelyNotWastedByID[nextParentID] = !0, nextParentID = treeSnapshot[nextParentID].parentID; }); var renderedCompositeIDs = {}; measurements.forEach(function(measurement) { var instanceID = measurement.instanceID; "render" === measurement.timerType && (renderedCompositeIDs[instanceID] = !0); }), measurements.forEach(function(measurement) { var duration = measurement.duration, instanceID = measurement.instanceID; if ("render" === measurement.timerType) { var updateCount = treeSnapshot[instanceID].updateCount; if (!isDefinitelyNotWastedByID[instanceID] && 0 !== updateCount) { updateAggregatedStats(treeSnapshot, instanceID, function(stats) { stats.renderCount++; }); for (var nextParentID = instanceID; nextParentID; ) renderedCompositeIDs[nextParentID] && !isDefinitelyNotWastedByID[nextParentID] && updateAggregatedStats(treeSnapshot, nextParentID, function(stats) { stats.inclusiveRenderDuration += duration; }), nextParentID = treeSnapshot[nextParentID].parentID; } } }); }), Object.keys(aggregatedStats).map(function(key) { return Object.assign({}, aggregatedStats[key], { instanceCount: Object.keys(affectedIDs[key]).length }); }).sort(function(a, b) { return b.inclusiveRenderDuration - a.inclusiveRenderDuration; }); } function getOperations() { var flushHistory = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : getLastMeasurements(), stats = []; return flushHistory.forEach(function(flush, flushIndex) { var operations = flush.operations, treeSnapshot = flush.treeSnapshot; operations.forEach(function(operation) { var instanceID = operation.instanceID, type = operation.type, payload = operation.payload, _treeSnapshot$instanc3 = treeSnapshot[instanceID], displayName = _treeSnapshot$instanc3.displayName, ownerID = _treeSnapshot$instanc3.ownerID, owner = treeSnapshot[ownerID], key = (owner ? owner.displayName + " > " : "") + displayName; stats.push({ flushIndex: flushIndex, instanceID: instanceID, key: key, type: type, ownerID: ownerID, payload: payload }); }); }), stats; } function printExclusive(flushHistory) { consoleTable(getExclusive(flushHistory).map(function(item) { var key = item.key, instanceCount = item.instanceCount, totalDuration = item.totalDuration, renderCount = item.counts.render || 0, renderDuration = item.durations.render || 0; return { Component: key, "Total time (ms)": roundFloat(totalDuration), "Instance count": instanceCount, "Total render time (ms)": roundFloat(renderDuration), "Average render time (ms)": renderCount ? roundFloat(renderDuration / renderCount) : void 0, "Render count": renderCount, "Total lifecycle time (ms)": roundFloat(totalDuration - renderDuration) }; })); } function printInclusive(flushHistory) { consoleTable(getInclusive(flushHistory).map(function(item) { var key = item.key, instanceCount = item.instanceCount, inclusiveRenderDuration = item.inclusiveRenderDuration, renderCount = item.renderCount; return { "Owner > Component": key, "Inclusive render time (ms)": roundFloat(inclusiveRenderDuration), "Instance count": instanceCount, "Render count": renderCount }; })); } function printWasted(flushHistory) { consoleTable(getWasted(flushHistory).map(function(item) { var key = item.key, instanceCount = item.instanceCount, inclusiveRenderDuration = item.inclusiveRenderDuration, renderCount = item.renderCount; return { "Owner > Component": key, "Inclusive wasted time (ms)": roundFloat(inclusiveRenderDuration), "Instance count": instanceCount, "Render count": renderCount }; })); } function printOperations(flushHistory) { consoleTable(getOperations(flushHistory).map(function(stat) { return { "Owner > Node": stat.key, Operation: stat.type, Payload: "object" == typeof stat.payload ? JSON.stringify(stat.payload) : stat.payload, "Flush index": stat.flushIndex, "Owner Component ID": stat.ownerID, "DOM Component ID": stat.instanceID }; })); } var warnedAboutPrintDOM = !1; function printDOM(measurements) { return lowPriorityWarning_1(warnedAboutPrintDOM, "`ReactPerf.printDOM(...)` is deprecated. Use " + "`ReactPerf.printOperations(...)` instead."), warnedAboutPrintDOM = !0, printOperations(measurements); } var warnedAboutGetMeasurementsSummaryMap = !1; function getMeasurementsSummaryMap(measurements) { return lowPriorityWarning_1(warnedAboutGetMeasurementsSummaryMap, "`ReactPerf.getMeasurementsSummaryMap(...)` is deprecated. Use " + "`ReactPerf.getWasted(...)` instead."), warnedAboutGetMeasurementsSummaryMap = !0, getWasted(measurements); } function start() { ReactDebugTool_1.beginProfiling(); } function stop() { ReactDebugTool_1.endProfiling(); } function isRunning() { return ReactDebugTool_1.isProfiling(); } var ReactPerfAnalysis = { getLastMeasurements: getLastMeasurements, getExclusive: getExclusive, getInclusive: getInclusive, getWasted: getWasted, getOperations: getOperations, printExclusive: printExclusive, printInclusive: printInclusive, printWasted: printWasted, printOperations: printOperations, start: start, stop: stop, isRunning: isRunning, printDOM: printDOM, getMeasurementsSummaryMap: getMeasurementsSummaryMap }, ReactPerf = ReactPerfAnalysis, render = function(element, mountInto, callback) { return ReactNativeMount_1.renderComponent(element, mountInto, callback); }, ReactNativeStack = { NativeComponent: ReactNativeComponent_1, hasReactNativeInitialized: !1, findNodeHandle: findNumericNodeHandleStack, render: render, unmountComponentAtNode: ReactNativeMount_1.unmountComponentAtNode, unstable_batchedUpdates: ReactUpdates_1.batchedUpdates, unmountComponentAtNodeAndRemoveContainer: ReactNativeMount_1.unmountComponentAtNodeAndRemoveContainer, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: { NativeMethodsMixin: NativeMethodsMixin_1, ReactGlobalSharedState: ReactGlobalSharedState_1, ReactNativeComponentTree: ReactNativeComponentTree_1, ReactNativePropRegistry: ReactNativePropRegistry_1, TouchHistoryMath: TouchHistoryMath_1, createReactNativeComponentClass: createReactNativeComponentClass, takeSnapshot: takeSnapshot_1 } }; Object.assign(ReactNativeStack.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, { ReactDebugTool: ReactDebugTool_1, ReactPerf: ReactPerf }), "undefined" != typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" == typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject && __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({ ComponentTree: { getClosestInstanceFromNode: function(node) { return ReactNativeComponentTree_1.getClosestInstanceFromNode(node); }, getNodeFromInstance: function(inst) { for (;inst._renderedComponent; ) inst = inst._renderedComponent; return inst ? ReactNativeComponentTree_1.getNodeFromInstance(inst) : null; } }, Mount: ReactNativeMount_1, Reconciler: ReactReconciler_1, getInspectorDataForViewTag: ReactNativeStackInspector.getInspectorDataForViewTag }); var ReactNativeStackEntry = ReactNativeStack; module.exports = ReactNativeStackEntry; }();
201,224
52,659
const re = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; export default (emails) => { const invalidEmails = emails .split(',') .map((email) => email.trim()) .filter((email) => re.test(email) === false); if (invalidEmails.length) { return `These emails are invalid: ${invalidEmails}`; } return; };
350
156
import { Link } from 'react-router-dom'; import Layout from '../Components/Layout'; export default function Page404() { return( <Layout head="No encontrado :c" subheading="404" type="ciudadano"> <h1>Esa ruta no existe</h1> <Link to="/">Volver al inicio</Link> </Layout> ); }
324
106
const mongoose = require("mongoose"); const Schema = mongoose.Schema; var commentSchema = new Schema( { user: { type: mongoose.Schema.Types.ObjectId, ref: "User", }, expense: { type: String, required: true, }, ideal: { type: Number, required: true, }, actual: { type: Number, default: "0", }, }, { timestamps: true, } ); var Comments = mongoose.model("Comment", commentSchema); module.exports = Comments;
503
173
const uuid = require('uuid/v4'); /** * A class wrapping a {@link external:JobPayload|JobPayload} * * @example * // with a client * const client = await faktory.connect(); * const job = client.job('SendWelcomeEmail', id); * * @example * // without a client * const job = new Job('SendWelcomeEmail'); * job.args = [id]; * job.queue = 'mailers'; * console.log(job.toJSON()); */ class Job { /** * Creates a job * * @param {string} jobtype {@link external:Jobtype|Jobtype} string * @param {Client} [client] a client to use for communicating to the server (if calling push) */ constructor(jobtype, client) { if (!jobtype) throw new Error('must provide jobtype'); this.client = client; this.payload = Object.assign({ jid: Job.jid(), jobtype, }, Job.defaults); } get jid() { return this.payload.jid; } /** * sets the jid * * @param {string} value the >8 length jid * @see external:JobPayload */ set jid(value) { this.payload.jid = value; return value; } get jobtype() { return this.payload.jobtype; } set jobtype(value) { this.payload.jobtype = value; return value; } get queue() { return this.payload.queue; } /** * sets the queue * * @param {string} value queue name * @see external:JobPayload */ set queue(value) { this.payload.queue = value; return value; } get args() { return this.payload.args; } /** * sets the args * * @param {Array} value array of positional arguments * @see external:JobPayload */ set args(value) { this.payload.args = value; return value; } get priority() { return this.payload.priority; } /** * sets the priority of this job * * @param {number} value 0-9 * @see external:JobPayload */ set priority(value) { this.payload.priority = value; return value; } get retry() { return this.payload.retry; } /** * sets the retry count * * @param {number} value {@see external:JobPayload} * @see external:JobPayload */ set retry(value) { this.payload.retry = value; return value; } get at() { return this.payload.at; } /** * sets the scheduled time * * @param {Date|string} value the date object or RFC3339 timestamp string * @see external:JobPayload */ set at(value) { const string = typeof value === 'object' ? value.toISOString() : value; this.payload.at = string; return string; } get reserveFor() { return this.payload.reserve_for; } /** * sets the reserveFor parameter * * @param {number} value * @see external:JobPayload */ set reserveFor(value) { this.payload.reserve_for = value; return value; } get custom() { return this.payload.custom; } /** * sets the custom object property * * @param {object} value the custom data * @see external:JobPayload */ set custom(value) { this.payload.custom = value; return value; } /** * Generates an object from this instance for transmission over the wire * * @return {object} the job as a serializable javascript object * @link external:JobPayload|JobPayload} * @see external:JobPayload */ toJSON() { return Object.assign({}, this.payload); } /** * Pushes this job to the faktory server. Modifications after this point are not * persistable to the server * * @return {string} return of client.push(job) */ push() { return this.client.push(this); } static get defaults() { return { queue: 'default', args: [], priority: 5, retry: 25, }; } /** * generates a uuid * * @return {string} a uuid/v4 string */ static jid() { return uuid(); } } module.exports = Job;
3,872
1,338
import React from "react"; import styled from "styled-components"; const Form = styled.form` display: flex; flex-direction: row; justify-content: center; `; const Space = styled.div` margin-left: 15px; `; const Spacespan = styled.span` margin-left: 5px; `; const QueryParams = ({ year, years, country, countries, shouldFilter, onQueryChange }) => ( <Form> <label htmlFor="year"> Year <Spacespan /> <select name="year" id="year" value={year} onChange={onQueryChange}> {years.map(year => ( <option key={year} value={year}> {year} </option> ))} </select> </label> <Space /> <label htmlFor="country"> Country <Spacespan /> <select name="country" id="country" value={country} onChange={onQueryChange}> {countries.map(country => ( <option key={country.iso3} value={country.iso3}> {country.name} </option> ))} </select> </label> <Space /> <label htmlFor="shouldFilter"> Reduce Details <Spacespan /> <input name="shouldFilter" id="shouldFilter" type="checkbox" checked={shouldFilter} onChange={onQueryChange} /> </label> </Form> ); export default QueryParams;
1,387
420
/* eslint-disable no-console */ const base64url = require('base64url'); const cookie = require('cookie'); const proxy = require('request'); const config = { ssoAuth: { host: 'www.ovh.com', baseUrl: 'https://www.ovh.com/cgi-bin/crosslogin.cgi', devLoginUrl: 'https://www.ovh.com/auth/requestDevLogin/', }, }; // [SSO] authentication function login(ctx) { console.log('[SSO] - crosslogin'); const { headers } = ctx; headers.host = config.ssoAuth.host; const location = new Promise((resolve) => { proxy.get({ url: config.ssoAuth.baseUrl + ctx.url, headers, proxy: config.proxy ? config.proxy.host : '', followRedirect: false, }, (err, resp) => { if (err) { console.error('[SSO] - crosslogin - error: ', err); return resp.status(500); } const cookies = resp.headers['set-cookie']; let parsedCookie; for (let i = cookies.length - 1; i >= 0; i -= 1) { parsedCookie = cookie.parse(cookies[i]); if (parsedCookie['CA.OVH.SES']) { ctx.cookies.set('CA.OVH.SES', parsedCookie['CA.OVH.SES'], { path: '/', httpOnly: true }); } if (parsedCookie.SESSION) { ctx.cookies.set('SESSION', parsedCookie.SESSION, { path: '/', httpOnly: true }); } if (parsedCookie.USERID) { ctx.cookies.set('USERID', parsedCookie.USERID, { path: '/' }); } } console.log('[SSO] - Logged'); return resolve(resp.headers.location); }); }); return ctx.redirect(location); } async function auth(ctx) { const origin = ctx.headers.host; const protocol = ctx.protocol || 'http'; const headers = { contentType: 'application/json', }; headers.host = config.ssoAuth.host; const redirectionUrl = await new Promise((resolve) => { proxy.post({ url: config.ssoAuth.devLoginUrl, proxy: config.proxy ? config.proxy.host : null, headers, followRedirect: false, gzip: true, json: { callbackUrl: `${protocol}://${origin}/auth/check`, }, }, (err, resp, data) => { if (err) { return resp.status(500); } return resolve(data.data.url); }); }); ctx.redirect(redirectionUrl); } function checkAuth(ctx) { const { headers } = ctx; headers.host = config.ssoAuth.host; let cookies = []; try { cookies = JSON.parse(base64url.decode(ctx.query.data)); if (Array.isArray(cookies.cookies)) { cookies.cookies.forEach((c) => { const parsedCookie = cookie.parse(c); if (parsedCookie['CA.OVH.SES']) { ctx.cookies.set('CA.OVH.SES', parsedCookie['CA.OVH.SES'], { path: '/', httpOnly: true }); } if (parsedCookie.SESSION) { ctx.cookies.set('SESSION', parsedCookie.SESSION, { path: '/', httpOnly: true }); } if (parsedCookie.USERID) { ctx.cookies.set('USERID', parsedCookie.USERID, { path: '/' }); } }); } } catch (err) { console.error(err); } ctx.redirect('/'); } module.exports = { auth, checkAuth, login, }; /* eslint-enable no-console */
3,136
1,072
module.exports = { 'dbUrl': 'mongodb://data01.audacy.space:11001/telemetry', 'dbOptions': { 'user': 'audacyapp', 'pass': 'quindar', 'auth': { 'authdb': 'admin' }, "server": { "auto_reconnect": true, "poolSize": 200, "socketOptions": { "keepAlive": 1 } } }, 'secret': 'quindar', 'maxRecords': 9999, 'vehicles': ["IBEX", "CST-100 Starliner", "Orion MPCV", "Dream Chaser CRS-2", "ISRO OV", "Skylon D1", "XCOR Lynx", "SIRIUS-1", "ISS (ZARYA)"], 'exchange':'quindarExchange04', 'exchangeType': 'topic', 'serverURL': 'data04.audacy.space/develop', 'serverEndpoint': 'amqp://audacyapp:[email protected]/develop', 'mqConfig': { 'user': 'audacyapp', 'pass': 'quindar', 'server': 'data04.audacy.space', 'queue': 'develop' }, // when starting NodeJS server, we can disable/enable modules 'serverStartupOptions': { 'apiHttp': true, 'apiHttps': true, 'socketHttp': true, 'socketHttps': true } };
1,026
421
import _typeof from "@babel/runtime/helpers/esm/typeof"; var isBrowser = (typeof process === "undefined" ? "undefined" : _typeof(process)) !== 'object' || String(process) !== '[object process]' || process.browser; var globals = { self: typeof self !== 'undefined' && self, window: typeof window !== 'undefined' && window, global: typeof global !== 'undefined' && global, document: typeof document !== 'undefined' && document }; var self_ = globals.self || globals.window || globals.global; var window_ = globals.window || globals.self || globals.global; var global_ = globals.global || globals.self || globals.window; var document_ = globals.document || {}; export { isBrowser, self_ as self, window_ as window, global_ as global, document_ as document }; var matches = typeof process !== 'undefined' && process.version && process.version.match(/v([0-9]*)/); export var nodeVersion = matches && parseFloat(matches[1]) || 0; //# sourceMappingURL=globals.js.map
967
278
const express = require('express') const router = express.Router() /*const strFullproductname = "Sony Vector 8000xc"; const strBrandName = "Sony"; const strProductName = "Vector 8000xc"; //const strModelName = ""; //const strCategory = "Electrical appliances and equipment"; const strModelNumber = '001-600006'; const strBarcode = 'EIN-12345334-44'; const strImageMain = '../public/images/hair-dryer.jpg';*/ //************* routes for /product-case-testing ************* starts router.post('/find-the-product', function (req, res) { var isrelated = req.session.data['related'] if (isrelated == 'yes') { res.redirect('/product-case-testing/products-page') } else if (isrelated == 'no') { res.redirect('/product-case-testing/is-this-case-related-to-covid') } }) //************* is-this-case-related-to-covid ************* starts router.post('/is-this-case-related-to-covid', function (req, res) { res.redirect('/product-case-testing/reason-for-creating-case') }) //********************* start reason-for-creating-case router.post('/reason-for-creating-case', function (req, res) { const casereason = req.session.data['reason'] if (casereason == 'unsafeoption') { res.redirect('/product-case-testing/is-case-counterfeit' ) } else { res.redirect('/product-case-testing/why-is-the-product-of-concern' ) } }) //********************* why is the product of concern router.post('/why-is-the-product-of-concern', function (req, res) { res.redirect('/product-case-testing/is-case-counterfeit' ) }) //******************* is-case-counterfeit router.post('/is-case-counterfeit', function (req, res) { //res.redirect('/product-case-testing/how-many-units-are-affected-std' ) res.redirect('/product-case-testing/success-case-created' ) }) //************* start do-you-have-the-barcode router.post('/do-you-have-the-barcode', function (req, res) { var theBarCode = req.session.data['barcode'] //var theBarNumberP = req.session.data['barnumber'].replace(/\D/g,''); var didItMatch = req.session.data['checkMatch'] if (theBarCode == 'yes') { if(didItMatch == 'yes'){ res.redirect('/product-case-testing/might-already-exist-bc') }else{ res.redirect('/product-case-testing/what-is-the-product-name') } } else if (theBarCode == 'no') { res.redirect('/product-case-testing/what-is-the-product-name') } }) // *********************** start might-already-exist-bc router.post('/might-already-exist-bc', function (req, res) { var isit = req.session.data['isit'] if (isit == null) { res.redirect('/product-case-testing/might-already-exist-bc-error') } else if (isit == 'yes') { res.redirect('/product-case-testing/it-was-your-product') } else if (isit == 'no') { res.redirect('/product-case-testing/what-is-the-product-name') } }) router.post('/might-already-exist-bc-error', function (req, res) { var isit2 = req.session.data['isit'] if (isit2 == null) { res.redirect('/product-case-testing/might-already-exist-bc-error') } else if (isit2 == 'yes') { res.redirect('/product-case-testing/it-was-your-product') } else if (isit2 == 'no') { res.redirect('/product-case-testing/what-is-the-product-name') } }) //************* start does-the-product-have-a-brand /*router.post('/does-the-product-have-a-brand', function (req, res) { var branded = req.session.data['branded'] var brand = req.session.data['brand'] if (branded == null) { return res.redirect('/product-case-testing/does-the-product-have-a-brand-error') } else if ((branded == 'yes') && (brand == '')) { return res.redirect('/product-case-testing/does-the-product-have-a-brand-error-2') } else { return res.redirect('/product-case-testing/what-is-the-product-name') } }) router.post('/does-the-product-have-a-brand-error', function (req, res) { var branded1 = req.session.data['branded'] var brand1 = req.session.data['brand'] if (branded1 == null) { return res.redirect('/product-case-testing/does-the-product-have-a-brand-error') } else if ((branded1 == 'yes') && (brand1 == '')) { return res.redirect('/product-case-testing/does-the-product-have-a-brand-error-2') } else if ((branded1 == 'yes') && (brand1 != '')) { return res.redirect('/product-case-testing/what-is-the-product-name') } }) router.post('/does-the-product-have-a-brand-error-2', function (req, res) { var branded2 = req.session.data['branded'] var brand2 = req.session.data['brand'] if (branded2 == null) { return res.redirect('/product-case-testing/does-the-product-have-a-brand-error') } else if ((branded2 == 'yes') && (brand2 == '')) { return res.redirect('/product-case-testing/does-the-product-have-a-brand-error-2') } else if ((branded2 == 'yes') && (brand2 != '')) { return res.redirect('/product-case-testing/what-is-the-product-name') } })*/ //************* what is the product name router.post('/what-is-the-product-name', function (req, res) { return res.redirect('/product-case-testing/what-is-the-product-category') }) //************* start what-is-the-product-category router.post('/what-is-the-product-category', function (req, res) { var checkMatch1 = req.session.data['checkMatch'] var theMatch1 = req.session.data['theMatch'] if (checkMatch1 == 'yes'){ return res.redirect('/product-case-testing/might-already-exist') }else{ return res.redirect('/product-case-testing/does-the-product-have-marking') } }) //************* start does-the-product-have-marking router.post('/does-the-product-have-marking', function (req, res) { return res.redirect('/product-case-testing/describe-the-product') }) // *********************** start might-already-exist /*router.get('/might-already-exist', function (req, res) { var thisFullproductname = "blah"; res.render('product-case-testing/might-already-exist', { thisFullproductname: strFullproductname, thisBrand: strBrandName, thisCategory: 'Electrical appliances and equipment', thisSubcategory: 'Domestic electricals', thisModelNumber: strModelNumber, thisBarcode: strBarcode, thisDescription: 'The product description lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut volutpat quam sapien. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed in libero urna. Nulla ut rhoncus magna, sagittis dapibus justo. Nullam blandit lacus et dui scelerisque, vel pretium lectus vulputate. In et ultrices sapien. Quisque pharetra, tortor scelerisque accumsan rhoncus, sem quam fermentum dui, non ornare neque mi ac justo.', thisImage: strImageMain }) }) and then in the page just use {{ thisBrand }} as normal. And this for an image in the HTML... <img src={%raw%}"{%endraw%}{{ thisImage }}{%raw%}"{%endraw%} class="opss-details-img" alt="Sony hair dryer"> */ router.post('/might-already-exist', function (req, res) { var isit = req.session.data['isit'] if (isit == 'yes') { res.redirect('/product-case-testing/it-was-your-product') } else if (isit == 'no') { res.redirect('/product-case-testing/does-the-product-have-marking') } }) //************* start describe-the-product router.post('/describe-the-product', function (req, res) { res.redirect('/product-case-testing/when-was-the-product-placed') }) //************* start when-was-the-product-placed router.post('/when-was-the-product-placed', function (req, res) { res.redirect('/product-case-testing/can-you-provide-an-image') }) //****************** can-you-provide-an-image router.post('/can-you-provide-an-image', function (req, res) { if (req.session.data['productimage'] == 'yes') { res.redirect('/product-case-testing/upload-a-product-image') } else { res.redirect('/product-case-testing/success-product-added') } }) //****************** success-product-added router.post('/success-product-added', function (req, res) { if (req.session.data['createcase'] == 'yes') { res.redirect('/product-case-testing/is-this-case-related-to-covid') } else { res.redirect('/product-case-testing/products-page') } }) //****************** it-was-your-product router.post('/it-was-your-product', function (req, res) { if (req.session.data['createcase'] == 'yes') { res.redirect('/product-case-testing/is-this-case-related-to-covid') } else { res.redirect('/product-case-testing/products-page') } }) //************ start upload-a-product-image router.post('/upload-a-product-image', function (req, res) { res.redirect('/product-case-testing/upload-a-product-image-success') }) //************ start upload-a-product-image-success router.post('/upload-a-product-image-success', function (req, res) { const valanother = req.session.data['another'] const valmax = req.session.data['max'] if (valmax == 'yes') { res.redirect('/product-case-testing/blank-no-more-images') } else if (valanother == 'anotherimage') { res.redirect('/product-case-testing/upload-a-product-image') } else if (valanother == 'no') { res.redirect('/product-case-testing/success-product-added') } }) //************ start remove-a-product-image-success router.post('/remove-a-product-image-success', function (req, res) { const valanother2 = req.session.data['another'] if (valanother2 == 'anotherimage') { res.redirect('/product-case-testing/upload-a-product-image') } else if (valanother2 == 'no') { res.redirect('/product-case-testing/success-product-added') } }) //****************** success-case-created router.post('/success-case-created', function (req, res) { const casecreated = req.session.data['casecreated'] if (casecreated == 'no') { res.redirect('/product-case-testing/cases-page') } else { res.redirect('/product-case-testing/add-a-product-to-a-case?ref=20-2120') } }) module.exports = router
9,793
3,328
const regex = / SUMME MONATSABRECHNUNG VISA /; function canParse() { return true; } function parse(text) { return { payee: { name: null }, text } } export default {parse, canParse}
231
80
// widths and padding var canvasWidth = 1000; // this will be the exported width of the image var elementPadding = 40; // padding around the logo and credit text // logo configuration // the name of the logo object should match the value of the corresponding radio button in the HTML. var logos = { 'lunchbox': { whitePath: '../img/icon-lunchbox-white.svg', // path to white logo blackPath: '../img/icon-lunchbox-black.svg', // path to black logo w: 100, // width of logo h: 80, // height of logo display: 'Lunchbox' }, 'socializr': { whitePath: '../img/icon-socializr-white.svg', blackPath: '../img/icon-socializr-black.svg', w: 150, h: 51, display: 'Socializr' } }; // logo opacity for colors var whiteLogoAlpha = '0.8'; var blackLogoAlpha = '0.6'; // type var fontWeight = 'normal'; // font weight for credit var fontSize = '20pt'; // font size for credit var fontFace = "Helvetica"; // font family for credit var fontShadow = 'rgba(0,0,0,0.7)'; // font shadow for credit var fontShadowOffsetX = 0; // font shadow offset x var fontShadowOffsetY = 0; // font shadow offset y var fontShadowBlur = 10; // font shadow blur // copyright options var orgName = 'Your News Organization'; var freelanceString = 'for ' + orgName; var copyrightOptions = { 'internal': { showPhotographer: true, // show the photographer input box showSource: false, // show the source input box photographerRequired: false, // require a photographer sourceRequired: false, // require a source source: orgName, // How the source should appear on the image, e.g. 'NPR' display: orgName, // How the option will appear in the dropdown menu }, 'freelance': { showPhotographer: true, showSource: false, photographerRequired: true, sourceRequired: false, source: freelanceString, display: 'Freelance' }, 'ap': { showPhotographer: true, showSource: false, photographerRequired: false, sourceRequired: false, source: 'AP', display: 'AP' }, 'getty': { showPhotographer: true, showSource: false, photographerRequired: false, sourceRequired: false, source: 'Getty Images', display: 'Getty' }, 'thirdParty': { showPhotographer: true, showSource: true, photographerRequired: false, sourceRequired: true, source: '', display: 'Third Party/Courtesy' } } // app load defaults var currentCrop = 'twitter'; // default crop size var currentLogo = 'lunchbox'; // default logo slug var currentLogoColor = 'white'; // default logo color var currentTextColor = 'white'; // default text color var defaultImage = '../img/test-kitten.jpg'; // path to image to load as test image var defaultLogo = logos[currentLogo]['whitePath'] // path to default logo
2,988
900
var basicCard = require('./basicCard.js'); var clozeCard = require('./clozeCard.js'); var quest = require('./quest.js') var inquirer = require('inquirer'); var basicArray = []; var clozeArray = []; inquirer.prompt([{ name:'addOrShow', message: 'Would you like to make Flash Cards?', type: 'list', choices: [{ name: 'Yes' },{ name: 'No' }] }]).then(function(answer){ if(answer.addOrShow === 'Yes'){ add(); }else{ console.log('Too bad! You are going to have to!'); add(); } }); var add = function(){ inquirer.prompt([{ name:'type', message: 'Which type of card BASIC or CLOZE?', type:'list', choices: [{ name: 'basic' },{ name:'cloze' }] }]).then(function(answer){ if(answer.type === 'basic'){ inquirer.prompt([{ name:'front', message: 'What is the question?', validate: function(input){ if(input ===''){ console.log('Put a question FIRST!!!'); return false; }else{ return true; } } },{ name:'back', message: 'Now put an ANSWER down!', validate: function(input){ if(input === ''){ console.log('Put an answer!'); return false; }else{ return true; } } }]).then(function(answer){ var front = answer.front; var back = answer.back; var firstPresident = new basicCard(front,back); basicArray.push(firstPresident); console.log(firstPresident); add(); }); }else if(answer.type === 'cloze'){ inquirer.prompt([{ name: 'full', message: 'What is the full text? Please put the cloze portion first!', validate: function(input){ if(input === ''){ console.log('Put a full text question') return false; } else{ return true; } } },{ name:'cloze', message: 'What is the cloze part?', validate: function(input){ if(input === ''){ console.log('provide a cloze portion silly'); return false; }else{ return true; } } },{ name: 'partial', message: 'What is the partial message?', validate: function(input){ if(input === ''){ console.log('provide the partial part!'); return false; }else{ return true; } } }]).then(function(answer){ var cloze = answer.cloze; var partial = answer.partial; var full = answer.full; var firstPresidentCloze = new clozeCard(partial,cloze,full); clozeArray.push(firstPresidentCloze); console.log(firstPresidentCloze); add(); }); } }); };
2,526
1,150
'use strict'; Object.defineProperty( exports, '__esModule', { value: true } ); module.exports = exports.default = require('./src/parser');
151
48
/*! * express-session-ws-rn * Copyright(c) 2019 Kudrenko Oleg * MIT Licensed */ /*! * forked from express-session * Copyright(c) 2010 Sencha Inc. * Copyright(c) 2011 TJ Holowaychuk * Copyright(c) 2014-2015 Douglas Christopher Wilson * MIT Licensed */ 'use strict'; /** * Module dependencies. * @private */ var cookie = require('cookie'); var crc = require('crc').crc32; var debug = require('debug')('express-session'); var deprecate = require('depd')('express-session'); var parseUrl = require('parseurl'); var uid = require('uid-safe').sync , onHeaders = require('on-headers') , signature = require('cookie-signature') var Session = require('./session/session') , MemoryStore = require('./session/memory') , Cookie = require('./session/cookie') , Store = require('./session/store') // environment var env = process.env.NODE_ENV; /** * Expose the middleware. */ exports = module.exports = session; /** * Expose constructors. */ exports.Store = Store; exports.Cookie = Cookie; exports.Session = Session; exports.MemoryStore = MemoryStore; /** * Warning message for `MemoryStore` usage in production. * @private */ var warning = 'Warning: connect.session() MemoryStore is not\n' + 'designed for a production environment, as it will leak\n' + 'memory, and will not scale past a single process.'; /** * Node.js 0.8+ async implementation. * @private */ /* istanbul ignore next */ var defer = typeof setImmediate === 'function' ? setImmediate : function(fn){ process.nextTick(fn.bind.apply(fn, arguments)) } /** * Setup session store with the given `options`. * * @param {Object} [options] * @param {Object} [options.cookie] Options for cookie * @param {Function} [options.genid] * @param {String} [options.name=connect.sid] Session ID cookie name * @param {Boolean} [options.proxy] * @param {Boolean} [options.resave] Resave unmodified sessions back to the store * @param {Boolean} [options.rolling] Enable/disable rolling session expiration * @param {Boolean} [options.saveUninitialized] Save uninitialized sessions to the store * @param {String|Array} [options.secret] Secret for signing session ID * @param {Object} [options.store=MemoryStore] Session store * @param {String} [options.unset] * @return {Function} middleware * @public */ function session(options) { var opts = options || {} // get the cookie options var cookieOptions = opts.cookie || {} // get the session id generate function var generateId = opts.genid || generateSessionId // get the session cookie name var name = opts.name || opts.key || 'connect.sid' // get the session store var store = opts.store || new MemoryStore() // get the trust proxy setting var trustProxy = opts.proxy // get the resave session option var resaveSession = opts.resave; // get the rolling session option var rollingSessions = Boolean(opts.rolling) // get the save uninitialized session option var saveUninitializedSession = opts.saveUninitialized // get the cookie signing secret var secret = opts.secret if (typeof generateId !== 'function') { throw new TypeError('genid option must be a function'); } if (resaveSession === undefined) { deprecate('undefined resave option; provide resave option'); resaveSession = true; } if (saveUninitializedSession === undefined) { deprecate('undefined saveUninitialized option; provide saveUninitialized option'); saveUninitializedSession = true; } if (opts.unset && opts.unset !== 'destroy' && opts.unset !== 'keep') { throw new TypeError('unset option must be "destroy" or "keep"'); } // TODO: switch to "destroy" on next major var unsetDestroy = opts.unset === 'destroy' if (Array.isArray(secret) && secret.length === 0) { throw new TypeError('secret option array must contain one or more strings'); } if (secret && !Array.isArray(secret)) { secret = [secret]; } if (!secret) { deprecate('req.secret; provide secret option'); } // notify user that this store is not // meant for a production environment /* istanbul ignore next: not tested */ if ('production' == env && store instanceof MemoryStore) { console.warn(warning); } // generates the new session store.generate = function(req){ req.sessionID = generateId(req); req.session = new Session(req); req.session.cookie = new Cookie(cookieOptions); if (cookieOptions.secure === 'auto') { req.session.cookie.secure = issecure(req, trustProxy); } }; var storeImplementsTouch = typeof store.touch === 'function'; // register event listeners for the store to track readiness var storeReady = true store.on('disconnect', function ondisconnect() { storeReady = false }) store.on('connect', function onconnect() { storeReady = true }) return function session(req, res, next) { // self-awareness if (req.session) { next() return } // Handle connection as if there is no session if // the store has temporarily disconnected etc if (!storeReady) { debug('store is disconnected') next() return } // pathname mismatch var originalPath = parseUrl.original(req).pathname || '/' if (originalPath.indexOf(cookieOptions.path || '/') !== 0) return next(); // ensure a secret is available or bail if (!secret && !req.secret) { next(new Error('secret option required for sessions')); return; } // backwards compatibility for signed cookies // req.secret is passed from the cookie parser middleware var secrets = secret || [req.secret]; var originalHash; var originalId; var savedHash; var touched = false // expose store req.sessionStore = store; debug('try to get sessionID from coookie with name %s and secrets %s', name, secrets); // get the session ID from the cookie var cookieId = req.sessionID = getcookie(req, name, secrets); // set-ws-cookie onHeaders(res, function(){ debug('onHeaders'); if (!req.session) { debug('no session'); return; } if (!shouldSetCookie(req)) { return; } // only send secure cookies via https if (req.session.cookie.secure && !issecure(req, trustProxy)) { debug('not secured'); return; } if (!touched) { // touch session req.session.touch() touched = true } // set cookie setcookie(res, name, req.sessionID, secrets[0], req.session.cookie.data); }); // proxy end() to commit the session var _end = res.end; var _write = res.write; var ended = false; res.end = function end(chunk, encoding) { if (ended) { return false; } ended = true; var ret; var sync = true; function writeend() { if (sync) { ret = _end.call(res, chunk, encoding); sync = false; return; } _end.call(res); } function writetop() { if (!sync) { return ret; } if (chunk == null) { ret = true; return ret; } var contentLength = Number(res.getHeader('Content-Length')); if (!isNaN(contentLength) && contentLength > 0) { // measure chunk chunk = !Buffer.isBuffer(chunk) ? new Buffer(chunk, encoding) : chunk; encoding = undefined; if (chunk.length !== 0) { debug('split response'); ret = _write.call(res, chunk.slice(0, chunk.length - 1)); chunk = chunk.slice(chunk.length - 1, chunk.length); return ret; } } ret = _write.call(res, chunk, encoding); sync = false; return ret; } if (shouldDestroy(req)) { // destroy session debug('destroying'); store.destroy(req.sessionID, function ondestroy(err) { if (err) { defer(next, err); } debug('destroyed'); writeend(); }); return writetop(); } // no session to save if (!req.session) { debug('no session'); return _end.call(res, chunk, encoding); } if (!touched) { // touch session req.session.touch() touched = true } if (shouldSave(req)) { req.session.save(function onsave(err) { if (err) { defer(next, err); } writeend(); }); return writetop(); } else if (storeImplementsTouch && shouldTouch(req)) { // store implements touch method debug('touching'); store.touch(req.sessionID, req.session, function ontouch(err) { if (err) { defer(next, err); } debug('touched'); writeend(); }); return writetop(); } return _end.call(res, chunk, encoding); }; // generate the session function generate() { store.generate(req); originalId = req.sessionID; originalHash = hash(req.session); wrapmethods(req.session); } // wrap session methods function wrapmethods(sess) { var _reload = sess.reload var _save = sess.save; function reload(callback) { debug('reloading %s', this.id) _reload.call(this, function () { wrapmethods(req.session) callback.apply(this, arguments) }) } function save() { debug('saving %s', this.id); savedHash = hash(this); _save.apply(this, arguments); } Object.defineProperty(sess, 'reload', { configurable: true, enumerable: false, value: reload, writable: true }) Object.defineProperty(sess, 'save', { configurable: true, enumerable: false, value: save, writable: true }); } // check if session has been modified function isModified(sess) { return originalId !== sess.id || originalHash !== hash(sess); } // check if session has been saved function isSaved(sess) { return originalId === sess.id && savedHash === hash(sess); } // determine if session should be destroyed function shouldDestroy(req) { return req.sessionID && unsetDestroy && req.session == null; } // determine if session should be saved to store function shouldSave(req) { // cannot set cookie without a session ID if (typeof req.sessionID !== 'string') { debug('session ignored because of bogus req.sessionID %o', req.sessionID); return false; } return !saveUninitializedSession && cookieId !== req.sessionID ? isModified(req.session) : !isSaved(req.session) } // determine if session should be touched function shouldTouch(req) { // cannot set cookie without a session ID if (typeof req.sessionID !== 'string') { debug('session ignored because of bogus req.sessionID %o', req.sessionID); return false; } return cookieId === req.sessionID && !shouldSave(req); } // determine if cookie should be set on response function shouldSetCookie(req) { // cannot set cookie without a session ID if (typeof req.sessionID !== 'string') { return false; } return cookieId != req.sessionID ? saveUninitializedSession || isModified(req.session) : rollingSessions || req.session.cookie.expires != null && isModified(req.session); } // generate a session if the browser doesn't send a sessionID if (!req.sessionID) { debug('no SID sent, generating session'); generate(); next(); return; } // generate the session object debug('fetching %s', req.sessionID); store.get(req.sessionID, function(err, sess){ // error handling if (err) { debug('error %j', err); if (err.code !== 'ENOENT') { next(err); return; } generate(); // no session } else if (!sess) { debug('no session found'); generate(); // populate req.session } else { debug('session found'); store.createSession(req, sess); originalId = req.sessionID; originalHash = hash(sess); if (!resaveSession) { savedHash = originalHash } wrapmethods(req.session); } next(); }); }; }; /** * Generate a session ID for a new session. * * @return {String} * @private */ function generateSessionId(sess) { return uid(24); } /** * Get the session ID cookie from request. * * @return {string} * @private */ function getcookie(req, name, secrets) { var header = req.headers['ws-cookie']; debug('headers', req.headers); var raw; var val; // read from cookie header if (header) { var cookies = cookie.parse(header); debug('cookies', cookies); raw = cookies[name]; if (raw) { if (raw.substr(0, 2) === 's:') { val = unsigncookie(raw.slice(2), secrets); if (val === false) { debug('cookie signature invalid'); val = undefined; } } else { debug('cookie unsigned') } } } // back-compat read from cookieParser() signedCookies data if (!val && req.signedCookies) { val = req.signedCookies[name]; if (val) { deprecate('cookie should be available in req.headers.cookie'); } } // back-compat read from cookieParser() cookies data if (!val && req.cookies) { raw = req.cookies[name]; if (raw) { if (raw.substr(0, 2) === 's:') { val = unsigncookie(raw.slice(2), secrets); if (val) { deprecate('cookie should be available in req.headers.cookie'); } if (val === false) { debug('cookie signature invalid'); val = undefined; } } else { debug('cookie unsigned') } } } return val; } /** * Hash the given `sess` object omitting changes to `.cookie`. * * @param {Object} sess * @return {String} * @private */ function hash(sess) { return crc(JSON.stringify(sess, function (key, val) { // ignore sess.cookie property if (this === sess && key === 'cookie') { return } return val })) } /** * Determine if request is secure. * * @param {Object} req * @param {Boolean} [trustProxy] * @return {Boolean} * @private */ function issecure(req, trustProxy) { // socket is https server if (req.connection && req.connection.encrypted) { return true; } // do not trust proxy if (trustProxy === false) { return false; } // no explicit trust; try req.secure from express if (trustProxy !== true) { var secure = req.secure; return typeof secure === 'boolean' ? secure : false; } // read the proto from x-forwarded-proto header var header = req.headers['x-forwarded-proto'] || ''; var index = header.indexOf(','); var proto = index !== -1 ? header.substr(0, index).toLowerCase().trim() : header.toLowerCase().trim() return proto === 'https'; } /** * Set cookie on response. * * @private */ function setcookie(res, name, val, secret, options) { var signed = 's:' + signature.sign(val, secret); var data = cookie.serialize(name, signed, options); debug('set-ws-cookie %s', data); var prev = res.getHeader('set-ws-cookie') || []; var header = Array.isArray(prev) ? prev.concat(data) : [prev, data]; res.setHeader('set-ws-cookie', header) } /** * Verify and decode the given `val` with `secrets`. * * @param {String} val * @param {Array} secrets * @returns {String|Boolean} * @private */ function unsigncookie(val, secrets) { for (var i = 0; i < secrets.length; i++) { var result = signature.unsign(val, secrets[i]); if (result !== false) { return result; } } return false; }
16,088
4,831
/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ export default function ({ getService, loadTestFile }) { const es = getService('es'); describe('uptime', () => { beforeEach(() => es.indices.delete({ index: 'heartbeat', ignore: [404], })); loadTestFile(require.resolve('./get_all_pings')); loadTestFile(require.resolve('./graphql')); }); }
581
175
/* eslint-env jest */ import MockAdapter from 'axios-mock-adapter' import { createStore } from '../../../../test/helpers/store' import { addSegment, clearSegments, incrementSegmentWidth, getLastStreet } from '../actions/street' // ToDo: Remove this once refactoring of redux action saveStreetToServerIfNecessary is complete import { saveStreetToServerIfNecessary } from '../../streets/data_model' import apiClient from '../../util/api' import { ERRORS } from '../../app/errors' jest.mock('../../app/load_resources') jest.mock('../../streets/data_model', () => { const actual = jest.requireActual('../../streets/data_model') return { ...actual, saveStreetToServerIfNecessary: jest.fn() } }) describe('street integration test', () => { beforeEach(() => { jest.clearAllMocks() }) describe('#addSegment', () => { it('adds the new segment at the index', () => { const initialState = { street: { segments: [1, 2] } } const store = createStore(initialState) store.dispatch(addSegment(1, 3)) const { street } = store.getState() expect(street.segments.length).toEqual(3) expect(street.segments[1]).toEqual(3) }) }) describe('#clearSegments', () => { it('clears all segments', () => { const initialState = { street: { segments: [1, 2] } } const store = createStore(initialState) store.dispatch(clearSegments()) const { street } = store.getState() expect(street.segments.length).toEqual(0) }) }) describe('#incrementSegmentWidth', () => { describe('decrease segment width by 1', () => { it('by resolution', async () => { const initialState = { street: { segments: [{ width: 200 }, { width: 200 }], units: 1 } } const store = createStore(initialState) await store.dispatch(incrementSegmentWidth(1, false, true, 200)) const { street } = store.getState() expect(street.segments[1].width).toEqual(199.75) }) it('by clickIncrement', async () => { const initialState = { street: { segments: [{ width: 200 }, { width: 200 }], units: 1 } } const store = createStore(initialState) await store.dispatch(incrementSegmentWidth(1, false, false, 200)) const { street } = store.getState() expect(street.segments[1].width).toEqual(199.5) }) it('has a remaining width of 0.25', async () => { const initialState = { street: { width: 400, segments: [{ width: 200 }, { width: 200 }], units: 1 } } const store = createStore(initialState) await store.dispatch(incrementSegmentWidth(1, false, true, 200)) const { street } = store.getState() expect(street.segments[1].width).toEqual(199.75) expect(street.occupiedWidth).toEqual(399.75) expect(street.remainingWidth).toEqual(0.25) }) }) describe('increase segment width by 1', () => { it('by resolution', async () => { const initialState = { street: { segments: [{ width: 200 }, { width: 200 }], units: 1 } } const store = createStore(initialState) await store.dispatch(incrementSegmentWidth(1, true, true, 200)) const { street } = store.getState() expect(street.segments[1].width).toEqual(200.25) }) it('by clickIncrement', async () => { const initialState = { street: { segments: [{ width: 200 }, { width: 200 }], units: 1 } } const store = createStore(initialState) await store.dispatch(incrementSegmentWidth(1, true, false, 200)) const { street } = store.getState() expect(street.segments[1].width).toEqual(200.5) }) }) // ToDo: Remove this once refactoring of redux action saveStreetToServerIfNecessary is complete it('saves to server', async () => { const initialState = { street: { segments: [{ width: 200 }, { width: 200 }] } } const store = createStore(initialState) await store.dispatch(incrementSegmentWidth(1, true, false, 200)) expect(saveStreetToServerIfNecessary).toHaveBeenCalledTimes(1) }) }) describe('#getLastStreet', () => { let apiMock const type = 'streetcar' const variantString = 'inbound|regular' const segment = { variantString, id: '1', width: 400, randSeed: 1, type } const street = { segments: [segment], width: 100 } const apiResponse = { id: '3', originalStreetId: '1', updatedAt: '', name: 'StreetName', data: { street } } beforeEach(() => { apiMock = new MockAdapter(apiClient.client) }) afterEach(() => { apiMock.restore() }) it('updates the street', async () => { const store = createStore({ settings: { priorLastStreetId: '1' } }) apiMock.onAny().reply(200, apiResponse) await store.dispatch(getLastStreet()) const { street } = store.getState() expect(street.segments.length).toEqual(1) }) it('sets lastStreetId', async () => { const store = createStore({ settings: { priorLastStreetId: '1' } }) apiMock.onAny().reply(200, apiResponse) await store.dispatch(getLastStreet()) const { settings } = store.getState() expect(settings.lastStreetId).toEqual('3') }) it('sets lastStreetId', async () => { const store = createStore({ street: { id: '50', namespaceId: '45' }, settings: { priorLastStreetId: '1' } }) apiMock.onAny().reply(200, apiResponse) await store.dispatch(getLastStreet()) const { street } = store.getState() expect(street.id).toEqual('50') expect(street.namespaceId).toEqual('45') }) describe('response failure', () => { it('does not set lastStreetId', async () => { const store = createStore({ settings: { priorLastStreetId: '1' } }) apiMock.onAny().networkError() await store.dispatch(getLastStreet()) const { errors } = store.getState() expect(errors.errorType).toEqual(ERRORS.NEW_STREET_SERVER_FAILURE) }) }) }) })
6,054
1,959
import React from "react"; import PageBaseComponent from "../../components/PageBaseComponent/PageBaseComponent"; import ModalContainer from "../../components/Modals/ModalContainer"; import Modal from "../../components/Modals/Modal"; const Challenge = () => { return ( <PageBaseComponent className="Challenge"> <ModalContainer> <Modal isGhost="true" isBackless="false"> <p>So you think you can challenge me?</p> <p>(TODO: Add a game people can challenge me in here...)</p> </Modal> </ModalContainer> </PageBaseComponent> ); }; export default Challenge;
615
168
function submit_message(message) { $.post( "/send_message", {message: message}, handle_response); function handle_response(data) { // append the bot repsonse to the div $('.card-body').append(` <div class="d-flex justify-content-start mb-4"> <div class="img_cont_msg"> <img src="/static/bot-icon.jpg" class="rounded-circle user_img_msg"> </div> <div class="msg_cotainer"> ${data.response} <span class="msg_time">8:40 AM, Today</span> </div> </div> `) if (data.has_image == 'True') { // append a row to the table $('.card-body').append(` <div class="d-flex justify-content-start mb-4"> <div class="img_cont_msg"> <img src="/static/bot-icon.jpg" class="rounded-circle user_img_msg"> </div> <div class="msg_cotainer"> <img src=${data.image} width="400"> <span class="msg_time">8:40 AM, Today</span> </div> </div> `) } // remove the loading indicator $( "#loading" ).remove(); } } $('#target').on('submit', function(e){ e.preventDefault(); const input_message = $('#input_message').val() // return if the user does not enter any text if (!input_message) { return } $('.card-body').append(` <div class="d-flex justify-content-end mb-4"> <div class="msg_cotainer_send"> ${input_message} <span class="msg_time_send">8:55 AM, Today</span> </div> <div class="img_cont_msg"> <img src="/static/user-icon.jpg" class="rounded-circle user_img_msg"> </div> </div> `) // loading $('.card-body').append(` <div class="d-flex justify-content-start mb-4" id="loading"> <div class="img_cont_msg"> <img src="/static/bot-icon.jpg" class="rounded-circle user_img_msg"> </div> <div class="msg_cotainer"> <b>...</b> <span class="msg_time">8:40 AM, Today</span> </div> </div> `) // clear the text input $('#input_message').val('') // send the message submit_message(input_message) });
2,150
786
import Page from '../../common/page'; Page({ data: { checkbox1: true, checkbox2: true, checkbox3: true, checkboxLabel: true, checkboxSize: true, checkboxShape: true, list: ['a', 'b', 'c'], result: ['a', 'b'], result2: [], result3: [], activeIcon: 'https://img.yzcdn.cn/vant/user-active.png', inactiveIcon: 'https://img.yzcdn.cn/vant/user-inactive.png' }, onChange(event) { const { key } = event.currentTarget.dataset; this.setData({ [key]: event.detail }); }, onClick(event) { const { value } = event.currentTarget.dataset; this.setData({ radio3: value }); }, toggle(event) { const { index } = event.currentTarget.dataset; const checkbox = this.selectComponent(`.checkboxes-${index}`); checkbox.toggle(); }, noop() {} });
831
289
import { Directive, EventEmitter, Host, Input, NgZone, Output } from '@angular/core'; import { Content } from '../content/content'; import { GestureController, GESTURE_PRIORITY_REFRESHER, GESTURE_REFRESHER } from '../../gestures/gesture-controller'; import { isTrueProperty } from '../../util/util'; import { Platform } from '../../platform/platform'; import { pointerCoord } from '../../util/dom'; import { UIEventManager } from '../../gestures/ui-event-manager'; /** * \@name Refresher * \@description * The Refresher provides pull-to-refresh functionality on a content component. * Place the `ion-refresher` as the first child of your `ion-content` element. * * Pages can then listen to the refresher's various output events. The * `refresh` output event is fired when the user has pulled down far * enough to kick off the refreshing process. Once the async operation * has completed and the refreshing should end, call `complete()`. * * Note: Do not wrap the `ion-refresher` in a `*ngIf`. It will not render * properly this way. Please use the `enabled` property instead to * display or hide the refresher. * * \@usage * ```html * <ion-content> * * <ion-refresher (ionRefresh)="doRefresh($event)"> * <ion-refresher-content></ion-refresher-content> * </ion-refresher> * * </ion-content> * ``` * * ```ts * \@Component({...}) * export class NewsFeedPage { * * doRefresh(refresher) { * console.log('Begin async operation', refresher); * * setTimeout(() => { * console.log('Async operation has ended'); * refresher.complete(); * }, 2000); * } * * } * ``` * * * ## Refresher Content * * By default, Ionic provides the pulling icon and refreshing spinner that * looks best for the platform the user is on. However, you can change the * default icon and spinner, along with adding text for each state by * adding properties to the child `ion-refresher-content` component. * * ```html * <ion-content> * * <ion-refresher (ionRefresh)="doRefresh($event)"> * <ion-refresher-content * pullingIcon="arrow-dropdown" * pullingText="Pull to refresh" * refreshingSpinner="circles" * refreshingText="Refreshing..."> * </ion-refresher-content> * </ion-refresher> * * </ion-content> * ``` * * * ## Further Customizing Refresher Content * * The `ion-refresher` component holds the refresh logic. * It requires a child component in order to display the content. * Ionic uses `ion-refresher-content` by default. This component * displays the refresher and changes the look depending * on the refresher's state. Separating these components * allows developers to create their own refresher content * components. You could replace our default content with * custom SVG or CSS animations. * * \@demo /docs/demos/src/refresher/ * */ export class Refresher { /** * @param {?} _plt * @param {?} _content * @param {?} _zone * @param {?} gestureCtrl */ constructor(_plt, _content, _zone, gestureCtrl) { this._plt = _plt; this._content = _content; this._zone = _zone; this._appliedStyles = false; this._lastCheck = 0; this._isEnabled = true; this._top = ''; /** * The current state which the refresher is in. The refresher's states include: * * - `inactive` - The refresher is not being pulled down or refreshing and is currently hidden. * - `pulling` - The user is actively pulling down the refresher, but has not reached the point yet that if the user lets go, it'll refresh. * - `cancelling` - The user pulled down the refresher and let go, but did not pull down far enough to kick off the `refreshing` state. After letting go, the refresher is in the `cancelling` state while it is closing, and will go back to the `inactive` state once closed. * - `ready` - The user has pulled down the refresher far enough that if they let go, it'll begin the `refreshing` state. * - `refreshing` - The refresher is actively waiting on the async operation to end. Once the refresh handler calls `complete()` it will begin the `completing` state. * - `completing` - The `refreshing` state has finished and the refresher is in the process of closing itself. Once closed, the refresher will go back to the `inactive` state. */ this.state = STATE_INACTIVE; /** * The Y coordinate of where the user started to the pull down the content. */ this.startY = null; /** * The current touch or mouse event's Y coordinate. */ this.currentY = null; /** * The distance between the start of the pull and the current touch or * mouse event's Y coordinate. */ this.deltaY = null; /** * A number representing how far down the user has pulled. * The number `0` represents the user hasn't pulled down at all. The * number `1`, and anything greater than `1`, represents that the user * has pulled far enough down that when they let go then the refresh will * happen. If they let go and the number is less than `1`, then the * refresh will not happen, and the content will return to it's original * position. */ this.progress = 0; /** * \@input {number} The min distance the user must pull down until the * refresher can go into the `refreshing` state. Default is `60`. */ this.pullMin = 60; /** * \@input {number} The maximum distance of the pull until the refresher * will automatically go into the `refreshing` state. By default, the pull * maximum will be the result of `pullMin + 60`. */ this.pullMax = this.pullMin + 60; /** * \@input {number} How many milliseconds it takes to close the refresher. Default is `280`. */ this.closeDuration = 280; /** * \@input {number} How many milliseconds it takes the refresher to to snap back to the `refreshing` state. Default is `280`. */ this.snapbackDuration = 280; /** * \@output {event} Emitted when the user lets go and has pulled down * far enough, which would be farther than the `pullMin`, then your refresh hander if * fired and the state is updated to `refreshing`. From within your refresh handler, * you must call the `complete()` method when your async operation has completed. */ this.ionRefresh = new EventEmitter(); /** * \@output {event} Emitted while the user is pulling down the content and exposing the refresher. */ this.ionPull = new EventEmitter(); /** * \@output {event} Emitted when the user begins to start pulling down. */ this.ionStart = new EventEmitter(); this._events = new UIEventManager(_plt); _content._hasRefresher = true; this._gesture = gestureCtrl.createGesture({ name: GESTURE_REFRESHER, priority: GESTURE_PRIORITY_REFRESHER }); } /** * \@input {boolean} If the refresher is enabled or not. This should be used in place of an `ngIf`. Default is `true`. * @return {?} */ get enabled() { return this._isEnabled; } /** * @param {?} val * @return {?} */ set enabled(val) { this._isEnabled = isTrueProperty(val); this._setListeners(this._isEnabled); } /** * @param {?} ev * @return {?} */ _onStart(ev) { // if multitouch then get out immediately if (ev.touches && ev.touches.length > 1) { return false; } if (this.state !== STATE_INACTIVE) { return false; } let /** @type {?} */ scrollHostScrollTop = this._content.getContentDimensions().scrollTop; // if the scrollTop is greater than zero then it's // not possible to pull the content down yet if (scrollHostScrollTop > 0) { return false; } if (!this._gesture.canStart()) { return false; } let /** @type {?} */ coord = pointerCoord(ev); (void 0) /* console.debug */; if (this._content.contentTop > 0) { let /** @type {?} */ newTop = this._content.contentTop + 'px'; if (this._top !== newTop) { this._top = newTop; } } this.startY = this.currentY = coord.y; this.progress = 0; this.state = STATE_INACTIVE; return true; } /** * @param {?} ev * @return {?} */ _onMove(ev) { // this method can get called like a bazillion times per second, // so it's built to be as efficient as possible, and does its // best to do any DOM read/writes only when absolutely necessary // if multitouch then get out immediately if (ev.touches && ev.touches.length > 1) { return 1; } if (!this._gesture.canStart()) { return 0; } // do nothing if it's actively refreshing // or it's in the process of closing // or this was never a startY if (this.startY === null || this.state === STATE_REFRESHING || this.state === STATE_CANCELLING || this.state === STATE_COMPLETING) { return 2; } // if we just updated stuff less than 16ms ago // then don't check again, just chillout plz let /** @type {?} */ now = Date.now(); if (this._lastCheck + 16 > now) { return 3; } // remember the last time we checked all this this._lastCheck = now; // get the current pointer coordinates let /** @type {?} */ coord = pointerCoord(ev); this.currentY = coord.y; // it's now possible they could be pulling down the content // how far have they pulled so far? this.deltaY = (coord.y - this.startY); // don't bother if they're scrolling up // and have not already started dragging if (this.deltaY <= 0) { // the current Y is higher than the starting Y // so they scrolled up enough to be ignored this.progress = 0; if (this.state !== STATE_INACTIVE) { this._zone.run(() => { this.state = STATE_INACTIVE; }); } if (this._appliedStyles) { // reset the styles only if they were applied this._setCss(0, '', false, ''); return 5; } return 6; } if (this.state === STATE_INACTIVE) { // this refresh is not already actively pulling down // get the content's scrollTop let /** @type {?} */ scrollHostScrollTop = this._content.getContentDimensions().scrollTop; // if the scrollTop is greater than zero then it's // not possible to pull the content down yet if (scrollHostScrollTop > 0) { this.progress = 0; this.startY = null; return 7; } // content scrolled all the way to the top, and dragging down this.state = STATE_PULLING; } // prevent native scroll events ev.preventDefault(); // the refresher is actively pulling at this point // move the scroll element within the content element this._setCss(this.deltaY, '0ms', true, ''); if (!this.deltaY) { // don't continue if there's no delta yet this.progress = 0; return 8; } // so far so good, let's run this all back within zone now this._zone.run(() => { this._onMoveInZone(); }); } /** * @return {?} */ _onMoveInZone() { // set pull progress this.progress = (this.deltaY / this.pullMin); // emit "start" if it hasn't started yet if (!this._didStart) { this._didStart = true; this.ionStart.emit(this); } // emit "pulling" on every move this.ionPull.emit(this); // do nothing if the delta is less than the pull threshold if (this.deltaY < this.pullMin) { // ensure it stays in the pulling state, cuz its not ready yet this.state = STATE_PULLING; return 2; } if (this.deltaY > this.pullMax) { // they pulled farther than the max, so kick off the refresh this._beginRefresh(); return 3; } // pulled farther than the pull min!! // it is now in the `ready` state!! // if they let go then it'll refresh, kerpow!! this.state = STATE_READY; return 4; } /** * @return {?} */ _onEnd() { // only run in a zone when absolutely necessary if (this.state === STATE_READY) { this._zone.run(() => { // they pulled down far enough, so it's ready to refresh this._beginRefresh(); }); } else if (this.state === STATE_PULLING) { this._zone.run(() => { // they were pulling down, but didn't pull down far enough // set the content back to it's original location // and close the refresher // set that the refresh is actively cancelling this.cancel(); }); } // reset on any touchend/mouseup this.startY = null; } /** * @return {?} */ _beginRefresh() { // assumes we're already back in a zone // they pulled down far enough, so it's ready to refresh this.state = STATE_REFRESHING; // place the content in a hangout position while it thinks this._setCss(this.pullMin, (this.snapbackDuration + 'ms'), true, ''); // emit "refresh" because it was pulled down far enough // and they let go to begin refreshing this.ionRefresh.emit(this); } /** * Call `complete()` when your async operation has completed. * For example, the `refreshing` state is while the app is performing * an asynchronous operation, such as receiving more data from an * AJAX request. Once the data has been received, you then call this * method to signify that the refreshing has completed and to close * the refresher. This method also changes the refresher's state from * `refreshing` to `completing`. * @return {?} */ complete() { this._close(STATE_COMPLETING, '120ms'); } /** * Changes the refresher's state from `refreshing` to `cancelling`. * @return {?} */ cancel() { this._close(STATE_CANCELLING, ''); } /** * @param {?} state * @param {?} delay * @return {?} */ _close(state, delay) { var /** @type {?} */ timer; /** * @param {?} ev * @return {?} */ function close(ev) { // closing is done, return to inactive state if (ev) { clearTimeout(timer); } this.state = STATE_INACTIVE; this.progress = 0; this._didStart = this.startY = this.currentY = this.deltaY = null; this._setCss(0, '0ms', false, ''); } // create fallback timer incase something goes wrong with transitionEnd event timer = setTimeout(close.bind(this), 600); // create transition end event on the content's scroll element this._content.onScrollElementTransitionEnd(close.bind(this)); // reset set the styles on the scroll element // set that the refresh is actively cancelling/completing this.state = state; this._setCss(0, '', true, delay); if (this._pointerEvents) { this._pointerEvents.stop(); } } /** * @param {?} y * @param {?} duration * @param {?} overflowVisible * @param {?} delay * @return {?} */ _setCss(y, duration, overflowVisible, delay) { this._appliedStyles = (y > 0); const /** @type {?} */ content = this._content; const /** @type {?} */ Css = this._plt.Css; content.setScrollElementStyle(Css.transform, ((y > 0) ? 'translateY(' + y + 'px) translateZ(0px)' : 'translateZ(0px)')); content.setScrollElementStyle(Css.transitionDuration, duration); content.setScrollElementStyle(Css.transitionDelay, delay); content.setScrollElementStyle('overflow', (overflowVisible ? 'hidden' : '')); } /** * @param {?} shouldListen * @return {?} */ _setListeners(shouldListen) { this._events.unlistenAll(); this._pointerEvents = null; if (shouldListen) { this._pointerEvents = this._events.pointerEvents({ element: this._content.getScrollElement(), pointerDown: this._onStart.bind(this), pointerMove: this._onMove.bind(this), pointerUp: this._onEnd.bind(this), zone: false }); } } /** * @hidden * @return {?} */ ngOnInit() { // bind event listeners // save the unregister listener functions to use onDestroy this._setListeners(this._isEnabled); } /** * @hidden * @return {?} */ ngOnDestroy() { this._setListeners(false); this._events.destroy(); this._gesture.destroy(); } } Refresher.decorators = [ { type: Directive, args: [{ selector: 'ion-refresher', host: { '[class.refresher-active]': 'state !== "inactive"', '[style.top]': '_top' } },] }, ]; /** * @nocollapse */ Refresher.ctorParameters = () => [ { type: Platform, }, { type: Content, decorators: [{ type: Host },] }, { type: NgZone, }, { type: GestureController, }, ]; Refresher.propDecorators = { 'pullMin': [{ type: Input },], 'pullMax': [{ type: Input },], 'closeDuration': [{ type: Input },], 'snapbackDuration': [{ type: Input },], 'enabled': [{ type: Input },], 'ionRefresh': [{ type: Output },], 'ionPull': [{ type: Output },], 'ionStart': [{ type: Output },], }; function Refresher_tsickle_Closure_declarations() { /** @type {?} */ Refresher.decorators; /** * @nocollapse * @type {?} */ Refresher.ctorParameters; /** @type {?} */ Refresher.propDecorators; /** @type {?} */ Refresher.prototype._appliedStyles; /** @type {?} */ Refresher.prototype._didStart; /** @type {?} */ Refresher.prototype._lastCheck; /** @type {?} */ Refresher.prototype._isEnabled; /** @type {?} */ Refresher.prototype._gesture; /** @type {?} */ Refresher.prototype._events; /** @type {?} */ Refresher.prototype._pointerEvents; /** @type {?} */ Refresher.prototype._top; /** * The current state which the refresher is in. The refresher's states include: * * - `inactive` - The refresher is not being pulled down or refreshing and is currently hidden. * - `pulling` - The user is actively pulling down the refresher, but has not reached the point yet that if the user lets go, it'll refresh. * - `cancelling` - The user pulled down the refresher and let go, but did not pull down far enough to kick off the `refreshing` state. After letting go, the refresher is in the `cancelling` state while it is closing, and will go back to the `inactive` state once closed. * - `ready` - The user has pulled down the refresher far enough that if they let go, it'll begin the `refreshing` state. * - `refreshing` - The refresher is actively waiting on the async operation to end. Once the refresh handler calls `complete()` it will begin the `completing` state. * - `completing` - The `refreshing` state has finished and the refresher is in the process of closing itself. Once closed, the refresher will go back to the `inactive` state. * @type {?} */ Refresher.prototype.state; /** * The Y coordinate of where the user started to the pull down the content. * @type {?} */ Refresher.prototype.startY; /** * The current touch or mouse event's Y coordinate. * @type {?} */ Refresher.prototype.currentY; /** * The distance between the start of the pull and the current touch or * mouse event's Y coordinate. * @type {?} */ Refresher.prototype.deltaY; /** * A number representing how far down the user has pulled. * The number `0` represents the user hasn't pulled down at all. The * number `1`, and anything greater than `1`, represents that the user * has pulled far enough down that when they let go then the refresh will * happen. If they let go and the number is less than `1`, then the * refresh will not happen, and the content will return to it's original * position. * @type {?} */ Refresher.prototype.progress; /** * \@input {number} The min distance the user must pull down until the * refresher can go into the `refreshing` state. Default is `60`. * @type {?} */ Refresher.prototype.pullMin; /** * \@input {number} The maximum distance of the pull until the refresher * will automatically go into the `refreshing` state. By default, the pull * maximum will be the result of `pullMin + 60`. * @type {?} */ Refresher.prototype.pullMax; /** * \@input {number} How many milliseconds it takes to close the refresher. Default is `280`. * @type {?} */ Refresher.prototype.closeDuration; /** * \@input {number} How many milliseconds it takes the refresher to to snap back to the `refreshing` state. Default is `280`. * @type {?} */ Refresher.prototype.snapbackDuration; /** * \@output {event} Emitted when the user lets go and has pulled down * far enough, which would be farther than the `pullMin`, then your refresh hander if * fired and the state is updated to `refreshing`. From within your refresh handler, * you must call the `complete()` method when your async operation has completed. * @type {?} */ Refresher.prototype.ionRefresh; /** * \@output {event} Emitted while the user is pulling down the content and exposing the refresher. * @type {?} */ Refresher.prototype.ionPull; /** * \@output {event} Emitted when the user begins to start pulling down. * @type {?} */ Refresher.prototype.ionStart; /** @type {?} */ Refresher.prototype._plt; /** @type {?} */ Refresher.prototype._content; /** @type {?} */ Refresher.prototype._zone; } const /** @type {?} */ STATE_INACTIVE = 'inactive'; const /** @type {?} */ STATE_PULLING = 'pulling'; const /** @type {?} */ STATE_READY = 'ready'; const /** @type {?} */ STATE_REFRESHING = 'refreshing'; const /** @type {?} */ STATE_CANCELLING = 'cancelling'; const /** @type {?} */ STATE_COMPLETING = 'completing'; //# sourceMappingURL=refresher.js.map
23,554
6,764
define([ 'angular', 'core/services/CommonResolveStateService', 'angular-ui-router', 'views/core/page-not-found' ],function(ng,CommonResolveStateService){ var app = ng.module('CoreRouterApp',['ui.router']); app.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) { $urlRouterProvider.otherwise(function($injector,$location){ var path = $location.path(); $location.replace().path('/page-not-found' + path); }); $stateProvider .state('page-not-found', CommonResolveStateService({ url: '/page-not-found/{page}', views: { 'main-content':{ template: TEMPLATES['views/core/page-not-found'](), controller: 'PageNotFoundController', resolve:{ page: ['$stateParams', function($stateParams){ return $stateParams.page; }] } } } })); }]); return app; });
1,243
300
import React from "react" import Layout from "../components/layout" import SEO from "../components/seo" const NotFoundPage = () => ( <Layout> <SEO title="404: Not found" /> <h1>451 – Unavailable For Legal Reasons</h1> Just kidding - it's a 404. <br></br> It seems you've found something that used to exist or I guess you spelled something wrong. Can you double check that URL? </Layout> ) export default NotFoundPage
444
148
class App { static parseDouble(number, digits = 2) { return Number.parseFloat(parseFloat(number).toFixed(digits)) } static borrowedTypeToDays(borrowedType, borrowedTime) { let idditionalDaysDateStart = 0 switch (borrowedType) { case 'day': idditionalDaysDateStart = borrowedTime break; case 'week': idditionalDaysDateStart = (borrowedTime * 7) break; case 'month': idditionalDaysDateStart = (borrowedTime * 30) break; case 'year': idditionalDaysDateStart = (borrowedTime * 365) break; } return idditionalDaysDateStart } } module.exports = App
612
259
/// <reference types="cypress" /> /// <reference types="../../support" /> context('resources/ExternalEmployees/actions/new', () => { before(() => { cy.abLoginAPI({ password: Cypress.env('ADMIN_PASSWORD'), email: Cypress.env('ADMIN_EMAIL') }) }) beforeEach(() => { cy.abKeepLoggedIn({ cookie: Cypress.env('COOKIE_NAME') }) cy.visit('resources/ExternalEmployees/actions/new') }) it('shows required mark (*) by email', () => { cy.get('[data-testid="property-edit-email"] label') .then(($label) => { const win = $label[0].ownerDocument.defaultView const before = win.getComputedStyle($label[0], 'before') const contentValue = before.getPropertyValue('content') expect(contentValue).to.eq('"*"') }) }) it('format date (only) in datepicker without time', () => { const hiredAt = new Date().toISOString().slice(0, 10) cy.get('[data-testid="property-edit-hiredAt"] button').click() cy.get('.react-datepicker__day--today').click() cy.get('[data-testid="property-edit-hiredAt"] input').should('have.value', hiredAt) }) })
1,108
371
const mongoose = require('mongoose'); const WeatherSchema = new mongoose.Schema({ weatherForNext5days: String, weatherForNext28days: String, suggestions: String, imgPath: String }); const Weather = mongoose.model('Weather', WeatherSchema); module.exports = { Weather, };
282
91
'use strict'; var Uit = {}; /**if developer wants to apply his/her own rivets rules, then include that file before uit.js and make window.customRivets === true. **/ if (window.rivets && _.isUndefined(window.customRivets)) { (function () { rivets.configure({ // Attribute prefix in templates prefix: 'rv', // Preload templates with initial data on bind preloadData: true, // Root sightglass interface for keypaths rootInterface: '.', // Template delimiters for text bindings templateDelimiters: ['{', '}'], // Augment the event handler of the on-* binder handler: function (target, event, binding) { this.call(binding.view.models, target, event); } }); rivets.adapters[':'] = { observe: function (obj, keypath, callback) { obj.on('change:' + keypath, callback); }, unobserve: function (obj, keypath, callback) { obj.off('change:' + keypath, callback); }, get: function (obj, keypath) { return obj.get(keypath); }, set: function (obj, keypath, value) { obj.set(keypath, value); } }; rivets.formatters.currency = { read: function (value) { var valueFloat = parseFloat(value); return (valueFloat) ? valueFloat.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') : '0.00'; }, publish: function (value) { return parseFloat(value); } }; // Allow to change the state of an input type check at checked on the DOM rivets.binders.util_checked = function (el, value) { var element = $(el); if (value === 1 || value === 1) { element.prop('checked', true); } else { element.prop('checked', false); } }; rivets.formatters.formatterHtml = function (value) { var textarea = $('<textarea>' + value + '</textarea>'); return textarea.val().replace(/\r\n|\r|\n/g, '<br /> '); }; })(); } Uit.ViewComponents = { _getAttributeByRivetsValue: function (rvValue, typeAttribute) { var arrayObject = rvValue.split(':'), reference = ''; if (typeAttribute === 'model') { reference = _.first(arrayObject); } else if (typeAttribute === 'attribute') { reference = _.last(arrayObject); } return reference; }, /** Return the value of model related with an attribute rv-value of a datepicker */ _getValueFromModelOfRivetsValue: function (rvValue) { var stringModel = this._getAttributeByRivetsValue(rvValue, 'model'), attribute = this._getAttributeByRivetsValue(rvValue, 'attribute'), model = window.s.startsWith(stringModel, 'options') ? this.options[stringModel.substr(8, stringModel.length)] : this[stringModel]; return model.get(attribute); }, _setValueModelFromRivetsValue: function (rvValue, value) { var stringModel = this._getAttributeByRivetsValue(rvValue, 'model'), attribute = this._getAttributeByRivetsValue(rvValue, 'attribute'), model = window.s.startsWith(stringModel, 'options') ? this.options[stringModel.substr(8, stringModel.length)] : this[stringModel]; model.set(attribute, value); } }; Uit.ViewComponents.Timepicker = { handlerTimePicker: function () { var el = this.$el, that = this; el.find('.timepicker').timepicker().on('changeTime.timepicker', function (e) { var element = $(e.currentTarget), rvValue = element.attr('rv-value'); var stringModel = that._getAttributeByRivetsValue(rvValue, 'model'); var attribute = that._getAttributeByRivetsValue(rvValue, 'attribute'); var model = window.s.startsWith(stringModel, 'options') ? that.options[stringModel.substr(8, stringModel.length)] : that[stringModel]; model.set(attribute, e.time.value); }); this.$el.find('.timepicker').each(function () { var element = $(this), rvValue = element.attr('rv-value'); if (rvValue) { var value = that._getValueFromModelOfRivetsValue(rvValue); if (_.isEmpty(value)) { if (!_.isUndefined(element.data('default-time')) || !_.isUndefined(element.attr('default-time'))) { var time = element.timepicker('updateElement'); that._setValueModelFromRivetsValue(rvValue, time.val()); } else { element.timepicker('setTime', ''); } } else { if (value[0] === '1' && value[1] === '2') {//timepicker lib has a bug where it does not convert 12:00:00 to proper 12:00 PM. value += ' PM'; } element.timepicker('setTime', value); } } }); } }; Uit.ViewComponents.Datepicker = { watchChangeDatepicker: true, _handlerUpdateModelFromDatepicker: function (element, checkValidFormat) { var value = element.val(); var rvValue = element.attr('rv-value'); if (checkValidFormat) { value = (value.indexOf('_') < 0) ? value : ''; } if (_.isUndefined(rvValue)) { return; } if (this._getValueFromModelOfRivetsValue(rvValue) !== value) { this._setValueModelFromRivetsValue(rvValue, value); } }, handlerDatePicker: function () { var el = this.$el, self = this; el.find('.datepicker').datepicker({ autoclose: true, format: 'yyyy-mm-dd', todayHighlight: true, forceParse: false }); // Events to update the value of each model attribute el.find('.datepicker').on('changeDate', function (event) { var element = $(event.currentTarget); self._handlerUpdateModelFromDatepicker(element, false); }); el.find('.datepicker').on('hide', function (event) { var element = $(event.currentTarget); self._handlerUpdateModelFromDatepicker(element, true); }); this.objetModels = {}; el.find('.datepicker').each(function () { var rvValue = $(this).attr('rv-value'); if (_.isUndefined(rvValue)) { return; } var modelName = self._getAttributeByRivetsValue(rvValue, 'model'); var attribute = 'change:' + self._getAttributeByRivetsValue(rvValue, 'attribute'); if (!_.has(self.objetModels, modelName)) { self.objetModels[modelName] = [attribute]; } else { self.objetModels[modelName].push(attribute); } }); _.each(this.objetModels, function (values, stringModel) { var model = window.s.startsWith(stringModel, 'options') ? self.options[stringModel.substr(8, stringModel.length)] : self[stringModel], attributes = values.join(' '); self.listenTo(model, attributes, function (model) { if (self.watchChangeDatepicker) { _.each(_.keys(model.changed), function (field) { if (self.$el.find('[name=' + field + ']').hasClass('datepicker')) { if (model.changed[field] !== self.$el.find('[name=' + field + ']').datepicker('getDate')) { self.$el.find('[name=' + field + ']').datepicker('setDate', model.changed[field]); } } }); } else { self.watchChangeDatepicker = true; } }); }); this._handlerDatepickerFromModel(); _.extend(this.events, { 'keypress .datepicker': function () { this.watchChangeDatepicker = false; }, 'keydown .datepicker': function (event) { if (event.keyCode === 8) { this.watchChangeDatepicker = false; } else { this.watchChangeDatepicker = true; } } }); this.delegateEvents(this.events); }, /** Set a value by default on each datepicker by its model */ _handlerDatepickerFromModel: function () { var self = this; this.$el.find('.datepicker').each(function () { var element = $(this), rvValue = element.attr('rv-value'); if (rvValue) { var value = Uit.getDate(self._getValueFromModelOfRivetsValue(rvValue)); if (_.isEmpty(value)) { if (!_.isUndefined(element.data('default-today')) || !_.isUndefined(element.attr('default-today'))) { element.datepicker('setDate', moment().format('YYYY-MM-DD')); } else { element.datepicker('update', moment().format('YYYY-MM-DD')); element.datepicker('update', ''); } } else { element.datepicker('setDate', value); } } else { if (!_.isUndefined(element.data('default-today')) || !_.isUndefined(element.attr('default-today'))) { element.datepicker('setDate', moment().format('YYYY-MM-DD')); } } }); } }; _.extend(Uit.ViewComponents, Uit.ViewComponents.Datepicker, Uit.ViewComponents.Timepicker); // Helper View Uit.View = Backbone.View.extend({ initialize: function (options) { if (window.rivets) { _.extend(this, Uit.ViewComponents); } this.options = options || {}; if (!_.isUndefined(this.options.model)) { this.model = this.options.model; this.listenTo(this.options.model, 'error', this.handlerErrors); } var self = this; _.bindAll(this, 'render'); this.afterRender = this.afterRender || function () { }; this.render = _.wrap(this.render, function (render) { if (self.options.slowMotionRender) { render(true); } else { render(); } this.applyPermissions(); if (window.rivets) { this.rivets = window.rivets.bind(this.el, this); } this._afterRender(); self.afterRender(); return self; }); $(this.el).data('view', this); }, emptyElement: function (element) { var classList = $(element + ' > [class]'); _.each(classList, function (index) { var dataView = $('.' + index.className).data('view'); if (!_.isUndefined(dataView)) { Uit.cleanView(dataView); } }); }, _afterRender: function () { var el = this.$el; if (el.find('.datepicker').length > 0 && this.handlerDatePicker) { this.handlerDatePicker(); } if (el.find('.timepicker').length > 0 && this.handlerTimePicker) { el.find('.timepicker').timepicker({showInputs: false, disableFocus: true, disableMousewheel: true}); this.handlerTimePicker(); } if (el.find('.control-tooltip').length > 0 && this.handlerTooltip) { this.handlerTooltip(); } if (Uit.addMask) { var phoneMask = el.find('.phone-mask'); _.each(phoneMask, function (elem) { elem = $(elem); Uit.addMask('[name="' + elem.attr('name') + '"]', '(999) 999-9999'); }); var dateMask = el.find('.datepicker'); _.each(dateMask, function (elem) { elem = $(elem); Uit.addMask('[name="' + elem.attr('name') + '"]', '9999-99-99'); }); } }, handlerErrors: function (model, request) { var self = this; var response = request.responseJSON; if (!_.isUndefined(response)) { this.clearErrors(); _.each(response, function (message, key) { if (typeof message !== 'boolean' && key !== 'recatcha' && key !== 'error_code') { self.showError(key, message); } }); } }, render: function (slideDown) { var template = $(this.template()); if (Uit.getStateSelect) { var stateHelper = template.find('.state-helper'); _.each(stateHelper, function (elem) { elem = $(elem); elem.append(Uit.getStateSelect()); }); } if (slideDown) { this.$el.html(template).hide().slideDown(666); } else { this.$el.html(template); } return this; }, applyPermissions: function () { var template = this.$el; var dataPermissions = template.find('[data-permission]'); _.each(dataPermissions, function (elem) { elem = $(elem); var id = elem.attr('data-permission'); if (!App.loginModel.hasAccess(id)) { elem.remove(); } else if (!App.loginModel.canEdit(id)) { elem.find('input,select,textarea,button:not(.btn-close),a:not([role="tab"])').prop('disabled', true); elem.find('input,select,textarea').css('background-image', 'none'); elem.find('.btn:not(.btn-close),button:not(.btn-close),a:not([role="tab"])').css('opacity', 0.5).off(); elem.find('.icon-typeahead-down').remove(); } }); if (!_.isUndefined(template.data('permission'))) { if (!App.loginModel.hasAccess(template.data('permission'))) { template = $('<div>Not Authorized to view this file</div>'); this.$el.html(template); } } }, serialize: function (form) { var el = this.$el; var o = {}; var elem = _.isUndefined(form) ? el.find('input').serializeArray() : form.serializeArray(); $.each(elem, function () { var keyName = this.name; if (o[keyName]) { if (!o[keyName].push) { o[keyName] = [o[keyName]]; } o[keyName].push(this.value || ''); } else { o[keyName] = this.value || ''; } }); return o; }, showError: function (key, message) { var el = this.$el, input = el.find('[name=' + key + ']'), baseHTML; if (input.length > 0) { input.addClass('error'); baseHTML = '<label class="error" for="' + key + '">' + message + '</label>'; if (input.parents('.input-group').length) { input.parents('.input-group').after($(baseHTML)); } else { input.closest('div').append($(baseHTML)); } } else { baseHTML = '<div class="error">' + message + '</div>'; this.$el.find('form').append(baseHTML); } }, clearErrors: function () { var el = this.$el; el.find('label.error,div.error').remove(); el.find('input.error').removeClass('error'); if (el.find('.message-captcha').length > 0) { el.find('.message-captcha').empty(); } }, showLoader: function (selector) { var loaderHTML = '<div class="loader"><i class="fa fa-spinner fa-pulse fa-4x"></i></div>'; if (_.isUndefined(selector) || _.isEmpty(selector)) { if (!_.isUndefined(this.$el)) { this.$el.append(loaderHTML); } } else { if (!_.isUndefined(this.$el)) { this.$el.find(selector).append(loaderHTML); } } }, removeLoader: function (selector) { selector = _.isUndefined(selector) || _.isEmpty(selector) ? '.loader' : selector + ' .loader'; if (!_.isUndefined(this.$el)) { this.$el.find(selector).remove(); } }, onClose: function () { if ($('.modal.in[data-parent-classname="' + this.className + '"]').length) { $('.modal.in[data-parent-classname="' + this.className + '"]').each(function () { $(this).data('bs.modal').$element.modal('hide'); }); } } }); Uit.getDate = function (value, format) { format = format || 'YYYY-MM-DD'; var s = window.s; if (s.isBlank(value) || s.isBlank(value) === false && moment(value, 'YYYY-MM-DD').isValid() === false) { return ''; } else { return moment(value, 'YYYY-MM-DD').format('YYYY-MM-DD'); } }; //Helper Model Uit.Model = Backbone.Model.extend(); //Helper Collection Uit.Collection = Backbone.Collection.extend({ initialize: function () { }, sortBy: 'id', sortOrder: 'asc', comparator: function (a, b) { if (_.isEmpty(this.sortBy) || _.isEmpty(this.sortOrder)) { return; } var sortBy = this.sortBy.split(':'); var attr = sortBy[0]; var func = sortBy[1]; if (_.isUndefined(func)) { a = a.get(attr); b = b.get(attr); } else { a = a[func](); b = b[func](); } if (_.isNull(a)) { a = ''; } if (_.isNull(b)) { b = ''; } if (!_.isUndefined(a) && a !== '' && !_.isNumber(a)) { a = a.toString().toLowerCase(); } if (!_.isUndefined(b) && b !== '' && !_.isNumber(b)) { b = b.toString().toLowerCase(); } if (this.sortOrder === 'asc') { return a > b ? 1 : a < b ? -1 : 0; } else { return a > b ? -1 : a < b ? 1 : 0; } } }); //Helper Router Uit.Router = Backbone.Router.extend(); //Helper functions Uit.htmlView = function (view, element) { element = element || '#main'; var classList = $(element + ' > [class]'); _.each(classList, function (index) { var dataView = $('.' + index.className).data('view'); if (!_.isUndefined(dataView)) { Uit.cleanView(dataView); } }); $(element).html(view.el); view.render(); }; Uit.append = function (view, element) { element = element || '#main'; $(element).append(view.el); view.render(); }; Uit.checkViewExist = function (className) { var elem = $('.' + className); if (elem) { var dataView = elem.data('view'); if (!_.isUndefined(dataView)) { return true; } } return false; }; //remove all child node and events from element //optional el to reduce scope of the DOM. Uit.cleanElement = function (stringElem, el) { var elem = $(stringElem); if (!_.isUndefined(el)) { elem = el.find(stringElem); } elem.empty(); elem.unbind(); }; Uit.cleanView = function (view) { if (!_.isUndefined(view)) { view.onClose = view.onClose || function () { }; view.onClose(); if (view.rivets) { view.rivets.unbind(); } view.unbind(); // Unbind all local event bindings if (view.model) { view.model.unbind('change', view.render, view); // Unbind reference to the model } if (view.collection) { view.collection.unbind('change', view.render, view); // Unbind reference to the model } view.remove(); // Remove view from DOM delete view.$el; // Delete the jQuery wrapped object variable delete view.el; // Delete the variable reference to view node } }; Uit.Modal = function (options) { var self = this; options = options || {}; options.sizeModal = options.sizeModal || ''; //modal-lg options.view = options.view || ''; options.resize = options.resize || false, options.parentClassName = options.parentClassName || ''; this.init = function () { var $element = $('<div class="modal" tabindex="-1" role="dialog"><div class="modal-dialog"><div class="modal-content"></div></div></div>'); if (options.sizeModal) { $element.find('.modal-dialog').addClass(options.sizeModal); } $element.on('hidden.bs.modal', function () { $element.undelegate(); if (!_.isUndefined($element.data('view'))) { var view = $element.data('view'); view.onClose = view.onClose || function () { }; view.onClose(); view.remove(); view.unbind(); } $element.remove(); if ($('.modal.in').length > 0) { $('body').addClass('modal-open'); } }); if (options.parentClassName && $('.' + options.parentClassName).length) { $element.attr('data-parent-classname', options.parentClassName); } if (options.parentClassName && $('.' + options.parentClassName).length) { $element.attr('data-parent-classname', options.parentClassName); } $element.on('shown.bs.modal', function () { if (options.view instanceof Uit.View) { options.view.render(); } if (options.resize) { $element.resizable({ minHeight: $element.height(), minWidth: $element.width() }); } }); if (options.view instanceof Uit.View) { $element.data('view', options.view); options.view.elementModal = $element; $element.find('.modal-content').html(options.view.el); $element.modal('show'); } else { $element.find('.modal-content').html(options.view); $element.modal('show'); } }; return { show: function () { self.init(); } }; }; Uit.CurrencyFormat = function (amount, returnEmptyNull) { if (amount) { amount = parseFloat(amount); return amount.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); } else if (returnEmptyNull && (_.isNull(amount) || amount === '')) { return ''; } else { return '0.00'; } }; // Jquery Mask Helper Uit.addMask = function (element, format) { $(element).mask(format); }; Uit.SessionFlash = { rows: [], set: function (key, value) { var row = _.findWhere(this.rows, {'key': key}); if (row) { row.value = value; } else { row = { 'key': key, 'value': value }; this.rows.push(row); } }, get: function (key) { var row = _.findWhere(this.rows, {'key': key}); if (row) { this.rows = _.without(this.rows, row); return row.value; } else { return undefined; } } };
23,536
6,660
/** * Copyright 2015 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* jshint maxlen: false */ 'use strict'; var createAPIRequest = require('../../lib/apirequest'); var utils = require('../../lib/utils'); /** * Prediction API * * Lets you access a cloud hosted machine learning service that makes it easy to build smart apps * * @example * var google = require('googleapis'); * var prediction = google.prediction('v1.4'); * * @namespace prediction * @type {Function} * @version v1.4 * @variation v1.4 * @param {object=} options Options for Prediction */ function Prediction(options) { // eslint-disable-line var self = this; self._options = options || {}; self.hostedmodels = { /** * prediction.hostedmodels.predict * * @desc Submit input and request an output against a hosted model. * * @alias prediction.hostedmodels.predict * @memberOf! prediction(v1.4) * * @param {object} params Parameters for request * @param {string} params.hostedModelName The name of a hosted model. * @param {prediction(v1.4).Input} params.resource Request body data * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`. * @param {callback} callback The callback that handles the response. * @return {object} Request object */ predict: function (params, options, callback) { if (typeof options === 'function') { callback = options; options = {}; } options || (options = {}); var parameters = { options: utils.extend({ url: 'https://www.googleapis.com/prediction/v1.4/hostedmodels/{hostedModelName}/predict', method: 'POST' }, options), params: params, requiredParams: ['hostedModelName'], pathParams: ['hostedModelName'], context: self }; return createAPIRequest(parameters, callback); } }; self.trainedmodels = { /** * prediction.trainedmodels.delete * * @desc Delete a trained model. * * @alias prediction.trainedmodels.delete * @memberOf! prediction(v1.4) * * @param {object} params Parameters for request * @param {string} params.id The unique name for the predictive model. * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`. * @param {callback} callback The callback that handles the response. * @return {object} Request object */ delete: function (params, options, callback) { if (typeof options === 'function') { callback = options; options = {}; } options || (options = {}); var parameters = { options: utils.extend({ url: 'https://www.googleapis.com/prediction/v1.4/trainedmodels/{id}', method: 'DELETE' }, options), params: params, requiredParams: ['id'], pathParams: ['id'], context: self }; return createAPIRequest(parameters, callback); }, /** * prediction.trainedmodels.get * * @desc Check training status of your model. * * @alias prediction.trainedmodels.get * @memberOf! prediction(v1.4) * * @param {object} params Parameters for request * @param {string} params.id The unique name for the predictive model. * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`. * @param {callback} callback The callback that handles the response. * @return {object} Request object */ get: function (params, options, callback) { if (typeof options === 'function') { callback = options; options = {}; } options || (options = {}); var parameters = { options: utils.extend({ url: 'https://www.googleapis.com/prediction/v1.4/trainedmodels/{id}', method: 'GET' }, options), params: params, requiredParams: ['id'], pathParams: ['id'], context: self }; return createAPIRequest(parameters, callback); }, /** * prediction.trainedmodels.insert * * @desc Begin training your model. * * @alias prediction.trainedmodels.insert * @memberOf! prediction(v1.4) * * @param {object} params Parameters for request * @param {prediction(v1.4).Training} params.resource Request body data * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`. * @param {callback} callback The callback that handles the response. * @return {object} Request object */ insert: function (params, options, callback) { if (typeof options === 'function') { callback = options; options = {}; } options || (options = {}); var parameters = { options: utils.extend({ url: 'https://www.googleapis.com/prediction/v1.4/trainedmodels', method: 'POST' }, options), params: params, requiredParams: [], pathParams: [], context: self }; return createAPIRequest(parameters, callback); }, /** * prediction.trainedmodels.predict * * @desc Submit model id and request a prediction * * @alias prediction.trainedmodels.predict * @memberOf! prediction(v1.4) * * @param {object} params Parameters for request * @param {string} params.id The unique name for the predictive model. * @param {prediction(v1.4).Input} params.resource Request body data * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`. * @param {callback} callback The callback that handles the response. * @return {object} Request object */ predict: function (params, options, callback) { if (typeof options === 'function') { callback = options; options = {}; } options || (options = {}); var parameters = { options: utils.extend({ url: 'https://www.googleapis.com/prediction/v1.4/trainedmodels/{id}/predict', method: 'POST' }, options), params: params, requiredParams: ['id'], pathParams: ['id'], context: self }; return createAPIRequest(parameters, callback); }, /** * prediction.trainedmodels.update * * @desc Add new data to a trained model. * * @alias prediction.trainedmodels.update * @memberOf! prediction(v1.4) * * @param {object} params Parameters for request * @param {string} params.id The unique name for the predictive model. * @param {prediction(v1.4).Update} params.resource Request body data * @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`. * @param {callback} callback The callback that handles the response. * @return {object} Request object */ update: function (params, options, callback) { if (typeof options === 'function') { callback = options; options = {}; } options || (options = {}); var parameters = { options: utils.extend({ url: 'https://www.googleapis.com/prediction/v1.4/trainedmodels/{id}', method: 'PUT' }, options), params: params, requiredParams: ['id'], pathParams: ['id'], context: self }; return createAPIRequest(parameters, callback); } }; } /** * @typedef Input * @memberOf! prediction(v1.4) * @type object * @property {object} input Input to the model for a prediction */ /** * @typedef Output * @memberOf! prediction(v1.4) * @type object * @property {string} id The unique name for the predictive model. * @property {string} kind What kind of resource this is. * @property {string} outputLabel The most likely class label [Categorical models only]. * @property {object[]} outputMulti A list of class labels with their estimated probabilities [Categorical models only]. * @property {number} outputValue The estimated regression value [Regression models only]. * @property {string} selfLink A URL to re-request this resource. */ /** * @typedef Training * @memberOf! prediction(v1.4) * @type object * @property {object} dataAnalysis Data Analysis. * @property {string} id The unique name for the predictive model. * @property {string} kind What kind of resource this is. * @property {object} modelInfo Model metadata. * @property {string} selfLink A URL to re-request this resource. * @property {string} storageDataLocation Google storage location of the training data file. * @property {string} storagePMMLLocation Google storage location of the preprocessing pmml file. * @property {string} storagePMMLModelLocation Google storage location of the pmml model file. * @property {string} trainingStatus The current status of the training job. This can be one of following: RUNNING; DONE; ERROR; ERROR: TRAINING JOB NOT FOUND * @property {object[]} utility A class weighting function, which allows the importance weights for class labels to be specified [Categorical models only]. */ /** * @typedef Update * @memberOf! prediction(v1.4) * @type object * @property {any[]} csvInstance The input features for this instance * @property {string} label The class label of this instance * @property {string} output The generic output value - could be regression value or class label */ module.exports = Prediction;
10,177
2,789
import Accordion from './accordion'; class Steps { static selector() { return '[data-steps-container]'; } constructor(stepsContainer) { this.stepsContainer = stepsContainer; this.steps = []; stepsContainer .querySelectorAll('[data-step-accordion]') .forEach((accordion) => { this.steps.push(new Accordion(accordion)); }); this.toggleSteps = stepsContainer.querySelector('[data-steps-toggle]'); this.state = { open: false, }; this.bindEvents(); } bindEvents() { this.toggleSteps.addEventListener('click', (e) => { e.preventDefault(); if (this.state.open) { this.steps.forEach((accordion) => accordion.close()); this.state.open = false; } else { this.steps.forEach((accordion) => accordion.open()); this.state.open = true; } this.toggleSteps.classList.toggle('is-open'); }); } } export default Steps;
1,099
304
import forms from './forms'; import layouts from './layouts'; export default {forms,layouts,}
93
26
import React from "react"; import { connect } from "react-redux"; import { Route, Redirect } from "react-router-dom"; import Header from "../components/Header"; import Footer from "../components/Footer"; import ScrollAnimation from "react-animate-on-scroll"; export const PrivateRoute = ({ isAuthenticated, component: Component, ...rest }) => ( <Route {...rest} component={props => isAuthenticated ? ( <div className="whole-page scrollbar"> <div className="content"> <div className="header__sticky"> <Header /> </div> <div> <Component {...props} /> </div> </div> <ScrollAnimation animateIn="fadeInUp" animateOnce={true} offset={0}> <div className="footer"> <Footer /> </div>{" "} </ScrollAnimation> </div> ) : ( <Redirect to="/" /> ) } /> ); const mapStateToProps = state => ({ isAuthenticated: !!state.auth.uid }); export default connect(mapStateToProps)(PrivateRoute);
1,094
309
import SectionSlideshow from '../../components/SectionSlideshow' export default () => <SectionSlideshow sectionName={'syntax'} />
131
35
module.exports = { mongoUrl: process.env.MONGO_URL || 'mongodb://localhost:27017/clean-node-api', tokenSecret: process.env.TOKEN_SECRET || 'token_secret', port: process.env.PORT || 5858 }
194
77
(function() {var implementors = {}; implementors["getrandom"] = [{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/core/num/struct.NonZeroU32.html\" title=\"struct core::num::NonZeroU32\">NonZeroU32</a>&gt; for <a class=\"struct\" href=\"getrandom/struct.Error.html\" title=\"struct getrandom::Error\">Error</a>",synthetic:false,types:["getrandom::error::Error"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html\" title=\"struct std::io::error::Error\">Error</a>&gt; for <a class=\"struct\" href=\"getrandom/struct.Error.html\" title=\"struct getrandom::Error\">Error</a>",synthetic:false,types:["getrandom::error::Error"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"struct\" href=\"getrandom/struct.Error.html\" title=\"struct getrandom::Error\">Error</a>&gt; for <a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html\" title=\"struct std::io::error::Error\">Error</a>",synthetic:false,types:["std::io::error::Error"]},]; implementors["rand"] = [{text:"impl&lt;X:&nbsp;<a class=\"trait\" href=\"rand/distributions/uniform/trait.SampleUniform.html\" title=\"trait rand::distributions::uniform::SampleUniform\">SampleUniform</a>&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/core/ops/range/struct.Range.html\" title=\"struct core::ops::range::Range\">Range</a>&lt;X&gt;&gt; for <a class=\"struct\" href=\"rand/distributions/uniform/struct.Uniform.html\" title=\"struct rand::distributions::uniform::Uniform\">Uniform</a>&lt;X&gt;",synthetic:false,types:["rand::distributions::uniform::Uniform"]},{text:"impl&lt;X:&nbsp;<a class=\"trait\" href=\"rand/distributions/uniform/trait.SampleUniform.html\" title=\"trait rand::distributions::uniform::SampleUniform\">SampleUniform</a>&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeInclusive.html\" title=\"struct core::ops::range::RangeInclusive\">RangeInclusive</a>&lt;X&gt;&gt; for <a class=\"struct\" href=\"rand/distributions/uniform/struct.Uniform.html\" title=\"struct rand::distributions::uniform::Uniform\">Uniform</a>&lt;X&gt;",synthetic:false,types:["rand::distributions::uniform::Uniform"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html\" title=\"struct alloc::vec::Vec\">Vec</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u32.html\">u32</a>&gt;&gt; for <a class=\"enum\" href=\"rand/seq/index/enum.IndexVec.html\" title=\"enum rand::seq::index::IndexVec\">IndexVec</a>",synthetic:false,types:["rand::seq::index::IndexVec"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html\" title=\"struct alloc::vec::Vec\">Vec</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.usize.html\">usize</a>&gt;&gt; for <a class=\"enum\" href=\"rand/seq/index/enum.IndexVec.html\" title=\"enum rand::seq::index::IndexVec\">IndexVec</a>",synthetic:false,types:["rand::seq::index::IndexVec"]},]; implementors["rand_chacha"] = [{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"struct\" href=\"rand_chacha/struct.ChaCha20Core.html\" title=\"struct rand_chacha::ChaCha20Core\">ChaCha20Core</a>&gt; for <a class=\"struct\" href=\"rand_chacha/struct.ChaCha20Rng.html\" title=\"struct rand_chacha::ChaCha20Rng\">ChaCha20Rng</a>",synthetic:false,types:["rand_chacha::chacha::ChaCha20Rng"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"struct\" href=\"rand_chacha/struct.ChaCha12Core.html\" title=\"struct rand_chacha::ChaCha12Core\">ChaCha12Core</a>&gt; for <a class=\"struct\" href=\"rand_chacha/struct.ChaCha12Rng.html\" title=\"struct rand_chacha::ChaCha12Rng\">ChaCha12Rng</a>",synthetic:false,types:["rand_chacha::chacha::ChaCha12Rng"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"struct\" href=\"rand_chacha/struct.ChaCha8Core.html\" title=\"struct rand_chacha::ChaCha8Core\">ChaCha8Core</a>&gt; for <a class=\"struct\" href=\"rand_chacha/struct.ChaCha8Rng.html\" title=\"struct rand_chacha::ChaCha8Rng\">ChaCha8Rng</a>",synthetic:false,types:["rand_chacha::chacha::ChaCha8Rng"]},]; implementors["rand_core"] = [{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/core/num/struct.NonZeroU32.html\" title=\"struct core::num::NonZeroU32\">NonZeroU32</a>&gt; for <a class=\"struct\" href=\"rand_core/struct.Error.html\" title=\"struct rand_core::Error\">Error</a>",synthetic:false,types:["rand_core::error::Error"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"struct\" href=\"getrandom/error/struct.Error.html\" title=\"struct getrandom::error::Error\">Error</a>&gt; for <a class=\"struct\" href=\"rand_core/struct.Error.html\" title=\"struct rand_core::Error\">Error</a>",synthetic:false,types:["rand_core::error::Error"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"struct\" href=\"rand_core/struct.Error.html\" title=\"struct rand_core::Error\">Error</a>&gt; for <a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html\" title=\"struct std::io::error::Error\">Error</a>",synthetic:false,types:["std::io::error::Error"]},]; implementors["serde_json"] = [{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"struct\" href=\"serde_json/error/struct.Error.html\" title=\"struct serde_json::error::Error\">Error</a>&gt; for <a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html\" title=\"struct std::io::error::Error\">Error</a>",synthetic:false,types:["std::io::error::Error"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.i8.html\">i8</a>&gt; for <a class=\"enum\" href=\"serde_json/value/enum.Value.html\" title=\"enum serde_json::value::Value\">Value</a>",synthetic:false,types:["serde_json::value::Value"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.i16.html\">i16</a>&gt; for <a class=\"enum\" href=\"serde_json/value/enum.Value.html\" title=\"enum serde_json::value::Value\">Value</a>",synthetic:false,types:["serde_json::value::Value"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.i32.html\">i32</a>&gt; for <a class=\"enum\" href=\"serde_json/value/enum.Value.html\" title=\"enum serde_json::value::Value\">Value</a>",synthetic:false,types:["serde_json::value::Value"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.i64.html\">i64</a>&gt; for <a class=\"enum\" href=\"serde_json/value/enum.Value.html\" title=\"enum serde_json::value::Value\">Value</a>",synthetic:false,types:["serde_json::value::Value"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.isize.html\">isize</a>&gt; for <a class=\"enum\" href=\"serde_json/value/enum.Value.html\" title=\"enum serde_json::value::Value\">Value</a>",synthetic:false,types:["serde_json::value::Value"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u8.html\">u8</a>&gt; for <a class=\"enum\" href=\"serde_json/value/enum.Value.html\" title=\"enum serde_json::value::Value\">Value</a>",synthetic:false,types:["serde_json::value::Value"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u16.html\">u16</a>&gt; for <a class=\"enum\" href=\"serde_json/value/enum.Value.html\" title=\"enum serde_json::value::Value\">Value</a>",synthetic:false,types:["serde_json::value::Value"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u32.html\">u32</a>&gt; for <a class=\"enum\" href=\"serde_json/value/enum.Value.html\" title=\"enum serde_json::value::Value\">Value</a>",synthetic:false,types:["serde_json::value::Value"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u64.html\">u64</a>&gt; for <a class=\"enum\" href=\"serde_json/value/enum.Value.html\" title=\"enum serde_json::value::Value\">Value</a>",synthetic:false,types:["serde_json::value::Value"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.usize.html\">usize</a>&gt; for <a class=\"enum\" href=\"serde_json/value/enum.Value.html\" title=\"enum serde_json::value::Value\">Value</a>",synthetic:false,types:["serde_json::value::Value"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.f32.html\">f32</a>&gt; for <a class=\"enum\" href=\"serde_json/value/enum.Value.html\" title=\"enum serde_json::value::Value\">Value</a>",synthetic:false,types:["serde_json::value::Value"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.f64.html\">f64</a>&gt; for <a class=\"enum\" href=\"serde_json/value/enum.Value.html\" title=\"enum serde_json::value::Value\">Value</a>",synthetic:false,types:["serde_json::value::Value"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.bool.html\">bool</a>&gt; for <a class=\"enum\" href=\"serde_json/value/enum.Value.html\" title=\"enum serde_json::value::Value\">Value</a>",synthetic:false,types:["serde_json::value::Value"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/alloc/string/struct.String.html\" title=\"struct alloc::string::String\">String</a>&gt; for <a class=\"enum\" href=\"serde_json/value/enum.Value.html\" title=\"enum serde_json::value::Value\">Value</a>",synthetic:false,types:["serde_json::value::Value"]},{text:"impl&lt;'a&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;&amp;'a <a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.str.html\">str</a>&gt; for <a class=\"enum\" href=\"serde_json/value/enum.Value.html\" title=\"enum serde_json::value::Value\">Value</a>",synthetic:false,types:["serde_json::value::Value"]},{text:"impl&lt;'a&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"enum\" href=\"https://doc.rust-lang.org/nightly/alloc/borrow/enum.Cow.html\" title=\"enum alloc::borrow::Cow\">Cow</a>&lt;'a, <a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.str.html\">str</a>&gt;&gt; for <a class=\"enum\" href=\"serde_json/value/enum.Value.html\" title=\"enum serde_json::value::Value\">Value</a>",synthetic:false,types:["serde_json::value::Value"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"struct\" href=\"serde_json/map/struct.Map.html\" title=\"struct serde_json::map::Map\">Map</a>&lt;<a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/alloc/string/struct.String.html\" title=\"struct alloc::string::String\">String</a>, <a class=\"enum\" href=\"serde_json/value/enum.Value.html\" title=\"enum serde_json::value::Value\">Value</a>&gt;&gt; for <a class=\"enum\" href=\"serde_json/value/enum.Value.html\" title=\"enum serde_json::value::Value\">Value</a>",synthetic:false,types:["serde_json::value::Value"]},{text:"impl&lt;T:&nbsp;<a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.Into.html\" title=\"trait core::convert::Into\">Into</a>&lt;<a class=\"enum\" href=\"serde_json/value/enum.Value.html\" title=\"enum serde_json::value::Value\">Value</a>&gt;&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html\" title=\"struct alloc::vec::Vec\">Vec</a>&lt;T&gt;&gt; for <a class=\"enum\" href=\"serde_json/value/enum.Value.html\" title=\"enum serde_json::value::Value\">Value</a>",synthetic:false,types:["serde_json::value::Value"]},{text:"impl&lt;'a, T:&nbsp;<a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html\" title=\"trait core::clone::Clone\">Clone</a> + <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.Into.html\" title=\"trait core::convert::Into\">Into</a>&lt;<a class=\"enum\" href=\"serde_json/value/enum.Value.html\" title=\"enum serde_json::value::Value\">Value</a>&gt;&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.slice.html\">&amp;'a [T]</a>&gt; for <a class=\"enum\" href=\"serde_json/value/enum.Value.html\" title=\"enum serde_json::value::Value\">Value</a>",synthetic:false,types:["serde_json::value::Value"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.unit.html\">()</a>&gt; for <a class=\"enum\" href=\"serde_json/value/enum.Value.html\" title=\"enum serde_json::value::Value\">Value</a>",synthetic:false,types:["serde_json::value::Value"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u8.html\">u8</a>&gt; for <a class=\"struct\" href=\"serde_json/struct.Number.html\" title=\"struct serde_json::Number\">Number</a>",synthetic:false,types:["serde_json::number::Number"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u16.html\">u16</a>&gt; for <a class=\"struct\" href=\"serde_json/struct.Number.html\" title=\"struct serde_json::Number\">Number</a>",synthetic:false,types:["serde_json::number::Number"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u32.html\">u32</a>&gt; for <a class=\"struct\" href=\"serde_json/struct.Number.html\" title=\"struct serde_json::Number\">Number</a>",synthetic:false,types:["serde_json::number::Number"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u64.html\">u64</a>&gt; for <a class=\"struct\" href=\"serde_json/struct.Number.html\" title=\"struct serde_json::Number\">Number</a>",synthetic:false,types:["serde_json::number::Number"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.usize.html\">usize</a>&gt; for <a class=\"struct\" href=\"serde_json/struct.Number.html\" title=\"struct serde_json::Number\">Number</a>",synthetic:false,types:["serde_json::number::Number"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.i8.html\">i8</a>&gt; for <a class=\"struct\" href=\"serde_json/struct.Number.html\" title=\"struct serde_json::Number\">Number</a>",synthetic:false,types:["serde_json::number::Number"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.i16.html\">i16</a>&gt; for <a class=\"struct\" href=\"serde_json/struct.Number.html\" title=\"struct serde_json::Number\">Number</a>",synthetic:false,types:["serde_json::number::Number"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.i32.html\">i32</a>&gt; for <a class=\"struct\" href=\"serde_json/struct.Number.html\" title=\"struct serde_json::Number\">Number</a>",synthetic:false,types:["serde_json::number::Number"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.i64.html\">i64</a>&gt; for <a class=\"struct\" href=\"serde_json/struct.Number.html\" title=\"struct serde_json::Number\">Number</a>",synthetic:false,types:["serde_json::number::Number"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.isize.html\">isize</a>&gt; for <a class=\"struct\" href=\"serde_json/struct.Number.html\" title=\"struct serde_json::Number\">Number</a>",synthetic:false,types:["serde_json::number::Number"]},]; implementors["uuid"] = [{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"struct\" href=\"uuid/struct.Uuid.html\" title=\"struct uuid::Uuid\">Uuid</a>&gt; for <a class=\"struct\" href=\"uuid/adapter/struct.Hyphenated.html\" title=\"struct uuid::adapter::Hyphenated\">Hyphenated</a>",synthetic:false,types:["uuid::adapter::Hyphenated"]},{text:"impl&lt;'a&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;&amp;'a <a class=\"struct\" href=\"uuid/struct.Uuid.html\" title=\"struct uuid::Uuid\">Uuid</a>&gt; for <a class=\"struct\" href=\"uuid/adapter/struct.HyphenatedRef.html\" title=\"struct uuid::adapter::HyphenatedRef\">HyphenatedRef</a>&lt;'a&gt;",synthetic:false,types:["uuid::adapter::HyphenatedRef"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"struct\" href=\"uuid/struct.Uuid.html\" title=\"struct uuid::Uuid\">Uuid</a>&gt; for <a class=\"struct\" href=\"uuid/adapter/struct.Simple.html\" title=\"struct uuid::adapter::Simple\">Simple</a>",synthetic:false,types:["uuid::adapter::Simple"]},{text:"impl&lt;'a&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;&amp;'a <a class=\"struct\" href=\"uuid/struct.Uuid.html\" title=\"struct uuid::Uuid\">Uuid</a>&gt; for <a class=\"struct\" href=\"uuid/adapter/struct.SimpleRef.html\" title=\"struct uuid::adapter::SimpleRef\">SimpleRef</a>&lt;'a&gt;",synthetic:false,types:["uuid::adapter::SimpleRef"]},{text:"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;<a class=\"struct\" href=\"uuid/struct.Uuid.html\" title=\"struct uuid::Uuid\">Uuid</a>&gt; for <a class=\"struct\" href=\"uuid/adapter/struct.Urn.html\" title=\"struct uuid::adapter::Urn\">Urn</a>",synthetic:false,types:["uuid::adapter::Urn"]},{text:"impl&lt;'a&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a>&lt;&amp;'a <a class=\"struct\" href=\"uuid/struct.Uuid.html\" title=\"struct uuid::Uuid\">Uuid</a>&gt; for <a class=\"struct\" href=\"uuid/adapter/struct.UrnRef.html\" title=\"struct uuid::adapter::UrnRef\">UrnRef</a>&lt;'a&gt;",synthetic:false,types:["uuid::adapter::UrnRef"]},]; if (window.register_implementors) { window.register_implementors(implementors); } else { window.pending_implementors = implementors; } })()
23,939
8,562
/** * * App.js * * This component is the skeleton around the actual pages, and should only * contain code that should be seen on all pages. (e.g. navigation bar) * * NOTE: while this component should technically be a stateless functional * component (SFC), hot reloading does not currently support SFCs. If hot * reloading is not a necessity for you then you can refactor it and remove * the linting exception. */ import React from 'react'; import { Switch, Route } from 'react-router-dom'; import HomePage from 'containers/HomePage/Loadable'; import NotFoundPage from 'containers/NotFoundPage/Loadable'; import { ApolloClient } from 'apollo-client'; import { HttpLink } from 'apollo-link-http'; import { InMemoryCache } from 'apollo-cache-inmemory'; import {ApolloProvider} from 'react-apollo'; import Services from '../Services'; import ServiceNew from '../ServiceNew'; const client = new ApolloClient({ link: new HttpLink({uri:'https://api.graph.cool/simple/v1/cjheviv534c3b0158hvmz4sde'}), cache: new InMemoryCache(), }); export default function App() { return ( <ApolloProvider client={client}> <div> <Switch> <Route exact path="/" component={HomePage} /> <Route exact path="/services/new" component={ServiceNew} /> <Route exact path="/services" component={Services} /> <Route component={NotFoundPage} /> </Switch> </div> </ApolloProvider> ); }
1,458
443