text
stringlengths
2
1.05M
// @flow import React, { useEffect, useState, useContext } from "react" import { createPoint, createShape } from "../../utils/helper" import Vertex from "../Vertex" import BEM from "../../utils/BEM" import "./Shape.scss" import { ShapeView } from "./ShapeView" import { TransformContext } from "../CanvasTransform" const b = BEM("Shape") const ShapeCreate = props => { const { onChange, offset } = props const transformation = useContext(TransformContext) const [shape, setShape] = useState(null) const [ghostPoint, setGhostPoint] = useState(createPoint({ x: 0, y: 0 })) useEffect(() => { const documentClickHandler = () => setShape( shape === null ? createShape(transformation.invert(ghostPoint)) : { ...shape, points: [...shape.points, transformation.invert(ghostPoint)] } ) document.addEventListener("click", documentClickHandler) return () => document.removeEventListener("click", documentClickHandler) }, [ghostPoint]) useEffect(() => { const keyHandler = ev => { const { key } = ev switch (key) { case "Escape": case "Enter": { ev.preventDefault() onChange({ ...shape }) break } default: return } } document.addEventListener("keydown", keyHandler) return () => { document.removeEventListener("keydown", keyHandler) } }, [shape]) return ( <g className={b(["edit"])}> {shape !== null ? ( <ShapeView path={{ ...shape, points: [...shape.points, transformation.invert(ghostPoint)] }} className={b(["create"])} /> ) : null} <Vertex draggable={true} point={ghostPoint} onChange={point => { setGhostPoint({ x: point.x - offset.x, y: point.y - offset.y }) }} /> </g> ) } export default ShapeCreate
var test = require('.././'); require('domready')(function () { console.log('dom ready, starting test.'); var body = document.getElementsByTagName("body")[0]; var container = document.createElement('div'); container.setAttribute("id", "container"); body.appendChild(container); test.init(function() { console.log('Library loaded'); var player = test.createPlayer("container", { width: '720', height: '405', videoId: 'M7lc1UVf-VE', playerVars: { 'autoplay': 0, 'controls': 1 }, events: { 'onReady': playerReady, 'onStateChange': onPlayerStateChange } }); }); function playerReady() { test.play(); } function onPlayerStateChange(event) { console.log('Player State Changed: ', event); } });
import url from 'url' import http from 'http' import path from 'path' import https from 'https' import merge from 'lodash.merge' import request from 'request' import EventEmitter from 'events' import logger from '@wdio/logger' import { isSuccessfulResponse, getErrorFromResponseBody } from './utils' import pkg from '../package.json' const log = logger('webdriver') const agents = { http: new http.Agent({ keepAlive: true }), https: new https.Agent({ keepAlive: true }) } export default class WebDriverRequest extends EventEmitter { constructor (method, endpoint, body) { super() this.body = body this.method = method this.endpoint = endpoint this.requiresSessionId = this.endpoint.match(/:sessionId/) this.defaultOptions = { method, followAllRedirects: true, json: true, headers: { 'Connection': 'keep-alive', 'Accept': 'application/json', 'User-Agent': 'webdriver/' + pkg.version } } } makeRequest (options, sessionId) { const fullRequestOptions = merge(this.defaultOptions, this._createOptions(options, sessionId)) this.emit('request', fullRequestOptions) return this._request(fullRequestOptions, options.connectionRetryCount) } _createOptions (options, sessionId) { const requestOptions = { agent: agents[options.protocol], headers: typeof options.headers === 'object' ? options.headers : {}, qs: typeof options.queryParams === 'object' ? options.queryParams : {} } /** * only apply body property if existing */ if (this.body && (Object.keys(this.body).length || this.method === 'POST')) { requestOptions.body = this.body } /** * if we don't have a session id we set it here, unless we call commands that don't require session ids, for * example /sessions. The call to /sessions is not connected to a session itself and it therefore doesn't * require it */ if (this.requiresSessionId && !sessionId) { throw new Error('A sessionId is required for this command') } requestOptions.uri = url.parse( `${options.protocol}://` + `${options.hostname}:${options.port}` + path.join(options.path, this.endpoint.replace(':sessionId', sessionId)) ) /** * send authentication credentials only when creating new session */ if (this.endpoint === '/session' && options.user && options.key) { requestOptions.auth = { user: options.user, pass: options.key } } return requestOptions } _request (fullRequestOptions, totalRetryCount = 0, retryCount = 0) { log.info(`[${fullRequestOptions.method}] ${fullRequestOptions.uri.href}`) if (fullRequestOptions.body && Object.keys(fullRequestOptions.body).length) { log.info('DATA', fullRequestOptions.body) } return new Promise((resolve, reject) => request(fullRequestOptions, (err, response, body) => { const error = err || getErrorFromResponseBody(body) /** * Resolve only if successful response */ if (!err && isSuccessfulResponse(response.statusCode, body)) { this.emit('response', { result: body }) return resolve(body) } /** * stop retrying as this will never be successful. * we will handle this at the elementErrorHandler */ if(error.stack.includes('stale element reference')) { log.warn('Request encountered a stale element - terminating request') this.emit('response', { error }) return reject(error) } /** * stop retrying if totalRetryCount was exceeded or there is no reason to * retry, e.g. if sessionId is invalid */ if (retryCount >= totalRetryCount || error.message.includes('invalid session id')) { log.error('Request failed due to', error) this.emit('response', { error }) return reject(error) } ++retryCount this.emit('retry', { error, retryCount }) log.warn('Request failed due to', error.message) log.info(`Retrying ${retryCount}/${totalRetryCount}`) this._request(fullRequestOptions, totalRetryCount, retryCount).then(resolve, reject) })) } }
// @link http://acme-schemas.triniti.io/json-schema/acme/curator/command/update-widget/1-0-0.json# import Fb from '@gdbots/pbj/FieldBuilder'; import Format from '@gdbots/pbj/enums/Format'; import GdbotsPbjxCommandV1Mixin from '@gdbots/schemas/gdbots/pbjx/mixin/command/CommandV1Mixin'; import Message from '@gdbots/pbj/Message'; import Schema from '@gdbots/pbj/Schema'; import T from '@gdbots/pbj/types'; export default class UpdateWidgetV1 extends Message { /** * @private * * @returns {Schema} */ static defineSchema() { return new Schema(this.SCHEMA_ID, this, [ Fb.create('command_id', T.TimeUuidType.create()) .required() .build(), Fb.create('occurred_at', T.MicrotimeType.create()) .build(), /* * Used to perform optimistic concurrency control. * @link https://en.wikipedia.org/wiki/HTTP_ETag */ Fb.create('expected_etag', T.StringType.create()) .maxLength(100) .pattern('^[\\w\\.:-]+$') .build(), /* * Multi-tenant apps can use this field to track the tenant id. */ Fb.create('ctx_tenant_id', T.StringType.create()) .pattern('^[\\w\\/\\.:-]+$') .build(), /* * The "ctx_retries" field is used to keep track of how many attempts were * made to process this command. In some cases, the service or transport * that handles the command may be down or an optimistic check has failed * and is being retried. */ Fb.create('ctx_retries', T.TinyIntType.create()) .build(), /* * The "ctx_causator" is the actual causator object that "ctx_causator_ref" * refers to. In some cases it's useful for command handlers to copy the * causator into the command. For example, when a node is being updated we * may want to know what the node will be after the update. We can derive * this via the causator instead of requesting the node and engaging a race * condition. */ Fb.create('ctx_causator', T.MessageType.create()) .build(), Fb.create('ctx_causator_ref', T.MessageRefType.create()) .build(), Fb.create('ctx_correlator_ref', T.MessageRefType.create()) .build(), Fb.create('ctx_user_ref', T.MessageRefType.create()) .build(), /* * The "ctx_app" refers to the application used to send the command. This is * different from ctx_ua (user_agent) because the agent used (Safari, Firefox) * is not necessarily the app used (cms, iOS app, website) */ Fb.create('ctx_app', T.MessageType.create()) .anyOfCuries([ 'gdbots:contexts::app', ]) .build(), /* * The "ctx_cloud" is set by the server receiving the command and is generally * only used internally for tracking and performance monitoring. */ Fb.create('ctx_cloud', T.MessageType.create()) .anyOfCuries([ 'gdbots:contexts::cloud', ]) .build(), Fb.create('ctx_ip', T.StringType.create()) .format(Format.IPV4) .overridable(true) .build(), Fb.create('ctx_ipv6', T.StringType.create()) .format(Format.IPV6) .overridable(true) .build(), Fb.create('ctx_ua', T.TextType.create()) .overridable(true) .build(), /* * An optional message/reason for the command being sent. * Consider this like a git commit message. */ Fb.create('ctx_msg', T.TextType.create()) .build(), Fb.create('node_ref', T.NodeRefType.create()) .required() .build(), Fb.create('new_node', T.MessageType.create()) .required() .anyOfCuries([ 'gdbots:ncr:mixin:node', ]) .overridable(true) .build(), /* * The entire node, as it appeared before it was modified. */ Fb.create('old_node', T.MessageType.create()) .anyOfCuries([ 'gdbots:ncr:mixin:node', ]) .overridable(true) .build(), /* * The names of the fields this update command should apply changes to. * Nested paths can be referenced using dot notation. */ Fb.create('paths', T.StringType.create()) .asASet() .pattern('^[a-zA-Z_]{1}[\\w\\.]*$') .build(), ], this.MIXINS, ); } } const M = UpdateWidgetV1; M.prototype.SCHEMA_ID = M.SCHEMA_ID = 'pbj:acme:curator:command:update-widget:1-0-0'; M.prototype.SCHEMA_CURIE = M.SCHEMA_CURIE = 'acme:curator:command:update-widget'; M.prototype.SCHEMA_CURIE_MAJOR = M.SCHEMA_CURIE_MAJOR = 'acme:curator:command:update-widget:v1'; M.prototype.MIXINS = M.MIXINS = [ 'gdbots:pbjx:mixin:command:v1', 'gdbots:pbjx:mixin:command', 'gdbots:ncr:mixin:update-node:v1', 'gdbots:ncr:mixin:update-node', ]; GdbotsPbjxCommandV1Mixin(M); Object.freeze(M); Object.freeze(M.prototype);
module.exports = { chainWebpack: (config) => { const svgRule = config.module.rule("svg"); svgRule.uses.clear(); svgRule .use("babel-loader") .loader("babel-loader") .end() .use("vue-svg-loader") .loader("vue-svg-loader"); }, };
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function getRandomInt(max) { return Math.floor(Math.random() * Math.floor(max)); } var Mocker = /** @class */ (function () { function Mocker() { this.pick = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } return args[getRandomInt(args.length)]; }; } Object.defineProperty(Mocker.prototype, "string", { get: function () { return Math.random() .toString(36) .substring(7); }, enumerable: true, configurable: true }); Object.defineProperty(Mocker.prototype, "number", { get: function () { return Math.random() * 100; }, enumerable: true, configurable: true }); Object.defineProperty(Mocker.prototype, "bigint", { get: function () { return BigInt(Math.floor(Math.random() * 10000)); }, enumerable: true, configurable: true }); Object.defineProperty(Mocker.prototype, "boolean", { get: function () { return Math.random() < 0.5; }, enumerable: true, configurable: true }); Object.defineProperty(Mocker.prototype, "date", { get: function () { return new Date(Math.floor(Date.now() * Math.random())); }, enumerable: true, configurable: true }); Object.defineProperty(Mocker.prototype, "null", { get: function () { return null; }, enumerable: true, configurable: true }); Object.defineProperty(Mocker.prototype, "undefined", { get: function () { return undefined; }, enumerable: true, configurable: true }); Object.defineProperty(Mocker.prototype, "stringOptional", { get: function () { return this.pick(this.string, this.undefined); }, enumerable: true, configurable: true }); Object.defineProperty(Mocker.prototype, "stringNullable", { get: function () { return this.pick(this.string, this.null); }, enumerable: true, configurable: true }); Object.defineProperty(Mocker.prototype, "numberOptional", { get: function () { return this.pick(this.number, this.undefined); }, enumerable: true, configurable: true }); Object.defineProperty(Mocker.prototype, "numberNullable", { get: function () { return this.pick(this.number, this.null); }, enumerable: true, configurable: true }); Object.defineProperty(Mocker.prototype, "booleanOptional", { get: function () { return this.pick(this.boolean, this.undefined); }, enumerable: true, configurable: true }); Object.defineProperty(Mocker.prototype, "booleanNullable", { get: function () { return this.pick(this.boolean, this.null); }, enumerable: true, configurable: true }); return Mocker; }()); exports.Mocker = Mocker; //# sourceMappingURL=Mocker.js.map
const path = require('path'); // This is a custom Jest transformer turning file imports into filenames. // http://facebook.github.io/jest/docs/en/webpack.html module.exports = { process(src, filename) { const assetFilename = JSON.stringify(path.basename(filename)); if (filename.match(/\.svg$/)) { return `module.exports = { __esModule: true, default: ${assetFilename}, ReactComponent: (props) => ({ $$typeof: Symbol.for('react.element'), type: 'svg', ref: null, key: null, props: Object.assign({}, props, { children: ${assetFilename} }) }), };`; } return `module.exports = ${assetFilename};`; }, };
var assert = require('assert'); var oembed = require('./index'); describe('oembed', function() { it('youtube', function() { return oembed('https://www.youtube.com/watch?v=J---aiyznGQ') .then(res => { assert.equal(res.title, 'Charlie Schmidt\'s Keyboard Cat! - THE ORIGINAL!'); }); }); it('no oembed link', function() { return oembed('https://google.com') .then(res => { throw new Error('expected an exception'); }) .catch(err => { assert.equal(err.message, 'No oembed link found'); }); }); it('link 404', function() { return oembed('https://google.com/asdfasdfasdfsf') .then(res => { throw new Error('expected an exception'); }) .catch(err => { assert.equal(err.message, 'https://google.com/asdfasdfasdfsf returned status 404'); }); }); });
;/*!src/zepto.before.js*/ var BJ_REPORT=function(n){if(n.BJ_REPORT)return n.BJ_REPORT;var r=[],e={id:0,uin:0,url:"",combo:1,ext:{},level:4,ignore:[],random:1,delay:1e3,submit:null},t=function(n,r){return Object.prototype.toString.call(n)==="[object "+(r||"Object")+"]"},o=function(n){var r=typeof n;return"object"===r&&!!n},u=function(n){return null===n?!0:t(n,"Number")?!1:!n},i=(n.onerror,function(n){try{if(n.stack){var r=n.stack.match("https?://[^\n]+");r=r?r[0]:"";var e=r.match(":(\\d+):(\\d+)");e||(e=[0,0,0]);var t=a(n);return{msg:t,rowNum:e[1],colNum:e[2],target:r.replace(e[0],"")}}return n.name&&n.message&&n.description?{msg:JSON.stringify(n)}:n}catch(o){return n}}),a=function(n){var r=n.stack.replace(/\n/gi,"").split(/\bat\b/).slice(0,5).join("@").replace(/\?[^:]+/gi,""),e=n.toString();return r.indexOf(e)<0&&(r=e+"@"+r),r},s=function(n,r){var t=[],i=[],a=[];if(o(n)){n.level=n.level||e.level;for(var s in n){var c=n[s];if(!u(c)){if(o(c))try{c=JSON.stringify(c)}catch(f){c="[BJ_REPORT detect value stringify error] "+f.toString()}a.push(s+":"+c),t.push(s+"="+encodeURIComponent(c)),i.push(s+"["+r+"]="+encodeURIComponent(c))}}}return[i.join("&"),a.join(","),t.join("&")]},c=[],f=function(n){if(e.submit)e.submit(n);else{var r=new Image;c.push(r),r.src=n}},l=[],p=0,m=function(n){if(e.report){for(;r.length;){var o=!1,u=r.shift(),i=s(u,l.length);if(t(e.ignore,"Array"))for(var a=0,c=e.ignore.length;c>a;a++){var m=e.ignore[a];if(t(m,"RegExp")&&m.test(i[1])||t(m,"Function")&&m(u,i[1])){o=!0;break}}o||(e.combo?l.push(i[0]):f(e.report+i[2]+"&_t="+ +new Date),e.onReport&&e.onReport(e.id,u))}var d=l.length;if(d){var g=function(){clearTimeout(p),f(e.report+l.join("&")+"&count="+d+"&_t="+ +new Date),p=0,l=[]};n?g():p||(p=setTimeout(g,e.delay))}}},d={push:function(n){return Math.random()>=e.random?d:(r.push(o(n)?i(n):{msg:n}),m(),d)},report:function(n){return n&&d.push(n),m(!0),d},info:function(n){return n?(o(n)?n.level=2:n={msg:n,level:2},d.push(n),d):d},debug:function(n){return n?(o(n)?n.level=1:n={msg:n,level:1},d.push(n),d):d},init:function(n){if(o(n))for(var r in n)e[r]=n[r];var t=parseInt(e.id,10);return t&&(/qq\.com$/gi.test(window.location.hostname)&&(e.url||(e.url="//badjs2.qq.com/badjs"),e.uin||(e.uin=parseInt((document.cookie.match(/\buin=\D+(\d+)/)||[])[1],10))),e.report=e.url+"?id="+t+"&uin="+e.uin+"&from="+encodeURIComponent(location.href)+"&ext="+JSON.stringify(e.ext)+"&"),d},__onerror__:n.onerror};return"undefined"!=typeof console&&console.error&&setTimeout(function(){var n=((location.hash||"").match(/([#&])BJ_ERROR=([^&$]+)/)||[])[2];n&&console.error("BJ_ERROR",decodeURIComponent(n).replace(/(:\d+:\d+)\s*/g,"$1\n"))},0),d}(window);"undefined"!=typeof exports&&("undefined"!=typeof module&&module.exports&&(exports=module.exports=BJ_REPORT),exports.BJ_REPORT=BJ_REPORT),function(n){if(n.BJ_REPORT){var r,e=function(r){n.BJ_REPORT.report(r)},t=n.BJ_REPORT.tryJs=function(n){return n&&(e=n),t},o=function(n,r){var e;for(e in r)n[e]=r[e]},u=function(n){return"function"==typeof n},i=function(t,o){return function(){try{return t.apply(this,o||arguments)}catch(u){if(e(u),u.stack&&console&&console.error&&console.error("[BJ-REPORT]",u.stack),!r){var i=n.onerror;n.onerror=function(){},r=setTimeout(function(){n.onerror=i,r=null},50)}throw u}}},a=function(n){return function(){for(var r,e=[],t=0,o=arguments.length;o>t;t++)r=arguments[t],u(r)&&(r=i(r)),e.push(r);return n.apply(this,e)}},s=function(n){return function(r,e){if("string"==typeof r)try{r=new Function(r)}catch(t){throw t}var o=[].slice.call(arguments,2);return r=i(r,o.length&&o),n(r,e)}},c=function(n,r){return function(){for(var e,t,o=[],a=0,s=arguments.length;s>a;a++)e=arguments[a],u(e)&&(t=i(e))&&(e.tryWrap=t)&&(e=t),o.push(e);return n.apply(r||this,o)}},f=function(n){var r,e;for(r in n)e=n[r],u(e)&&(n[r]=i(e));return n};t.spyJquery=function(){var r=n.$;if(!r||!r.event)return t;var e,o;r.zepto?(e=r.fn.on,o=r.fn.off,r.fn.on=c(e),r.fn.off=function(){for(var n,r=[],e=0,t=arguments.length;t>e;e++)n=arguments[e],u(n)&&n.tryWrap&&(n=n.tryWrap),r.push(n);return o.apply(this,r)}):window.jQuery&&(e=r.event.add,o=r.event.remove,r.event.add=c(e),r.event.remove=function(){for(var n,r=[],e=0,t=arguments.length;t>e;e++)n=arguments[e],u(n)&&n.tryWrap&&(n=n.tryWrap),r.push(n);return o.apply(this,r)});var i=r.ajax;return i&&(r.ajax=function(n,e){return e||(e=n,n=void 0),f(e),n?i.call(r,n,e):i.call(r,e)}),t},t.spyModules=function(){var r=n.require,e=n.define;return e&&e.amd&&r&&(n.require=a(r),o(n.require,r),n.define=a(e),o(n.define,e)),n.seajs&&e&&(n.define=function(){for(var n,r=[],t=0,o=arguments.length;o>t;t++)n=arguments[t],u(n)&&(n=i(n),n.toString=function(n){return function(){return n.toString()}}(arguments[t])),r.push(n);return e.apply(this,r)},n.seajs.use=a(n.seajs.use),o(n.define,e)),t},t.spySystem=function(){return n.setTimeout=s(n.setTimeout),n.setInterval=s(n.setInterval),t},t.spyCustom=function(n){return u(n)?i(n):f(n)},t.spyAll=function(){return t.spyJquery().spyModules().spySystem(),t}}}(window),BJ_REPORT.init({id:1,combo:1,delay:1e3,url:"https://webbad.nie.netease.com/badjs",ignore:[/Script error/i]}); ;/*!src/lib/zepto.min.js*/ var Zepto=function(){function t(t){return null==t?String(t):U[J.call(t)]||"object"}function e(e){return"function"==t(e)}function n(t){return null!=t&&t==t.window}function r(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function i(e){return"object"==t(e)}function o(t){return i(t)&&!n(t)&&Object.getPrototypeOf(t)==Object.prototype}function a(t){return"number"==typeof t.length}function s(t){return P.call(t,function(t){return null!=t})}function u(t){return t.length>0?j.fn.concat.apply([],t):t}function c(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function l(t){return t in Z?Z[t]:Z[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function f(t,e){return"number"!=typeof e||$[c(t)]?e:e+"px"}function h(t){var e,n;return L[t]||(e=A.createElement(t),A.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),L[t]=n),L[t]}function p(t){return"children"in t?O.call(t.children):j.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function d(t,e,n){for(E in e)n&&(o(e[E])||G(e[E]))?(o(e[E])&&!o(t[E])&&(t[E]={}),G(e[E])&&!G(t[E])&&(t[E]=[]),d(t[E],e[E],n)):e[E]!==w&&(t[E]=e[E])}function m(t,e){return null==e?j(t):j(t).filter(e)}function v(t,n,r,i){return e(n)?n.call(t,r,i):n}function g(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function y(t,e){var n=t.className,r=n&&n.baseVal!==w;return e===w?r?n.baseVal:n:void(r?n.baseVal=e:t.className=e)}function x(t){var e;try{return t?"true"==t||("false"==t?!1:"null"==t?null:/^0/.test(t)||isNaN(e=Number(t))?/^[\[\{]/.test(t)?j.parseJSON(t):t:e):t}catch(n){return t}}function b(t,e){e(t);for(var n=0,r=t.childNodes.length;r>n;n++)b(t.childNodes[n],e)}var w,E,j,S,T,C,N=[],O=N.slice,P=N.filter,A=window.document,L={},Z={},$={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},_=/^\s*<(\w+|!)[^>]*>/,D=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,M=/^(?:body|html)$/i,k=/([A-Z])/g,z=["val","css","html","text","data","width","height","offset"],F=["after","prepend","before","append"],q=A.createElement("table"),H=A.createElement("tr"),I={tr:A.createElement("tbody"),tbody:q,thead:q,tfoot:q,td:H,th:H,"*":A.createElement("div")},V=/complete|loaded|interactive/,B=/^[\w-]*$/,U={},J=U.toString,X={},W=A.createElement("div"),Y={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},G=Array.isArray||function(t){return t instanceof Array};return X.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var r,i=t.parentNode,o=!i;return o&&(i=W).appendChild(t),r=~X.qsa(i,e).indexOf(t),o&&W.removeChild(t),r},T=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},C=function(t){return P.call(t,function(e,n){return t.indexOf(e)==n})},X.fragment=function(t,e,n){var r,i,a;return D.test(t)&&(r=j(A.createElement(RegExp.$1))),r||(t.replace&&(t=t.replace(R,"<$1></$2>")),e===w&&(e=_.test(t)&&RegExp.$1),e in I||(e="*"),a=I[e],a.innerHTML=""+t,r=j.each(O.call(a.childNodes),function(){a.removeChild(this)})),o(n)&&(i=j(r),j.each(n,function(t,e){z.indexOf(t)>-1?i[t](e):i.attr(t,e)})),r},X.Z=function(t,e){return t=t||[],t.__proto__=j.fn,t.selector=e||"",t},X.isZ=function(t){return t instanceof X.Z},X.init=function(t,n){var r;if(!t)return X.Z();if("string"==typeof t)if(t=t.trim(),"<"==t[0]&&_.test(t))r=X.fragment(t,RegExp.$1,n),t=null;else{if(n!==w)return j(n).find(t);r=X.qsa(A,t)}else{if(e(t))return j(A).ready(t);if(X.isZ(t))return t;if(G(t))r=s(t);else if(i(t))r=[t],t=null;else if(_.test(t))r=X.fragment(t.trim(),RegExp.$1,n),t=null;else{if(n!==w)return j(n).find(t);r=X.qsa(A,t)}}return X.Z(r,t)},j=function(t,e){return X.init(t,e)},j.extend=function(t){var e,n=O.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){d(t,n,e)}),t},X.qsa=function(t,e){var n,i="#"==e[0],o=!i&&"."==e[0],a=i||o?e.slice(1):e,s=B.test(a);return r(t)&&s&&i?(n=t.getElementById(a))?[n]:[]:1!==t.nodeType&&9!==t.nodeType?[]:O.call(s&&!i?o?t.getElementsByClassName(a):t.getElementsByTagName(e):t.querySelectorAll(e))},j.contains=A.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},j.type=t,j.isFunction=e,j.isWindow=n,j.isArray=G,j.isPlainObject=o,j.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},j.inArray=function(t,e,n){return N.indexOf.call(e,t,n)},j.camelCase=T,j.trim=function(t){return null==t?"":String.prototype.trim.call(t)},j.uuid=0,j.support={},j.expr={},j.map=function(t,e){var n,r,i,o=[];if(a(t))for(r=0;r<t.length;r++)n=e(t[r],r),null!=n&&o.push(n);else for(i in t)n=e(t[i],i),null!=n&&o.push(n);return u(o)},j.each=function(t,e){var n,r;if(a(t)){for(n=0;n<t.length;n++)if(e.call(t[n],n,t[n])===!1)return t}else for(r in t)if(e.call(t[r],r,t[r])===!1)return t;return t},j.grep=function(t,e){return P.call(t,e)},window.JSON&&(j.parseJSON=JSON.parse),j.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(t,e){U["[object "+e+"]"]=e.toLowerCase()}),j.fn={forEach:N.forEach,reduce:N.reduce,push:N.push,sort:N.sort,indexOf:N.indexOf,concat:N.concat,map:function(t){return j(j.map(this,function(e,n){return t.call(e,n,e)}))},slice:function(){return j(O.apply(this,arguments))},ready:function(t){return V.test(A.readyState)&&A.body?t(j):A.addEventListener("DOMContentLoaded",function(){t(j)},!1),this},get:function(t){return t===w?O.call(this):this[t>=0?t:t+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return N.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return e(t)?this.not(this.not(t)):j(P.call(this,function(e){return X.matches(e,t)}))},add:function(t,e){return j(C(this.concat(j(t,e))))},is:function(t){return this.length>0&&X.matches(this[0],t)},not:function(t){var n=[];if(e(t)&&t.call!==w)this.each(function(e){t.call(this,e)||n.push(this)});else{var r="string"==typeof t?this.filter(t):a(t)&&e(t.item)?O.call(t):j(t);this.forEach(function(t){r.indexOf(t)<0&&n.push(t)})}return j(n)},has:function(t){return this.filter(function(){return i(t)?j.contains(this,t):j(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!i(t)?t:j(t)},last:function(){var t=this[this.length-1];return t&&!i(t)?t:j(t)},find:function(t){var e,n=this;return e=t?"object"==typeof t?j(t).filter(function(){var t=this;return N.some.call(n,function(e){return j.contains(e,t)})}):1==this.length?j(X.qsa(this[0],t)):this.map(function(){return X.qsa(this,t)}):[]},closest:function(t,e){var n=this[0],i=!1;for("object"==typeof t&&(i=j(t));n&&!(i?i.indexOf(n)>=0:X.matches(n,t));)n=n!==e&&!r(n)&&n.parentNode;return j(n)},parents:function(t){for(var e=[],n=this;n.length>0;)n=j.map(n,function(t){return(t=t.parentNode)&&!r(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return m(e,t)},parent:function(t){return m(C(this.pluck("parentNode")),t)},children:function(t){return m(this.map(function(){return p(this)}),t)},contents:function(){return this.map(function(){return O.call(this.childNodes)})},siblings:function(t){return m(this.map(function(t,e){return P.call(p(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return j.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=h(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var n=e(t);if(this[0]&&!n)var r=j(t).get(0),i=r.parentNode||this.length>1;return this.each(function(e){j(this).wrapAll(n?t.call(this,e):i?r.cloneNode(!0):r)})},wrapAll:function(t){if(this[0]){j(this[0]).before(t=j(t));for(var e;(e=t.children()).length;)t=e.first();j(t).append(this)}return this},wrapInner:function(t){var n=e(t);return this.each(function(e){var r=j(this),i=r.contents(),o=n?t.call(this,e):t;i.length?i.wrapAll(o):r.append(o)})},unwrap:function(){return this.parent().each(function(){j(this).replaceWith(j(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(t){return this.each(function(){var e=j(this);(t===w?"none"==e.css("display"):t)?e.show():e.hide()})},prev:function(t){return j(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return j(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each(function(e){var n=this.innerHTML;j(this).empty().append(v(this,t,e,n))}):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each(function(e){var n=v(this,t,e,this.textContent);this.textContent=null==n?"":""+n}):0 in this?this[0].textContent:null},attr:function(t,e){var n;return"string"!=typeof t||1 in arguments?this.each(function(n){if(1===this.nodeType)if(i(t))for(E in t)g(this,E,t[E]);else g(this,t,v(this,e,n,this.getAttribute(t)))}):this.length&&1===this[0].nodeType?!(n=this[0].getAttribute(t))&&t in this[0]?this[0][t]:n:w},removeAttr:function(t){return this.each(function(){1===this.nodeType&&g(this,t)})},prop:function(t,e){return t=Y[t]||t,1 in arguments?this.each(function(n){this[t]=v(this,e,n,this[t])}):this[0]&&this[0][t]},data:function(t,e){var n="data-"+t.replace(k,"-$1").toLowerCase(),r=1 in arguments?this.attr(n,e):this.attr(n);return null!==r?x(r):w},val:function(t){return 0 in arguments?this.each(function(e){this.value=v(this,t,e,this.value)}):this[0]&&(this[0].multiple?j(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(t){if(t)return this.each(function(e){var n=j(this),r=v(this,t,e,n.offset()),i=n.offsetParent().offset(),o={top:r.top-i.top,left:r.left-i.left};"static"==n.css("position")&&(o.position="relative"),n.css(o)});if(!this.length)return null;var e=this[0].getBoundingClientRect();return{left:e.left+window.pageXOffset,top:e.top+window.pageYOffset,width:Math.round(e.width),height:Math.round(e.height)}},css:function(e,n){if(arguments.length<2){var r=this[0],i=getComputedStyle(r,"");if(!r)return;if("string"==typeof e)return r.style[T(e)]||i.getPropertyValue(e);if(G(e)){var o={};return j.each(G(e)?e:[e],function(t,e){o[e]=r.style[T(e)]||i.getPropertyValue(e)}),o}}var a="";if("string"==t(e))n||0===n?a=c(e)+":"+f(e,n):this.each(function(){this.style.removeProperty(c(e))});else for(E in e)e[E]||0===e[E]?a+=c(E)+":"+f(E,e[E])+";":this.each(function(){this.style.removeProperty(c(E))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf(j(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return t?N.some.call(this,function(t){return this.test(y(t))},l(t)):!1},addClass:function(t){return t?this.each(function(e){S=[];var n=y(this),r=v(this,t,e,n);r.split(/\s+/g).forEach(function(t){j(this).hasClass(t)||S.push(t)},this),S.length&&y(this,n+(n?" ":"")+S.join(" "))}):this},removeClass:function(t){return this.each(function(e){return t===w?y(this,""):(S=y(this),v(this,t,e,S).split(/\s+/g).forEach(function(t){S=S.replace(l(t)," ")}),void y(this,S.trim()))})},toggleClass:function(t,e){return t?this.each(function(n){var r=j(this),i=v(this,t,n,y(this));i.split(/\s+/g).forEach(function(t){(e===w?!r.hasClass(t):e)?r.addClass(t):r.removeClass(t)})}):this},scrollTop:function(t){if(this.length){var e="scrollTop"in this[0];return t===w?e?this[0].scrollTop:this[0].pageYOffset:this.each(e?function(){this.scrollTop=t}:function(){this.scrollTo(this.scrollX,t)})}},scrollLeft:function(t){if(this.length){var e="scrollLeft"in this[0];return t===w?e?this[0].scrollLeft:this[0].pageXOffset:this.each(e?function(){this.scrollLeft=t}:function(){this.scrollTo(t,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),n=this.offset(),r=M.test(e[0].nodeName)?{top:0,left:0}:e.offset();return n.top-=parseFloat(j(t).css("margin-top"))||0,n.left-=parseFloat(j(t).css("margin-left"))||0,r.top+=parseFloat(j(e[0]).css("border-top-width"))||0,r.left+=parseFloat(j(e[0]).css("border-left-width"))||0,{top:n.top-r.top,left:n.left-r.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||A.body;t&&!M.test(t.nodeName)&&"static"==j(t).css("position");)t=t.offsetParent;return t})}},j.fn.detach=j.fn.remove,["width","height"].forEach(function(t){var e=t.replace(/./,function(t){return t[0].toUpperCase()});j.fn[t]=function(i){var o,a=this[0];return i===w?n(a)?a["inner"+e]:r(a)?a.documentElement["scroll"+e]:(o=this.offset())&&o[t]:this.each(function(e){a=j(this),a.css(t,v(this,i,e,a[t]()))})}}),F.forEach(function(e,n){var r=n%2;j.fn[e]=function(){var e,i,o=j.map(arguments,function(n){return e=t(n),"object"==e||"array"==e||null==n?n:X.fragment(n)}),a=this.length>1;return o.length<1?this:this.each(function(t,e){i=r?e:e.parentNode,e=0==n?e.nextSibling:1==n?e.firstChild:2==n?e:null;var s=j.contains(A.documentElement,i);o.forEach(function(t){if(a)t=t.cloneNode(!0);else if(!i)return j(t).remove();i.insertBefore(t,e),s&&b(t,function(t){null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src||window.eval.call(window,t.innerHTML)})})})},j.fn[r?e+"To":"insert"+(n?"Before":"After")]=function(t){return j(t)[e](this),this}}),X.Z.prototype=j.fn,X.uniq=C,X.deserializeValue=x,j.zepto=X,j}();window.Zepto=Zepto,void 0===window.$&&(window.$=Zepto),function(t){function e(t){return t._zid||(t._zid=h++)}function n(t,n,o,a){if(n=r(n),n.ns)var s=i(n.ns);return(v[e(t)]||[]).filter(function(t){return!(!t||n.e&&t.e!=n.e||n.ns&&!s.test(t.ns)||o&&e(t.fn)!==e(o)||a&&t.sel!=a)})}function r(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function i(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function o(t,e){return t.del&&!y&&t.e in x||!!e}function a(t){return b[t]||y&&x[t]||t}function s(n,i,s,u,l,h,p){var d=e(n),m=v[d]||(v[d]=[]);i.split(/\s/).forEach(function(e){if("ready"==e)return t(document).ready(s);var i=r(e);i.fn=s,i.sel=l,i.e in b&&(s=function(e){var n=e.relatedTarget;return!n||n!==this&&!t.contains(this,n)?i.fn.apply(this,arguments):void 0}),i.del=h;var d=h||s;i.proxy=function(t){if(t=c(t),!t.isImmediatePropagationStopped()){t.data=u;var e=d.apply(n,t._args==f?[t]:[t].concat(t._args));return e===!1&&(t.preventDefault(),t.stopPropagation()),e}},i.i=m.length,m.push(i),"addEventListener"in n&&n.addEventListener(a(i.e),i.proxy,o(i,p))})}function u(t,r,i,s,u){var c=e(t);(r||"").split(/\s/).forEach(function(e){n(t,e,i,s).forEach(function(e){delete v[c][e.i],"removeEventListener"in t&&t.removeEventListener(a(e.e),e.proxy,o(e,u))})})}function c(e,n){return(n||!e.isDefaultPrevented)&&(n||(n=e),t.each(S,function(t,r){var i=n[t];e[t]=function(){return this[r]=w,i&&i.apply(n,arguments)},e[r]=E}),(n.defaultPrevented!==f?n.defaultPrevented:"returnValue"in n?n.returnValue===!1:n.getPreventDefault&&n.getPreventDefault())&&(e.isDefaultPrevented=w)),e}function l(t){var e,n={originalEvent:t};for(e in t)j.test(e)||t[e]===f||(n[e]=t[e]);return c(n,t)}var f,h=1,p=Array.prototype.slice,d=t.isFunction,m=function(t){return"string"==typeof t},v={},g={},y="onfocusin"in window,x={focus:"focusin",blur:"focusout"},b={mouseenter:"mouseover",mouseleave:"mouseout"};g.click=g.mousedown=g.mouseup=g.mousemove="MouseEvents",t.event={add:s,remove:u},t.proxy=function(n,r){var i=2 in arguments&&p.call(arguments,2);if(d(n)){var o=function(){return n.apply(r,i?i.concat(p.call(arguments)):arguments)};return o._zid=e(n),o}if(m(r))return i?(i.unshift(n[r],n),t.proxy.apply(null,i)):t.proxy(n[r],n);throw new TypeError("expected function")},t.fn.bind=function(t,e,n){return this.on(t,e,n)},t.fn.unbind=function(t,e){return this.off(t,e)},t.fn.one=function(t,e,n,r){return this.on(t,e,n,r,1)};var w=function(){return!0},E=function(){return!1},j=/^([A-Z]|returnValue$|layer[XY]$)/,S={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};t.fn.delegate=function(t,e,n){return this.on(e,t,n)},t.fn.undelegate=function(t,e,n){return this.off(e,t,n)},t.fn.live=function(e,n){return t(document.body).delegate(this.selector,e,n),this},t.fn.die=function(e,n){return t(document.body).undelegate(this.selector,e,n),this},t.fn.on=function(e,n,r,i,o){var a,c,h=this;return e&&!m(e)?(t.each(e,function(t,e){h.on(t,n,r,e,o)}),h):(m(n)||d(i)||i===!1||(i=r,r=n,n=f),(d(r)||r===!1)&&(i=r,r=f),i===!1&&(i=E),h.each(function(f,h){o&&(a=function(t){return u(h,t.type,i),i.apply(this,arguments)}),n&&(c=function(e){var r,o=t(e.target).closest(n,h).get(0);return o&&o!==h?(r=t.extend(l(e),{currentTarget:o,liveFired:h}),(a||i).apply(o,[r].concat(p.call(arguments,1)))):void 0}),s(h,e,i,r,n,c||a)}))},t.fn.off=function(e,n,r){var i=this;return e&&!m(e)?(t.each(e,function(t,e){i.off(t,n,e)}),i):(m(n)||d(r)||r===!1||(r=n,n=f),r===!1&&(r=E),i.each(function(){u(this,e,r,n)}))},t.fn.trigger=function(e,n){return e=m(e)||t.isPlainObject(e)?t.Event(e):c(e),e._args=n,this.each(function(){"dispatchEvent"in this?this.dispatchEvent(e):t(this).triggerHandler(e,n)})},t.fn.triggerHandler=function(e,r){var i,o;return this.each(function(a,s){i=l(m(e)?t.Event(e):e),i._args=r,i.target=s,t.each(n(s,e.type||e),function(t,e){return o=e.proxy(i),i.isImmediatePropagationStopped()?!1:void 0})}),o},"focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(e){t.fn[e]=function(t){return t?this.bind(e,t):this.trigger(e)}}),["focus","blur"].forEach(function(e){t.fn[e]=function(t){return t?this.bind(e,t):this.each(function(){try{this[e]()}catch(t){}}),this}}),t.Event=function(t,e){m(t)||(e=t,t=e.type);var n=document.createEvent(g[t]||"Events"),r=!0;if(e)for(var i in e)"bubbles"==i?r=!!e[i]:n[i]=e[i];return n.initEvent(t,r,!0),c(n)}}(Zepto),function(t){function e(e,n,r){var i=t.Event(n);return t(e).trigger(i,r),!i.isDefaultPrevented()}function n(t,n,r,i){return t.global?e(n||y,r,i):void 0}function r(e){e.global&&0===t.active++&&n(e,null,"ajaxStart")}function i(e){e.global&&!--t.active&&n(e,null,"ajaxStop")}function o(t,e){var r=e.context;return e.beforeSend.call(r,t,e)===!1||n(e,r,"ajaxBeforeSend",[t,e])===!1?!1:void n(e,r,"ajaxSend",[t,e])}function a(t,e,r,i){var o=r.context,a="success";r.success.call(o,t,a,e),i&&i.resolveWith(o,[t,a,e]),n(r,o,"ajaxSuccess",[e,r,t]),u(a,e,r)}function s(t,e,r,i,o){var a=i.context;i.error.call(a,r,e,t),o&&o.rejectWith(a,[r,e,t]),n(i,a,"ajaxError",[r,i,t||e]),u(e,r,i)}function u(t,e,r){var o=r.context;r.complete.call(o,e,t),n(r,o,"ajaxComplete",[e,r]),i(r)}function c(){}function l(t){return t&&(t=t.split(";",2)[0]),t&&(t==j?"html":t==E?"json":b.test(t)?"script":w.test(t)&&"xml")||"text"}function f(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function h(e){e.processData&&e.data&&"string"!=t.type(e.data)&&(e.data=t.param(e.data,e.traditional)),!e.data||e.type&&"GET"!=e.type.toUpperCase()||(e.url=f(e.url,e.data),e.data=void 0)}function p(e,n,r,i){return t.isFunction(n)&&(i=r,r=n,n=void 0),t.isFunction(r)||(i=r,r=void 0),{url:e,data:n,success:r,dataType:i}}function d(e,n,r,i){var o,a=t.isArray(n),s=t.isPlainObject(n);t.each(n,function(n,u){o=t.type(u),i&&(n=r?i:i+"["+(s||"object"==o||"array"==o?n:"")+"]"),!i&&a?e.add(u.name,u.value):"array"==o||!r&&"object"==o?d(e,u,r,n):e.add(n,u)})}var m,v,g=0,y=window.document,x=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,b=/^(?:text|application)\/javascript/i,w=/^(?:text|application)\/xml/i,E="application/json",j="text/html",S=/^\s*$/;t.active=0,t.ajaxJSONP=function(e,n){if(!("type"in e))return t.ajax(e);var r,i,u=e.jsonpCallback,c=(t.isFunction(u)?u():u)||"jsonp"+ ++g,l=y.createElement("script"),f=window[c],h=function(e){t(l).triggerHandler("error",e||"abort")},p={abort:h};return n&&n.promise(p),t(l).on("load error",function(o,u){clearTimeout(i),t(l).off().remove(),"error"!=o.type&&r?a(r[0],p,e,n):s(null,u||"error",p,e,n),window[c]=f,r&&t.isFunction(f)&&f(r[0]),f=r=void 0}),o(p,e)===!1?(h("abort"),p):(window[c]=function(){r=arguments},l.src=e.url.replace(/\?(.+)=\?/,"?$1="+c),y.head.appendChild(l),e.timeout>0&&(i=setTimeout(function(){h("timeout")},e.timeout)),p)},t.ajaxSettings={type:"GET",beforeSend:c,success:c,error:c,complete:c,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:E,xml:"application/xml, text/xml",html:j,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},t.ajax=function(e){var n=t.extend({},e||{}),i=t.Deferred&&t.Deferred();for(m in t.ajaxSettings)void 0===n[m]&&(n[m]=t.ajaxSettings[m]);r(n),n.crossDomain||(n.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(n.url)&&RegExp.$2!=window.location.host),n.url||(n.url=window.location.toString()),h(n);var u=n.dataType,p=/\?.+=\?/.test(n.url);if(p&&(u="jsonp"),n.cache!==!1&&(e&&e.cache===!0||"script"!=u&&"jsonp"!=u)||(n.url=f(n.url,"_="+Date.now())),"jsonp"==u)return p||(n.url=f(n.url,n.jsonp?n.jsonp+"=?":n.jsonp===!1?"":"callback=?")),t.ajaxJSONP(n,i);var d,g=n.accepts[u],y={},x=function(t,e){y[t.toLowerCase()]=[t,e]},b=/^([\w-]+:)\/\//.test(n.url)?RegExp.$1:window.location.protocol,w=n.xhr(),E=w.setRequestHeader;if(i&&i.promise(w),n.crossDomain||x("X-Requested-With","XMLHttpRequest"),x("Accept",g||"*/*"),(g=n.mimeType||g)&&(g.indexOf(",")>-1&&(g=g.split(",",2)[0]),w.overrideMimeType&&w.overrideMimeType(g)),(n.contentType||n.contentType!==!1&&n.data&&"GET"!=n.type.toUpperCase())&&x("Content-Type",n.contentType||"application/x-www-form-urlencoded"),n.headers)for(v in n.headers)x(v,n.headers[v]);if(w.setRequestHeader=x,w.onreadystatechange=function(){if(4==w.readyState){w.onreadystatechange=c,clearTimeout(d);var e,r=!1;if(w.status>=200&&w.status<300||304==w.status||0==w.status&&"file:"==b){u=u||l(n.mimeType||w.getResponseHeader("content-type")),e=w.responseText;try{"script"==u?(1,eval)(e):"xml"==u?e=w.responseXML:"json"==u&&(e=S.test(e)?null:t.parseJSON(e))}catch(o){r=o}r?s(r,"parsererror",w,n,i):a(e,w,n,i)}else s(w.statusText||null,w.status?"error":"abort",w,n,i)}},o(w,n)===!1)return w.abort(),s(null,"abort",w,n,i),w;if(n.xhrFields)for(v in n.xhrFields)w[v]=n.xhrFields[v];var j="async"in n?n.async:!0;w.open(n.type,n.url,j,n.username,n.password);for(v in y)E.apply(w,y[v]);return n.timeout>0&&(d=setTimeout(function(){w.onreadystatechange=c,w.abort(),s(null,"timeout",w,n,i)},n.timeout)),w.send(n.data?n.data:null),w},t.get=function(){return t.ajax(p.apply(null,arguments))},t.post=function(){var e=p.apply(null,arguments);return e.type="POST",t.ajax(e)},t.getJSON=function(){var e=p.apply(null,arguments);return e.dataType="json",t.ajax(e)},t.fn.load=function(e,n,r){if(!this.length)return this;var i,o=this,a=e.split(/\s/),s=p(e,n,r),u=s.success;return a.length>1&&(s.url=a[0],i=a[1]),s.success=function(e){o.html(i?t("<div>").html(e.replace(x,"")).find(i):e),u&&u.apply(o,arguments)},t.ajax(s),this};var T=encodeURIComponent;t.param=function(t,e){var n=[];return n.add=function(t,e){this.push(T(t)+"="+T(e))},d(n,t,e),n.join("&").replace(/%20/g,"+")}}(Zepto),function(t){t.fn.serializeArray=function(){var e,n=[];return t([].slice.call(this.get(0).elements)).each(function(){e=t(this);var r=e.attr("type");"fieldset"!=this.nodeName.toLowerCase()&&!this.disabled&&"submit"!=r&&"reset"!=r&&"button"!=r&&("radio"!=r&&"checkbox"!=r||this.checked)&&n.push({name:e.attr("name"),value:e.val()})}),n},t.fn.serialize=function(){var t=[];return this.serializeArray().forEach(function(e){t.push(encodeURIComponent(e.name)+"="+encodeURIComponent(e.value))}),t.join("&")},t.fn.submit=function(e){if(e)this.bind("submit",e);else if(this.length){var n=t.Event("submit");this.eq(0).trigger(n),n.isDefaultPrevented()||this.get(0).submit()}return this}}(Zepto),function(t){"__proto__"in{}||t.extend(t.zepto,{Z:function(e,n){return e=e||[],t.extend(e,t.fn),e.selector=n||"",e.__Z=!0,e},isZ:function(e){return"array"===t.type(e)&&"__Z"in e}});try{getComputedStyle(void 0)}catch(e){var n=getComputedStyle;window.getComputedStyle=function(t){try{return n(t)}catch(e){return null}}}}(Zepto); ;/*!src/mobi.js*/ window.jQuery=window.Zepto,$.browser={msie:!1},function(e){e.extend(e,{makeArray:function(n,r){var u,i=r||[];return null!=n&&(u=jQuery.type(n),null==n.length||"string"===u||"function"===u||"regexp"===u||jQuery.isWindow(n)?i.push(n):e.merge(i,n)),i}})}(jQuery); ;/*!src/zepto.pack.js*/ var nie=nie||{};!function(t){t.host=function(){var t=window.location.protocol,e="";return e=t.indexOf("https")>-1||window.location.hostname.indexOf("163")<0?"https://nie.res.netease.com":"http://res.nie.netease.com"}()}(jQuery),!function(t){var e=function(t,e){return t<<e|t>>>32-e},n=function(t,e){var n,i,o,r,a;return o=2147483648&t,r=2147483648&e,n=1073741824&t,i=1073741824&e,a=(1073741823&t)+(1073741823&e),n&i?2147483648^a^o^r:n|i?1073741824&a?3221225472^a^o^r:1073741824^a^o^r:a^o^r},i=function(t,e,n){return t&e|~t&n},o=function(t,e,n){return t&n|e&~n},r=function(t,e,n){return t^e^n},a=function(t,e,n){return e^(t|~n)},u=function(t,o,r,a,u,s,c){return t=n(t,n(n(i(o,r,a),u),c)),n(e(t,s),o)},s=function(t,i,r,a,u,s,c){return t=n(t,n(n(o(i,r,a),u),c)),n(e(t,s),i)},c=function(t,i,o,a,u,s,c){return t=n(t,n(n(r(i,o,a),u),c)),n(e(t,s),i)},l=function(t,i,o,r,u,s,c){return t=n(t,n(n(a(i,o,r),u),c)),n(e(t,s),i)},f=function(t){for(var e,n=t.length,i=n+8,o=(i-i%64)/64,r=16*(o+1),a=Array(r-1),u=0,s=0;n>s;)e=(s-s%4)/4,u=s%4*8,a[e]=a[e]|t.charCodeAt(s)<<u,s++;return e=(s-s%4)/4,u=s%4*8,a[e]=a[e]|128<<u,a[r-2]=n<<3,a[r-1]=n>>>29,a},m=function(t){var e,n,i="",o="";for(n=0;3>=n;n++)e=t>>>8*n&255,o="0"+e.toString(16),i+=o.substr(o.length-2,2);return i},d=function(t){t=t.replace(/\x0d\x0a/g,"\n");for(var e="",n=0;n<t.length;n++){var i=t.charCodeAt(n);128>i?e+=String.fromCharCode(i):i>127&&2048>i?(e+=String.fromCharCode(i>>6|192),e+=String.fromCharCode(63&i|128)):(e+=String.fromCharCode(i>>12|224),e+=String.fromCharCode(i>>6&63|128),e+=String.fromCharCode(63&i|128))}return e};t.extend(t,{md5:function(t){var e,i,o,r,a,h,p,g,w,y=Array(),v=7,x=12,b=17,_=22,j=5,k=9,S=14,L=20,q=4,C=11,z=16,D=23,T=6,P=10,E=15,R=21;for(t=d(t),y=f(t),h=1732584193,p=4023233417,g=2562383102,w=271733878,e=0;e<y.length;e+=16)i=h,o=p,r=g,a=w,h=u(h,p,g,w,y[e+0],v,3614090360),w=u(w,h,p,g,y[e+1],x,3905402710),g=u(g,w,h,p,y[e+2],b,606105819),p=u(p,g,w,h,y[e+3],_,3250441966),h=u(h,p,g,w,y[e+4],v,4118548399),w=u(w,h,p,g,y[e+5],x,1200080426),g=u(g,w,h,p,y[e+6],b,2821735955),p=u(p,g,w,h,y[e+7],_,4249261313),h=u(h,p,g,w,y[e+8],v,1770035416),w=u(w,h,p,g,y[e+9],x,2336552879),g=u(g,w,h,p,y[e+10],b,4294925233),p=u(p,g,w,h,y[e+11],_,2304563134),h=u(h,p,g,w,y[e+12],v,1804603682),w=u(w,h,p,g,y[e+13],x,4254626195),g=u(g,w,h,p,y[e+14],b,2792965006),p=u(p,g,w,h,y[e+15],_,1236535329),h=s(h,p,g,w,y[e+1],j,4129170786),w=s(w,h,p,g,y[e+6],k,3225465664),g=s(g,w,h,p,y[e+11],S,643717713),p=s(p,g,w,h,y[e+0],L,3921069994),h=s(h,p,g,w,y[e+5],j,3593408605),w=s(w,h,p,g,y[e+10],k,38016083),g=s(g,w,h,p,y[e+15],S,3634488961),p=s(p,g,w,h,y[e+4],L,3889429448),h=s(h,p,g,w,y[e+9],j,568446438),w=s(w,h,p,g,y[e+14],k,3275163606),g=s(g,w,h,p,y[e+3],S,4107603335),p=s(p,g,w,h,y[e+8],L,1163531501),h=s(h,p,g,w,y[e+13],j,2850285829),w=s(w,h,p,g,y[e+2],k,4243563512),g=s(g,w,h,p,y[e+7],S,1735328473),p=s(p,g,w,h,y[e+12],L,2368359562),h=c(h,p,g,w,y[e+5],q,4294588738),w=c(w,h,p,g,y[e+8],C,2272392833),g=c(g,w,h,p,y[e+11],z,1839030562),p=c(p,g,w,h,y[e+14],D,4259657740),h=c(h,p,g,w,y[e+1],q,2763975236),w=c(w,h,p,g,y[e+4],C,1272893353),g=c(g,w,h,p,y[e+7],z,4139469664),p=c(p,g,w,h,y[e+10],D,3200236656),h=c(h,p,g,w,y[e+13],q,681279174),w=c(w,h,p,g,y[e+0],C,3936430074),g=c(g,w,h,p,y[e+3],z,3572445317),p=c(p,g,w,h,y[e+6],D,76029189),h=c(h,p,g,w,y[e+9],q,3654602809),w=c(w,h,p,g,y[e+12],C,3873151461),g=c(g,w,h,p,y[e+15],z,530742520),p=c(p,g,w,h,y[e+2],D,3299628645),h=l(h,p,g,w,y[e+0],T,4096336452),w=l(w,h,p,g,y[e+7],P,1126891415),g=l(g,w,h,p,y[e+14],E,2878612391),p=l(p,g,w,h,y[e+5],R,4237533241),h=l(h,p,g,w,y[e+12],T,1700485571),w=l(w,h,p,g,y[e+3],P,2399980690),g=l(g,w,h,p,y[e+10],E,4293915773),p=l(p,g,w,h,y[e+1],R,2240044497),h=l(h,p,g,w,y[e+8],T,1873313359),w=l(w,h,p,g,y[e+15],P,4264355552),g=l(g,w,h,p,y[e+6],E,2734768916),p=l(p,g,w,h,y[e+13],R,1309151649),h=l(h,p,g,w,y[e+4],T,4149444226),w=l(w,h,p,g,y[e+11],P,3174756917),g=l(g,w,h,p,y[e+2],E,718787259),p=l(p,g,w,h,y[e+9],R,3951481745),h=n(h,i),p=n(p,o),g=n(g,r),w=n(w,a);var U=m(h)+m(p)+m(g)+m(w);return U.toLowerCase()}})}(jQuery),!function(){jQuery.cookie=function(t,e,n){if("undefined"==typeof e){var i=null;if(document.cookie&&""!=document.cookie)for(var o=document.cookie.split(";"),r=0;r<o.length;r++){var a=jQuery.trim(o[r]);if(a.substring(0,t.length+1)==t+"="){i=decodeURIComponent(a.substring(t.length+1));break}}return i}n=n||{},null===e&&(e="",n.expires=-1);var u="";if(n.expires&&("number"==typeof n.expires||n.expires.toUTCString)){var s;"number"==typeof n.expires?(s=new Date,s.setTime(s.getTime()+24*n.expires*60*60*1e3)):s=n.expires,u="; expires="+s.toUTCString()}var c=n.path?"; path="+n.path:"",l=n.domain?"; domain="+n.domain:"",f=n.secure?"; secure":"";document.cookie=[t,"=",encodeURIComponent(e),u,c,l,f].join("")}}(jQuery),!function(t){t.chainclude=function(e,n){var i=function(o,r){if("undefined"!=typeof e.length)return 0==e.length?t.isFunction(n)?n(r):null:(e.shift(),t.chainclude.load(e,i));for(var a in e){e[a](r),delete e[a];var u=0;for(var s in e)u++;return 0==u?t.isFunction(n)?n(r):null:t.chainclude.load(e,i)}};t.chainclude.load(e,i)},t.chainclude.load=function(e,n){if("object"==typeof e&&"undefined"==typeof e.length)for(var i in e)return t.include.load(i,n,e[i].callback);e=t.makeArray(e),t.include.load(e[0],n,null)},t.include=function(e,n){var i=t.include.luid++,o=function(e,o){t.isFunction(e)&&e(o),0==--t.include.counter[i]&&t.isFunction(n)&&n()};if("object"==typeof e&&"undefined"==typeof e.length){t.include.counter[i]=0;for(var r in e)t.include.counter[i]++;return t.each(e,function(e,n){t.include.load(e,o,n)})}e="object"==typeof e?e:[e],t.include.counter[i]=e.length,t.each(e,function(){t.include.load(this,o,null)})},t.extend(t.include,{luid:0,counter:[],load:function(e,n,i){if(t.include.exist(e))return n(i);var o=e.match(/\.([^\.]+)$/);if(o)switch(o[1]){case"css":t.include.loadCSS(e,n,i);break;case"js":t.include.loadJS(e,n,i);break;default:t.get(e,function(t){n(i,t)})}},loadCSS:function(e,n,i){var o=document.createElement("link");o.setAttribute("type","text/css"),o.setAttribute("rel","stylesheet"),o.setAttribute("href",e.toString()),t("head").get(0).appendChild(o),t.browser.msie?t.include.IEonload(o,n,i):n(i)},loadJS:function(e,n,i){var o=document.createElement("script"),r=/charset=([^&]+)/i.exec(e);o.setAttribute("defer",!0),o.setAttribute("charset",r&&r[1]?r[1]:"gbk"),o.src=e;var a=function(){"function"==typeof i&&i(),t(o).remove()};"onload"in o?o.onload=function(){n(a)}:t.include.IEonload(o,n,a),t("head").get(0).appendChild(o)},IEonload:function(t,e,n){t.onreadystatechange=function(){("loaded"==this.readyState||"complete"==this.readyState)&&e(n)}},exist:function(e){var n=!1;return t("head script").each(function(){return/.css$/.test(e)&&this.href==e?n=!0:/.js$/.test(e)&&this.src==e?n=!0:void 0}),n}})}(jQuery),!function(){nie.site=nie.site||function(){var t=window.self.location.hostname,e=/^((?:[^\.]+\.)+)163\.com$/i.exec(t),n={immortalconquest:1,onmyojigame:1,rulesofsurvivalgame:1,fortcraft:1,kingofhunters:1,roverrage:1,magesupremegame:1},i={"en.onmyojigame.com":"en.onmyojigame","www.knives-out.com":"knivesouttw","www.knivesout.jp":"knivesoutjp","www.onmyojiarena.jp":"onmyojiarenajp","www.onmyojiarena.tw":"onmyojiarenatw","www.onmyojiarena.us":"onmyojiarenaus","www.onmyojiarena.com":"onmyojiarena","www.cyberhunter.game":"cyberhunter","www.stormarenagame.com":"stormarenagame","www.sywmsg.com":"sywmsg","www.hellothreekingdoms.com":"hellothreekingdoms","www.cdgame.com":"cdgame","www.playdisorder.com":"playdisorder","www.mumuglobal.com":"mumuglobal","www.eclipse-isle.com":"eclipseisle"},o={"test.nie":1,"yixiu.game":1};if(e)return/^\w+\.gm\.163\.com$/i.exec(t)?null:o[e[1].substring(0,e[1].length-1)]?null:e[1].substring(0,e[1].length-1).toLowerCase();if(/^(www\.)?(\u68a6\u5e7b\u897f\u6e38|xn--owt49tjseb46a)\.(com|cn|net|\u4e2d\u56fd|xn--fiqs8s)$/i.test(t))return"xyq";if(/^(www\.)?(\u98de\u98de|xn--q35aa)\.(com|cn|net|\u4e2d\u56fd|xn--fiqs8s)$/i.test(t))return"ff";if(/^(www\.)?(\u5927\u8bdd\u897f\u6e38|xn--pss230cs2tifc)\.(com|cn|net|\u4e2d\u56fd|xn--fiqs8s)$/i.test(t))return"xy2";if(i[t])return i[t];var r=/^((?:[^\.]+\.)+)([^\.]+)\.\w+/i.exec(t);if(r&&n[r[r.length-1]])return r[r.length-1].toLowerCase();var a=/^((?:[^\.]+\.)+)leihuo\.net(\.cn)?$/i.exec(t);return a?a[1].substring(0,a[1].length-1).toLowerCase():null}()}(jQuery),!function(t){nie.useJsURL="",nie.use=function(e,n){var i=e.sort().toString(),o=t.host+"/comm/js/"+(0!=window.self.location.href.indexOf("http")?"use.php?p="+i+"&":"cache/"+t.md5(i))+".js";nie.useJsURL=o,t.include(o,n)}}(jQuery),!function(t,e){var n=function(t,n){var i,o,r=this;"PENDING"===r._status&&setTimeout(function(){for(r._status=t,o="FULFILLED"===r._status,queue=r[o?"_resolves":"_rejects"];i=queue.shift();)n=i.call(r,n)||n;r[o?"_value":"_reason"]=n,r._resolves=r._rejects=e})},i=function(t){if("function"!=typeof t)throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof i))return new i(t);var e=this;e._value,e._reason,e._status="PENDING",e._resolves=[],e._rejects=[];var o=function(t){n.apply(e,["FULFILLED"].concat([t]))},r=function(t){n.apply(e,["REJECTED"].concat([t]))};t(o,r)};i.prototype.then=function(t,e){var n=this;return new i(function(i,o){function r(e){var n="function"==typeof t&&t(e)||e;n&&"function"==typeof n.then?n.then(function(t){i(t)},function(t){o(t)}):i(n)}function a(t){t="function"==typeof e&&e(t)||t,o(t)}"PENDING"===n._status?(n._resolves.push(r),n._rejects.push(a)):n._status===FULFILLED?callback(n._value):n._status===REJECTED&&a(n._reason)})},i.prototype["catch"]=function(t){return this.then(e,t)},i.prototype.delay=function(t,e){return this.then(function(n){return i.delay(t,e||n)})},i.delay=function(t,e){return new i(function(n){setTimeout(function(){n(e),console.log("1")},t)})},i.resolve=function(t){return new i(function(e){e(t)})},i.reject=function(t){return i(function(e,n){n(t)})},i.all=function(t){if(!Array.isArray(t))throw new TypeError("You must pass an array to all.");return i(function(e,n){function i(t){return function(e){r(t,e)}}function o(t){n(t)}function r(t,n){u[t]=n,0==--c&&e(u)}for(var a=0,u=[],s=t.length,c=s;s>a;a++)t[a].then(i(a),o)})},i.race=function(t){if(!Array.isArray(t))throw new TypeError("You must pass an array to race.");return i(function(e,n){function i(t){e(t)}function o(t){n(t)}for(var r=0,a=t.length;a>r;r++)t[r].then(i,o)})},"undefined"==typeof t.Promise&&(t.Promise=i)}(window),!function($){function unique(t){for(var e,n=[],i={},o=0;null!=(e=t[o]);o++)i[e]||(n.push(e),i[e]=!0);return n}function filter(t,e){for(var n=[],i=0;i<t.length;i++)1==e(t[i],i)&&n.push(t[i]);return n}function factoryProcess(t){function e(t){_factoryList[t].canProcess=!0,_factoryList[t].did=!0,_factoryList[t].name?window[_factoryList[t].name]=_defineList[_factoryList[t].name]=_factoryList[t].factory()||_factoryList[t].name:_factoryList[t].factory(),_factoryList[t+1]&&_factoryList[t+1].canProcess&&e(t+1)}return 0>=t?(e(t),!0):_factoryList[t-1].did?(e(t),!0):(_factoryList[t].canProcess=!0,!1)}function packProcess(storeList){for(var keyVal={},i=0;i<storeList.length;i++){var name=_defineList[storeList[i]]||storeList[i],lastName=storeList[i].split(".");keyVal[lastName[lastName.length-1]]=eval("("+name+")")}return keyVal}var _defineList={},_host=$.host+"/comm/js/",_nameHash={"ui.tab":" $.tab","ui.Switch":"$.Switch","nie.util.copytext":"nie.util.copyText","nie.util.audio":"audio","util.swfobject":"$.flash","nie.util.pager":"Pager","ui.marquee2":"$.marquee2","nie.util.Lottery":"Lottery","util.bjTime":"$","nie.util.mobiShare":"MobileShare","nie.util.mobiShare2":"MobileShare","nie.util.shareV5":"nie.util.share","nie.util.shareV4":"nie.util.share","nie.util.shareV3":"nie.util.share","nie.util.videoV2":"nie.util.video","ui.lightBox":"$","nie.util.login":"Login","nie.util.login2":"Login","nie.util.fur3":"fur3","nie.util.frame":"Frame","nie.util.Comment":"Comment","nie.util.CommentV2":"Comment","nie.util.barrage":"Barrage","nie.util.niedownload":"NieDownload","nie.util.shake":"Shake","nie.util.gallery":"Gallery","nie.util.galleryV2":"Gallery","nie.util.imageshow":"ImageShow","nie.util.GamePackage":"GamePackage","nie.util.PopDialog":"PopDialog","nie.util.imageUploader":"ImageUploader","nie.util.imageCropper":"ImageCropper","nie.util.FormCheck":"FormCheck","nie.util.nosUploader":"nosUploader","nie.util.nosUploaderV2":"NosUploader","nie.util.gamestart":"GameStart","nie.util.bullet":"BulletUtil","nie.util.indexorder":"IndexOrder","nie.util.wxauth":"WxAuth","nie.util.gameorder":"GameOrder","nie.util.gameorder_m":"GameOrder","nie.util.map3d":"Map3D","nie.util.metro":"ImageTextMetro","nie.util.moretips":"moreTips","nie.util.barrage2":"BarrageFC"},_verHash={"nie.util.pager":2,"nie.util.copytext":6,"nie.util.videoV2":14,"nie.util.audio":6,"ui.lightBox":5,"nie.util.mobiShare2":15,"nie.util.login":19,"nie.util.login2":56,"nie.util.Lottery":6,"nie.util.fur2":6,"nie.util.fur3":44,"util.bjTime":4,"nie.util.Comment":25,"nie.util.frame":5,"nie.util.shareV5":6,"nie.util.niedownload":5,"nie.util.GamePackage":5,"nie.util.imageUploader":17,"nie.util.imageCropper":9,"nie.util.PopDialog":2,"nie.util.FormCheck":5,"nie.util.imageshow":6,"nie.util.galleryV2":6,"nie.util.bullet":15,"nie.util.indexorder":9,"nie.util.gamestart":21,"nie.util.wxauth":3,"nie.util.nosUploaderV2":1,"nie.util.gameorder_m":28,"nie.util.gameorder":29,"nie.util.map3d":5,"nie.util.metro":0,"nie.util.moretips":18},_factoryList=[],_factoryIndex=0;nie.define=function(t,e){"string"!=typeof t&&(e=t,t=null),e.__nieIndex=_factoryIndex,_factoryIndex+=1,_factoryList.push({factory:e,name:t});var n=e.toString().match(/nie\.require\([^\)]+\)/g),i="",o=0;if(t&&(_defineList[t]=!0),!n||!n.length)return factoryProcess(e.__nieIndex);for(var r=0;r<n.length;r++)n[r]=n[r].match(/\(([^\)]+)\)/i)[1].replace(/'|"/g,"");if(n=unique(n),n=filter(n,function(t){return _defineList[t]?!1:!0}),!n||!n.length)return factoryProcess(e.__nieIndex);for(n=n.sort(function(t,e){return t>e}),r=0;r<n.length;r++)i+=n[r].replace(/\./g,"/")+".js,",_verHash[n[r]]&&(o+=_verHash[n[r]]);i=_host+"??"+i+"v="+o+".js",$.include(i,function(){for(var t=0;t<n.length;t++){var i=n[t];_defineList[i]=_nameHash[i]||i}factoryProcess(e.__nieIndex)})},nie.require=function(name){return name=_defineList[name]||name,"string"!=(typeof name).toLowerCase()?name:eval("("+name+")")},nie.pack=function(t){var e="",n=0,o=t;if(t="string"==typeof t?[t]:t,t=unique(t),t=filter(t,function(t){return _defineList[t]?!1:!0}),!t||!t.length)return packProcess(o);for(t=t.sort(function(t,e){return t>e}),i=0;i<t.length;i++)e+=t[i].replace(/\./g,"/")+".js,",_verHash[t[i]]&&(n+=_verHash[t[i]]);return e=_host+"??"+e+"v="+n+".js",new Promise(function(n){$.include(e,function(){for(var e=0;e<t.length;e++){var i=t[e];_defineList[i]=_nameHash[i]||i}var r=packProcess(o);n(r)})})},nie.require=BJ_REPORT.tryJs().spyCustom(nie.require),nie.define=BJ_REPORT.tryJs().spyCustom(nie.define),nie.pack=BJ_REPORT.tryJs().spyCustom(nie.pack)}(window.jQuery||window.Zepto),!function(t){nie.config=nie.config||{site:nie.site,stats:{loaded:!1,defaultRun:function(){try{return window.top!=window.self||window.top.location.hostname!=window.self.location.hostname?!1:!0}catch(t){return!1}}(),name:"Devilfish",clickStats:!1,clickStatsPrecent:null,id:null,url:{_data:[],add:function(t,e){var n="http://clickgame.163.com/"+nie.config.site+"/"+t,i=e||null;nie.config.stats.url._data.push({url:n,title:i}),nie.config.stats.loaded&&nie.config.stats.url._run(n,i)},addto:function(t,e,n){var i=window.location.protocol+"//"+window.location.hostname+window.location.pathname+"?"+t,o=e||null;n=n||window._ntes_nacc,nie.config.stats.url._data.push({url:i,title:o,site:n}),nie.config.stats.loaded&&nie.config.stats.url._run(i,o,n)},_cb:function(){for(var t=nie.config.stats.url._data,e=0,n=t.length;n>e;e++)nie.config.stats.url._run(t[e].url,t[e].title,t[e].site)},_run:function(e,n,i){t.isFunction(neteaseTracker)&&neteaseTracker(!0,e,n,i?i:"clickgame")}}},topBar:{hasRun:!1,time:2e3},copyRight:new function(){var t=1,e=!1,n=function(n,i){(i||!e)&&(t=n,e=!0)};this.domain="",this.showmore=0,this.product=nie.site,this.getStyle=function(){return t},this.setSiteDefaultStyle=function(t){e||("white"==t?n(2,!0):(t="gray")&&n(3,!0))},this.setGray=function(){n(3)},this.setWhite=function(){n(2)},this.setNormal=function(){n(1)}}}}(jQuery),nie.util=nie.util||{},nie.util.addStyle=function(t){var e;document.all?(e=document.createStyleSheet(),e.cssText=t):(e=document.createElement("style"),e.type="text/css",e.textContent=t);try{document.getElementsByTagName("head")[0].appendChild(e)}catch(n){}e=null},nie.util.ajax=function(t){var e=window.location.hostname;return"127.0.0.1"!=e&&"locahost"!=e&&"test.nie.163.com"!=e&&0!=e.indexOf("10.")&&0!=e.indexOf("192.")&&e.indexOf("test.nie.163.com")<0?$.ajax(t):(url=t.url.replace(/#\S*/gi,""),void $.ajax({type:"get",url:"//webpub.nie.netease.com/home/tool/proxy",dataType:"jsonp",data:"url="+url,success:function(e){t.success&&t.success(e.data)},error:function(){t.error&&t.error("\u8bf7\u6c42\u5931\u8d25")}}))},!function(t){nie.util.stats=function(){var e={nb:"vipnb",gs:"gssumr","wy.xy3":"xy3",pk:"xyw",xdw:"xyw",xc:"itown",jl:"mc",jlcs:"mc",pet:"petkingdom",sg:"sgtx",zg:"zgfy",qn:"qnyh",qn2:"qnyh","v.cc":"cc",yx:"ipush",tx3:"tx2","game.campus":"gamecampus",y3:"dota",lj:"gamex","bang.tx3":"tx2",f:"f4",gamef:"f4",dtws2:"dt2",dtws:"dt2",zd:"zdcq",zmq:"zdcq",yxsg:"dota",dj:"esports","xyq.baike":"xyq","xy3.baike":"xy3","y3.baike":"dota","xy2.baike":"xy2","xdw.baike":"xyw","my.baike":"my","tx3.baike":"tx2","x3.baike":"x3",kyx:"kanyouxi","wst.webapp":"xyq",wj:"f4",newwar:"xxx","tuku.xyq":"xyq","so.xyq":"xyq",story:"xy2","zgmh.baike":"zgmh","daren.nie":"daren","game.academy":"gameacademy",wh2:"wh","b2c.nb":"vipnb",fire:"xcbw",bw:"xcbw",xcbw:"xcbwsy",qnyh:"qnyhc",game:"nie","mall.gs":"gssumr","pm.gs":"gssumr",ma:"ma2",z:"z1",cssg:"blcx",gzbnl:"yszj",xn:"mxxc",xqn:"qnyh",ldz:"raven",n:"nsh","tuku.tx":"tx",mc:"mc163",dt:"dtm","wx.game":"wx","new.hi":"hi",au:"dance","en.onmyojigame":"onmyojigame",rulesofsurvivalgame:"ros"},n=null,i=function(t){return e[t]||t};if(null==nie.config.stats.id){if(null!=nie.config.site)if("undefined"!=typeof e[nie.config.site])n=i(nie.config.site);else{var o=nie.config.site.match(/([^.]+)\.webapp/);if(o&&o.length>1&&(n=i(o[1].split("-")[0])),"v"==nie.config.site){var r=window.location.pathname.split("/");r="paike"==r[1]?r[2]:r[1],n=i(r)}o=nie.config.site.match(/([^.]+)\.baike/),o&&o.length>1&&(n=i(o[1].split("-")[0])),o=nie.config.site.match(/tuku\.([^.]+)/),o&&o.length>1&&(n=i(o[1].split("-")[0])),o=nie.config.site.match(/([^.]+)\.tuku/),o&&o.length>1&&(n=i(o[1].split("-")[0])),null==n&&nie.config.site.split(".").length<3&&(n=i(nie.config.site))}}else n=i(nie.config.stats.id);null!=n&&t.include("//analytics.163.com/ntes.js",function(){nie.config.stats.loaded=!0,_ntes_nacc=n,t.isFunction(neteaseTracker)&&neteaseTracker(),nie.config.stats.clickStats&&(nie.config.stats.clickStatsPrecent?neteaseClickStat(nie.config.stats.clickStatsPrecent):neteaseClickStat()),nie.config.stats.url._cb()})}}(jQuery);var LocalData={hname:location.hostname?location.hostname:"localStatus",dataDom:null,isLocalStorage:function(){try{return window.localStorage?!0:!1}catch(t){return!1}},initDom:function(){if(!this.dataDom)try{this.dataDom=document.body,this.dataDom.addBehavior("#default#userData");var t=new Date;t=t.getDate()+30,this.dataDom.expires=t.toUTCString()}catch(e){return!1}return!0},set:function(t,e){if(this.isLocalStorage())try{window.localStorage.setItem(t,e)}catch(n){}else if(this.initDom())try{this.dataDom.load(this.hname),this.dataDom.setAttribute(t,e),this.dataDom.save(this.hname)}catch(n){}},get:function(t){if(this.isLocalStorage())try{return window.localStorage.getItem(t)}catch(e){return null}else if(this.initDom())try{return this.dataDom.load(this.hname),this.dataDom.getAttribute(t)}catch(e){return null}},remove:function(t){this.isLocalStorage?localStorage.removeItem(t):this.initDom()&&(this.dataDom.load(this.hname),this.dataDom.removeAttribute(t),this.dataDom.save(this.hname))}},__GetScript=function(t){function e(t){if(1==/iphone|ios|android|ipod/i.test(navigator.userAgent.toLowerCase())||0==/msie/i.test(navigator.userAgent))return n(t);var e="script"+Math.floor(1e5*Math.random()+1e5),i=0,o=(new Date,document.createElement("script"));o.type="text/javascript";var r=o.onerror=function(e){return i?(clearTimeout(i),t.error(),document.body.removeChild(o),window.random=null,void("undefined"!=typeof BJ_REPORT&&BJ_REPORT.report(1==e?"["+nie.site+"][adconfig_error][timeout][data:"+t.data+"]":"["+nie.site+"][adconfig_error][interface_error][data:"+t.data+"]"))):!1};window[e]=function(){if(!i)return!1;clearTimeout(i);try{t.success.apply(null,arguments)}catch(e){t.error()}document.body.removeChild(o),window.random=null},i=setTimeout(function(){r(!0),i=0},t.time||3e3),o.src=t.url+"?"+t.data+"&callback="+e,document.body.appendChild(o)}function n(e){new Date,t.ajax({url:e.url+"?"+e.data,dataType:"json",timeout:e.time||3e3,type:"POST",success:function(t){try{e.success(t)}catch(n){e.error()}},error:function(n,i,o){return"yys"!=nie.site?e.error():(BJ_REPORT.report("["+nie.site+"][adconfig_ajax_error][data:"+e.data+"][status:"+i+"][error:"+o+"][msg:"+n.responseText+"]"),void(("abort"==i||"timeout"==i)&&t.ajax({url:"http://106.2.69.124/fz/interface/frontend/fz.do?"+e.data,dataType:"json",timeout:1e4,type:"GET",success:function(t){e.success(t),BJ_REPORT.report("["+nie.site+"][adconfig_ip_success][repeat_"+nie.site+"][data:"+e.data+"]")},error:function(t,n,i){e.error(),BJ_REPORT.report("["+nie.site+"][adconfig_ip_error][repeat_"+nie.site+"][status:"+n+"][error:"+i+"][msg:"+t.responseText+"]")}})))}})}return e}(window.jQuery||window.Zepto),ADBase=function(t){function e(t){t=t||{},t=t instanceof Array?t:[t],n(t)}function n(t){for(var e=[],n=[],o=!!t[0].noCache,r=t[0].time||15e3,u=(new Date,0);u<t.length;u++)e.push(t[u].pos),n.push(t[u].callback);e=e.join(","),f({url:p.getData,data:"pos="+e,time:r,success:function(t){if(t.succ&&"00"==t.result.code){var r=t.result.content;i(r,e,n,o),setTimeout(function(){s(e)},1e3)}else a(e,n),"undefined"!=typeof BJ_REPORT&&BJ_REPORT.report("["+l.site+"][adconfig_error][interface_fail][data:"+m.stringify(t)+"]")},error:function(){a(e,n)}})}function i(t,e,n,i){c(".adbase-ctn").css("background","none");var a=i?{}:o(e);a=r(a,t),i||d.set(e,m.stringify(a));for(var s=0;s<n.length;s++)n[s](!0,a);u()}function o(t){var e=d.get(t);return e?m.parse(e):{}}function r(t,e){for(var n in e)!t[n]||t[n].length<1?t[n]=e[n]:t[n]&&t[n].length&&e[n]&&e[n].length?t[n]=e[n]:t[n]&&t[n].length&&(!e[n]||e[n].length<1)?t[n]=[]:(!e[n]||e[n].length<1)&&(!t[n]||t[n].length<1)&&(t[n]=[]);return t}function a(t,e){var n=d.get(t);if(n){n=m.parse(n),c(".adbase-ctn").css("background","none");for(var i=0;i<e.length;i++)e[i](!0,n);u()}else{c(".adbase-ctn").css("background","url("+c.host+"/comm/js/nie/util/img/error.png) center center no-repeat");for(var i=0;i<e.length;i++)e[i](!1,{})}}function u(){c(".adbase-ctn").each(function(t,e){c(e).contents().length<1&&c(e).css("background","url("+c.host+"/comm/js/nie/util/img/error.png) center center no-repeat")})}function s(t){var e=new Image;e.src=[p.report,"?pos=",t].join("")}var c=t.jQuery||t.Zepto,l=t.nie,f=t.__GetScript,m=t.JSON,d=t.LocalData,h=(t.ADData,"//a.game.163.com"),p={getData:h+"/fz/interface/frontend/fz.do",report:h+"/fz/interface/frontend/viewstatics.do"},g={config:e,flag:!0};return g}(window,document);!function(t){nie.util.copyRight=nie.util.copyRight||function(){function e(){var e="",r=t(window).width(),u=function(t){"m"==e?i.html(t):n.html(t)};0==n.length&&i.length>0&&(e="m"),t.ajax({url:"https://websource.nie.netease.com/copyright/get/byreferer",dataType:"jsonp",data:{type:e,browserversion:a,domain:nie.config.copyRight.domain||"",showmore:nie.config.copyRight.showmore||0},success:function(n){if(n.success)t(function(){2==nie.config.copyRight.getStyle()&&(n.result.copyright=n.result.copyright.replace(/(\/images\/([^\.\/]*)\.)\d{1}(\.png)/gi,"$12$3")),u(n.result.copyright)}),n.result.browsertips&&0==o.length&&r>1e3&&!s&&t("body").prepend(n.result.browsertips);else{var i=n.msg||n.errmsg;u(e,"\u7248\u6743\u52a0\u8f7d\u5931\u8d25\uff1a"+i)}},error:function(t){u(e,"\u7248\u6743\u52a0\u8f7d\u5931\u8d25\uff1a"+JSON.stringify(t))}})}var n=t("#NIE-copyRight"),i=t(".NIE-copyRight_m"),o=t("#NIE-warning-tips"),r=navigator.userAgent,a=+(r.match(/MSIE (\d+)/)&&RegExp.$1),u=/cbg.163.com|gift.163.com/,s=u.test(window.location.host);(n.length>0||i.length>0||0!=a)&&e()}}(jQuery),!function(t){nie.util.union=nie.util.union||{unionFabUrlList:["http://dh2.163.com/biz/wm/","http://x3.163.com/biz/wm/","http://x3.163.com/biz/wm01/","http://x3.163.com/biz/wm2/","http://y3.163.com/biz/wm/","http://y3.163.com/biz/wm3/","http://wh.163.com/wm/","http://wh.163.com/biz/wm1/","http://wh.163.com/wm1/","http://wh.163.com/biz/wm3/","http://wh2.163.com/biz/wm/","http://zh.163.com/fab/wm1/","http://xy2.163.com/biz/wm1/","http://xy2.163.com/","http://xy2.163.com/biz/wm2/","http://x3.163.com/biz/wm2/","http://dtws2.163.com/biz/wm01/","http://dtws2.163.com/biz/wm02/","http://dtws2.163.com/biz/wm1/","http://dtws.163.com/biz/wm/","http://dtws2.163.com/biz/wm/","http://qn2.163.com/biz/wm1/?id=01/","http://qn2.163.com/biz/wm2/","http://qn2.163.com/biz/wm/","http://qn2.163.com/biz/wm3/","http://qn2.163.com/biz/wm1/","http://qn2.163.com/biz/wm01/","http://tx3.163.com/biz/wm2/","http://tx3.163.com/biz/wm3/","http://tx3.163.com/biz/wm/","http://tx3.163.com/biz/wm1/","http://xyq.163.com/fab3/","http://xyq.163.com/biz/wm/","http://xyq.163.com/wmc/","http://xyq.163.com/biz/wm1407/","http://xdw.163.com/biz/wm2/","http://xdw.163.com/biz/wm1/","http://dh2.163.com/biz/wm1/"],unionApi:"http://union.gad.netease.com/union2/monitor/point_code",url:{},qUrsUnion:{},init:function(){this.url.raw=window.location.href,this.url.isUnion=!1},processUrl:function(){function e(t,e){var n=new RegExp("(^|&)"+t+"=([^&]*)(&|$)"),i=e.match(n);return null!==i?unescape(i[2]):null}function n(n){var i=n.indexOf("?"),o={};if(i>0){o.req=n.substring(0,i);var r=n.substring(i+1),a=["login","username","product"];t.each(a,function(t,n){var i=e(n,r);i&&(o[n]=i)})}else o.req=n;return"/"!=o.req.charAt(o.req.length-1)&&(o.req+="/"),o}if(t.inArray(this.url.raw,this.unionFabUrlList)>=0)this.url.isUnion=!0,this.url.req=this.url.raw;else{var i=n(this.url.raw);this.url.req=i.req,i.hasOwnProperty("login")&&(this.url.isUnion=!0,this.url.urs=i.login),i.hasOwnProperty("username")&&(this.url.isUnion=!0,this.url.urs=i.username),i.hasOwnProperty("product")&&(this.url.isUnion=!0,this.url.product=i.product)}},setupUnion:function(e){function n(e){t.getScript(e)}function i(t,e){(new Image).src=t+"&urs="+e}e.hasOwnProperty("0")&&n(e[0]),e.hasOwnProperty("1")&&(this.qUrsUnion.url=e[1]),e.hasOwnProperty("2")&&i(e[2],this.url.urs),e.hasOwnProperty("3")&&i(e[3],this.url.urs)},getUnionCode:function(){var e=this;t.ajax({type:"get",url:e.unionApi,data:{url:e.url.req,product:e.url.product},dataType:"jsonp",success:function(t){e.setupUnion(t)}})},run:function(){}}}(jQuery); ;/*!src/app.mobi.js*/ BJ_REPORT.tryJs().spyAll(),$(function(){window.onerror=function(){},nie.config.stats.defaultRun&&setTimeout(function(){nie.util.stats()},0),setTimeout(function(){nie.util.copyRight();var t=(document.documentElement||document.body).innerHTML;t.match(/\[an\serror\soccurred\swhile\sprocessing\sthis\sdirective\]/i)&&BJ_REPORT.report("include_error")},0)});
/** Copyright 2014 Gordon Williams (gw@pur3.co.uk) This Source Code is subject to the terms of the Mozilla Public License, v2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. ------------------------------------------------------------------ Handle URLS of the form http://www.espruino.com/webide?... These are sent from background.js and are picked up by the Web IDE ------------------------------------------------------------------ **/ "use strict"; (function(){ function init() { // Try and automatically handle the URL if we're served from somewhere we know if (typeof window!=="undefined" && window.location && (window.location.origin=="https://localhost" || window.location.origin=="https://www.espruino.com")) { setTimeout(function() { handle(window.location.href); }, 200); } } function handleQuery(key, val) { Espruino.Core.Code.switchToCode(); // if in blockly switch(key){ case "code": // Passing "encodedURIcomponent code" within the URL Espruino.Core.EditorJavaScript.setCode(val); break; case "codeurl": // Passing a URL for code within the URL Espruino.Core.EditorJavaScript.setCode("// Loading from "+val+"..."); $.ajax({ url: val, cache: false }).done(function( data ) { Espruino.Core.EditorJavaScript.setCode(data); }).error(function(){ Espruino.Core.EditorJavaScript.setCode("// Error loading "+val); }); break; case "upload": // Get "encodedURIcomponent code" from URL and upload it Espruino.Core.MenuPortSelector.ensureConnected(function() { Espruino.Core.Terminal.focus(); // give the terminal focus Espruino.callProcessor("sending"); Espruino.Core.CodeWriter.writeToEspruino(val); Espruino.Core.EditorJavaScript.setCode(val); }); break; case "gist": // Get code from a gist number in the URL Espruino.Core.EditorJavaScript.setCode("// Loading Gist "+val+"..."); $.getJSON("https://api.github.com/gists/"+ val, function(data){ if(data && data.files){ var keys = Object.keys(data.files); if(keys.length > 0){ Espruino.Core.EditorJavaScript.setCode(data.files[keys[0]].content); } } }).error(function(){ Espruino.Core.EditorJavaScript.setCode("// Error loading Gist "+val); }); break; case "settings": Espruino.Plugins.SettingsProfile.updateFromJson(val); break; } } function handle(url) { console.log("Handling URL "+JSON.stringify(url)); url = (url); var h = url.indexOf("#"); var q = url.indexOf("?"); if (h>=0) { var hash = (q>h) ? url.substr(h+1,q) : url.substr(h+1); if (hash.substr(0,7)=="http://" || hash.substr(0,8)=="https://") { handleQuery("codeurl",hash); } } if (q<0) return; var query = url.substr(q+1).split("&"); for (var i in query) { var eq = query[i].split("="); if (eq.length==1) handleQuery(eq[0],undefined); else if (eq.length==2) handleQuery(decodeURIComponent(eq[0]),decodeURIComponent(eq[1])); else console.warn("Didn't understand query section "+JSON.stringify(query[i])); } } Espruino.Plugins.URLHandler = { init : init, handle : handle, // handle a URL }; }());
import React from 'react'; const ShopItem = ({ name, price, onPut }) => { return ( <div className="ShopItem" onClick={() => onPut(name, price)}> <h4>{name}</h4> <div>{price}원</div> </div> ); }; export default ShopItem;
webpackJsonp([8],{ /***/ 873: /***/ (function(module, exports, __webpack_require__) { var disposed = false function injectStyle (ssrContext) { if (disposed) return __webpack_require__(896) } var normalizeComponent = __webpack_require__(202) /* script */ var __vue_script__ = __webpack_require__(898) /* template */ var __vue_template__ = __webpack_require__(899) /* template functional */ var __vue_template_functional__ = false /* styles */ var __vue_styles__ = injectStyle /* scopeId */ var __vue_scopeId__ = null /* moduleIdentifier (server only) */ var __vue_module_identifier__ = null var Component = normalizeComponent( __vue_script__, __vue_template__, __vue_template_functional__, __vue_styles__, __vue_scopeId__, __vue_module_identifier__ ) Component.options.__file = "resources/assets/js/components/h5/AlipayOrder.vue" /* hot reload */ if (false) {(function () { var hotAPI = require("vue-hot-reload-api") hotAPI.install(require("vue"), false) if (!hotAPI.compatible) return module.hot.accept() if (!module.hot.data) { hotAPI.createRecord("data-v-ab7facce", Component.options) } else { hotAPI.reload("data-v-ab7facce", Component.options) } module.hot.dispose(function (data) { disposed = true }) })()} module.exports = Component.exports /***/ }), /***/ 896: /***/ (function(module, exports, __webpack_require__) { // style-loader: Adds some css to the DOM by adding a <style> tag // load the styles var content = __webpack_require__(897); if(typeof content === 'string') content = [[module.i, content, '']]; if(content.locals) module.exports = content.locals; // add the styles to the DOM var update = __webpack_require__(363)("719bf83a", content, false, {}); // Hot Module Replacement if(false) { // When the styles change, update the <style> tags if(!content.locals) { module.hot.accept("!!../../../../../node_modules/css-loader/index.js!../../../../../node_modules/vue-loader/lib/style-compiler/index.js?{\"vue\":true,\"id\":\"data-v-ab7facce\",\"scoped\":false,\"hasInlineConfig\":true}!../../../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./AlipayOrder.vue", function() { var newContent = require("!!../../../../../node_modules/css-loader/index.js!../../../../../node_modules/vue-loader/lib/style-compiler/index.js?{\"vue\":true,\"id\":\"data-v-ab7facce\",\"scoped\":false,\"hasInlineConfig\":true}!../../../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./AlipayOrder.vue"); if(typeof newContent === 'string') newContent = [[module.id, newContent, '']]; update(newContent); }); } // When the module is disposed, remove the <style> tags module.hot.dispose(function() { update(); }); } /***/ }), /***/ 897: /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(105)(false); // imports // module exports.push([module.i, "\n.imageStyle img {\n width: 100%;\n height: 100%;\n display: block;\n}\n.van-card__thumb {\n width: 100px;\n height: 70px;\n margin-right: 10px;\n /* -webkit-box-align: center; */\n /* -webkit-align-items: center; */\n /* align-items: center; */\n /* -webkit-box-pack: center; */\n -webkit-justify-content: center;\n /* justify-content: center; */\n /* -webkit-box-flex: 0; */\n -webkit-flex: none;\n /* flex: none; */\n /* margin-top: 20px; */\n}\n.van-button--warning {\n color: #fff;\n background-color: #409eff;\n border: 1px solid #409eff;\n}\n.van-card {\n position: relative;\n color: #323233;\n padding: 10px 15px;\n font-size: 14px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n background-color: #fafafa;\n}\n.van-card__content, .van-card__header {\n height: 44px;\n}\n.van-card__title {\n line-height: 16px;\n max-height: 32px;\n font-weight: 500;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n padding-top: 5px;\n}\n.van-card__bottom, .van-card__desc {\n line-height: 20px;\n margin-top: 4px;\n font-size: 14px;\n}\n\n", ""]); // exports /***/ }), /***/ 898: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vant__ = __webpack_require__(364); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_vue__ = __webpack_require__(11); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_vue__); // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // __WEBPACK_IMPORTED_MODULE_1_vue___default.a.use(__WEBPACK_IMPORTED_MODULE_0_vant__["a" /* GoodsAction */]); // .use(GoodsActionBigBtn) // .use(GoodsActionMiniBtn); /* harmony default export */ __webpack_exports__["default"] = ({ data: function data() { return { activeKey: 0, categories: {}, store: {}, form: { account: '', fee: '' }, accountOptions: [], accountShow: false, showNumber: false, images: ["h5.keeper.test/images/banner1.jpg", "h5.keeper.test/images/banner2.jpg"], imageURL: "", hot: '热卖中', price: '', originPrice: '', desc: '微辣', title: '', number: 0, totalAmount: 0, dishData: {}, customerDishDetail: [] }; }, created: function created() {}, computed: {}, mounted: function mounted() { this.handleCategories(); this.handleBanner(); this.dishes(); }, methods: { check: function check(category_id, key) { if (key === 0) { document.documentElement.scrollTop = 1; } else { document.getElementById(category_id).scrollIntoView(); } }, dishes: function dishes(category_id) { var _this = this; var merchant_id = this.$route.query.merchant_id; // console.log(merchant_id); this.$api.h5DishList({ merchant_id: merchant_id, category_id: category_id }).then(function (res) { if (res.status === 1) { _this.dishData = res.data; } else if (res.status === 3) { __WEBPACK_IMPORTED_MODULE_0_vant__["d" /* Toast */].fail(res.message); // this.$router.push({name: 'login', query: {}}); } else { __WEBPACK_IMPORTED_MODULE_0_vant__["d" /* Toast */].fail(res.message); } }); }, handleCategories: function handleCategories() { var _this2 = this; var merchant_id = this.$route.query.merchant_id; this.$api.h5Category({ merchant_id: merchant_id }).then(function (res) { _this2.categories = res.data; // let category_id = res.data[0].id; // this.dishes(category_id); }).catch(function (err) { _this2.$message({ type: 'error', message: '类目获取失败' }); }); }, handleBanner: function handleBanner() { var _this3 = this; var merchant_id = this.$route.query.merchant_id; this.$api.h5Banner({ merchant_id: merchant_id }).then(function (res) { _this3.store = res.data; }).catch(function (err) { _this3.$message({ type: 'error', message: 'store获取失败' }); }); }, sub: function sub(dish) { var dishId = dish.id; var id = 'number' + dishId; var numberObject = document.getElementById(id); var numberValue = Number(numberObject.value); var finalNumber = 0; if (numberValue > 0) { numberObject.setAttribute("style", "width: 40px; text-align: center;color: #f44"); finalNumber = numberValue - 1; numberObject.value = finalNumber; if (this.customerDishDetail.length > 0) { for (var i = 0; i < this.customerDishDetail.length; i++) { if (this.customerDishDetail[i].dish_id === dishId) { this.customerDishDetail[i].number = finalNumber; if (finalNumber < 1) { this.customerDishDetail.splice(i, 1); } // 总价减去次价格 this.totalAmount -= Number(dish.amount) * 100; } } } } if (finalNumber < 1) { numberObject.setAttribute("style", "width: 40px; text-align: center;"); } // if (this.totalAmount > 0) { // document.getElementById('pay').attributes("style", "color: #fff;background-color: #f44;border: 1px solid #f44;") // } else { // document.getElementById('pay').attributes("style", "color: #fff;background-color: #fff;border: 1px solid #fff;") // } }, add: function add(dish) { var dishId = dish.id; var id = 'number' + dishId; var numberObject = document.getElementById(id); var numberValue = Number(numberObject.value); var finalNumber = 0; numberObject.setAttribute("style", "width: 40px; text-align: center;color: #f44"); finalNumber = numberValue + 1; numberObject.value = finalNumber; // console.log(numberObject.value); if (this.customerDishDetail.length > 0 && numberValue > 0) { for (var i = 0; i < this.customerDishDetail.length; i++) { if (this.customerDishDetail[i].dish_id === dishId) { this.customerDishDetail[i].number = finalNumber; // 总价增加 this.totalAmount += Number(dish.amount) * 100; } } } else { var newJson = {}; newJson.dish_id = dishId; newJson.number = finalNumber; this.customerDishDetail.push(newJson); // 总价增加 this.totalAmount += Number(dish.amount) * 100; } // if (this.totalAmount > 0) { // document.getElementById('pay').attributes("style", "color: #fff;background-color: #f44;border: 1px solid #f44;") // } else { // document.getElementById('pay').attributes("style", "color: #fff;background-color: #fff;border: 1px solid #fff;") // } // console.log(this.customerDishDetail); // console.log(Number(dish.amount), this.totalAmount, dish.amount); }, onSubmit: function onSubmit() { var _this4 = this; // console.log(this.totalAmount); if (this.totalAmount > 0) { var amount = this.totalAmount; var detail = this.customerDishDetail; var open_id = this.$route.query.open_id; var merchant_id = this.$route.query.merchant_id; var seat_id = this.$route.query.seat_id; var table_id = this.$route.query.table_id; var query = this.$route.query; var jsApiParameters = ''; this.$api.h5Pay({ amount: amount, detail: detail, open_id: open_id, merchant_id: merchant_id, seat_id: seat_id, table_id: table_id, query: query }).then(function (res) { // this.$message({ // type: 'info', // message: document.getElementsByTagName('body')[0].append(res.pay_form) // }); // alert(data.pay_form); if (res.status === 1) { // this.html = res.pay_form; var form = res.pay_form; var div = document.createElement('div'); div.innerHTML = form; document.body.appendChild(div); document.forms[0].submit(); } else { _this4.$message({ type: 'info', message: '网络错误,请稍后再试' }); } }).catch(function (error) { _this4.$message({ type: 'info', message: error }); }); } // console.log(this.$route.params); }, onConfirmAccount: function onConfirmAccount(value, index) { this.form.account = value; this.accountShow = false; }, onInput: function onInput(key) { this.form.fee += key; }, onDelete: function onDelete() { this.form.fee = ''; }, onClose: function onClose() { this.showNumber = false; }, // 表单提交 onSubmitForm: function onSubmitForm() { var _this5 = this; this.$validator.validateAll().then(function (result) { if (result) { _this5.$api.FinanceWithdrawApply(_this5.form).then(function (res) { if (res.status === 1) { __WEBPACK_IMPORTED_MODULE_0_vant__["d" /* Toast */].success(res.message); } else if (res.status === 3) { __WEBPACK_IMPORTED_MODULE_0_vant__["d" /* Toast */].fail(res.message); _this5.$router.push({ name: 'login', query: {} }); } else { __WEBPACK_IMPORTED_MODULE_0_vant__["d" /* Toast */].fail(res.message); } }).catch(function (err) { __WEBPACK_IMPORTED_MODULE_0_vant__["d" /* Toast */].fail('表单数据异常!'); }); } }); } } }); /***/ }), /***/ 899: /***/ (function(module, exports, __webpack_require__) { var render = function() { var _vm = this var _h = _vm.$createElement var _c = _vm._self._c || _h return _c("div", { staticStyle: { "margin-top": "20px" } }, [ _c( "div", { staticClass: "body", staticStyle: { margin: "0", padding: "0", height: "100%" } }, [ _c( "div", { staticClass: "main", staticStyle: { width: "100%", margin: "0", padding: "0" } }, [ _c( "div", { staticClass: "head", staticStyle: { position: "fixed", width: "100%", top: "0", "line-height": "150px", "z-index": "9999" } }, [ _c( "van-swipe", { staticClass: "imageStyle", attrs: { autoplay: 3000, height: 150, "indicator-color": "white" } }, [ _vm.store.banner1 ? _c("van-swipe-item", [ _c("img", { attrs: { src: _vm.store.banner1 } }) ]) : _vm._e(), _vm._v(" "), _vm.store.banner2 ? _c("van-swipe-item", [ _c("img", { attrs: { src: _vm.store.banner2 } }) ]) : _vm._e(), _vm._v(" "), _vm.store.banner3 ? _c("van-swipe-item", [ _c("img", { attrs: { src: _vm.store.banner3 } }) ]) : _vm._e() ], 1 ) ], 1 ), _vm._v(" "), _c( "div", { staticStyle: { position: "absolute", width: "100%", "margin-top": "150px" } }, [ _c( "div", { staticStyle: { width: "20%", position: "fixed" } }, [ _c( "van-sidebar", { model: { value: _vm.activeKey, callback: function($$v) { _vm.activeKey = $$v }, expression: "activeKey" } }, _vm._l(_vm.categories, function(category, key) { return _c("van-sidebar-item", { attrs: { title: category.name }, on: { click: function($event) { return _vm.check(category.id, key) } } }) }), 1 ) ], 1 ), _vm._v(" "), _c( "div", { staticStyle: { width: "80%", position: "absolute", "margin-left": "75px", overflow: "scroll" }, attrs: { id: "dish" } }, _vm._l(_vm.dishData, function(category) { return _c( "van-swipe-cell", { key: category.id, attrs: { "right-width": 10, "on-close": _vm.onClose, id: category.id } }, _vm._l(category.dishes, function(dish) { return _c( "div", [ _c( "van-cell-group", [ _c( "van-card", { attrs: { price: dish.amount, title: dish.name, thumb: dish.logo, "origin-price": dish.original_amount } }, [ _c( "div", { attrs: { slot: "footer" }, slot: "footer" }, [ _c( "div", { staticClass: "amount_container" }, [ _c( "div", { staticClass: "amount_box" }, [ _c( "van-button", { attrs: { size: "mini" }, on: { click: function($event) { return _vm.sub(dish) } } }, [_vm._v("-")] ), _vm._v(" "), _c("input", { staticStyle: { width: "40px", "text-align": "center" }, attrs: { type: "number", value: "0", id: "number" + dish.id, maxlength: "2", pattern: "[0-9]*", readonly: "readonly" } }), _vm._v(" "), _c( "van-button", { attrs: { size: "mini" }, on: { click: function($event) { return _vm.add(dish) } } }, [_vm._v("+")] ) ], 1 ) ] ) ] ) ] ) ], 1 ) ], 1 ) }), 0 ) }), 1 ) ] ), _vm._v(" "), _c("van-submit-bar", { attrs: { id: "pay", price: _vm.totalAmount, "button-text": "提交订单" }, on: { submit: function($event) { return _vm.onSubmit() } } }) ], 1 ) ] ) ]) } var staticRenderFns = [] render._withStripped = true module.exports = { render: render, staticRenderFns: staticRenderFns } if (false) { module.hot.accept() if (module.hot.data) { require("vue-hot-reload-api") .rerender("data-v-ab7facce", module.exports) } } /***/ }) });
import React from 'react'; import {Switch, Route} from 'react-router-dom'; import './App.scss'; import Header from '../Header/Header'; import Directory from '../Directory/Directory'; import Shop from '../Shop/Shop'; import SigninSignup from '../SigninSignup/SigninSignup'; import PageNotFound from '../PageNotFound/PageNotFound'; import {auth, createUserProfileDocument} from '../../firebase/firebase'; class App extends React.Component { state = { currentUser: null }; unsubscribeFromAuth = null; componentDidMount() { this.unsubscribeFromAuth = auth.onAuthStateChanged(async user => { createUserProfileDocument(user); }); } componentWillUnmount() { this.unsubscribeFromAuth(); } render() { return ( <div className="App"> <Header currentUser={this.state.currentUser} /> <Switch> <Route exact path="/" component={Directory} /> <Route path="/shop" component={Shop} /> <Route path="/signin" component={SigninSignup} /> <Route component={PageNotFound}/> </Switch> </div> ); } } export default App;
/* * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) 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. */ /** * This Javascript module exposes all the data analytics API as Javascript methods. This can be used * to develop custom webapps which use Analytics API. */ var DATA_TYPE_JSON = "json"; var CONTENT_TYPE_JSON = "application/json"; var AUTHORIZATION_HEADER = "Authorization"; function AnalyticsClient() { var TYPE_CLEAR_INDEX_DATA = 1; //var TYPE_CREATE_TABLE = 2; //var TYPE_DELETE_BY_ID = 3; //var TYPE_DELETE_BY_RANGE = 4; //var TYPE_DELETE_TABLE = 5; var TYPE_GET_RECORD_COUNT = 6; var TYPE_GET_BY_ID = 7; var TYPE_GET_BY_RANGE = 8; var TYPE_LIST_TABLES = 9; var TYPE_GET_SCHEMA = 10; //var TYPE_PUT_RECORDS = 11; //var TYPE_PUT_RECORDS_TO_TABLE = 12; var TYPE_SEARCH = 13; var TYPE_SEARCH_COUNT = 14; //var TYPE_SET_SCHEMA = 15; var TYPE_TABLE_EXISTS = 16; var TYPE_WAIT_FOR_INDEXING = 17; var TYPE_PAGINATION_SUPPORTED = 18; var TYPE_DRILLDOWN_CATEGORIES = 19; var TYPE_DRILLDOWN_SEARCH = 20; var TYPE_DRILLDOWN_SEARCH_COUNT = 21; var TYPE_ADD_STREAM_DEFINITION = 22; var TYPE_GET_STREAM_DEFINITION = 23; var TYPE_PUBLISH_EVENTS = 24; var HTTP_GET = "GET"; var HTTP_POST = "POST"; var RESPONSE_ELEMENT = "responseJSON"; this.serverUrl = ""; /** * Lists all the tables. * @param callback The callback functions which has one argument containing the response data. * @param error The callback function which has one argument which contains the error if any */ this.listTables = function (callback, error) { jQuery.ajax({ url: this.serverUrl + "?type=" + TYPE_LIST_TABLES, type: HTTP_GET, success: function (data) { callback(data); }, error: function (msg) { error(msg[RESPONSE_ELEMENT]); } }); }; /** * Creates a table with a given name. * @param tableName The table name. * @param callback The callback function which has one argument containing the response message. * @param error The callback function which has one argument which contains the error if any */ /*this.createTable = function (tableName, callback, error) { jQuery.ajax({ url: this.serverUrl + "?type=" + TYPE_CREATE_TABLE + "&tableName=" + tableName, type: HTTP_POST, success: function (data) { callback(data); }, error: function (msg) { error(msg); } }); };*/ /** * Check if the given table exists * @param tableName table name * @param callback The callback function which has one argument containing the response message. * @param error The callback function which has one argument which contains the error if any */ this.tableExists = function (tableName, callback, error) { jQuery.ajax({ url: this.serverUrl + "?type=" + TYPE_TABLE_EXISTS, type: HTTP_GET, success: function (data) { callback(data); }, error: function (msg) { error(msg[RESPONSE_ELEMENT]); } }); }; /** * Delete a table with a given name. * @param tableName The table name. * @param callback The callback function which has one argument containing the response message. * @param error The callback function which has one argument which contains the error if any */ /*this.deleteTable = function (tableName, callback, error) { jQuery.ajax({ url: this.serverUrl + "?type=" + TYPE_DELETE_TABLE + "&tableName=" + tableName, type: HTTP_GET, success: function (data) { callback(data); }, error: function (msg) { error(msg); } }); };*/ /** * Clears all the indexed data for a specific table. * @param tableName The table name of which the index data to be removed. * @param callback The callback function which has one argument containing the response message. * @param error The callback function which has one argument which contains the error if any */ this.clearIndexData = function (tableName, callback, error) { jQuery.ajax({ url: this.serverUrl + "?type=" + TYPE_CLEAR_INDEX_DATA + "&tableName=" + tableName, type: HTTP_GET, success: function (data) { callback(data); }, error: function (msg) { error(msg[RESPONSE_ELEMENT]); } }); }; /** * Gets the records given the table name and the timestamp range and pagination information. * @param rangeInfo Information containing the table name, range and pagination information. * e.g. rangeInfo = { * tableName : "TEST", * timeFrom : 243243245354532, * timeTo : 364654656435343, * start : 0, * count : 10, * columns : [ "column1", "column2"] * } * @param callback The callback function which has one argument containing the response message. * @param error The callback function which has one argument which contains the error if any */ this.getRecordsByRange = function (rangeInfo, callback, error) { jQuery.ajax({ url: this.serverUrl + "?type=" + TYPE_GET_BY_RANGE + "&tableName=" + rangeInfo["tableName"] + "&timeFrom=" + rangeInfo["timeFrom"] + "&timeTo=" + rangeInfo["timeTo"] + "&start=" + rangeInfo["start"] + "&count=" + rangeInfo["count"], data: JSON.stringify(rangeInfo["columns"]), type: HTTP_POST, success: function (data) { callback(data); }, error: function (msg) { error(msg[RESPONSE_ELEMENT]); } }); }; /** * Gets the records given the record Ids. * @param recordsInfo The object which contains the record ids. * e.g. recordsInfo = { * tableName : "TEST", * ids : [ "id1", "id2", "id3"] * } * @param callback The callback function which has one argument containing the response message. * @param error The callback function which has one argument which contains the error if any */ this.getRecordsByIds = function (recordsInfo, callback, error) { jQuery.ajax({ url: this.serverUrl + "?type=" + TYPE_GET_BY_ID + "&tableName=" + recordsInfo["tableName"], data: JSON.stringify(recordsInfo["ids"]), type: HTTP_POST, success: function (data) { callback(data); }, error: function (msg) { error(msg[RESPONSE_ELEMENT]); } }); }; /** * Returns the total record count. * @param tableName The table name * @param callback The callback function which has one argument containing the response message. * @param error The callback function which has one argument which contains the error if any */ this.getRecordCount = function (tableName, callback, error) { jQuery.ajax({ url: this.serverUrl + "?type=" + TYPE_GET_RECORD_COUNT + "&tableName=" + tableName, type: HTTP_GET, success: function (data) { callback(data); }, error: function (msg) { error(msg[RESPONSE_ELEMENT]); } }); }; /** * Delete records by records ids. * @param recordsInfo The object which contains the record information. * e.g. recordsInfo = { * tableName : "TEST", * ids : [ "id1", "id2", "id3"] * } * @param callback The callback function which has one argument containing the response message. * @param error The callback function which has one argument which contains the error if any */ /*this.deleteRecordsByIds = function (recordsInfo, callback, error) { jQuery.ajax({ url: this.serverUrl + "?type=" + TYPE_DELETE_BY_ID + "&tableName=" + recordsInfo["tableName"], data: JSON.stringify(recordsInfo["ids"]), type: HTTP_POST, success: function (data) { callback(data); }, error: function (msg) { error(msg); } }); };*/ /** * Deletes the records given the time ranges. * @param rangeInfo The object information which contains the timestamp range. * e.g rangeInfo = { * tableName : "TEST", * timeFrom : 12132143242422, * timeTo : 3435353535335 * } * @param callback The callback function which has one argument containing the response message. * @param error The callback function which has one argument which contains the error if any */ /*this.deleteRecordsByRange = function (rangeInfo, callback, error) { jQuery.ajax({ url: this.serverUrl + "?type=" + TYPE_DELETE_BY_RANGE + "&tableName=" + rangeInfo["tableName"] + "&timeFrom=" + rangeInfo["timeFrom"] + "&timeTo=" + rangeInfo["timeTo"], type: HTTP_GET, success: function (data) { callback(data); }, error: function (msg) { error(msg); } }); };*/ /** * Insert records ( tableName should be given for each record. * @param recordsInfo Records information containing the records array. * e.g. recordsInfo = { * records : [ * { * tableName : "TEST", * values : { * "field1" : "value1", * "field2" : "value2" * } * }, * { * tableName : "TEST2", * values : { * "field1" : "value1", * "facetField" : [ "category", "subCategory", "subSubCategory" ] * } * } * ] * @param callback The callback function which has one argument containing the array of * ids of records inserted. * @param error The callback function which has one argument which contains the error if any */ /*this.insertRecords = function (recordsInfo, callback, error) { jQuery.ajax({ url: this.serverUrl + "?type=" + TYPE_PUT_RECORDS, data: JSON.stringify(recordsInfo["records"]), type: HTTP_POST, success: function (data) { callback(data); }, error: function (msg) { error(msg); } }); };*/ /** * Insert records to a specific table. * @param recordsInfo Records information containing the records array. * e.g. recordsInfo = { * tableName : "TEST", * records : [ * { * values : { * "field1" : "value1", * "field2" : "value2" * } * }, * { * values : { * "field1" : "value1", * "facetField" : [ "category", "subCategory", "subSubCategory" ] * } * } * ] * @param callback The callback function which has one argument containing the array of * ids of records inserted. * @param error The callback function which has one argument which contains the error if any */ /*this.insertRecordsToTable = function (recordsInfo, callback, error) { jQuery.ajax({ url: this.serverUrl + "?type=" + TYPE_PUT_RECORDS_TO_TABLE + "&tableName=" + recordsInfo["tableName"], data: JSON.stringify(recordsInfo["records"]), type: HTTP_POST, success: function (data) { callback(data); }, error: function (msg) { error(msg); } }); };*/ /** * Search records in a given table using lucene queries. * @param queryInfo Query information which contains the table name and search parameters. * e.g. queryInfo = { * tableName : "TEST", * searchParams : { * query : "logFile : wso2carbon.log", * start : 0, * count : 10, * } * } * @param callback The callback function which has one argument containing the array of * matching records. * @param error The callback function which has one argument which contains the error if any */ this.searchCount = function (queryInfo, callback, error) { jQuery.ajax({ url: this.serverUrl + "?type=" + TYPE_SEARCH_COUNT + "&tableName=" + queryInfo["tableName"], data: JSON.stringify(queryInfo["searchParams"]), type: HTTP_POST, success: function (data) { callback(data); }, error: function (msg) { error(msg[RESPONSE_ELEMENT]); } }); }; /** * Returns the search count of records in a given table using lucene queries. * @param queryInfo Query information which contains the table name and search parameters. * e.g. queryInfo = { * tableName : "TEST", * searchParams : { * query : "logFile : wso2carbon.log", * start : 0, * count : 10, * } * } * @param callback The callback function which has one argument containing the number of * matched records * @param error The callback function which has one argument which contains the error if any */ this.search = function (queryInfo, callback, error) { jQuery.ajax({ url: this.serverUrl + "?type=" + TYPE_SEARCH + "&tableName=" + queryInfo["tableName"], data: JSON.stringify(queryInfo["searchParams"]), type: HTTP_POST, success: function (data) { callback(data); }, error: function (msg) { error(msg[RESPONSE_ELEMENT]); } }); }; /** * Sets the schema for a table. * @param schemaInfo The object which contains the schema information * e.g. schemaInfo = { * tableName : "TEST", * schema : { * columns : { * "column1" : { * "type" : "STRING", * "isIndex : true, * "isScoreParam" : false * } * } * } * } * @param callback The callback function which has one argument containing the response message * @param error The callback function which has one argument which contains the error if any */ /*this.setSchema = function (schemaInfo, callback, error) { jQuery.ajax({ url: this.serverUrl + "?type=" + TYPE_SET_SCHEMA + "&tableName=" + schemaInfo["tableName"], data: JSON.stringify(schemaInfo["schema"]), type: HTTP_POST, success: function (data) { callback(data); }, error: function (msg) { error(msg); } }); };*/ /** * Gets the schema of a table. * @param tableName the table name. * @param callback The callback function which has one argument containing the table schema. * @param error The callback function which has one argument which contains the error if any */ this.getSchema = function (tableName, callback, error) { jQuery.ajax({ url: this.serverUrl + "?type=" + TYPE_GET_SCHEMA + "&tableName=" + tableName, type: HTTP_GET, success: function (data) { callback(data); }, error: function (msg) { error(msg[RESPONSE_ELEMENT]); } }); }; /** * Returns if the underlying AnalyticsService supports pagination. * @param callback The callback function which has one argument containing true/false. * @param error The callback function which has one argument which contains the error if any */ this.isPaginationSupported = function (callback, error) { jQuery.ajax({ url: this.serverUrl + "?type=" + TYPE_PAGINATION_SUPPORTED, type: HTTP_GET, success: function (data) { callback(data); }, error: function (msg) { error(msg[RESPONSE_ELEMENT]); } }); }; /** * Waits till the indexing completes. * @param callback The callback function which has one argument which contains the response message. * @param error The callback function which has one argument which contains the error if any */ this.waitForIndexing = function (callback, error) { jQuery.ajax({ url: this.serverUrl + "?type=" + TYPE_WAIT_FOR_INDEXING, type: HTTP_GET, success: function (data) { callback(data); }, error: function (msg) { error(msg[RESPONSE_ELEMENT]); } }); }; /** * Returns the immediate sub categories of a facet field. * @param drilldownReq drilldown information. * e.g. drillDownReq = { * tableName : "TEST", * drillDownInfo : { * fieldName : "facetField1", * categoryPath : [ "category", "subCategory"] * query : "logFile : wso2carbon.log" * scoreFunction : "sqrt(weight)" * } * } * @param callback The callback function which has one argument which contains the subcategories. * @param error The callback function which has one argument which contains the error if any */ this.drillDownCategories = function (drilldownReq, callback, error) { jQuery.ajax({ url: this.serverUrl + "?type=" + TYPE_DRILLDOWN_CATEGORIES + "&tableName=" + drilldownReq["tableName"], data: JSON.stringify(drilldownReq["drillDownInfo"]), type: HTTP_POST, success: function (data) { callback(data); }, error: function (msg) { error(msg[RESPONSE_ELEMENT]); } }); }; /** * Returns the records which match the drill-down query given the table. * @param drillDownReq The object which contains the drillDown information. * e.g. drillDownReq = { * tableName : "TEST", * drillDownInfo : { * categories : [ * { * fieldName : "facetField1", * path : ["A", "B", "C"] * }, * { * fieldName : "facetField2", * path : [ "X", "Y", "Z"] * }] * query : "field1 : value1", * recordStart : 0, * recordCount : 50, * scoreFunction : "scoreParamField * 2" * } * @param callback The callback function which has one argument which contains the matching records * @param error The callback function which has one argument which contains the error if any */ this.drillDownSearch = function (drillDownReq, callback, error) { jQuery.ajax({ url: this.serverUrl + "?type=" + TYPE_DRILLDOWN_SEARCH + "&tableName=" + drillDownReq["tableName"], data: JSON.stringify(drillDownReq["drillDownInfo"]), type: HTTP_POST, success: function (data) { callback(data); }, error: function (msg) { error(msg[RESPONSE_ELEMENT]); } }); }; /** * Returns number of the records which match the drill-down query given the table. * @param drillDownReq The object which contains the drillDown information. * e.g. drillDownReq = { * tableName : "TEST", * drillDownInfo : { * categories : [ * { * fieldName : "facetField1", * path : ["A", "B", "C"] * }, * { * fieldName : "facetField2", * path : [ "X", "Y", "Z"] * }] * query : "field1 : value1", * recordStart : 0, * recordCount : 50, * scoreFunction : "scoreParamField * 2" * } * @param callback The callback function which has one argument which contains the count. * @param error The callback function which has one argument which contains the error if any */ this.drillDownSearchCount = function (drillDownReq, callback, error) { jQuery.ajax({ url: this.serverUrl + "?type=" + TYPE_DRILLDOWN_SEARCH_COUNT + "&tableName="+ drillDownReq["tableName"], data: JSON.stringify(drillDownReq["drillDownInfo"]), type: HTTP_POST, success: function (data) { callback(data); }, error: function (msg) { error(msg[RESPONSE_ELEMENT]); } }); }; /** * Create a stream definition for.a event stream * @param streamDef The object which contains the stream definition. * e.g. streamDef = { * name : "TEST", * version : "1.0.0", * nickName : "test", * description : "sample description" * payloadData : { * name : "STRING", * married : "BOOLEAN", * age : "INTEGER" * }, * metaData : { * timestamp : "LONG" * }, * correlationData : { * * }, * tags : [] * } * @param callback The callback function which has one argument which contains stream id. * @param error The callback function which has one argument which contains the error if any */ this.addStreamDefinition = function (streamDef, callback, error) { jQuery.ajax({ url: this.serverUrl + "?type=" + TYPE_ADD_STREAM_DEFINITION, data: JSON.stringify(streamDef), type: HTTP_POST, success: function (data) { callback(data); }, error: function (msg) { error(msg[RESPONSE_ELEMENT]); } }); }; /** * Publishes an event to a given stream. * @param event object containing event data. * e.g. eventData = { * streamId : "TEST:1.0.0", * timestamp : 54326543254532, "optional" * publishData : { * }, * metaData : { * }, * correlationData : { * } * } * @param callback callback The callback function which has one argument which contains the response. * @param error The callback function which has one argument which contains the error if any. */ this.publishEvent = function (event, callback, error) { jQuery.ajax({ url: this.serverUrl + "?type=" + TYPE_PUBLISH_EVENTS, data: JSON.stringify(event), type: HTTP_POST, success: function (data) { callback(data); }, error: function (msg) { error(msg[RESPONSE_ELEMENT]); } }); }; /** * Get the stream definition for a event stream. * @param requestData request containing the data of the event stream. * e.g. eventStreamInfo = { * name : "TEST", * version" "1.0.0" * } * @param callback callback The callback function which has one argument which contains the stream definition. * @param error error The callback function which has one argument which contains the error if any */ this.getStreamDefinition = function (requestData, callback, error) { jQuery.ajax({ url: this.serverUrl + "?type=" + TYPE_GET_STREAM_DEFINITION, data: JSON.stringify(requestData), type: HTTP_POST, success: function (data) { callback(data); }, error: function (msg) { error(msg[RESPONSE_ELEMENT]); } }); } } /** * Construct an AnalyticsClient object given the username, password and serverUrl. * @param username the username * @param password the password * @param svrUrl the server url * @returns {AnalyticsClient} AnalyticsClient object */ AnalyticsClient.prototype.init = function (username, password, svrUrl) { if (svrUrl == null) { this.serverUrl = "https://localhost:9443/portal/apis/analytics"; } else { this.serverUrl = svrUrl; } var authHeader = generateBasicAuthHeader(username, password); jQuery.ajaxSetup({ dataType: DATA_TYPE_JSON, contentType: CONTENT_TYPE_JSON, beforeSend: function (request) { if (authHeader != null) { request.setRequestHeader(AUTHORIZATION_HEADER, authHeader); } } }); return this; }; function generateBasicAuthHeader(username, password) { if (username != null && password != null) { return "Basic " + btoa(username + ":" + password); } return null; }
import path from 'path'; import del from 'del'; import nock from 'nock'; import pathExists from 'path-exists'; import tempfile from 'tempfile'; import test from 'ava'; import m from '.'; test.beforeEach(t => { t.context.tmp = tempfile(); }); test.afterEach(async t => { await del(t.context.tmp, {force: true}); }); test('download and build source', async t => { nock('http://foo.com') .get('/gifsicle.tar.gz') .replyWithFile(200, path.join(__dirname, 'fixtures', 'test.tar.gz')); await m.url('http://foo.com/gifsicle.tar.gz', [ 'autoreconf -ivf', `./configure --disable-gifview --disable-gifdiff --prefix="${t.context.tmp}" --bindir="${t.context.tmp}"`, 'make install' ]); t.true(await pathExists(path.join(t.context.tmp, 'gifsicle'))); }); test('build source from existing archive', async t => { await m.file(path.join(__dirname, 'fixtures', 'test.tar.gz'), [ 'autoreconf -ivf', `./configure --disable-gifview --disable-gifdiff --prefix="${t.context.tmp}" --bindir="${t.context.tmp}"`, 'make install' ]); t.true(await pathExists(path.join(t.context.tmp, 'gifsicle'))); }); test('accepts a string', async t => { await t.throws(m.directory([]), 'Expected a `string`, got `object`'); await t.throws(m.file([]), 'Expected a `string`, got `object`'); await t.throws(m.url([]), 'Expected a `string`, got `object`'); });
import theme from '@nuxt/content-theme-docs' export default theme({ head: { meta: [ // { name: 'google-site-verification', content: "VqBuI6LAOEm-RHyKbbLnmhReR-Tk04T9foBKmr9m_LM" } ] }, docs: { primaryColor: '#F8E479' }, pwa: { manifest: { name: '@vurian/wizard' } } })
(window.webpackJsonp=window.webpackJsonp||[]).push([[58],{O1Gv:function(e,t,a){"use strict";a.r(t),a.d(t,"_frontmatter",(function(){return m})),a.d(t,"default",(function(){return u}));var n=a("zLVn"),i=(a("q1tI"),a("7ljp")),o=a("Bl7J"),r=a("IP2g"),s=a("wHSu"),c=a("tBDR"),b=a("Bn85"),p=a("/k7T"),m={layout:"about",title:"About",permalink:"/about/"},l={_frontmatter:m},h=function(e){return Object(i.b)(o.a,Object.assign({},e,{icon:"info"}))};function u(e){var t=e.components,a=Object(n.a)(e,["components"]);return Object(i.b)(h,Object.assign({},l,a,{components:t,mdxType:"MDXLayout"}),Object(i.b)("h3",null,"About Work"),Object(i.b)("p",null,"I'm currently a graphics research engineer @ ",Object(i.b)("a",Object.assign({parentName:"p"},{href:"tiktok.com"}),"Tiktok"),"'s AR Effect Platform Team. Before joining Tiktok, I'm a research engineer @ ",Object(i.b)("a",Object.assign({parentName:"p"},{href:"http://www.bosch.us/content/language1/html/rtc.htm"}),"Bosch Research")," productizing I4.0 & eXplainable AI ",Object(i.b)("a",Object.assign({parentName:"p"},{href:"https://www.bosch.us/media/our_company/innovation/visual-analytics-industry-4_res_1280x720.png"}),"web app"),", ",Object(i.b)("a",Object.assign({parentName:"p"},{href:"https://www.bosch.us/media/our_company/innovation/3d-map-navigation_res_1280x720.jpg"}),"3D map"),", & hand/",Object(i.b)("a",Object.assign({parentName:"p"},{href:"https://www.bosch.us/media/our_company/innovation/bosch-intelligent-glove_res_1984x1116.jpg"}),"glove")," capturing etc., where I learnt a lot about industrial research lab. Before in 2014, I joined ",Object(i.b)("a",Object.assign({parentName:"p"},{href:"https://www.amazon.com/"}),"Amazon")," Retail (hardline) as SDE where I unlocked my web dev skill and have a great time with enthusiastic colleagues."),Object(i.b)("p",null,"My earlier industrial experience started at ",Object(i.b)("a",Object.assign({parentName:"p"},{href:"https://www.ubisoft.com/en-GB/"}),"Ubisoft")," in 2008 as a software developer for ",Object(i.b)("a",Object.assign({parentName:"p"},{href:"https://en.wikipedia.org/wiki/Rayman"}),"Rayman"),' HD.\nI have computer science, statistics and mathematics background and thus a "mixture" of ',Object(i.b)("a",Object.assign({parentName:"p"},{href:"https://slackprop.wordpress.com/2013/06/03/on-geek-versus-nerd/"}),"geeky/nerdy")," things. "),Object(i.b)(c.a,{filename:"coding.png",className:"float-right-photo",style:{width:"10rem"},mdxType:"Image"}),Object(i.b)("p",null,"I hand on lots of tech but never overfit my tech brain and here's the keywords I try to define my tech league: real-time, full-stack, GPU, web, AI, scale, productization, engineering focus."),Object(i.b)("p",null,"I love graphics, however, I'm a TUI guy when coming to coding, or more precisely a Vim+Tmux guy always carrying his ",Object(i.b)("a",Object.assign({parentName:"p"},{href:"https://github.com/daizeng1984/dotfiles"}),"backpack"),"."),Object(i.b)("h3",null,"About Academy"),Object(i.b)("p",null,"In 2014, I graduated from ",Object(i.b)("a",Object.assign({parentName:"p"},{href:"http://www.uiowa.edu/"}),"University of Iowa")," where I spent wonderful years studying 3D real time rendering with my advisor ",Object(i.b)("a",Object.assign({parentName:"p"},{href:"http://cwyman.org/"}),"Chris Wyman"),". I also have M.S. degree in Probability and Mathematics Statistics and B.S. degree in Applied Mathematics from ",Object(i.b)("a",Object.assign({parentName:"p"},{href:"http://www.scu.edu.cn/en/"}),"Sichuan University"),", where I worked on theoretical research (statistics) of multi-sensor fusion with Prof. ",Object(i.b)("a",Object.assign({parentName:"p"},{href:"https://scholar.google.com/citations?user=cN4yYyoAAAAJ&hl=en"}),"Yunmin Zhu"),"."),Object(i.b)("h3",null,"About Life"),Object(i.b)(c.a,{filename:"william-code-abc.png",className:"float-right-photo",style:{width:"10rem"},mdxType:"Image"}),Object(i.b)("p",null,'I have two "lovely" kids with my wife living in bay area. As expected, ',Object(i.b)(b.a,{mdxType:"WilliamAge"})," while ",Object(i.b)(p.a,{mdxType:"AlexAge"}),"."),Object(i.b)("p",null,"During weekends, I enjoy playing ",Object(i.b)(r.a,{icon:s.i,mdxType:"FontAwesomeIcon"}),", ",Object(i.b)(r.a,{icon:s.f,mdxType:"FontAwesomeIcon"}),", ",Object(i.b)(r.a,{icon:s.m,mdxType:"FontAwesomeIcon"})," and sometimes go out to nature ",Object(i.b)(r.a,{style:{color:"green"},icon:s.l,mdxType:"FontAwesomeIcon"})," for fresh air."))}u.isMDXComponent=!0}}]); //# sourceMappingURL=component---src-posts-about-mdx-6516fe6cb638ed26b7ec.js.map
/* jshint esnext: true */ import path from './svg-path'; const EPSILON = 1e-12; const PI = Math.PI; const HALF_PI = PI / 2; const TAU = 2 * PI; const constant = (x) => { return () => { return x; }; }; const asin = (x) => { return x >= 1 ? HALF_PI : x <= -1 ? -HALF_PI : Math.asin(x); }; function intersect(x0, y0, x1, y1, x2, y2, x3, y3) { var x10 = x1 - x0, y10 = y1 - y0, x32 = x3 - x2, y32 = y3 - y2, t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / (y32 * x10 - x32 * y10); return [x0 + t * x10, y0 + t * y10]; } // Compute perpendicular offset line of length rc. // http://mathworld.wolfram.com/Circle-LineIntersection.html function cornerTangents(x0, y0, x1, y1, r1, rc, cw) { var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / Math.sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * Math.sqrt(Math.max(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00; // Pick the closer of the two intersection points. // TODO Is there a faster way to determine which intersection to use? if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) { cx0 = cx1; cy0 = cy1; } return { cx: cx0, cy: cy0, x01: -ox, y01: -oy, x11: cx0 * (r1 / r - 1), y11: cy0 * (r1 / r - 1) }; } const arcCentroid = (data, fns) => { if(fns === undefined || typeof fns !== 'object') { fns = {}; } fns = Object.assign({ innerRadius: (d) => { return d.innerRadius || 0; }, outerRadius: (d) => { return d.outerRadius || 0; }, startAngle: (d) => { return d.startAngle || 0; }, endAngle: (d) => { return d.endAngle || 0; } }, fns); var r = ((+fns.innerRadius(data)) + (+fns.outerRadius(data))) / 2, a = ((+fns.startAngle(data)) + (+fns.endAngle(data))) / 2 - PI / 2; return [Math.cos(a) * r, Math.sin(a) * r]; }; const arcPath = (data, fns) => { if(fns === undefined || typeof fns !== 'object') { fns = {}; } Object.assign(fns, { innerRadius: (d) => { return d.innerRadius || 0; }, outerRadius: (d) => { return d.outerRadius || 0; }, startAngle: (d) => { return d.startAngle || 0; }, endAngle: (d) => { return d.endAngle || 0; }, padAngle: (d) => { return d.padAngle || 0; }, padRadius: (d) => { return 0; }, cornerRadius: (d) => { return 0; }, }); let context = null; var buffer, r, r0 = +fns.innerRadius(data), r1 = +fns.outerRadius(data), a0 = +fns.startAngle(data) - HALF_PI, a1 = +fns.endAngle(data) - HALF_PI, da = Math.abs(a1 - a0), cw = a1 > a0; if (!context) { context = buffer = path(); } else { // can this be? } // Ensure that the outer radius is always larger than the inner radius. if (r1 < r0) { r = r1; r1 = r0; r0 = r; } if (r1 <= EPSILON) { // Is it a point? context.moveTo(0, 0); } else if (da > TAU - EPSILON) { // Or is it a circle or annulus? context.moveTo(r1 * Math.cos(a0), r1 * Math.sin(a0)); context.arc(0, 0, r1, a0, a1, !cw); if (r0 > EPSILON) { context.moveTo(r0 * Math.cos(a1), r0 * Math.sin(a1)); context.arc(0, 0, r0, a1, a0, cw); } } else { // Or is it a circular or annular sector? var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = fns.padAngle.apply(this, arguments) / 2, padRadius = fns.padRadius(data), rp = (ap > EPSILON) && (padRadius ? +padRadius : Math.sqrt(r0 * r0 + r1 * r1)), rc = Math.min(Math.abs(r1 - r0) / 2, +fns.cornerRadius(data)), rc0 = rc, rc1 = rc, t0, t1; // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0. if (rp > EPSILON) { var p0 = asin(rp / r0 * Math.sin(ap)), p1 = asin(rp / r1 * Math.sin(ap)); if ((da0 -= p0 * 2) > EPSILON) { p0 *= (cw ? 1 : -1); a00 += p0; a10 -= p0; } else { da0 = 0; a00 = a10 = (a0 + a1) / 2; } if ((da1 -= p1 * 2) > EPSILON) { p1 *= (cw ? 1 : -1); a01 += p1; a11 -= p1; } else { da1 = 0; a01 = a11 = (a0 + a1) / 2; } } var x01 = r1 * Math.cos(a01), y01 = r1 * Math.sin(a01), x10 = r0 * Math.cos(a10), y10 = r0 * Math.sin(a10); // Apply rounded corners? if (rc > EPSILON) { var x11 = r1 * Math.cos(a11), y11 = r1 * Math.sin(a11), x00 = r0 * Math.cos(a00), y00 = r0 * Math.sin(a00); // Restrict the corner radius according to the sector angle. if (da < PI) { var oc = da0 > EPSILON ? intersect(x01, y01, x00, y00, x11, y11, x10, y10) : [x10, y10], ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / Math.sin(Math.acos((ax * bx + ay * by) / (Math.sqrt(ax * ax + ay * ay) * Math.sqrt(bx * bx + by * by))) / 2), lc = Math.sqrt(oc[0] * oc[0] + oc[1] * oc[1]); rc0 = Math.min(rc, (r0 - lc) / (kc - 1)); rc1 = Math.min(rc, (r1 - lc) / (kc + 1)); } } if (da1 <= EPSILON) { // Is the sector collapsed to a line? context.moveTo(x01, y01); } else if (rc1 > EPSILON) { // Does the sector’s outer ring have rounded corners? t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw); t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw); context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01); if (rc1 < rc) { // Have the corners merged? context.arc(t0.cx, t0.cy, rc1, Math.atan2(t0.y01, t0.x01), Math.atan2(t1.y01, t1.x01), !cw); } else { // Otherwise, draw the two corners and the ring. context.arc(t0.cx, t0.cy, rc1, Math.atan2(t0.y01, t0.x01), Math.atan2(t0.y11, t0.x11), !cw); context.arc(0, 0, r1, Math.atan2(t0.cy + t0.y11, t0.cx + t0.x11), Math.atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw); context.arc(t1.cx, t1.cy, rc1, Math.atan2(t1.y11, t1.x11), Math.atan2(t1.y01, t1.x01), !cw); } } else { // Or is the outer ring just a circular arc? context.moveTo(x01, y01); context.arc(0, 0, r1, a01, a11, !cw); } // Is there no inner ring, and it’s a circular sector? // Or perhaps it’s an annular sector collapsed due to padding? if (r0 <= EPSILON || da0 <= EPSILON) { context.lineTo(x10, y10); } else if (rc0 > EPSILON) { // Does the sector’s inner ring (or point) have rounded corners? t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw); t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw); context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01); if (rc0 < rc) { // Have the corners merged? context.arc(t0.cx, t0.cy, rc0, Math.atan2(t0.y01, t0.x01), Math.atan2(t1.y01, t1.x01), !cw); } else { // Otherwise, draw the two corners and the ring. context.arc(t0.cx, t0.cy, rc0, Math.atan2(t0.y01, t0.x01), Math.atan2(t0.y11, t0.x11), !cw); context.arc(0, 0, r0, Math.atan2(t0.cy + t0.y11, t0.cx + t0.x11), Math.atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw); context.arc(t1.cx, t1.cy, rc0, Math.atan2(t1.y11, t1.x11), Math.atan2(t1.y01, t1.x01), !cw); } } // Or is the inner ring just a circular arc? else context.arc(0, 0, r0, a10, a00, cw); } context.closePath(); if (buffer) { context = null; return buffer + ""; } }; export default arcPath;
// source: proto/item_service.proto /** * @fileoverview * @enhanceable * @suppress {messageConventions} JS Compiler reports an error if a variable or * field starts with 'MSG_' and isn't a translatable message. * @public */ // GENERATED CODE -- DO NOT EDIT! var jspb = require('google-protobuf'); var goog = jspb; var global = Function('return this')(); var proto_item_pb = require('../proto/item_pb.js'); goog.object.extend(proto, proto_item_pb); goog.exportSymbol('proto.pb.ItemCreateRequest', null, global); goog.exportSymbol('proto.pb.ItemCreateResponse', null, global); goog.exportSymbol('proto.pb.ItemDeleteRequest', null, global); goog.exportSymbol('proto.pb.ItemDeleteResponse', null, global); goog.exportSymbol('proto.pb.ItemPatchRequest', null, global); goog.exportSymbol('proto.pb.ItemPatchResponse', null, global); goog.exportSymbol('proto.pb.ItemReadRequest', null, global); goog.exportSymbol('proto.pb.ItemReadResponse', null, global); goog.exportSymbol('proto.pb.ItemSearchRequest', null, global); goog.exportSymbol('proto.pb.ItemSearchResponse', null, global); goog.exportSymbol('proto.pb.ItemUpdateRequest', null, global); goog.exportSymbol('proto.pb.ItemUpdateResponse', null, global); /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.pb.ItemSearchRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.pb.ItemSearchRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.pb.ItemSearchRequest.displayName = 'proto.pb.ItemSearchRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.pb.ItemSearchResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.pb.ItemSearchResponse.repeatedFields_, null); }; goog.inherits(proto.pb.ItemSearchResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.pb.ItemSearchResponse.displayName = 'proto.pb.ItemSearchResponse'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.pb.ItemCreateRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.pb.ItemCreateRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.pb.ItemCreateRequest.displayName = 'proto.pb.ItemCreateRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.pb.ItemCreateResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.pb.ItemCreateResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.pb.ItemCreateResponse.displayName = 'proto.pb.ItemCreateResponse'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.pb.ItemReadRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.pb.ItemReadRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.pb.ItemReadRequest.displayName = 'proto.pb.ItemReadRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.pb.ItemReadResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.pb.ItemReadResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.pb.ItemReadResponse.displayName = 'proto.pb.ItemReadResponse'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.pb.ItemUpdateRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.pb.ItemUpdateRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.pb.ItemUpdateRequest.displayName = 'proto.pb.ItemUpdateRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.pb.ItemUpdateResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.pb.ItemUpdateResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.pb.ItemUpdateResponse.displayName = 'proto.pb.ItemUpdateResponse'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.pb.ItemDeleteRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.pb.ItemDeleteRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.pb.ItemDeleteRequest.displayName = 'proto.pb.ItemDeleteRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.pb.ItemDeleteResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.pb.ItemDeleteResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.pb.ItemDeleteResponse.displayName = 'proto.pb.ItemDeleteResponse'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.pb.ItemPatchRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.pb.ItemPatchRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.pb.ItemPatchRequest.displayName = 'proto.pb.ItemPatchRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.pb.ItemPatchResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.pb.ItemPatchResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.pb.ItemPatchResponse.displayName = 'proto.pb.ItemPatchResponse'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.pb.ItemSearchRequest.prototype.toObject = function(opt_includeInstance) { return proto.pb.ItemSearchRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.pb.ItemSearchRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.pb.ItemSearchRequest.toObject = function(includeInstance, msg) { var f, obj = { valuesMap: (f = msg.getValuesMap()) ? f.toObject(includeInstance, undefined) : [], limit: jspb.Message.getFieldWithDefault(msg, 2, 0), offset: jspb.Message.getFieldWithDefault(msg, 3, 0), orderby: jspb.Message.getFieldWithDefault(msg, 4, ""), orderdesc: jspb.Message.getBooleanFieldWithDefault(msg, 5, false) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.pb.ItemSearchRequest} */ proto.pb.ItemSearchRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.pb.ItemSearchRequest; return proto.pb.ItemSearchRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.pb.ItemSearchRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.pb.ItemSearchRequest} */ proto.pb.ItemSearchRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = msg.getValuesMap(); reader.readMessage(value, function(message, reader) { jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", ""); }); break; case 2: var value = /** @type {number} */ (reader.readInt64()); msg.setLimit(value); break; case 3: var value = /** @type {number} */ (reader.readInt64()); msg.setOffset(value); break; case 4: var value = /** @type {string} */ (reader.readString()); msg.setOrderby(value); break; case 5: var value = /** @type {boolean} */ (reader.readBool()); msg.setOrderdesc(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.pb.ItemSearchRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.pb.ItemSearchRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.pb.ItemSearchRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.pb.ItemSearchRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getValuesMap(true); if (f && f.getLength() > 0) { f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString); } f = message.getLimit(); if (f !== 0) { writer.writeInt64( 2, f ); } f = message.getOffset(); if (f !== 0) { writer.writeInt64( 3, f ); } f = message.getOrderby(); if (f.length > 0) { writer.writeString( 4, f ); } f = message.getOrderdesc(); if (f) { writer.writeBool( 5, f ); } }; /** * map<string, string> values = 1; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` * @return {!jspb.Map<string,string>} */ proto.pb.ItemSearchRequest.prototype.getValuesMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map<string,string>} */ ( jspb.Message.getMapField(this, 1, opt_noLazyCreate, null)); }; /** * Clears values from the map. The map will be non-null. * @return {!proto.pb.ItemSearchRequest} returns this */ proto.pb.ItemSearchRequest.prototype.clearValuesMap = function() { this.getValuesMap().clear(); return this;}; /** * optional int64 limit = 2; * @return {number} */ proto.pb.ItemSearchRequest.prototype.getLimit = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** * @param {number} value * @return {!proto.pb.ItemSearchRequest} returns this */ proto.pb.ItemSearchRequest.prototype.setLimit = function(value) { return jspb.Message.setProto3IntField(this, 2, value); }; /** * optional int64 offset = 3; * @return {number} */ proto.pb.ItemSearchRequest.prototype.getOffset = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** * @param {number} value * @return {!proto.pb.ItemSearchRequest} returns this */ proto.pb.ItemSearchRequest.prototype.setOffset = function(value) { return jspb.Message.setProto3IntField(this, 3, value); }; /** * optional string orderby = 4; * @return {string} */ proto.pb.ItemSearchRequest.prototype.getOrderby = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; /** * @param {string} value * @return {!proto.pb.ItemSearchRequest} returns this */ proto.pb.ItemSearchRequest.prototype.setOrderby = function(value) { return jspb.Message.setProto3StringField(this, 4, value); }; /** * optional bool orderdesc = 5; * @return {boolean} */ proto.pb.ItemSearchRequest.prototype.getOrderdesc = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false)); }; /** * @param {boolean} value * @return {!proto.pb.ItemSearchRequest} returns this */ proto.pb.ItemSearchRequest.prototype.setOrderdesc = function(value) { return jspb.Message.setProto3BooleanField(this, 5, value); }; /** * List of repeated fields within this message type. * @private {!Array<number>} * @const */ proto.pb.ItemSearchResponse.repeatedFields_ = [1]; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.pb.ItemSearchResponse.prototype.toObject = function(opt_includeInstance) { return proto.pb.ItemSearchResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.pb.ItemSearchResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.pb.ItemSearchResponse.toObject = function(includeInstance, msg) { var f, obj = { itemsList: jspb.Message.toObjectList(msg.getItemsList(), proto_item_pb.Item.toObject, includeInstance), total: jspb.Message.getFieldWithDefault(msg, 2, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.pb.ItemSearchResponse} */ proto.pb.ItemSearchResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.pb.ItemSearchResponse; return proto.pb.ItemSearchResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.pb.ItemSearchResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.pb.ItemSearchResponse} */ proto.pb.ItemSearchResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto_item_pb.Item; reader.readMessage(value,proto_item_pb.Item.deserializeBinaryFromReader); msg.addItems(value); break; case 2: var value = /** @type {number} */ (reader.readInt64()); msg.setTotal(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.pb.ItemSearchResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.pb.ItemSearchResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.pb.ItemSearchResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.pb.ItemSearchResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getItemsList(); if (f.length > 0) { writer.writeRepeatedMessage( 1, f, proto_item_pb.Item.serializeBinaryToWriter ); } f = message.getTotal(); if (f !== 0) { writer.writeInt64( 2, f ); } }; /** * repeated Item Items = 1; * @return {!Array<!proto.pb.Item>} */ proto.pb.ItemSearchResponse.prototype.getItemsList = function() { return /** @type{!Array<!proto.pb.Item>} */ ( jspb.Message.getRepeatedWrapperField(this, proto_item_pb.Item, 1)); }; /** * @param {!Array<!proto.pb.Item>} value * @return {!proto.pb.ItemSearchResponse} returns this */ proto.pb.ItemSearchResponse.prototype.setItemsList = function(value) { return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** * @param {!proto.pb.Item=} opt_value * @param {number=} opt_index * @return {!proto.pb.Item} */ proto.pb.ItemSearchResponse.prototype.addItems = function(opt_value, opt_index) { return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.pb.Item, opt_index); }; /** * Clears the list making it empty but non-null. * @return {!proto.pb.ItemSearchResponse} returns this */ proto.pb.ItemSearchResponse.prototype.clearItemsList = function() { return this.setItemsList([]); }; /** * optional int64 total = 2; * @return {number} */ proto.pb.ItemSearchResponse.prototype.getTotal = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** * @param {number} value * @return {!proto.pb.ItemSearchResponse} returns this */ proto.pb.ItemSearchResponse.prototype.setTotal = function(value) { return jspb.Message.setProto3IntField(this, 2, value); }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.pb.ItemCreateRequest.prototype.toObject = function(opt_includeInstance) { return proto.pb.ItemCreateRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.pb.ItemCreateRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.pb.ItemCreateRequest.toObject = function(includeInstance, msg) { var f, obj = { valuesMap: (f = msg.getValuesMap()) ? f.toObject(includeInstance, undefined) : [] }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.pb.ItemCreateRequest} */ proto.pb.ItemCreateRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.pb.ItemCreateRequest; return proto.pb.ItemCreateRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.pb.ItemCreateRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.pb.ItemCreateRequest} */ proto.pb.ItemCreateRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 2: var value = msg.getValuesMap(); reader.readMessage(value, function(message, reader) { jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", ""); }); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.pb.ItemCreateRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.pb.ItemCreateRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.pb.ItemCreateRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.pb.ItemCreateRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getValuesMap(true); if (f && f.getLength() > 0) { f.serializeBinary(2, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString); } }; /** * map<string, string> values = 2; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` * @return {!jspb.Map<string,string>} */ proto.pb.ItemCreateRequest.prototype.getValuesMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map<string,string>} */ ( jspb.Message.getMapField(this, 2, opt_noLazyCreate, null)); }; /** * Clears values from the map. The map will be non-null. * @return {!proto.pb.ItemCreateRequest} returns this */ proto.pb.ItemCreateRequest.prototype.clearValuesMap = function() { this.getValuesMap().clear(); return this;}; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.pb.ItemCreateResponse.prototype.toObject = function(opt_includeInstance) { return proto.pb.ItemCreateResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.pb.ItemCreateResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.pb.ItemCreateResponse.toObject = function(includeInstance, msg) { var f, obj = { id: jspb.Message.getFieldWithDefault(msg, 1, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.pb.ItemCreateResponse} */ proto.pb.ItemCreateResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.pb.ItemCreateResponse; return proto.pb.ItemCreateResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.pb.ItemCreateResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.pb.ItemCreateResponse} */ proto.pb.ItemCreateResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readInt64()); msg.setId(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.pb.ItemCreateResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.pb.ItemCreateResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.pb.ItemCreateResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.pb.ItemCreateResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getId(); if (f !== 0) { writer.writeInt64( 1, f ); } }; /** * optional int64 id = 1; * @return {number} */ proto.pb.ItemCreateResponse.prototype.getId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value * @return {!proto.pb.ItemCreateResponse} returns this */ proto.pb.ItemCreateResponse.prototype.setId = function(value) { return jspb.Message.setProto3IntField(this, 1, value); }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.pb.ItemReadRequest.prototype.toObject = function(opt_includeInstance) { return proto.pb.ItemReadRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.pb.ItemReadRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.pb.ItemReadRequest.toObject = function(includeInstance, msg) { var f, obj = { id: jspb.Message.getFieldWithDefault(msg, 1, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.pb.ItemReadRequest} */ proto.pb.ItemReadRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.pb.ItemReadRequest; return proto.pb.ItemReadRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.pb.ItemReadRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.pb.ItemReadRequest} */ proto.pb.ItemReadRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readInt64()); msg.setId(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.pb.ItemReadRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.pb.ItemReadRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.pb.ItemReadRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.pb.ItemReadRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getId(); if (f !== 0) { writer.writeInt64( 1, f ); } }; /** * optional int64 id = 1; * @return {number} */ proto.pb.ItemReadRequest.prototype.getId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value * @return {!proto.pb.ItemReadRequest} returns this */ proto.pb.ItemReadRequest.prototype.setId = function(value) { return jspb.Message.setProto3IntField(this, 1, value); }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.pb.ItemReadResponse.prototype.toObject = function(opt_includeInstance) { return proto.pb.ItemReadResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.pb.ItemReadResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.pb.ItemReadResponse.toObject = function(includeInstance, msg) { var f, obj = { item: (f = msg.getItem()) && proto_item_pb.Item.toObject(includeInstance, f) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.pb.ItemReadResponse} */ proto.pb.ItemReadResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.pb.ItemReadResponse; return proto.pb.ItemReadResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.pb.ItemReadResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.pb.ItemReadResponse} */ proto.pb.ItemReadResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto_item_pb.Item; reader.readMessage(value,proto_item_pb.Item.deserializeBinaryFromReader); msg.setItem(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.pb.ItemReadResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.pb.ItemReadResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.pb.ItemReadResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.pb.ItemReadResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getItem(); if (f != null) { writer.writeMessage( 1, f, proto_item_pb.Item.serializeBinaryToWriter ); } }; /** * optional Item item = 1; * @return {?proto.pb.Item} */ proto.pb.ItemReadResponse.prototype.getItem = function() { return /** @type{?proto.pb.Item} */ ( jspb.Message.getWrapperField(this, proto_item_pb.Item, 1)); }; /** * @param {?proto.pb.Item|undefined} value * @return {!proto.pb.ItemReadResponse} returns this */ proto.pb.ItemReadResponse.prototype.setItem = function(value) { return jspb.Message.setWrapperField(this, 1, value); }; /** * Clears the message field making it undefined. * @return {!proto.pb.ItemReadResponse} returns this */ proto.pb.ItemReadResponse.prototype.clearItem = function() { return this.setItem(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.pb.ItemReadResponse.prototype.hasItem = function() { return jspb.Message.getField(this, 1) != null; }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.pb.ItemUpdateRequest.prototype.toObject = function(opt_includeInstance) { return proto.pb.ItemUpdateRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.pb.ItemUpdateRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.pb.ItemUpdateRequest.toObject = function(includeInstance, msg) { var f, obj = { id: jspb.Message.getFieldWithDefault(msg, 1, 0), valuesMap: (f = msg.getValuesMap()) ? f.toObject(includeInstance, undefined) : [] }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.pb.ItemUpdateRequest} */ proto.pb.ItemUpdateRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.pb.ItemUpdateRequest; return proto.pb.ItemUpdateRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.pb.ItemUpdateRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.pb.ItemUpdateRequest} */ proto.pb.ItemUpdateRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readInt64()); msg.setId(value); break; case 2: var value = msg.getValuesMap(); reader.readMessage(value, function(message, reader) { jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", ""); }); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.pb.ItemUpdateRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.pb.ItemUpdateRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.pb.ItemUpdateRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.pb.ItemUpdateRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getId(); if (f !== 0) { writer.writeInt64( 1, f ); } f = message.getValuesMap(true); if (f && f.getLength() > 0) { f.serializeBinary(2, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString); } }; /** * optional int64 id = 1; * @return {number} */ proto.pb.ItemUpdateRequest.prototype.getId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value * @return {!proto.pb.ItemUpdateRequest} returns this */ proto.pb.ItemUpdateRequest.prototype.setId = function(value) { return jspb.Message.setProto3IntField(this, 1, value); }; /** * map<string, string> values = 2; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` * @return {!jspb.Map<string,string>} */ proto.pb.ItemUpdateRequest.prototype.getValuesMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map<string,string>} */ ( jspb.Message.getMapField(this, 2, opt_noLazyCreate, null)); }; /** * Clears values from the map. The map will be non-null. * @return {!proto.pb.ItemUpdateRequest} returns this */ proto.pb.ItemUpdateRequest.prototype.clearValuesMap = function() { this.getValuesMap().clear(); return this;}; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.pb.ItemUpdateResponse.prototype.toObject = function(opt_includeInstance) { return proto.pb.ItemUpdateResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.pb.ItemUpdateResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.pb.ItemUpdateResponse.toObject = function(includeInstance, msg) { var f, obj = { rowsaffected: jspb.Message.getFieldWithDefault(msg, 1, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.pb.ItemUpdateResponse} */ proto.pb.ItemUpdateResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.pb.ItemUpdateResponse; return proto.pb.ItemUpdateResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.pb.ItemUpdateResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.pb.ItemUpdateResponse} */ proto.pb.ItemUpdateResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readInt64()); msg.setRowsaffected(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.pb.ItemUpdateResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.pb.ItemUpdateResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.pb.ItemUpdateResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.pb.ItemUpdateResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getRowsaffected(); if (f !== 0) { writer.writeInt64( 1, f ); } }; /** * optional int64 rowsaffected = 1; * @return {number} */ proto.pb.ItemUpdateResponse.prototype.getRowsaffected = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value * @return {!proto.pb.ItemUpdateResponse} returns this */ proto.pb.ItemUpdateResponse.prototype.setRowsaffected = function(value) { return jspb.Message.setProto3IntField(this, 1, value); }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.pb.ItemDeleteRequest.prototype.toObject = function(opt_includeInstance) { return proto.pb.ItemDeleteRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.pb.ItemDeleteRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.pb.ItemDeleteRequest.toObject = function(includeInstance, msg) { var f, obj = { id: jspb.Message.getFieldWithDefault(msg, 1, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.pb.ItemDeleteRequest} */ proto.pb.ItemDeleteRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.pb.ItemDeleteRequest; return proto.pb.ItemDeleteRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.pb.ItemDeleteRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.pb.ItemDeleteRequest} */ proto.pb.ItemDeleteRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readInt64()); msg.setId(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.pb.ItemDeleteRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.pb.ItemDeleteRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.pb.ItemDeleteRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.pb.ItemDeleteRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getId(); if (f !== 0) { writer.writeInt64( 1, f ); } }; /** * optional int64 id = 1; * @return {number} */ proto.pb.ItemDeleteRequest.prototype.getId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value * @return {!proto.pb.ItemDeleteRequest} returns this */ proto.pb.ItemDeleteRequest.prototype.setId = function(value) { return jspb.Message.setProto3IntField(this, 1, value); }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.pb.ItemDeleteResponse.prototype.toObject = function(opt_includeInstance) { return proto.pb.ItemDeleteResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.pb.ItemDeleteResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.pb.ItemDeleteResponse.toObject = function(includeInstance, msg) { var f, obj = { rowsaffected: jspb.Message.getFieldWithDefault(msg, 1, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.pb.ItemDeleteResponse} */ proto.pb.ItemDeleteResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.pb.ItemDeleteResponse; return proto.pb.ItemDeleteResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.pb.ItemDeleteResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.pb.ItemDeleteResponse} */ proto.pb.ItemDeleteResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readInt64()); msg.setRowsaffected(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.pb.ItemDeleteResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.pb.ItemDeleteResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.pb.ItemDeleteResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.pb.ItemDeleteResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getRowsaffected(); if (f !== 0) { writer.writeInt64( 1, f ); } }; /** * optional int64 rowsaffected = 1; * @return {number} */ proto.pb.ItemDeleteResponse.prototype.getRowsaffected = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value * @return {!proto.pb.ItemDeleteResponse} returns this */ proto.pb.ItemDeleteResponse.prototype.setRowsaffected = function(value) { return jspb.Message.setProto3IntField(this, 1, value); }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.pb.ItemPatchRequest.prototype.toObject = function(opt_includeInstance) { return proto.pb.ItemPatchRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.pb.ItemPatchRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.pb.ItemPatchRequest.toObject = function(includeInstance, msg) { var f, obj = { id: jspb.Message.getFieldWithDefault(msg, 1, 0), key: jspb.Message.getFieldWithDefault(msg, 2, ""), value: jspb.Message.getFieldWithDefault(msg, 3, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.pb.ItemPatchRequest} */ proto.pb.ItemPatchRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.pb.ItemPatchRequest; return proto.pb.ItemPatchRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.pb.ItemPatchRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.pb.ItemPatchRequest} */ proto.pb.ItemPatchRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readInt64()); msg.setId(value); break; case 2: var value = /** @type {string} */ (reader.readString()); msg.setKey(value); break; case 3: var value = /** @type {string} */ (reader.readString()); msg.setValue(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.pb.ItemPatchRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.pb.ItemPatchRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.pb.ItemPatchRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.pb.ItemPatchRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getId(); if (f !== 0) { writer.writeInt64( 1, f ); } f = message.getKey(); if (f.length > 0) { writer.writeString( 2, f ); } f = message.getValue(); if (f.length > 0) { writer.writeString( 3, f ); } }; /** * optional int64 id = 1; * @return {number} */ proto.pb.ItemPatchRequest.prototype.getId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value * @return {!proto.pb.ItemPatchRequest} returns this */ proto.pb.ItemPatchRequest.prototype.setId = function(value) { return jspb.Message.setProto3IntField(this, 1, value); }; /** * optional string key = 2; * @return {string} */ proto.pb.ItemPatchRequest.prototype.getKey = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * @param {string} value * @return {!proto.pb.ItemPatchRequest} returns this */ proto.pb.ItemPatchRequest.prototype.setKey = function(value) { return jspb.Message.setProto3StringField(this, 2, value); }; /** * optional string value = 3; * @return {string} */ proto.pb.ItemPatchRequest.prototype.getValue = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** * @param {string} value * @return {!proto.pb.ItemPatchRequest} returns this */ proto.pb.ItemPatchRequest.prototype.setValue = function(value) { return jspb.Message.setProto3StringField(this, 3, value); }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.pb.ItemPatchResponse.prototype.toObject = function(opt_includeInstance) { return proto.pb.ItemPatchResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.pb.ItemPatchResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.pb.ItemPatchResponse.toObject = function(includeInstance, msg) { var f, obj = { rowsaffected: jspb.Message.getFieldWithDefault(msg, 1, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.pb.ItemPatchResponse} */ proto.pb.ItemPatchResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.pb.ItemPatchResponse; return proto.pb.ItemPatchResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.pb.ItemPatchResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.pb.ItemPatchResponse} */ proto.pb.ItemPatchResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readInt64()); msg.setRowsaffected(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.pb.ItemPatchResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.pb.ItemPatchResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.pb.ItemPatchResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.pb.ItemPatchResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getRowsaffected(); if (f !== 0) { writer.writeInt64( 1, f ); } }; /** * optional int64 rowsaffected = 1; * @return {number} */ proto.pb.ItemPatchResponse.prototype.getRowsaffected = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {number} value * @return {!proto.pb.ItemPatchResponse} returns this */ proto.pb.ItemPatchResponse.prototype.setRowsaffected = function(value) { return jspb.Message.setProto3IntField(this, 1, value); }; goog.object.extend(exports, proto.pb);
// Copyright 2016 Erik Neumann. 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. goog.module('myphysicslab.lab.view.VerticalAlign'); /** Vertical alignment enum, used to specify how to align a LabView's simulation rectangle within its screen rectangle. See {@link myphysicslab.lab.view.CoordMap#make}, {@link myphysicslab.lab.view.SimView#setVerticalAlign}. Also used for alignment of DisplayAxes, see {@link myphysicslab.lab.graph.DisplayAxes#setXAxisAlignment}. * Note that enum types do not appear correctly in the documentation, they appear * as the underlying type (string, number, boolean) instead of the enum type. * see [Dossier issue #32](https://github.com/jleyba/js-dossier/issues/32). * * @enum {string} */ const VerticalAlign = { /** align top */ TOP: 'TOP', /** align middle */ MIDDLE: 'MIDDLE', /** align bottom */ BOTTOM: 'BOTTOM', /** full alignment */ FULL: 'FULL', /** align at a particular value (specified elsewhere) */ VALUE: 'VALUE' }; /** Returns array containing all localized enum choices. * @return {!Array<string>} array containing all localized enum choices. */ VerticalAlign.getChoices = () => [ VerticalAlign.i18n.TOP, VerticalAlign.i18n.MIDDLE, VerticalAlign.i18n.BOTTOM, VerticalAlign.i18n.FULL, VerticalAlign.i18n.VALUE ]; /** Returns array containing all possible enum values. * @return {!Array<!VerticalAlign>} array containing all possible enum values. */ VerticalAlign.getValues = () => [ VerticalAlign.TOP, VerticalAlign.MIDDLE, VerticalAlign.BOTTOM, VerticalAlign.FULL, VerticalAlign.VALUE ]; /** Converts a string to an enum. * @param {string} value the string to convert * @return {!VerticalAlign} the enum corresponding to the value * @throws {!Error} if the value does not represent a valid enum */ VerticalAlign.stringToEnum = value => { const vals = VerticalAlign.getValues(); for (let i=0, len=vals.length; i<len; i++) { if (value === vals[i]) { return vals[i]; } } throw 'invalid VerticalAlign value: '+value; }; /** Set of internationalized strings. @typedef {{ TOP: string, MIDDLE: string, BOTTOM: string, FULL: string, VALUE: string }} */ VerticalAlign.i18n_strings; /** @type {VerticalAlign.i18n_strings} */ VerticalAlign.en = { TOP: 'top', MIDDLE: 'middle', BOTTOM: 'bottom', FULL: 'full', VALUE: 'value' }; /** @private @type {VerticalAlign.i18n_strings} */ VerticalAlign.de_strings = { TOP: 'oben', MIDDLE: 'mitte', BOTTOM: 'unten', FULL: 'voll', VALUE: 'Wert' }; /** @private @type {VerticalAlign.i18n_strings} */ VerticalAlign.es_strings = { TOP: 'superior', MIDDLE: 'medio', BOTTOM: 'fondo', FULL: 'completo', VALUE: 'valor' }; /** Set of internationalized strings. @type {VerticalAlign.i18n_strings} */ VerticalAlign.i18n = VerticalAlign.en; switch(goog.LOCALE) { case 'de': VerticalAlign.i18n = VerticalAlign.de_strings; break; case 'es': VerticalAlign.i18n = VerticalAlign.es_strings; break; default: VerticalAlign.i18n = VerticalAlign.en; break; }; exports = VerticalAlign;
let config = { awardLevel: [ {'lastRank': 1, 'className': 'award champion'}, {'lastRank': 3, 'className': 'award gold'}, {'lastRank': 6, 'className': 'award silver'}, {'lastRank': 10, 'className': 'award bronze'}, ], dataURL: 'ranklist.json', requestTimeout: 25000, requestInterval: 30000, }; export default config;
import React from 'react' import { HomeView } from 'routes/Home/components/HomeView' import { render } from 'enzyme' describe('(View) Home', () => { let _component beforeEach(() => { _component = render(<HomeView />) }) it('Renders a welcome message', () => { const welcome = _component.find('h4') expect(welcome).to.exist() expect(welcome.text()).to.match(/Welcome!/) }) it('Renders an awesome duck image', () => { const duck = _component.find('img') expect(duck).to.exist() expect(duck.attr('alt')).to.match(/This is a duck, because Redux!/) }) })
// Win: COM3 // OSX: /dev/tty.usbserial-EN275366 const config = { dmx: { driver: 'enttec-usb-dmx-pro', device: '/dev/tty.usbserial-EN275366', startChannel: 1, nbChannels: 11, channels: { x: 1, y: 3, speed: 5 } } }; module.exports = config;
import { Component } from 'react' import pt from 'prop-types' import { format, addMonths, subMonths, isDate, getDate, isEqual as isEqualDates, startOfMonth, endOfMonth, eachDay, addWeeks, startOfWeek, endOfWeek, isSameMonth } from 'date-fns' const dateToDayObjects = dateValue => ({ dateValue, label: getDate(dateValue) }) class Kalendaryo extends Component { state = { date: this.props.startCurrentDateAt, selectedDate: this.props.startCurrentDateAt } static defaultProps = { startCurrentDateAt: new Date(), defaultFormat: 'MM/DD/YY' } static propTypes = { render: pt.func.isRequired, onChange: pt.func, onDateChange: pt.func, onSelectedChange: pt.func, defaultFormat: pt.string, startCurrentDateAt: props => !isDate(props.startCurrentDateAt) ? new Error('Value is not an instance of Date') : null } getFormattedDate = (arg = this.state.date, dateFormat) => { if (isDate(arg) && dateFormat === undefined) { return format(arg, this.props.defaultFormat) } if (typeof arg === 'string' && dateFormat === undefined) { return format(this.state.date, arg) } if (isDate(arg) && typeof dateFormat === 'string') { return format(arg, dateFormat) } throw new Error('Invalid arguments passed') } getDateNextMonth = (arg = this.state.date, amount) => { if (isDate(arg) && amount === undefined) { return addMonths(arg, 1) } if (Number.isInteger(arg) && amount === undefined) { return addMonths(this.state.date, arg) } if (isDate(arg) && Number.isInteger(amount)) { return addMonths(arg, amount) } throw new Error('Invalid arguments passed') } getDatePrevMonth = (arg = this.state.date, amount) => { if (isDate(arg) && amount === undefined) { return subMonths(arg, 1) } if (Number.isInteger(arg) && amount === undefined) { return subMonths(this.state.date, arg) } if (isDate(arg) && Number.isInteger(amount)) { return subMonths(arg, amount) } throw new Error('Invalid arguments passed') } getDaysInMonth = (date = this.state.date) => { if (!isDate(date)) throw new Error('Value is not an instance of Date') return eachDay(startOfMonth(date), endOfMonth(date)).map(dateToDayObjects) } getWeeksInMonth = (date = this.state.date) => { if (!isDate(date)) throw new Error('Value is not an instance of Date') const firstDayOfMonth = startOfMonth(date) const firstDayOfFirstWeek = startOfWeek(firstDayOfMonth) const lastDayOfFirstWeek = endOfWeek(firstDayOfMonth) const getWeeks = (startDay, endDay, weekArray = []) => { const week = eachDay(startDay, endDay).map(dateToDayObjects) const weeks = [...weekArray, week] const nextWeek = addWeeks(startDay, 1) const firstDayNextWeek = startOfWeek(nextWeek) const lastDayNextWeek = endOfWeek(nextWeek) if (isSameMonth(firstDayNextWeek, date)) { return getWeeks(firstDayNextWeek, lastDayNextWeek, weeks) } return weeks } return getWeeks(firstDayOfFirstWeek, lastDayOfFirstWeek) } setDate = date => { if (!isDate(date)) throw new Error('Value is not an instance of Date') this.setState({ date }) } setSelectedDate = selectedDate => { if (!isDate(selectedDate)) throw new Error('Value is not an instance of Date') this.setState({ selectedDate }) } pickDate = date => { if (!isDate(date)) throw new Error('Value is not an instance of Date') this.setState({ date, selectedDate: date }) } componentDidUpdate (_, prevState) { const { onChange, onDateChange, onSelectedChange } = this.props const dateChanged = !isEqualDates(prevState.date, this.state.date) const selectedDateChanged = !isEqualDates(prevState.selectedDate, this.state.selectedDate) const stateUpdated = dateChanged || selectedDateChanged if (dateChanged && onDateChange) { onDateChange(this.state.date) } if (selectedDateChanged && onSelectedChange) { onSelectedChange(this.state.selectedDate) } if (stateUpdated && onChange) { onChange(this.state) } } render () { const { state, props, getFormattedDate, getDateNextMonth, getDatePrevMonth, getDaysInMonth, getWeeksInMonth, setDate, setSelectedDate, pickDate } = this const { startCurrentDateAt, defaultFormat, onChange, onDateChange, onSelectedChange, render, ...rest } = props return render({ ...rest, ...state, getFormattedDate, getDateNextMonth, getDatePrevMonth, getDaysInMonth, getWeeksInMonth, setDate, setSelectedDate, pickDate }) } } export default Kalendaryo
// @flow import '@storybook/addon-actions/register'; import '@storybook/addon-links/register'; import '@storybook/addon-options/register';
module.exports.run = async (client, message, args, data) => { if(!data.plugins.economy.enabled) return message.channel.send(`⚠️ Le système d'économie n'est pas activé sur ce serveur. Activez-le avec la commande \`${data.prefix}enable economy\``); const toDeposit = args[0]; const user = await client.findOrCreateUser(message.author); if(!user || user?.money <= 0) return message.channel.send('⚠️ Vous n\'avez pas d\'argent à déposer dans votre banque.'); if(toDeposit === "all") { message.channel.send(`✅ **${user.money}${data.plugins.economy.currency}** ont été déposés dans votre banque.`); user.bank = user.bank + user.money; user.money = 0; user.markModified("money"); user.save(); } else { if(toDeposit <= 0 || isNaN(toDeposit) || toDeposit > user.money) return message.channel.send('⚠️ Vous ne pouvez pas déposer un nombre nul ou négatif ou plus de ce que vous avez.'); message.channel.send(`✅ **${parseInt(toDeposit)}${data.plugins.economy.currency}** ont été déposés dans votre banque.`); user.bank = user.bank + parseInt(toDeposit); user.money = user.money - parseInt(toDeposit); user.markModified("money"); user.save(); } } module.exports.help = { name: "deposit", aliases: ["deposit", "dep", "dp"], category: "Economy", description: "Déposer l'argent de votre balance dans banque", usage: "<money | all>", cooldown: 5, memberPerms: [], botPerms: [], args: true }
/* Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.lang['tt']={"editor":"Форматлаулы текст өлкәсе","editorPanel":"Rich Text Editor panel","common":{"editorHelp":"Ярдәм өчен ALT 0 басыгыз","browseServer":"Сервер карап чыгу","url":"Сылталама","protocol":"Протокол","upload":"Йөкләү","uploadSubmit":"Серверга җибәрү","image":"Рәсем","flash":"Флеш","form":"Форма","checkbox":"Чекбокс","radio":"Радио төймә","textField":"Текст кыры","textarea":"Текст мәйданы","hiddenField":"Яшерен кыр","button":"Төймə","select":"Сайлау кыры","imageButton":"Рәсемле төймə","notSet":"<билгеләнмәгән>","id":"Id","name":"Исем","langDir":"Язылыш юнəлеше","langDirLtr":"Сулдан уңга язылыш (LTR)","langDirRtl":"Уңнан сулга язылыш (RTL)","langCode":"Тел коды","longDescr":"Җентекле тасвирламага сылталама","cssClass":"Стильләр класслары","advisoryTitle":"Киңәш исем","cssStyle":"Стиль","ok":"Тәмам","cancel":"Баш тарту","close":"Чыгу","preview":"Карап алу","resize":"Зурлыкны үзгәртү","generalTab":"Төп","advancedTab":"Киңәйтелгән көйләүләр","validateNumberFailed":"Әлеге кыйммәт сан түгел.","confirmNewPage":"Any unsaved changes to this content will be lost. Are you sure you want to load new page?","confirmCancel":"You have changed some options. Are you sure you want to close the dialog window?","options":"Үзлекләр","target":"Максат","targetNew":"Яңа тәрәзә (_blank)","targetTop":"Өске тәрәзә (_top)","targetSelf":"Шул үк тәрәзә (_self)","targetParent":"Ана тәрәзә (_parent)","langDirLTR":"Сулдан уңга язылыш (LTR)","langDirRTL":"Уңнан сулга язылыш (RTL)","styles":"Стиль","cssClasses":"Стильләр класслары","width":"Киңлек","height":"Биеклек","align":"Тигезләү","alignLeft":"Сул якка","alignRight":"Уң якка","alignCenter":"Үзәккә","alignJustify":"Киңлеккә карап тигезләү","alignTop":"Өскә","alignMiddle":"Уртага","alignBottom":"Аска","alignNone":"Һичбер","invalidValue":"Дөрес булмаган кыйммәт.","invalidHeight":"Биеклек сан булырга тиеш.","invalidWidth":"Киңлек сан булырга тиеш.","invalidCssLength":"Value specified for the \"%1\" field must be a positive number with or without a valid CSS measurement unit (px, %, in, cm, mm, em, ex, pt, or pc).","invalidHtmlLength":"Value specified for the \"%1\" field must be a positive number with or without a valid HTML measurement unit (px or %).","invalidInlineStyle":"Value specified for the inline style must consist of one or more tuples with the format of \"name : value\", separated by semi-colons.","cssLengthTooltip":"Enter a number for a value in pixels or a number with a valid CSS unit (px, %, in, cm, mm, em, ex, pt, or pc).","unavailable":"%1<span class=\"cke_accessibility\">, unavailable</span>"},"about":{"copy":"Copyright &copy; $1. Бар хокуклар сакланган","dlgTitle":"CKEditor турында","help":"Ярдәм өчен $1 тикшереп карагыз.","moreInfo":"For licensing information please visit our web site:","title":"CKEditor турында","userGuide":"CKEditor кулланмасы"},"basicstyles":{"bold":"Калын","italic":"Курсив","strike":"Сызылган","subscript":"Аскы индекс","superscript":"Өске индекс","underline":"Астына сызылган"},"blockquote":{"toolbar":"Өземтә блогы"},"clipboard":{"copy":"Күчермәләү","copyError":"Браузерыгызның иминлек үзлекләре автоматик рәвештә күчермәләү үтәүне тыя. Тиз төймәләрне (Ctrl/Cmd+C) кулланыгыз.","cut":"Кисеп алу","cutError":"Браузерыгызның иминлек үзлекләре автоматик рәвештә күчермәләү үтәүне тыя. Тиз төймәләрне (Ctrl/Cmd+C) кулланыгыз.","paste":"Өстәү","pasteArea":"Өстәү мәйданы","pasteMsg":"Please paste inside the following box using the keyboard (<strong>Ctrl/Cmd+V</strong>) and hit OK","securityMsg":"Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.","title":"Өстәү"},"codemirror":{"toolbar":"Source","searchCode":"Search Source","autoFormat":"Format Selection","commentSelectedRange":"Comment Selection","uncommentSelectedRange":"Uncomment Selection","autoCompleteToggle":"Enable/Disable HTML Tag Autocomplete"},"button":{"selectedLabel":"%1 (Сайланган)"},"colorbutton":{"auto":"Автоматик","bgColorTitle":"Фон төсе","colors":{"000":"Кара","800000":"Бордо","8B4513":"Дарчин","2F4F4F":"Аспид соры","008080":"Күкле-яшелле","000080":"Куе күк","4B0082":"Индиго","696969":"Куе соры","B22222":"Кармин","A52A2A":"Чия кызыл","DAA520":"Алтын каен","006400":"Үлән","40E0D0":"Фирәзә","0000CD":"Фарсы күк","800080":"Шәмәхә","808080":"Соры","F00":"Кызыл","FF8C00":"Кабак","FFD700":"Алтын","008000":"Яшел","0FF":"Ачык зәңгәр","00F":"Зәңгәр","EE82EE":"Миләүшә","A9A9A9":"Ачык соры","FFA07A":"Кызгылт сары алсу","FFA500":"Кызгылт сары","FFFF00":"Сары","00FF00":"Лайм","AFEEEE":"Тонык күк","ADD8E6":"Тонык күкбаш","DDA0DD":"Аксыл шәмәхә","D3D3D3":"Ачык соры","FFF0F5":"Ал ала миләүшә","FAEBD7":"Җитен","FFFFE0":"Ачык сары","F0FFF0":"Аксыл көрән","F0FFFF":"Ап-ак","F0F8FF":"Аксыл зәңгәр диңгез","E6E6FA":"Ала миләүшә","FFF":"Ак"},"more":"Башка төсләр...","panelTitle":"Төсләр","textColorTitle":"Текст төсе"},"contextmenu":{"options":"Контекст меню үзлекләре"},"elementspath":{"eleLabel":"Elements path","eleTitle":"%1 элемент"},"find":{"find":"Эзләү","findOptions":"Эзләү көйләүләре","findWhat":"Нәрсә эзләргә:","matchCase":"Баш һәм юл хәрефләрен исәпкә алу","matchCyclic":"Кабатлап эзләргә","matchWord":"Сүзләрне тулысынча гына эзләү","notFoundMsg":"Эзләнгән текст табылмады.","replace":"Алмаштыру","replaceAll":"Барысын да алмаштыру","replaceSuccessMsg":"%1 урында(ларда) алмаштырылган.","replaceWith":"Нәрсәгә алмаштыру:","title":"Эзләп табу һәм алмаштыру"},"format":{"label":"Форматлау","panelTitle":"Параграф форматлавы","tag_address":"Адрес","tag_div":"Гади (DIV)","tag_h1":"Башлам 1","tag_h2":"Башлам 2","tag_h3":"Башлам 3","tag_h4":"Башлам 4","tag_h5":"Башлам 5","tag_h6":"Башлам 6","tag_p":"Гади","tag_pre":"Форматлаулы"},"horizontalrule":{"toolbar":"Ятма сызык өстәү"},"image":{"alt":"Альтернатив текст","border":"Чик","btnUpload":"Серверга җибәрү","button2Img":"Do you want to transform the selected image button on a simple image?","hSpace":"Горизонталь ара","img2Button":"Do you want to transform the selected image on a image button?","infoTab":"Рәсем тасвирламасы","linkTab":"Сылталама","lockRatio":"Lock Ratio","menu":"Рәсем үзлекләре","resetSize":"Баштагы зурлык","title":"Рәсем үзлекләре","titleButton":"Рәсемле төймə үзлекләре","upload":"Йөкләү","urlMissing":"Image source URL is missing.","vSpace":"Вертикаль ара","validateBorder":"Чик киңлеге сан булырга тиеш.","validateHSpace":"Горизонталь ара бөтен сан булырга тиеш.","validateVSpace":"Вертикаль ара бөтен сан булырга тиеш."},"indent":{"indent":"Отступны арттыру","outdent":"Отступны кечерәйтү"},"justify":{"block":"Киңлеккә карап тигезләү","center":"Үзәккә тигезләү","left":"Сул як кырыйдан тигезләү","right":"Уң як кырыйдан тигезләү"},"fakeobjects":{"anchor":"Якорь","flash":"Флеш анимациясы","hiddenfield":"Яшерен кыр","iframe":"IFrame","unknown":"Танылмаган объект"},"link":{"acccessKey":"Access Key","advanced":"Киңәйтелгән көйләүләр","advisoryContentType":"Advisory Content Type","advisoryTitle":"Киңәш исем","anchor":{"toolbar":"Якорь","menu":"Якорьне үзгәртү","title":"Якорь үзлекләре","name":"Якорь исеме","errorName":"Якорьнең исемен языгыз","remove":"Якорьне бетерү"},"anchorId":"Элемент идентификаторы буенча","anchorName":"Якорь исеме буенча","charset":"Linked Resource Charset","cssClasses":"Стильләр класслары","emailAddress":"Электрон почта адресы","emailBody":"Хат эчтәлеге","emailSubject":"Хат темасы","id":"Идентификатор","info":"Сылталама тасвирламасы","langCode":"Тел коды","langDir":"Язылыш юнəлеше","langDirLTR":"Сулдан уңга язылыш (LTR)","langDirRTL":"Уңнан сулга язылыш (RTL)","menu":"Сылталамаyны үзгәртү","name":"Исем","noAnchors":"(Әлеге документта якорьләр табылмады)","noEmail":"Электрон почта адресын языгыз","noUrl":"Сылталаманы языгыз","other":"<бүтән>","popupDependent":"Бәйле (Netscape)","popupFeatures":"Popup Window Features","popupFullScreen":"Тулы экран (IE)","popupLeft":"Left Position","popupLocationBar":"Location Bar","popupMenuBar":"Menu Bar","popupResizable":"Resizable","popupScrollBars":"Scroll Bars","popupStatusBar":"Status Bar","popupToolbar":"Toolbar","popupTop":"Top Position","rel":"Бәйләнеш","selectAnchor":"Якорьне сайлау","styles":"Стиль","tabIndex":"Tab Index","target":"Максат","targetFrame":"<frame>","targetFrameName":"Target Frame Name","targetPopup":"<popup window>","targetPopupName":"Попап тәрәзәсе исеме","title":"Сылталама","toAnchor":"Якорьне текст белән бәйләү","toEmail":"Электрон почта","toUrl":"Сылталама","toolbar":"Сылталама","type":"Сылталама төре","unlink":"Сылталаманы бетерү","upload":"Йөкләү"},"list":{"bulletedlist":"Маркерлы тезмә өстәү/бетерү","numberedlist":" Номерланган тезмә өстәү/бетерү"},"magicline":{"title":"Бирегә параграф өстәү"},"maximize":{"maximize":"Зурайту","minimize":"Кечерәйтү"},"widget":{"move":"Күчереп куер өчен басып шудырыгыз"},"oembed":{"title":"Embed Media Content (Photo, Video, Audio or Rich Content)","button":"Embed Media from External Sites","pasteUrl":"Paste a URL (shorted URLs are also supported) from one of the supported sites (e.g. YouTube, Flickr, Qik, Vimeo, Hulu, Viddler, MyOpera, etc.).","invalidUrl":"Please provide a valid URL.","noEmbedCode":"No embed code found, or site is not supported.","url":"URL:","width":"Width:","height":"Height:","widthTitle":"Width for the embeded content","heightTitle":"Height for the embeded content","maxWidth":"Max. Width:","maxHeight":"Max. Height:","maxWidthTitle":"Maximum Width for the embeded Content","maxHeightTitle":"Maximum Height for the embeded Content","none":"None","resizeType":"Resize Type (videos only):","noresize":"No Resize (use default)","responsive":"Responsive Resize","custom":"Specific Resize","noVimeo":"The owner of this video has set domain restrictions and you will not be able to embed it on your website.","Error":"Media Content could not been retrieved, please try a different URL."},"pagebreak":{"alt":"Бит бүлгече","toolbar":"Бастыру өчен бит бүлгечен өстәү"},"pastefromword":{"confirmCleanup":"The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?","error":"It was not possible to clean up the pasted data due to an internal error","title":"Word'тан өстәү","toolbar":"Word'тан өстәү"},"pastetext":{"button":"Форматлаусыз текст өстәү","title":"Форматлаусыз текст өстәү"},"print":{"toolbar":"Бастыру"},"removeformat":{"toolbar":"Форматлауны бетерү"},"scayt":{"btn_about":"About SCAYT","btn_dictionaries":"Dictionaries","btn_disable":"Disable SCAYT","btn_enable":"Enable SCAYT","btn_langs":"Languages","btn_options":"Options","text_title":"Spell Check As You Type"},"selectall":{"toolbar":"Барысын сайлау"},"showblocks":{"toolbar":"Блокларны күрсәтү"},"smiley":{"options":"Смайл көйләүләре","title":"Смайл өстәү","toolbar":"Смайл"},"sourcearea":{"toolbar":"Чыганак"},"specialchar":{"options":"Махсус символ үзлекләре","title":"Махсус символ сайлау","toolbar":"Махсус символ өстәү"},"stylescombo":{"label":"Стильләр","panelTitle":"Форматлау стильләре","panelTitle1":"Блоклар стильләре","panelTitle2":"Эчке стильләр","panelTitle3":"Объектлар стильләре"},"syntaxhighlight":{"title":"Add or update a code snippet","contextTitle":"Edit source code","sourceTab":"Source code","langLbl":"Select language","sourceTextareaEmptyError":"Source code mustn't be empty.","advancedTab":"Advanced","hideGutter":"Hide gutter","hideGutterLbl":"Hide gutter & line numbers.","hideControls":"Hide controls","hideControlsLbl":"Hide code controls at the top of the code block.","collapse":"Collapse","collapseLbl":"Collapse the code block by default. (controls need to be turned on)","codeTitleLbl":"Use a Code Title","showColumns":"Show columns","showColumnsLbl":"Show row columns in the first line.","lineWrap":"Disable line wrapping","lineWrapLbl":"Switch off line wrapping.","lineCount":"Default line count","highlight":"Highlight lines","highlightLbl":"Enter a comma seperated lines of lines you want to highlight, eg <em style=\"font-style:italic\">3,10,15</em>."},"table":{"border":"Чик калынлыгы","caption":"Исем","cell":{"menu":"Күзәнәк","insertBefore":"Алдына күзәнәк өстәү","insertAfter":"Артына күзәнәк өстәү","deleteCell":"Күзәнәкләрне бетерү","merge":"Күзәнәкләрне берләштерү","mergeRight":"Уң яктагы белән берләштерү","mergeDown":"Астагы белән берләштерү","splitHorizontal":"Күзәнәкне юлларга бүлү","splitVertical":"Күзәнәкне баганаларга бүлү","title":"Күзәнәк үзлекләре","cellType":"Күзәнәк төре","rowSpan":"Юлларны берләштерү","colSpan":"Баганаларны берләштерү","wordWrap":"Текстны күчерү","hAlign":"Ятма тигезләү","vAlign":"Асма тигезләү","alignBaseline":"Таяныч сызыгы","bgColor":"Фон төсе","borderColor":"Чик төсе","data":"Мәгълүмат","header":"Башлык","yes":"Әйе","no":"Юк","invalidWidth":"Cell width must be a number.","invalidHeight":"Cell height must be a number.","invalidRowSpan":"Rows span must be a whole number.","invalidColSpan":"Columns span must be a whole number.","chooseColor":"Сайлау"},"cellPad":"Cell padding","cellSpace":"Cell spacing","column":{"menu":"Багана","insertBefore":"Сулдан баганалар өстәү","insertAfter":"Уңнан баганалар өстәү","deleteColumn":"Баганаларны бетерү"},"columns":"Баганалар","deleteTable":"Таблицаны бетерү","headers":"Башлыклар","headersBoth":"Икесе дә","headersColumn":"Беренче багана","headersNone":"Һичбер","headersRow":"Беренче юл","invalidBorder":"Чик киңлеге сан булырга тиеш.","invalidCellPadding":"Cell padding must be a positive number.","invalidCellSpacing":"Күзәнәкләр аралары уңай сан булырга тиеш.","invalidCols":"Number of columns must be a number greater than 0.","invalidHeight":"Таблица биеклеге сан булырга тиеш.","invalidRows":"Number of rows must be a number greater than 0.","invalidWidth":"Таблица киңлеге сан булырга тиеш","menu":"Таблица үзлекләре","row":{"menu":"Юл","insertBefore":"Өстән юллар өстәү","insertAfter":"Астан юллар өстәү","deleteRow":"Юлларны бетерү"},"rows":"Юллар","summary":"Йомгаклау","title":"Таблица үзлекләре","toolbar":"Таблица","widthPc":"процент","widthPx":"Нокталар","widthUnit":"киңлек берәмлеге"},"toolbar":{"toolbarCollapse":"Collapse Toolbar","toolbarExpand":"Expand Toolbar","toolbarGroups":{"document":"Документ","clipboard":"Алмашу буферы/Кайтару","editing":"Төзәтү","forms":"Формалар","basicstyles":"Төп стильләр","paragraph":"Параграф","links":"Сылталамалар","insert":"Өстәү","styles":"Стильләр","colors":"Төсләр","tools":"Кораллар"},"toolbars":"Editor toolbars"},"undo":{"redo":"Кабатлау","undo":"Кайтару"},"wsc":{"btnIgnore":"Ignore","btnIgnoreAll":"Ignore All","btnReplace":"Replace","btnReplaceAll":"Replace All","btnUndo":"Undo","changeTo":"Change to","errorLoading":"Error loading application service host: %s.","ieSpellDownload":"Spell checker not installed. Do you want to download it now?","manyChanges":"Spell check complete: %1 words changed","noChanges":"Spell check complete: No words changed","noMispell":"Spell check complete: No misspellings found","noSuggestions":"- No suggestions -","notAvailable":"Sorry, but service is unavailable now.","notInDic":"Not in dictionary","oneChange":"Spell check complete: One word changed","progress":"Spell check in progress...","title":"Spell Checker","toolbar":"Check Spelling"}};
/** * Copyright IBM Corp. 2019, 2020 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. * * Code generated by @carbon/icon-build-helpers. DO NOT EDIT. */ 'use strict'; var Icon = require('../Icon-1083255b.js'); var React = require('react'); require('@carbon/icon-helpers'); require('prop-types'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var React__default = /*#__PURE__*/_interopDefaultLegacy(React); var _path, _circle, _path2, _path3; var SysProvision20 = /*#__PURE__*/React__default['default'].forwardRef(function SysProvision20(_ref, ref) { var children = _ref.children, rest = Icon._objectWithoutProperties(_ref, ["children"]); return /*#__PURE__*/React__default['default'].createElement(Icon.Icon, Icon._extends({ width: 20, height: 20, viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", ref: ref }, rest), _path || (_path = /*#__PURE__*/React__default['default'].createElement("path", { d: "M21 20L21 30 30 25 21 20z" })), _circle || (_circle = /*#__PURE__*/React__default['default'].createElement("circle", { cx: "14", cy: "14", r: "2" })), _path2 || (_path2 = /*#__PURE__*/React__default['default'].createElement("path", { d: "M14,20a6,6,0,1,1,6-6A6.0066,6.0066,0,0,1,14,20Zm0-10a4,4,0,1,0,4,4A4.0045,4.0045,0,0,0,14,10Z" })), _path3 || (_path3 = /*#__PURE__*/React__default['default'].createElement("path", { d: "M25.9512,12.91l-.0064,0A12.05,12.05,0,1,0,17,25.605V23.5386a9.9813,9.9813,0,1,1,6.6235-6.81l1.9248.544A12.0341,12.0341,0,0,0,26,14Q26,13.4492,25.9512,12.91Z" })), children); }); module.exports = SysProvision20;
import { createStore, applyMiddleware, compose } from 'redux'; import thunk from 'redux-thunk'; import { createHashHistory } from 'history'; import { routerMiddleware, routerActions } from 'react-router-redux'; import { createLogger } from 'redux-logger'; import { persistStore, persistReducer } from 'redux-persist'; import createElectronStorage from 'redux-persist-electron-storage'; import { enableBatching } from 'redux-batched-actions'; import rootReducer from '../reducers'; const history = createHashHistory(); const persistConfig = { key: 'root', storage: createElectronStorage(), blacklist: ['visibilityFilter', 'subjectsModal'] }; const persistedReducer = persistReducer(persistConfig, rootReducer); const configureStore = (initialState?: counterStateType) => { // Redux Configuration const middleware = []; const enhancers = []; // Thunk Middleware middleware.push(thunk); // Logging Middleware const logger = createLogger({ level: 'info', collapsed: true }); // Skip redux logs in console during the tests if (process.env.NODE_ENV !== 'test') { middleware.push(logger); } // Router Middleware const router = routerMiddleware(history); middleware.push(router); // Redux DevTools Configuration const actionCreators = { ...routerActions }; // If Redux DevTools Extension is installed use it, otherwise use Redux compose /* eslint-disable no-underscore-dangle */ const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({ // Options: http://zalmoxisus.github.io/redux-devtools-extension/API/Arguments.html actionCreators }) : compose; /* eslint-enable no-underscore-dangle */ // Apply Middleware & Compose Enhancers enhancers.push(applyMiddleware(...middleware)); const enhancer = composeEnhancers(...enhancers); // Create Store const reducer = enableBatching(persistedReducer); const store = createStore(reducer, initialState, enhancer); if (module.hot) { module.hot.accept( '../reducers', () => store.replaceReducer(require('../reducers')) // eslint-disable-line global-require ); } const persistor = persistStore(store); return { store, persistor }; }; export default { configureStore, history };
class Paddle extends GameEntity{ constructor(x, y, canvas) { super(x, y, canvas); this.vector = new MovementVector(1, 0, 0); this.hitbox = new HitBox(x, y, Paddle.WIDTH, Paddle.HEIGHT); this.image = new ImageRectangle(Paddle.WIDTH, Paddle.HEIGHT, Paddle.COLOR, this.context); } static get HEIGHT() { return 4; } static get WIDTH() { return 80; } static get COLOR() { return 'ghostwhite'; } static get SPEED() { return 10; } update() { super.update(); // Stop at edges if (this.x < 0) { this.x = 0; this.moveX = 0; this.vector.magnitude = 0; } else if (this.x + Paddle.WIDTH > this.canvas.width) { this.x = this.canvas.width - Paddle.WIDTH; this.moveX = 0; this.vector.magnitude = 0; } // Update hitbox this.hitbox.setPosition(this.x, this.y); } }
(function (_, $) { $.ceEvent('on', 'ce.commoninit', function (context) { $('.cm-yad-city', context).autocomplete({ delay: 600, source: function source(request, response) { var url = 'yandex_delivery.autocomplete?type=locality&q=' + encodeURIComponent(request.term); $.ceAjax('request', fn_url(url), { callback: function callback(data) { response(data.autocomplete); } }); } }); $('.cm-yad-address', context).autocomplete({ delay: 600, source: function source(request, response) { var city = $('.cm-yad-city').val(); if (city) { var url = 'yandex_delivery.autocomplete?type=street&city=' + city + '&q=' + encodeURIComponent(request.term); $.ceAjax('request', fn_url(url), { callback: function callback(data) { response(data.autocomplete); } }); } } }); }); })(Tygh, Tygh.$);
$(document).ready(() => { // Getting references to our form and inputs const signInBtn = $("form.form-signin"); const emailInput = $("input#inputEmail"); const passwordInput = $("input#inputPassword"); // When the form is submitted, we validate there's an email and password entered signInBtn.on("submit", event => { event.preventDefault(); const userData = { email: emailInput.val().trim(), password: passwordInput.val().trim() }; if (!userData.email || !userData.password) { return; } // If we have an email and password we run the loginUser function and clear the form signInUser(userData.email, userData.password); emailInput.val(""); passwordInput.val(""); }); // loginUser does a post to our "api/login" route and if successful, redirects us the the members page const signInUser = async (email, password) => { await $.post("/api/sign-in", { email: email, password: password }); try { window.location.replace("/user"); // If there's an error, log the error } catch (err) { console.log(err); } }; });
import React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon(React.createElement(React.Fragment, null, React.createElement("path", { d: "M12 4c-4.41 0-8 3.59-8 8s3.59 8 8 8 8-3.59 8-8-3.59-8-8-8zm0 12.5c-2.49 0-4.5-2.01-4.5-4.5S9.51 7.5 12 7.5s4.5 2.01 4.5 4.5-2.01 4.5-4.5 4.5z", opacity: ".3" }), React.createElement("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm0-12.5c-2.49 0-4.5 2.01-4.5 4.5s2.01 4.5 4.5 4.5 4.5-2.01 4.5-4.5-2.01-4.5-4.5-4.5zm0 5.5c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1z" })), 'AlbumTwoTone');
angular.module('customElements') .directive('postEditor',[ function(){ return { restrict:'A', scope:{ id:'=postEditor', comment: '=', sharedId: '=', sharingType:'=', close:'=close', onvalidation:'=?' }, controller: 'post_editor_controller', controllerAs: 'ctrl', templateUrl: 'app/shared/custom_elements/post/post_editor.html' }; } ]);
const testFunctionalConfig = { port: 3000, polyfills: ['@babel/polyfill'], mode: 'development', storageAdapter: { module: 'resolve-storage-lite', options: {} } } export default testFunctionalConfig
var should = require('should'); var x11 = require('x11'); var async = require('async'); var EVMW = require('../lib/ewmh'); var get_property = require('x11-prop').get_property; var os = require('os'); describe('setting properties...', function() { before(function(done) { var self = this; async.parallel( [ function create_client_1(cb) { x11.createClient(cb); }, function create_client_2(cb) { x11.createClient(cb); } ], function(err, displays) { should.not.exist(err); self.X1 = displays[0].client; self.root = displays[0].screen[0].root; self.X2 = displays[1].client; displays[1].screen[0].root.should.equal(self.root); self.ewmh = new EVMW(self.X1, self.root); self.wid1 = self.X1.AllocID(); self.wid2 = self.X1.AllocID(); self.wid3 = self.X1.AllocID(); self.X2.ChangeWindowAttributes(self.root, { eventMask : x11.eventMask.PropertyChange }); done(); } ); }); it('set_supported should set _NET_SUPPORTED correctly', function(done) { var self = this; var atoms = [ '_NET_WM_ACTION_MOVE', '_NET_WM_ACTION_RESIZE', '_NET_WM_ACTION_MINIMIZE' ]; this.X2.once('event', function(ev) { ev.atom.should.equal(self.X1.atoms._NET_SUPPORTED); get_property(self.X1, self.root, ev.atom, function(err, data) { should.not.exist(err); async.map( atoms, function(prop, cb) { self.X1.InternAtom(false, prop, cb); }, function(err, results) { should.not.exist(err); data.should.eql(results); done(); } ); }); }); this.ewmh.set_supported(atoms); }); it('set_number_of_desktops should set _NET_NUMBER_OF_DESKTOPS correctly', function(done) { var self = this; this.X2.once('event', function(ev) { ev.atom.should.equal(self.X1.atoms._NET_NUMBER_OF_DESKTOPS); get_property(self.X1, self.root, ev.atom, function(err, data) { should.not.exist(err); data.should.eql([ 2 ]); done(); }); }); this.ewmh.set_number_of_desktops(2); }); it('set_current_desktop should set _NET_CURRENT_DESKTOP correctly', function(done) { var self = this; this.X2.once('event', function(ev) { ev.atom.should.equal(self.X1.atoms._NET_CURRENT_DESKTOP); get_property(self.X1, self.root, ev.atom, function(err, data) { should.not.exist(err); data.should.eql([ 1 ]); done(); }); }); this.ewmh.set_current_desktop(1); }); it('update_window_list should set _NET_CLIENT_LIST correctly', function(done) { var self = this; this.X2.once('event', function(ev) { ev.atom.should.equal(self.X1.atoms._NET_CLIENT_LIST); get_property(self.X1, self.root, ev.atom, function(err, data) { should.not.exist(err); data.should.eql([ self.wid1, self.wid2, self.wid3 ]); done(); }); }); this.ewmh.update_window_list([ this.wid1, this.wid2, this.wid3 ]); }); it('update_window_list should set _NET_CLIENT_LIST_STACKING correctly', function(done) { var self = this; this.X2.once('event', function(ev) { ev.atom.should.equal(self.X1.atoms._NET_CLIENT_LIST_STACKING); get_property(self.X1, self.root, ev.atom, function(err, data) { should.not.exist(err); data.should.eql([ self.wid1, self.wid3, self.wid1 ]); done(); }); }); this.ewmh.update_window_list_stacking([ this.wid1, this.wid3, this.wid1 ]); }); it('set_pid should set _NET_WM_PID correctly', function(done) { var self = this; this.X2.once('event', function(ev) { ev.atom.should.equal(self.X1.atoms._NET_WM_PID); get_property(self.X1, self.root, ev.atom, function(err, data) { should.not.exist(err); data.should.eql([ process.pid ]); done(); }); }); this.ewmh.set_pid(this.root); }); it('set_hostname should set WM_CLIENT_MACHINE correctly', function(done) { var self = this; this.X2.once('event', function(ev) { ev.atom.should.equal(self.X1.atoms.WM_CLIENT_MACHINE); get_property(self.X1, self.root, ev.atom, function(err, data) { should.not.exist(err); data.toString().should.eql(os.hostname()); done(); }); }); this.ewmh.set_hostname(this.root); }); it('set_active_window should set _NET_ACTIVE_WINDOW correctly', function(done) { var self = this; this.X2.once('event', function(ev) { ev.atom.should.equal(self.X1.atoms._NET_ACTIVE_WINDOW); get_property(self.X1, self.root, ev.atom, function(err, data) { should.not.exist(err); data.should.eql([ self.wid2 ]); done(); }); }); this.ewmh.set_active_window(this.wid2); }); after(function(done) { async.each( [ this.X1, this.X2 ], function(X, cb) { X.terminate(); X.on('end', cb); }, done ); }); });
var socialUrls = require('@tryghost/social-urls'); function getStructuredData(metaData) { var structuredData, card = 'summary'; if (metaData.twitterImage || metaData.coverImage.url) { card = 'summary_large_image'; } structuredData = { 'og:site_name': metaData.site.title, 'og:type': metaData.ogType, 'og:title': metaData.ogTitle || metaData.metaTitle, // CASE: metaData.excerpt for post context is populated by either the custom excerpt, // the meta description, or the automated excerpt of 50 words. It is empty for any // other context and *always* uses the provided meta description fields. 'og:description': metaData.ogDescription || metaData.excerpt || metaData.metaDescription, 'og:url': metaData.canonicalUrl, 'og:image': metaData.ogImage.url || metaData.coverImage.url, 'article:published_time': metaData.publishedDate, 'article:modified_time': metaData.modifiedDate, 'article:tag': metaData.keywords, 'article:publisher': metaData.site.facebook ? socialUrls.facebook(metaData.site.facebook) : undefined, 'article:author': metaData.authorFacebook ? socialUrls.facebook(metaData.authorFacebook) : undefined, 'twitter:card': card, 'twitter:title': metaData.twitterTitle || metaData.metaTitle, 'twitter:description': metaData.twitterDescription || metaData.excerpt || metaData.metaDescription, 'twitter:url': metaData.canonicalUrl, 'twitter:image': metaData.twitterImage || metaData.coverImage.url, 'twitter:label1': metaData.authorName ? 'Written by' : undefined, 'twitter:data1': metaData.authorName, 'twitter:label2': metaData.keywords ? 'Filed under' : undefined, 'twitter:data2': metaData.keywords ? metaData.keywords.join(', ') : undefined, 'twitter:site': metaData.site.twitter || undefined, 'twitter:creator': metaData.creatorTwitter || undefined }; if (metaData.ogImage.dimensions) { structuredData['og:image:width'] = metaData.ogImage.dimensions.width; structuredData['og:image:height'] = metaData.ogImage.dimensions.height; } else if (metaData.coverImage.dimensions) { structuredData['og:image:width'] = metaData.coverImage.dimensions.width; structuredData['og:image:height'] = metaData.coverImage.dimensions.height; } // return structured data removing null or undefined keys return Object.keys(structuredData).reduce(function (data, key) { var content = structuredData[key]; if (content !== null && typeof content !== 'undefined') { data[key] = content; } return data; }, {}); } module.exports = getStructuredData;
function listOfWeights (array) { var object = {} array.forEach(function(v) { object[v] = 0.1 }) return object } function weightedRandomIn (weightedList) { // Figure out the total of all the weights var totalWeight = 0 for (var i in weightedList) { totalWeight += weightedList[i] } // Pick a random number within the total weight range var n = Math.random() * totalWeight // Look for the item chosen by the random number and return it for (var j in weightedList) { if (n <= weightedList[j]) { return j } n -= weightedList[j] } } function generateSyllable (syllablePosition) { // Get the weights for the appropriate syllable position var parts = syllableWeights[syllablePosition] // Generate parts of syllable var syllable = { position: syllablePosition, onset: weightedRandomIn(parts.onsets), nucleus: weightedRandomIn(parts.nuclei), coda: weightedRandomIn(parts.codas) } // Return the syllable return syllable } function judgeSyllable (syllable, addWeight) { // Modify weights of given syllable syllableWeights[syllable.position].onsets[syllable.onset] += addWeight syllableWeights[syllable.position].nuclei[syllable.nucleus] += addWeight syllableWeights[syllable.position].codas[syllable.coda] += addWeight } function generateWord () { // Create a new word var word = { numSyllables: parseInt(weightedRandomIn(numSyllableWeights)), syllables: [] } // Generate its syllables for (var i in range(word.numSyllables+1)) { word.syllables.push(generateSyllable(i)) } // Return word return word } function judgeWord (word, addWeight) { // Modify weights of given word //numSyllableWeights[word.numSyllables] += addWeight for (var i in word.syllables) { judgeSyllable(word.syllables[i], addWeight) } } function flattenWord (word) { var arrayWord = [] var lastIndex = word.syllables.length - 1 for (var i in word.syllables) { var syllable = word.syllables[i] if (i == 0) arrayWord.push(syllable.onset) arrayWord.push(syllable.nucleus) var coda = syllable.coda if (i == lastIndex) { if (coda == 's') coda = 'ss' if (coda == 'z') coda = 'zz' if (coda == 'f') coda = 'ff' if (coda == 'g') coda = 'ge' if (coda == 'v') coda = 've' if (coda == 'x') coda = 'xe' } arrayWord.push(coda) } var stringWord = arrayWord.join('') stringWord = stringWord.replace('uu', 'uo') return capitalize(stringWord) } function syllableParts () { return { onsets: listOfWeights(onsets), nuclei: listOfWeights(nuclei), codas: listOfWeights(codas) } } var syllableWeights = { 0: syllableParts(), 1: syllableParts(), 2: syllableParts() } var numSyllableWeights = listOfWeights([0, 1, 2]) numSyllableWeights[0] = .60 numSyllableWeights[1] = .30 numSyllableWeights[2] = .10 var favoriteWords = [] function displayWord(word) { return $('<div>') .addClass('word') .data('word', word) .text(flattenWord(word)) } function setupVoting(el) { for (var i in range(30)) { var word = generateWord() displayWord(word) .appendTo($(el)) .click(function () { $(this).toggleClass('accepted') }) } var nextButton = $('<div>') .addClass('nextRound') .text('Next Round') .click(function () { $('.word') .each(function() { var weight = ($(this).hasClass('accepted') ? 0.01 : 0) judgeWord($(this).data('word'), weight) if ($(this).hasClass('accepted')) { favoriteWords.push($(this).text()) } }) .remove() $(this).remove() setupVoting(el) }) .appendTo(el) }
/* global define */ /* jQuery plugin for an side-panel which can open and close on the left or right edge of the document. Methods are invoked by passing the method name as a string in the constructor method, e.g. `$(...).panel('open')`. Methods: `open` - Opens the panel `close` - Closes the panel `toggle` - Toggles the panel open/close opened 'isOpen' - Returns true if the panel is open 'isClosed' - Returns true if the panel is closed CSS classes: `.panel` - base class for panel container `.panel-toggle` - edge toggle on the panel itself which is kept exposed while in a closed opened `.panel-right` - positions the panel on the right edge of the document `.panel-left` - positions the panel on the left edge of the document `.closed` - start the panel in a closed opened HTML markup: <div class="panel panel-left closed"> <div class="panel-toggle"></div> <div class="panel-content"> ... </div> </div> */ define(['jquery'], function($) { var getSlideWidth = function(element, options) { options = options || {}; // Total width of panel var slideWidth = element.outerWidth(), toggle = element.children('.panel-toggle'); // If a .panel-toggle exists within the panel, substract the width // to it is still visible for use if (options.full !== false && toggle[0]) { return slideWidth - toggle.outerWidth(); } return slideWidth; }; var Panel = function(element, options) { this.element = $(element); this.options = $.extend({ side: 'left', closed: false }, options); this.opened = true; if (this.options.side === 'right' || this.element.hasClass('panel-right')) { this.side = 'right'; } else { this.side = 'left'; } this.element.addClass('panel-' + this.side); // Hide without animation if (this.options.closed === true || this.element.hasClass('closed')) { this.opened = false; this.element.addClass('closed').hide(); } var _this = this; this.element.on('click', '.panel-toggle', function() { _this.toggle(); }); return this; }; Panel.prototype = { constructor: Panel, open: function(options) { if (this.opened) return; options = options || {}; this.opened = true; var css = {}, attrs = {}; // Ensure the position is off screen to start. This // is to handle the case when the element was hidden css[this.side] = -getSlideWidth(this.element, options); attrs[this.side] = 0; this.element.css(css).show().stop(); if (options.animate !== false) { this.element.animate(attrs, 300); } else { this.element.css(attrs); } this.element.removeClass('closed'); }, close: function(options) { if (!this.opened) return; options = options || {}; this.opened = false; var attrs = {}, slideWidth = getSlideWidth(this.element, options); attrs[this.side] = -slideWidth; this.element.stop(); if (options.animate !== false) { this.element.animate(attrs, 300); } else { this.element.css(attrs); } this.element.addClass('closed'); }, toggle: function() { if (this.opened) { this.close(); } else { this.open(); } }, isOpen: function() { return this.opened; }, isClosed: function() { return !this.opened; } }; $.fn.panel = function(option, options) { if (typeof option === 'object') options = option; this.each(function() { var element = $(this), data = element.data('panel'); // Initialize data if (!data) { data = new Panel(this, options); element.data('panel', data); } // Method call if (typeof option === 'string') { data[option](options); } }); }; $.fn.panel.Constructor = Panel; $(function() { // Bootstrap pre-rendered DOM elements $('.panel').panel(); $('[data-toggle*=panel]').each(function() { var toggle = $(this); toggle.on('click', function() { var panel; // If this data-toggle specifies a target, use that, otherwise assume // it is a .panel-toggle within the panel itself. if (toggle.data('target')) { panel = $(toggle.data('target')); } else { panel = toggle.parent(); } panel.panel('toggle'); }); }); }); });
(window.webpackJsonp=window.webpackJsonp||[]).push([[399],{974:function(t,s,e){"use strict";e.r(s);var n=e(6),i=Object(n.a)({},(function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[e("p",[t._v("在"),e("code",[t._v("第4.9小节")]),t._v(",我们已经知道,切片实际是一个指向潜在数组的指针。我们常常需要把切片作为一个参数传递给函数是因为:实际就是传递一个指向变量的指针,在函数内可以改变这个变量,而不是传递数据的拷贝。")]),t._v(" "),e("p",[t._v("因此应该这样做:")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",[e("code",[t._v(" func findBiggest( listOfNumbers []int ) int {}\n")])])]),e("p",[t._v("而不是:")]),t._v(" "),e("div",{staticClass:"language- extra-class"},[e("pre",[e("code",[t._v(" func findBiggest( listOfNumbers *[]int ) int {}\n")])])]),e("p",[e("strong",[t._v("当切片作为参数传递时,切记不要解引用切片。")])])])}),[],!1,null,null,null);s.default=i.exports}}]);
"use strict"; /* global describe, it */ const {observable, bundleChanges} = require('../../lib/observable'); const {computed} = require('../../lib/computed'); const {subscribe} = require('../../lib/subscribe'); const assert = require('chai').assert; const sinon = require('sinon'); describe('subscribe', function() { // Note that the `subscribe` module is also tested implicitly by the more comprehensive // `computed` test. it('should depend on static and dynamic dependencies', function() { // Create a few observables, a computed, and and a subscription that depends on them // statically or dynamically. let x = observable('x'), y = observable('y'), z = observable('z'), w = observable('w'), cy = computed(use => 'c' + use(y)); let spy = sinon.spy(); let sub = subscribe(x, y, (use, x, y) => spy(x, y, use(cy), use(z), use(z) && use(w))); // Check it got called immediately. assert.deepEqual(spy.args, [['x', 'y', 'cy', 'z', 'w']]); spy.resetHistory(); // Change different observables, and ensure it reacts to each change. x.set('X'); y.set('Y'); z.set('Z'); w.set('W'); assert.deepEqual(spy.args, [ ['X', 'y', 'cy', 'z', 'w'], ['X', 'Y', 'cY', 'z', 'w'], ['X', 'Y', 'cY', 'Z', 'w'], ['X', 'Y', 'cY', 'Z', 'W'], ]); spy.resetHistory(); // Check that a set() call that causes no change, does not triggers the subscription callback. x.set('X'); y.set('Y'); assert.deepEqual(spy.args, []); // Cause a dynamic subscription to be dropped and check that it no longer listens to it. z.set(''); assert.deepEqual(spy.args, [['X', 'Y', 'cY', '', '']]); w.set('world'); assert.deepEqual(spy.args, [['X', 'Y', 'cY', '', '']]); // no new call. // Check that when the dynamic subscription is re-added, it triggers callback again. z.set('hello'); assert.deepEqual(spy.args, [['X', 'Y', 'cY', '', ''], ['X', 'Y', 'cY', 'hello', 'world']]); w.set('WORLD'); assert.deepEqual(spy.args, [['X', 'Y', 'cY', '', ''], ['X', 'Y', 'cY', 'hello', 'world'], ['X', 'Y', 'cY', 'hello', 'WORLD']]); spy.resetHistory(); // Check that for bundled changes, subscription is only called once. bundleChanges(() => { x.set('x'); y.set('y'); z.set('z'); w.set('w'); }); y.set('Y'); assert.deepEqual(spy.args, [['x', 'y', 'cy', 'z', 'w'], ['x', 'Y', 'cY', 'z', 'w']]); spy.resetHistory(); // Verify that after disposal, it no longer reacts to dependencies. sub.dispose(); x.set("x0"); y.set("y0"); z.set("z0"); w.set("w0"); assert.deepEqual(spy.args, []); }); });
/** * Copyright 2017 Intel Corporation * * 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. * ---------------------------------------------------------------------------- */ 'use strict' const _ = require('lodash') const moment = require('moment') const FLOAT_PRECISION = 1000000 const STRINGIFIERS = { LatLong: v => `${v.latitude / FLOAT_PRECISION}, ${v.longitude / FLOAT_PRECISION}`, weight: v => `${v}kg`, temperature: v => `${v / FLOAT_PRECISION} °C`, shock: v => `${v}g`, '*': v => JSON.stringify(v, null, 1).replace(/[{}"]/g, '') } /** * Parses a property value by its name or type, returning a string for display */ const stringifyValue = (value, type, name) => { if (STRINGIFIERS[type]) { return STRINGIFIERS[type](value) } if (STRINGIFIERS[name]) { return STRINGIFIERS[name](value) } return STRINGIFIERS['*'](value) } /** * Simple functions that turn numbers or number-like strings to * an integer (in millionths) or back to a float. */ const toFloat = num => parseInt(num) / FLOAT_PRECISION const toInt = num => parseInt(parseFloat(num) * FLOAT_PRECISION) /** * Calls toFloat on a property value, or it's sub-values in the case of * location, tilt, or shock */ const floatifyValue = value => { if (_.isString(value)) value = JSON.parse(value) if (_.isObject(value)) return _.mapValues(value, toFloat) return toFloat(value) } /** * Parses seconds into a date/time string */ const formatTimestamp = sec => { if (!sec) { sec = Date.now() / 1000 } return moment.unix(sec).format('MM/DD/YYYY, h:mm:ss a') } module.exports = { toInt, toFloat, stringifyValue, floatifyValue, formatTimestamp }
'use strict'; angular.module('creamApp') .factory('Perference', function ($resource, DateUtils) { return $resource('api/perferences/:id', {}, { 'query': { method: 'GET', isArray: true}, 'get': { method: 'GET', transformResponse: function (data) { data = angular.fromJson(data); data.dateImport = DateUtils.convertDateTimeFromServer(data.dateImport); return data; } }, 'update': { method:'PUT' } }); }); angular.module('creamApp') .factory('ImportProspect', function ($resource, DateUtils) { return $resource('api/perferences/import/:id', {}, { 'query': { method: 'GET', isArray: true}, 'get': { method: 'GET', transformResponse: function (data) { data = angular.fromJson(data); data.dateImport = DateUtils.convertDateTimeFromServer(data.dateImport); return data; } }, 'update': { method:'PUT' } }); });
import stripePackage from "stripe"; import handler from "./libs/handler-lib"; import { calculateCost } from "./libs/billing-lib"; export const main = handler(async (event, context) => { const { storage, source } = JSON.parse(event.body); const amount = calculateCost(storage); const description = "Scratch charge"; // Load our secret key from the environment variables const stripe = stripePackage(process.env.stripeSecretKey); await stripe.charges.create({ source, amount, description, currency: "usd" }); return { status: true }; });
// import Vue from 'vue' // let // new Vue({ // el:"#root", // template: '<App/>' // })
exports.swapVerticalCircleOutlinedImpl = require('@material-ui/icons/SwapVerticalCircleOutlined').default;
// Modules to control application life and create native browser window const {app, BrowserWindow} = require('electron') // import {PythonShell} from 'python-shell'; const {PythonShell} = require('python-shell'); PythonShell.runString('x=1+1;print(x)', null, function (err) { if (err) throw err; console.log('finished'); }); // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. let mainWindow function createWindow () { // Create the browser window. mainWindow = new BrowserWindow({width: 800, height: 600}) PythonShell.run('engine.py',null,function(err){ if (err) throw err; console.log('finished engine'); }); // and load the index.html of the app. mainWindow.loadFile('index.html') // Open the DevTools. // mainWindow.webContents.openDevTools() // Emitted when the window is closed. mainWindow.on('closed', function () { // Dereference the window object, usually you would store windows // in an array if your app supports multi windows, this is the time // when you should delete the corresponding element. mainWindow = null }) } // This method will be called when Electron has finished // initialization and is ready to create browser windows. // Some APIs can only be used after this event occurs. app.on('ready', createWindow) // Quit when all windows are closed. app.on('window-all-closed', function () { // On macOS it is common for applications and their menu bar // to stay active until the user quits explicitly with Cmd + Q if (process.platform !== 'darwin') { app.quit() } }) app.on('activate', function () { // On macOS it's common to re-create a window in the app when the // dock icon is clicked and there are no other windows open. if (mainWindow === null) { createWindow() } }) // In this file you can include the rest of your app's specific main process // code. You can also put them in separate files and require them here.
var callbackArguments = []; var argument1 = function callback(a,b,c) { callbackArguments.push(JSON.stringify(arguments)) base_0[3][2] = {"59":1.6181186456889842e+308,"843":"l","fuw":"","1.071474030063186e+308":"m'k"} return a+b*c }; var argument2 = ""; var argument3 = function callback(a,b,c) { callbackArguments.push(JSON.stringify(arguments)) base_1[5] = {"122":59,"126":1.5058154086215495e+308,"969":1.7976931348623157e+308,"":"","1.2967816970383867e+308":1.5262101360947533e+308,"irL#":627,"9.035713855563055e+307":5.474784835080495e+307,"5.15776444684831e+307":"fq","7.044460396081833e+307":"eYuo","1.588889527453394e+308":""} argument4[82] = ["?",403,893,"#(",403] return a/b-c }; var argument4 = ""; var argument5 = function callback(a,b,c) { callbackArguments.push(JSON.stringify(arguments)) base_2[6] = null return a-b*c }; var argument6 = r_1; var argument7 = function callback(a,b,c) { callbackArguments.push(JSON.stringify(arguments)) base_3[1][4] = {"49":"","2.551163782560422e+307":"","O9'r":7.926412479491489e+307,"":""} base_3[6] = 1.4011470989332165e+308 argument9[0] = 783 return a*b-c }; var base_0 = [-100,213,460,242] var r_0= undefined try { r_0 = base_0.map(argument1,argument2) } catch(e) { r_0= "Error" } var base_1 = r_0 var r_1= undefined try { r_1 = base_1.map(argument3,argument4) } catch(e) { r_1= "Error" } var base_2 = r_1 var r_2= undefined try { r_2 = base_2.map(argument5,argument6) } catch(e) { r_2= "Error" } var base_3 = r_2 var r_3= undefined try { r_3 = base_3.map(argument7) } catch(e) { r_3= "Error" } function serialize(array){ return array.map(function(a){ if (a === null || a == undefined) return a; var name = a.constructor.name; if (name==='Object' || name=='Boolean'|| name=='Array'||name=='Number'||name=='String') return JSON.stringify(a); return name; }); } setTimeout(function(){ require("fs").writeFileSync("./experiments/map/mapGen/test91.json",JSON.stringify({"baseObjects":serialize([base_0,base_1,base_2,base_3]),"returnObjects":serialize([r_0,r_1,r_2,r_3]),"callbackArgs":callbackArguments})) },300)
const _ = require('lodash'), EventEmitter = require('events').EventEmitter, WSProcessor = require('./wsprocessor'), TCPProcessor = require('./tcpprocessor'), logger = require('pomelo-logger').getLogger('pomelo', __filename); const HTTP_METHODS = [ 'GET', 'POST', 'DELETE', 'PUT', 'HEAD' ]; const ST_STARTED = 1; const ST_CLOSED = 2; const DEFAULT_TIMEOUT = 90; class Switcher extends EventEmitter { /** * Switcher for tcp and websocket protocol * * @param {Object} server tcp server instance from node.js net module */ constructor(server, opts) { super(); this.server = server; this.wsprocessor = new WSProcessor(); this.tcpprocessor = new TCPProcessor(opts.closeMethod); this.id = 1; this.timeout = (opts.timeout || DEFAULT_TIMEOUT) * 1000; this.setNoDelay = opts.setNoDelay; if (!opts.ssl) { this.server.on('connection', this.newSocket.bind(this)); } else { this.server.on('secureConnection', this.newSocket.bind(this)); this.server.on('clientError', (e) => { logger.warn('an ssl error occured before handshake established: ', e); }); } this.wsprocessor.on('connection', this.emit.bind(this, 'connection')); this.tcpprocessor.on('connection', this.emit.bind(this, 'connection')); this.state = ST_STARTED; } newSocket(socket) { if (this.state !== ST_STARTED) { return; } socket.setTimeout(this.timeout, () => { logger.warn(`connection is timeout without communication, the remote ip is ${socket.remoteAddress} && port is ${socket.remotePort}`); socket.destroy(); }); socket.once('data', data => { // FIXME: handle incomplete HTTP method if (SwitcherUtility.IsHttp(data)) { SwitcherUtility.ProcessHttp(this, this.wsprocessor, socket, data); } else { if (this.setNoDelay) { socket.setNoDelay(true); } SwitcherUtility.ProcessTcp(this, this.tcpprocessor, socket, data); } }); } close() { if (this.state !== ST_STARTED) { return; } this.state = ST_CLOSED; this.wsprocessor.close(); this.tcpprocessor.close(); } } class SwitcherUtility { static IsHttp(data) { const head = data.toString('utf8', 0, 4); _.forEach(HTTP_METHODS, httpType => { if (_.indexOf(head, httpType) === 0) { return true; } }); return false; } static ProcessHttp(switcher, processor, socket, data) { processor.add(socket, data); } static ProcessTcp(switcher, processor, socket, data) { processor.add(socket, data); } } module.exports = function(server, opts) { return new Switcher(server, opts); };
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var Constants = /** @class */ (function () { function Constants() { } Constants.TEXT_CANCEL = 'Cancel'; Constants.TEXT_CLEAR_ALL_FILTERS = 'Clear All Filters'; Constants.TEXT_CLEAR_ALL_SORTING = 'Clear All Sorting'; Constants.TEXT_COLUMNS = 'Columns'; Constants.TEXT_COMMANDS = 'Commands'; Constants.TEXT_EXPORT_IN_CSV_FORMAT = 'Export in CSV format'; Constants.TEXT_EXPORT_IN_TEXT_FORMAT = 'Export in Text format (Tab delimited)'; Constants.TEXT_FORCE_FIT_COLUMNS = 'Force fit columns'; Constants.TEXT_HIDE_COLUMN = 'Hide Column'; Constants.TEXT_REFRESH_DATASET = 'Refresh Dataset'; Constants.TEXT_SAVE = 'Save'; Constants.TEXT_SYNCHRONOUS_RESIZE = 'Synchronous resize'; Constants.TEXT_SORT_ASCENDING = 'Sort Ascending'; Constants.TEXT_SORT_DESCENDING = 'Sort Descending'; Constants.TEXT_TOGGLE_FILTER_ROW = 'Toggle Filter Row'; Constants.TEXT_TOGGLE_PRE_HEADER_ROW = 'Toggle Pre-Header Row'; Constants.VALIDATION_EDITOR_VALID_NUMBER = 'Please enter a valid number'; Constants.VALIDATION_EDITOR_VALID_INTEGER = 'Please enter a valid integer number'; Constants.VALIDATION_EDITOR_NUMBER_BETWEEN = 'Please enter a valid number between {{minValue}} and {{maxValue}}'; Constants.VALIDATION_EDITOR_NUMBER_MAX = 'Please enter a valid number that is lower than {{maxValue}}'; Constants.VALIDATION_EDITOR_NUMBER_MIN = 'Please enter a valid number that is greater than {{minValue}}'; Constants.VALIDATION_EDITOR_DECIMAL_BETWEEN = 'Please enter a valid number with a maximum of {{maxDecimal}} decimals'; return Constants; }()); export { Constants }; if (false) { /** @type {?} */ Constants.TEXT_CANCEL; /** @type {?} */ Constants.TEXT_CLEAR_ALL_FILTERS; /** @type {?} */ Constants.TEXT_CLEAR_ALL_SORTING; /** @type {?} */ Constants.TEXT_COLUMNS; /** @type {?} */ Constants.TEXT_COMMANDS; /** @type {?} */ Constants.TEXT_EXPORT_IN_CSV_FORMAT; /** @type {?} */ Constants.TEXT_EXPORT_IN_TEXT_FORMAT; /** @type {?} */ Constants.TEXT_FORCE_FIT_COLUMNS; /** @type {?} */ Constants.TEXT_HIDE_COLUMN; /** @type {?} */ Constants.TEXT_REFRESH_DATASET; /** @type {?} */ Constants.TEXT_SAVE; /** @type {?} */ Constants.TEXT_SYNCHRONOUS_RESIZE; /** @type {?} */ Constants.TEXT_SORT_ASCENDING; /** @type {?} */ Constants.TEXT_SORT_DESCENDING; /** @type {?} */ Constants.TEXT_TOGGLE_FILTER_ROW; /** @type {?} */ Constants.TEXT_TOGGLE_PRE_HEADER_ROW; /** @type {?} */ Constants.VALIDATION_EDITOR_VALID_NUMBER; /** @type {?} */ Constants.VALIDATION_EDITOR_VALID_INTEGER; /** @type {?} */ Constants.VALIDATION_EDITOR_NUMBER_BETWEEN; /** @type {?} */ Constants.VALIDATION_EDITOR_NUMBER_MAX; /** @type {?} */ Constants.VALIDATION_EDITOR_NUMBER_MIN; /** @type {?} */ Constants.VALIDATION_EDITOR_DECIMAL_BETWEEN; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmpzIiwic291cmNlUm9vdCI6Im5nOi8vYW5ndWxhci1zbGlja2dyaWQvIiwic291cmNlcyI6WyJhcHAvbW9kdWxlcy9hbmd1bGFyLXNsaWNrZ3JpZC9jb25zdGFudHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQUFBO0lBQUE7SUF1QkEsQ0FBQztJQXRCUSxxQkFBVyxHQUFHLFFBQVEsQ0FBQztJQUN2QixnQ0FBc0IsR0FBRyxtQkFBbUIsQ0FBQztJQUM3QyxnQ0FBc0IsR0FBRyxtQkFBbUIsQ0FBQztJQUM3QyxzQkFBWSxHQUFHLFNBQVMsQ0FBQztJQUN6Qix1QkFBYSxHQUFHLFVBQVUsQ0FBQztJQUMzQixtQ0FBeUIsR0FBRyxzQkFBc0IsQ0FBQztJQUNuRCxvQ0FBMEIsR0FBRyx1Q0FBdUMsQ0FBQztJQUNyRSxnQ0FBc0IsR0FBRyxtQkFBbUIsQ0FBQztJQUM3QywwQkFBZ0IsR0FBRyxhQUFhLENBQUM7SUFDakMsOEJBQW9CLEdBQUcsaUJBQWlCLENBQUM7SUFDekMsbUJBQVMsR0FBRyxNQUFNLENBQUM7SUFDbkIsaUNBQXVCLEdBQUcsb0JBQW9CLENBQUM7SUFDL0MsNkJBQW1CLEdBQUcsZ0JBQWdCLENBQUM7SUFDdkMsOEJBQW9CLEdBQUcsaUJBQWlCLENBQUM7SUFDekMsZ0NBQXNCLEdBQUcsbUJBQW1CLENBQUM7SUFDN0Msb0NBQTBCLEdBQUcsdUJBQXVCLENBQUM7SUFDckQsd0NBQThCLEdBQUcsNkJBQTZCLENBQUM7SUFDL0QseUNBQStCLEdBQUcscUNBQXFDLENBQUM7SUFDeEUsMENBQWdDLEdBQUcsbUVBQW1FLENBQUM7SUFDdkcsc0NBQTRCLEdBQUcsNkRBQTZELENBQUM7SUFDN0Ysc0NBQTRCLEdBQUcsK0RBQStELENBQUM7SUFDL0YsMkNBQWlDLEdBQUcsdUVBQXVFLENBQUM7SUFDckgsZ0JBQUM7Q0FBQSxBQXZCRCxJQXVCQztTQXZCWSxTQUFTOzs7SUFDcEIsc0JBQThCOztJQUM5QixpQ0FBb0Q7O0lBQ3BELGlDQUFvRDs7SUFDcEQsdUJBQWdDOztJQUNoQyx3QkFBa0M7O0lBQ2xDLG9DQUEwRDs7SUFDMUQscUNBQTRFOztJQUM1RSxpQ0FBb0Q7O0lBQ3BELDJCQUF3Qzs7SUFDeEMsK0JBQWdEOztJQUNoRCxvQkFBMEI7O0lBQzFCLGtDQUFzRDs7SUFDdEQsOEJBQThDOztJQUM5QywrQkFBZ0Q7O0lBQ2hELGlDQUFvRDs7SUFDcEQscUNBQTREOztJQUM1RCx5Q0FBc0U7O0lBQ3RFLDBDQUErRTs7SUFDL0UsMkNBQThHOztJQUM5Ryx1Q0FBb0c7O0lBQ3BHLHVDQUFzRzs7SUFDdEcsNENBQW1IIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNsYXNzIENvbnN0YW50cyB7XHJcbiAgc3RhdGljIFRFWFRfQ0FOQ0VMID0gJ0NhbmNlbCc7XHJcbiAgc3RhdGljIFRFWFRfQ0xFQVJfQUxMX0ZJTFRFUlMgPSAnQ2xlYXIgQWxsIEZpbHRlcnMnO1xyXG4gIHN0YXRpYyBURVhUX0NMRUFSX0FMTF9TT1JUSU5HID0gJ0NsZWFyIEFsbCBTb3J0aW5nJztcclxuICBzdGF0aWMgVEVYVF9DT0xVTU5TID0gJ0NvbHVtbnMnO1xyXG4gIHN0YXRpYyBURVhUX0NPTU1BTkRTID0gJ0NvbW1hbmRzJztcclxuICBzdGF0aWMgVEVYVF9FWFBPUlRfSU5fQ1NWX0ZPUk1BVCA9ICdFeHBvcnQgaW4gQ1NWIGZvcm1hdCc7XHJcbiAgc3RhdGljIFRFWFRfRVhQT1JUX0lOX1RFWFRfRk9STUFUID0gJ0V4cG9ydCBpbiBUZXh0IGZvcm1hdCAoVGFiIGRlbGltaXRlZCknO1xyXG4gIHN0YXRpYyBURVhUX0ZPUkNFX0ZJVF9DT0xVTU5TID0gJ0ZvcmNlIGZpdCBjb2x1bW5zJztcclxuICBzdGF0aWMgVEVYVF9ISURFX0NPTFVNTiA9ICdIaWRlIENvbHVtbic7XHJcbiAgc3RhdGljIFRFWFRfUkVGUkVTSF9EQVRBU0VUID0gJ1JlZnJlc2ggRGF0YXNldCc7XHJcbiAgc3RhdGljIFRFWFRfU0FWRSA9ICdTYXZlJztcclxuICBzdGF0aWMgVEVYVF9TWU5DSFJPTk9VU19SRVNJWkUgPSAnU3luY2hyb25vdXMgcmVzaXplJztcclxuICBzdGF0aWMgVEVYVF9TT1JUX0FTQ0VORElORyA9ICdTb3J0IEFzY2VuZGluZyc7XHJcbiAgc3RhdGljIFRFWFRfU09SVF9ERVNDRU5ESU5HID0gJ1NvcnQgRGVzY2VuZGluZyc7XHJcbiAgc3RhdGljIFRFWFRfVE9HR0xFX0ZJTFRFUl9ST1cgPSAnVG9nZ2xlIEZpbHRlciBSb3cnO1xyXG4gIHN0YXRpYyBURVhUX1RPR0dMRV9QUkVfSEVBREVSX1JPVyA9ICdUb2dnbGUgUHJlLUhlYWRlciBSb3cnO1xyXG4gIHN0YXRpYyBWQUxJREFUSU9OX0VESVRPUl9WQUxJRF9OVU1CRVIgPSAnUGxlYXNlIGVudGVyIGEgdmFsaWQgbnVtYmVyJztcclxuICBzdGF0aWMgVkFMSURBVElPTl9FRElUT1JfVkFMSURfSU5URUdFUiA9ICdQbGVhc2UgZW50ZXIgYSB2YWxpZCBpbnRlZ2VyIG51bWJlcic7XHJcbiAgc3RhdGljIFZBTElEQVRJT05fRURJVE9SX05VTUJFUl9CRVRXRUVOID0gJ1BsZWFzZSBlbnRlciBhIHZhbGlkIG51bWJlciBiZXR3ZWVuIHt7bWluVmFsdWV9fSBhbmQge3ttYXhWYWx1ZX19JztcclxuICBzdGF0aWMgVkFMSURBVElPTl9FRElUT1JfTlVNQkVSX01BWCA9ICdQbGVhc2UgZW50ZXIgYSB2YWxpZCBudW1iZXIgdGhhdCBpcyBsb3dlciB0aGFuIHt7bWF4VmFsdWV9fSc7XHJcbiAgc3RhdGljIFZBTElEQVRJT05fRURJVE9SX05VTUJFUl9NSU4gPSAnUGxlYXNlIGVudGVyIGEgdmFsaWQgbnVtYmVyIHRoYXQgaXMgZ3JlYXRlciB0aGFuIHt7bWluVmFsdWV9fSc7XHJcbiAgc3RhdGljIFZBTElEQVRJT05fRURJVE9SX0RFQ0lNQUxfQkVUV0VFTiA9ICdQbGVhc2UgZW50ZXIgYSB2YWxpZCBudW1iZXIgd2l0aCBhIG1heGltdW0gb2Yge3ttYXhEZWNpbWFsfX0gZGVjaW1hbHMnO1xyXG59XHJcbiJdfQ==
import React, { useState, useEffect, useRef, useContext } from 'react'; import { observer } from 'mobx-react-lite'; import { UiStoreContext, VisualizationStoreContext } from 'store/stores'; import { ItemStatus, drawItemLabel, zoomContext } from 'utils/drawing'; import * as s from './styles'; const ItemLabelCanvas = observer(({ canvasWidth, canvasHeight, customFont }) => { const uiStore = useContext(UiStoreContext); const visualizationStore = useContext(VisualizationStoreContext); const canvasEl = useRef(null); const [ctx, setCtx] = useState(null); const [font, setFont] = useState(customFont); useEffect(() => { if (document.fonts) { document.fonts.ready.then(() => { setFont(customFont || 'Roboto'); }); } else { setTimeout(() => { setFont(customFont || 'Roboto'); }, 250); } const context = canvasEl.current.getContext('2d'); setCtx(context); visualizationStore.setLabelCanvasContext(context); visualizationStore.setGetItemLabelCanvasImage(() => canvasEl.current); }, []); useEffect(() => { if (ctx) draw(); }, [ctx]); useEffect(() => { if (ctx) zoomContext(ctx, visualizationStore, draw); }, [visualizationStore.lastItemUpdate, visualizationStore.zTransform]); const draw = () => { const { zTransform, pixelRatio, highlightedItems, clickedItem, hoveredItem } = visualizationStore; ctx.clearRect(0, 0, canvasWidth * pixelRatio, canvasHeight * pixelRatio); ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; // Draw labels of default items. for (let i = visualizationStore.items.length - 1; i >= 0; i--) { const item = visualizationStore.items[i]; if ((item._labelScalingFactor < zTransform.k) && (item._status === ItemStatus.DEFAULT)) { drawItemLabel(ctx, item, font, visualizationStore, uiStore); } } // Draw labels of highlighted items. for (let i = highlightedItems.length - 1; i >= 0; i--) { const item = highlightedItems[i]; if (item._labelScalingFactor < zTransform.k) { drawItemLabel(ctx, item, font, visualizationStore, uiStore, ItemStatus.HIGHLIGHTED, false); } } // Draw label of selected item. if (clickedItem) { drawItemLabel(ctx, clickedItem, font, visualizationStore, uiStore, ItemStatus.SELECTED, true); } // Draw label of hovered item. if (hoveredItem) { drawItemLabel(ctx, hoveredItem, font, visualizationStore, uiStore, ItemStatus.HOVERED, true); } }; return ( <canvas className={s.canvas} ref={canvasEl} width={canvasWidth * visualizationStore.pixelRatio} height={canvasHeight * visualizationStore.pixelRatio} /> ); }); export default ItemLabelCanvas;
var assert = require('assert'); var base64_utf8 = require('../lib/index'); describe('base64_utf8', () => { it('encode', () => { var encodeString = base64_utf8.encode('小胡子哥'); assert(encodeString === '5bCP6IOh5a2Q5ZOl', 'encode error'); }); it('decode', () => { var decodeString = base64_utf8.decode('5bCP6IOh5a2Q5ZOl'); assert(decodeString === '小胡子哥', 'decode error'); }); });
var lUpdate = document.getElementById('l-update'), lSlide = document.getElementById('l-slide'), lSet = document.getElementById('l-set'), lChange = document.getElementById('l-change'), lStart = document.getElementById('l-start'), lEnd = document.getElementById('l-end'); slider.noUiSlider.on('update', function(){ addClassFor(lUpdate, 'tShow', 450); }); slider.noUiSlider.on('slide', function(){ addClassFor(lSlide, 'tShow', 450); }); slider.noUiSlider.on('set', function(){ addClassFor(lSet, 'tShow', 450); }); slider.noUiSlider.on('change', function(){ addClassFor(lChange, 'tShow', 450); }); slider.noUiSlider.on('start', function(){ addClassFor(lStart, 'tShow', 450); }); slider.noUiSlider.on('end', function(){ addClassFor(lEnd, 'tShow', 450); });
const { singular } = require('pluralize'); const Fuse = require('fuse.js'); const { foods } = require('../database.json'); const fuse = new Fuse(foods, { keys: ['name', 'alternateNames'], threshold: 0.4, }); exports.handler = (event, context, callback) => { const q = singular(event.queryStringParameters.q); const matches = fuse.search(q); const results = { query: event.queryStringParameters.q, interpretation: q, resultCount: matches.length, results: matches, }; callback(null, { statusCode: 200, headers: { 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept', }, body: JSON.stringify(results), }); };
/** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. * * * ## Notice * * The original C code, long comment, copyright, license, and constants are from [Cephes]{@link http://www.netlib.org/cephes}. The implementation follows the original, but has been modified for JavaScript. * * ```text * Copyright 1984, 1987, 1989, 1992, 2000 by Stephen L. Moshier * * Some software in this archive may be from the book _Methods and Programs for Mathematical Functions_ (Prentice-Hall or Simon & Schuster International, 1989) or from the Cephes Mathematical Library, a commercial product. In either event, it is copyrighted by the author. What you see here may be used freely but it comes with no support or guarantee. * * Stephen L. Moshier * moshier@na-net.ornl.gov * ``` */ 'use strict'; // MODULES // var isnan = require( '@stdlib/math/base/assert/is-nan' ); var isInteger = require( '@stdlib/math/base/assert/is-integer' ); var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' ); var abs = require( '@stdlib/math/base/special/abs' ); var floor = require( '@stdlib/math/base/special/floor' ); var sin = require( '@stdlib/math/base/special/sin' ); var PINF = require( '@stdlib/constants/float64/pinf' ); var NINF = require( '@stdlib/constants/float64/ninf' ); var PI = require( '@stdlib/constants/float64/pi' ); var stirlingApprox = require( './stirling_approximation.js' ); var smallApprox = require( './small_approximation.js' ); var rateval = require( './rational_pq.js' ); // MAIN // /** * Evaluates the gamma function. * * ## Method * * 1. Arguments \\(|x| \leq 34\\) are reduced by recurrence and the function approximated by a rational function of degree \\(6/7\\) in the interval \\((2,3)\\). * 2. Large negative arguments are made positive using a reflection formula. * 3. Large arguments are handled by Stirling's formula. * * * ## Notes * * - Relative error: * * | arithmetic | domain | # trials | peak | rms | * |:----------:|:---------:|:--------:|:-------:|:-------:| * | DEC | -34,34 | 10000 | 1.3e-16 | 2.5e-17 | * | IEEE | -170,-33 | 20000 | 2.3e-15 | 3.3e-16 | * | IEEE | -33, 33 | 20000 | 9.4e-16 | 2.2e-16 | * | IEEE | 33, 171.6 | 20000 | 2.3e-15 | 3.2e-16 | * * - Error for arguments outside the test range will be larger owing to error amplification by the exponential function. * * * @param {number} x - input value * @returns {number} function value * * @example * var v = gamma( 4.0 ); * // returns 6.0 * * @example * var v = gamma( -1.5 ); * // returns ~2.363 * * @example * var v = gamma( -0.5 ); * // returns ~-3.545 * * @example * var v = gamma( 0.5 ); * // returns ~1.772 * * @example * var v = gamma( 0.0 ); * // returns Infinity * * @example * var v = gamma( -0.0 ); * // returns -Infinity * * @example * var v = gamma( NaN ); * // returns NaN */ function gamma( x ) { var sign; var q; var p; var z; if ( (isInteger( x ) && x < 0) || x === NINF || isnan( x ) ) { return NaN; } if ( x === 0.0 ) { if ( isNegativeZero( x ) ) { return NINF; } return PINF; } if ( x > 171.61447887182298 ) { return PINF; } if ( x < -170.5674972726612 ) { return 0.0; } q = abs( x ); if ( q > 33.0 ) { if ( x >= 0.0 ) { return stirlingApprox( x ); } p = floor( q ); // Check whether `x` is even... if ( (p&1) === 0 ) { sign = -1.0; } else { sign = 1.0; } z = q - p; if ( z > 0.5 ) { p += 1.0; z = q - p; } z = q * sin( PI * z ); return sign * PI / ( abs(z)*stirlingApprox(q) ); } // Reduce `x`... z = 1.0; while ( x >= 3.0 ) { x -= 1.0; z *= x; } while ( x < 0.0 ) { if ( x > -1.0e-9 ) { return smallApprox( x, z ); } z /= x; x += 1.0; } while ( x < 2.0 ) { if ( x < 1.0e-9 ) { return smallApprox( x, z ); } z /= x; x += 1.0; } if ( x === 2.0 ) { return z; } x -= 2.0; return z * rateval( x ); } // EXPORTS // module.exports = gamma;
Ext.data.JsonP.tm_net_event_Error({"tagname":"class","name":"tm.net.event.Error","autodetected":{},"files":[{"filename":"websocket.js","href":"websocket.html#tm-net-event-Error"}],"extends":"tm.net.event.WebSocketEvent","members":[{"name":"data","tagname":"property","owner":"tm.net.event.Error","id":"property-data","meta":{}},{"name":"type","tagname":"property","owner":"tm.event.Event","id":"property-type","meta":{}},{"name":"constructor","tagname":"method","owner":"tm.net.event.Error","id":"method-constructor","meta":{}}],"alternateClassNames":[],"aliases":{},"id":"class-tm.net.event.Error","component":false,"superclasses":["tm.event.Event","tm.net.event.WebSocketEvent"],"subclasses":[],"mixedInto":[],"mixins":[],"parentMixins":[],"requires":[],"uses":[],"html":"<div><pre class=\"hierarchy\"><h4>Hierarchy</h4><div class='subclass first-child'><a href='#!/api/tm.event.Event' rel='tm.event.Event' class='docClass'>tm.event.Event</a><div class='subclass '><a href='#!/api/tm.net.event.WebSocketEvent' rel='tm.net.event.WebSocketEvent' class='docClass'>tm.net.event.WebSocketEvent</a><div class='subclass '><strong>tm.net.event.Error</strong></div></div></div><h4>Files</h4><div class='dependency'><a href='source/websocket.html#tm-net-event-Error' target='_blank'>websocket.js</a></div></pre><div class='doc-contents'><p>エラー時に発生するイベント.</p>\n</div><div class='members'><div class='members-section'><div class='definedBy'>Defined By</div><h3 class='members-title icon-property'>Properties</h3><div class='subsection'><div id='property-data' class='member first-child not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='tm.net.event.Error'>tm.net.event.Error</span><br/><a href='source/websocket.html#tm-net-event-Error-property-data' target='_blank' class='view-source'>view source</a></div><a href='#!/api/tm.net.event.Error-property-data' class='name expandable'>data</a> : Object<span class=\"signature\"></span></div><div class='description'><div class='short'><p>エラー情報.</p>\n</div><div class='long'><p>エラー情報.</p>\n</div></div></div><div id='property-type' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/tm.event.Event' rel='tm.event.Event' class='defined-in docClass'>tm.event.Event</a><br/><a href='source/event2.html#tm-event-Event-property-type' target='_blank' class='view-source'>view source</a></div><a href='#!/api/tm.event.Event-property-type' class='name expandable'>type</a> : Object<span class=\"signature\"></span></div><div class='description'><div class='short'><p>タイプ</p>\n</div><div class='long'><p>タイプ</p>\n</div></div></div></div></div><div class='members-section'><div class='definedBy'>Defined By</div><h3 class='members-title icon-method'>Methods</h3><div class='subsection'><div id='method-constructor' class='member first-child not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><span class='defined-in' rel='tm.net.event.Error'>tm.net.event.Error</span><br/><a href='source/websocket.html#tm-net-event-Error-method-constructor' target='_blank' class='view-source'>view source</a></div><strong class='new-keyword'>new</strong><a href='#!/api/tm.net.event.Error-method-constructor' class='name expandable'>tm.net.event.Error</a>( <span class='pre'></span> ) : <a href=\"#!/api/tm.net.event.Error\" rel=\"tm.net.event.Error\" class=\"docClass\">tm.net.event.Error</a><span class=\"signature\"></span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/tm.net.event.Error\" rel=\"tm.net.event.Error\" class=\"docClass\">tm.net.event.Error</a></span><div class='sub-desc'>\n</div></li></ul><p>Overrides: <a href=\"#!/api/tm.net.event.WebSocketEvent-method-constructor\" rel=\"tm.net.event.WebSocketEvent-method-constructor\" class=\"docClass\">tm.net.event.WebSocketEvent.constructor</a></p></div></div></div></div></div></div></div>","meta":{}});
//= link_tree ../images //= link_directory ../javascripts .js //= link_directory ../stylesheets .css //= link quick_search_ebsco_discovery_service_api_searcher_manifest.js
import React, { useEffect } from 'react' import { useDispatch, useSelector } from 'react-redux' import { useLocation, useHistory } from 'react-router-dom' import { Helmet } from 'react-helmet' import { selectCustomer, authCustomerThanx } from '@open-tender/redux' import { isObject } from '@open-tender/js' import { Message } from '@open-tender/components' import { maybeRefreshVersion } from '../../../app/version' import { selectBrand } from '../../../slices' import { Content, HeaderDefault, Main, PageTitle, PageContainer, PageContent, Loading, } from '../..' import { useDeviceDimensions } from '../../../contexts/DeviceDimensions/DeviceDimensions' import { documentElement } from '../../../App' const Thanx = () => { const dispatch = useDispatch() const history = useHistory() const { title: siteTitle } = useSelector(selectBrand) const { auth, loading, error } = useSelector(selectCustomer) const isLoading = loading === 'pending' const errMsg = error ? isObject(error) ? error.detail || error.message : error : null const title = errMsg ? 'Something went wrong' : 'Retrieving your account' const subtitle = errMsg ? 'Please review the error below and retry your request or contact support' : 'Please hang tight. This will only take a second.' const query = new URLSearchParams(useLocation().search) const code = query.get('code') useEffect(() => { documentElement.scrollTop = 0 maybeRefreshVersion() }, []) useEffect(() => { if (auth) { history.push('/') } else if (code) { dispatch(authCustomerThanx(code)) } else { history.push('/') } }, [auth, code, history, dispatch]) const { isDesktop } = useDeviceDimensions() return ( <> <Helmet> <title>Thanx | {siteTitle}</title> </Helmet> <Content> <HeaderDefault title={isDesktop ? null : 'Thanx'} /> <Main> <PageContainer style={{ maxWidth: '76.8rem' }}> <PageTitle title={title} subtitle={subtitle} /> <PageContent> {isLoading ? ( <Loading text="Contacting Thanx..." /> ) : errMsg ? ( <Message color="error" style={{ width: '100%' }}> {errMsg} </Message> ) : null} </PageContent> </PageContainer> </Main> </Content> </> ) } Thanx.displayName = 'Thanx' export default Thanx
const { VIEW } = require('../lib/views'); const { fileErrorSummary, fileUploadNunjucksVariables, uploadFiles, } = require('../lib/file-upload-helpers'); const { deleteDocument } = require('../lib/documents-api-wrapper'); const getAppealSideBarDetails = require('../lib/appeal-sidebar-details'); const { getTaskStatus } = require('../services/task.service'); const { createOrUpdateAppealReply } = require('../lib/appeal-reply-api-wrapper'); const { renderView, redirect } = require('../util/render'); const docArrayFromInputString = (tempDocsString) => { return tempDocsString && typeof tempDocsString === 'string' ? tempDocsString.match(/{.*?}/g).map((docString) => JSON.parse(docString)) : []; }; exports.getUpload = (req, res) => { const { sectionName, taskName, view } = res.locals.routeInfo; const { documentType } = req; let uploadedFiles; let appealReplyId; if (!req.session.appealReply[sectionName][taskName]) { req.session.appealReply[sectionName][taskName] = { uploadFiles: [] }; } else { uploadedFiles = req.session.appealReply[sectionName][taskName].uploadedFiles; appealReplyId = req.session.appealReply.id; } renderView(res, view, { prefix: 'appeal-questionnaire', appeal: getAppealSideBarDetails(req.session.appeal), backLink: req.session.backLink ? req.session.backLink : `/${req.params.id}/${VIEW.TASK_LIST}`, ...fileUploadNunjucksVariables(null, null, uploadedFiles), appealReplyId, documentType, }); }; exports.postUpload = async (req, res) => { const { sectionName, taskName, view, name } = res.locals.routeInfo; const { documentType } = req; const { appealReply } = req.session; const { appealReplyId } = appealReply; const documents = req.body?.files?.documents || []; const { delete: deleteId = '', errors = {}, submit = '' } = req.body; const backLink = req.session.backLink || `/${req.params.id}/${VIEW.TASK_LIST}`; const uploadedFiles = docArrayFromInputString(req.body.tempDocs); let validFiles = []; const erroredFiles = []; let errorMessage; // Remove errored files uploadedFiles.forEach((uploadedFile) => { if (uploadedFile.error && uploadedFile.error.length > 0) { erroredFiles.push({ name: 'documents', error: uploadedFile.error }); } else { validFiles.push(uploadedFile); } }); // Chance for delete to be triggered due to non-JS solution. delete will be set to value of filename if button clicked if (deleteId) { try { // deleteId will be 'undefined' if file upload error if (deleteId !== 'undefined') await deleteDocument(appealReply.id, deleteId); } catch (err) { req.log.error({ err }, `Error deleting ${deleteId} from ${name}`); } finally { validFiles = validFiles.filter((file) => file.id !== deleteId); } } else if (documents.length) { // Chance for files to be attached due to non-JS solution, these need to be uploaded (with appropriate errors); try { const newFiles = await uploadFiles( documents.map((doc, index) => ({ ...doc, // current validation will return errors in this format error: errors[`files.documents[${index}]`]?.msg, })), req.session?.appealReply?.id, documentType ); validFiles = [ ...validFiles, ...newFiles.map(({ id, name: fileName, error }) => ({ id, name: fileName, error, })), ]; } catch (err) { req.log.error({ err }, 'Error uploading files to documents service'); errorMessage = err; } } errorMessage = errorMessage || (errors.documents && errors.documents.msg); let constructedErrorSummary; if (typeof erroredFiles !== 'undefined' && erroredFiles.length > 0) { constructedErrorSummary = fileErrorSummary('', erroredFiles); } else { constructedErrorSummary = fileErrorSummary(errorMessage, validFiles); } try { appealReply[sectionName][taskName].uploadedFiles = validFiles; appealReply.sectionStates[sectionName][taskName] = getTaskStatus( appealReply, sectionName, taskName ); req.session.appealReply = await createOrUpdateAppealReply(appealReply); if (!submit || constructedErrorSummary?.length) { renderView(res, view, { prefix: 'appeal-questionnaire', ...fileUploadNunjucksVariables(errorMessage, constructedErrorSummary, validFiles), appeal: getAppealSideBarDetails(req.session.appeal), backLink, appealReplyId, }); } else { redirect( res, 'appeal-questionnaire', `${req.params.id}/${VIEW.TASK_LIST}`, req.session.backLink ); } // If it gets this far there are no errors and files must exist } catch (err) { req.log.error({ err }, `Error adding files to ${name} question`); renderView(res, view, { prefix: 'appeal-questionnaire', ...fileUploadNunjucksVariables(errorMessage, constructedErrorSummary, validFiles), appeal: getAppealSideBarDetails(req.session.appeal), backLink, appealReplyId, }); } };
/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "/"; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 0); /******/ }) /************************************************************************/ /******/ ({ /***/ "./node_modules/axios/index.js": /*!*************************************!*\ !*** ./node_modules/axios/index.js ***! \*************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js"); /***/ }), /***/ "./node_modules/axios/lib/adapters/xhr.js": /*!************************************************!*\ !*** ./node_modules/axios/lib/adapters/xhr.js ***! \************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js"); var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js"); var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js"); var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js"); var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js"); var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js"); module.exports = function xhrAdapter(config) { return new Promise(function dispatchXhrRequest(resolve, reject) { var requestData = config.data; var requestHeaders = config.headers; if (utils.isFormData(requestData)) { delete requestHeaders['Content-Type']; // Let the browser set it } var request = new XMLHttpRequest(); // HTTP basic authentication if (config.auth) { var username = config.auth.username || ''; var password = config.auth.password || ''; requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); } var fullPath = buildFullPath(config.baseURL, config.url); request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); // Set the request timeout in MS request.timeout = config.timeout; // Listen for ready state request.onreadystatechange = function handleLoad() { if (!request || request.readyState !== 4) { return; } // The request errored out and we didn't get a response, this will be // handled by onerror instead // With one exception: request that using file: protocol, most browsers // will return status as 0 even though it's a successful request if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { return; } // Prepare the response var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response; var response = { data: responseData, status: request.status, statusText: request.statusText, headers: responseHeaders, config: config, request: request }; settle(resolve, reject, response); // Clean up request request = null; }; // Handle browser request cancellation (as opposed to a manual cancellation) request.onabort = function handleAbort() { if (!request) { return; } reject(createError('Request aborted', config, 'ECONNABORTED', request)); // Clean up request request = null; }; // Handle low level network errors request.onerror = function handleError() { // Real errors are hidden from us by the browser // onerror should only fire if it's a network error reject(createError('Network Error', config, null, request)); // Clean up request request = null; }; // Handle timeout request.ontimeout = function handleTimeout() { var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded'; if (config.timeoutErrorMessage) { timeoutErrorMessage = config.timeoutErrorMessage; } reject(createError(timeoutErrorMessage, config, 'ECONNABORTED', request)); // Clean up request request = null; }; // Add xsrf header // This is only done if running in a standard browser environment. // Specifically not if we're in a web worker, or react-native. if (utils.isStandardBrowserEnv()) { var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js"); // Add xsrf header var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? cookies.read(config.xsrfCookieName) : undefined; if (xsrfValue) { requestHeaders[config.xsrfHeaderName] = xsrfValue; } } // Add headers to the request if ('setRequestHeader' in request) { utils.forEach(requestHeaders, function setRequestHeader(val, key) { if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { // Remove Content-Type if data is undefined delete requestHeaders[key]; } else { // Otherwise add header to the request request.setRequestHeader(key, val); } }); } // Add withCredentials to request if needed if (!utils.isUndefined(config.withCredentials)) { request.withCredentials = !!config.withCredentials; } // Add responseType to request if needed if (config.responseType) { try { request.responseType = config.responseType; } catch (e) { // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function. if (config.responseType !== 'json') { throw e; } } } // Handle progress if needed if (typeof config.onDownloadProgress === 'function') { request.addEventListener('progress', config.onDownloadProgress); } // Not all browsers support upload events if (typeof config.onUploadProgress === 'function' && request.upload) { request.upload.addEventListener('progress', config.onUploadProgress); } if (config.cancelToken) { // Handle cancellation config.cancelToken.promise.then(function onCanceled(cancel) { if (!request) { return; } request.abort(); reject(cancel); // Clean up request request = null; }); } if (requestData === undefined) { requestData = null; } // Send the request request.send(requestData); }); }; /***/ }), /***/ "./node_modules/axios/lib/axios.js": /*!*****************************************!*\ !*** ./node_modules/axios/lib/axios.js ***! \*****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js"); var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js"); var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js"); var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js"); var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js"); /** * Create an instance of Axios * * @param {Object} defaultConfig The default config for the instance * @return {Axios} A new instance of Axios */ function createInstance(defaultConfig) { var context = new Axios(defaultConfig); var instance = bind(Axios.prototype.request, context); // Copy axios.prototype to instance utils.extend(instance, Axios.prototype, context); // Copy context to instance utils.extend(instance, context); return instance; } // Create the default instance to be exported var axios = createInstance(defaults); // Expose Axios class to allow class inheritance axios.Axios = Axios; // Factory for creating new instances axios.create = function create(instanceConfig) { return createInstance(mergeConfig(axios.defaults, instanceConfig)); }; // Expose Cancel & CancelToken axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js"); axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js"); axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js"); // Expose all/spread axios.all = function all(promises) { return Promise.all(promises); }; axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js"); module.exports = axios; // Allow use of default import syntax in TypeScript module.exports.default = axios; /***/ }), /***/ "./node_modules/axios/lib/cancel/Cancel.js": /*!*************************************************!*\ !*** ./node_modules/axios/lib/cancel/Cancel.js ***! \*************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * A `Cancel` is an object that is thrown when an operation is canceled. * * @class * @param {string=} message The message. */ function Cancel(message) { this.message = message; } Cancel.prototype.toString = function toString() { return 'Cancel' + (this.message ? ': ' + this.message : ''); }; Cancel.prototype.__CANCEL__ = true; module.exports = Cancel; /***/ }), /***/ "./node_modules/axios/lib/cancel/CancelToken.js": /*!******************************************************!*\ !*** ./node_modules/axios/lib/cancel/CancelToken.js ***! \******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js"); /** * A `CancelToken` is an object that can be used to request cancellation of an operation. * * @class * @param {Function} executor The executor function. */ function CancelToken(executor) { if (typeof executor !== 'function') { throw new TypeError('executor must be a function.'); } var resolvePromise; this.promise = new Promise(function promiseExecutor(resolve) { resolvePromise = resolve; }); var token = this; executor(function cancel(message) { if (token.reason) { // Cancellation has already been requested return; } token.reason = new Cancel(message); resolvePromise(token.reason); }); } /** * Throws a `Cancel` if cancellation has been requested. */ CancelToken.prototype.throwIfRequested = function throwIfRequested() { if (this.reason) { throw this.reason; } }; /** * Returns an object that contains a new `CancelToken` and a function that, when called, * cancels the `CancelToken`. */ CancelToken.source = function source() { var cancel; var token = new CancelToken(function executor(c) { cancel = c; }); return { token: token, cancel: cancel }; }; module.exports = CancelToken; /***/ }), /***/ "./node_modules/axios/lib/cancel/isCancel.js": /*!***************************************************!*\ !*** ./node_modules/axios/lib/cancel/isCancel.js ***! \***************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = function isCancel(value) { return !!(value && value.__CANCEL__); }; /***/ }), /***/ "./node_modules/axios/lib/core/Axios.js": /*!**********************************************!*\ !*** ./node_modules/axios/lib/core/Axios.js ***! \**********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js"); var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js"); var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js"); var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js"); /** * Create a new instance of Axios * * @param {Object} instanceConfig The default config for the instance */ function Axios(instanceConfig) { this.defaults = instanceConfig; this.interceptors = { request: new InterceptorManager(), response: new InterceptorManager() }; } /** * Dispatch a request * * @param {Object} config The config specific for this request (merged with this.defaults) */ Axios.prototype.request = function request(config) { /*eslint no-param-reassign:0*/ // Allow for axios('example/url'[, config]) a la fetch API if (typeof config === 'string') { config = arguments[1] || {}; config.url = arguments[0]; } else { config = config || {}; } config = mergeConfig(this.defaults, config); // Set config.method if (config.method) { config.method = config.method.toLowerCase(); } else if (this.defaults.method) { config.method = this.defaults.method.toLowerCase(); } else { config.method = 'get'; } // Hook up interceptors middleware var chain = [dispatchRequest, undefined]; var promise = Promise.resolve(config); this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { chain.unshift(interceptor.fulfilled, interceptor.rejected); }); this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { chain.push(interceptor.fulfilled, interceptor.rejected); }); while (chain.length) { promise = promise.then(chain.shift(), chain.shift()); } return promise; }; Axios.prototype.getUri = function getUri(config) { config = mergeConfig(this.defaults, config); return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, ''); }; // Provide aliases for supported request methods utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { /*eslint func-names:0*/ Axios.prototype[method] = function(url, config) { return this.request(utils.merge(config || {}, { method: method, url: url })); }; }); utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { /*eslint func-names:0*/ Axios.prototype[method] = function(url, data, config) { return this.request(utils.merge(config || {}, { method: method, url: url, data: data })); }; }); module.exports = Axios; /***/ }), /***/ "./node_modules/axios/lib/core/InterceptorManager.js": /*!***********************************************************!*\ !*** ./node_modules/axios/lib/core/InterceptorManager.js ***! \***********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); function InterceptorManager() { this.handlers = []; } /** * Add a new interceptor to the stack * * @param {Function} fulfilled The function to handle `then` for a `Promise` * @param {Function} rejected The function to handle `reject` for a `Promise` * * @return {Number} An ID used to remove interceptor later */ InterceptorManager.prototype.use = function use(fulfilled, rejected) { this.handlers.push({ fulfilled: fulfilled, rejected: rejected }); return this.handlers.length - 1; }; /** * Remove an interceptor from the stack * * @param {Number} id The ID that was returned by `use` */ InterceptorManager.prototype.eject = function eject(id) { if (this.handlers[id]) { this.handlers[id] = null; } }; /** * Iterate over all the registered interceptors * * This method is particularly useful for skipping over any * interceptors that may have become `null` calling `eject`. * * @param {Function} fn The function to call for each interceptor */ InterceptorManager.prototype.forEach = function forEach(fn) { utils.forEach(this.handlers, function forEachHandler(h) { if (h !== null) { fn(h); } }); }; module.exports = InterceptorManager; /***/ }), /***/ "./node_modules/axios/lib/core/buildFullPath.js": /*!******************************************************!*\ !*** ./node_modules/axios/lib/core/buildFullPath.js ***! \******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js"); var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js"); /** * Creates a new URL by combining the baseURL with the requestedURL, * only when the requestedURL is not already an absolute URL. * If the requestURL is absolute, this function returns the requestedURL untouched. * * @param {string} baseURL The base URL * @param {string} requestedURL Absolute or relative URL to combine * @returns {string} The combined full path */ module.exports = function buildFullPath(baseURL, requestedURL) { if (baseURL && !isAbsoluteURL(requestedURL)) { return combineURLs(baseURL, requestedURL); } return requestedURL; }; /***/ }), /***/ "./node_modules/axios/lib/core/createError.js": /*!****************************************************!*\ !*** ./node_modules/axios/lib/core/createError.js ***! \****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js"); /** * Create an Error with the specified message, config, error code, request and response. * * @param {string} message The error message. * @param {Object} config The config. * @param {string} [code] The error code (for example, 'ECONNABORTED'). * @param {Object} [request] The request. * @param {Object} [response] The response. * @returns {Error} The created error. */ module.exports = function createError(message, config, code, request, response) { var error = new Error(message); return enhanceError(error, config, code, request, response); }; /***/ }), /***/ "./node_modules/axios/lib/core/dispatchRequest.js": /*!********************************************************!*\ !*** ./node_modules/axios/lib/core/dispatchRequest.js ***! \********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js"); var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js"); var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js"); /** * Throws a `Cancel` if cancellation has been requested. */ function throwIfCancellationRequested(config) { if (config.cancelToken) { config.cancelToken.throwIfRequested(); } } /** * Dispatch a request to the server using the configured adapter. * * @param {object} config The config that is to be used for the request * @returns {Promise} The Promise to be fulfilled */ module.exports = function dispatchRequest(config) { throwIfCancellationRequested(config); // Ensure headers exist config.headers = config.headers || {}; // Transform request data config.data = transformData( config.data, config.headers, config.transformRequest ); // Flatten headers config.headers = utils.merge( config.headers.common || {}, config.headers[config.method] || {}, config.headers ); utils.forEach( ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function cleanHeaderConfig(method) { delete config.headers[method]; } ); var adapter = config.adapter || defaults.adapter; return adapter(config).then(function onAdapterResolution(response) { throwIfCancellationRequested(config); // Transform response data response.data = transformData( response.data, response.headers, config.transformResponse ); return response; }, function onAdapterRejection(reason) { if (!isCancel(reason)) { throwIfCancellationRequested(config); // Transform response data if (reason && reason.response) { reason.response.data = transformData( reason.response.data, reason.response.headers, config.transformResponse ); } } return Promise.reject(reason); }); }; /***/ }), /***/ "./node_modules/axios/lib/core/enhanceError.js": /*!*****************************************************!*\ !*** ./node_modules/axios/lib/core/enhanceError.js ***! \*****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Update an Error with the specified config, error code, and response. * * @param {Error} error The error to update. * @param {Object} config The config. * @param {string} [code] The error code (for example, 'ECONNABORTED'). * @param {Object} [request] The request. * @param {Object} [response] The response. * @returns {Error} The error. */ module.exports = function enhanceError(error, config, code, request, response) { error.config = config; if (code) { error.code = code; } error.request = request; error.response = response; error.isAxiosError = true; error.toJSON = function() { return { // Standard message: this.message, name: this.name, // Microsoft description: this.description, number: this.number, // Mozilla fileName: this.fileName, lineNumber: this.lineNumber, columnNumber: this.columnNumber, stack: this.stack, // Axios config: this.config, code: this.code }; }; return error; }; /***/ }), /***/ "./node_modules/axios/lib/core/mergeConfig.js": /*!****************************************************!*\ !*** ./node_modules/axios/lib/core/mergeConfig.js ***! \****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js"); /** * Config-specific merge-function which creates a new config-object * by merging two configuration objects together. * * @param {Object} config1 * @param {Object} config2 * @returns {Object} New object resulting from merging config2 to config1 */ module.exports = function mergeConfig(config1, config2) { // eslint-disable-next-line no-param-reassign config2 = config2 || {}; var config = {}; var valueFromConfig2Keys = ['url', 'method', 'params', 'data']; var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy']; var defaultToConfig2Keys = [ 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer', 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName', 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent', 'httpsAgent', 'cancelToken', 'socketPath' ]; utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) { if (typeof config2[prop] !== 'undefined') { config[prop] = config2[prop]; } }); utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) { if (utils.isObject(config2[prop])) { config[prop] = utils.deepMerge(config1[prop], config2[prop]); } else if (typeof config2[prop] !== 'undefined') { config[prop] = config2[prop]; } else if (utils.isObject(config1[prop])) { config[prop] = utils.deepMerge(config1[prop]); } else if (typeof config1[prop] !== 'undefined') { config[prop] = config1[prop]; } }); utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) { if (typeof config2[prop] !== 'undefined') { config[prop] = config2[prop]; } else if (typeof config1[prop] !== 'undefined') { config[prop] = config1[prop]; } }); var axiosKeys = valueFromConfig2Keys .concat(mergeDeepPropertiesKeys) .concat(defaultToConfig2Keys); var otherKeys = Object .keys(config2) .filter(function filterAxiosKeys(key) { return axiosKeys.indexOf(key) === -1; }); utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) { if (typeof config2[prop] !== 'undefined') { config[prop] = config2[prop]; } else if (typeof config1[prop] !== 'undefined') { config[prop] = config1[prop]; } }); return config; }; /***/ }), /***/ "./node_modules/axios/lib/core/settle.js": /*!***********************************************!*\ !*** ./node_modules/axios/lib/core/settle.js ***! \***********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js"); /** * Resolve or reject a Promise based on response status. * * @param {Function} resolve A function that resolves the promise. * @param {Function} reject A function that rejects the promise. * @param {object} response The response. */ module.exports = function settle(resolve, reject, response) { var validateStatus = response.config.validateStatus; if (!validateStatus || validateStatus(response.status)) { resolve(response); } else { reject(createError( 'Request failed with status code ' + response.status, response.config, null, response.request, response )); } }; /***/ }), /***/ "./node_modules/axios/lib/core/transformData.js": /*!******************************************************!*\ !*** ./node_modules/axios/lib/core/transformData.js ***! \******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); /** * Transform the data for a request or a response * * @param {Object|String} data The data to be transformed * @param {Array} headers The headers for the request or response * @param {Array|Function} fns A single function or Array of functions * @returns {*} The resulting transformed data */ module.exports = function transformData(data, headers, fns) { /*eslint no-param-reassign:0*/ utils.forEach(fns, function transform(fn) { data = fn(data, headers); }); return data; }; /***/ }), /***/ "./node_modules/axios/lib/defaults.js": /*!********************************************!*\ !*** ./node_modules/axios/lib/defaults.js ***! \********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) { var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js"); var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js"); var DEFAULT_CONTENT_TYPE = { 'Content-Type': 'application/x-www-form-urlencoded' }; function setContentTypeIfUnset(headers, value) { if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { headers['Content-Type'] = value; } } function getDefaultAdapter() { var adapter; if (typeof XMLHttpRequest !== 'undefined') { // For browsers use XHR adapter adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js"); } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') { // For node use HTTP adapter adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js"); } return adapter; } var defaults = { adapter: getDefaultAdapter(), transformRequest: [function transformRequest(data, headers) { normalizeHeaderName(headers, 'Accept'); normalizeHeaderName(headers, 'Content-Type'); if (utils.isFormData(data) || utils.isArrayBuffer(data) || utils.isBuffer(data) || utils.isStream(data) || utils.isFile(data) || utils.isBlob(data) ) { return data; } if (utils.isArrayBufferView(data)) { return data.buffer; } if (utils.isURLSearchParams(data)) { setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); return data.toString(); } if (utils.isObject(data)) { setContentTypeIfUnset(headers, 'application/json;charset=utf-8'); return JSON.stringify(data); } return data; }], transformResponse: [function transformResponse(data) { /*eslint no-param-reassign:0*/ if (typeof data === 'string') { try { data = JSON.parse(data); } catch (e) { /* Ignore */ } } return data; }], /** * A timeout in milliseconds to abort a request. If set to 0 (default) a * timeout is not created. */ timeout: 0, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, validateStatus: function validateStatus(status) { return status >= 200 && status < 300; } }; defaults.headers = { common: { 'Accept': 'application/json, text/plain, */*' } }; utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { defaults.headers[method] = {}; }); utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); }); module.exports = defaults; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js"))) /***/ }), /***/ "./node_modules/axios/lib/helpers/bind.js": /*!************************************************!*\ !*** ./node_modules/axios/lib/helpers/bind.js ***! \************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = function bind(fn, thisArg) { return function wrap() { var args = new Array(arguments.length); for (var i = 0; i < args.length; i++) { args[i] = arguments[i]; } return fn.apply(thisArg, args); }; }; /***/ }), /***/ "./node_modules/axios/lib/helpers/buildURL.js": /*!****************************************************!*\ !*** ./node_modules/axios/lib/helpers/buildURL.js ***! \****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); function encode(val) { return encodeURIComponent(val). replace(/%40/gi, '@'). replace(/%3A/gi, ':'). replace(/%24/g, '$'). replace(/%2C/gi, ','). replace(/%20/g, '+'). replace(/%5B/gi, '['). replace(/%5D/gi, ']'); } /** * Build a URL by appending params to the end * * @param {string} url The base of the url (e.g., http://www.google.com) * @param {object} [params] The params to be appended * @returns {string} The formatted url */ module.exports = function buildURL(url, params, paramsSerializer) { /*eslint no-param-reassign:0*/ if (!params) { return url; } var serializedParams; if (paramsSerializer) { serializedParams = paramsSerializer(params); } else if (utils.isURLSearchParams(params)) { serializedParams = params.toString(); } else { var parts = []; utils.forEach(params, function serialize(val, key) { if (val === null || typeof val === 'undefined') { return; } if (utils.isArray(val)) { key = key + '[]'; } else { val = [val]; } utils.forEach(val, function parseValue(v) { if (utils.isDate(v)) { v = v.toISOString(); } else if (utils.isObject(v)) { v = JSON.stringify(v); } parts.push(encode(key) + '=' + encode(v)); }); }); serializedParams = parts.join('&'); } if (serializedParams) { var hashmarkIndex = url.indexOf('#'); if (hashmarkIndex !== -1) { url = url.slice(0, hashmarkIndex); } url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; } return url; }; /***/ }), /***/ "./node_modules/axios/lib/helpers/combineURLs.js": /*!*******************************************************!*\ !*** ./node_modules/axios/lib/helpers/combineURLs.js ***! \*******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Creates a new URL by combining the specified URLs * * @param {string} baseURL The base URL * @param {string} relativeURL The relative URL * @returns {string} The combined URL */ module.exports = function combineURLs(baseURL, relativeURL) { return relativeURL ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') : baseURL; }; /***/ }), /***/ "./node_modules/axios/lib/helpers/cookies.js": /*!***************************************************!*\ !*** ./node_modules/axios/lib/helpers/cookies.js ***! \***************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); module.exports = ( utils.isStandardBrowserEnv() ? // Standard browser envs support document.cookie (function standardBrowserEnv() { return { write: function write(name, value, expires, path, domain, secure) { var cookie = []; cookie.push(name + '=' + encodeURIComponent(value)); if (utils.isNumber(expires)) { cookie.push('expires=' + new Date(expires).toGMTString()); } if (utils.isString(path)) { cookie.push('path=' + path); } if (utils.isString(domain)) { cookie.push('domain=' + domain); } if (secure === true) { cookie.push('secure'); } document.cookie = cookie.join('; '); }, read: function read(name) { var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); return (match ? decodeURIComponent(match[3]) : null); }, remove: function remove(name) { this.write(name, '', Date.now() - 86400000); } }; })() : // Non standard browser env (web workers, react-native) lack needed support. (function nonStandardBrowserEnv() { return { write: function write() {}, read: function read() { return null; }, remove: function remove() {} }; })() ); /***/ }), /***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js": /*!*********************************************************!*\ !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***! \*********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Determines whether the specified URL is absolute * * @param {string} url The URL to test * @returns {boolean} True if the specified URL is absolute, otherwise false */ module.exports = function isAbsoluteURL(url) { // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL). // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed // by any combination of letters, digits, plus, period, or hyphen. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); }; /***/ }), /***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js": /*!***********************************************************!*\ !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***! \***********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); module.exports = ( utils.isStandardBrowserEnv() ? // Standard browser envs have full support of the APIs needed to test // whether the request URL is of the same origin as current location. (function standardBrowserEnv() { var msie = /(msie|trident)/i.test(navigator.userAgent); var urlParsingNode = document.createElement('a'); var originURL; /** * Parse a URL to discover it's components * * @param {String} url The URL to be parsed * @returns {Object} */ function resolveURL(url) { var href = url; if (msie) { // IE needs attribute set twice to normalize properties urlParsingNode.setAttribute('href', href); href = urlParsingNode.href; } urlParsingNode.setAttribute('href', href); // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils return { href: urlParsingNode.href, protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', host: urlParsingNode.host, search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', hostname: urlParsingNode.hostname, port: urlParsingNode.port, pathname: (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname : '/' + urlParsingNode.pathname }; } originURL = resolveURL(window.location.href); /** * Determine if a URL shares the same origin as the current location * * @param {String} requestURL The URL to test * @returns {boolean} True if URL shares the same origin, otherwise false */ return function isURLSameOrigin(requestURL) { var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; return (parsed.protocol === originURL.protocol && parsed.host === originURL.host); }; })() : // Non standard browser envs (web workers, react-native) lack needed support. (function nonStandardBrowserEnv() { return function isURLSameOrigin() { return true; }; })() ); /***/ }), /***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js": /*!***************************************************************!*\ !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***! \***************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js"); module.exports = function normalizeHeaderName(headers, normalizedName) { utils.forEach(headers, function processHeader(value, name) { if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { headers[normalizedName] = value; delete headers[name]; } }); }; /***/ }), /***/ "./node_modules/axios/lib/helpers/parseHeaders.js": /*!********************************************************!*\ !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***! \********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); // Headers whose duplicates are ignored by node // c.f. https://nodejs.org/api/http.html#http_message_headers var ignoreDuplicateOf = [ 'age', 'authorization', 'content-length', 'content-type', 'etag', 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 'referer', 'retry-after', 'user-agent' ]; /** * Parse headers into an object * * ``` * Date: Wed, 27 Aug 2014 08:58:49 GMT * Content-Type: application/json * Connection: keep-alive * Transfer-Encoding: chunked * ``` * * @param {String} headers Headers needing to be parsed * @returns {Object} Headers parsed into an object */ module.exports = function parseHeaders(headers) { var parsed = {}; var key; var val; var i; if (!headers) { return parsed; } utils.forEach(headers.split('\n'), function parser(line) { i = line.indexOf(':'); key = utils.trim(line.substr(0, i)).toLowerCase(); val = utils.trim(line.substr(i + 1)); if (key) { if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { return; } if (key === 'set-cookie') { parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); } else { parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; } } }); return parsed; }; /***/ }), /***/ "./node_modules/axios/lib/helpers/spread.js": /*!**************************************************!*\ !*** ./node_modules/axios/lib/helpers/spread.js ***! \**************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Syntactic sugar for invoking a function and expanding an array for arguments. * * Common use case would be to use `Function.prototype.apply`. * * ```js * function f(x, y, z) {} * var args = [1, 2, 3]; * f.apply(null, args); * ``` * * With `spread` this example can be re-written. * * ```js * spread(function(x, y, z) {})([1, 2, 3]); * ``` * * @param {Function} callback * @returns {Function} */ module.exports = function spread(callback) { return function wrap(arr) { return callback.apply(null, arr); }; }; /***/ }), /***/ "./node_modules/axios/lib/utils.js": /*!*****************************************!*\ !*** ./node_modules/axios/lib/utils.js ***! \*****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js"); /*global toString:true*/ // utils is a library of generic helper functions non-specific to axios var toString = Object.prototype.toString; /** * Determine if a value is an Array * * @param {Object} val The value to test * @returns {boolean} True if value is an Array, otherwise false */ function isArray(val) { return toString.call(val) === '[object Array]'; } /** * Determine if a value is undefined * * @param {Object} val The value to test * @returns {boolean} True if the value is undefined, otherwise false */ function isUndefined(val) { return typeof val === 'undefined'; } /** * Determine if a value is a Buffer * * @param {Object} val The value to test * @returns {boolean} True if value is a Buffer, otherwise false */ function isBuffer(val) { return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val); } /** * Determine if a value is an ArrayBuffer * * @param {Object} val The value to test * @returns {boolean} True if value is an ArrayBuffer, otherwise false */ function isArrayBuffer(val) { return toString.call(val) === '[object ArrayBuffer]'; } /** * Determine if a value is a FormData * * @param {Object} val The value to test * @returns {boolean} True if value is an FormData, otherwise false */ function isFormData(val) { return (typeof FormData !== 'undefined') && (val instanceof FormData); } /** * Determine if a value is a view on an ArrayBuffer * * @param {Object} val The value to test * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false */ function isArrayBufferView(val) { var result; if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { result = ArrayBuffer.isView(val); } else { result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); } return result; } /** * Determine if a value is a String * * @param {Object} val The value to test * @returns {boolean} True if value is a String, otherwise false */ function isString(val) { return typeof val === 'string'; } /** * Determine if a value is a Number * * @param {Object} val The value to test * @returns {boolean} True if value is a Number, otherwise false */ function isNumber(val) { return typeof val === 'number'; } /** * Determine if a value is an Object * * @param {Object} val The value to test * @returns {boolean} True if value is an Object, otherwise false */ function isObject(val) { return val !== null && typeof val === 'object'; } /** * Determine if a value is a Date * * @param {Object} val The value to test * @returns {boolean} True if value is a Date, otherwise false */ function isDate(val) { return toString.call(val) === '[object Date]'; } /** * Determine if a value is a File * * @param {Object} val The value to test * @returns {boolean} True if value is a File, otherwise false */ function isFile(val) { return toString.call(val) === '[object File]'; } /** * Determine if a value is a Blob * * @param {Object} val The value to test * @returns {boolean} True if value is a Blob, otherwise false */ function isBlob(val) { return toString.call(val) === '[object Blob]'; } /** * Determine if a value is a Function * * @param {Object} val The value to test * @returns {boolean} True if value is a Function, otherwise false */ function isFunction(val) { return toString.call(val) === '[object Function]'; } /** * Determine if a value is a Stream * * @param {Object} val The value to test * @returns {boolean} True if value is a Stream, otherwise false */ function isStream(val) { return isObject(val) && isFunction(val.pipe); } /** * Determine if a value is a URLSearchParams object * * @param {Object} val The value to test * @returns {boolean} True if value is a URLSearchParams object, otherwise false */ function isURLSearchParams(val) { return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; } /** * Trim excess whitespace off the beginning and end of a string * * @param {String} str The String to trim * @returns {String} The String freed of excess whitespace */ function trim(str) { return str.replace(/^\s*/, '').replace(/\s*$/, ''); } /** * Determine if we're running in a standard browser environment * * This allows axios to run in a web worker, and react-native. * Both environments support XMLHttpRequest, but not fully standard globals. * * web workers: * typeof window -> undefined * typeof document -> undefined * * react-native: * navigator.product -> 'ReactNative' * nativescript * navigator.product -> 'NativeScript' or 'NS' */ function isStandardBrowserEnv() { if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || navigator.product === 'NativeScript' || navigator.product === 'NS')) { return false; } return ( typeof window !== 'undefined' && typeof document !== 'undefined' ); } /** * Iterate over an Array or an Object invoking a function for each item. * * If `obj` is an Array callback will be called passing * the value, index, and complete array for each item. * * If 'obj' is an Object callback will be called passing * the value, key, and complete object for each property. * * @param {Object|Array} obj The object to iterate * @param {Function} fn The callback to invoke for each item */ function forEach(obj, fn) { // Don't bother if no value provided if (obj === null || typeof obj === 'undefined') { return; } // Force an array if not already something iterable if (typeof obj !== 'object') { /*eslint no-param-reassign:0*/ obj = [obj]; } if (isArray(obj)) { // Iterate over array values for (var i = 0, l = obj.length; i < l; i++) { fn.call(null, obj[i], i, obj); } } else { // Iterate over object keys for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { fn.call(null, obj[key], key, obj); } } } } /** * Accepts varargs expecting each argument to be an object, then * immutably merges the properties of each object and returns result. * * When multiple objects contain the same key the later object in * the arguments list will take precedence. * * Example: * * ```js * var result = merge({foo: 123}, {foo: 456}); * console.log(result.foo); // outputs 456 * ``` * * @param {Object} obj1 Object to merge * @returns {Object} Result of all merge properties */ function merge(/* obj1, obj2, obj3, ... */) { var result = {}; function assignValue(val, key) { if (typeof result[key] === 'object' && typeof val === 'object') { result[key] = merge(result[key], val); } else { result[key] = val; } } for (var i = 0, l = arguments.length; i < l; i++) { forEach(arguments[i], assignValue); } return result; } /** * Function equal to merge with the difference being that no reference * to original objects is kept. * * @see merge * @param {Object} obj1 Object to merge * @returns {Object} Result of all merge properties */ function deepMerge(/* obj1, obj2, obj3, ... */) { var result = {}; function assignValue(val, key) { if (typeof result[key] === 'object' && typeof val === 'object') { result[key] = deepMerge(result[key], val); } else if (typeof val === 'object') { result[key] = deepMerge({}, val); } else { result[key] = val; } } for (var i = 0, l = arguments.length; i < l; i++) { forEach(arguments[i], assignValue); } return result; } /** * Extends object a by mutably adding to it the properties of object b. * * @param {Object} a The object to be extended * @param {Object} b The object to copy properties from * @param {Object} thisArg The object to bind function to * @return {Object} The resulting value of object a */ function extend(a, b, thisArg) { forEach(b, function assignValue(val, key) { if (thisArg && typeof val === 'function') { a[key] = bind(val, thisArg); } else { a[key] = val; } }); return a; } module.exports = { isArray: isArray, isArrayBuffer: isArrayBuffer, isBuffer: isBuffer, isFormData: isFormData, isArrayBufferView: isArrayBufferView, isString: isString, isNumber: isNumber, isObject: isObject, isUndefined: isUndefined, isDate: isDate, isFile: isFile, isBlob: isBlob, isFunction: isFunction, isStream: isStream, isURLSearchParams: isURLSearchParams, isStandardBrowserEnv: isStandardBrowserEnv, forEach: forEach, merge: merge, deepMerge: deepMerge, extend: extend, trim: trim }; /***/ }), /***/ "./node_modules/lodash/lodash.js": /*!***************************************!*\ !*** ./node_modules/lodash/lodash.js ***! \***************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/** * @license * Lodash <https://lodash.com/> * Copyright OpenJS Foundation and other contributors <https://openjsf.org/> * Released under MIT license <https://lodash.com/license> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ ;(function() { /** Used as a safe reference for `undefined` in pre-ES5 environments. */ var undefined; /** Used as the semantic version number. */ var VERSION = '4.17.15'; /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; /** Error message constants. */ var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.', FUNC_ERROR_TEXT = 'Expected a function'; /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; /** Used as the maximum memoize cache size. */ var MAX_MEMOIZE_SIZE = 500; /** Used as the internal argument placeholder. */ var PLACEHOLDER = '__lodash_placeholder__'; /** Used to compose bitmasks for cloning. */ var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4; /** Used to compose bitmasks for value comparisons. */ var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; /** Used to compose bitmasks for function metadata. */ var WRAP_BIND_FLAG = 1, WRAP_BIND_KEY_FLAG = 2, WRAP_CURRY_BOUND_FLAG = 4, WRAP_CURRY_FLAG = 8, WRAP_CURRY_RIGHT_FLAG = 16, WRAP_PARTIAL_FLAG = 32, WRAP_PARTIAL_RIGHT_FLAG = 64, WRAP_ARY_FLAG = 128, WRAP_REARG_FLAG = 256, WRAP_FLIP_FLAG = 512; /** Used as default options for `_.truncate`. */ var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = '...'; /** Used to detect hot functions by number of calls within a span of milliseconds. */ var HOT_COUNT = 800, HOT_SPAN = 16; /** Used to indicate the type of lazy iteratees. */ var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3; /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 1.7976931348623157e+308, NAN = 0 / 0; /** Used as references for the maximum length and index of an array. */ var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; /** Used to associate wrap methods with their bit flags. */ var wrapFlags = [ ['ary', WRAP_ARY_FLAG], ['bind', WRAP_BIND_FLAG], ['bindKey', WRAP_BIND_KEY_FLAG], ['curry', WRAP_CURRY_FLAG], ['curryRight', WRAP_CURRY_RIGHT_FLAG], ['flip', WRAP_FLIP_FLAG], ['partial', WRAP_PARTIAL_FLAG], ['partialRight', WRAP_PARTIAL_RIGHT_FLAG], ['rearg', WRAP_REARG_FLAG] ]; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', arrayTag = '[object Array]', asyncTag = '[object AsyncFunction]', boolTag = '[object Boolean]', dateTag = '[object Date]', domExcTag = '[object DOMException]', errorTag = '[object Error]', funcTag = '[object Function]', genTag = '[object GeneratorFunction]', mapTag = '[object Map]', numberTag = '[object Number]', nullTag = '[object Null]', objectTag = '[object Object]', promiseTag = '[object Promise]', proxyTag = '[object Proxy]', regexpTag = '[object RegExp]', setTag = '[object Set]', stringTag = '[object String]', symbolTag = '[object Symbol]', undefinedTag = '[object Undefined]', weakMapTag = '[object WeakMap]', weakSetTag = '[object WeakSet]'; var arrayBufferTag = '[object ArrayBuffer]', dataViewTag = '[object DataView]', float32Tag = '[object Float32Array]', float64Tag = '[object Float64Array]', int8Tag = '[object Int8Array]', int16Tag = '[object Int16Array]', int32Tag = '[object Int32Array]', uint8Tag = '[object Uint8Array]', uint8ClampedTag = '[object Uint8ClampedArray]', uint16Tag = '[object Uint16Array]', uint32Tag = '[object Uint32Array]'; /** Used to match empty string literals in compiled template source. */ var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; /** Used to match HTML entities and HTML characters. */ var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml = /[&<>"']/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source); /** Used to match template delimiters. */ var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g; /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; /** * Used to match `RegExp` * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source); /** Used to match leading and trailing whitespace. */ var reTrim = /^\s+|\s+$/g, reTrimStart = /^\s+/, reTrimEnd = /\s+$/; /** Used to match wrap detail comments. */ var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /; /** Used to match words composed of alphanumeric characters. */ var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; /** Used to match backslashes in property paths. */ var reEscapeChar = /\\(\\)?/g; /** * Used to match * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components). */ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; /** Used to match `RegExp` flags from their coerced string values. */ var reFlags = /\w*$/; /** Used to detect bad signed hexadecimal string values. */ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; /** Used to detect binary string values. */ var reIsBinary = /^0b[01]+$/i; /** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** Used to detect octal string values. */ var reIsOctal = /^0o[0-7]+$/i; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; /** Used to match Latin Unicode letters (excluding mathematical operators). */ var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; /** Used to ensure capturing order of template delimiters. */ var reNoMatch = /($^)/; /** Used to match unescaped characters in compiled string literals. */ var reUnescapedString = /['\n\r\u2028\u2029\\]/g; /** Used to compose unicode character classes. */ var rsAstralRange = '\\ud800-\\udfff', rsComboMarksRange = '\\u0300-\\u036f', reComboHalfMarksRange = '\\ufe20-\\ufe2f', rsComboSymbolsRange = '\\u20d0-\\u20ff', rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsDingbatRange = '\\u2700-\\u27bf', rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', rsPunctuationRange = '\\u2000-\\u206f', rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', rsVarRange = '\\ufe0e\\ufe0f', rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; /** Used to compose unicode capture groups. */ var rsApos = "['\u2019]", rsAstral = '[' + rsAstralRange + ']', rsBreak = '[' + rsBreakRange + ']', rsCombo = '[' + rsComboRange + ']', rsDigits = '\\d+', rsDingbat = '[' + rsDingbatRange + ']', rsLower = '[' + rsLowerRange + ']', rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', rsFitz = '\\ud83c[\\udffb-\\udfff]', rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', rsNonAstral = '[^' + rsAstralRange + ']', rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', rsUpper = '[' + rsUpperRange + ']', rsZWJ = '\\u200d'; /** Used to compose unicode regexes. */ var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', reOptMod = rsModifier + '?', rsOptVar = '[' + rsVarRange + ']?', rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; /** Used to match apostrophes. */ var reApos = RegExp(rsApos, 'g'); /** * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). */ var reComboMark = RegExp(rsCombo, 'g'); /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); /** Used to match complex or compound words. */ var reUnicodeWord = RegExp([ rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, rsUpper + '+' + rsOptContrUpper, rsOrdUpper, rsOrdLower, rsDigits, rsEmoji ].join('|'), 'g'); /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); /** Used to detect strings that need a more robust regexp to match words. */ var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; /** Used to assign default `context` object properties. */ var contextProps = [ 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array', 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' ]; /** Used to make template sourceURLs easier to identify. */ var templateCounter = -1; /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; /** Used to identify `toStringTag` values supported by `_.clone`. */ var cloneableTags = {}; cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false; /** Used to map Latin Unicode letters to basic Latin letters. */ var deburredLetters = { // Latin-1 Supplement block. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', '\xc7': 'C', '\xe7': 'c', '\xd0': 'D', '\xf0': 'd', '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', '\xd1': 'N', '\xf1': 'n', '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', '\xc6': 'Ae', '\xe6': 'ae', '\xde': 'Th', '\xfe': 'th', '\xdf': 'ss', // Latin Extended-A block. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', '\u0134': 'J', '\u0135': 'j', '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', '\u0163': 't', '\u0165': 't', '\u0167': 't', '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', '\u0174': 'W', '\u0175': 'w', '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', '\u0132': 'IJ', '\u0133': 'ij', '\u0152': 'Oe', '\u0153': 'oe', '\u0149': "'n", '\u017f': 's' }; /** Used to map characters to HTML entities. */ var htmlEscapes = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }; /** Used to map HTML entities to characters. */ var htmlUnescapes = { '&amp;': '&', '&lt;': '<', '&gt;': '>', '&quot;': '"', '&#39;': "'" }; /** Used to escape characters for inclusion in compiled string literals. */ var stringEscapes = { '\\': '\\', "'": "'", '\n': 'n', '\r': 'r', '\u2028': 'u2028', '\u2029': 'u2029' }; /** Built-in method references without a dependency on `root`. */ var freeParseFloat = parseFloat, freeParseInt = parseInt; /** Detect free variable `global` from Node.js. */ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; /** Detect free variable `self`. */ var freeSelf = typeof self == 'object' && self && self.Object === Object && self; /** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function('return this')(); /** Detect free variable `exports`. */ var freeExports = true && exports && !exports.nodeType && exports; /** Detect free variable `module`. */ var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; /** Detect free variable `process` from Node.js. */ var freeProcess = moduleExports && freeGlobal.process; /** Used to access faster Node.js helpers. */ var nodeUtil = (function() { try { // Use `util.types` for Node.js 10+. var types = freeModule && freeModule.require && freeModule.require('util').types; if (types) { return types; } // Legacy `process.binding('util')` for Node.js < 10. return freeProcess && freeProcess.binding && freeProcess.binding('util'); } catch (e) {} }()); /* Node.js helper references. */ var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, nodeIsDate = nodeUtil && nodeUtil.isDate, nodeIsMap = nodeUtil && nodeUtil.isMap, nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, nodeIsSet = nodeUtil && nodeUtil.isSet, nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; /*--------------------------------------------------------------------------*/ /** * A faster alternative to `Function#apply`, this function invokes `func` * with the `this` binding of `thisArg` and the arguments of `args`. * * @private * @param {Function} func The function to invoke. * @param {*} thisArg The `this` binding of `func`. * @param {Array} args The arguments to invoke `func` with. * @returns {*} Returns the result of `func`. */ function apply(func, thisArg, args) { switch (args.length) { case 0: return func.call(thisArg); case 1: return func.call(thisArg, args[0]); case 2: return func.call(thisArg, args[0], args[1]); case 3: return func.call(thisArg, args[0], args[1], args[2]); } return func.apply(thisArg, args); } /** * A specialized version of `baseAggregator` for arrays. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} setter The function to set `accumulator` values. * @param {Function} iteratee The iteratee to transform keys. * @param {Object} accumulator The initial aggregated object. * @returns {Function} Returns `accumulator`. */ function arrayAggregator(array, setter, iteratee, accumulator) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { var value = array[index]; setter(accumulator, value, iteratee(value), array); } return accumulator; } /** * A specialized version of `_.forEach` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns `array`. */ function arrayEach(array, iteratee) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (iteratee(array[index], index, array) === false) { break; } } return array; } /** * A specialized version of `_.forEachRight` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns `array`. */ function arrayEachRight(array, iteratee) { var length = array == null ? 0 : array.length; while (length--) { if (iteratee(array[length], length, array) === false) { break; } } return array; } /** * A specialized version of `_.every` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if all elements pass the predicate check, * else `false`. */ function arrayEvery(array, predicate) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (!predicate(array[index], index, array)) { return false; } } return true; } /** * A specialized version of `_.filter` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function arrayFilter(array, predicate) { var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result[resIndex++] = value; } } return result; } /** * A specialized version of `_.includes` for arrays without support for * specifying an index to search from. * * @private * @param {Array} [array] The array to inspect. * @param {*} target The value to search for. * @returns {boolean} Returns `true` if `target` is found, else `false`. */ function arrayIncludes(array, value) { var length = array == null ? 0 : array.length; return !!length && baseIndexOf(array, value, 0) > -1; } /** * This function is like `arrayIncludes` except that it accepts a comparator. * * @private * @param {Array} [array] The array to inspect. * @param {*} target The value to search for. * @param {Function} comparator The comparator invoked per element. * @returns {boolean} Returns `true` if `target` is found, else `false`. */ function arrayIncludesWith(array, value, comparator) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (comparator(value, array[index])) { return true; } } return false; } /** * A specialized version of `_.map` for arrays without support for iteratee * shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { var index = -1, length = array == null ? 0 : array.length, result = Array(length); while (++index < length) { result[index] = iteratee(array[index], index, array); } return result; } /** * Appends the elements of `values` to `array`. * * @private * @param {Array} array The array to modify. * @param {Array} values The values to append. * @returns {Array} Returns `array`. */ function arrayPush(array, values) { var index = -1, length = values.length, offset = array.length; while (++index < length) { array[offset + index] = values[index]; } return array; } /** * A specialized version of `_.reduce` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean} [initAccum] Specify using the first element of `array` as * the initial value. * @returns {*} Returns the accumulated value. */ function arrayReduce(array, iteratee, accumulator, initAccum) { var index = -1, length = array == null ? 0 : array.length; if (initAccum && length) { accumulator = array[++index]; } while (++index < length) { accumulator = iteratee(accumulator, array[index], index, array); } return accumulator; } /** * A specialized version of `_.reduceRight` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean} [initAccum] Specify using the last element of `array` as * the initial value. * @returns {*} Returns the accumulated value. */ function arrayReduceRight(array, iteratee, accumulator, initAccum) { var length = array == null ? 0 : array.length; if (initAccum && length) { accumulator = array[--length]; } while (length--) { accumulator = iteratee(accumulator, array[length], length, array); } return accumulator; } /** * A specialized version of `_.some` for arrays without support for iteratee * shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if any element passes the predicate check, * else `false`. */ function arraySome(array, predicate) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (predicate(array[index], index, array)) { return true; } } return false; } /** * Gets the size of an ASCII `string`. * * @private * @param {string} string The string inspect. * @returns {number} Returns the string size. */ var asciiSize = baseProperty('length'); /** * Converts an ASCII `string` to an array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the converted array. */ function asciiToArray(string) { return string.split(''); } /** * Splits an ASCII `string` into an array of its words. * * @private * @param {string} The string to inspect. * @returns {Array} Returns the words of `string`. */ function asciiWords(string) { return string.match(reAsciiWord) || []; } /** * The base implementation of methods like `_.findKey` and `_.findLastKey`, * without support for iteratee shorthands, which iterates over `collection` * using `eachFunc`. * * @private * @param {Array|Object} collection The collection to inspect. * @param {Function} predicate The function invoked per iteration. * @param {Function} eachFunc The function to iterate over `collection`. * @returns {*} Returns the found element or its key, else `undefined`. */ function baseFindKey(collection, predicate, eachFunc) { var result; eachFunc(collection, function(value, key, collection) { if (predicate(value, key, collection)) { result = key; return false; } }); return result; } /** * The base implementation of `_.findIndex` and `_.findLastIndex` without * support for iteratee shorthands. * * @private * @param {Array} array The array to inspect. * @param {Function} predicate The function invoked per iteration. * @param {number} fromIndex The index to search from. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {number} Returns the index of the matched value, else `-1`. */ function baseFindIndex(array, predicate, fromIndex, fromRight) { var length = array.length, index = fromIndex + (fromRight ? 1 : -1); while ((fromRight ? index-- : ++index < length)) { if (predicate(array[index], index, array)) { return index; } } return -1; } /** * The base implementation of `_.indexOf` without `fromIndex` bounds checks. * * @private * @param {Array} array The array to inspect. * @param {*} value The value to search for. * @param {number} fromIndex The index to search from. * @returns {number} Returns the index of the matched value, else `-1`. */ function baseIndexOf(array, value, fromIndex) { return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex); } /** * This function is like `baseIndexOf` except that it accepts a comparator. * * @private * @param {Array} array The array to inspect. * @param {*} value The value to search for. * @param {number} fromIndex The index to search from. * @param {Function} comparator The comparator invoked per element. * @returns {number} Returns the index of the matched value, else `-1`. */ function baseIndexOfWith(array, value, fromIndex, comparator) { var index = fromIndex - 1, length = array.length; while (++index < length) { if (comparator(array[index], value)) { return index; } } return -1; } /** * The base implementation of `_.isNaN` without support for number objects. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. */ function baseIsNaN(value) { return value !== value; } /** * The base implementation of `_.mean` and `_.meanBy` without support for * iteratee shorthands. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {number} Returns the mean. */ function baseMean(array, iteratee) { var length = array == null ? 0 : array.length; return length ? (baseSum(array, iteratee) / length) : NAN; } /** * The base implementation of `_.property` without support for deep paths. * * @private * @param {string} key The key of the property to get. * @returns {Function} Returns the new accessor function. */ function baseProperty(key) { return function(object) { return object == null ? undefined : object[key]; }; } /** * The base implementation of `_.propertyOf` without support for deep paths. * * @private * @param {Object} object The object to query. * @returns {Function} Returns the new accessor function. */ function basePropertyOf(object) { return function(key) { return object == null ? undefined : object[key]; }; } /** * The base implementation of `_.reduce` and `_.reduceRight`, without support * for iteratee shorthands, which iterates over `collection` using `eachFunc`. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} accumulator The initial value. * @param {boolean} initAccum Specify using the first or last element of * `collection` as the initial value. * @param {Function} eachFunc The function to iterate over `collection`. * @returns {*} Returns the accumulated value. */ function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { eachFunc(collection, function(value, index, collection) { accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection); }); return accumulator; } /** * The base implementation of `_.sortBy` which uses `comparer` to define the * sort order of `array` and replaces criteria objects with their corresponding * values. * * @private * @param {Array} array The array to sort. * @param {Function} comparer The function to define sort order. * @returns {Array} Returns `array`. */ function baseSortBy(array, comparer) { var length = array.length; array.sort(comparer); while (length--) { array[length] = array[length].value; } return array; } /** * The base implementation of `_.sum` and `_.sumBy` without support for * iteratee shorthands. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {number} Returns the sum. */ function baseSum(array, iteratee) { var result, index = -1, length = array.length; while (++index < length) { var current = iteratee(array[index]); if (current !== undefined) { result = result === undefined ? current : (result + current); } } return result; } /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. * * @private * @param {number} n The number of times to invoke `iteratee`. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the array of results. */ function baseTimes(n, iteratee) { var index = -1, result = Array(n); while (++index < n) { result[index] = iteratee(index); } return result; } /** * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array * of key-value pairs for `object` corresponding to the property names of `props`. * * @private * @param {Object} object The object to query. * @param {Array} props The property names to get values for. * @returns {Object} Returns the key-value pairs. */ function baseToPairs(object, props) { return arrayMap(props, function(key) { return [key, object[key]]; }); } /** * The base implementation of `_.unary` without support for storing metadata. * * @private * @param {Function} func The function to cap arguments for. * @returns {Function} Returns the new capped function. */ function baseUnary(func) { return function(value) { return func(value); }; } /** * The base implementation of `_.values` and `_.valuesIn` which creates an * array of `object` property values corresponding to the property names * of `props`. * * @private * @param {Object} object The object to query. * @param {Array} props The property names to get values for. * @returns {Object} Returns the array of property values. */ function baseValues(object, props) { return arrayMap(props, function(key) { return object[key]; }); } /** * Checks if a `cache` value for `key` exists. * * @private * @param {Object} cache The cache to query. * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function cacheHas(cache, key) { return cache.has(key); } /** * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol * that is not found in the character symbols. * * @private * @param {Array} strSymbols The string symbols to inspect. * @param {Array} chrSymbols The character symbols to find. * @returns {number} Returns the index of the first unmatched string symbol. */ function charsStartIndex(strSymbols, chrSymbols) { var index = -1, length = strSymbols.length; while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} return index; } /** * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol * that is not found in the character symbols. * * @private * @param {Array} strSymbols The string symbols to inspect. * @param {Array} chrSymbols The character symbols to find. * @returns {number} Returns the index of the last unmatched string symbol. */ function charsEndIndex(strSymbols, chrSymbols) { var index = strSymbols.length; while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} return index; } /** * Gets the number of `placeholder` occurrences in `array`. * * @private * @param {Array} array The array to inspect. * @param {*} placeholder The placeholder to search for. * @returns {number} Returns the placeholder count. */ function countHolders(array, placeholder) { var length = array.length, result = 0; while (length--) { if (array[length] === placeholder) { ++result; } } return result; } /** * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A * letters to basic Latin letters. * * @private * @param {string} letter The matched letter to deburr. * @returns {string} Returns the deburred letter. */ var deburrLetter = basePropertyOf(deburredLetters); /** * Used by `_.escape` to convert characters to HTML entities. * * @private * @param {string} chr The matched character to escape. * @returns {string} Returns the escaped character. */ var escapeHtmlChar = basePropertyOf(htmlEscapes); /** * Used by `_.template` to escape characters for inclusion in compiled string literals. * * @private * @param {string} chr The matched character to escape. * @returns {string} Returns the escaped character. */ function escapeStringChar(chr) { return '\\' + stringEscapes[chr]; } /** * Gets the value at `key` of `object`. * * @private * @param {Object} [object] The object to query. * @param {string} key The key of the property to get. * @returns {*} Returns the property value. */ function getValue(object, key) { return object == null ? undefined : object[key]; } /** * Checks if `string` contains Unicode symbols. * * @private * @param {string} string The string to inspect. * @returns {boolean} Returns `true` if a symbol is found, else `false`. */ function hasUnicode(string) { return reHasUnicode.test(string); } /** * Checks if `string` contains a word composed of Unicode symbols. * * @private * @param {string} string The string to inspect. * @returns {boolean} Returns `true` if a word is found, else `false`. */ function hasUnicodeWord(string) { return reHasUnicodeWord.test(string); } /** * Converts `iterator` to an array. * * @private * @param {Object} iterator The iterator to convert. * @returns {Array} Returns the converted array. */ function iteratorToArray(iterator) { var data, result = []; while (!(data = iterator.next()).done) { result.push(data.value); } return result; } /** * Converts `map` to its key-value pairs. * * @private * @param {Object} map The map to convert. * @returns {Array} Returns the key-value pairs. */ function mapToArray(map) { var index = -1, result = Array(map.size); map.forEach(function(value, key) { result[++index] = [key, value]; }); return result; } /** * Creates a unary function that invokes `func` with its argument transformed. * * @private * @param {Function} func The function to wrap. * @param {Function} transform The argument transform. * @returns {Function} Returns the new function. */ function overArg(func, transform) { return function(arg) { return func(transform(arg)); }; } /** * Replaces all `placeholder` elements in `array` with an internal placeholder * and returns an array of their indexes. * * @private * @param {Array} array The array to modify. * @param {*} placeholder The placeholder to replace. * @returns {Array} Returns the new array of placeholder indexes. */ function replaceHolders(array, placeholder) { var index = -1, length = array.length, resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (value === placeholder || value === PLACEHOLDER) { array[index] = PLACEHOLDER; result[resIndex++] = index; } } return result; } /** * Converts `set` to an array of its values. * * @private * @param {Object} set The set to convert. * @returns {Array} Returns the values. */ function setToArray(set) { var index = -1, result = Array(set.size); set.forEach(function(value) { result[++index] = value; }); return result; } /** * Converts `set` to its value-value pairs. * * @private * @param {Object} set The set to convert. * @returns {Array} Returns the value-value pairs. */ function setToPairs(set) { var index = -1, result = Array(set.size); set.forEach(function(value) { result[++index] = [value, value]; }); return result; } /** * A specialized version of `_.indexOf` which performs strict equality * comparisons of values, i.e. `===`. * * @private * @param {Array} array The array to inspect. * @param {*} value The value to search for. * @param {number} fromIndex The index to search from. * @returns {number} Returns the index of the matched value, else `-1`. */ function strictIndexOf(array, value, fromIndex) { var index = fromIndex - 1, length = array.length; while (++index < length) { if (array[index] === value) { return index; } } return -1; } /** * A specialized version of `_.lastIndexOf` which performs strict equality * comparisons of values, i.e. `===`. * * @private * @param {Array} array The array to inspect. * @param {*} value The value to search for. * @param {number} fromIndex The index to search from. * @returns {number} Returns the index of the matched value, else `-1`. */ function strictLastIndexOf(array, value, fromIndex) { var index = fromIndex + 1; while (index--) { if (array[index] === value) { return index; } } return index; } /** * Gets the number of symbols in `string`. * * @private * @param {string} string The string to inspect. * @returns {number} Returns the string size. */ function stringSize(string) { return hasUnicode(string) ? unicodeSize(string) : asciiSize(string); } /** * Converts `string` to an array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the converted array. */ function stringToArray(string) { return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string); } /** * Used by `_.unescape` to convert HTML entities to characters. * * @private * @param {string} chr The matched character to unescape. * @returns {string} Returns the unescaped character. */ var unescapeHtmlChar = basePropertyOf(htmlUnescapes); /** * Gets the size of a Unicode `string`. * * @private * @param {string} string The string inspect. * @returns {number} Returns the string size. */ function unicodeSize(string) { var result = reUnicode.lastIndex = 0; while (reUnicode.test(string)) { ++result; } return result; } /** * Converts a Unicode `string` to an array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the converted array. */ function unicodeToArray(string) { return string.match(reUnicode) || []; } /** * Splits a Unicode `string` into an array of its words. * * @private * @param {string} The string to inspect. * @returns {Array} Returns the words of `string`. */ function unicodeWords(string) { return string.match(reUnicodeWord) || []; } /*--------------------------------------------------------------------------*/ /** * Create a new pristine `lodash` function using the `context` object. * * @static * @memberOf _ * @since 1.1.0 * @category Util * @param {Object} [context=root] The context object. * @returns {Function} Returns a new `lodash` function. * @example * * _.mixin({ 'foo': _.constant('foo') }); * * var lodash = _.runInContext(); * lodash.mixin({ 'bar': lodash.constant('bar') }); * * _.isFunction(_.foo); * // => true * _.isFunction(_.bar); * // => false * * lodash.isFunction(lodash.foo); * // => false * lodash.isFunction(lodash.bar); * // => true * * // Create a suped-up `defer` in Node.js. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; */ var runInContext = (function runInContext(context) { context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); /** Built-in constructor references. */ var Array = context.Array, Date = context.Date, Error = context.Error, Function = context.Function, Math = context.Math, Object = context.Object, RegExp = context.RegExp, String = context.String, TypeError = context.TypeError; /** Used for built-in method references. */ var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype; /** Used to detect overreaching core-js shims. */ var coreJsData = context['__core-js_shared__']; /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** Used to generate unique IDs. */ var idCounter = 0; /** Used to detect methods masquerading as native. */ var maskSrcKey = (function() { var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); return uid ? ('Symbol(src)_1.' + uid) : ''; }()); /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var nativeObjectToString = objectProto.toString; /** Used to infer the `Object` constructor. */ var objectCtorString = funcToString.call(Object); /** Used to restore the original `_` reference in `_.noConflict`. */ var oldDash = root._; /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** Built-in value references. */ var Buffer = moduleExports ? context.Buffer : undefined, Symbol = context.Symbol, Uint8Array = context.Uint8Array, allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined, getPrototype = overArg(Object.getPrototypeOf, Object), objectCreate = Object.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined, symIterator = Symbol ? Symbol.iterator : undefined, symToStringTag = Symbol ? Symbol.toStringTag : undefined; var defineProperty = (function() { try { var func = getNative(Object, 'defineProperty'); func({}, '', {}); return func; } catch (e) {} }()); /** Mocked built-ins. */ var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date && Date.now !== root.Date.now && Date.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeCeil = Math.ceil, nativeFloor = Math.floor, nativeGetSymbols = Object.getOwnPropertySymbols, nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object.keys, Object), nativeMax = Math.max, nativeMin = Math.min, nativeNow = Date.now, nativeParseInt = context.parseInt, nativeRandom = Math.random, nativeReverse = arrayProto.reverse; /* Built-in method references that are verified to be native. */ var DataView = getNative(context, 'DataView'), Map = getNative(context, 'Map'), Promise = getNative(context, 'Promise'), Set = getNative(context, 'Set'), WeakMap = getNative(context, 'WeakMap'), nativeCreate = getNative(Object, 'create'); /** Used to store function metadata. */ var metaMap = WeakMap && new WeakMap; /** Used to lookup unminified function names. */ var realNames = {}; /** Used to detect maps, sets, and weakmaps. */ var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap); /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, symbolToString = symbolProto ? symbolProto.toString : undefined; /*------------------------------------------------------------------------*/ /** * Creates a `lodash` object which wraps `value` to enable implicit method * chain sequences. Methods that operate on and return arrays, collections, * and functions can be chained together. Methods that retrieve a single value * or may return a primitive value will automatically end the chain sequence * and return the unwrapped value. Otherwise, the value must be unwrapped * with `_#value`. * * Explicit chain sequences, which must be unwrapped with `_#value`, may be * enabled using `_.chain`. * * The execution of chained methods is lazy, that is, it's deferred until * `_#value` is implicitly or explicitly called. * * Lazy evaluation allows several methods to support shortcut fusion. * Shortcut fusion is an optimization to merge iteratee calls; this avoids * the creation of intermediate arrays and can greatly reduce the number of * iteratee executions. Sections of a chain sequence qualify for shortcut * fusion if the section is applied to an array and iteratees accept only * one argument. The heuristic for whether a section qualifies for shortcut * fusion is subject to change. * * Chaining is supported in custom builds as long as the `_#value` method is * directly or indirectly included in the build. * * In addition to lodash methods, wrappers have `Array` and `String` methods. * * The wrapper `Array` methods are: * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` * * The wrapper `String` methods are: * `replace` and `split` * * The wrapper methods that support shortcut fusion are: * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` * * The chainable wrapper methods are: * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, * `zipObject`, `zipObjectDeep`, and `zipWith` * * The wrapper methods that are **not** chainable by default are: * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, * `upperFirst`, `value`, and `words` * * @name _ * @constructor * @category Seq * @param {*} value The value to wrap in a `lodash` instance. * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * function square(n) { * return n * n; * } * * var wrapped = _([1, 2, 3]); * * // Returns an unwrapped value. * wrapped.reduce(_.add); * // => 6 * * // Returns a wrapped value. * var squares = wrapped.map(square); * * _.isArray(squares); * // => false * * _.isArray(squares.value()); * // => true */ function lodash(value) { if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { if (value instanceof LodashWrapper) { return value; } if (hasOwnProperty.call(value, '__wrapped__')) { return wrapperClone(value); } } return new LodashWrapper(value); } /** * The base implementation of `_.create` without support for assigning * properties to the created object. * * @private * @param {Object} proto The object to inherit from. * @returns {Object} Returns the new object. */ var baseCreate = (function() { function object() {} return function(proto) { if (!isObject(proto)) { return {}; } if (objectCreate) { return objectCreate(proto); } object.prototype = proto; var result = new object; object.prototype = undefined; return result; }; }()); /** * The function whose prototype chain sequence wrappers inherit from. * * @private */ function baseLodash() { // No operation performed. } /** * The base constructor for creating `lodash` wrapper objects. * * @private * @param {*} value The value to wrap. * @param {boolean} [chainAll] Enable explicit method chain sequences. */ function LodashWrapper(value, chainAll) { this.__wrapped__ = value; this.__actions__ = []; this.__chain__ = !!chainAll; this.__index__ = 0; this.__values__ = undefined; } /** * By default, the template delimiters used by lodash are like those in * embedded Ruby (ERB) as well as ES2015 template strings. Change the * following template settings to use alternative delimiters. * * @static * @memberOf _ * @type {Object} */ lodash.templateSettings = { /** * Used to detect `data` property values to be HTML-escaped. * * @memberOf _.templateSettings * @type {RegExp} */ 'escape': reEscape, /** * Used to detect code to be evaluated. * * @memberOf _.templateSettings * @type {RegExp} */ 'evaluate': reEvaluate, /** * Used to detect `data` property values to inject. * * @memberOf _.templateSettings * @type {RegExp} */ 'interpolate': reInterpolate, /** * Used to reference the data object in the template text. * * @memberOf _.templateSettings * @type {string} */ 'variable': '', /** * Used to import variables into the compiled template. * * @memberOf _.templateSettings * @type {Object} */ 'imports': { /** * A reference to the `lodash` function. * * @memberOf _.templateSettings.imports * @type {Function} */ '_': lodash } }; // Ensure wrappers are instances of `baseLodash`. lodash.prototype = baseLodash.prototype; lodash.prototype.constructor = lodash; LodashWrapper.prototype = baseCreate(baseLodash.prototype); LodashWrapper.prototype.constructor = LodashWrapper; /*------------------------------------------------------------------------*/ /** * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. * * @private * @constructor * @param {*} value The value to wrap. */ function LazyWrapper(value) { this.__wrapped__ = value; this.__actions__ = []; this.__dir__ = 1; this.__filtered__ = false; this.__iteratees__ = []; this.__takeCount__ = MAX_ARRAY_LENGTH; this.__views__ = []; } /** * Creates a clone of the lazy wrapper object. * * @private * @name clone * @memberOf LazyWrapper * @returns {Object} Returns the cloned `LazyWrapper` object. */ function lazyClone() { var result = new LazyWrapper(this.__wrapped__); result.__actions__ = copyArray(this.__actions__); result.__dir__ = this.__dir__; result.__filtered__ = this.__filtered__; result.__iteratees__ = copyArray(this.__iteratees__); result.__takeCount__ = this.__takeCount__; result.__views__ = copyArray(this.__views__); return result; } /** * Reverses the direction of lazy iteration. * * @private * @name reverse * @memberOf LazyWrapper * @returns {Object} Returns the new reversed `LazyWrapper` object. */ function lazyReverse() { if (this.__filtered__) { var result = new LazyWrapper(this); result.__dir__ = -1; result.__filtered__ = true; } else { result = this.clone(); result.__dir__ *= -1; } return result; } /** * Extracts the unwrapped value from its lazy wrapper. * * @private * @name value * @memberOf LazyWrapper * @returns {*} Returns the unwrapped value. */ function lazyValue() { var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index = isRight ? end : (start - 1), iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin(length, this.__takeCount__); if (!isArr || (!isRight && arrLength == length && takeCount == length)) { return baseWrapperValue(array, this.__actions__); } var result = []; outer: while (length-- && resIndex < takeCount) { index += dir; var iterIndex = -1, value = array[index]; while (++iterIndex < iterLength) { var data = iteratees[iterIndex], iteratee = data.iteratee, type = data.type, computed = iteratee(value); if (type == LAZY_MAP_FLAG) { value = computed; } else if (!computed) { if (type == LAZY_FILTER_FLAG) { continue outer; } else { break outer; } } } result[resIndex++] = value; } return result; } // Ensure `LazyWrapper` is an instance of `baseLodash`. LazyWrapper.prototype = baseCreate(baseLodash.prototype); LazyWrapper.prototype.constructor = LazyWrapper; /*------------------------------------------------------------------------*/ /** * Creates a hash object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Hash(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the hash. * * @private * @name clear * @memberOf Hash */ function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; this.size = 0; } /** * Removes `key` and its value from the hash. * * @private * @name delete * @memberOf Hash * @param {Object} hash The hash to modify. * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function hashDelete(key) { var result = this.has(key) && delete this.__data__[key]; this.size -= result ? 1 : 0; return result; } /** * Gets the hash value for `key`. * * @private * @name get * @memberOf Hash * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function hashGet(key) { var data = this.__data__; if (nativeCreate) { var result = data[key]; return result === HASH_UNDEFINED ? undefined : result; } return hasOwnProperty.call(data, key) ? data[key] : undefined; } /** * Checks if a hash value for `key` exists. * * @private * @name has * @memberOf Hash * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function hashHas(key) { var data = this.__data__; return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); } /** * Sets the hash `key` to `value`. * * @private * @name set * @memberOf Hash * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the hash instance. */ function hashSet(key, value) { var data = this.__data__; this.size += this.has(key) ? 0 : 1; data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; return this; } // Add methods to `Hash`. Hash.prototype.clear = hashClear; Hash.prototype['delete'] = hashDelete; Hash.prototype.get = hashGet; Hash.prototype.has = hashHas; Hash.prototype.set = hashSet; /*------------------------------------------------------------------------*/ /** * Creates an list cache object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function ListCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the list cache. * * @private * @name clear * @memberOf ListCache */ function listCacheClear() { this.__data__ = []; this.size = 0; } /** * Removes `key` and its value from the list cache. * * @private * @name delete * @memberOf ListCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function listCacheDelete(key) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { return false; } var lastIndex = data.length - 1; if (index == lastIndex) { data.pop(); } else { splice.call(data, index, 1); } --this.size; return true; } /** * Gets the list cache value for `key`. * * @private * @name get * @memberOf ListCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function listCacheGet(key) { var data = this.__data__, index = assocIndexOf(data, key); return index < 0 ? undefined : data[index][1]; } /** * Checks if a list cache value for `key` exists. * * @private * @name has * @memberOf ListCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function listCacheHas(key) { return assocIndexOf(this.__data__, key) > -1; } /** * Sets the list cache `key` to `value`. * * @private * @name set * @memberOf ListCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the list cache instance. */ function listCacheSet(key, value) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { ++this.size; data.push([key, value]); } else { data[index][1] = value; } return this; } // Add methods to `ListCache`. ListCache.prototype.clear = listCacheClear; ListCache.prototype['delete'] = listCacheDelete; ListCache.prototype.get = listCacheGet; ListCache.prototype.has = listCacheHas; ListCache.prototype.set = listCacheSet; /*------------------------------------------------------------------------*/ /** * Creates a map cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function MapCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the map. * * @private * @name clear * @memberOf MapCache */ function mapCacheClear() { this.size = 0; this.__data__ = { 'hash': new Hash, 'map': new (Map || ListCache), 'string': new Hash }; } /** * Removes `key` and its value from the map. * * @private * @name delete * @memberOf MapCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function mapCacheDelete(key) { var result = getMapData(this, key)['delete'](key); this.size -= result ? 1 : 0; return result; } /** * Gets the map value for `key`. * * @private * @name get * @memberOf MapCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function mapCacheGet(key) { return getMapData(this, key).get(key); } /** * Checks if a map value for `key` exists. * * @private * @name has * @memberOf MapCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function mapCacheHas(key) { return getMapData(this, key).has(key); } /** * Sets the map `key` to `value`. * * @private * @name set * @memberOf MapCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the map cache instance. */ function mapCacheSet(key, value) { var data = getMapData(this, key), size = data.size; data.set(key, value); this.size += data.size == size ? 0 : 1; return this; } // Add methods to `MapCache`. MapCache.prototype.clear = mapCacheClear; MapCache.prototype['delete'] = mapCacheDelete; MapCache.prototype.get = mapCacheGet; MapCache.prototype.has = mapCacheHas; MapCache.prototype.set = mapCacheSet; /*------------------------------------------------------------------------*/ /** * * Creates an array cache object to store unique values. * * @private * @constructor * @param {Array} [values] The values to cache. */ function SetCache(values) { var index = -1, length = values == null ? 0 : values.length; this.__data__ = new MapCache; while (++index < length) { this.add(values[index]); } } /** * Adds `value` to the array cache. * * @private * @name add * @memberOf SetCache * @alias push * @param {*} value The value to cache. * @returns {Object} Returns the cache instance. */ function setCacheAdd(value) { this.__data__.set(value, HASH_UNDEFINED); return this; } /** * Checks if `value` is in the array cache. * * @private * @name has * @memberOf SetCache * @param {*} value The value to search for. * @returns {number} Returns `true` if `value` is found, else `false`. */ function setCacheHas(value) { return this.__data__.has(value); } // Add methods to `SetCache`. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; SetCache.prototype.has = setCacheHas; /*------------------------------------------------------------------------*/ /** * Creates a stack cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Stack(entries) { var data = this.__data__ = new ListCache(entries); this.size = data.size; } /** * Removes all key-value entries from the stack. * * @private * @name clear * @memberOf Stack */ function stackClear() { this.__data__ = new ListCache; this.size = 0; } /** * Removes `key` and its value from the stack. * * @private * @name delete * @memberOf Stack * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function stackDelete(key) { var data = this.__data__, result = data['delete'](key); this.size = data.size; return result; } /** * Gets the stack value for `key`. * * @private * @name get * @memberOf Stack * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function stackGet(key) { return this.__data__.get(key); } /** * Checks if a stack value for `key` exists. * * @private * @name has * @memberOf Stack * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function stackHas(key) { return this.__data__.has(key); } /** * Sets the stack `key` to `value`. * * @private * @name set * @memberOf Stack * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the stack cache instance. */ function stackSet(key, value) { var data = this.__data__; if (data instanceof ListCache) { var pairs = data.__data__; if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { pairs.push([key, value]); this.size = ++data.size; return this; } data = this.__data__ = new MapCache(pairs); } data.set(key, value); this.size = data.size; return this; } // Add methods to `Stack`. Stack.prototype.clear = stackClear; Stack.prototype['delete'] = stackDelete; Stack.prototype.get = stackGet; Stack.prototype.has = stackHas; Stack.prototype.set = stackSet; /*------------------------------------------------------------------------*/ /** * Creates an array of the enumerable property names of the array-like `value`. * * @private * @param {*} value The value to query. * @param {boolean} inherited Specify returning inherited property names. * @returns {Array} Returns the array of property names. */ function arrayLikeKeys(value, inherited) { var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length; for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && ( // Safari 9 has enumerable `arguments.length` in strict mode. key == 'length' || // Node.js 0.10 has enumerable non-index properties on buffers. (isBuff && (key == 'offset' || key == 'parent')) || // PhantomJS 2 has enumerable non-index properties on typed arrays. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || // Skip index properties. isIndex(key, length) ))) { result.push(key); } } return result; } /** * A specialized version of `_.sample` for arrays. * * @private * @param {Array} array The array to sample. * @returns {*} Returns the random element. */ function arraySample(array) { var length = array.length; return length ? array[baseRandom(0, length - 1)] : undefined; } /** * A specialized version of `_.sampleSize` for arrays. * * @private * @param {Array} array The array to sample. * @param {number} n The number of elements to sample. * @returns {Array} Returns the random elements. */ function arraySampleSize(array, n) { return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); } /** * A specialized version of `_.shuffle` for arrays. * * @private * @param {Array} array The array to shuffle. * @returns {Array} Returns the new shuffled array. */ function arrayShuffle(array) { return shuffleSelf(copyArray(array)); } /** * This function is like `assignValue` except that it doesn't assign * `undefined` values. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function assignMergeValue(object, key, value) { if ((value !== undefined && !eq(object[key], value)) || (value === undefined && !(key in object))) { baseAssignValue(object, key, value); } } /** * Assigns `value` to `key` of `object` if the existing value is not equivalent * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function assignValue(object, key, value) { var objValue = object[key]; if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || (value === undefined && !(key in object))) { baseAssignValue(object, key, value); } } /** * Gets the index at which the `key` is found in `array` of key-value pairs. * * @private * @param {Array} array The array to inspect. * @param {*} key The key to search for. * @returns {number} Returns the index of the matched value, else `-1`. */ function assocIndexOf(array, key) { var length = array.length; while (length--) { if (eq(array[length][0], key)) { return length; } } return -1; } /** * Aggregates elements of `collection` on `accumulator` with keys transformed * by `iteratee` and values set by `setter`. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} setter The function to set `accumulator` values. * @param {Function} iteratee The iteratee to transform keys. * @param {Object} accumulator The initial aggregated object. * @returns {Function} Returns `accumulator`. */ function baseAggregator(collection, setter, iteratee, accumulator) { baseEach(collection, function(value, key, collection) { setter(accumulator, value, iteratee(value), collection); }); return accumulator; } /** * The base implementation of `_.assign` without support for multiple sources * or `customizer` functions. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @returns {Object} Returns `object`. */ function baseAssign(object, source) { return object && copyObject(source, keys(source), object); } /** * The base implementation of `_.assignIn` without support for multiple sources * or `customizer` functions. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @returns {Object} Returns `object`. */ function baseAssignIn(object, source) { return object && copyObject(source, keysIn(source), object); } /** * The base implementation of `assignValue` and `assignMergeValue` without * value checks. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function baseAssignValue(object, key, value) { if (key == '__proto__' && defineProperty) { defineProperty(object, key, { 'configurable': true, 'enumerable': true, 'value': value, 'writable': true }); } else { object[key] = value; } } /** * The base implementation of `_.at` without support for individual paths. * * @private * @param {Object} object The object to iterate over. * @param {string[]} paths The property paths to pick. * @returns {Array} Returns the picked elements. */ function baseAt(object, paths) { var index = -1, length = paths.length, result = Array(length), skip = object == null; while (++index < length) { result[index] = skip ? undefined : get(object, paths[index]); } return result; } /** * The base implementation of `_.clamp` which doesn't coerce arguments. * * @private * @param {number} number The number to clamp. * @param {number} [lower] The lower bound. * @param {number} upper The upper bound. * @returns {number} Returns the clamped number. */ function baseClamp(number, lower, upper) { if (number === number) { if (upper !== undefined) { number = number <= upper ? number : upper; } if (lower !== undefined) { number = number >= lower ? number : lower; } } return number; } /** * The base implementation of `_.clone` and `_.cloneDeep` which tracks * traversed objects. * * @private * @param {*} value The value to clone. * @param {boolean} bitmask The bitmask flags. * 1 - Deep clone * 2 - Flatten inherited properties * 4 - Clone symbols * @param {Function} [customizer] The function to customize cloning. * @param {string} [key] The key of `value`. * @param {Object} [object] The parent object of `value`. * @param {Object} [stack] Tracks traversed objects and their clone counterparts. * @returns {*} Returns the cloned value. */ function baseClone(value, bitmask, customizer, key, object, stack) { var result, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG; if (customizer) { result = object ? customizer(value, key, object, stack) : customizer(value); } if (result !== undefined) { return result; } if (!isObject(value)) { return value; } var isArr = isArray(value); if (isArr) { result = initCloneArray(value); if (!isDeep) { return copyArray(value, result); } } else { var tag = getTag(value), isFunc = tag == funcTag || tag == genTag; if (isBuffer(value)) { return cloneBuffer(value, isDeep); } if (tag == objectTag || tag == argsTag || (isFunc && !object)) { result = (isFlat || isFunc) ? {} : initCloneObject(value); if (!isDeep) { return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value)); } } else { if (!cloneableTags[tag]) { return object ? value : {}; } result = initCloneByTag(value, tag, isDeep); } } // Check for circular references and return its corresponding clone. stack || (stack = new Stack); var stacked = stack.get(value); if (stacked) { return stacked; } stack.set(value, result); if (isSet(value)) { value.forEach(function(subValue) { result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); }); } else if (isMap(value)) { value.forEach(function(subValue, key) { result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); }); } var keysFunc = isFull ? (isFlat ? getAllKeysIn : getAllKeys) : (isFlat ? keysIn : keys); var props = isArr ? undefined : keysFunc(value); arrayEach(props || value, function(subValue, key) { if (props) { key = subValue; subValue = value[key]; } // Recursively populate clone (susceptible to call stack limits). assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); }); return result; } /** * The base implementation of `_.conforms` which doesn't clone `source`. * * @private * @param {Object} source The object of property predicates to conform to. * @returns {Function} Returns the new spec function. */ function baseConforms(source) { var props = keys(source); return function(object) { return baseConformsTo(object, source, props); }; } /** * The base implementation of `_.conformsTo` which accepts `props` to check. * * @private * @param {Object} object The object to inspect. * @param {Object} source The object of property predicates to conform to. * @returns {boolean} Returns `true` if `object` conforms, else `false`. */ function baseConformsTo(object, source, props) { var length = props.length; if (object == null) { return !length; } object = Object(object); while (length--) { var key = props[length], predicate = source[key], value = object[key]; if ((value === undefined && !(key in object)) || !predicate(value)) { return false; } } return true; } /** * The base implementation of `_.delay` and `_.defer` which accepts `args` * to provide to `func`. * * @private * @param {Function} func The function to delay. * @param {number} wait The number of milliseconds to delay invocation. * @param {Array} args The arguments to provide to `func`. * @returns {number|Object} Returns the timer id or timeout object. */ function baseDelay(func, wait, args) { if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } return setTimeout(function() { func.apply(undefined, args); }, wait); } /** * The base implementation of methods like `_.difference` without support * for excluding multiple arrays or iteratee shorthands. * * @private * @param {Array} array The array to inspect. * @param {Array} values The values to exclude. * @param {Function} [iteratee] The iteratee invoked per element. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of filtered values. */ function baseDifference(array, values, iteratee, comparator) { var index = -1, includes = arrayIncludes, isCommon = true, length = array.length, result = [], valuesLength = values.length; if (!length) { return result; } if (iteratee) { values = arrayMap(values, baseUnary(iteratee)); } if (comparator) { includes = arrayIncludesWith; isCommon = false; } else if (values.length >= LARGE_ARRAY_SIZE) { includes = cacheHas; isCommon = false; values = new SetCache(values); } outer: while (++index < length) { var value = array[index], computed = iteratee == null ? value : iteratee(value); value = (comparator || value !== 0) ? value : 0; if (isCommon && computed === computed) { var valuesIndex = valuesLength; while (valuesIndex--) { if (values[valuesIndex] === computed) { continue outer; } } result.push(value); } else if (!includes(values, computed, comparator)) { result.push(value); } } return result; } /** * The base implementation of `_.forEach` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array|Object} Returns `collection`. */ var baseEach = createBaseEach(baseForOwn); /** * The base implementation of `_.forEachRight` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array|Object} Returns `collection`. */ var baseEachRight = createBaseEach(baseForOwnRight, true); /** * The base implementation of `_.every` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if all elements pass the predicate check, * else `false` */ function baseEvery(collection, predicate) { var result = true; baseEach(collection, function(value, index, collection) { result = !!predicate(value, index, collection); return result; }); return result; } /** * The base implementation of methods like `_.max` and `_.min` which accepts a * `comparator` to determine the extremum value. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The iteratee invoked per iteration. * @param {Function} comparator The comparator used to compare values. * @returns {*} Returns the extremum value. */ function baseExtremum(array, iteratee, comparator) { var index = -1, length = array.length; while (++index < length) { var value = array[index], current = iteratee(value); if (current != null && (computed === undefined ? (current === current && !isSymbol(current)) : comparator(current, computed) )) { var computed = current, result = value; } } return result; } /** * The base implementation of `_.fill` without an iteratee call guard. * * @private * @param {Array} array The array to fill. * @param {*} value The value to fill `array` with. * @param {number} [start=0] The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns `array`. */ function baseFill(array, value, start, end) { var length = array.length; start = toInteger(start); if (start < 0) { start = -start > length ? 0 : (length + start); } end = (end === undefined || end > length) ? length : toInteger(end); if (end < 0) { end += length; } end = start > end ? 0 : toLength(end); while (start < end) { array[start++] = value; } return array; } /** * The base implementation of `_.filter` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function baseFilter(collection, predicate) { var result = []; baseEach(collection, function(value, index, collection) { if (predicate(value, index, collection)) { result.push(value); } }); return result; } /** * The base implementation of `_.flatten` with support for restricting flattening. * * @private * @param {Array} array The array to flatten. * @param {number} depth The maximum recursion depth. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. * @param {Array} [result=[]] The initial result value. * @returns {Array} Returns the new flattened array. */ function baseFlatten(array, depth, predicate, isStrict, result) { var index = -1, length = array.length; predicate || (predicate = isFlattenable); result || (result = []); while (++index < length) { var value = array[index]; if (depth > 0 && predicate(value)) { if (depth > 1) { // Recursively flatten arrays (susceptible to call stack limits). baseFlatten(value, depth - 1, predicate, isStrict, result); } else { arrayPush(result, value); } } else if (!isStrict) { result[result.length] = value; } } return result; } /** * The base implementation of `baseForOwn` which iterates over `object` * properties returned by `keysFunc` and invokes `iteratee` for each property. * Iteratee functions may exit iteration early by explicitly returning `false`. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {Function} keysFunc The function to get the keys of `object`. * @returns {Object} Returns `object`. */ var baseFor = createBaseFor(); /** * This function is like `baseFor` except that it iterates over properties * in the opposite order. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {Function} keysFunc The function to get the keys of `object`. * @returns {Object} Returns `object`. */ var baseForRight = createBaseFor(true); /** * The base implementation of `_.forOwn` without support for iteratee shorthands. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Object} Returns `object`. */ function baseForOwn(object, iteratee) { return object && baseFor(object, iteratee, keys); } /** * The base implementation of `_.forOwnRight` without support for iteratee shorthands. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Object} Returns `object`. */ function baseForOwnRight(object, iteratee) { return object && baseForRight(object, iteratee, keys); } /** * The base implementation of `_.functions` which creates an array of * `object` function property names filtered from `props`. * * @private * @param {Object} object The object to inspect. * @param {Array} props The property names to filter. * @returns {Array} Returns the function names. */ function baseFunctions(object, props) { return arrayFilter(props, function(key) { return isFunction(object[key]); }); } /** * The base implementation of `_.get` without support for default values. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @returns {*} Returns the resolved value. */ function baseGet(object, path) { path = castPath(path, object); var index = 0, length = path.length; while (object != null && index < length) { object = object[toKey(path[index++])]; } return (index && index == length) ? object : undefined; } /** * The base implementation of `getAllKeys` and `getAllKeysIn` which uses * `keysFunc` and `symbolsFunc` to get the enumerable property names and * symbols of `object`. * * @private * @param {Object} object The object to query. * @param {Function} keysFunc The function to get the keys of `object`. * @param {Function} symbolsFunc The function to get the symbols of `object`. * @returns {Array} Returns the array of property names and symbols. */ function baseGetAllKeys(object, keysFunc, symbolsFunc) { var result = keysFunc(object); return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); } /** * The base implementation of `getTag` without fallbacks for buggy environments. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ function baseGetTag(value) { if (value == null) { return value === undefined ? undefinedTag : nullTag; } return (symToStringTag && symToStringTag in Object(value)) ? getRawTag(value) : objectToString(value); } /** * The base implementation of `_.gt` which doesn't coerce arguments. * * @private * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if `value` is greater than `other`, * else `false`. */ function baseGt(value, other) { return value > other; } /** * The base implementation of `_.has` without support for deep paths. * * @private * @param {Object} [object] The object to query. * @param {Array|string} key The key to check. * @returns {boolean} Returns `true` if `key` exists, else `false`. */ function baseHas(object, key) { return object != null && hasOwnProperty.call(object, key); } /** * The base implementation of `_.hasIn` without support for deep paths. * * @private * @param {Object} [object] The object to query. * @param {Array|string} key The key to check. * @returns {boolean} Returns `true` if `key` exists, else `false`. */ function baseHasIn(object, key) { return object != null && key in Object(object); } /** * The base implementation of `_.inRange` which doesn't coerce arguments. * * @private * @param {number} number The number to check. * @param {number} start The start of the range. * @param {number} end The end of the range. * @returns {boolean} Returns `true` if `number` is in the range, else `false`. */ function baseInRange(number, start, end) { return number >= nativeMin(start, end) && number < nativeMax(start, end); } /** * The base implementation of methods like `_.intersection`, without support * for iteratee shorthands, that accepts an array of arrays to inspect. * * @private * @param {Array} arrays The arrays to inspect. * @param {Function} [iteratee] The iteratee invoked per element. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of shared values. */ function baseIntersection(arrays, iteratee, comparator) { var includes = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array(othLength), maxLength = Infinity, result = []; while (othIndex--) { var array = arrays[othIndex]; if (othIndex && iteratee) { array = arrayMap(array, baseUnary(iteratee)); } maxLength = nativeMin(array.length, maxLength); caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) ? new SetCache(othIndex && array) : undefined; } array = arrays[0]; var index = -1, seen = caches[0]; outer: while (++index < length && result.length < maxLength) { var value = array[index], computed = iteratee ? iteratee(value) : value; value = (comparator || value !== 0) ? value : 0; if (!(seen ? cacheHas(seen, computed) : includes(result, computed, comparator) )) { othIndex = othLength; while (--othIndex) { var cache = caches[othIndex]; if (!(cache ? cacheHas(cache, computed) : includes(arrays[othIndex], computed, comparator)) ) { continue outer; } } if (seen) { seen.push(computed); } result.push(value); } } return result; } /** * The base implementation of `_.invert` and `_.invertBy` which inverts * `object` with values transformed by `iteratee` and set by `setter`. * * @private * @param {Object} object The object to iterate over. * @param {Function} setter The function to set `accumulator` values. * @param {Function} iteratee The iteratee to transform values. * @param {Object} accumulator The initial inverted object. * @returns {Function} Returns `accumulator`. */ function baseInverter(object, setter, iteratee, accumulator) { baseForOwn(object, function(value, key, object) { setter(accumulator, iteratee(value), key, object); }); return accumulator; } /** * The base implementation of `_.invoke` without support for individual * method arguments. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path of the method to invoke. * @param {Array} args The arguments to invoke the method with. * @returns {*} Returns the result of the invoked method. */ function baseInvoke(object, path, args) { path = castPath(path, object); object = parent(object, path); var func = object == null ? object : object[toKey(last(path))]; return func == null ? undefined : apply(func, object, args); } /** * The base implementation of `_.isArguments`. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, */ function baseIsArguments(value) { return isObjectLike(value) && baseGetTag(value) == argsTag; } /** * The base implementation of `_.isArrayBuffer` without Node.js optimizations. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. */ function baseIsArrayBuffer(value) { return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; } /** * The base implementation of `_.isDate` without Node.js optimizations. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a date object, else `false`. */ function baseIsDate(value) { return isObjectLike(value) && baseGetTag(value) == dateTag; } /** * The base implementation of `_.isEqual` which supports partial comparisons * and tracks traversed objects. * * @private * @param {*} value The value to compare. * @param {*} other The other value to compare. * @param {boolean} bitmask The bitmask flags. * 1 - Unordered comparison * 2 - Partial comparison * @param {Function} [customizer] The function to customize comparisons. * @param {Object} [stack] Tracks traversed `value` and `other` objects. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. */ function baseIsEqual(value, other, bitmask, customizer, stack) { if (value === other) { return true; } if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { return value !== value && other !== other; } return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); } /** * A specialized version of `baseIsEqual` for arrays and objects which performs * deep comparisons and tracks traversed objects enabling objects with circular * references to be compared. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} [stack] Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other); objTag = objTag == argsTag ? objectTag : objTag; othTag = othTag == argsTag ? objectTag : othTag; var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag; if (isSameTag && isBuffer(object)) { if (!isBuffer(other)) { return false; } objIsArr = true; objIsObj = false; } if (isSameTag && !objIsObj) { stack || (stack = new Stack); return (objIsArr || isTypedArray(object)) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & COMPARE_PARTIAL_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); if (objIsWrapped || othIsWrapped) { var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; stack || (stack = new Stack); return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); } } if (!isSameTag) { return false; } stack || (stack = new Stack); return equalObjects(object, other, bitmask, customizer, equalFunc, stack); } /** * The base implementation of `_.isMap` without Node.js optimizations. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a map, else `false`. */ function baseIsMap(value) { return isObjectLike(value) && getTag(value) == mapTag; } /** * The base implementation of `_.isMatch` without support for iteratee shorthands. * * @private * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. * @param {Array} matchData The property names, values, and compare flags to match. * @param {Function} [customizer] The function to customize comparisons. * @returns {boolean} Returns `true` if `object` is a match, else `false`. */ function baseIsMatch(object, source, matchData, customizer) { var index = matchData.length, length = index, noCustomizer = !customizer; if (object == null) { return !length; } object = Object(object); while (index--) { var data = matchData[index]; if ((noCustomizer && data[2]) ? data[1] !== object[data[0]] : !(data[0] in object) ) { return false; } } while (++index < length) { data = matchData[index]; var key = data[0], objValue = object[key], srcValue = data[1]; if (noCustomizer && data[2]) { if (objValue === undefined && !(key in object)) { return false; } } else { var stack = new Stack; if (customizer) { var result = customizer(objValue, srcValue, key, object, source, stack); } if (!(result === undefined ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result )) { return false; } } } return true; } /** * The base implementation of `_.isNative` without bad shim checks. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, * else `false`. */ function baseIsNative(value) { if (!isObject(value) || isMasked(value)) { return false; } var pattern = isFunction(value) ? reIsNative : reIsHostCtor; return pattern.test(toSource(value)); } /** * The base implementation of `_.isRegExp` without Node.js optimizations. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. */ function baseIsRegExp(value) { return isObjectLike(value) && baseGetTag(value) == regexpTag; } /** * The base implementation of `_.isSet` without Node.js optimizations. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a set, else `false`. */ function baseIsSet(value) { return isObjectLike(value) && getTag(value) == setTag; } /** * The base implementation of `_.isTypedArray` without Node.js optimizations. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. */ function baseIsTypedArray(value) { return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; } /** * The base implementation of `_.iteratee`. * * @private * @param {*} [value=_.identity] The value to convert to an iteratee. * @returns {Function} Returns the iteratee. */ function baseIteratee(value) { // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. if (typeof value == 'function') { return value; } if (value == null) { return identity; } if (typeof value == 'object') { return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value); } return property(value); } /** * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeys(object) { if (!isPrototype(object)) { return nativeKeys(object); } var result = []; for (var key in Object(object)) { if (hasOwnProperty.call(object, key) && key != 'constructor') { result.push(key); } } return result; } /** * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeysIn(object) { if (!isObject(object)) { return nativeKeysIn(object); } var isProto = isPrototype(object), result = []; for (var key in object) { if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { result.push(key); } } return result; } /** * The base implementation of `_.lt` which doesn't coerce arguments. * * @private * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if `value` is less than `other`, * else `false`. */ function baseLt(value, other) { return value < other; } /** * The base implementation of `_.map` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function baseMap(collection, iteratee) { var index = -1, result = isArrayLike(collection) ? Array(collection.length) : []; baseEach(collection, function(value, key, collection) { result[++index] = iteratee(value, key, collection); }); return result; } /** * The base implementation of `_.matches` which doesn't clone `source`. * * @private * @param {Object} source The object of property values to match. * @returns {Function} Returns the new spec function. */ function baseMatches(source) { var matchData = getMatchData(source); if (matchData.length == 1 && matchData[0][2]) { return matchesStrictComparable(matchData[0][0], matchData[0][1]); } return function(object) { return object === source || baseIsMatch(object, source, matchData); }; } /** * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. * * @private * @param {string} path The path of the property to get. * @param {*} srcValue The value to match. * @returns {Function} Returns the new spec function. */ function baseMatchesProperty(path, srcValue) { if (isKey(path) && isStrictComparable(srcValue)) { return matchesStrictComparable(toKey(path), srcValue); } return function(object) { var objValue = get(object, path); return (objValue === undefined && objValue === srcValue) ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); }; } /** * The base implementation of `_.merge` without support for multiple sources. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @param {number} srcIndex The index of `source`. * @param {Function} [customizer] The function to customize merged values. * @param {Object} [stack] Tracks traversed source values and their merged * counterparts. */ function baseMerge(object, source, srcIndex, customizer, stack) { if (object === source) { return; } baseFor(source, function(srcValue, key) { stack || (stack = new Stack); if (isObject(srcValue)) { baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); } else { var newValue = customizer ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) : undefined; if (newValue === undefined) { newValue = srcValue; } assignMergeValue(object, key, newValue); } }, keysIn); } /** * A specialized version of `baseMerge` for arrays and objects which performs * deep merges and tracks traversed objects enabling objects with circular * references to be merged. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @param {string} key The key of the value to merge. * @param {number} srcIndex The index of `source`. * @param {Function} mergeFunc The function to merge values. * @param {Function} [customizer] The function to customize assigned values. * @param {Object} [stack] Tracks traversed source values and their merged * counterparts. */ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue); if (stacked) { assignMergeValue(object, key, stacked); return; } var newValue = customizer ? customizer(objValue, srcValue, (key + ''), object, source, stack) : undefined; var isCommon = newValue === undefined; if (isCommon) { var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue); newValue = srcValue; if (isArr || isBuff || isTyped) { if (isArray(objValue)) { newValue = objValue; } else if (isArrayLikeObject(objValue)) { newValue = copyArray(objValue); } else if (isBuff) { isCommon = false; newValue = cloneBuffer(srcValue, true); } else if (isTyped) { isCommon = false; newValue = cloneTypedArray(srcValue, true); } else { newValue = []; } } else if (isPlainObject(srcValue) || isArguments(srcValue)) { newValue = objValue; if (isArguments(objValue)) { newValue = toPlainObject(objValue); } else if (!isObject(objValue) || isFunction(objValue)) { newValue = initCloneObject(srcValue); } } else { isCommon = false; } } if (isCommon) { // Recursively merge objects and arrays (susceptible to call stack limits). stack.set(srcValue, newValue); mergeFunc(newValue, srcValue, srcIndex, customizer, stack); stack['delete'](srcValue); } assignMergeValue(object, key, newValue); } /** * The base implementation of `_.nth` which doesn't coerce arguments. * * @private * @param {Array} array The array to query. * @param {number} n The index of the element to return. * @returns {*} Returns the nth element of `array`. */ function baseNth(array, n) { var length = array.length; if (!length) { return; } n += n < 0 ? length : 0; return isIndex(n, length) ? array[n] : undefined; } /** * The base implementation of `_.orderBy` without param guards. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. * @param {string[]} orders The sort orders of `iteratees`. * @returns {Array} Returns the new sorted array. */ function baseOrderBy(collection, iteratees, orders) { var index = -1; iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee())); var result = baseMap(collection, function(value, key, collection) { var criteria = arrayMap(iteratees, function(iteratee) { return iteratee(value); }); return { 'criteria': criteria, 'index': ++index, 'value': value }; }); return baseSortBy(result, function(object, other) { return compareMultiple(object, other, orders); }); } /** * The base implementation of `_.pick` without support for individual * property identifiers. * * @private * @param {Object} object The source object. * @param {string[]} paths The property paths to pick. * @returns {Object} Returns the new object. */ function basePick(object, paths) { return basePickBy(object, paths, function(value, path) { return hasIn(object, path); }); } /** * The base implementation of `_.pickBy` without support for iteratee shorthands. * * @private * @param {Object} object The source object. * @param {string[]} paths The property paths to pick. * @param {Function} predicate The function invoked per property. * @returns {Object} Returns the new object. */ function basePickBy(object, paths, predicate) { var index = -1, length = paths.length, result = {}; while (++index < length) { var path = paths[index], value = baseGet(object, path); if (predicate(value, path)) { baseSet(result, castPath(path, object), value); } } return result; } /** * A specialized version of `baseProperty` which supports deep paths. * * @private * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new accessor function. */ function basePropertyDeep(path) { return function(object) { return baseGet(object, path); }; } /** * The base implementation of `_.pullAllBy` without support for iteratee * shorthands. * * @private * @param {Array} array The array to modify. * @param {Array} values The values to remove. * @param {Function} [iteratee] The iteratee invoked per element. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns `array`. */ function basePullAll(array, values, iteratee, comparator) { var indexOf = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values.length, seen = array; if (array === values) { values = copyArray(values); } if (iteratee) { seen = arrayMap(array, baseUnary(iteratee)); } while (++index < length) { var fromIndex = 0, value = values[index], computed = iteratee ? iteratee(value) : value; while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { if (seen !== array) { splice.call(seen, fromIndex, 1); } splice.call(array, fromIndex, 1); } } return array; } /** * The base implementation of `_.pullAt` without support for individual * indexes or capturing the removed elements. * * @private * @param {Array} array The array to modify. * @param {number[]} indexes The indexes of elements to remove. * @returns {Array} Returns `array`. */ function basePullAt(array, indexes) { var length = array ? indexes.length : 0, lastIndex = length - 1; while (length--) { var index = indexes[length]; if (length == lastIndex || index !== previous) { var previous = index; if (isIndex(index)) { splice.call(array, index, 1); } else { baseUnset(array, index); } } } return array; } /** * The base implementation of `_.random` without support for returning * floating-point numbers. * * @private * @param {number} lower The lower bound. * @param {number} upper The upper bound. * @returns {number} Returns the random number. */ function baseRandom(lower, upper) { return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); } /** * The base implementation of `_.range` and `_.rangeRight` which doesn't * coerce arguments. * * @private * @param {number} start The start of the range. * @param {number} end The end of the range. * @param {number} step The value to increment or decrement by. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Array} Returns the range of numbers. */ function baseRange(start, end, step, fromRight) { var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result = Array(length); while (length--) { result[fromRight ? length : ++index] = start; start += step; } return result; } /** * The base implementation of `_.repeat` which doesn't coerce arguments. * * @private * @param {string} string The string to repeat. * @param {number} n The number of times to repeat the string. * @returns {string} Returns the repeated string. */ function baseRepeat(string, n) { var result = ''; if (!string || n < 1 || n > MAX_SAFE_INTEGER) { return result; } // Leverage the exponentiation by squaring algorithm for a faster repeat. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. do { if (n % 2) { result += string; } n = nativeFloor(n / 2); if (n) { string += string; } } while (n); return result; } /** * The base implementation of `_.rest` which doesn't validate or coerce arguments. * * @private * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. * @returns {Function} Returns the new function. */ function baseRest(func, start) { return setToString(overRest(func, start, identity), func + ''); } /** * The base implementation of `_.sample`. * * @private * @param {Array|Object} collection The collection to sample. * @returns {*} Returns the random element. */ function baseSample(collection) { return arraySample(values(collection)); } /** * The base implementation of `_.sampleSize` without param guards. * * @private * @param {Array|Object} collection The collection to sample. * @param {number} n The number of elements to sample. * @returns {Array} Returns the random elements. */ function baseSampleSize(collection, n) { var array = values(collection); return shuffleSelf(array, baseClamp(n, 0, array.length)); } /** * The base implementation of `_.set`. * * @private * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. * @param {*} value The value to set. * @param {Function} [customizer] The function to customize path creation. * @returns {Object} Returns `object`. */ function baseSet(object, path, value, customizer) { if (!isObject(object)) { return object; } path = castPath(path, object); var index = -1, length = path.length, lastIndex = length - 1, nested = object; while (nested != null && ++index < length) { var key = toKey(path[index]), newValue = value; if (index != lastIndex) { var objValue = nested[key]; newValue = customizer ? customizer(objValue, key, nested) : undefined; if (newValue === undefined) { newValue = isObject(objValue) ? objValue : (isIndex(path[index + 1]) ? [] : {}); } } assignValue(nested, key, newValue); nested = nested[key]; } return object; } /** * The base implementation of `setData` without support for hot loop shorting. * * @private * @param {Function} func The function to associate metadata with. * @param {*} data The metadata. * @returns {Function} Returns `func`. */ var baseSetData = !metaMap ? identity : function(func, data) { metaMap.set(func, data); return func; }; /** * The base implementation of `setToString` without support for hot loop shorting. * * @private * @param {Function} func The function to modify. * @param {Function} string The `toString` result. * @returns {Function} Returns `func`. */ var baseSetToString = !defineProperty ? identity : function(func, string) { return defineProperty(func, 'toString', { 'configurable': true, 'enumerable': false, 'value': constant(string), 'writable': true }); }; /** * The base implementation of `_.shuffle`. * * @private * @param {Array|Object} collection The collection to shuffle. * @returns {Array} Returns the new shuffled array. */ function baseShuffle(collection) { return shuffleSelf(values(collection)); } /** * The base implementation of `_.slice` without an iteratee call guard. * * @private * @param {Array} array The array to slice. * @param {number} [start=0] The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns the slice of `array`. */ function baseSlice(array, start, end) { var index = -1, length = array.length; if (start < 0) { start = -start > length ? 0 : (length + start); } end = end > length ? length : end; if (end < 0) { end += length; } length = start > end ? 0 : ((end - start) >>> 0); start >>>= 0; var result = Array(length); while (++index < length) { result[index] = array[index + start]; } return result; } /** * The base implementation of `_.some` without support for iteratee shorthands. * * @private * @param {Array|Object} collection The collection to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if any element passes the predicate check, * else `false`. */ function baseSome(collection, predicate) { var result; baseEach(collection, function(value, index, collection) { result = predicate(value, index, collection); return !result; }); return !!result; } /** * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which * performs a binary search of `array` to determine the index at which `value` * should be inserted into `array` in order to maintain its sort order. * * @private * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @param {boolean} [retHighest] Specify returning the highest qualified index. * @returns {number} Returns the index at which `value` should be inserted * into `array`. */ function baseSortedIndex(array, value, retHighest) { var low = 0, high = array == null ? low : array.length; if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { while (low < high) { var mid = (low + high) >>> 1, computed = array[mid]; if (computed !== null && !isSymbol(computed) && (retHighest ? (computed <= value) : (computed < value))) { low = mid + 1; } else { high = mid; } } return high; } return baseSortedIndexBy(array, value, identity, retHighest); } /** * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` * which invokes `iteratee` for `value` and each element of `array` to compute * their sort ranking. The iteratee is invoked with one argument; (value). * * @private * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @param {Function} iteratee The iteratee invoked per element. * @param {boolean} [retHighest] Specify returning the highest qualified index. * @returns {number} Returns the index at which `value` should be inserted * into `array`. */ function baseSortedIndexBy(array, value, iteratee, retHighest) { value = iteratee(value); var low = 0, high = array == null ? 0 : array.length, valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === undefined; while (low < high) { var mid = nativeFloor((low + high) / 2), computed = iteratee(array[mid]), othIsDefined = computed !== undefined, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol(computed); if (valIsNaN) { var setLow = retHighest || othIsReflexive; } else if (valIsUndefined) { setLow = othIsReflexive && (retHighest || othIsDefined); } else if (valIsNull) { setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); } else if (valIsSymbol) { setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); } else if (othIsNull || othIsSymbol) { setLow = false; } else { setLow = retHighest ? (computed <= value) : (computed < value); } if (setLow) { low = mid + 1; } else { high = mid; } } return nativeMin(high, MAX_ARRAY_INDEX); } /** * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without * support for iteratee shorthands. * * @private * @param {Array} array The array to inspect. * @param {Function} [iteratee] The iteratee invoked per element. * @returns {Array} Returns the new duplicate free array. */ function baseSortedUniq(array, iteratee) { var index = -1, length = array.length, resIndex = 0, result = []; while (++index < length) { var value = array[index], computed = iteratee ? iteratee(value) : value; if (!index || !eq(computed, seen)) { var seen = computed; result[resIndex++] = value === 0 ? 0 : value; } } return result; } /** * The base implementation of `_.toNumber` which doesn't ensure correct * conversions of binary, hexadecimal, or octal string values. * * @private * @param {*} value The value to process. * @returns {number} Returns the number. */ function baseToNumber(value) { if (typeof value == 'number') { return value; } if (isSymbol(value)) { return NAN; } return +value; } /** * The base implementation of `_.toString` which doesn't convert nullish * values to empty strings. * * @private * @param {*} value The value to process. * @returns {string} Returns the string. */ function baseToString(value) { // Exit early for strings to avoid a performance hit in some environments. if (typeof value == 'string') { return value; } if (isArray(value)) { // Recursively convert values (susceptible to call stack limits). return arrayMap(value, baseToString) + ''; } if (isSymbol(value)) { return symbolToString ? symbolToString.call(value) : ''; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } /** * The base implementation of `_.uniqBy` without support for iteratee shorthands. * * @private * @param {Array} array The array to inspect. * @param {Function} [iteratee] The iteratee invoked per element. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new duplicate free array. */ function baseUniq(array, iteratee, comparator) { var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result; if (comparator) { isCommon = false; includes = arrayIncludesWith; } else if (length >= LARGE_ARRAY_SIZE) { var set = iteratee ? null : createSet(array); if (set) { return setToArray(set); } isCommon = false; includes = cacheHas; seen = new SetCache; } else { seen = iteratee ? [] : result; } outer: while (++index < length) { var value = array[index], computed = iteratee ? iteratee(value) : value; value = (comparator || value !== 0) ? value : 0; if (isCommon && computed === computed) { var seenIndex = seen.length; while (seenIndex--) { if (seen[seenIndex] === computed) { continue outer; } } if (iteratee) { seen.push(computed); } result.push(value); } else if (!includes(seen, computed, comparator)) { if (seen !== result) { seen.push(computed); } result.push(value); } } return result; } /** * The base implementation of `_.unset`. * * @private * @param {Object} object The object to modify. * @param {Array|string} path The property path to unset. * @returns {boolean} Returns `true` if the property is deleted, else `false`. */ function baseUnset(object, path) { path = castPath(path, object); object = parent(object, path); return object == null || delete object[toKey(last(path))]; } /** * The base implementation of `_.update`. * * @private * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to update. * @param {Function} updater The function to produce the updated value. * @param {Function} [customizer] The function to customize path creation. * @returns {Object} Returns `object`. */ function baseUpdate(object, path, updater, customizer) { return baseSet(object, path, updater(baseGet(object, path)), customizer); } /** * The base implementation of methods like `_.dropWhile` and `_.takeWhile` * without support for iteratee shorthands. * * @private * @param {Array} array The array to query. * @param {Function} predicate The function invoked per iteration. * @param {boolean} [isDrop] Specify dropping elements instead of taking them. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Array} Returns the slice of `array`. */ function baseWhile(array, predicate, isDrop, fromRight) { var length = array.length, index = fromRight ? length : -1; while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {} return isDrop ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); } /** * The base implementation of `wrapperValue` which returns the result of * performing a sequence of actions on the unwrapped `value`, where each * successive action is supplied the return value of the previous. * * @private * @param {*} value The unwrapped value. * @param {Array} actions Actions to perform to resolve the unwrapped value. * @returns {*} Returns the resolved value. */ function baseWrapperValue(value, actions) { var result = value; if (result instanceof LazyWrapper) { result = result.value(); } return arrayReduce(actions, function(result, action) { return action.func.apply(action.thisArg, arrayPush([result], action.args)); }, result); } /** * The base implementation of methods like `_.xor`, without support for * iteratee shorthands, that accepts an array of arrays to inspect. * * @private * @param {Array} arrays The arrays to inspect. * @param {Function} [iteratee] The iteratee invoked per element. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of values. */ function baseXor(arrays, iteratee, comparator) { var length = arrays.length; if (length < 2) { return length ? baseUniq(arrays[0]) : []; } var index = -1, result = Array(length); while (++index < length) { var array = arrays[index], othIndex = -1; while (++othIndex < length) { if (othIndex != index) { result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); } } } return baseUniq(baseFlatten(result, 1), iteratee, comparator); } /** * This base implementation of `_.zipObject` which assigns values using `assignFunc`. * * @private * @param {Array} props The property identifiers. * @param {Array} values The property values. * @param {Function} assignFunc The function to assign values. * @returns {Object} Returns the new object. */ function baseZipObject(props, values, assignFunc) { var index = -1, length = props.length, valsLength = values.length, result = {}; while (++index < length) { var value = index < valsLength ? values[index] : undefined; assignFunc(result, props[index], value); } return result; } /** * Casts `value` to an empty array if it's not an array like object. * * @private * @param {*} value The value to inspect. * @returns {Array|Object} Returns the cast array-like object. */ function castArrayLikeObject(value) { return isArrayLikeObject(value) ? value : []; } /** * Casts `value` to `identity` if it's not a function. * * @private * @param {*} value The value to inspect. * @returns {Function} Returns cast function. */ function castFunction(value) { return typeof value == 'function' ? value : identity; } /** * Casts `value` to a path array if it's not one. * * @private * @param {*} value The value to inspect. * @param {Object} [object] The object to query keys on. * @returns {Array} Returns the cast property path array. */ function castPath(value, object) { if (isArray(value)) { return value; } return isKey(value, object) ? [value] : stringToPath(toString(value)); } /** * A `baseRest` alias which can be replaced with `identity` by module * replacement plugins. * * @private * @type {Function} * @param {Function} func The function to apply a rest parameter to. * @returns {Function} Returns the new function. */ var castRest = baseRest; /** * Casts `array` to a slice if it's needed. * * @private * @param {Array} array The array to inspect. * @param {number} start The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns the cast slice. */ function castSlice(array, start, end) { var length = array.length; end = end === undefined ? length : end; return (!start && end >= length) ? array : baseSlice(array, start, end); } /** * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout). * * @private * @param {number|Object} id The timer id or timeout object of the timer to clear. */ var clearTimeout = ctxClearTimeout || function(id) { return root.clearTimeout(id); }; /** * Creates a clone of `buffer`. * * @private * @param {Buffer} buffer The buffer to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Buffer} Returns the cloned buffer. */ function cloneBuffer(buffer, isDeep) { if (isDeep) { return buffer.slice(); } var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); buffer.copy(result); return result; } /** * Creates a clone of `arrayBuffer`. * * @private * @param {ArrayBuffer} arrayBuffer The array buffer to clone. * @returns {ArrayBuffer} Returns the cloned array buffer. */ function cloneArrayBuffer(arrayBuffer) { var result = new arrayBuffer.constructor(arrayBuffer.byteLength); new Uint8Array(result).set(new Uint8Array(arrayBuffer)); return result; } /** * Creates a clone of `dataView`. * * @private * @param {Object} dataView The data view to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the cloned data view. */ function cloneDataView(dataView, isDeep) { var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); } /** * Creates a clone of `regexp`. * * @private * @param {Object} regexp The regexp to clone. * @returns {Object} Returns the cloned regexp. */ function cloneRegExp(regexp) { var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); result.lastIndex = regexp.lastIndex; return result; } /** * Creates a clone of the `symbol` object. * * @private * @param {Object} symbol The symbol object to clone. * @returns {Object} Returns the cloned symbol object. */ function cloneSymbol(symbol) { return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; } /** * Creates a clone of `typedArray`. * * @private * @param {Object} typedArray The typed array to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the cloned typed array. */ function cloneTypedArray(typedArray, isDeep) { var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); } /** * Compares values to sort them in ascending order. * * @private * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {number} Returns the sort order indicator for `value`. */ function compareAscending(value, other) { if (value !== other) { var valIsDefined = value !== undefined, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value); var othIsDefined = other !== undefined, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other); if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || (valIsNull && othIsDefined && othIsReflexive) || (!valIsDefined && othIsReflexive) || !valIsReflexive) { return 1; } if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || (othIsNull && valIsDefined && valIsReflexive) || (!othIsDefined && valIsReflexive) || !othIsReflexive) { return -1; } } return 0; } /** * Used by `_.orderBy` to compare multiple properties of a value to another * and stable sort them. * * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, * specify an order of "desc" for descending or "asc" for ascending sort order * of corresponding values. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {boolean[]|string[]} orders The order to sort by for each property. * @returns {number} Returns the sort order indicator for `object`. */ function compareMultiple(object, other, orders) { var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length; while (++index < length) { var result = compareAscending(objCriteria[index], othCriteria[index]); if (result) { if (index >= ordersLength) { return result; } var order = orders[index]; return result * (order == 'desc' ? -1 : 1); } } // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications // that causes it, under certain circumstances, to provide the same value for // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 // for more details. // // This also ensures a stable sort in V8 and other engines. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. return object.index - other.index; } /** * Creates an array that is the composition of partially applied arguments, * placeholders, and provided arguments into a single array of arguments. * * @private * @param {Array} args The provided arguments. * @param {Array} partials The arguments to prepend to those provided. * @param {Array} holders The `partials` placeholder indexes. * @params {boolean} [isCurried] Specify composing for a curried function. * @returns {Array} Returns the new array of composed arguments. */ function composeArgs(args, partials, holders, isCurried) { var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result = Array(leftLength + rangeLength), isUncurried = !isCurried; while (++leftIndex < leftLength) { result[leftIndex] = partials[leftIndex]; } while (++argsIndex < holdersLength) { if (isUncurried || argsIndex < argsLength) { result[holders[argsIndex]] = args[argsIndex]; } } while (rangeLength--) { result[leftIndex++] = args[argsIndex++]; } return result; } /** * This function is like `composeArgs` except that the arguments composition * is tailored for `_.partialRight`. * * @private * @param {Array} args The provided arguments. * @param {Array} partials The arguments to append to those provided. * @param {Array} holders The `partials` placeholder indexes. * @params {boolean} [isCurried] Specify composing for a curried function. * @returns {Array} Returns the new array of composed arguments. */ function composeArgsRight(args, partials, holders, isCurried) { var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result = Array(rangeLength + rightLength), isUncurried = !isCurried; while (++argsIndex < rangeLength) { result[argsIndex] = args[argsIndex]; } var offset = argsIndex; while (++rightIndex < rightLength) { result[offset + rightIndex] = partials[rightIndex]; } while (++holdersIndex < holdersLength) { if (isUncurried || argsIndex < argsLength) { result[offset + holders[holdersIndex]] = args[argsIndex++]; } } return result; } /** * Copies the values of `source` to `array`. * * @private * @param {Array} source The array to copy values from. * @param {Array} [array=[]] The array to copy values to. * @returns {Array} Returns `array`. */ function copyArray(source, array) { var index = -1, length = source.length; array || (array = Array(length)); while (++index < length) { array[index] = source[index]; } return array; } /** * Copies properties of `source` to `object`. * * @private * @param {Object} source The object to copy properties from. * @param {Array} props The property identifiers to copy. * @param {Object} [object={}] The object to copy properties to. * @param {Function} [customizer] The function to customize copied values. * @returns {Object} Returns `object`. */ function copyObject(source, props, object, customizer) { var isNew = !object; object || (object = {}); var index = -1, length = props.length; while (++index < length) { var key = props[index]; var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined; if (newValue === undefined) { newValue = source[key]; } if (isNew) { baseAssignValue(object, key, newValue); } else { assignValue(object, key, newValue); } } return object; } /** * Copies own symbols of `source` to `object`. * * @private * @param {Object} source The object to copy symbols from. * @param {Object} [object={}] The object to copy symbols to. * @returns {Object} Returns `object`. */ function copySymbols(source, object) { return copyObject(source, getSymbols(source), object); } /** * Copies own and inherited symbols of `source` to `object`. * * @private * @param {Object} source The object to copy symbols from. * @param {Object} [object={}] The object to copy symbols to. * @returns {Object} Returns `object`. */ function copySymbolsIn(source, object) { return copyObject(source, getSymbolsIn(source), object); } /** * Creates a function like `_.groupBy`. * * @private * @param {Function} setter The function to set accumulator values. * @param {Function} [initializer] The accumulator object initializer. * @returns {Function} Returns the new aggregator function. */ function createAggregator(setter, initializer) { return function(collection, iteratee) { var func = isArray(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {}; return func(collection, setter, getIteratee(iteratee, 2), accumulator); }; } /** * Creates a function like `_.assign`. * * @private * @param {Function} assigner The function to assign values. * @returns {Function} Returns the new assigner function. */ function createAssigner(assigner) { return baseRest(function(object, sources) { var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined, guard = length > 2 ? sources[2] : undefined; customizer = (assigner.length > 3 && typeof customizer == 'function') ? (length--, customizer) : undefined; if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; length = 1; } object = Object(object); while (++index < length) { var source = sources[index]; if (source) { assigner(object, source, index, customizer); } } return object; }); } /** * Creates a `baseEach` or `baseEachRight` function. * * @private * @param {Function} eachFunc The function to iterate over a collection. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new base function. */ function createBaseEach(eachFunc, fromRight) { return function(collection, iteratee) { if (collection == null) { return collection; } if (!isArrayLike(collection)) { return eachFunc(collection, iteratee); } var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection); while ((fromRight ? index-- : ++index < length)) { if (iteratee(iterable[index], index, iterable) === false) { break; } } return collection; }; } /** * Creates a base function for methods like `_.forIn` and `_.forOwn`. * * @private * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new base function. */ function createBaseFor(fromRight) { return function(object, iteratee, keysFunc) { var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length; while (length--) { var key = props[fromRight ? length : ++index]; if (iteratee(iterable[key], key, iterable) === false) { break; } } return object; }; } /** * Creates a function that wraps `func` to invoke it with the optional `this` * binding of `thisArg`. * * @private * @param {Function} func The function to wrap. * @param {number} bitmask The bitmask flags. See `createWrap` for more details. * @param {*} [thisArg] The `this` binding of `func`. * @returns {Function} Returns the new wrapped function. */ function createBind(func, bitmask, thisArg) { var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func); function wrapper() { var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; return fn.apply(isBind ? thisArg : this, arguments); } return wrapper; } /** * Creates a function like `_.lowerFirst`. * * @private * @param {string} methodName The name of the `String` case method to use. * @returns {Function} Returns the new case function. */ function createCaseFirst(methodName) { return function(string) { string = toString(string); var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined; var chr = strSymbols ? strSymbols[0] : string.charAt(0); var trailing = strSymbols ? castSlice(strSymbols, 1).join('') : string.slice(1); return chr[methodName]() + trailing; }; } /** * Creates a function like `_.camelCase`. * * @private * @param {Function} callback The function to combine each word. * @returns {Function} Returns the new compounder function. */ function createCompounder(callback) { return function(string) { return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); }; } /** * Creates a function that produces an instance of `Ctor` regardless of * whether it was invoked as part of a `new` expression or by `call` or `apply`. * * @private * @param {Function} Ctor The constructor to wrap. * @returns {Function} Returns the new wrapped function. */ function createCtor(Ctor) { return function() { // Use a `switch` statement to work with class constructors. See // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist // for more details. var args = arguments; switch (args.length) { case 0: return new Ctor; case 1: return new Ctor(args[0]); case 2: return new Ctor(args[0], args[1]); case 3: return new Ctor(args[0], args[1], args[2]); case 4: return new Ctor(args[0], args[1], args[2], args[3]); case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); } var thisBinding = baseCreate(Ctor.prototype), result = Ctor.apply(thisBinding, args); // Mimic the constructor's `return` behavior. // See https://es5.github.io/#x13.2.2 for more details. return isObject(result) ? result : thisBinding; }; } /** * Creates a function that wraps `func` to enable currying. * * @private * @param {Function} func The function to wrap. * @param {number} bitmask The bitmask flags. See `createWrap` for more details. * @param {number} arity The arity of `func`. * @returns {Function} Returns the new wrapped function. */ function createCurry(func, bitmask, arity) { var Ctor = createCtor(func); function wrapper() { var length = arguments.length, args = Array(length), index = length, placeholder = getHolder(wrapper); while (index--) { args[index] = arguments[index]; } var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) ? [] : replaceHolders(args, placeholder); length -= holders.length; if (length < arity) { return createRecurry( func, bitmask, createHybrid, wrapper.placeholder, undefined, args, holders, undefined, undefined, arity - length); } var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; return apply(fn, this, args); } return wrapper; } /** * Creates a `_.find` or `_.findLast` function. * * @private * @param {Function} findIndexFunc The function to find the collection index. * @returns {Function} Returns the new find function. */ function createFind(findIndexFunc) { return function(collection, predicate, fromIndex) { var iterable = Object(collection); if (!isArrayLike(collection)) { var iteratee = getIteratee(predicate, 3); collection = keys(collection); predicate = function(key) { return iteratee(iterable[key], key, iterable); }; } var index = findIndexFunc(collection, predicate, fromIndex); return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; }; } /** * Creates a `_.flow` or `_.flowRight` function. * * @private * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new flow function. */ function createFlow(fromRight) { return flatRest(function(funcs) { var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru; if (fromRight) { funcs.reverse(); } while (index--) { var func = funcs[index]; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } if (prereq && !wrapper && getFuncName(func) == 'wrapper') { var wrapper = new LodashWrapper([], true); } } index = wrapper ? index : length; while (++index < length) { func = funcs[index]; var funcName = getFuncName(func), data = funcName == 'wrapper' ? getData(func) : undefined; if (data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data[4].length && data[9] == 1 ) { wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); } else { wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func); } } return function() { var args = arguments, value = args[0]; if (wrapper && args.length == 1 && isArray(value)) { return wrapper.plant(value).value(); } var index = 0, result = length ? funcs[index].apply(this, args) : value; while (++index < length) { result = funcs[index].call(this, result); } return result; }; }); } /** * Creates a function that wraps `func` to invoke it with optional `this` * binding of `thisArg`, partial application, and currying. * * @private * @param {Function|string} func The function or method name to wrap. * @param {number} bitmask The bitmask flags. See `createWrap` for more details. * @param {*} [thisArg] The `this` binding of `func`. * @param {Array} [partials] The arguments to prepend to those provided to * the new function. * @param {Array} [holders] The `partials` placeholder indexes. * @param {Array} [partialsRight] The arguments to append to those provided * to the new function. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. * @param {Array} [argPos] The argument positions of the new function. * @param {number} [ary] The arity cap of `func`. * @param {number} [arity] The arity of `func`. * @returns {Function} Returns the new wrapped function. */ function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { var isAry = bitmask & WRAP_ARY_FLAG, isBind = bitmask & WRAP_BIND_FLAG, isBindKey = bitmask & WRAP_BIND_KEY_FLAG, isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), isFlip = bitmask & WRAP_FLIP_FLAG, Ctor = isBindKey ? undefined : createCtor(func); function wrapper() { var length = arguments.length, args = Array(length), index = length; while (index--) { args[index] = arguments[index]; } if (isCurried) { var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder); } if (partials) { args = composeArgs(args, partials, holders, isCurried); } if (partialsRight) { args = composeArgsRight(args, partialsRight, holdersRight, isCurried); } length -= holdersCount; if (isCurried && length < arity) { var newHolders = replaceHolders(args, placeholder); return createRecurry( func, bitmask, createHybrid, wrapper.placeholder, thisArg, args, newHolders, argPos, ary, arity - length ); } var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func; length = args.length; if (argPos) { args = reorder(args, argPos); } else if (isFlip && length > 1) { args.reverse(); } if (isAry && ary < length) { args.length = ary; } if (this && this !== root && this instanceof wrapper) { fn = Ctor || createCtor(fn); } return fn.apply(thisBinding, args); } return wrapper; } /** * Creates a function like `_.invertBy`. * * @private * @param {Function} setter The function to set accumulator values. * @param {Function} toIteratee The function to resolve iteratees. * @returns {Function} Returns the new inverter function. */ function createInverter(setter, toIteratee) { return function(object, iteratee) { return baseInverter(object, setter, toIteratee(iteratee), {}); }; } /** * Creates a function that performs a mathematical operation on two values. * * @private * @param {Function} operator The function to perform the operation. * @param {number} [defaultValue] The value used for `undefined` arguments. * @returns {Function} Returns the new mathematical operation function. */ function createMathOperation(operator, defaultValue) { return function(value, other) { var result; if (value === undefined && other === undefined) { return defaultValue; } if (value !== undefined) { result = value; } if (other !== undefined) { if (result === undefined) { return other; } if (typeof value == 'string' || typeof other == 'string') { value = baseToString(value); other = baseToString(other); } else { value = baseToNumber(value); other = baseToNumber(other); } result = operator(value, other); } return result; }; } /** * Creates a function like `_.over`. * * @private * @param {Function} arrayFunc The function to iterate over iteratees. * @returns {Function} Returns the new over function. */ function createOver(arrayFunc) { return flatRest(function(iteratees) { iteratees = arrayMap(iteratees, baseUnary(getIteratee())); return baseRest(function(args) { var thisArg = this; return arrayFunc(iteratees, function(iteratee) { return apply(iteratee, thisArg, args); }); }); }); } /** * Creates the padding for `string` based on `length`. The `chars` string * is truncated if the number of characters exceeds `length`. * * @private * @param {number} length The padding length. * @param {string} [chars=' '] The string used as padding. * @returns {string} Returns the padding for `string`. */ function createPadding(length, chars) { chars = chars === undefined ? ' ' : baseToString(chars); var charsLength = chars.length; if (charsLength < 2) { return charsLength ? baseRepeat(chars, length) : chars; } var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); return hasUnicode(chars) ? castSlice(stringToArray(result), 0, length).join('') : result.slice(0, length); } /** * Creates a function that wraps `func` to invoke it with the `this` binding * of `thisArg` and `partials` prepended to the arguments it receives. * * @private * @param {Function} func The function to wrap. * @param {number} bitmask The bitmask flags. See `createWrap` for more details. * @param {*} thisArg The `this` binding of `func`. * @param {Array} partials The arguments to prepend to those provided to * the new function. * @returns {Function} Returns the new wrapped function. */ function createPartial(func, bitmask, thisArg, partials) { var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func); function wrapper() { var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array(leftLength + argsLength), fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; while (++leftIndex < leftLength) { args[leftIndex] = partials[leftIndex]; } while (argsLength--) { args[leftIndex++] = arguments[++argsIndex]; } return apply(fn, isBind ? thisArg : this, args); } return wrapper; } /** * Creates a `_.range` or `_.rangeRight` function. * * @private * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new range function. */ function createRange(fromRight) { return function(start, end, step) { if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { end = step = undefined; } // Ensure the sign of `-0` is preserved. start = toFinite(start); if (end === undefined) { end = start; start = 0; } else { end = toFinite(end); } step = step === undefined ? (start < end ? 1 : -1) : toFinite(step); return baseRange(start, end, step, fromRight); }; } /** * Creates a function that performs a relational operation on two values. * * @private * @param {Function} operator The function to perform the operation. * @returns {Function} Returns the new relational operation function. */ function createRelationalOperation(operator) { return function(value, other) { if (!(typeof value == 'string' && typeof other == 'string')) { value = toNumber(value); other = toNumber(other); } return operator(value, other); }; } /** * Creates a function that wraps `func` to continue currying. * * @private * @param {Function} func The function to wrap. * @param {number} bitmask The bitmask flags. See `createWrap` for more details. * @param {Function} wrapFunc The function to create the `func` wrapper. * @param {*} placeholder The placeholder value. * @param {*} [thisArg] The `this` binding of `func`. * @param {Array} [partials] The arguments to prepend to those provided to * the new function. * @param {Array} [holders] The `partials` placeholder indexes. * @param {Array} [argPos] The argument positions of the new function. * @param {number} [ary] The arity cap of `func`. * @param {number} [arity] The arity of `func`. * @returns {Function} Returns the new wrapped function. */ function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined, newHoldersRight = isCurry ? undefined : holders, newPartials = isCurry ? partials : undefined, newPartialsRight = isCurry ? undefined : partials; bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG); bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); } var newData = [ func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, newHoldersRight, argPos, ary, arity ]; var result = wrapFunc.apply(undefined, newData); if (isLaziable(func)) { setData(result, newData); } result.placeholder = placeholder; return setWrapToString(result, func, bitmask); } /** * Creates a function like `_.round`. * * @private * @param {string} methodName The name of the `Math` method to use when rounding. * @returns {Function} Returns the new round function. */ function createRound(methodName) { var func = Math[methodName]; return function(number, precision) { number = toNumber(number); precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); if (precision && nativeIsFinite(number)) { // Shift with exponential notation to avoid floating-point issues. // See [MDN](https://mdn.io/round#Examples) for more details. var pair = (toString(number) + 'e').split('e'), value = func(pair[0] + 'e' + (+pair[1] + precision)); pair = (toString(value) + 'e').split('e'); return +(pair[0] + 'e' + (+pair[1] - precision)); } return func(number); }; } /** * Creates a set object of `values`. * * @private * @param {Array} values The values to add to the set. * @returns {Object} Returns the new set. */ var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { return new Set(values); }; /** * Creates a `_.toPairs` or `_.toPairsIn` function. * * @private * @param {Function} keysFunc The function to get the keys of a given object. * @returns {Function} Returns the new pairs function. */ function createToPairs(keysFunc) { return function(object) { var tag = getTag(object); if (tag == mapTag) { return mapToArray(object); } if (tag == setTag) { return setToPairs(object); } return baseToPairs(object, keysFunc(object)); }; } /** * Creates a function that either curries or invokes `func` with optional * `this` binding and partially applied arguments. * * @private * @param {Function|string} func The function or method name to wrap. * @param {number} bitmask The bitmask flags. * 1 - `_.bind` * 2 - `_.bindKey` * 4 - `_.curry` or `_.curryRight` of a bound function * 8 - `_.curry` * 16 - `_.curryRight` * 32 - `_.partial` * 64 - `_.partialRight` * 128 - `_.rearg` * 256 - `_.ary` * 512 - `_.flip` * @param {*} [thisArg] The `this` binding of `func`. * @param {Array} [partials] The arguments to be partially applied. * @param {Array} [holders] The `partials` placeholder indexes. * @param {Array} [argPos] The argument positions of the new function. * @param {number} [ary] The arity cap of `func`. * @param {number} [arity] The arity of `func`. * @returns {Function} Returns the new wrapped function. */ function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; if (!isBindKey && typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } var length = partials ? partials.length : 0; if (!length) { bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); partials = holders = undefined; } ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); arity = arity === undefined ? arity : toInteger(arity); length -= holders ? holders.length : 0; if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { var partialsRight = partials, holdersRight = holders; partials = holders = undefined; } var data = isBindKey ? undefined : getData(func); var newData = [ func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity ]; if (data) { mergeData(newData, data); } func = newData[0]; bitmask = newData[1]; thisArg = newData[2]; partials = newData[3]; holders = newData[4]; arity = newData[9] = newData[9] === undefined ? (isBindKey ? 0 : func.length) : nativeMax(newData[9] - length, 0); if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); } if (!bitmask || bitmask == WRAP_BIND_FLAG) { var result = createBind(func, bitmask, thisArg); } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { result = createCurry(func, bitmask, arity); } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { result = createPartial(func, bitmask, thisArg, partials); } else { result = createHybrid.apply(undefined, newData); } var setter = data ? baseSetData : setData; return setWrapToString(setter(result, newData), func, bitmask); } /** * Used by `_.defaults` to customize its `_.assignIn` use to assign properties * of source objects to the destination object for all destination properties * that resolve to `undefined`. * * @private * @param {*} objValue The destination value. * @param {*} srcValue The source value. * @param {string} key The key of the property to assign. * @param {Object} object The parent object of `objValue`. * @returns {*} Returns the value to assign. */ function customDefaultsAssignIn(objValue, srcValue, key, object) { if (objValue === undefined || (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { return srcValue; } return objValue; } /** * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source * objects into destination objects that are passed thru. * * @private * @param {*} objValue The destination value. * @param {*} srcValue The source value. * @param {string} key The key of the property to merge. * @param {Object} object The parent object of `objValue`. * @param {Object} source The parent object of `srcValue`. * @param {Object} [stack] Tracks traversed source values and their merged * counterparts. * @returns {*} Returns the value to assign. */ function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { if (isObject(objValue) && isObject(srcValue)) { // Recursively merge objects and arrays (susceptible to call stack limits). stack.set(srcValue, objValue); baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack); stack['delete'](srcValue); } return objValue; } /** * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain * objects. * * @private * @param {*} value The value to inspect. * @param {string} key The key of the property to inspect. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`. */ function customOmitClone(value) { return isPlainObject(value) ? undefined : value; } /** * A specialized version of `baseIsEqualDeep` for arrays with support for * partial deep comparisons. * * @private * @param {Array} array The array to compare. * @param {Array} other The other array to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} stack Tracks traversed `array` and `other` objects. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. */ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length; if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } // Assume cyclic values are equal. var stacked = stack.get(array); if (stacked && stack.get(other)) { return stacked == other; } var index = -1, result = true, seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; stack.set(array, other); stack.set(other, array); // Ignore non-index properties. while (++index < arrLength) { var arrValue = array[index], othValue = other[index]; if (customizer) { var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== undefined) { if (compared) { continue; } result = false; break; } // Recursively compare arrays (susceptible to call stack limits). if (seen) { if (!arraySome(other, function(othValue, othIndex) { if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { return seen.push(othIndex); } })) { result = false; break; } } else if (!( arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack) )) { result = false; break; } } stack['delete'](array); stack['delete'](other); return result; } /** * A specialized version of `baseIsEqualDeep` for comparing objects of * the same `toStringTag`. * * **Note:** This function only supports comparing values with tags of * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {string} tag The `toStringTag` of the objects to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { switch (tag) { case dataViewTag: if ((object.byteLength != other.byteLength) || (object.byteOffset != other.byteOffset)) { return false; } object = object.buffer; other = other.buffer; case arrayBufferTag: if ((object.byteLength != other.byteLength) || !equalFunc(new Uint8Array(object), new Uint8Array(other))) { return false; } return true; case boolTag: case dateTag: case numberTag: // Coerce booleans to `1` or `0` and dates to milliseconds. // Invalid dates are coerced to `NaN`. return eq(+object, +other); case errorTag: return object.name == other.name && object.message == other.message; case regexpTag: case stringTag: // Coerce regexes to strings and treat strings, primitives and objects, // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring // for more details. return object == (other + ''); case mapTag: var convert = mapToArray; case setTag: var isPartial = bitmask & COMPARE_PARTIAL_FLAG; convert || (convert = setToArray); if (object.size != other.size && !isPartial) { return false; } // Assume cyclic values are equal. var stacked = stack.get(object); if (stacked) { return stacked == other; } bitmask |= COMPARE_UNORDERED_FLAG; // Recursively compare objects (susceptible to call stack limits). stack.set(object, other); var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); stack['delete'](object); return result; case symbolTag: if (symbolValueOf) { return symbolValueOf.call(object) == symbolValueOf.call(other); } } return false; } /** * A specialized version of `baseIsEqualDeep` for objects with support for * partial deep comparisons. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length; if (objLength != othLength && !isPartial) { return false; } var index = objLength; while (index--) { var key = objProps[index]; if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { return false; } } // Assume cyclic values are equal. var stacked = stack.get(object); if (stacked && stack.get(other)) { return stacked == other; } var result = true; stack.set(object, other); stack.set(other, object); var skipCtor = isPartial; while (++index < objLength) { key = objProps[index]; var objValue = object[key], othValue = other[key]; if (customizer) { var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); } // Recursively compare objects (susceptible to call stack limits). if (!(compared === undefined ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) : compared )) { result = false; break; } skipCtor || (skipCtor = key == 'constructor'); } if (result && !skipCtor) { var objCtor = object.constructor, othCtor = other.constructor; // Non `Object` object instances with different constructors are not equal. if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) { result = false; } } stack['delete'](object); stack['delete'](other); return result; } /** * A specialized version of `baseRest` which flattens the rest array. * * @private * @param {Function} func The function to apply a rest parameter to. * @returns {Function} Returns the new function. */ function flatRest(func) { return setToString(overRest(func, undefined, flatten), func + ''); } /** * Creates an array of own enumerable property names and symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names and symbols. */ function getAllKeys(object) { return baseGetAllKeys(object, keys, getSymbols); } /** * Creates an array of own and inherited enumerable property names and * symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names and symbols. */ function getAllKeysIn(object) { return baseGetAllKeys(object, keysIn, getSymbolsIn); } /** * Gets metadata for `func`. * * @private * @param {Function} func The function to query. * @returns {*} Returns the metadata for `func`. */ var getData = !metaMap ? noop : function(func) { return metaMap.get(func); }; /** * Gets the name of `func`. * * @private * @param {Function} func The function to query. * @returns {string} Returns the function name. */ function getFuncName(func) { var result = (func.name + ''), array = realNames[result], length = hasOwnProperty.call(realNames, result) ? array.length : 0; while (length--) { var data = array[length], otherFunc = data.func; if (otherFunc == null || otherFunc == func) { return data.name; } } return result; } /** * Gets the argument placeholder value for `func`. * * @private * @param {Function} func The function to inspect. * @returns {*} Returns the placeholder value. */ function getHolder(func) { var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func; return object.placeholder; } /** * Gets the appropriate "iteratee" function. If `_.iteratee` is customized, * this function returns the custom method, otherwise it returns `baseIteratee`. * If arguments are provided, the chosen function is invoked with them and * its result is returned. * * @private * @param {*} [value] The value to convert to an iteratee. * @param {number} [arity] The arity of the created iteratee. * @returns {Function} Returns the chosen function or its result. */ function getIteratee() { var result = lodash.iteratee || iteratee; result = result === iteratee ? baseIteratee : result; return arguments.length ? result(arguments[0], arguments[1]) : result; } /** * Gets the data for `map`. * * @private * @param {Object} map The map to query. * @param {string} key The reference key. * @returns {*} Returns the map data. */ function getMapData(map, key) { var data = map.__data__; return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map; } /** * Gets the property names, values, and compare flags of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the match data of `object`. */ function getMatchData(object) { var result = keys(object), length = result.length; while (length--) { var key = result[length], value = object[key]; result[length] = [key, value, isStrictComparable(value)]; } return result; } /** * Gets the native function at `key` of `object`. * * @private * @param {Object} object The object to query. * @param {string} key The key of the method to get. * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { var value = getValue(object, key); return baseIsNative(value) ? value : undefined; } /** * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. * * @private * @param {*} value The value to query. * @returns {string} Returns the raw `toStringTag`. */ function getRawTag(value) { var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; try { value[symToStringTag] = undefined; var unmasked = true; } catch (e) {} var result = nativeObjectToString.call(value); if (unmasked) { if (isOwn) { value[symToStringTag] = tag; } else { delete value[symToStringTag]; } } return result; } /** * Creates an array of the own enumerable symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ var getSymbols = !nativeGetSymbols ? stubArray : function(object) { if (object == null) { return []; } object = Object(object); return arrayFilter(nativeGetSymbols(object), function(symbol) { return propertyIsEnumerable.call(object, symbol); }); }; /** * Creates an array of the own and inherited enumerable symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { var result = []; while (object) { arrayPush(result, getSymbols(object)); object = getPrototype(object); } return result; }; /** * Gets the `toStringTag` of `value`. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ var getTag = baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || (Map && getTag(new Map) != mapTag) || (Promise && getTag(Promise.resolve()) != promiseTag) || (Set && getTag(new Set) != setTag) || (WeakMap && getTag(new WeakMap) != weakMapTag)) { getTag = function(value) { var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : undefined, ctorString = Ctor ? toSource(Ctor) : ''; if (ctorString) { switch (ctorString) { case dataViewCtorString: return dataViewTag; case mapCtorString: return mapTag; case promiseCtorString: return promiseTag; case setCtorString: return setTag; case weakMapCtorString: return weakMapTag; } } return result; }; } /** * Gets the view, applying any `transforms` to the `start` and `end` positions. * * @private * @param {number} start The start of the view. * @param {number} end The end of the view. * @param {Array} transforms The transformations to apply to the view. * @returns {Object} Returns an object containing the `start` and `end` * positions of the view. */ function getView(start, end, transforms) { var index = -1, length = transforms.length; while (++index < length) { var data = transforms[index], size = data.size; switch (data.type) { case 'drop': start += size; break; case 'dropRight': end -= size; break; case 'take': end = nativeMin(end, start + size); break; case 'takeRight': start = nativeMax(start, end - size); break; } } return { 'start': start, 'end': end }; } /** * Extracts wrapper details from the `source` body comment. * * @private * @param {string} source The source to inspect. * @returns {Array} Returns the wrapper details. */ function getWrapDetails(source) { var match = source.match(reWrapDetails); return match ? match[1].split(reSplitDetails) : []; } /** * Checks if `path` exists on `object`. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @param {Function} hasFunc The function to check properties. * @returns {boolean} Returns `true` if `path` exists, else `false`. */ function hasPath(object, path, hasFunc) { path = castPath(path, object); var index = -1, length = path.length, result = false; while (++index < length) { var key = toKey(path[index]); if (!(result = object != null && hasFunc(object, key))) { break; } object = object[key]; } if (result || ++index != length) { return result; } length = object == null ? 0 : object.length; return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object)); } /** * Initializes an array clone. * * @private * @param {Array} array The array to clone. * @returns {Array} Returns the initialized clone. */ function initCloneArray(array) { var length = array.length, result = new array.constructor(length); // Add properties assigned by `RegExp#exec`. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { result.index = array.index; result.input = array.input; } return result; } /** * Initializes an object clone. * * @private * @param {Object} object The object to clone. * @returns {Object} Returns the initialized clone. */ function initCloneObject(object) { return (typeof object.constructor == 'function' && !isPrototype(object)) ? baseCreate(getPrototype(object)) : {}; } /** * Initializes an object clone based on its `toStringTag`. * * **Note:** This function only supports cloning values with tags of * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`. * * @private * @param {Object} object The object to clone. * @param {string} tag The `toStringTag` of the object to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the initialized clone. */ function initCloneByTag(object, tag, isDeep) { var Ctor = object.constructor; switch (tag) { case arrayBufferTag: return cloneArrayBuffer(object); case boolTag: case dateTag: return new Ctor(+object); case dataViewTag: return cloneDataView(object, isDeep); case float32Tag: case float64Tag: case int8Tag: case int16Tag: case int32Tag: case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: return cloneTypedArray(object, isDeep); case mapTag: return new Ctor; case numberTag: case stringTag: return new Ctor(object); case regexpTag: return cloneRegExp(object); case setTag: return new Ctor; case symbolTag: return cloneSymbol(object); } } /** * Inserts wrapper `details` in a comment at the top of the `source` body. * * @private * @param {string} source The source to modify. * @returns {Array} details The details to insert. * @returns {string} Returns the modified source. */ function insertWrapDetails(source, details) { var length = details.length; if (!length) { return source; } var lastIndex = length - 1; details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; details = details.join(length > 2 ? ', ' : ' '); return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); } /** * Checks if `value` is a flattenable `arguments` object or array. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. */ function isFlattenable(value) { return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]); } /** * Checks if `value` is a valid array-like index. * * @private * @param {*} value The value to check. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { var type = typeof value; length = length == null ? MAX_SAFE_INTEGER : length; return !!length && (type == 'number' || (type != 'symbol' && reIsUint.test(value))) && (value > -1 && value % 1 == 0 && value < length); } /** * Checks if the given arguments are from an iteratee call. * * @private * @param {*} value The potential iteratee value argument. * @param {*} index The potential iteratee index or key argument. * @param {*} object The potential iteratee object argument. * @returns {boolean} Returns `true` if the arguments are from an iteratee call, * else `false`. */ function isIterateeCall(value, index, object) { if (!isObject(object)) { return false; } var type = typeof index; if (type == 'number' ? (isArrayLike(object) && isIndex(index, object.length)) : (type == 'string' && index in object) ) { return eq(object[index], value); } return false; } /** * Checks if `value` is a property name and not a property path. * * @private * @param {*} value The value to check. * @param {Object} [object] The object to query keys on. * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { if (isArray(value)) { return false; } var type = typeof value; if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol(value)) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object)); } /** * Checks if `value` is suitable for use as unique object key. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is suitable, else `false`. */ function isKeyable(value) { var type = typeof value; return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') ? (value !== '__proto__') : (value === null); } /** * Checks if `func` has a lazy counterpart. * * @private * @param {Function} func The function to check. * @returns {boolean} Returns `true` if `func` has a lazy counterpart, * else `false`. */ function isLaziable(func) { var funcName = getFuncName(func), other = lodash[funcName]; if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { return false; } if (func === other) { return true; } var data = getData(other); return !!data && func === data[0]; } /** * Checks if `func` has its source masked. * * @private * @param {Function} func The function to check. * @returns {boolean} Returns `true` if `func` is masked, else `false`. */ function isMasked(func) { return !!maskSrcKey && (maskSrcKey in func); } /** * Checks if `func` is capable of being masked. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `func` is maskable, else `false`. */ var isMaskable = coreJsData ? isFunction : stubFalse; /** * Checks if `value` is likely a prototype object. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. */ function isPrototype(value) { var Ctor = value && value.constructor, proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; return value === proto; } /** * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` if suitable for strict * equality comparisons, else `false`. */ function isStrictComparable(value) { return value === value && !isObject(value); } /** * A specialized version of `matchesProperty` for source values suitable * for strict equality comparisons, i.e. `===`. * * @private * @param {string} key The key of the property to get. * @param {*} srcValue The value to match. * @returns {Function} Returns the new spec function. */ function matchesStrictComparable(key, srcValue) { return function(object) { if (object == null) { return false; } return object[key] === srcValue && (srcValue !== undefined || (key in Object(object))); }; } /** * A specialized version of `_.memoize` which clears the memoized function's * cache when it exceeds `MAX_MEMOIZE_SIZE`. * * @private * @param {Function} func The function to have its output memoized. * @returns {Function} Returns the new memoized function. */ function memoizeCapped(func) { var result = memoize(func, function(key) { if (cache.size === MAX_MEMOIZE_SIZE) { cache.clear(); } return key; }); var cache = result.cache; return result; } /** * Merges the function metadata of `source` into `data`. * * Merging metadata reduces the number of wrappers used to invoke a function. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` * may be applied regardless of execution order. Methods like `_.ary` and * `_.rearg` modify function arguments, making the order in which they are * executed important, preventing the merging of metadata. However, we make * an exception for a safe combined case where curried functions have `_.ary` * and or `_.rearg` applied. * * @private * @param {Array} data The destination metadata. * @param {Array} source The source metadata. * @returns {Array} Returns `data`. */ function mergeData(data, source) { var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); var isCombo = ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); // Exit early if metadata can't be merged. if (!(isCommon || isCombo)) { return data; } // Use source `thisArg` if available. if (srcBitmask & WRAP_BIND_FLAG) { data[2] = source[2]; // Set when currying a bound function. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; } // Compose partial arguments. var value = source[3]; if (value) { var partials = data[3]; data[3] = partials ? composeArgs(partials, value, source[4]) : value; data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; } // Compose partial right arguments. value = source[5]; if (value) { partials = data[5]; data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; } // Use source `argPos` if available. value = source[7]; if (value) { data[7] = value; } // Use source `ary` if it's smaller. if (srcBitmask & WRAP_ARY_FLAG) { data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); } // Use source `arity` if one is not provided. if (data[9] == null) { data[9] = source[9]; } // Use source `func` and merge bitmasks. data[0] = source[0]; data[1] = newBitmask; return data; } /** * This function is like * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * except that it includes inherited enumerable properties. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function nativeKeysIn(object) { var result = []; if (object != null) { for (var key in Object(object)) { result.push(key); } } return result; } /** * Converts `value` to a string using `Object.prototype.toString`. * * @private * @param {*} value The value to convert. * @returns {string} Returns the converted string. */ function objectToString(value) { return nativeObjectToString.call(value); } /** * A specialized version of `baseRest` which transforms the rest array. * * @private * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. * @param {Function} transform The rest array transform. * @returns {Function} Returns the new function. */ function overRest(func, start, transform) { start = nativeMax(start === undefined ? (func.length - 1) : start, 0); return function() { var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length); while (++index < length) { array[index] = args[start + index]; } index = -1; var otherArgs = Array(start + 1); while (++index < start) { otherArgs[index] = args[index]; } otherArgs[start] = transform(array); return apply(func, this, otherArgs); }; } /** * Gets the parent value at `path` of `object`. * * @private * @param {Object} object The object to query. * @param {Array} path The path to get the parent value of. * @returns {*} Returns the parent value. */ function parent(object, path) { return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); } /** * Reorder `array` according to the specified indexes where the element at * the first index is assigned as the first element, the element at * the second index is assigned as the second element, and so on. * * @private * @param {Array} array The array to reorder. * @param {Array} indexes The arranged array indexes. * @returns {Array} Returns `array`. */ function reorder(array, indexes) { var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array); while (length--) { var index = indexes[length]; array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; } return array; } /** * Gets the value at `key`, unless `key` is "__proto__" or "constructor". * * @private * @param {Object} object The object to query. * @param {string} key The key of the property to get. * @returns {*} Returns the property value. */ function safeGet(object, key) { if (key === 'constructor' && typeof object[key] === 'function') { return; } if (key == '__proto__') { return; } return object[key]; } /** * Sets metadata for `func`. * * **Note:** If this function becomes hot, i.e. is invoked a lot in a short * period of time, it will trip its breaker and transition to an identity * function to avoid garbage collection pauses in V8. See * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070) * for more details. * * @private * @param {Function} func The function to associate metadata with. * @param {*} data The metadata. * @returns {Function} Returns `func`. */ var setData = shortOut(baseSetData); /** * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout). * * @private * @param {Function} func The function to delay. * @param {number} wait The number of milliseconds to delay invocation. * @returns {number|Object} Returns the timer id or timeout object. */ var setTimeout = ctxSetTimeout || function(func, wait) { return root.setTimeout(func, wait); }; /** * Sets the `toString` method of `func` to return `string`. * * @private * @param {Function} func The function to modify. * @param {Function} string The `toString` result. * @returns {Function} Returns `func`. */ var setToString = shortOut(baseSetToString); /** * Sets the `toString` method of `wrapper` to mimic the source of `reference` * with wrapper details in a comment at the top of the source body. * * @private * @param {Function} wrapper The function to modify. * @param {Function} reference The reference function. * @param {number} bitmask The bitmask flags. See `createWrap` for more details. * @returns {Function} Returns `wrapper`. */ function setWrapToString(wrapper, reference, bitmask) { var source = (reference + ''); return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); } /** * Creates a function that'll short out and invoke `identity` instead * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` * milliseconds. * * @private * @param {Function} func The function to restrict. * @returns {Function} Returns the new shortable function. */ function shortOut(func) { var count = 0, lastCalled = 0; return function() { var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled); lastCalled = stamp; if (remaining > 0) { if (++count >= HOT_COUNT) { return arguments[0]; } } else { count = 0; } return func.apply(undefined, arguments); }; } /** * A specialized version of `_.shuffle` which mutates and sets the size of `array`. * * @private * @param {Array} array The array to shuffle. * @param {number} [size=array.length] The size of `array`. * @returns {Array} Returns `array`. */ function shuffleSelf(array, size) { var index = -1, length = array.length, lastIndex = length - 1; size = size === undefined ? length : size; while (++index < size) { var rand = baseRandom(index, lastIndex), value = array[rand]; array[rand] = array[index]; array[index] = value; } array.length = size; return array; } /** * Converts `string` to a property path array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the property path array. */ var stringToPath = memoizeCapped(function(string) { var result = []; if (string.charCodeAt(0) === 46 /* . */) { result.push(''); } string.replace(rePropName, function(match, number, quote, subString) { result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); }); return result; }); /** * Converts `value` to a string key if it's not a string or symbol. * * @private * @param {*} value The value to inspect. * @returns {string|symbol} Returns the key. */ function toKey(value) { if (typeof value == 'string' || isSymbol(value)) { return value; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } /** * Converts `func` to its source code. * * @private * @param {Function} func The function to convert. * @returns {string} Returns the source code. */ function toSource(func) { if (func != null) { try { return funcToString.call(func); } catch (e) {} try { return (func + ''); } catch (e) {} } return ''; } /** * Updates wrapper `details` based on `bitmask` flags. * * @private * @returns {Array} details The details to modify. * @param {number} bitmask The bitmask flags. See `createWrap` for more details. * @returns {Array} Returns `details`. */ function updateWrapDetails(details, bitmask) { arrayEach(wrapFlags, function(pair) { var value = '_.' + pair[0]; if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { details.push(value); } }); return details.sort(); } /** * Creates a clone of `wrapper`. * * @private * @param {Object} wrapper The wrapper to clone. * @returns {Object} Returns the cloned wrapper. */ function wrapperClone(wrapper) { if (wrapper instanceof LazyWrapper) { return wrapper.clone(); } var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); result.__actions__ = copyArray(wrapper.__actions__); result.__index__ = wrapper.__index__; result.__values__ = wrapper.__values__; return result; } /*------------------------------------------------------------------------*/ /** * Creates an array of elements split into groups the length of `size`. * If `array` can't be split evenly, the final chunk will be the remaining * elements. * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Array} array The array to process. * @param {number} [size=1] The length of each chunk * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the new array of chunks. * @example * * _.chunk(['a', 'b', 'c', 'd'], 2); * // => [['a', 'b'], ['c', 'd']] * * _.chunk(['a', 'b', 'c', 'd'], 3); * // => [['a', 'b', 'c'], ['d']] */ function chunk(array, size, guard) { if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) { size = 1; } else { size = nativeMax(toInteger(size), 0); } var length = array == null ? 0 : array.length; if (!length || size < 1) { return []; } var index = 0, resIndex = 0, result = Array(nativeCeil(length / size)); while (index < length) { result[resIndex++] = baseSlice(array, index, (index += size)); } return result; } /** * Creates an array with all falsey values removed. The values `false`, `null`, * `0`, `""`, `undefined`, and `NaN` are falsey. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to compact. * @returns {Array} Returns the new array of filtered values. * @example * * _.compact([0, 1, false, 2, '', 3]); * // => [1, 2, 3] */ function compact(array) { var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (value) { result[resIndex++] = value; } } return result; } /** * Creates a new array concatenating `array` with any additional arrays * and/or values. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to concatenate. * @param {...*} [values] The values to concatenate. * @returns {Array} Returns the new concatenated array. * @example * * var array = [1]; * var other = _.concat(array, 2, [3], [[4]]); * * console.log(other); * // => [1, 2, 3, [4]] * * console.log(array); * // => [1] */ function concat() { var length = arguments.length; if (!length) { return []; } var args = Array(length - 1), array = arguments[0], index = length; while (index--) { args[index - 1] = arguments[index]; } return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); } /** * Creates an array of `array` values not included in the other given arrays * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. The order and references of result values are * determined by the first array. * * **Note:** Unlike `_.pullAll`, this method returns a new array. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to inspect. * @param {...Array} [values] The values to exclude. * @returns {Array} Returns the new array of filtered values. * @see _.without, _.xor * @example * * _.difference([2, 1], [2, 3]); * // => [1] */ var difference = baseRest(function(array, values) { return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : []; }); /** * This method is like `_.difference` except that it accepts `iteratee` which * is invoked for each element of `array` and `values` to generate the criterion * by which they're compared. The order and references of result values are * determined by the first array. The iteratee is invoked with one argument: * (value). * * **Note:** Unlike `_.pullAllBy`, this method returns a new array. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @param {...Array} [values] The values to exclude. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns the new array of filtered values. * @example * * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); * // => [1.2] * * // The `_.property` iteratee shorthand. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); * // => [{ 'x': 2 }] */ var differenceBy = baseRest(function(array, values) { var iteratee = last(values); if (isArrayLikeObject(iteratee)) { iteratee = undefined; } return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)) : []; }); /** * This method is like `_.difference` except that it accepts `comparator` * which is invoked to compare elements of `array` to `values`. The order and * references of result values are determined by the first array. The comparator * is invoked with two arguments: (arrVal, othVal). * * **Note:** Unlike `_.pullAllWith`, this method returns a new array. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @param {...Array} [values] The values to exclude. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of filtered values. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; * * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); * // => [{ 'x': 2, 'y': 1 }] */ var differenceWith = baseRest(function(array, values) { var comparator = last(values); if (isArrayLikeObject(comparator)) { comparator = undefined; } return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator) : []; }); /** * Creates a slice of `array` with `n` elements dropped from the beginning. * * @static * @memberOf _ * @since 0.5.0 * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to drop. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * * _.drop([1, 2, 3]); * // => [2, 3] * * _.drop([1, 2, 3], 2); * // => [3] * * _.drop([1, 2, 3], 5); * // => [] * * _.drop([1, 2, 3], 0); * // => [1, 2, 3] */ function drop(array, n, guard) { var length = array == null ? 0 : array.length; if (!length) { return []; } n = (guard || n === undefined) ? 1 : toInteger(n); return baseSlice(array, n < 0 ? 0 : n, length); } /** * Creates a slice of `array` with `n` elements dropped from the end. * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to drop. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * * _.dropRight([1, 2, 3]); * // => [1, 2] * * _.dropRight([1, 2, 3], 2); * // => [1] * * _.dropRight([1, 2, 3], 5); * // => [] * * _.dropRight([1, 2, 3], 0); * // => [1, 2, 3] */ function dropRight(array, n, guard) { var length = array == null ? 0 : array.length; if (!length) { return []; } n = (guard || n === undefined) ? 1 : toInteger(n); n = length - n; return baseSlice(array, 0, n < 0 ? 0 : n); } /** * Creates a slice of `array` excluding elements dropped from the end. * Elements are dropped until `predicate` returns falsey. The predicate is * invoked with three arguments: (value, index, array). * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Array} array The array to query. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the slice of `array`. * @example * * var users = [ * { 'user': 'barney', 'active': true }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': false } * ]; * * _.dropRightWhile(users, function(o) { return !o.active; }); * // => objects for ['barney'] * * // The `_.matches` iteratee shorthand. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); * // => objects for ['barney', 'fred'] * * // The `_.matchesProperty` iteratee shorthand. * _.dropRightWhile(users, ['active', false]); * // => objects for ['barney'] * * // The `_.property` iteratee shorthand. * _.dropRightWhile(users, 'active'); * // => objects for ['barney', 'fred', 'pebbles'] */ function dropRightWhile(array, predicate) { return (array && array.length) ? baseWhile(array, getIteratee(predicate, 3), true, true) : []; } /** * Creates a slice of `array` excluding elements dropped from the beginning. * Elements are dropped until `predicate` returns falsey. The predicate is * invoked with three arguments: (value, index, array). * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Array} array The array to query. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the slice of `array`. * @example * * var users = [ * { 'user': 'barney', 'active': false }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': true } * ]; * * _.dropWhile(users, function(o) { return !o.active; }); * // => objects for ['pebbles'] * * // The `_.matches` iteratee shorthand. * _.dropWhile(users, { 'user': 'barney', 'active': false }); * // => objects for ['fred', 'pebbles'] * * // The `_.matchesProperty` iteratee shorthand. * _.dropWhile(users, ['active', false]); * // => objects for ['pebbles'] * * // The `_.property` iteratee shorthand. * _.dropWhile(users, 'active'); * // => objects for ['barney', 'fred', 'pebbles'] */ function dropWhile(array, predicate) { return (array && array.length) ? baseWhile(array, getIteratee(predicate, 3), true) : []; } /** * Fills elements of `array` with `value` from `start` up to, but not * including, `end`. * * **Note:** This method mutates `array`. * * @static * @memberOf _ * @since 3.2.0 * @category Array * @param {Array} array The array to fill. * @param {*} value The value to fill `array` with. * @param {number} [start=0] The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns `array`. * @example * * var array = [1, 2, 3]; * * _.fill(array, 'a'); * console.log(array); * // => ['a', 'a', 'a'] * * _.fill(Array(3), 2); * // => [2, 2, 2] * * _.fill([4, 6, 8, 10], '*', 1, 3); * // => [4, '*', '*', 10] */ function fill(array, value, start, end) { var length = array == null ? 0 : array.length; if (!length) { return []; } if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { start = 0; end = length; } return baseFill(array, value, start, end); } /** * This method is like `_.find` except that it returns the index of the first * element `predicate` returns truthy for instead of the element itself. * * @static * @memberOf _ * @since 1.1.0 * @category Array * @param {Array} array The array to inspect. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @param {number} [fromIndex=0] The index to search from. * @returns {number} Returns the index of the found element, else `-1`. * @example * * var users = [ * { 'user': 'barney', 'active': false }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': true } * ]; * * _.findIndex(users, function(o) { return o.user == 'barney'; }); * // => 0 * * // The `_.matches` iteratee shorthand. * _.findIndex(users, { 'user': 'fred', 'active': false }); * // => 1 * * // The `_.matchesProperty` iteratee shorthand. * _.findIndex(users, ['active', false]); * // => 0 * * // The `_.property` iteratee shorthand. * _.findIndex(users, 'active'); * // => 2 */ function findIndex(array, predicate, fromIndex) { var length = array == null ? 0 : array.length; if (!length) { return -1; } var index = fromIndex == null ? 0 : toInteger(fromIndex); if (index < 0) { index = nativeMax(length + index, 0); } return baseFindIndex(array, getIteratee(predicate, 3), index); } /** * This method is like `_.findIndex` except that it iterates over elements * of `collection` from right to left. * * @static * @memberOf _ * @since 2.0.0 * @category Array * @param {Array} array The array to inspect. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @param {number} [fromIndex=array.length-1] The index to search from. * @returns {number} Returns the index of the found element, else `-1`. * @example * * var users = [ * { 'user': 'barney', 'active': true }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': false } * ]; * * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); * // => 2 * * // The `_.matches` iteratee shorthand. * _.findLastIndex(users, { 'user': 'barney', 'active': true }); * // => 0 * * // The `_.matchesProperty` iteratee shorthand. * _.findLastIndex(users, ['active', false]); * // => 2 * * // The `_.property` iteratee shorthand. * _.findLastIndex(users, 'active'); * // => 0 */ function findLastIndex(array, predicate, fromIndex) { var length = array == null ? 0 : array.length; if (!length) { return -1; } var index = length - 1; if (fromIndex !== undefined) { index = toInteger(fromIndex); index = fromIndex < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); } return baseFindIndex(array, getIteratee(predicate, 3), index, true); } /** * Flattens `array` a single level deep. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to flatten. * @returns {Array} Returns the new flattened array. * @example * * _.flatten([1, [2, [3, [4]], 5]]); * // => [1, 2, [3, [4]], 5] */ function flatten(array) { var length = array == null ? 0 : array.length; return length ? baseFlatten(array, 1) : []; } /** * Recursively flattens `array`. * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Array} array The array to flatten. * @returns {Array} Returns the new flattened array. * @example * * _.flattenDeep([1, [2, [3, [4]], 5]]); * // => [1, 2, 3, 4, 5] */ function flattenDeep(array) { var length = array == null ? 0 : array.length; return length ? baseFlatten(array, INFINITY) : []; } /** * Recursively flatten `array` up to `depth` times. * * @static * @memberOf _ * @since 4.4.0 * @category Array * @param {Array} array The array to flatten. * @param {number} [depth=1] The maximum recursion depth. * @returns {Array} Returns the new flattened array. * @example * * var array = [1, [2, [3, [4]], 5]]; * * _.flattenDepth(array, 1); * // => [1, 2, [3, [4]], 5] * * _.flattenDepth(array, 2); * // => [1, 2, 3, [4], 5] */ function flattenDepth(array, depth) { var length = array == null ? 0 : array.length; if (!length) { return []; } depth = depth === undefined ? 1 : toInteger(depth); return baseFlatten(array, depth); } /** * The inverse of `_.toPairs`; this method returns an object composed * from key-value `pairs`. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} pairs The key-value pairs. * @returns {Object} Returns the new object. * @example * * _.fromPairs([['a', 1], ['b', 2]]); * // => { 'a': 1, 'b': 2 } */ function fromPairs(pairs) { var index = -1, length = pairs == null ? 0 : pairs.length, result = {}; while (++index < length) { var pair = pairs[index]; result[pair[0]] = pair[1]; } return result; } /** * Gets the first element of `array`. * * @static * @memberOf _ * @since 0.1.0 * @alias first * @category Array * @param {Array} array The array to query. * @returns {*} Returns the first element of `array`. * @example * * _.head([1, 2, 3]); * // => 1 * * _.head([]); * // => undefined */ function head(array) { return (array && array.length) ? array[0] : undefined; } /** * Gets the index at which the first occurrence of `value` is found in `array` * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. If `fromIndex` is negative, it's used as the * offset from the end of `array`. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to inspect. * @param {*} value The value to search for. * @param {number} [fromIndex=0] The index to search from. * @returns {number} Returns the index of the matched value, else `-1`. * @example * * _.indexOf([1, 2, 1, 2], 2); * // => 1 * * // Search from the `fromIndex`. * _.indexOf([1, 2, 1, 2], 2, 2); * // => 3 */ function indexOf(array, value, fromIndex) { var length = array == null ? 0 : array.length; if (!length) { return -1; } var index = fromIndex == null ? 0 : toInteger(fromIndex); if (index < 0) { index = nativeMax(length + index, 0); } return baseIndexOf(array, value, index); } /** * Gets all but the last element of `array`. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to query. * @returns {Array} Returns the slice of `array`. * @example * * _.initial([1, 2, 3]); * // => [1, 2] */ function initial(array) { var length = array == null ? 0 : array.length; return length ? baseSlice(array, 0, -1) : []; } /** * Creates an array of unique values that are included in all given arrays * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. The order and references of result values are * determined by the first array. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @returns {Array} Returns the new array of intersecting values. * @example * * _.intersection([2, 1], [2, 3]); * // => [2] */ var intersection = baseRest(function(arrays) { var mapped = arrayMap(arrays, castArrayLikeObject); return (mapped.length && mapped[0] === arrays[0]) ? baseIntersection(mapped) : []; }); /** * This method is like `_.intersection` except that it accepts `iteratee` * which is invoked for each element of each `arrays` to generate the criterion * by which they're compared. The order and references of result values are * determined by the first array. The iteratee is invoked with one argument: * (value). * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns the new array of intersecting values. * @example * * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); * // => [2.1] * * // The `_.property` iteratee shorthand. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }] */ var intersectionBy = baseRest(function(arrays) { var iteratee = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject); if (iteratee === last(mapped)) { iteratee = undefined; } else { mapped.pop(); } return (mapped.length && mapped[0] === arrays[0]) ? baseIntersection(mapped, getIteratee(iteratee, 2)) : []; }); /** * This method is like `_.intersection` except that it accepts `comparator` * which is invoked to compare elements of `arrays`. The order and references * of result values are determined by the first array. The comparator is * invoked with two arguments: (arrVal, othVal). * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of intersecting values. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; * * _.intersectionWith(objects, others, _.isEqual); * // => [{ 'x': 1, 'y': 2 }] */ var intersectionWith = baseRest(function(arrays) { var comparator = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject); comparator = typeof comparator == 'function' ? comparator : undefined; if (comparator) { mapped.pop(); } return (mapped.length && mapped[0] === arrays[0]) ? baseIntersection(mapped, undefined, comparator) : []; }); /** * Converts all elements in `array` into a string separated by `separator`. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to convert. * @param {string} [separator=','] The element separator. * @returns {string} Returns the joined string. * @example * * _.join(['a', 'b', 'c'], '~'); * // => 'a~b~c' */ function join(array, separator) { return array == null ? '' : nativeJoin.call(array, separator); } /** * Gets the last element of `array`. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to query. * @returns {*} Returns the last element of `array`. * @example * * _.last([1, 2, 3]); * // => 3 */ function last(array) { var length = array == null ? 0 : array.length; return length ? array[length - 1] : undefined; } /** * This method is like `_.indexOf` except that it iterates over elements of * `array` from right to left. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to inspect. * @param {*} value The value to search for. * @param {number} [fromIndex=array.length-1] The index to search from. * @returns {number} Returns the index of the matched value, else `-1`. * @example * * _.lastIndexOf([1, 2, 1, 2], 2); * // => 3 * * // Search from the `fromIndex`. * _.lastIndexOf([1, 2, 1, 2], 2, 2); * // => 1 */ function lastIndexOf(array, value, fromIndex) { var length = array == null ? 0 : array.length; if (!length) { return -1; } var index = length; if (fromIndex !== undefined) { index = toInteger(fromIndex); index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); } return value === value ? strictLastIndexOf(array, value, index) : baseFindIndex(array, baseIsNaN, index, true); } /** * Gets the element at index `n` of `array`. If `n` is negative, the nth * element from the end is returned. * * @static * @memberOf _ * @since 4.11.0 * @category Array * @param {Array} array The array to query. * @param {number} [n=0] The index of the element to return. * @returns {*} Returns the nth element of `array`. * @example * * var array = ['a', 'b', 'c', 'd']; * * _.nth(array, 1); * // => 'b' * * _.nth(array, -2); * // => 'c'; */ function nth(array, n) { return (array && array.length) ? baseNth(array, toInteger(n)) : undefined; } /** * Removes all given values from `array` using * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` * to remove elements from an array by predicate. * * @static * @memberOf _ * @since 2.0.0 * @category Array * @param {Array} array The array to modify. * @param {...*} [values] The values to remove. * @returns {Array} Returns `array`. * @example * * var array = ['a', 'b', 'c', 'a', 'b', 'c']; * * _.pull(array, 'a', 'c'); * console.log(array); * // => ['b', 'b'] */ var pull = baseRest(pullAll); /** * This method is like `_.pull` except that it accepts an array of values to remove. * * **Note:** Unlike `_.difference`, this method mutates `array`. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to modify. * @param {Array} values The values to remove. * @returns {Array} Returns `array`. * @example * * var array = ['a', 'b', 'c', 'a', 'b', 'c']; * * _.pullAll(array, ['a', 'c']); * console.log(array); * // => ['b', 'b'] */ function pullAll(array, values) { return (array && array.length && values && values.length) ? basePullAll(array, values) : array; } /** * This method is like `_.pullAll` except that it accepts `iteratee` which is * invoked for each element of `array` and `values` to generate the criterion * by which they're compared. The iteratee is invoked with one argument: (value). * * **Note:** Unlike `_.differenceBy`, this method mutates `array`. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to modify. * @param {Array} values The values to remove. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns `array`. * @example * * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; * * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); * console.log(array); * // => [{ 'x': 2 }] */ function pullAllBy(array, values, iteratee) { return (array && array.length && values && values.length) ? basePullAll(array, values, getIteratee(iteratee, 2)) : array; } /** * This method is like `_.pullAll` except that it accepts `comparator` which * is invoked to compare elements of `array` to `values`. The comparator is * invoked with two arguments: (arrVal, othVal). * * **Note:** Unlike `_.differenceWith`, this method mutates `array`. * * @static * @memberOf _ * @since 4.6.0 * @category Array * @param {Array} array The array to modify. * @param {Array} values The values to remove. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns `array`. * @example * * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; * * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); * console.log(array); * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] */ function pullAllWith(array, values, comparator) { return (array && array.length && values && values.length) ? basePullAll(array, values, undefined, comparator) : array; } /** * Removes elements from `array` corresponding to `indexes` and returns an * array of removed elements. * * **Note:** Unlike `_.at`, this method mutates `array`. * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Array} array The array to modify. * @param {...(number|number[])} [indexes] The indexes of elements to remove. * @returns {Array} Returns the new array of removed elements. * @example * * var array = ['a', 'b', 'c', 'd']; * var pulled = _.pullAt(array, [1, 3]); * * console.log(array); * // => ['a', 'c'] * * console.log(pulled); * // => ['b', 'd'] */ var pullAt = flatRest(function(array, indexes) { var length = array == null ? 0 : array.length, result = baseAt(array, indexes); basePullAt(array, arrayMap(indexes, function(index) { return isIndex(index, length) ? +index : index; }).sort(compareAscending)); return result; }); /** * Removes all elements from `array` that `predicate` returns truthy for * and returns an array of the removed elements. The predicate is invoked * with three arguments: (value, index, array). * * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` * to pull elements from an array by value. * * @static * @memberOf _ * @since 2.0.0 * @category Array * @param {Array} array The array to modify. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the new array of removed elements. * @example * * var array = [1, 2, 3, 4]; * var evens = _.remove(array, function(n) { * return n % 2 == 0; * }); * * console.log(array); * // => [1, 3] * * console.log(evens); * // => [2, 4] */ function remove(array, predicate) { var result = []; if (!(array && array.length)) { return result; } var index = -1, indexes = [], length = array.length; predicate = getIteratee(predicate, 3); while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result.push(value); indexes.push(index); } } basePullAt(array, indexes); return result; } /** * Reverses `array` so that the first element becomes the last, the second * element becomes the second to last, and so on. * * **Note:** This method mutates `array` and is based on * [`Array#reverse`](https://mdn.io/Array/reverse). * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to modify. * @returns {Array} Returns `array`. * @example * * var array = [1, 2, 3]; * * _.reverse(array); * // => [3, 2, 1] * * console.log(array); * // => [3, 2, 1] */ function reverse(array) { return array == null ? array : nativeReverse.call(array); } /** * Creates a slice of `array` from `start` up to, but not including, `end`. * * **Note:** This method is used instead of * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are * returned. * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Array} array The array to slice. * @param {number} [start=0] The start position. * @param {number} [end=array.length] The end position. * @returns {Array} Returns the slice of `array`. */ function slice(array, start, end) { var length = array == null ? 0 : array.length; if (!length) { return []; } if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { start = 0; end = length; } else { start = start == null ? 0 : toInteger(start); end = end === undefined ? length : toInteger(end); } return baseSlice(array, start, end); } /** * Uses a binary search to determine the lowest index at which `value` * should be inserted into `array` in order to maintain its sort order. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @returns {number} Returns the index at which `value` should be inserted * into `array`. * @example * * _.sortedIndex([30, 50], 40); * // => 1 */ function sortedIndex(array, value) { return baseSortedIndex(array, value); } /** * This method is like `_.sortedIndex` except that it accepts `iteratee` * which is invoked for `value` and each element of `array` to compute their * sort ranking. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {number} Returns the index at which `value` should be inserted * into `array`. * @example * * var objects = [{ 'x': 4 }, { 'x': 5 }]; * * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); * // => 0 * * // The `_.property` iteratee shorthand. * _.sortedIndexBy(objects, { 'x': 4 }, 'x'); * // => 0 */ function sortedIndexBy(array, value, iteratee) { return baseSortedIndexBy(array, value, getIteratee(iteratee, 2)); } /** * This method is like `_.indexOf` except that it performs a binary * search on a sorted `array`. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @param {*} value The value to search for. * @returns {number} Returns the index of the matched value, else `-1`. * @example * * _.sortedIndexOf([4, 5, 5, 5, 6], 5); * // => 1 */ function sortedIndexOf(array, value) { var length = array == null ? 0 : array.length; if (length) { var index = baseSortedIndex(array, value); if (index < length && eq(array[index], value)) { return index; } } return -1; } /** * This method is like `_.sortedIndex` except that it returns the highest * index at which `value` should be inserted into `array` in order to * maintain its sort order. * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @returns {number} Returns the index at which `value` should be inserted * into `array`. * @example * * _.sortedLastIndex([4, 5, 5, 5, 6], 5); * // => 4 */ function sortedLastIndex(array, value) { return baseSortedIndex(array, value, true); } /** * This method is like `_.sortedLastIndex` except that it accepts `iteratee` * which is invoked for `value` and each element of `array` to compute their * sort ranking. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {number} Returns the index at which `value` should be inserted * into `array`. * @example * * var objects = [{ 'x': 4 }, { 'x': 5 }]; * * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); * // => 1 * * // The `_.property` iteratee shorthand. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x'); * // => 1 */ function sortedLastIndexBy(array, value, iteratee) { return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true); } /** * This method is like `_.lastIndexOf` except that it performs a binary * search on a sorted `array`. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @param {*} value The value to search for. * @returns {number} Returns the index of the matched value, else `-1`. * @example * * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5); * // => 3 */ function sortedLastIndexOf(array, value) { var length = array == null ? 0 : array.length; if (length) { var index = baseSortedIndex(array, value, true) - 1; if (eq(array[index], value)) { return index; } } return -1; } /** * This method is like `_.uniq` except that it's designed and optimized * for sorted arrays. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @returns {Array} Returns the new duplicate free array. * @example * * _.sortedUniq([1, 1, 2]); * // => [1, 2] */ function sortedUniq(array) { return (array && array.length) ? baseSortedUniq(array) : []; } /** * This method is like `_.uniqBy` except that it's designed and optimized * for sorted arrays. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @param {Function} [iteratee] The iteratee invoked per element. * @returns {Array} Returns the new duplicate free array. * @example * * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); * // => [1.1, 2.3] */ function sortedUniqBy(array, iteratee) { return (array && array.length) ? baseSortedUniq(array, getIteratee(iteratee, 2)) : []; } /** * Gets all but the first element of `array`. * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to query. * @returns {Array} Returns the slice of `array`. * @example * * _.tail([1, 2, 3]); * // => [2, 3] */ function tail(array) { var length = array == null ? 0 : array.length; return length ? baseSlice(array, 1, length) : []; } /** * Creates a slice of `array` with `n` elements taken from the beginning. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to take. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * * _.take([1, 2, 3]); * // => [1] * * _.take([1, 2, 3], 2); * // => [1, 2] * * _.take([1, 2, 3], 5); * // => [1, 2, 3] * * _.take([1, 2, 3], 0); * // => [] */ function take(array, n, guard) { if (!(array && array.length)) { return []; } n = (guard || n === undefined) ? 1 : toInteger(n); return baseSlice(array, 0, n < 0 ? 0 : n); } /** * Creates a slice of `array` with `n` elements taken from the end. * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Array} array The array to query. * @param {number} [n=1] The number of elements to take. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the slice of `array`. * @example * * _.takeRight([1, 2, 3]); * // => [3] * * _.takeRight([1, 2, 3], 2); * // => [2, 3] * * _.takeRight([1, 2, 3], 5); * // => [1, 2, 3] * * _.takeRight([1, 2, 3], 0); * // => [] */ function takeRight(array, n, guard) { var length = array == null ? 0 : array.length; if (!length) { return []; } n = (guard || n === undefined) ? 1 : toInteger(n); n = length - n; return baseSlice(array, n < 0 ? 0 : n, length); } /** * Creates a slice of `array` with elements taken from the end. Elements are * taken until `predicate` returns falsey. The predicate is invoked with * three arguments: (value, index, array). * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Array} array The array to query. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the slice of `array`. * @example * * var users = [ * { 'user': 'barney', 'active': true }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': false } * ]; * * _.takeRightWhile(users, function(o) { return !o.active; }); * // => objects for ['fred', 'pebbles'] * * // The `_.matches` iteratee shorthand. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }); * // => objects for ['pebbles'] * * // The `_.matchesProperty` iteratee shorthand. * _.takeRightWhile(users, ['active', false]); * // => objects for ['fred', 'pebbles'] * * // The `_.property` iteratee shorthand. * _.takeRightWhile(users, 'active'); * // => [] */ function takeRightWhile(array, predicate) { return (array && array.length) ? baseWhile(array, getIteratee(predicate, 3), false, true) : []; } /** * Creates a slice of `array` with elements taken from the beginning. Elements * are taken until `predicate` returns falsey. The predicate is invoked with * three arguments: (value, index, array). * * @static * @memberOf _ * @since 3.0.0 * @category Array * @param {Array} array The array to query. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the slice of `array`. * @example * * var users = [ * { 'user': 'barney', 'active': false }, * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': true } * ]; * * _.takeWhile(users, function(o) { return !o.active; }); * // => objects for ['barney', 'fred'] * * // The `_.matches` iteratee shorthand. * _.takeWhile(users, { 'user': 'barney', 'active': false }); * // => objects for ['barney'] * * // The `_.matchesProperty` iteratee shorthand. * _.takeWhile(users, ['active', false]); * // => objects for ['barney', 'fred'] * * // The `_.property` iteratee shorthand. * _.takeWhile(users, 'active'); * // => [] */ function takeWhile(array, predicate) { return (array && array.length) ? baseWhile(array, getIteratee(predicate, 3)) : []; } /** * Creates an array of unique values, in order, from all given arrays using * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @returns {Array} Returns the new array of combined values. * @example * * _.union([2], [1, 2]); * // => [2, 1] */ var union = baseRest(function(arrays) { return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); }); /** * This method is like `_.union` except that it accepts `iteratee` which is * invoked for each element of each `arrays` to generate the criterion by * which uniqueness is computed. Result values are chosen from the first * array in which the value occurs. The iteratee is invoked with one argument: * (value). * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns the new array of combined values. * @example * * _.unionBy([2.1], [1.2, 2.3], Math.floor); * // => [2.1, 1.2] * * // The `_.property` iteratee shorthand. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }, { 'x': 2 }] */ var unionBy = baseRest(function(arrays) { var iteratee = last(arrays); if (isArrayLikeObject(iteratee)) { iteratee = undefined; } return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)); }); /** * This method is like `_.union` except that it accepts `comparator` which * is invoked to compare elements of `arrays`. Result values are chosen from * the first array in which the value occurs. The comparator is invoked * with two arguments: (arrVal, othVal). * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of combined values. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; * * _.unionWith(objects, others, _.isEqual); * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] */ var unionWith = baseRest(function(arrays) { var comparator = last(arrays); comparator = typeof comparator == 'function' ? comparator : undefined; return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator); }); /** * Creates a duplicate-free version of an array, using * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons, in which only the first occurrence of each element * is kept. The order of result values is determined by the order they occur * in the array. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to inspect. * @returns {Array} Returns the new duplicate free array. * @example * * _.uniq([2, 1, 2]); * // => [2, 1] */ function uniq(array) { return (array && array.length) ? baseUniq(array) : []; } /** * This method is like `_.uniq` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the criterion by which * uniqueness is computed. The order of result values is determined by the * order they occur in the array. The iteratee is invoked with one argument: * (value). * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns the new duplicate free array. * @example * * _.uniqBy([2.1, 1.2, 2.3], Math.floor); * // => [2.1, 1.2] * * // The `_.property` iteratee shorthand. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }, { 'x': 2 }] */ function uniqBy(array, iteratee) { return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : []; } /** * This method is like `_.uniq` except that it accepts `comparator` which * is invoked to compare elements of `array`. The order of result values is * determined by the order they occur in the array.The comparator is invoked * with two arguments: (arrVal, othVal). * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {Array} array The array to inspect. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new duplicate free array. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; * * _.uniqWith(objects, _.isEqual); * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] */ function uniqWith(array, comparator) { comparator = typeof comparator == 'function' ? comparator : undefined; return (array && array.length) ? baseUniq(array, undefined, comparator) : []; } /** * This method is like `_.zip` except that it accepts an array of grouped * elements and creates an array regrouping the elements to their pre-zip * configuration. * * @static * @memberOf _ * @since 1.2.0 * @category Array * @param {Array} array The array of grouped elements to process. * @returns {Array} Returns the new array of regrouped elements. * @example * * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]); * // => [['a', 1, true], ['b', 2, false]] * * _.unzip(zipped); * // => [['a', 'b'], [1, 2], [true, false]] */ function unzip(array) { if (!(array && array.length)) { return []; } var length = 0; array = arrayFilter(array, function(group) { if (isArrayLikeObject(group)) { length = nativeMax(group.length, length); return true; } }); return baseTimes(length, function(index) { return arrayMap(array, baseProperty(index)); }); } /** * This method is like `_.unzip` except that it accepts `iteratee` to specify * how regrouped values should be combined. The iteratee is invoked with the * elements of each group: (...group). * * @static * @memberOf _ * @since 3.8.0 * @category Array * @param {Array} array The array of grouped elements to process. * @param {Function} [iteratee=_.identity] The function to combine * regrouped values. * @returns {Array} Returns the new array of regrouped elements. * @example * * var zipped = _.zip([1, 2], [10, 20], [100, 200]); * // => [[1, 10, 100], [2, 20, 200]] * * _.unzipWith(zipped, _.add); * // => [3, 30, 300] */ function unzipWith(array, iteratee) { if (!(array && array.length)) { return []; } var result = unzip(array); if (iteratee == null) { return result; } return arrayMap(result, function(group) { return apply(iteratee, undefined, group); }); } /** * Creates an array excluding all given values using * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * **Note:** Unlike `_.pull`, this method returns a new array. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {Array} array The array to inspect. * @param {...*} [values] The values to exclude. * @returns {Array} Returns the new array of filtered values. * @see _.difference, _.xor * @example * * _.without([2, 1, 2, 3], 1, 2); * // => [3] */ var without = baseRest(function(array, values) { return isArrayLikeObject(array) ? baseDifference(array, values) : []; }); /** * Creates an array of unique values that is the * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) * of the given arrays. The order of result values is determined by the order * they occur in the arrays. * * @static * @memberOf _ * @since 2.4.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @returns {Array} Returns the new array of filtered values. * @see _.difference, _.without * @example * * _.xor([2, 1], [2, 3]); * // => [1, 3] */ var xor = baseRest(function(arrays) { return baseXor(arrayFilter(arrays, isArrayLikeObject)); }); /** * This method is like `_.xor` except that it accepts `iteratee` which is * invoked for each element of each `arrays` to generate the criterion by * which by which they're compared. The order of result values is determined * by the order they occur in the arrays. The iteratee is invoked with one * argument: (value). * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {Array} Returns the new array of filtered values. * @example * * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); * // => [1.2, 3.4] * * // The `_.property` iteratee shorthand. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 2 }] */ var xorBy = baseRest(function(arrays) { var iteratee = last(arrays); if (isArrayLikeObject(iteratee)) { iteratee = undefined; } return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2)); }); /** * This method is like `_.xor` except that it accepts `comparator` which is * invoked to compare elements of `arrays`. The order of result values is * determined by the order they occur in the arrays. The comparator is invoked * with two arguments: (arrVal, othVal). * * @static * @memberOf _ * @since 4.0.0 * @category Array * @param {...Array} [arrays] The arrays to inspect. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of filtered values. * @example * * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; * * _.xorWith(objects, others, _.isEqual); * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] */ var xorWith = baseRest(function(arrays) { var comparator = last(arrays); comparator = typeof comparator == 'function' ? comparator : undefined; return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator); }); /** * Creates an array of grouped elements, the first of which contains the * first elements of the given arrays, the second of which contains the * second elements of the given arrays, and so on. * * @static * @memberOf _ * @since 0.1.0 * @category Array * @param {...Array} [arrays] The arrays to process. * @returns {Array} Returns the new array of grouped elements. * @example * * _.zip(['a', 'b'], [1, 2], [true, false]); * // => [['a', 1, true], ['b', 2, false]] */ var zip = baseRest(unzip); /** * This method is like `_.fromPairs` except that it accepts two arrays, * one of property identifiers and one of corresponding values. * * @static * @memberOf _ * @since 0.4.0 * @category Array * @param {Array} [props=[]] The property identifiers. * @param {Array} [values=[]] The property values. * @returns {Object} Returns the new object. * @example * * _.zipObject(['a', 'b'], [1, 2]); * // => { 'a': 1, 'b': 2 } */ function zipObject(props, values) { return baseZipObject(props || [], values || [], assignValue); } /** * This method is like `_.zipObject` except that it supports property paths. * * @static * @memberOf _ * @since 4.1.0 * @category Array * @param {Array} [props=[]] The property identifiers. * @param {Array} [values=[]] The property values. * @returns {Object} Returns the new object. * @example * * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } */ function zipObjectDeep(props, values) { return baseZipObject(props || [], values || [], baseSet); } /** * This method is like `_.zip` except that it accepts `iteratee` to specify * how grouped values should be combined. The iteratee is invoked with the * elements of each group: (...group). * * @static * @memberOf _ * @since 3.8.0 * @category Array * @param {...Array} [arrays] The arrays to process. * @param {Function} [iteratee=_.identity] The function to combine * grouped values. * @returns {Array} Returns the new array of grouped elements. * @example * * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) { * return a + b + c; * }); * // => [111, 222] */ var zipWith = baseRest(function(arrays) { var length = arrays.length, iteratee = length > 1 ? arrays[length - 1] : undefined; iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined; return unzipWith(arrays, iteratee); }); /*------------------------------------------------------------------------*/ /** * Creates a `lodash` wrapper instance that wraps `value` with explicit method * chain sequences enabled. The result of such sequences must be unwrapped * with `_#value`. * * @static * @memberOf _ * @since 1.3.0 * @category Seq * @param {*} value The value to wrap. * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * var users = [ * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 40 }, * { 'user': 'pebbles', 'age': 1 } * ]; * * var youngest = _ * .chain(users) * .sortBy('age') * .map(function(o) { * return o.user + ' is ' + o.age; * }) * .head() * .value(); * // => 'pebbles is 1' */ function chain(value) { var result = lodash(value); result.__chain__ = true; return result; } /** * This method invokes `interceptor` and returns `value`. The interceptor * is invoked with one argument; (value). The purpose of this method is to * "tap into" a method chain sequence in order to modify intermediate results. * * @static * @memberOf _ * @since 0.1.0 * @category Seq * @param {*} value The value to provide to `interceptor`. * @param {Function} interceptor The function to invoke. * @returns {*} Returns `value`. * @example * * _([1, 2, 3]) * .tap(function(array) { * // Mutate input array. * array.pop(); * }) * .reverse() * .value(); * // => [2, 1] */ function tap(value, interceptor) { interceptor(value); return value; } /** * This method is like `_.tap` except that it returns the result of `interceptor`. * The purpose of this method is to "pass thru" values replacing intermediate * results in a method chain sequence. * * @static * @memberOf _ * @since 3.0.0 * @category Seq * @param {*} value The value to provide to `interceptor`. * @param {Function} interceptor The function to invoke. * @returns {*} Returns the result of `interceptor`. * @example * * _(' abc ') * .chain() * .trim() * .thru(function(value) { * return [value]; * }) * .value(); * // => ['abc'] */ function thru(value, interceptor) { return interceptor(value); } /** * This method is the wrapper version of `_.at`. * * @name at * @memberOf _ * @since 1.0.0 * @category Seq * @param {...(string|string[])} [paths] The property paths to pick. * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; * * _(object).at(['a[0].b.c', 'a[1]']).value(); * // => [3, 4] */ var wrapperAt = flatRest(function(paths) { var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) { return baseAt(object, paths); }; if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) { return this.thru(interceptor); } value = value.slice(start, +start + (length ? 1 : 0)); value.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined }); return new LodashWrapper(value, this.__chain__).thru(function(array) { if (length && !array.length) { array.push(undefined); } return array; }); }); /** * Creates a `lodash` wrapper instance with explicit method chain sequences enabled. * * @name chain * @memberOf _ * @since 0.1.0 * @category Seq * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * var users = [ * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 40 } * ]; * * // A sequence without explicit chaining. * _(users).head(); * // => { 'user': 'barney', 'age': 36 } * * // A sequence with explicit chaining. * _(users) * .chain() * .head() * .pick('user') * .value(); * // => { 'user': 'barney' } */ function wrapperChain() { return chain(this); } /** * Executes the chain sequence and returns the wrapped result. * * @name commit * @memberOf _ * @since 3.2.0 * @category Seq * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * var array = [1, 2]; * var wrapped = _(array).push(3); * * console.log(array); * // => [1, 2] * * wrapped = wrapped.commit(); * console.log(array); * // => [1, 2, 3] * * wrapped.last(); * // => 3 * * console.log(array); * // => [1, 2, 3] */ function wrapperCommit() { return new LodashWrapper(this.value(), this.__chain__); } /** * Gets the next value on a wrapped object following the * [iterator protocol](https://mdn.io/iteration_protocols#iterator). * * @name next * @memberOf _ * @since 4.0.0 * @category Seq * @returns {Object} Returns the next iterator value. * @example * * var wrapped = _([1, 2]); * * wrapped.next(); * // => { 'done': false, 'value': 1 } * * wrapped.next(); * // => { 'done': false, 'value': 2 } * * wrapped.next(); * // => { 'done': true, 'value': undefined } */ function wrapperNext() { if (this.__values__ === undefined) { this.__values__ = toArray(this.value()); } var done = this.__index__ >= this.__values__.length, value = done ? undefined : this.__values__[this.__index__++]; return { 'done': done, 'value': value }; } /** * Enables the wrapper to be iterable. * * @name Symbol.iterator * @memberOf _ * @since 4.0.0 * @category Seq * @returns {Object} Returns the wrapper object. * @example * * var wrapped = _([1, 2]); * * wrapped[Symbol.iterator]() === wrapped; * // => true * * Array.from(wrapped); * // => [1, 2] */ function wrapperToIterator() { return this; } /** * Creates a clone of the chain sequence planting `value` as the wrapped value. * * @name plant * @memberOf _ * @since 3.2.0 * @category Seq * @param {*} value The value to plant. * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * function square(n) { * return n * n; * } * * var wrapped = _([1, 2]).map(square); * var other = wrapped.plant([3, 4]); * * other.value(); * // => [9, 16] * * wrapped.value(); * // => [1, 4] */ function wrapperPlant(value) { var result, parent = this; while (parent instanceof baseLodash) { var clone = wrapperClone(parent); clone.__index__ = 0; clone.__values__ = undefined; if (result) { previous.__wrapped__ = clone; } else { result = clone; } var previous = clone; parent = parent.__wrapped__; } previous.__wrapped__ = value; return result; } /** * This method is the wrapper version of `_.reverse`. * * **Note:** This method mutates the wrapped array. * * @name reverse * @memberOf _ * @since 0.1.0 * @category Seq * @returns {Object} Returns the new `lodash` wrapper instance. * @example * * var array = [1, 2, 3]; * * _(array).reverse().value() * // => [3, 2, 1] * * console.log(array); * // => [3, 2, 1] */ function wrapperReverse() { var value = this.__wrapped__; if (value instanceof LazyWrapper) { var wrapped = value; if (this.__actions__.length) { wrapped = new LazyWrapper(this); } wrapped = wrapped.reverse(); wrapped.__actions__.push({ 'func': thru, 'args': [reverse], 'thisArg': undefined }); return new LodashWrapper(wrapped, this.__chain__); } return this.thru(reverse); } /** * Executes the chain sequence to resolve the unwrapped value. * * @name value * @memberOf _ * @since 0.1.0 * @alias toJSON, valueOf * @category Seq * @returns {*} Returns the resolved unwrapped value. * @example * * _([1, 2, 3]).value(); * // => [1, 2, 3] */ function wrapperValue() { return baseWrapperValue(this.__wrapped__, this.__actions__); } /*------------------------------------------------------------------------*/ /** * Creates an object composed of keys generated from the results of running * each element of `collection` thru `iteratee`. The corresponding value of * each key is the number of times the key was returned by `iteratee`. The * iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @since 0.5.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The iteratee to transform keys. * @returns {Object} Returns the composed aggregate object. * @example * * _.countBy([6.1, 4.2, 6.3], Math.floor); * // => { '4': 1, '6': 2 } * * // The `_.property` iteratee shorthand. * _.countBy(['one', 'two', 'three'], 'length'); * // => { '3': 2, '5': 1 } */ var countBy = createAggregator(function(result, value, key) { if (hasOwnProperty.call(result, key)) { ++result[key]; } else { baseAssignValue(result, key, 1); } }); /** * Checks if `predicate` returns truthy for **all** elements of `collection`. * Iteration is stopped once `predicate` returns falsey. The predicate is * invoked with three arguments: (value, index|key, collection). * * **Note:** This method returns `true` for * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of * elements of empty collections. * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {boolean} Returns `true` if all elements pass the predicate check, * else `false`. * @example * * _.every([true, 1, null, 'yes'], Boolean); * // => false * * var users = [ * { 'user': 'barney', 'age': 36, 'active': false }, * { 'user': 'fred', 'age': 40, 'active': false } * ]; * * // The `_.matches` iteratee shorthand. * _.every(users, { 'user': 'barney', 'active': false }); * // => false * * // The `_.matchesProperty` iteratee shorthand. * _.every(users, ['active', false]); * // => true * * // The `_.property` iteratee shorthand. * _.every(users, 'active'); * // => false */ function every(collection, predicate, guard) { var func = isArray(collection) ? arrayEvery : baseEvery; if (guard && isIterateeCall(collection, predicate, guard)) { predicate = undefined; } return func(collection, getIteratee(predicate, 3)); } /** * Iterates over elements of `collection`, returning an array of all elements * `predicate` returns truthy for. The predicate is invoked with three * arguments: (value, index|key, collection). * * **Note:** Unlike `_.remove`, this method returns a new array. * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the new filtered array. * @see _.reject * @example * * var users = [ * { 'user': 'barney', 'age': 36, 'active': true }, * { 'user': 'fred', 'age': 40, 'active': false } * ]; * * _.filter(users, function(o) { return !o.active; }); * // => objects for ['fred'] * * // The `_.matches` iteratee shorthand. * _.filter(users, { 'age': 36, 'active': true }); * // => objects for ['barney'] * * // The `_.matchesProperty` iteratee shorthand. * _.filter(users, ['active', false]); * // => objects for ['fred'] * * // The `_.property` iteratee shorthand. * _.filter(users, 'active'); * // => objects for ['barney'] */ function filter(collection, predicate) { var func = isArray(collection) ? arrayFilter : baseFilter; return func(collection, getIteratee(predicate, 3)); } /** * Iterates over elements of `collection`, returning the first element * `predicate` returns truthy for. The predicate is invoked with three * arguments: (value, index|key, collection). * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to inspect. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @param {number} [fromIndex=0] The index to search from. * @returns {*} Returns the matched element, else `undefined`. * @example * * var users = [ * { 'user': 'barney', 'age': 36, 'active': true }, * { 'user': 'fred', 'age': 40, 'active': false }, * { 'user': 'pebbles', 'age': 1, 'active': true } * ]; * * _.find(users, function(o) { return o.age < 40; }); * // => object for 'barney' * * // The `_.matches` iteratee shorthand. * _.find(users, { 'age': 1, 'active': true }); * // => object for 'pebbles' * * // The `_.matchesProperty` iteratee shorthand. * _.find(users, ['active', false]); * // => object for 'fred' * * // The `_.property` iteratee shorthand. * _.find(users, 'active'); * // => object for 'barney' */ var find = createFind(findIndex); /** * This method is like `_.find` except that it iterates over elements of * `collection` from right to left. * * @static * @memberOf _ * @since 2.0.0 * @category Collection * @param {Array|Object} collection The collection to inspect. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @param {number} [fromIndex=collection.length-1] The index to search from. * @returns {*} Returns the matched element, else `undefined`. * @example * * _.findLast([1, 2, 3, 4], function(n) { * return n % 2 == 1; * }); * // => 3 */ var findLast = createFind(findLastIndex); /** * Creates a flattened array of values by running each element in `collection` * thru `iteratee` and flattening the mapped results. The iteratee is invoked * with three arguments: (value, index|key, collection). * * @static * @memberOf _ * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Array} Returns the new flattened array. * @example * * function duplicate(n) { * return [n, n]; * } * * _.flatMap([1, 2], duplicate); * // => [1, 1, 2, 2] */ function flatMap(collection, iteratee) { return baseFlatten(map(collection, iteratee), 1); } /** * This method is like `_.flatMap` except that it recursively flattens the * mapped results. * * @static * @memberOf _ * @since 4.7.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Array} Returns the new flattened array. * @example * * function duplicate(n) { * return [[[n, n]]]; * } * * _.flatMapDeep([1, 2], duplicate); * // => [1, 1, 2, 2] */ function flatMapDeep(collection, iteratee) { return baseFlatten(map(collection, iteratee), INFINITY); } /** * This method is like `_.flatMap` except that it recursively flattens the * mapped results up to `depth` times. * * @static * @memberOf _ * @since 4.7.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {number} [depth=1] The maximum recursion depth. * @returns {Array} Returns the new flattened array. * @example * * function duplicate(n) { * return [[[n, n]]]; * } * * _.flatMapDepth([1, 2], duplicate, 2); * // => [[1, 1], [2, 2]] */ function flatMapDepth(collection, iteratee, depth) { depth = depth === undefined ? 1 : toInteger(depth); return baseFlatten(map(collection, iteratee), depth); } /** * Iterates over elements of `collection` and invokes `iteratee` for each element. * The iteratee is invoked with three arguments: (value, index|key, collection). * Iteratee functions may exit iteration early by explicitly returning `false`. * * **Note:** As with other "Collections" methods, objects with a "length" * property are iterated like arrays. To avoid this behavior use `_.forIn` * or `_.forOwn` for object iteration. * * @static * @memberOf _ * @since 0.1.0 * @alias each * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Array|Object} Returns `collection`. * @see _.forEachRight * @example * * _.forEach([1, 2], function(value) { * console.log(value); * }); * // => Logs `1` then `2`. * * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { * console.log(key); * }); * // => Logs 'a' then 'b' (iteration order is not guaranteed). */ function forEach(collection, iteratee) { var func = isArray(collection) ? arrayEach : baseEach; return func(collection, getIteratee(iteratee, 3)); } /** * This method is like `_.forEach` except that it iterates over elements of * `collection` from right to left. * * @static * @memberOf _ * @since 2.0.0 * @alias eachRight * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Array|Object} Returns `collection`. * @see _.forEach * @example * * _.forEachRight([1, 2], function(value) { * console.log(value); * }); * // => Logs `2` then `1`. */ function forEachRight(collection, iteratee) { var func = isArray(collection) ? arrayEachRight : baseEachRight; return func(collection, getIteratee(iteratee, 3)); } /** * Creates an object composed of keys generated from the results of running * each element of `collection` thru `iteratee`. The order of grouped values * is determined by the order they occur in `collection`. The corresponding * value of each key is an array of elements responsible for generating the * key. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The iteratee to transform keys. * @returns {Object} Returns the composed aggregate object. * @example * * _.groupBy([6.1, 4.2, 6.3], Math.floor); * // => { '4': [4.2], '6': [6.1, 6.3] } * * // The `_.property` iteratee shorthand. * _.groupBy(['one', 'two', 'three'], 'length'); * // => { '3': ['one', 'two'], '5': ['three'] } */ var groupBy = createAggregator(function(result, value, key) { if (hasOwnProperty.call(result, key)) { result[key].push(value); } else { baseAssignValue(result, key, [value]); } }); /** * Checks if `value` is in `collection`. If `collection` is a string, it's * checked for a substring of `value`, otherwise * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * is used for equality comparisons. If `fromIndex` is negative, it's used as * the offset from the end of `collection`. * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object|string} collection The collection to inspect. * @param {*} value The value to search for. * @param {number} [fromIndex=0] The index to search from. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. * @returns {boolean} Returns `true` if `value` is found, else `false`. * @example * * _.includes([1, 2, 3], 1); * // => true * * _.includes([1, 2, 3], 1, 2); * // => false * * _.includes({ 'a': 1, 'b': 2 }, 1); * // => true * * _.includes('abcd', 'bc'); * // => true */ function includes(collection, value, fromIndex, guard) { collection = isArrayLike(collection) ? collection : values(collection); fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; var length = collection.length; if (fromIndex < 0) { fromIndex = nativeMax(length + fromIndex, 0); } return isString(collection) ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) : (!!length && baseIndexOf(collection, value, fromIndex) > -1); } /** * Invokes the method at `path` of each element in `collection`, returning * an array of the results of each invoked method. Any additional arguments * are provided to each invoked method. If `path` is a function, it's invoked * for, and `this` bound to, each element in `collection`. * * @static * @memberOf _ * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Array|Function|string} path The path of the method to invoke or * the function invoked per iteration. * @param {...*} [args] The arguments to invoke each method with. * @returns {Array} Returns the array of results. * @example * * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); * // => [[1, 5, 7], [1, 2, 3]] * * _.invokeMap([123, 456], String.prototype.split, ''); * // => [['1', '2', '3'], ['4', '5', '6']] */ var invokeMap = baseRest(function(collection, path, args) { var index = -1, isFunc = typeof path == 'function', result = isArrayLike(collection) ? Array(collection.length) : []; baseEach(collection, function(value) { result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); }); return result; }); /** * Creates an object composed of keys generated from the results of running * each element of `collection` thru `iteratee`. The corresponding value of * each key is the last element responsible for generating the key. The * iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The iteratee to transform keys. * @returns {Object} Returns the composed aggregate object. * @example * * var array = [ * { 'dir': 'left', 'code': 97 }, * { 'dir': 'right', 'code': 100 } * ]; * * _.keyBy(array, function(o) { * return String.fromCharCode(o.code); * }); * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } * * _.keyBy(array, 'dir'); * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } */ var keyBy = createAggregator(function(result, value, key) { baseAssignValue(result, key, value); }); /** * Creates an array of values by running each element in `collection` thru * `iteratee`. The iteratee is invoked with three arguments: * (value, index|key, collection). * * Many lodash methods are guarded to work as iteratees for methods like * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. * * The guarded methods are: * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, * `template`, `trim`, `trimEnd`, `trimStart`, and `words` * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Array} Returns the new mapped array. * @example * * function square(n) { * return n * n; * } * * _.map([4, 8], square); * // => [16, 64] * * _.map({ 'a': 4, 'b': 8 }, square); * // => [16, 64] (iteration order is not guaranteed) * * var users = [ * { 'user': 'barney' }, * { 'user': 'fred' } * ]; * * // The `_.property` iteratee shorthand. * _.map(users, 'user'); * // => ['barney', 'fred'] */ function map(collection, iteratee) { var func = isArray(collection) ? arrayMap : baseMap; return func(collection, getIteratee(iteratee, 3)); } /** * This method is like `_.sortBy` except that it allows specifying the sort * orders of the iteratees to sort by. If `orders` is unspecified, all values * are sorted in ascending order. Otherwise, specify an order of "desc" for * descending or "asc" for ascending sort order of corresponding values. * * @static * @memberOf _ * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]] * The iteratees to sort by. * @param {string[]} [orders] The sort orders of `iteratees`. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. * @returns {Array} Returns the new sorted array. * @example * * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 34 }, * { 'user': 'fred', 'age': 40 }, * { 'user': 'barney', 'age': 36 } * ]; * * // Sort by `user` in ascending order and by `age` in descending order. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] */ function orderBy(collection, iteratees, orders, guard) { if (collection == null) { return []; } if (!isArray(iteratees)) { iteratees = iteratees == null ? [] : [iteratees]; } orders = guard ? undefined : orders; if (!isArray(orders)) { orders = orders == null ? [] : [orders]; } return baseOrderBy(collection, iteratees, orders); } /** * Creates an array of elements split into two groups, the first of which * contains elements `predicate` returns truthy for, the second of which * contains elements `predicate` returns falsey for. The predicate is * invoked with one argument: (value). * * @static * @memberOf _ * @since 3.0.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the array of grouped elements. * @example * * var users = [ * { 'user': 'barney', 'age': 36, 'active': false }, * { 'user': 'fred', 'age': 40, 'active': true }, * { 'user': 'pebbles', 'age': 1, 'active': false } * ]; * * _.partition(users, function(o) { return o.active; }); * // => objects for [['fred'], ['barney', 'pebbles']] * * // The `_.matches` iteratee shorthand. * _.partition(users, { 'age': 1, 'active': false }); * // => objects for [['pebbles'], ['barney', 'fred']] * * // The `_.matchesProperty` iteratee shorthand. * _.partition(users, ['active', false]); * // => objects for [['barney', 'pebbles'], ['fred']] * * // The `_.property` iteratee shorthand. * _.partition(users, 'active'); * // => objects for [['fred'], ['barney', 'pebbles']] */ var partition = createAggregator(function(result, value, key) { result[key ? 0 : 1].push(value); }, function() { return [[], []]; }); /** * Reduces `collection` to a value which is the accumulated result of running * each element in `collection` thru `iteratee`, where each successive * invocation is supplied the return value of the previous. If `accumulator` * is not given, the first element of `collection` is used as the initial * value. The iteratee is invoked with four arguments: * (accumulator, value, index|key, collection). * * Many lodash methods are guarded to work as iteratees for methods like * `_.reduce`, `_.reduceRight`, and `_.transform`. * * The guarded methods are: * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, * and `sortBy` * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The initial value. * @returns {*} Returns the accumulated value. * @see _.reduceRight * @example * * _.reduce([1, 2], function(sum, n) { * return sum + n; * }, 0); * // => 3 * * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { * (result[value] || (result[value] = [])).push(key); * return result; * }, {}); * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) */ function reduce(collection, iteratee, accumulator) { var func = isArray(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3; return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach); } /** * This method is like `_.reduce` except that it iterates over elements of * `collection` from right to left. * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The initial value. * @returns {*} Returns the accumulated value. * @see _.reduce * @example * * var array = [[0, 1], [2, 3], [4, 5]]; * * _.reduceRight(array, function(flattened, other) { * return flattened.concat(other); * }, []); * // => [4, 5, 2, 3, 0, 1] */ function reduceRight(collection, iteratee, accumulator) { var func = isArray(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3; return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight); } /** * The opposite of `_.filter`; this method returns the elements of `collection` * that `predicate` does **not** return truthy for. * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @returns {Array} Returns the new filtered array. * @see _.filter * @example * * var users = [ * { 'user': 'barney', 'age': 36, 'active': false }, * { 'user': 'fred', 'age': 40, 'active': true } * ]; * * _.reject(users, function(o) { return !o.active; }); * // => objects for ['fred'] * * // The `_.matches` iteratee shorthand. * _.reject(users, { 'age': 40, 'active': true }); * // => objects for ['barney'] * * // The `_.matchesProperty` iteratee shorthand. * _.reject(users, ['active', false]); * // => objects for ['fred'] * * // The `_.property` iteratee shorthand. * _.reject(users, 'active'); * // => objects for ['barney'] */ function reject(collection, predicate) { var func = isArray(collection) ? arrayFilter : baseFilter; return func(collection, negate(getIteratee(predicate, 3))); } /** * Gets a random element from `collection`. * * @static * @memberOf _ * @since 2.0.0 * @category Collection * @param {Array|Object} collection The collection to sample. * @returns {*} Returns the random element. * @example * * _.sample([1, 2, 3, 4]); * // => 2 */ function sample(collection) { var func = isArray(collection) ? arraySample : baseSample; return func(collection); } /** * Gets `n` random elements at unique keys from `collection` up to the * size of `collection`. * * @static * @memberOf _ * @since 4.0.0 * @category Collection * @param {Array|Object} collection The collection to sample. * @param {number} [n=1] The number of elements to sample. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the random elements. * @example * * _.sampleSize([1, 2, 3], 2); * // => [3, 1] * * _.sampleSize([1, 2, 3], 4); * // => [2, 3, 1] */ function sampleSize(collection, n, guard) { if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) { n = 1; } else { n = toInteger(n); } var func = isArray(collection) ? arraySampleSize : baseSampleSize; return func(collection, n); } /** * Creates an array of shuffled values, using a version of the * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to shuffle. * @returns {Array} Returns the new shuffled array. * @example * * _.shuffle([1, 2, 3, 4]); * // => [4, 1, 3, 2] */ function shuffle(collection) { var func = isArray(collection) ? arrayShuffle : baseShuffle; return func(collection); } /** * Gets the size of `collection` by returning its length for array-like * values or the number of own enumerable string keyed properties for objects. * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object|string} collection The collection to inspect. * @returns {number} Returns the collection size. * @example * * _.size([1, 2, 3]); * // => 3 * * _.size({ 'a': 1, 'b': 2 }); * // => 2 * * _.size('pebbles'); * // => 7 */ function size(collection) { if (collection == null) { return 0; } if (isArrayLike(collection)) { return isString(collection) ? stringSize(collection) : collection.length; } var tag = getTag(collection); if (tag == mapTag || tag == setTag) { return collection.size; } return baseKeys(collection).length; } /** * Checks if `predicate` returns truthy for **any** element of `collection`. * Iteration is stopped once `predicate` returns truthy. The predicate is * invoked with three arguments: (value, index|key, collection). * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {boolean} Returns `true` if any element passes the predicate check, * else `false`. * @example * * _.some([null, 0, 'yes', false], Boolean); * // => true * * var users = [ * { 'user': 'barney', 'active': true }, * { 'user': 'fred', 'active': false } * ]; * * // The `_.matches` iteratee shorthand. * _.some(users, { 'user': 'barney', 'active': false }); * // => false * * // The `_.matchesProperty` iteratee shorthand. * _.some(users, ['active', false]); * // => true * * // The `_.property` iteratee shorthand. * _.some(users, 'active'); * // => true */ function some(collection, predicate, guard) { var func = isArray(collection) ? arraySome : baseSome; if (guard && isIterateeCall(collection, predicate, guard)) { predicate = undefined; } return func(collection, getIteratee(predicate, 3)); } /** * Creates an array of elements, sorted in ascending order by the results of * running each element in a collection thru each iteratee. This method * performs a stable sort, that is, it preserves the original sort order of * equal elements. The iteratees are invoked with one argument: (value). * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object} collection The collection to iterate over. * @param {...(Function|Function[])} [iteratees=[_.identity]] * The iteratees to sort by. * @returns {Array} Returns the new sorted array. * @example * * var users = [ * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 36 }, * { 'user': 'fred', 'age': 40 }, * { 'user': 'barney', 'age': 34 } * ]; * * _.sortBy(users, [function(o) { return o.user; }]); * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] * * _.sortBy(users, ['user', 'age']); * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] */ var sortBy = baseRest(function(collection, iteratees) { if (collection == null) { return []; } var length = iteratees.length; if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { iteratees = []; } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { iteratees = [iteratees[0]]; } return baseOrderBy(collection, baseFlatten(iteratees, 1), []); }); /*------------------------------------------------------------------------*/ /** * Gets the timestamp of the number of milliseconds that have elapsed since * the Unix epoch (1 January 1970 00:00:00 UTC). * * @static * @memberOf _ * @since 2.4.0 * @category Date * @returns {number} Returns the timestamp. * @example * * _.defer(function(stamp) { * console.log(_.now() - stamp); * }, _.now()); * // => Logs the number of milliseconds it took for the deferred invocation. */ var now = ctxNow || function() { return root.Date.now(); }; /*------------------------------------------------------------------------*/ /** * The opposite of `_.before`; this method creates a function that invokes * `func` once it's called `n` or more times. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {number} n The number of calls before `func` is invoked. * @param {Function} func The function to restrict. * @returns {Function} Returns the new restricted function. * @example * * var saves = ['profile', 'settings']; * * var done = _.after(saves.length, function() { * console.log('done saving!'); * }); * * _.forEach(saves, function(type) { * asyncSave({ 'type': type, 'complete': done }); * }); * // => Logs 'done saving!' after the two async saves have completed. */ function after(n, func) { if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } n = toInteger(n); return function() { if (--n < 1) { return func.apply(this, arguments); } }; } /** * Creates a function that invokes `func`, with up to `n` arguments, * ignoring any additional arguments. * * @static * @memberOf _ * @since 3.0.0 * @category Function * @param {Function} func The function to cap arguments for. * @param {number} [n=func.length] The arity cap. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Function} Returns the new capped function. * @example * * _.map(['6', '8', '10'], _.ary(parseInt, 1)); * // => [6, 8, 10] */ function ary(func, n, guard) { n = guard ? undefined : n; n = (func && n == null) ? func.length : n; return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n); } /** * Creates a function that invokes `func`, with the `this` binding and arguments * of the created function, while it's called less than `n` times. Subsequent * calls to the created function return the result of the last `func` invocation. * * @static * @memberOf _ * @since 3.0.0 * @category Function * @param {number} n The number of calls at which `func` is no longer invoked. * @param {Function} func The function to restrict. * @returns {Function} Returns the new restricted function. * @example * * jQuery(element).on('click', _.before(5, addContactToList)); * // => Allows adding up to 4 contacts to the list. */ function before(n, func) { var result; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } n = toInteger(n); return function() { if (--n > 0) { result = func.apply(this, arguments); } if (n <= 1) { func = undefined; } return result; }; } /** * Creates a function that invokes `func` with the `this` binding of `thisArg` * and `partials` prepended to the arguments it receives. * * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, * may be used as a placeholder for partially applied arguments. * * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" * property of bound functions. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to bind. * @param {*} thisArg The `this` binding of `func`. * @param {...*} [partials] The arguments to be partially applied. * @returns {Function} Returns the new bound function. * @example * * function greet(greeting, punctuation) { * return greeting + ' ' + this.user + punctuation; * } * * var object = { 'user': 'fred' }; * * var bound = _.bind(greet, object, 'hi'); * bound('!'); * // => 'hi fred!' * * // Bound with placeholders. * var bound = _.bind(greet, object, _, '!'); * bound('hi'); * // => 'hi fred!' */ var bind = baseRest(function(func, thisArg, partials) { var bitmask = WRAP_BIND_FLAG; if (partials.length) { var holders = replaceHolders(partials, getHolder(bind)); bitmask |= WRAP_PARTIAL_FLAG; } return createWrap(func, bitmask, thisArg, partials, holders); }); /** * Creates a function that invokes the method at `object[key]` with `partials` * prepended to the arguments it receives. * * This method differs from `_.bind` by allowing bound functions to reference * methods that may be redefined or don't yet exist. See * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) * for more details. * * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for partially applied arguments. * * @static * @memberOf _ * @since 0.10.0 * @category Function * @param {Object} object The object to invoke the method on. * @param {string} key The key of the method. * @param {...*} [partials] The arguments to be partially applied. * @returns {Function} Returns the new bound function. * @example * * var object = { * 'user': 'fred', * 'greet': function(greeting, punctuation) { * return greeting + ' ' + this.user + punctuation; * } * }; * * var bound = _.bindKey(object, 'greet', 'hi'); * bound('!'); * // => 'hi fred!' * * object.greet = function(greeting, punctuation) { * return greeting + 'ya ' + this.user + punctuation; * }; * * bound('!'); * // => 'hiya fred!' * * // Bound with placeholders. * var bound = _.bindKey(object, 'greet', _, '!'); * bound('hi'); * // => 'hiya fred!' */ var bindKey = baseRest(function(object, key, partials) { var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; if (partials.length) { var holders = replaceHolders(partials, getHolder(bindKey)); bitmask |= WRAP_PARTIAL_FLAG; } return createWrap(key, bitmask, object, partials, holders); }); /** * Creates a function that accepts arguments of `func` and either invokes * `func` returning its result, if at least `arity` number of arguments have * been provided, or returns a function that accepts the remaining `func` * arguments, and so on. The arity of `func` may be specified if `func.length` * is not sufficient. * * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, * may be used as a placeholder for provided arguments. * * **Note:** This method doesn't set the "length" property of curried functions. * * @static * @memberOf _ * @since 2.0.0 * @category Function * @param {Function} func The function to curry. * @param {number} [arity=func.length] The arity of `func`. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Function} Returns the new curried function. * @example * * var abc = function(a, b, c) { * return [a, b, c]; * }; * * var curried = _.curry(abc); * * curried(1)(2)(3); * // => [1, 2, 3] * * curried(1, 2)(3); * // => [1, 2, 3] * * curried(1, 2, 3); * // => [1, 2, 3] * * // Curried with placeholders. * curried(1)(_, 3)(2); * // => [1, 2, 3] */ function curry(func, arity, guard) { arity = guard ? undefined : arity; var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); result.placeholder = curry.placeholder; return result; } /** * This method is like `_.curry` except that arguments are applied to `func` * in the manner of `_.partialRight` instead of `_.partial`. * * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for provided arguments. * * **Note:** This method doesn't set the "length" property of curried functions. * * @static * @memberOf _ * @since 3.0.0 * @category Function * @param {Function} func The function to curry. * @param {number} [arity=func.length] The arity of `func`. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Function} Returns the new curried function. * @example * * var abc = function(a, b, c) { * return [a, b, c]; * }; * * var curried = _.curryRight(abc); * * curried(3)(2)(1); * // => [1, 2, 3] * * curried(2, 3)(1); * // => [1, 2, 3] * * curried(1, 2, 3); * // => [1, 2, 3] * * // Curried with placeholders. * curried(3)(1, _)(2); * // => [1, 2, 3] */ function curryRight(func, arity, guard) { arity = guard ? undefined : arity; var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); result.placeholder = curryRight.placeholder; return result; } /** * Creates a debounced function that delays invoking `func` until after `wait` * milliseconds have elapsed since the last time the debounced function was * invoked. The debounced function comes with a `cancel` method to cancel * delayed `func` invocations and a `flush` method to immediately invoke them. * Provide `options` to indicate whether `func` should be invoked on the * leading and/or trailing edge of the `wait` timeout. The `func` is invoked * with the last arguments provided to the debounced function. Subsequent * calls to the debounced function return the result of the last `func` * invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is * invoked on the trailing edge of the timeout only if the debounced function * is invoked more than once during the `wait` timeout. * * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred * until to the next tick, similar to `setTimeout` with a timeout of `0`. * * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) * for details over the differences between `_.debounce` and `_.throttle`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to debounce. * @param {number} [wait=0] The number of milliseconds to delay. * @param {Object} [options={}] The options object. * @param {boolean} [options.leading=false] * Specify invoking on the leading edge of the timeout. * @param {number} [options.maxWait] * The maximum time `func` is allowed to be delayed before it's invoked. * @param {boolean} [options.trailing=true] * Specify invoking on the trailing edge of the timeout. * @returns {Function} Returns the new debounced function. * @example * * // Avoid costly calculations while the window size is in flux. * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); * * // Invoke `sendMail` when clicked, debouncing subsequent calls. * jQuery(element).on('click', _.debounce(sendMail, 300, { * 'leading': true, * 'trailing': false * })); * * // Ensure `batchLog` is invoked once after 1 second of debounced calls. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); * var source = new EventSource('/stream'); * jQuery(source).on('message', debounced); * * // Cancel the trailing debounced invocation. * jQuery(window).on('popstate', debounced.cancel); */ function debounce(func, wait, options) { var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } wait = toNumber(wait) || 0; if (isObject(options)) { leading = !!options.leading; maxing = 'maxWait' in options; maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; trailing = 'trailing' in options ? !!options.trailing : trailing; } function invokeFunc(time) { var args = lastArgs, thisArg = lastThis; lastArgs = lastThis = undefined; lastInvokeTime = time; result = func.apply(thisArg, args); return result; } function leadingEdge(time) { // Reset any `maxWait` timer. lastInvokeTime = time; // Start the timer for the trailing edge. timerId = setTimeout(timerExpired, wait); // Invoke the leading edge. return leading ? invokeFunc(time) : result; } function remainingWait(time) { var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall; return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting; } function shouldInvoke(time) { var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime; // Either this is the first call, activity has stopped and we're at the // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. return (lastCallTime === undefined || (timeSinceLastCall >= wait) || (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); } function timerExpired() { var time = now(); if (shouldInvoke(time)) { return trailingEdge(time); } // Restart the timer. timerId = setTimeout(timerExpired, remainingWait(time)); } function trailingEdge(time) { timerId = undefined; // Only invoke if we have `lastArgs` which means `func` has been // debounced at least once. if (trailing && lastArgs) { return invokeFunc(time); } lastArgs = lastThis = undefined; return result; } function cancel() { if (timerId !== undefined) { clearTimeout(timerId); } lastInvokeTime = 0; lastArgs = lastCallTime = lastThis = timerId = undefined; } function flush() { return timerId === undefined ? result : trailingEdge(now()); } function debounced() { var time = now(), isInvoking = shouldInvoke(time); lastArgs = arguments; lastThis = this; lastCallTime = time; if (isInvoking) { if (timerId === undefined) { return leadingEdge(lastCallTime); } if (maxing) { // Handle invocations in a tight loop. clearTimeout(timerId); timerId = setTimeout(timerExpired, wait); return invokeFunc(lastCallTime); } } if (timerId === undefined) { timerId = setTimeout(timerExpired, wait); } return result; } debounced.cancel = cancel; debounced.flush = flush; return debounced; } /** * Defers invoking the `func` until the current call stack has cleared. Any * additional arguments are provided to `func` when it's invoked. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to defer. * @param {...*} [args] The arguments to invoke `func` with. * @returns {number} Returns the timer id. * @example * * _.defer(function(text) { * console.log(text); * }, 'deferred'); * // => Logs 'deferred' after one millisecond. */ var defer = baseRest(function(func, args) { return baseDelay(func, 1, args); }); /** * Invokes `func` after `wait` milliseconds. Any additional arguments are * provided to `func` when it's invoked. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to delay. * @param {number} wait The number of milliseconds to delay invocation. * @param {...*} [args] The arguments to invoke `func` with. * @returns {number} Returns the timer id. * @example * * _.delay(function(text) { * console.log(text); * }, 1000, 'later'); * // => Logs 'later' after one second. */ var delay = baseRest(function(func, wait, args) { return baseDelay(func, toNumber(wait) || 0, args); }); /** * Creates a function that invokes `func` with arguments reversed. * * @static * @memberOf _ * @since 4.0.0 * @category Function * @param {Function} func The function to flip arguments for. * @returns {Function} Returns the new flipped function. * @example * * var flipped = _.flip(function() { * return _.toArray(arguments); * }); * * flipped('a', 'b', 'c', 'd'); * // => ['d', 'c', 'b', 'a'] */ function flip(func) { return createWrap(func, WRAP_FLIP_FLAG); } /** * Creates a function that memoizes the result of `func`. If `resolver` is * provided, it determines the cache key for storing the result based on the * arguments provided to the memoized function. By default, the first argument * provided to the memoized function is used as the map cache key. The `func` * is invoked with the `this` binding of the memoized function. * * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` * constructor with one whose instances implement the * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) * method interface of `clear`, `delete`, `get`, `has`, and `set`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to have its output memoized. * @param {Function} [resolver] The function to resolve the cache key. * @returns {Function} Returns the new memoized function. * @example * * var object = { 'a': 1, 'b': 2 }; * var other = { 'c': 3, 'd': 4 }; * * var values = _.memoize(_.values); * values(object); * // => [1, 2] * * values(other); * // => [3, 4] * * object.a = 2; * values(object); * // => [1, 2] * * // Modify the result cache. * values.cache.set(object, ['a', 'b']); * values(object); * // => ['a', 'b'] * * // Replace `_.memoize.Cache`. * _.memoize.Cache = WeakMap; */ function memoize(func, resolver) { if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { throw new TypeError(FUNC_ERROR_TEXT); } var memoized = function() { var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; if (cache.has(key)) { return cache.get(key); } var result = func.apply(this, args); memoized.cache = cache.set(key, result) || cache; return result; }; memoized.cache = new (memoize.Cache || MapCache); return memoized; } // Expose `MapCache`. memoize.Cache = MapCache; /** * Creates a function that negates the result of the predicate `func`. The * `func` predicate is invoked with the `this` binding and arguments of the * created function. * * @static * @memberOf _ * @since 3.0.0 * @category Function * @param {Function} predicate The predicate to negate. * @returns {Function} Returns the new negated function. * @example * * function isEven(n) { * return n % 2 == 0; * } * * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); * // => [1, 3, 5] */ function negate(predicate) { if (typeof predicate != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } return function() { var args = arguments; switch (args.length) { case 0: return !predicate.call(this); case 1: return !predicate.call(this, args[0]); case 2: return !predicate.call(this, args[0], args[1]); case 3: return !predicate.call(this, args[0], args[1], args[2]); } return !predicate.apply(this, args); }; } /** * Creates a function that is restricted to invoking `func` once. Repeat calls * to the function return the value of the first invocation. The `func` is * invoked with the `this` binding and arguments of the created function. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to restrict. * @returns {Function} Returns the new restricted function. * @example * * var initialize = _.once(createApplication); * initialize(); * initialize(); * // => `createApplication` is invoked once */ function once(func) { return before(2, func); } /** * Creates a function that invokes `func` with its arguments transformed. * * @static * @since 4.0.0 * @memberOf _ * @category Function * @param {Function} func The function to wrap. * @param {...(Function|Function[])} [transforms=[_.identity]] * The argument transforms. * @returns {Function} Returns the new function. * @example * * function doubled(n) { * return n * 2; * } * * function square(n) { * return n * n; * } * * var func = _.overArgs(function(x, y) { * return [x, y]; * }, [square, doubled]); * * func(9, 3); * // => [81, 6] * * func(10, 5); * // => [100, 10] */ var overArgs = castRest(function(func, transforms) { transforms = (transforms.length == 1 && isArray(transforms[0])) ? arrayMap(transforms[0], baseUnary(getIteratee())) : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); var funcsLength = transforms.length; return baseRest(function(args) { var index = -1, length = nativeMin(args.length, funcsLength); while (++index < length) { args[index] = transforms[index].call(this, args[index]); } return apply(func, this, args); }); }); /** * Creates a function that invokes `func` with `partials` prepended to the * arguments it receives. This method is like `_.bind` except it does **not** * alter the `this` binding. * * The `_.partial.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for partially applied arguments. * * **Note:** This method doesn't set the "length" property of partially * applied functions. * * @static * @memberOf _ * @since 0.2.0 * @category Function * @param {Function} func The function to partially apply arguments to. * @param {...*} [partials] The arguments to be partially applied. * @returns {Function} Returns the new partially applied function. * @example * * function greet(greeting, name) { * return greeting + ' ' + name; * } * * var sayHelloTo = _.partial(greet, 'hello'); * sayHelloTo('fred'); * // => 'hello fred' * * // Partially applied with placeholders. * var greetFred = _.partial(greet, _, 'fred'); * greetFred('hi'); * // => 'hi fred' */ var partial = baseRest(function(func, partials) { var holders = replaceHolders(partials, getHolder(partial)); return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders); }); /** * This method is like `_.partial` except that partially applied arguments * are appended to the arguments it receives. * * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for partially applied arguments. * * **Note:** This method doesn't set the "length" property of partially * applied functions. * * @static * @memberOf _ * @since 1.0.0 * @category Function * @param {Function} func The function to partially apply arguments to. * @param {...*} [partials] The arguments to be partially applied. * @returns {Function} Returns the new partially applied function. * @example * * function greet(greeting, name) { * return greeting + ' ' + name; * } * * var greetFred = _.partialRight(greet, 'fred'); * greetFred('hi'); * // => 'hi fred' * * // Partially applied with placeholders. * var sayHelloTo = _.partialRight(greet, 'hello', _); * sayHelloTo('fred'); * // => 'hello fred' */ var partialRight = baseRest(function(func, partials) { var holders = replaceHolders(partials, getHolder(partialRight)); return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders); }); /** * Creates a function that invokes `func` with arguments arranged according * to the specified `indexes` where the argument value at the first index is * provided as the first argument, the argument value at the second index is * provided as the second argument, and so on. * * @static * @memberOf _ * @since 3.0.0 * @category Function * @param {Function} func The function to rearrange arguments for. * @param {...(number|number[])} indexes The arranged argument indexes. * @returns {Function} Returns the new function. * @example * * var rearged = _.rearg(function(a, b, c) { * return [a, b, c]; * }, [2, 0, 1]); * * rearged('b', 'c', 'a') * // => ['a', 'b', 'c'] */ var rearg = flatRest(function(func, indexes) { return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes); }); /** * Creates a function that invokes `func` with the `this` binding of the * created function and arguments from `start` and beyond provided as * an array. * * **Note:** This method is based on the * [rest parameter](https://mdn.io/rest_parameters). * * @static * @memberOf _ * @since 4.0.0 * @category Function * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. * @returns {Function} Returns the new function. * @example * * var say = _.rest(function(what, names) { * return what + ' ' + _.initial(names).join(', ') + * (_.size(names) > 1 ? ', & ' : '') + _.last(names); * }); * * say('hello', 'fred', 'barney', 'pebbles'); * // => 'hello fred, barney, & pebbles' */ function rest(func, start) { if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } start = start === undefined ? start : toInteger(start); return baseRest(func, start); } /** * Creates a function that invokes `func` with the `this` binding of the * create function and an array of arguments much like * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply). * * **Note:** This method is based on the * [spread operator](https://mdn.io/spread_operator). * * @static * @memberOf _ * @since 3.2.0 * @category Function * @param {Function} func The function to spread arguments over. * @param {number} [start=0] The start position of the spread. * @returns {Function} Returns the new function. * @example * * var say = _.spread(function(who, what) { * return who + ' says ' + what; * }); * * say(['fred', 'hello']); * // => 'fred says hello' * * var numbers = Promise.all([ * Promise.resolve(40), * Promise.resolve(36) * ]); * * numbers.then(_.spread(function(x, y) { * return x + y; * })); * // => a Promise of 76 */ function spread(func, start) { if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } start = start == null ? 0 : nativeMax(toInteger(start), 0); return baseRest(function(args) { var array = args[start], otherArgs = castSlice(args, 0, start); if (array) { arrayPush(otherArgs, array); } return apply(func, this, otherArgs); }); } /** * Creates a throttled function that only invokes `func` at most once per * every `wait` milliseconds. The throttled function comes with a `cancel` * method to cancel delayed `func` invocations and a `flush` method to * immediately invoke them. Provide `options` to indicate whether `func` * should be invoked on the leading and/or trailing edge of the `wait` * timeout. The `func` is invoked with the last arguments provided to the * throttled function. Subsequent calls to the throttled function return the * result of the last `func` invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is * invoked on the trailing edge of the timeout only if the throttled function * is invoked more than once during the `wait` timeout. * * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred * until to the next tick, similar to `setTimeout` with a timeout of `0`. * * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) * for details over the differences between `_.throttle` and `_.debounce`. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {Function} func The function to throttle. * @param {number} [wait=0] The number of milliseconds to throttle invocations to. * @param {Object} [options={}] The options object. * @param {boolean} [options.leading=true] * Specify invoking on the leading edge of the timeout. * @param {boolean} [options.trailing=true] * Specify invoking on the trailing edge of the timeout. * @returns {Function} Returns the new throttled function. * @example * * // Avoid excessively updating the position while scrolling. * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); * * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); * jQuery(element).on('click', throttled); * * // Cancel the trailing throttled invocation. * jQuery(window).on('popstate', throttled.cancel); */ function throttle(func, wait, options) { var leading = true, trailing = true; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } if (isObject(options)) { leading = 'leading' in options ? !!options.leading : leading; trailing = 'trailing' in options ? !!options.trailing : trailing; } return debounce(func, wait, { 'leading': leading, 'maxWait': wait, 'trailing': trailing }); } /** * Creates a function that accepts up to one argument, ignoring any * additional arguments. * * @static * @memberOf _ * @since 4.0.0 * @category Function * @param {Function} func The function to cap arguments for. * @returns {Function} Returns the new capped function. * @example * * _.map(['6', '8', '10'], _.unary(parseInt)); * // => [6, 8, 10] */ function unary(func) { return ary(func, 1); } /** * Creates a function that provides `value` to `wrapper` as its first * argument. Any additional arguments provided to the function are appended * to those provided to the `wrapper`. The wrapper is invoked with the `this` * binding of the created function. * * @static * @memberOf _ * @since 0.1.0 * @category Function * @param {*} value The value to wrap. * @param {Function} [wrapper=identity] The wrapper function. * @returns {Function} Returns the new function. * @example * * var p = _.wrap(_.escape, function(func, text) { * return '<p>' + func(text) + '</p>'; * }); * * p('fred, barney, & pebbles'); * // => '<p>fred, barney, &amp; pebbles</p>' */ function wrap(value, wrapper) { return partial(castFunction(wrapper), value); } /*------------------------------------------------------------------------*/ /** * Casts `value` as an array if it's not one. * * @static * @memberOf _ * @since 4.4.0 * @category Lang * @param {*} value The value to inspect. * @returns {Array} Returns the cast array. * @example * * _.castArray(1); * // => [1] * * _.castArray({ 'a': 1 }); * // => [{ 'a': 1 }] * * _.castArray('abc'); * // => ['abc'] * * _.castArray(null); * // => [null] * * _.castArray(undefined); * // => [undefined] * * _.castArray(); * // => [] * * var array = [1, 2, 3]; * console.log(_.castArray(array) === array); * // => true */ function castArray() { if (!arguments.length) { return []; } var value = arguments[0]; return isArray(value) ? value : [value]; } /** * Creates a shallow clone of `value`. * * **Note:** This method is loosely based on the * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) * and supports cloning arrays, array buffers, booleans, date objects, maps, * numbers, `Object` objects, regexes, sets, strings, symbols, and typed * arrays. The own enumerable properties of `arguments` objects are cloned * as plain objects. An empty object is returned for uncloneable values such * as error objects, functions, DOM nodes, and WeakMaps. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to clone. * @returns {*} Returns the cloned value. * @see _.cloneDeep * @example * * var objects = [{ 'a': 1 }, { 'b': 2 }]; * * var shallow = _.clone(objects); * console.log(shallow[0] === objects[0]); * // => true */ function clone(value) { return baseClone(value, CLONE_SYMBOLS_FLAG); } /** * This method is like `_.clone` except that it accepts `customizer` which * is invoked to produce the cloned value. If `customizer` returns `undefined`, * cloning is handled by the method instead. The `customizer` is invoked with * up to four arguments; (value [, index|key, object, stack]). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to clone. * @param {Function} [customizer] The function to customize cloning. * @returns {*} Returns the cloned value. * @see _.cloneDeepWith * @example * * function customizer(value) { * if (_.isElement(value)) { * return value.cloneNode(false); * } * } * * var el = _.cloneWith(document.body, customizer); * * console.log(el === document.body); * // => false * console.log(el.nodeName); * // => 'BODY' * console.log(el.childNodes.length); * // => 0 */ function cloneWith(value, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined; return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); } /** * This method is like `_.clone` except that it recursively clones `value`. * * @static * @memberOf _ * @since 1.0.0 * @category Lang * @param {*} value The value to recursively clone. * @returns {*} Returns the deep cloned value. * @see _.clone * @example * * var objects = [{ 'a': 1 }, { 'b': 2 }]; * * var deep = _.cloneDeep(objects); * console.log(deep[0] === objects[0]); * // => false */ function cloneDeep(value) { return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); } /** * This method is like `_.cloneWith` except that it recursively clones `value`. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to recursively clone. * @param {Function} [customizer] The function to customize cloning. * @returns {*} Returns the deep cloned value. * @see _.cloneWith * @example * * function customizer(value) { * if (_.isElement(value)) { * return value.cloneNode(true); * } * } * * var el = _.cloneDeepWith(document.body, customizer); * * console.log(el === document.body); * // => false * console.log(el.nodeName); * // => 'BODY' * console.log(el.childNodes.length); * // => 20 */ function cloneDeepWith(value, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined; return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); } /** * Checks if `object` conforms to `source` by invoking the predicate * properties of `source` with the corresponding property values of `object`. * * **Note:** This method is equivalent to `_.conforms` when `source` is * partially applied. * * @static * @memberOf _ * @since 4.14.0 * @category Lang * @param {Object} object The object to inspect. * @param {Object} source The object of property predicates to conform to. * @returns {boolean} Returns `true` if `object` conforms, else `false`. * @example * * var object = { 'a': 1, 'b': 2 }; * * _.conformsTo(object, { 'b': function(n) { return n > 1; } }); * // => true * * _.conformsTo(object, { 'b': function(n) { return n > 2; } }); * // => false */ function conformsTo(object, source) { return source == null || baseConformsTo(object, source, keys(source)); } /** * Performs a * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'a': 1 }; * var other = { 'a': 1 }; * * _.eq(object, object); * // => true * * _.eq(object, other); * // => false * * _.eq('a', 'a'); * // => true * * _.eq('a', Object('a')); * // => false * * _.eq(NaN, NaN); * // => true */ function eq(value, other) { return value === other || (value !== value && other !== other); } /** * Checks if `value` is greater than `other`. * * @static * @memberOf _ * @since 3.9.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if `value` is greater than `other`, * else `false`. * @see _.lt * @example * * _.gt(3, 1); * // => true * * _.gt(3, 3); * // => false * * _.gt(1, 3); * // => false */ var gt = createRelationalOperation(baseGt); /** * Checks if `value` is greater than or equal to `other`. * * @static * @memberOf _ * @since 3.9.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if `value` is greater than or equal to * `other`, else `false`. * @see _.lte * @example * * _.gte(3, 1); * // => true * * _.gte(3, 3); * // => true * * _.gte(1, 3); * // => false */ var gte = createRelationalOperation(function(value, other) { return value >= other; }); /** * Checks if `value` is likely an `arguments` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, * else `false`. * @example * * _.isArguments(function() { return arguments; }()); * // => true * * _.isArguments([1, 2, 3]); * // => false */ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); }; /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(document.body.children); * // => false * * _.isArray('abc'); * // => false * * _.isArray(_.noop); * // => false */ var isArray = Array.isArray; /** * Checks if `value` is classified as an `ArrayBuffer` object. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. * @example * * _.isArrayBuffer(new ArrayBuffer(2)); * // => true * * _.isArrayBuffer(new Array(2)); * // => false */ var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. * @example * * _.isArrayLike([1, 2, 3]); * // => true * * _.isArrayLike(document.body.children); * // => true * * _.isArrayLike('abc'); * // => true * * _.isArrayLike(_.noop); * // => false */ function isArrayLike(value) { return value != null && isLength(value.length) && !isFunction(value); } /** * This method is like `_.isArrayLike` except that it also checks if `value` * is an object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, * else `false`. * @example * * _.isArrayLikeObject([1, 2, 3]); * // => true * * _.isArrayLikeObject(document.body.children); * // => true * * _.isArrayLikeObject('abc'); * // => false * * _.isArrayLikeObject(_.noop); * // => false */ function isArrayLikeObject(value) { return isObjectLike(value) && isArrayLike(value); } /** * Checks if `value` is classified as a boolean primitive or object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`. * @example * * _.isBoolean(false); * // => true * * _.isBoolean(null); * // => false */ function isBoolean(value) { return value === true || value === false || (isObjectLike(value) && baseGetTag(value) == boolTag); } /** * Checks if `value` is a buffer. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. * @example * * _.isBuffer(new Buffer(2)); * // => true * * _.isBuffer(new Uint8Array(2)); * // => false */ var isBuffer = nativeIsBuffer || stubFalse; /** * Checks if `value` is classified as a `Date` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a date object, else `false`. * @example * * _.isDate(new Date); * // => true * * _.isDate('Mon April 23 2012'); * // => false */ var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; /** * Checks if `value` is likely a DOM element. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. * @example * * _.isElement(document.body); * // => true * * _.isElement('<body>'); * // => false */ function isElement(value) { return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); } /** * Checks if `value` is an empty object, collection, map, or set. * * Objects are considered empty if they have no own enumerable string keyed * properties. * * Array-like values such as `arguments` objects, arrays, buffers, strings, or * jQuery-like collections are considered empty if they have a `length` of `0`. * Similarly, maps and sets are considered empty if they have a `size` of `0`. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is empty, else `false`. * @example * * _.isEmpty(null); * // => true * * _.isEmpty(true); * // => true * * _.isEmpty(1); * // => true * * _.isEmpty([1, 2, 3]); * // => false * * _.isEmpty({ 'a': 1 }); * // => false */ function isEmpty(value) { if (value == null) { return true; } if (isArrayLike(value) && (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || isBuffer(value) || isTypedArray(value) || isArguments(value))) { return !value.length; } var tag = getTag(value); if (tag == mapTag || tag == setTag) { return !value.size; } if (isPrototype(value)) { return !baseKeys(value).length; } for (var key in value) { if (hasOwnProperty.call(value, key)) { return false; } } return true; } /** * Performs a deep comparison between two values to determine if they are * equivalent. * * **Note:** This method supports comparing arrays, array buffers, booleans, * date objects, error objects, maps, numbers, `Object` objects, regexes, * sets, strings, symbols, and typed arrays. `Object` objects are compared * by their own, not inherited, enumerable properties. Functions and DOM * nodes are compared by strict equality, i.e. `===`. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'a': 1 }; * var other = { 'a': 1 }; * * _.isEqual(object, other); * // => true * * object === other; * // => false */ function isEqual(value, other) { return baseIsEqual(value, other); } /** * This method is like `_.isEqual` except that it accepts `customizer` which * is invoked to compare values. If `customizer` returns `undefined`, comparisons * are handled by the method instead. The `customizer` is invoked with up to * six arguments: (objValue, othValue [, index|key, object, other, stack]). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @param {Function} [customizer] The function to customize comparisons. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * function isGreeting(value) { * return /^h(?:i|ello)$/.test(value); * } * * function customizer(objValue, othValue) { * if (isGreeting(objValue) && isGreeting(othValue)) { * return true; * } * } * * var array = ['hello', 'goodbye']; * var other = ['hi', 'goodbye']; * * _.isEqualWith(array, other, customizer); * // => true */ function isEqualWith(value, other, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined; var result = customizer ? customizer(value, other) : undefined; return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result; } /** * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, * `SyntaxError`, `TypeError`, or `URIError` object. * * @static * @memberOf _ * @since 3.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an error object, else `false`. * @example * * _.isError(new Error); * // => true * * _.isError(Error); * // => false */ function isError(value) { if (!isObjectLike(value)) { return false; } var tag = baseGetTag(value); return tag == errorTag || tag == domExcTag || (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)); } /** * Checks if `value` is a finite primitive number. * * **Note:** This method is based on * [`Number.isFinite`](https://mdn.io/Number/isFinite). * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. * @example * * _.isFinite(3); * // => true * * _.isFinite(Number.MIN_VALUE); * // => true * * _.isFinite(Infinity); * // => false * * _.isFinite('3'); * // => false */ function isFinite(value) { return typeof value == 'number' && nativeIsFinite(value); } /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { if (!isObject(value)) { return false; } // The use of `Object#toString` avoids issues with the `typeof` operator // in Safari 9 which returns 'object' for typed arrays and other constructors. var tag = baseGetTag(value); return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; } /** * Checks if `value` is an integer. * * **Note:** This method is based on * [`Number.isInteger`](https://mdn.io/Number/isInteger). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an integer, else `false`. * @example * * _.isInteger(3); * // => true * * _.isInteger(Number.MIN_VALUE); * // => false * * _.isInteger(Infinity); * // => false * * _.isInteger('3'); * // => false */ function isInteger(value) { return typeof value == 'number' && value == toInteger(value); } /** * Checks if `value` is a valid array-like length. * * **Note:** This method is loosely based on * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); * // => true * * _.isLength(Number.MIN_VALUE); * // => false * * _.isLength(Infinity); * // => false * * _.isLength('3'); * // => false */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { var type = typeof value; return value != null && (type == 'object' || type == 'function'); } /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return value != null && typeof value == 'object'; } /** * Checks if `value` is classified as a `Map` object. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a map, else `false`. * @example * * _.isMap(new Map); * // => true * * _.isMap(new WeakMap); * // => false */ var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; /** * Performs a partial deep comparison between `object` and `source` to * determine if `object` contains equivalent property values. * * **Note:** This method is equivalent to `_.matches` when `source` is * partially applied. * * Partial comparisons will match empty array and empty object `source` * values against any array or object value, respectively. See `_.isEqual` * for a list of supported value comparisons. * * @static * @memberOf _ * @since 3.0.0 * @category Lang * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. * @returns {boolean} Returns `true` if `object` is a match, else `false`. * @example * * var object = { 'a': 1, 'b': 2 }; * * _.isMatch(object, { 'b': 2 }); * // => true * * _.isMatch(object, { 'b': 1 }); * // => false */ function isMatch(object, source) { return object === source || baseIsMatch(object, source, getMatchData(source)); } /** * This method is like `_.isMatch` except that it accepts `customizer` which * is invoked to compare values. If `customizer` returns `undefined`, comparisons * are handled by the method instead. The `customizer` is invoked with five * arguments: (objValue, srcValue, index|key, object, source). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. * @param {Function} [customizer] The function to customize comparisons. * @returns {boolean} Returns `true` if `object` is a match, else `false`. * @example * * function isGreeting(value) { * return /^h(?:i|ello)$/.test(value); * } * * function customizer(objValue, srcValue) { * if (isGreeting(objValue) && isGreeting(srcValue)) { * return true; * } * } * * var object = { 'greeting': 'hello' }; * var source = { 'greeting': 'hi' }; * * _.isMatchWith(object, source, customizer); * // => true */ function isMatchWith(object, source, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined; return baseIsMatch(object, source, getMatchData(source), customizer); } /** * Checks if `value` is `NaN`. * * **Note:** This method is based on * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for * `undefined` and other non-number values. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. * @example * * _.isNaN(NaN); * // => true * * _.isNaN(new Number(NaN)); * // => true * * isNaN(undefined); * // => true * * _.isNaN(undefined); * // => false */ function isNaN(value) { // An `NaN` primitive is the only value that is not equal to itself. // Perform the `toStringTag` check first to avoid errors with some // ActiveX objects in IE. return isNumber(value) && value != +value; } /** * Checks if `value` is a pristine native function. * * **Note:** This method can't reliably detect native functions in the presence * of the core-js package because core-js circumvents this kind of detection. * Despite multiple requests, the core-js maintainer has made it clear: any * attempt to fix the detection will be obstructed. As a result, we're left * with little choice but to throw an error. Unfortunately, this also affects * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill), * which rely on core-js. * * @static * @memberOf _ * @since 3.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, * else `false`. * @example * * _.isNative(Array.prototype.push); * // => true * * _.isNative(_); * // => false */ function isNative(value) { if (isMaskable(value)) { throw new Error(CORE_ERROR_TEXT); } return baseIsNative(value); } /** * Checks if `value` is `null`. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `null`, else `false`. * @example * * _.isNull(null); * // => true * * _.isNull(void 0); * // => false */ function isNull(value) { return value === null; } /** * Checks if `value` is `null` or `undefined`. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is nullish, else `false`. * @example * * _.isNil(null); * // => true * * _.isNil(void 0); * // => true * * _.isNil(NaN); * // => false */ function isNil(value) { return value == null; } /** * Checks if `value` is classified as a `Number` primitive or object. * * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are * classified as numbers, use the `_.isFinite` method. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a number, else `false`. * @example * * _.isNumber(3); * // => true * * _.isNumber(Number.MIN_VALUE); * // => true * * _.isNumber(Infinity); * // => true * * _.isNumber('3'); * // => false */ function isNumber(value) { return typeof value == 'number' || (isObjectLike(value) && baseGetTag(value) == numberTag); } /** * Checks if `value` is a plain object, that is, an object created by the * `Object` constructor or one with a `[[Prototype]]` of `null`. * * @static * @memberOf _ * @since 0.8.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. * @example * * function Foo() { * this.a = 1; * } * * _.isPlainObject(new Foo); * // => false * * _.isPlainObject([1, 2, 3]); * // => false * * _.isPlainObject({ 'x': 0, 'y': 0 }); * // => true * * _.isPlainObject(Object.create(null)); * // => true */ function isPlainObject(value) { if (!isObjectLike(value) || baseGetTag(value) != objectTag) { return false; } var proto = getPrototype(value); if (proto === null) { return true; } var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; return typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString; } /** * Checks if `value` is classified as a `RegExp` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. * @example * * _.isRegExp(/abc/); * // => true * * _.isRegExp('/abc/'); * // => false */ var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; /** * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 * double precision number which isn't the result of a rounded unsafe integer. * * **Note:** This method is based on * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. * @example * * _.isSafeInteger(3); * // => true * * _.isSafeInteger(Number.MIN_VALUE); * // => false * * _.isSafeInteger(Infinity); * // => false * * _.isSafeInteger('3'); * // => false */ function isSafeInteger(value) { return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; } /** * Checks if `value` is classified as a `Set` object. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a set, else `false`. * @example * * _.isSet(new Set); * // => true * * _.isSet(new WeakSet); * // => false */ var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; /** * Checks if `value` is classified as a `String` primitive or object. * * @static * @since 0.1.0 * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a string, else `false`. * @example * * _.isString('abc'); * // => true * * _.isString(1); * // => false */ function isString(value) { return typeof value == 'string' || (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); } /** * Checks if `value` is classified as a `Symbol` primitive or object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. * @example * * _.isSymbol(Symbol.iterator); * // => true * * _.isSymbol('abc'); * // => false */ function isSymbol(value) { return typeof value == 'symbol' || (isObjectLike(value) && baseGetTag(value) == symbolTag); } /** * Checks if `value` is classified as a typed array. * * @static * @memberOf _ * @since 3.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. * @example * * _.isTypedArray(new Uint8Array); * // => true * * _.isTypedArray([]); * // => false */ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; /** * Checks if `value` is `undefined`. * * @static * @since 0.1.0 * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. * @example * * _.isUndefined(void 0); * // => true * * _.isUndefined(null); * // => false */ function isUndefined(value) { return value === undefined; } /** * Checks if `value` is classified as a `WeakMap` object. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`. * @example * * _.isWeakMap(new WeakMap); * // => true * * _.isWeakMap(new Map); * // => false */ function isWeakMap(value) { return isObjectLike(value) && getTag(value) == weakMapTag; } /** * Checks if `value` is classified as a `WeakSet` object. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`. * @example * * _.isWeakSet(new WeakSet); * // => true * * _.isWeakSet(new Set); * // => false */ function isWeakSet(value) { return isObjectLike(value) && baseGetTag(value) == weakSetTag; } /** * Checks if `value` is less than `other`. * * @static * @memberOf _ * @since 3.9.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if `value` is less than `other`, * else `false`. * @see _.gt * @example * * _.lt(1, 3); * // => true * * _.lt(3, 3); * // => false * * _.lt(3, 1); * // => false */ var lt = createRelationalOperation(baseLt); /** * Checks if `value` is less than or equal to `other`. * * @static * @memberOf _ * @since 3.9.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if `value` is less than or equal to * `other`, else `false`. * @see _.gte * @example * * _.lte(1, 3); * // => true * * _.lte(3, 3); * // => true * * _.lte(3, 1); * // => false */ var lte = createRelationalOperation(function(value, other) { return value <= other; }); /** * Converts `value` to an array. * * @static * @since 0.1.0 * @memberOf _ * @category Lang * @param {*} value The value to convert. * @returns {Array} Returns the converted array. * @example * * _.toArray({ 'a': 1, 'b': 2 }); * // => [1, 2] * * _.toArray('abc'); * // => ['a', 'b', 'c'] * * _.toArray(1); * // => [] * * _.toArray(null); * // => [] */ function toArray(value) { if (!value) { return []; } if (isArrayLike(value)) { return isString(value) ? stringToArray(value) : copyArray(value); } if (symIterator && value[symIterator]) { return iteratorToArray(value[symIterator]()); } var tag = getTag(value), func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values); return func(value); } /** * Converts `value` to a finite number. * * @static * @memberOf _ * @since 4.12.0 * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted number. * @example * * _.toFinite(3.2); * // => 3.2 * * _.toFinite(Number.MIN_VALUE); * // => 5e-324 * * _.toFinite(Infinity); * // => 1.7976931348623157e+308 * * _.toFinite('3.2'); * // => 3.2 */ function toFinite(value) { if (!value) { return value === 0 ? value : 0; } value = toNumber(value); if (value === INFINITY || value === -INFINITY) { var sign = (value < 0 ? -1 : 1); return sign * MAX_INTEGER; } return value === value ? value : 0; } /** * Converts `value` to an integer. * * **Note:** This method is loosely based on * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. * @example * * _.toInteger(3.2); * // => 3 * * _.toInteger(Number.MIN_VALUE); * // => 0 * * _.toInteger(Infinity); * // => 1.7976931348623157e+308 * * _.toInteger('3.2'); * // => 3 */ function toInteger(value) { var result = toFinite(value), remainder = result % 1; return result === result ? (remainder ? result - remainder : result) : 0; } /** * Converts `value` to an integer suitable for use as the length of an * array-like object. * * **Note:** This method is based on * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. * @example * * _.toLength(3.2); * // => 3 * * _.toLength(Number.MIN_VALUE); * // => 0 * * _.toLength(Infinity); * // => 4294967295 * * _.toLength('3.2'); * // => 3 */ function toLength(value) { return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; } /** * Converts `value` to a number. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to process. * @returns {number} Returns the number. * @example * * _.toNumber(3.2); * // => 3.2 * * _.toNumber(Number.MIN_VALUE); * // => 5e-324 * * _.toNumber(Infinity); * // => Infinity * * _.toNumber('3.2'); * // => 3.2 */ function toNumber(value) { if (typeof value == 'number') { return value; } if (isSymbol(value)) { return NAN; } if (isObject(value)) { var other = typeof value.valueOf == 'function' ? value.valueOf() : value; value = isObject(other) ? (other + '') : other; } if (typeof value != 'string') { return value === 0 ? value : +value; } value = value.replace(reTrim, ''); var isBinary = reIsBinary.test(value); return (isBinary || reIsOctal.test(value)) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : (reIsBadHex.test(value) ? NAN : +value); } /** * Converts `value` to a plain object flattening inherited enumerable string * keyed properties of `value` to own properties of the plain object. * * @static * @memberOf _ * @since 3.0.0 * @category Lang * @param {*} value The value to convert. * @returns {Object} Returns the converted plain object. * @example * * function Foo() { * this.b = 2; * } * * Foo.prototype.c = 3; * * _.assign({ 'a': 1 }, new Foo); * // => { 'a': 1, 'b': 2 } * * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); * // => { 'a': 1, 'b': 2, 'c': 3 } */ function toPlainObject(value) { return copyObject(value, keysIn(value)); } /** * Converts `value` to a safe integer. A safe integer can be compared and * represented correctly. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. * @example * * _.toSafeInteger(3.2); * // => 3 * * _.toSafeInteger(Number.MIN_VALUE); * // => 0 * * _.toSafeInteger(Infinity); * // => 9007199254740991 * * _.toSafeInteger('3.2'); * // => 3 */ function toSafeInteger(value) { return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : (value === 0 ? value : 0); } /** * Converts `value` to a string. An empty string is returned for `null` * and `undefined` values. The sign of `-0` is preserved. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {string} Returns the converted string. * @example * * _.toString(null); * // => '' * * _.toString(-0); * // => '-0' * * _.toString([1, 2, 3]); * // => '1,2,3' */ function toString(value) { return value == null ? '' : baseToString(value); } /*------------------------------------------------------------------------*/ /** * Assigns own enumerable string keyed properties of source objects to the * destination object. Source objects are applied from left to right. * Subsequent sources overwrite property assignments of previous sources. * * **Note:** This method mutates `object` and is loosely based on * [`Object.assign`](https://mdn.io/Object/assign). * * @static * @memberOf _ * @since 0.10.0 * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @see _.assignIn * @example * * function Foo() { * this.a = 1; * } * * function Bar() { * this.c = 3; * } * * Foo.prototype.b = 2; * Bar.prototype.d = 4; * * _.assign({ 'a': 0 }, new Foo, new Bar); * // => { 'a': 1, 'c': 3 } */ var assign = createAssigner(function(object, source) { if (isPrototype(source) || isArrayLike(source)) { copyObject(source, keys(source), object); return; } for (var key in source) { if (hasOwnProperty.call(source, key)) { assignValue(object, key, source[key]); } } }); /** * This method is like `_.assign` except that it iterates over own and * inherited source properties. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 4.0.0 * @alias extend * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @see _.assign * @example * * function Foo() { * this.a = 1; * } * * function Bar() { * this.c = 3; * } * * Foo.prototype.b = 2; * Bar.prototype.d = 4; * * _.assignIn({ 'a': 0 }, new Foo, new Bar); * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } */ var assignIn = createAssigner(function(object, source) { copyObject(source, keysIn(source), object); }); /** * This method is like `_.assignIn` except that it accepts `customizer` * which is invoked to produce the assigned values. If `customizer` returns * `undefined`, assignment is handled by the method instead. The `customizer` * is invoked with five arguments: (objValue, srcValue, key, object, source). * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 4.0.0 * @alias extendWith * @category Object * @param {Object} object The destination object. * @param {...Object} sources The source objects. * @param {Function} [customizer] The function to customize assigned values. * @returns {Object} Returns `object`. * @see _.assignWith * @example * * function customizer(objValue, srcValue) { * return _.isUndefined(objValue) ? srcValue : objValue; * } * * var defaults = _.partialRight(_.assignInWith, customizer); * * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); * // => { 'a': 1, 'b': 2 } */ var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { copyObject(source, keysIn(source), object, customizer); }); /** * This method is like `_.assign` except that it accepts `customizer` * which is invoked to produce the assigned values. If `customizer` returns * `undefined`, assignment is handled by the method instead. The `customizer` * is invoked with five arguments: (objValue, srcValue, key, object, source). * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The destination object. * @param {...Object} sources The source objects. * @param {Function} [customizer] The function to customize assigned values. * @returns {Object} Returns `object`. * @see _.assignInWith * @example * * function customizer(objValue, srcValue) { * return _.isUndefined(objValue) ? srcValue : objValue; * } * * var defaults = _.partialRight(_.assignWith, customizer); * * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); * // => { 'a': 1, 'b': 2 } */ var assignWith = createAssigner(function(object, source, srcIndex, customizer) { copyObject(source, keys(source), object, customizer); }); /** * Creates an array of values corresponding to `paths` of `object`. * * @static * @memberOf _ * @since 1.0.0 * @category Object * @param {Object} object The object to iterate over. * @param {...(string|string[])} [paths] The property paths to pick. * @returns {Array} Returns the picked values. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; * * _.at(object, ['a[0].b.c', 'a[1]']); * // => [3, 4] */ var at = flatRest(baseAt); /** * Creates an object that inherits from the `prototype` object. If a * `properties` object is given, its own enumerable string keyed properties * are assigned to the created object. * * @static * @memberOf _ * @since 2.3.0 * @category Object * @param {Object} prototype The object to inherit from. * @param {Object} [properties] The properties to assign to the object. * @returns {Object} Returns the new object. * @example * * function Shape() { * this.x = 0; * this.y = 0; * } * * function Circle() { * Shape.call(this); * } * * Circle.prototype = _.create(Shape.prototype, { * 'constructor': Circle * }); * * var circle = new Circle; * circle instanceof Circle; * // => true * * circle instanceof Shape; * // => true */ function create(prototype, properties) { var result = baseCreate(prototype); return properties == null ? result : baseAssign(result, properties); } /** * Assigns own and inherited enumerable string keyed properties of source * objects to the destination object for all destination properties that * resolve to `undefined`. Source objects are applied from left to right. * Once a property is set, additional values of the same property are ignored. * * **Note:** This method mutates `object`. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @see _.defaultsDeep * @example * * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); * // => { 'a': 1, 'b': 2 } */ var defaults = baseRest(function(object, sources) { object = Object(object); var index = -1; var length = sources.length; var guard = length > 2 ? sources[2] : undefined; if (guard && isIterateeCall(sources[0], sources[1], guard)) { length = 1; } while (++index < length) { var source = sources[index]; var props = keysIn(source); var propsIndex = -1; var propsLength = props.length; while (++propsIndex < propsLength) { var key = props[propsIndex]; var value = object[key]; if (value === undefined || (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) { object[key] = source[key]; } } } return object; }); /** * This method is like `_.defaults` except that it recursively assigns * default properties. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 3.10.0 * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @see _.defaults * @example * * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); * // => { 'a': { 'b': 2, 'c': 3 } } */ var defaultsDeep = baseRest(function(args) { args.push(undefined, customDefaultsMerge); return apply(mergeWith, undefined, args); }); /** * This method is like `_.find` except that it returns the key of the first * element `predicate` returns truthy for instead of the element itself. * * @static * @memberOf _ * @since 1.1.0 * @category Object * @param {Object} object The object to inspect. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @returns {string|undefined} Returns the key of the matched element, * else `undefined`. * @example * * var users = { * 'barney': { 'age': 36, 'active': true }, * 'fred': { 'age': 40, 'active': false }, * 'pebbles': { 'age': 1, 'active': true } * }; * * _.findKey(users, function(o) { return o.age < 40; }); * // => 'barney' (iteration order is not guaranteed) * * // The `_.matches` iteratee shorthand. * _.findKey(users, { 'age': 1, 'active': true }); * // => 'pebbles' * * // The `_.matchesProperty` iteratee shorthand. * _.findKey(users, ['active', false]); * // => 'fred' * * // The `_.property` iteratee shorthand. * _.findKey(users, 'active'); * // => 'barney' */ function findKey(object, predicate) { return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); } /** * This method is like `_.findKey` except that it iterates over elements of * a collection in the opposite order. * * @static * @memberOf _ * @since 2.0.0 * @category Object * @param {Object} object The object to inspect. * @param {Function} [predicate=_.identity] The function invoked per iteration. * @returns {string|undefined} Returns the key of the matched element, * else `undefined`. * @example * * var users = { * 'barney': { 'age': 36, 'active': true }, * 'fred': { 'age': 40, 'active': false }, * 'pebbles': { 'age': 1, 'active': true } * }; * * _.findLastKey(users, function(o) { return o.age < 40; }); * // => returns 'pebbles' assuming `_.findKey` returns 'barney' * * // The `_.matches` iteratee shorthand. * _.findLastKey(users, { 'age': 36, 'active': true }); * // => 'barney' * * // The `_.matchesProperty` iteratee shorthand. * _.findLastKey(users, ['active', false]); * // => 'fred' * * // The `_.property` iteratee shorthand. * _.findLastKey(users, 'active'); * // => 'pebbles' */ function findLastKey(object, predicate) { return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); } /** * Iterates over own and inherited enumerable string keyed properties of an * object and invokes `iteratee` for each property. The iteratee is invoked * with three arguments: (value, key, object). Iteratee functions may exit * iteration early by explicitly returning `false`. * * @static * @memberOf _ * @since 0.3.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns `object`. * @see _.forInRight * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.forIn(new Foo, function(value, key) { * console.log(key); * }); * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed). */ function forIn(object, iteratee) { return object == null ? object : baseFor(object, getIteratee(iteratee, 3), keysIn); } /** * This method is like `_.forIn` except that it iterates over properties of * `object` in the opposite order. * * @static * @memberOf _ * @since 2.0.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns `object`. * @see _.forIn * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.forInRight(new Foo, function(value, key) { * console.log(key); * }); * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. */ function forInRight(object, iteratee) { return object == null ? object : baseForRight(object, getIteratee(iteratee, 3), keysIn); } /** * Iterates over own enumerable string keyed properties of an object and * invokes `iteratee` for each property. The iteratee is invoked with three * arguments: (value, key, object). Iteratee functions may exit iteration * early by explicitly returning `false`. * * @static * @memberOf _ * @since 0.3.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns `object`. * @see _.forOwnRight * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.forOwn(new Foo, function(value, key) { * console.log(key); * }); * // => Logs 'a' then 'b' (iteration order is not guaranteed). */ function forOwn(object, iteratee) { return object && baseForOwn(object, getIteratee(iteratee, 3)); } /** * This method is like `_.forOwn` except that it iterates over properties of * `object` in the opposite order. * * @static * @memberOf _ * @since 2.0.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns `object`. * @see _.forOwn * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.forOwnRight(new Foo, function(value, key) { * console.log(key); * }); * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. */ function forOwnRight(object, iteratee) { return object && baseForOwnRight(object, getIteratee(iteratee, 3)); } /** * Creates an array of function property names from own enumerable properties * of `object`. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to inspect. * @returns {Array} Returns the function names. * @see _.functionsIn * @example * * function Foo() { * this.a = _.constant('a'); * this.b = _.constant('b'); * } * * Foo.prototype.c = _.constant('c'); * * _.functions(new Foo); * // => ['a', 'b'] */ function functions(object) { return object == null ? [] : baseFunctions(object, keys(object)); } /** * Creates an array of function property names from own and inherited * enumerable properties of `object`. * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The object to inspect. * @returns {Array} Returns the function names. * @see _.functions * @example * * function Foo() { * this.a = _.constant('a'); * this.b = _.constant('b'); * } * * Foo.prototype.c = _.constant('c'); * * _.functionsIn(new Foo); * // => ['a', 'b', 'c'] */ function functionsIn(object) { return object == null ? [] : baseFunctions(object, keysIn(object)); } /** * Gets the value at `path` of `object`. If the resolved value is * `undefined`, the `defaultValue` is returned in its place. * * @static * @memberOf _ * @since 3.7.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @param {*} [defaultValue] The value returned for `undefined` resolved values. * @returns {*} Returns the resolved value. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }] }; * * _.get(object, 'a[0].b.c'); * // => 3 * * _.get(object, ['a', '0', 'b', 'c']); * // => 3 * * _.get(object, 'a.b.c', 'default'); * // => 'default' */ function get(object, path, defaultValue) { var result = object == null ? undefined : baseGet(object, path); return result === undefined ? defaultValue : result; } /** * Checks if `path` is a direct property of `object`. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * * var object = { 'a': { 'b': 2 } }; * var other = _.create({ 'a': _.create({ 'b': 2 }) }); * * _.has(object, 'a'); * // => true * * _.has(object, 'a.b'); * // => true * * _.has(object, ['a', 'b']); * // => true * * _.has(other, 'a'); * // => false */ function has(object, path) { return object != null && hasPath(object, path, baseHas); } /** * Checks if `path` is a direct or inherited property of `object`. * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @returns {boolean} Returns `true` if `path` exists, else `false`. * @example * * var object = _.create({ 'a': _.create({ 'b': 2 }) }); * * _.hasIn(object, 'a'); * // => true * * _.hasIn(object, 'a.b'); * // => true * * _.hasIn(object, ['a', 'b']); * // => true * * _.hasIn(object, 'b'); * // => false */ function hasIn(object, path) { return object != null && hasPath(object, path, baseHasIn); } /** * Creates an object composed of the inverted keys and values of `object`. * If `object` contains duplicate values, subsequent values overwrite * property assignments of previous values. * * @static * @memberOf _ * @since 0.7.0 * @category Object * @param {Object} object The object to invert. * @returns {Object} Returns the new inverted object. * @example * * var object = { 'a': 1, 'b': 2, 'c': 1 }; * * _.invert(object); * // => { '1': 'c', '2': 'b' } */ var invert = createInverter(function(result, value, key) { if (value != null && typeof value.toString != 'function') { value = nativeObjectToString.call(value); } result[value] = key; }, constant(identity)); /** * This method is like `_.invert` except that the inverted object is generated * from the results of running each element of `object` thru `iteratee`. The * corresponding inverted value of each inverted key is an array of keys * responsible for generating the inverted value. The iteratee is invoked * with one argument: (value). * * @static * @memberOf _ * @since 4.1.0 * @category Object * @param {Object} object The object to invert. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {Object} Returns the new inverted object. * @example * * var object = { 'a': 1, 'b': 2, 'c': 1 }; * * _.invertBy(object); * // => { '1': ['a', 'c'], '2': ['b'] } * * _.invertBy(object, function(value) { * return 'group' + value; * }); * // => { 'group1': ['a', 'c'], 'group2': ['b'] } */ var invertBy = createInverter(function(result, value, key) { if (value != null && typeof value.toString != 'function') { value = nativeObjectToString.call(value); } if (hasOwnProperty.call(result, value)) { result[value].push(key); } else { result[value] = [key]; } }, getIteratee); /** * Invokes the method at `path` of `object`. * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the method to invoke. * @param {...*} [args] The arguments to invoke the method with. * @returns {*} Returns the result of the invoked method. * @example * * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; * * _.invoke(object, 'a[0].b.c.slice', 1, 3); * // => [2, 3] */ var invoke = baseRest(baseInvoke); /** * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keys(new Foo); * // => ['a', 'b'] (iteration order is not guaranteed) * * _.keys('hi'); * // => ['0', '1'] */ function keys(object) { return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } /** * Creates an array of the own and inherited enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ * @since 3.0.0 * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keysIn(new Foo); * // => ['a', 'b', 'c'] (iteration order is not guaranteed) */ function keysIn(object) { return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); } /** * The opposite of `_.mapValues`; this method creates an object with the * same values as `object` and keys generated by running each own enumerable * string keyed property of `object` thru `iteratee`. The iteratee is invoked * with three arguments: (value, key, object). * * @static * @memberOf _ * @since 3.8.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns the new mapped object. * @see _.mapValues * @example * * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { * return key + value; * }); * // => { 'a1': 1, 'b2': 2 } */ function mapKeys(object, iteratee) { var result = {}; iteratee = getIteratee(iteratee, 3); baseForOwn(object, function(value, key, object) { baseAssignValue(result, iteratee(value, key, object), value); }); return result; } /** * Creates an object with the same keys as `object` and values generated * by running each own enumerable string keyed property of `object` thru * `iteratee`. The iteratee is invoked with three arguments: * (value, key, object). * * @static * @memberOf _ * @since 2.4.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Object} Returns the new mapped object. * @see _.mapKeys * @example * * var users = { * 'fred': { 'user': 'fred', 'age': 40 }, * 'pebbles': { 'user': 'pebbles', 'age': 1 } * }; * * _.mapValues(users, function(o) { return o.age; }); * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) * * // The `_.property` iteratee shorthand. * _.mapValues(users, 'age'); * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) */ function mapValues(object, iteratee) { var result = {}; iteratee = getIteratee(iteratee, 3); baseForOwn(object, function(value, key, object) { baseAssignValue(result, key, iteratee(value, key, object)); }); return result; } /** * This method is like `_.assign` except that it recursively merges own and * inherited enumerable string keyed properties of source objects into the * destination object. Source properties that resolve to `undefined` are * skipped if a destination value exists. Array and plain object properties * are merged recursively. Other objects and value types are overridden by * assignment. Source objects are applied from left to right. Subsequent * sources overwrite property assignments of previous sources. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 0.5.0 * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @example * * var object = { * 'a': [{ 'b': 2 }, { 'd': 4 }] * }; * * var other = { * 'a': [{ 'c': 3 }, { 'e': 5 }] * }; * * _.merge(object, other); * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } */ var merge = createAssigner(function(object, source, srcIndex) { baseMerge(object, source, srcIndex); }); /** * This method is like `_.merge` except that it accepts `customizer` which * is invoked to produce the merged values of the destination and source * properties. If `customizer` returns `undefined`, merging is handled by the * method instead. The `customizer` is invoked with six arguments: * (objValue, srcValue, key, object, source, stack). * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The destination object. * @param {...Object} sources The source objects. * @param {Function} customizer The function to customize assigned values. * @returns {Object} Returns `object`. * @example * * function customizer(objValue, srcValue) { * if (_.isArray(objValue)) { * return objValue.concat(srcValue); * } * } * * var object = { 'a': [1], 'b': [2] }; * var other = { 'a': [3], 'b': [4] }; * * _.mergeWith(object, other, customizer); * // => { 'a': [1, 3], 'b': [2, 4] } */ var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { baseMerge(object, source, srcIndex, customizer); }); /** * The opposite of `_.pick`; this method creates an object composed of the * own and inherited enumerable property paths of `object` that are not omitted. * * **Note:** This method is considerably slower than `_.pick`. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The source object. * @param {...(string|string[])} [paths] The property paths to omit. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': '2', 'c': 3 }; * * _.omit(object, ['a', 'c']); * // => { 'b': '2' } */ var omit = flatRest(function(object, paths) { var result = {}; if (object == null) { return result; } var isDeep = false; paths = arrayMap(paths, function(path) { path = castPath(path, object); isDeep || (isDeep = path.length > 1); return path; }); copyObject(object, getAllKeysIn(object), result); if (isDeep) { result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); } var length = paths.length; while (length--) { baseUnset(result, paths[length]); } return result; }); /** * The opposite of `_.pickBy`; this method creates an object composed of * the own and inherited enumerable string keyed properties of `object` that * `predicate` doesn't return truthy for. The predicate is invoked with two * arguments: (value, key). * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The source object. * @param {Function} [predicate=_.identity] The function invoked per property. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': '2', 'c': 3 }; * * _.omitBy(object, _.isNumber); * // => { 'b': '2' } */ function omitBy(object, predicate) { return pickBy(object, negate(getIteratee(predicate))); } /** * Creates an object composed of the picked `object` properties. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The source object. * @param {...(string|string[])} [paths] The property paths to pick. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': '2', 'c': 3 }; * * _.pick(object, ['a', 'c']); * // => { 'a': 1, 'c': 3 } */ var pick = flatRest(function(object, paths) { return object == null ? {} : basePick(object, paths); }); /** * Creates an object composed of the `object` properties `predicate` returns * truthy for. The predicate is invoked with two arguments: (value, key). * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The source object. * @param {Function} [predicate=_.identity] The function invoked per property. * @returns {Object} Returns the new object. * @example * * var object = { 'a': 1, 'b': '2', 'c': 3 }; * * _.pickBy(object, _.isNumber); * // => { 'a': 1, 'c': 3 } */ function pickBy(object, predicate) { if (object == null) { return {}; } var props = arrayMap(getAllKeysIn(object), function(prop) { return [prop]; }); predicate = getIteratee(predicate); return basePickBy(object, props, function(value, path) { return predicate(value, path[0]); }); } /** * This method is like `_.get` except that if the resolved value is a * function it's invoked with the `this` binding of its parent object and * its result is returned. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to resolve. * @param {*} [defaultValue] The value returned for `undefined` resolved values. * @returns {*} Returns the resolved value. * @example * * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; * * _.result(object, 'a[0].b.c1'); * // => 3 * * _.result(object, 'a[0].b.c2'); * // => 4 * * _.result(object, 'a[0].b.c3', 'default'); * // => 'default' * * _.result(object, 'a[0].b.c3', _.constant('default')); * // => 'default' */ function result(object, path, defaultValue) { path = castPath(path, object); var index = -1, length = path.length; // Ensure the loop is entered when path is empty. if (!length) { length = 1; object = undefined; } while (++index < length) { var value = object == null ? undefined : object[toKey(path[index])]; if (value === undefined) { index = length; value = defaultValue; } object = isFunction(value) ? value.call(object) : value; } return object; } /** * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, * it's created. Arrays are created for missing index properties while objects * are created for all other missing properties. Use `_.setWith` to customize * `path` creation. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 3.7.0 * @category Object * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. * @param {*} value The value to set. * @returns {Object} Returns `object`. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }] }; * * _.set(object, 'a[0].b.c', 4); * console.log(object.a[0].b.c); * // => 4 * * _.set(object, ['x', '0', 'y', 'z'], 5); * console.log(object.x[0].y.z); * // => 5 */ function set(object, path, value) { return object == null ? object : baseSet(object, path, value); } /** * This method is like `_.set` except that it accepts `customizer` which is * invoked to produce the objects of `path`. If `customizer` returns `undefined` * path creation is handled by the method instead. The `customizer` is invoked * with three arguments: (nsValue, key, nsObject). * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. * @param {*} value The value to set. * @param {Function} [customizer] The function to customize assigned values. * @returns {Object} Returns `object`. * @example * * var object = {}; * * _.setWith(object, '[0][1]', 'a', Object); * // => { '0': { '1': 'a' } } */ function setWith(object, path, value, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined; return object == null ? object : baseSet(object, path, value, customizer); } /** * Creates an array of own enumerable string keyed-value pairs for `object` * which can be consumed by `_.fromPairs`. If `object` is a map or set, its * entries are returned. * * @static * @memberOf _ * @since 4.0.0 * @alias entries * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the key-value pairs. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.toPairs(new Foo); * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) */ var toPairs = createToPairs(keys); /** * Creates an array of own and inherited enumerable string keyed-value pairs * for `object` which can be consumed by `_.fromPairs`. If `object` is a map * or set, its entries are returned. * * @static * @memberOf _ * @since 4.0.0 * @alias entriesIn * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the key-value pairs. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.toPairsIn(new Foo); * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed) */ var toPairsIn = createToPairs(keysIn); /** * An alternative to `_.reduce`; this method transforms `object` to a new * `accumulator` object which is the result of running each of its own * enumerable string keyed properties thru `iteratee`, with each invocation * potentially mutating the `accumulator` object. If `accumulator` is not * provided, a new object with the same `[[Prototype]]` will be used. The * iteratee is invoked with four arguments: (accumulator, value, key, object). * Iteratee functions may exit iteration early by explicitly returning `false`. * * @static * @memberOf _ * @since 1.3.0 * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The custom accumulator value. * @returns {*} Returns the accumulated value. * @example * * _.transform([2, 3, 4], function(result, n) { * result.push(n *= n); * return n % 2 == 0; * }, []); * // => [4, 9] * * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { * (result[value] || (result[value] = [])).push(key); * }, {}); * // => { '1': ['a', 'c'], '2': ['b'] } */ function transform(object, iteratee, accumulator) { var isArr = isArray(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object); iteratee = getIteratee(iteratee, 4); if (accumulator == null) { var Ctor = object && object.constructor; if (isArrLike) { accumulator = isArr ? new Ctor : []; } else if (isObject(object)) { accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; } else { accumulator = {}; } } (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) { return iteratee(accumulator, value, index, object); }); return accumulator; } /** * Removes the property at `path` of `object`. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 4.0.0 * @category Object * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to unset. * @returns {boolean} Returns `true` if the property is deleted, else `false`. * @example * * var object = { 'a': [{ 'b': { 'c': 7 } }] }; * _.unset(object, 'a[0].b.c'); * // => true * * console.log(object); * // => { 'a': [{ 'b': {} }] }; * * _.unset(object, ['a', '0', 'b', 'c']); * // => true * * console.log(object); * // => { 'a': [{ 'b': {} }] }; */ function unset(object, path) { return object == null ? true : baseUnset(object, path); } /** * This method is like `_.set` except that accepts `updater` to produce the * value to set. Use `_.updateWith` to customize `path` creation. The `updater` * is invoked with one argument: (value). * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 4.6.0 * @category Object * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. * @param {Function} updater The function to produce the updated value. * @returns {Object} Returns `object`. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }] }; * * _.update(object, 'a[0].b.c', function(n) { return n * n; }); * console.log(object.a[0].b.c); * // => 9 * * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; }); * console.log(object.x[0].y.z); * // => 0 */ function update(object, path, updater) { return object == null ? object : baseUpdate(object, path, castFunction(updater)); } /** * This method is like `_.update` except that it accepts `customizer` which is * invoked to produce the objects of `path`. If `customizer` returns `undefined` * path creation is handled by the method instead. The `customizer` is invoked * with three arguments: (nsValue, key, nsObject). * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 4.6.0 * @category Object * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. * @param {Function} updater The function to produce the updated value. * @param {Function} [customizer] The function to customize assigned values. * @returns {Object} Returns `object`. * @example * * var object = {}; * * _.updateWith(object, '[0][1]', _.constant('a'), Object); * // => { '0': { '1': 'a' } } */ function updateWith(object, path, updater, customizer) { customizer = typeof customizer == 'function' ? customizer : undefined; return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); } /** * Creates an array of the own enumerable string keyed property values of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property values. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.values(new Foo); * // => [1, 2] (iteration order is not guaranteed) * * _.values('hi'); * // => ['h', 'i'] */ function values(object) { return object == null ? [] : baseValues(object, keys(object)); } /** * Creates an array of the own and inherited enumerable string keyed property * values of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ * @since 3.0.0 * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property values. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.valuesIn(new Foo); * // => [1, 2, 3] (iteration order is not guaranteed) */ function valuesIn(object) { return object == null ? [] : baseValues(object, keysIn(object)); } /*------------------------------------------------------------------------*/ /** * Clamps `number` within the inclusive `lower` and `upper` bounds. * * @static * @memberOf _ * @since 4.0.0 * @category Number * @param {number} number The number to clamp. * @param {number} [lower] The lower bound. * @param {number} upper The upper bound. * @returns {number} Returns the clamped number. * @example * * _.clamp(-10, -5, 5); * // => -5 * * _.clamp(10, -5, 5); * // => 5 */ function clamp(number, lower, upper) { if (upper === undefined) { upper = lower; lower = undefined; } if (upper !== undefined) { upper = toNumber(upper); upper = upper === upper ? upper : 0; } if (lower !== undefined) { lower = toNumber(lower); lower = lower === lower ? lower : 0; } return baseClamp(toNumber(number), lower, upper); } /** * Checks if `n` is between `start` and up to, but not including, `end`. If * `end` is not specified, it's set to `start` with `start` then set to `0`. * If `start` is greater than `end` the params are swapped to support * negative ranges. * * @static * @memberOf _ * @since 3.3.0 * @category Number * @param {number} number The number to check. * @param {number} [start=0] The start of the range. * @param {number} end The end of the range. * @returns {boolean} Returns `true` if `number` is in the range, else `false`. * @see _.range, _.rangeRight * @example * * _.inRange(3, 2, 4); * // => true * * _.inRange(4, 8); * // => true * * _.inRange(4, 2); * // => false * * _.inRange(2, 2); * // => false * * _.inRange(1.2, 2); * // => true * * _.inRange(5.2, 4); * // => false * * _.inRange(-3, -2, -6); * // => true */ function inRange(number, start, end) { start = toFinite(start); if (end === undefined) { end = start; start = 0; } else { end = toFinite(end); } number = toNumber(number); return baseInRange(number, start, end); } /** * Produces a random number between the inclusive `lower` and `upper` bounds. * If only one argument is provided a number between `0` and the given number * is returned. If `floating` is `true`, or either `lower` or `upper` are * floats, a floating-point number is returned instead of an integer. * * **Note:** JavaScript follows the IEEE-754 standard for resolving * floating-point values which can produce unexpected results. * * @static * @memberOf _ * @since 0.7.0 * @category Number * @param {number} [lower=0] The lower bound. * @param {number} [upper=1] The upper bound. * @param {boolean} [floating] Specify returning a floating-point number. * @returns {number} Returns the random number. * @example * * _.random(0, 5); * // => an integer between 0 and 5 * * _.random(5); * // => also an integer between 0 and 5 * * _.random(5, true); * // => a floating-point number between 0 and 5 * * _.random(1.2, 5.2); * // => a floating-point number between 1.2 and 5.2 */ function random(lower, upper, floating) { if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) { upper = floating = undefined; } if (floating === undefined) { if (typeof upper == 'boolean') { floating = upper; upper = undefined; } else if (typeof lower == 'boolean') { floating = lower; lower = undefined; } } if (lower === undefined && upper === undefined) { lower = 0; upper = 1; } else { lower = toFinite(lower); if (upper === undefined) { upper = lower; lower = 0; } else { upper = toFinite(upper); } } if (lower > upper) { var temp = lower; lower = upper; upper = temp; } if (floating || lower % 1 || upper % 1) { var rand = nativeRandom(); return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper); } return baseRandom(lower, upper); } /*------------------------------------------------------------------------*/ /** * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the camel cased string. * @example * * _.camelCase('Foo Bar'); * // => 'fooBar' * * _.camelCase('--foo-bar--'); * // => 'fooBar' * * _.camelCase('__FOO_BAR__'); * // => 'fooBar' */ var camelCase = createCompounder(function(result, word, index) { word = word.toLowerCase(); return result + (index ? capitalize(word) : word); }); /** * Converts the first character of `string` to upper case and the remaining * to lower case. * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to capitalize. * @returns {string} Returns the capitalized string. * @example * * _.capitalize('FRED'); * // => 'Fred' */ function capitalize(string) { return upperFirst(toString(string).toLowerCase()); } /** * Deburrs `string` by converting * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) * letters to basic Latin letters and removing * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to deburr. * @returns {string} Returns the deburred string. * @example * * _.deburr('déjà vu'); * // => 'deja vu' */ function deburr(string) { string = toString(string); return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); } /** * Checks if `string` ends with the given target string. * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to inspect. * @param {string} [target] The string to search for. * @param {number} [position=string.length] The position to search up to. * @returns {boolean} Returns `true` if `string` ends with `target`, * else `false`. * @example * * _.endsWith('abc', 'c'); * // => true * * _.endsWith('abc', 'b'); * // => false * * _.endsWith('abc', 'b', 2); * // => true */ function endsWith(string, target, position) { string = toString(string); target = baseToString(target); var length = string.length; position = position === undefined ? length : baseClamp(toInteger(position), 0, length); var end = position; position -= target.length; return position >= 0 && string.slice(position, end) == target; } /** * Converts the characters "&", "<", ">", '"', and "'" in `string` to their * corresponding HTML entities. * * **Note:** No other characters are escaped. To escape additional * characters use a third-party library like [_he_](https://mths.be/he). * * Though the ">" character is escaped for symmetry, characters like * ">" and "/" don't need escaping in HTML and have no special meaning * unless they're part of a tag or unquoted attribute value. See * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) * (under "semi-related fun fact") for more details. * * When working with HTML you should always * [quote attribute values](http://wonko.com/post/html-escaping) to reduce * XSS vectors. * * @static * @since 0.1.0 * @memberOf _ * @category String * @param {string} [string=''] The string to escape. * @returns {string} Returns the escaped string. * @example * * _.escape('fred, barney, & pebbles'); * // => 'fred, barney, &amp; pebbles' */ function escape(string) { string = toString(string); return (string && reHasUnescapedHtml.test(string)) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string; } /** * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to escape. * @returns {string} Returns the escaped string. * @example * * _.escapeRegExp('[lodash](https://lodash.com/)'); * // => '\[lodash\]\(https://lodash\.com/\)' */ function escapeRegExp(string) { string = toString(string); return (string && reHasRegExpChar.test(string)) ? string.replace(reRegExpChar, '\\$&') : string; } /** * Converts `string` to * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the kebab cased string. * @example * * _.kebabCase('Foo Bar'); * // => 'foo-bar' * * _.kebabCase('fooBar'); * // => 'foo-bar' * * _.kebabCase('__FOO_BAR__'); * // => 'foo-bar' */ var kebabCase = createCompounder(function(result, word, index) { return result + (index ? '-' : '') + word.toLowerCase(); }); /** * Converts `string`, as space separated words, to lower case. * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the lower cased string. * @example * * _.lowerCase('--Foo-Bar--'); * // => 'foo bar' * * _.lowerCase('fooBar'); * // => 'foo bar' * * _.lowerCase('__FOO_BAR__'); * // => 'foo bar' */ var lowerCase = createCompounder(function(result, word, index) { return result + (index ? ' ' : '') + word.toLowerCase(); }); /** * Converts the first character of `string` to lower case. * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the converted string. * @example * * _.lowerFirst('Fred'); * // => 'fred' * * _.lowerFirst('FRED'); * // => 'fRED' */ var lowerFirst = createCaseFirst('toLowerCase'); /** * Pads `string` on the left and right sides if it's shorter than `length`. * Padding characters are truncated if they can't be evenly divided by `length`. * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to pad. * @param {number} [length=0] The padding length. * @param {string} [chars=' '] The string used as padding. * @returns {string} Returns the padded string. * @example * * _.pad('abc', 8); * // => ' abc ' * * _.pad('abc', 8, '_-'); * // => '_-abc_-_' * * _.pad('abc', 3); * // => 'abc' */ function pad(string, length, chars) { string = toString(string); length = toInteger(length); var strLength = length ? stringSize(string) : 0; if (!length || strLength >= length) { return string; } var mid = (length - strLength) / 2; return ( createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars) ); } /** * Pads `string` on the right side if it's shorter than `length`. Padding * characters are truncated if they exceed `length`. * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to pad. * @param {number} [length=0] The padding length. * @param {string} [chars=' '] The string used as padding. * @returns {string} Returns the padded string. * @example * * _.padEnd('abc', 6); * // => 'abc ' * * _.padEnd('abc', 6, '_-'); * // => 'abc_-_' * * _.padEnd('abc', 3); * // => 'abc' */ function padEnd(string, length, chars) { string = toString(string); length = toInteger(length); var strLength = length ? stringSize(string) : 0; return (length && strLength < length) ? (string + createPadding(length - strLength, chars)) : string; } /** * Pads `string` on the left side if it's shorter than `length`. Padding * characters are truncated if they exceed `length`. * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to pad. * @param {number} [length=0] The padding length. * @param {string} [chars=' '] The string used as padding. * @returns {string} Returns the padded string. * @example * * _.padStart('abc', 6); * // => ' abc' * * _.padStart('abc', 6, '_-'); * // => '_-_abc' * * _.padStart('abc', 3); * // => 'abc' */ function padStart(string, length, chars) { string = toString(string); length = toInteger(length); var strLength = length ? stringSize(string) : 0; return (length && strLength < length) ? (createPadding(length - strLength, chars) + string) : string; } /** * Converts `string` to an integer of the specified radix. If `radix` is * `undefined` or `0`, a `radix` of `10` is used unless `value` is a * hexadecimal, in which case a `radix` of `16` is used. * * **Note:** This method aligns with the * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`. * * @static * @memberOf _ * @since 1.1.0 * @category String * @param {string} string The string to convert. * @param {number} [radix=10] The radix to interpret `value` by. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {number} Returns the converted integer. * @example * * _.parseInt('08'); * // => 8 * * _.map(['6', '08', '10'], _.parseInt); * // => [6, 8, 10] */ function parseInt(string, radix, guard) { if (guard || radix == null) { radix = 0; } else if (radix) { radix = +radix; } return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0); } /** * Repeats the given string `n` times. * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to repeat. * @param {number} [n=1] The number of times to repeat the string. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {string} Returns the repeated string. * @example * * _.repeat('*', 3); * // => '***' * * _.repeat('abc', 2); * // => 'abcabc' * * _.repeat('abc', 0); * // => '' */ function repeat(string, n, guard) { if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) { n = 1; } else { n = toInteger(n); } return baseRepeat(toString(string), n); } /** * Replaces matches for `pattern` in `string` with `replacement`. * * **Note:** This method is based on * [`String#replace`](https://mdn.io/String/replace). * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to modify. * @param {RegExp|string} pattern The pattern to replace. * @param {Function|string} replacement The match replacement. * @returns {string} Returns the modified string. * @example * * _.replace('Hi Fred', 'Fred', 'Barney'); * // => 'Hi Barney' */ function replace() { var args = arguments, string = toString(args[0]); return args.length < 3 ? string : string.replace(args[1], args[2]); } /** * Converts `string` to * [snake case](https://en.wikipedia.org/wiki/Snake_case). * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the snake cased string. * @example * * _.snakeCase('Foo Bar'); * // => 'foo_bar' * * _.snakeCase('fooBar'); * // => 'foo_bar' * * _.snakeCase('--FOO-BAR--'); * // => 'foo_bar' */ var snakeCase = createCompounder(function(result, word, index) { return result + (index ? '_' : '') + word.toLowerCase(); }); /** * Splits `string` by `separator`. * * **Note:** This method is based on * [`String#split`](https://mdn.io/String/split). * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to split. * @param {RegExp|string} separator The separator pattern to split by. * @param {number} [limit] The length to truncate results to. * @returns {Array} Returns the string segments. * @example * * _.split('a-b-c', '-', 2); * // => ['a', 'b'] */ function split(string, separator, limit) { if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) { separator = limit = undefined; } limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0; if (!limit) { return []; } string = toString(string); if (string && ( typeof separator == 'string' || (separator != null && !isRegExp(separator)) )) { separator = baseToString(separator); if (!separator && hasUnicode(string)) { return castSlice(stringToArray(string), 0, limit); } } return string.split(separator, limit); } /** * Converts `string` to * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). * * @static * @memberOf _ * @since 3.1.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the start cased string. * @example * * _.startCase('--foo-bar--'); * // => 'Foo Bar' * * _.startCase('fooBar'); * // => 'Foo Bar' * * _.startCase('__FOO_BAR__'); * // => 'FOO BAR' */ var startCase = createCompounder(function(result, word, index) { return result + (index ? ' ' : '') + upperFirst(word); }); /** * Checks if `string` starts with the given target string. * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to inspect. * @param {string} [target] The string to search for. * @param {number} [position=0] The position to search from. * @returns {boolean} Returns `true` if `string` starts with `target`, * else `false`. * @example * * _.startsWith('abc', 'a'); * // => true * * _.startsWith('abc', 'b'); * // => false * * _.startsWith('abc', 'b', 1); * // => true */ function startsWith(string, target, position) { string = toString(string); position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length); target = baseToString(target); return string.slice(position, position + target.length) == target; } /** * Creates a compiled template function that can interpolate data properties * in "interpolate" delimiters, HTML-escape interpolated data properties in * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data * properties may be accessed as free variables in the template. If a setting * object is given, it takes precedence over `_.templateSettings` values. * * **Note:** In the development build `_.template` utilizes * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) * for easier debugging. * * For more information on precompiling templates see * [lodash's custom builds documentation](https://lodash.com/custom-builds). * * For more information on Chrome extension sandboxes see * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). * * @static * @since 0.1.0 * @memberOf _ * @category String * @param {string} [string=''] The template string. * @param {Object} [options={}] The options object. * @param {RegExp} [options.escape=_.templateSettings.escape] * The HTML "escape" delimiter. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate] * The "evaluate" delimiter. * @param {Object} [options.imports=_.templateSettings.imports] * An object to import into the template as free variables. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate] * The "interpolate" delimiter. * @param {string} [options.sourceURL='lodash.templateSources[n]'] * The sourceURL of the compiled template. * @param {string} [options.variable='obj'] * The data object variable name. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Function} Returns the compiled template function. * @example * * // Use the "interpolate" delimiter to create a compiled template. * var compiled = _.template('hello <%= user %>!'); * compiled({ 'user': 'fred' }); * // => 'hello fred!' * * // Use the HTML "escape" delimiter to escape data property values. * var compiled = _.template('<b><%- value %></b>'); * compiled({ 'value': '<script>' }); * // => '<b>&lt;script&gt;</b>' * * // Use the "evaluate" delimiter to execute JavaScript and generate HTML. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>'); * compiled({ 'users': ['fred', 'barney'] }); * // => '<li>fred</li><li>barney</li>' * * // Use the internal `print` function in "evaluate" delimiters. * var compiled = _.template('<% print("hello " + user); %>!'); * compiled({ 'user': 'barney' }); * // => 'hello barney!' * * // Use the ES template literal delimiter as an "interpolate" delimiter. * // Disable support by replacing the "interpolate" delimiter. * var compiled = _.template('hello ${ user }!'); * compiled({ 'user': 'pebbles' }); * // => 'hello pebbles!' * * // Use backslashes to treat delimiters as plain text. * var compiled = _.template('<%= "\\<%- value %\\>" %>'); * compiled({ 'value': 'ignored' }); * // => '<%- value %>' * * // Use the `imports` option to import `jQuery` as `jq`. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>'; * var compiled = _.template(text, { 'imports': { 'jq': jQuery } }); * compiled({ 'users': ['fred', 'barney'] }); * // => '<li>fred</li><li>barney</li>' * * // Use the `sourceURL` option to specify a custom sourceURL for the template. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' }); * compiled(data); * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector. * * // Use the `variable` option to ensure a with-statement isn't used in the compiled template. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' }); * compiled.source; * // => function(data) { * // var __t, __p = ''; * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!'; * // return __p; * // } * * // Use custom template delimiters. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g; * var compiled = _.template('hello {{ user }}!'); * compiled({ 'user': 'mustache' }); * // => 'hello mustache!' * * // Use the `source` property to inline compiled templates for meaningful * // line numbers in error messages and stack traces. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\ * var JST = {\ * "main": ' + _.template(mainText).source + '\ * };\ * '); */ function template(string, options, guard) { // Based on John Resig's `tmpl` implementation // (http://ejohn.org/blog/javascript-micro-templating/) // and Laura Doktorova's doT.js (https://github.com/olado/doT). var settings = lodash.templateSettings; if (guard && isIterateeCall(string, options, guard)) { options = undefined; } string = toString(string); options = assignInWith({}, options, settings, customDefaultsAssignIn); var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys); var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '"; // Compile the regexp to match each delimiter. var reDelimiters = RegExp( (options.escape || reNoMatch).source + '|' + interpolate.source + '|' + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' + (options.evaluate || reNoMatch).source + '|$' , 'g'); // Use a sourceURL for easier debugging. // The sourceURL gets injected into the source that's eval-ed, so be careful // with lookup (in case of e.g. prototype pollution), and strip newlines if any. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection. var sourceURL = '//# sourceURL=' + (hasOwnProperty.call(options, 'sourceURL') ? (options.sourceURL + '').replace(/[\r\n]/g, ' ') : ('lodash.templateSources[' + (++templateCounter) + ']') ) + '\n'; string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { interpolateValue || (interpolateValue = esTemplateValue); // Escape characters that can't be included in string literals. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar); // Replace delimiters with snippets. if (escapeValue) { isEscaping = true; source += "' +\n__e(" + escapeValue + ") +\n'"; } if (evaluateValue) { isEvaluating = true; source += "';\n" + evaluateValue + ";\n__p += '"; } if (interpolateValue) { source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'"; } index = offset + match.length; // The JS engine embedded in Adobe products needs `match` returned in // order to produce the correct `offset` value. return match; }); source += "';\n"; // If `variable` is not specified wrap a with-statement around the generated // code to add the data object to the top of the scope chain. // Like with sourceURL, we take care to not check the option's prototype, // as this configuration is a code injection vector. var variable = hasOwnProperty.call(options, 'variable') && options.variable; if (!variable) { source = 'with (obj) {\n' + source + '\n}\n'; } // Cleanup code by stripping empty strings. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source) .replace(reEmptyStringMiddle, '$1') .replace(reEmptyStringTrailing, '$1;'); // Frame code as the function body. source = 'function(' + (variable || 'obj') + ') {\n' + (variable ? '' : 'obj || (obj = {});\n' ) + "var __t, __p = ''" + (isEscaping ? ', __e = _.escape' : '' ) + (isEvaluating ? ', __j = Array.prototype.join;\n' + "function print() { __p += __j.call(arguments, '') }\n" : ';\n' ) + source + 'return __p\n}'; var result = attempt(function() { return Function(importsKeys, sourceURL + 'return ' + source) .apply(undefined, importsValues); }); // Provide the compiled function's source by its `toString` method or // the `source` property as a convenience for inlining compiled templates. result.source = source; if (isError(result)) { throw result; } return result; } /** * Converts `string`, as a whole, to lower case just like * [String#toLowerCase](https://mdn.io/toLowerCase). * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the lower cased string. * @example * * _.toLower('--Foo-Bar--'); * // => '--foo-bar--' * * _.toLower('fooBar'); * // => 'foobar' * * _.toLower('__FOO_BAR__'); * // => '__foo_bar__' */ function toLower(value) { return toString(value).toLowerCase(); } /** * Converts `string`, as a whole, to upper case just like * [String#toUpperCase](https://mdn.io/toUpperCase). * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the upper cased string. * @example * * _.toUpper('--foo-bar--'); * // => '--FOO-BAR--' * * _.toUpper('fooBar'); * // => 'FOOBAR' * * _.toUpper('__foo_bar__'); * // => '__FOO_BAR__' */ function toUpper(value) { return toString(value).toUpperCase(); } /** * Removes leading and trailing whitespace or specified characters from `string`. * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The characters to trim. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {string} Returns the trimmed string. * @example * * _.trim(' abc '); * // => 'abc' * * _.trim('-_-abc-_-', '_-'); * // => 'abc' * * _.map([' foo ', ' bar '], _.trim); * // => ['foo', 'bar'] */ function trim(string, chars, guard) { string = toString(string); if (string && (guard || chars === undefined)) { return string.replace(reTrim, ''); } if (!string || !(chars = baseToString(chars))) { return string; } var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1; return castSlice(strSymbols, start, end).join(''); } /** * Removes trailing whitespace or specified characters from `string`. * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The characters to trim. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {string} Returns the trimmed string. * @example * * _.trimEnd(' abc '); * // => ' abc' * * _.trimEnd('-_-abc-_-', '_-'); * // => '-_-abc' */ function trimEnd(string, chars, guard) { string = toString(string); if (string && (guard || chars === undefined)) { return string.replace(reTrimEnd, ''); } if (!string || !(chars = baseToString(chars))) { return string; } var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1; return castSlice(strSymbols, 0, end).join(''); } /** * Removes leading whitespace or specified characters from `string`. * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The characters to trim. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {string} Returns the trimmed string. * @example * * _.trimStart(' abc '); * // => 'abc ' * * _.trimStart('-_-abc-_-', '_-'); * // => 'abc-_-' */ function trimStart(string, chars, guard) { string = toString(string); if (string && (guard || chars === undefined)) { return string.replace(reTrimStart, ''); } if (!string || !(chars = baseToString(chars))) { return string; } var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars)); return castSlice(strSymbols, start).join(''); } /** * Truncates `string` if it's longer than the given maximum string length. * The last characters of the truncated string are replaced with the omission * string which defaults to "...". * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to truncate. * @param {Object} [options={}] The options object. * @param {number} [options.length=30] The maximum string length. * @param {string} [options.omission='...'] The string to indicate text is omitted. * @param {RegExp|string} [options.separator] The separator pattern to truncate to. * @returns {string} Returns the truncated string. * @example * * _.truncate('hi-diddly-ho there, neighborino'); * // => 'hi-diddly-ho there, neighbo...' * * _.truncate('hi-diddly-ho there, neighborino', { * 'length': 24, * 'separator': ' ' * }); * // => 'hi-diddly-ho there,...' * * _.truncate('hi-diddly-ho there, neighborino', { * 'length': 24, * 'separator': /,? +/ * }); * // => 'hi-diddly-ho there...' * * _.truncate('hi-diddly-ho there, neighborino', { * 'omission': ' [...]' * }); * // => 'hi-diddly-ho there, neig [...]' */ function truncate(string, options) { var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION; if (isObject(options)) { var separator = 'separator' in options ? options.separator : separator; length = 'length' in options ? toInteger(options.length) : length; omission = 'omission' in options ? baseToString(options.omission) : omission; } string = toString(string); var strLength = string.length; if (hasUnicode(string)) { var strSymbols = stringToArray(string); strLength = strSymbols.length; } if (length >= strLength) { return string; } var end = length - stringSize(omission); if (end < 1) { return omission; } var result = strSymbols ? castSlice(strSymbols, 0, end).join('') : string.slice(0, end); if (separator === undefined) { return result + omission; } if (strSymbols) { end += (result.length - end); } if (isRegExp(separator)) { if (string.slice(end).search(separator)) { var match, substring = result; if (!separator.global) { separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g'); } separator.lastIndex = 0; while ((match = separator.exec(substring))) { var newEnd = match.index; } result = result.slice(0, newEnd === undefined ? end : newEnd); } } else if (string.indexOf(baseToString(separator), end) != end) { var index = result.lastIndexOf(separator); if (index > -1) { result = result.slice(0, index); } } return result + omission; } /** * The inverse of `_.escape`; this method converts the HTML entities * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to * their corresponding characters. * * **Note:** No other HTML entities are unescaped. To unescape additional * HTML entities use a third-party library like [_he_](https://mths.be/he). * * @static * @memberOf _ * @since 0.6.0 * @category String * @param {string} [string=''] The string to unescape. * @returns {string} Returns the unescaped string. * @example * * _.unescape('fred, barney, &amp; pebbles'); * // => 'fred, barney, & pebbles' */ function unescape(string) { string = toString(string); return (string && reHasEscapedHtml.test(string)) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string; } /** * Converts `string`, as space separated words, to upper case. * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the upper cased string. * @example * * _.upperCase('--foo-bar'); * // => 'FOO BAR' * * _.upperCase('fooBar'); * // => 'FOO BAR' * * _.upperCase('__foo_bar__'); * // => 'FOO BAR' */ var upperCase = createCompounder(function(result, word, index) { return result + (index ? ' ' : '') + word.toUpperCase(); }); /** * Converts the first character of `string` to upper case. * * @static * @memberOf _ * @since 4.0.0 * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the converted string. * @example * * _.upperFirst('fred'); * // => 'Fred' * * _.upperFirst('FRED'); * // => 'FRED' */ var upperFirst = createCaseFirst('toUpperCase'); /** * Splits `string` into an array of its words. * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to inspect. * @param {RegExp|string} [pattern] The pattern to match words. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. * @returns {Array} Returns the words of `string`. * @example * * _.words('fred, barney, & pebbles'); * // => ['fred', 'barney', 'pebbles'] * * _.words('fred, barney, & pebbles', /[^, ]+/g); * // => ['fred', 'barney', '&', 'pebbles'] */ function words(string, pattern, guard) { string = toString(string); pattern = guard ? undefined : pattern; if (pattern === undefined) { return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); } return string.match(pattern) || []; } /*------------------------------------------------------------------------*/ /** * Attempts to invoke `func`, returning either the result or the caught error * object. Any additional arguments are provided to `func` when it's invoked. * * @static * @memberOf _ * @since 3.0.0 * @category Util * @param {Function} func The function to attempt. * @param {...*} [args] The arguments to invoke `func` with. * @returns {*} Returns the `func` result or error object. * @example * * // Avoid throwing errors for invalid selectors. * var elements = _.attempt(function(selector) { * return document.querySelectorAll(selector); * }, '>_>'); * * if (_.isError(elements)) { * elements = []; * } */ var attempt = baseRest(function(func, args) { try { return apply(func, undefined, args); } catch (e) { return isError(e) ? e : new Error(e); } }); /** * Binds methods of an object to the object itself, overwriting the existing * method. * * **Note:** This method doesn't set the "length" property of bound functions. * * @static * @since 0.1.0 * @memberOf _ * @category Util * @param {Object} object The object to bind and assign the bound methods to. * @param {...(string|string[])} methodNames The object method names to bind. * @returns {Object} Returns `object`. * @example * * var view = { * 'label': 'docs', * 'click': function() { * console.log('clicked ' + this.label); * } * }; * * _.bindAll(view, ['click']); * jQuery(element).on('click', view.click); * // => Logs 'clicked docs' when clicked. */ var bindAll = flatRest(function(object, methodNames) { arrayEach(methodNames, function(key) { key = toKey(key); baseAssignValue(object, key, bind(object[key], object)); }); return object; }); /** * Creates a function that iterates over `pairs` and invokes the corresponding * function of the first predicate to return truthy. The predicate-function * pairs are invoked with the `this` binding and arguments of the created * function. * * @static * @memberOf _ * @since 4.0.0 * @category Util * @param {Array} pairs The predicate-function pairs. * @returns {Function} Returns the new composite function. * @example * * var func = _.cond([ * [_.matches({ 'a': 1 }), _.constant('matches A')], * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')], * [_.stubTrue, _.constant('no match')] * ]); * * func({ 'a': 1, 'b': 2 }); * // => 'matches A' * * func({ 'a': 0, 'b': 1 }); * // => 'matches B' * * func({ 'a': '1', 'b': '2' }); * // => 'no match' */ function cond(pairs) { var length = pairs == null ? 0 : pairs.length, toIteratee = getIteratee(); pairs = !length ? [] : arrayMap(pairs, function(pair) { if (typeof pair[1] != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } return [toIteratee(pair[0]), pair[1]]; }); return baseRest(function(args) { var index = -1; while (++index < length) { var pair = pairs[index]; if (apply(pair[0], this, args)) { return apply(pair[1], this, args); } } }); } /** * Creates a function that invokes the predicate properties of `source` with * the corresponding property values of a given object, returning `true` if * all predicates return truthy, else `false`. * * **Note:** The created function is equivalent to `_.conformsTo` with * `source` partially applied. * * @static * @memberOf _ * @since 4.0.0 * @category Util * @param {Object} source The object of property predicates to conform to. * @returns {Function} Returns the new spec function. * @example * * var objects = [ * { 'a': 2, 'b': 1 }, * { 'a': 1, 'b': 2 } * ]; * * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } })); * // => [{ 'a': 1, 'b': 2 }] */ function conforms(source) { return baseConforms(baseClone(source, CLONE_DEEP_FLAG)); } /** * Creates a function that returns `value`. * * @static * @memberOf _ * @since 2.4.0 * @category Util * @param {*} value The value to return from the new function. * @returns {Function} Returns the new constant function. * @example * * var objects = _.times(2, _.constant({ 'a': 1 })); * * console.log(objects); * // => [{ 'a': 1 }, { 'a': 1 }] * * console.log(objects[0] === objects[1]); * // => true */ function constant(value) { return function() { return value; }; } /** * Checks `value` to determine whether a default value should be returned in * its place. The `defaultValue` is returned if `value` is `NaN`, `null`, * or `undefined`. * * @static * @memberOf _ * @since 4.14.0 * @category Util * @param {*} value The value to check. * @param {*} defaultValue The default value. * @returns {*} Returns the resolved value. * @example * * _.defaultTo(1, 10); * // => 1 * * _.defaultTo(undefined, 10); * // => 10 */ function defaultTo(value, defaultValue) { return (value == null || value !== value) ? defaultValue : value; } /** * Creates a function that returns the result of invoking the given functions * with the `this` binding of the created function, where each successive * invocation is supplied the return value of the previous. * * @static * @memberOf _ * @since 3.0.0 * @category Util * @param {...(Function|Function[])} [funcs] The functions to invoke. * @returns {Function} Returns the new composite function. * @see _.flowRight * @example * * function square(n) { * return n * n; * } * * var addSquare = _.flow([_.add, square]); * addSquare(1, 2); * // => 9 */ var flow = createFlow(); /** * This method is like `_.flow` except that it creates a function that * invokes the given functions from right to left. * * @static * @since 3.0.0 * @memberOf _ * @category Util * @param {...(Function|Function[])} [funcs] The functions to invoke. * @returns {Function} Returns the new composite function. * @see _.flow * @example * * function square(n) { * return n * n; * } * * var addSquare = _.flowRight([square, _.add]); * addSquare(1, 2); * // => 9 */ var flowRight = createFlow(true); /** * This method returns the first argument it receives. * * @static * @since 0.1.0 * @memberOf _ * @category Util * @param {*} value Any value. * @returns {*} Returns `value`. * @example * * var object = { 'a': 1 }; * * console.log(_.identity(object) === object); * // => true */ function identity(value) { return value; } /** * Creates a function that invokes `func` with the arguments of the created * function. If `func` is a property name, the created function returns the * property value for a given element. If `func` is an array or object, the * created function returns `true` for elements that contain the equivalent * source properties, otherwise it returns `false`. * * @static * @since 4.0.0 * @memberOf _ * @category Util * @param {*} [func=_.identity] The value to convert to a callback. * @returns {Function} Returns the callback. * @example * * var users = [ * { 'user': 'barney', 'age': 36, 'active': true }, * { 'user': 'fred', 'age': 40, 'active': false } * ]; * * // The `_.matches` iteratee shorthand. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true })); * // => [{ 'user': 'barney', 'age': 36, 'active': true }] * * // The `_.matchesProperty` iteratee shorthand. * _.filter(users, _.iteratee(['user', 'fred'])); * // => [{ 'user': 'fred', 'age': 40 }] * * // The `_.property` iteratee shorthand. * _.map(users, _.iteratee('user')); * // => ['barney', 'fred'] * * // Create custom iteratee shorthands. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) { * return !_.isRegExp(func) ? iteratee(func) : function(string) { * return func.test(string); * }; * }); * * _.filter(['abc', 'def'], /ef/); * // => ['def'] */ function iteratee(func) { return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG)); } /** * Creates a function that performs a partial deep comparison between a given * object and `source`, returning `true` if the given object has equivalent * property values, else `false`. * * **Note:** The created function is equivalent to `_.isMatch` with `source` * partially applied. * * Partial comparisons will match empty array and empty object `source` * values against any array or object value, respectively. See `_.isEqual` * for a list of supported value comparisons. * * @static * @memberOf _ * @since 3.0.0 * @category Util * @param {Object} source The object of property values to match. * @returns {Function} Returns the new spec function. * @example * * var objects = [ * { 'a': 1, 'b': 2, 'c': 3 }, * { 'a': 4, 'b': 5, 'c': 6 } * ]; * * _.filter(objects, _.matches({ 'a': 4, 'c': 6 })); * // => [{ 'a': 4, 'b': 5, 'c': 6 }] */ function matches(source) { return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); } /** * Creates a function that performs a partial deep comparison between the * value at `path` of a given object to `srcValue`, returning `true` if the * object value is equivalent, else `false`. * * **Note:** Partial comparisons will match empty array and empty object * `srcValue` values against any array or object value, respectively. See * `_.isEqual` for a list of supported value comparisons. * * @static * @memberOf _ * @since 3.2.0 * @category Util * @param {Array|string} path The path of the property to get. * @param {*} srcValue The value to match. * @returns {Function} Returns the new spec function. * @example * * var objects = [ * { 'a': 1, 'b': 2, 'c': 3 }, * { 'a': 4, 'b': 5, 'c': 6 } * ]; * * _.find(objects, _.matchesProperty('a', 4)); * // => { 'a': 4, 'b': 5, 'c': 6 } */ function matchesProperty(path, srcValue) { return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG)); } /** * Creates a function that invokes the method at `path` of a given object. * Any additional arguments are provided to the invoked method. * * @static * @memberOf _ * @since 3.7.0 * @category Util * @param {Array|string} path The path of the method to invoke. * @param {...*} [args] The arguments to invoke the method with. * @returns {Function} Returns the new invoker function. * @example * * var objects = [ * { 'a': { 'b': _.constant(2) } }, * { 'a': { 'b': _.constant(1) } } * ]; * * _.map(objects, _.method('a.b')); * // => [2, 1] * * _.map(objects, _.method(['a', 'b'])); * // => [2, 1] */ var method = baseRest(function(path, args) { return function(object) { return baseInvoke(object, path, args); }; }); /** * The opposite of `_.method`; this method creates a function that invokes * the method at a given path of `object`. Any additional arguments are * provided to the invoked method. * * @static * @memberOf _ * @since 3.7.0 * @category Util * @param {Object} object The object to query. * @param {...*} [args] The arguments to invoke the method with. * @returns {Function} Returns the new invoker function. * @example * * var array = _.times(3, _.constant), * object = { 'a': array, 'b': array, 'c': array }; * * _.map(['a[2]', 'c[0]'], _.methodOf(object)); * // => [2, 0] * * _.map([['a', '2'], ['c', '0']], _.methodOf(object)); * // => [2, 0] */ var methodOf = baseRest(function(object, args) { return function(path) { return baseInvoke(object, path, args); }; }); /** * Adds all own enumerable string keyed function properties of a source * object to the destination object. If `object` is a function, then methods * are added to its prototype as well. * * **Note:** Use `_.runInContext` to create a pristine `lodash` function to * avoid conflicts caused by modifying the original. * * @static * @since 0.1.0 * @memberOf _ * @category Util * @param {Function|Object} [object=lodash] The destination object. * @param {Object} source The object of functions to add. * @param {Object} [options={}] The options object. * @param {boolean} [options.chain=true] Specify whether mixins are chainable. * @returns {Function|Object} Returns `object`. * @example * * function vowels(string) { * return _.filter(string, function(v) { * return /[aeiou]/i.test(v); * }); * } * * _.mixin({ 'vowels': vowels }); * _.vowels('fred'); * // => ['e'] * * _('fred').vowels().value(); * // => ['e'] * * _.mixin({ 'vowels': vowels }, { 'chain': false }); * _('fred').vowels(); * // => ['e'] */ function mixin(object, source, options) { var props = keys(source), methodNames = baseFunctions(source, props); if (options == null && !(isObject(source) && (methodNames.length || !props.length))) { options = source; source = object; object = this; methodNames = baseFunctions(source, keys(source)); } var chain = !(isObject(options) && 'chain' in options) || !!options.chain, isFunc = isFunction(object); arrayEach(methodNames, function(methodName) { var func = source[methodName]; object[methodName] = func; if (isFunc) { object.prototype[methodName] = function() { var chainAll = this.__chain__; if (chain || chainAll) { var result = object(this.__wrapped__), actions = result.__actions__ = copyArray(this.__actions__); actions.push({ 'func': func, 'args': arguments, 'thisArg': object }); result.__chain__ = chainAll; return result; } return func.apply(object, arrayPush([this.value()], arguments)); }; } }); return object; } /** * Reverts the `_` variable to its previous value and returns a reference to * the `lodash` function. * * @static * @since 0.1.0 * @memberOf _ * @category Util * @returns {Function} Returns the `lodash` function. * @example * * var lodash = _.noConflict(); */ function noConflict() { if (root._ === this) { root._ = oldDash; } return this; } /** * This method returns `undefined`. * * @static * @memberOf _ * @since 2.3.0 * @category Util * @example * * _.times(2, _.noop); * // => [undefined, undefined] */ function noop() { // No operation performed. } /** * Creates a function that gets the argument at index `n`. If `n` is negative, * the nth argument from the end is returned. * * @static * @memberOf _ * @since 4.0.0 * @category Util * @param {number} [n=0] The index of the argument to return. * @returns {Function} Returns the new pass-thru function. * @example * * var func = _.nthArg(1); * func('a', 'b', 'c', 'd'); * // => 'b' * * var func = _.nthArg(-2); * func('a', 'b', 'c', 'd'); * // => 'c' */ function nthArg(n) { n = toInteger(n); return baseRest(function(args) { return baseNth(args, n); }); } /** * Creates a function that invokes `iteratees` with the arguments it receives * and returns their results. * * @static * @memberOf _ * @since 4.0.0 * @category Util * @param {...(Function|Function[])} [iteratees=[_.identity]] * The iteratees to invoke. * @returns {Function} Returns the new function. * @example * * var func = _.over([Math.max, Math.min]); * * func(1, 2, 3, 4); * // => [4, 1] */ var over = createOver(arrayMap); /** * Creates a function that checks if **all** of the `predicates` return * truthy when invoked with the arguments it receives. * * @static * @memberOf _ * @since 4.0.0 * @category Util * @param {...(Function|Function[])} [predicates=[_.identity]] * The predicates to check. * @returns {Function} Returns the new function. * @example * * var func = _.overEvery([Boolean, isFinite]); * * func('1'); * // => true * * func(null); * // => false * * func(NaN); * // => false */ var overEvery = createOver(arrayEvery); /** * Creates a function that checks if **any** of the `predicates` return * truthy when invoked with the arguments it receives. * * @static * @memberOf _ * @since 4.0.0 * @category Util * @param {...(Function|Function[])} [predicates=[_.identity]] * The predicates to check. * @returns {Function} Returns the new function. * @example * * var func = _.overSome([Boolean, isFinite]); * * func('1'); * // => true * * func(null); * // => true * * func(NaN); * // => false */ var overSome = createOver(arraySome); /** * Creates a function that returns the value at `path` of a given object. * * @static * @memberOf _ * @since 2.4.0 * @category Util * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new accessor function. * @example * * var objects = [ * { 'a': { 'b': 2 } }, * { 'a': { 'b': 1 } } * ]; * * _.map(objects, _.property('a.b')); * // => [2, 1] * * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); * // => [1, 2] */ function property(path) { return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); } /** * The opposite of `_.property`; this method creates a function that returns * the value at a given path of `object`. * * @static * @memberOf _ * @since 3.0.0 * @category Util * @param {Object} object The object to query. * @returns {Function} Returns the new accessor function. * @example * * var array = [0, 1, 2], * object = { 'a': array, 'b': array, 'c': array }; * * _.map(['a[2]', 'c[0]'], _.propertyOf(object)); * // => [2, 0] * * _.map([['a', '2'], ['c', '0']], _.propertyOf(object)); * // => [2, 0] */ function propertyOf(object) { return function(path) { return object == null ? undefined : baseGet(object, path); }; } /** * Creates an array of numbers (positive and/or negative) progressing from * `start` up to, but not including, `end`. A step of `-1` is used if a negative * `start` is specified without an `end` or `step`. If `end` is not specified, * it's set to `start` with `start` then set to `0`. * * **Note:** JavaScript follows the IEEE-754 standard for resolving * floating-point values which can produce unexpected results. * * @static * @since 0.1.0 * @memberOf _ * @category Util * @param {number} [start=0] The start of the range. * @param {number} end The end of the range. * @param {number} [step=1] The value to increment or decrement by. * @returns {Array} Returns the range of numbers. * @see _.inRange, _.rangeRight * @example * * _.range(4); * // => [0, 1, 2, 3] * * _.range(-4); * // => [0, -1, -2, -3] * * _.range(1, 5); * // => [1, 2, 3, 4] * * _.range(0, 20, 5); * // => [0, 5, 10, 15] * * _.range(0, -4, -1); * // => [0, -1, -2, -3] * * _.range(1, 4, 0); * // => [1, 1, 1] * * _.range(0); * // => [] */ var range = createRange(); /** * This method is like `_.range` except that it populates values in * descending order. * * @static * @memberOf _ * @since 4.0.0 * @category Util * @param {number} [start=0] The start of the range. * @param {number} end The end of the range. * @param {number} [step=1] The value to increment or decrement by. * @returns {Array} Returns the range of numbers. * @see _.inRange, _.range * @example * * _.rangeRight(4); * // => [3, 2, 1, 0] * * _.rangeRight(-4); * // => [-3, -2, -1, 0] * * _.rangeRight(1, 5); * // => [4, 3, 2, 1] * * _.rangeRight(0, 20, 5); * // => [15, 10, 5, 0] * * _.rangeRight(0, -4, -1); * // => [-3, -2, -1, 0] * * _.rangeRight(1, 4, 0); * // => [1, 1, 1] * * _.rangeRight(0); * // => [] */ var rangeRight = createRange(true); /** * This method returns a new empty array. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {Array} Returns the new empty array. * @example * * var arrays = _.times(2, _.stubArray); * * console.log(arrays); * // => [[], []] * * console.log(arrays[0] === arrays[1]); * // => false */ function stubArray() { return []; } /** * This method returns `false`. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {boolean} Returns `false`. * @example * * _.times(2, _.stubFalse); * // => [false, false] */ function stubFalse() { return false; } /** * This method returns a new empty object. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {Object} Returns the new empty object. * @example * * var objects = _.times(2, _.stubObject); * * console.log(objects); * // => [{}, {}] * * console.log(objects[0] === objects[1]); * // => false */ function stubObject() { return {}; } /** * This method returns an empty string. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {string} Returns the empty string. * @example * * _.times(2, _.stubString); * // => ['', ''] */ function stubString() { return ''; } /** * This method returns `true`. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {boolean} Returns `true`. * @example * * _.times(2, _.stubTrue); * // => [true, true] */ function stubTrue() { return true; } /** * Invokes the iteratee `n` times, returning an array of the results of * each invocation. The iteratee is invoked with one argument; (index). * * @static * @since 0.1.0 * @memberOf _ * @category Util * @param {number} n The number of times to invoke `iteratee`. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @returns {Array} Returns the array of results. * @example * * _.times(3, String); * // => ['0', '1', '2'] * * _.times(4, _.constant(0)); * // => [0, 0, 0, 0] */ function times(n, iteratee) { n = toInteger(n); if (n < 1 || n > MAX_SAFE_INTEGER) { return []; } var index = MAX_ARRAY_LENGTH, length = nativeMin(n, MAX_ARRAY_LENGTH); iteratee = getIteratee(iteratee); n -= MAX_ARRAY_LENGTH; var result = baseTimes(length, iteratee); while (++index < n) { iteratee(index); } return result; } /** * Converts `value` to a property path array. * * @static * @memberOf _ * @since 4.0.0 * @category Util * @param {*} value The value to convert. * @returns {Array} Returns the new property path array. * @example * * _.toPath('a.b.c'); * // => ['a', 'b', 'c'] * * _.toPath('a[0].b.c'); * // => ['a', '0', 'b', 'c'] */ function toPath(value) { if (isArray(value)) { return arrayMap(value, toKey); } return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value))); } /** * Generates a unique ID. If `prefix` is given, the ID is appended to it. * * @static * @since 0.1.0 * @memberOf _ * @category Util * @param {string} [prefix=''] The value to prefix the ID with. * @returns {string} Returns the unique ID. * @example * * _.uniqueId('contact_'); * // => 'contact_104' * * _.uniqueId(); * // => '105' */ function uniqueId(prefix) { var id = ++idCounter; return toString(prefix) + id; } /*------------------------------------------------------------------------*/ /** * Adds two numbers. * * @static * @memberOf _ * @since 3.4.0 * @category Math * @param {number} augend The first number in an addition. * @param {number} addend The second number in an addition. * @returns {number} Returns the total. * @example * * _.add(6, 4); * // => 10 */ var add = createMathOperation(function(augend, addend) { return augend + addend; }, 0); /** * Computes `number` rounded up to `precision`. * * @static * @memberOf _ * @since 3.10.0 * @category Math * @param {number} number The number to round up. * @param {number} [precision=0] The precision to round up to. * @returns {number} Returns the rounded up number. * @example * * _.ceil(4.006); * // => 5 * * _.ceil(6.004, 2); * // => 6.01 * * _.ceil(6040, -2); * // => 6100 */ var ceil = createRound('ceil'); /** * Divide two numbers. * * @static * @memberOf _ * @since 4.7.0 * @category Math * @param {number} dividend The first number in a division. * @param {number} divisor The second number in a division. * @returns {number} Returns the quotient. * @example * * _.divide(6, 4); * // => 1.5 */ var divide = createMathOperation(function(dividend, divisor) { return dividend / divisor; }, 1); /** * Computes `number` rounded down to `precision`. * * @static * @memberOf _ * @since 3.10.0 * @category Math * @param {number} number The number to round down. * @param {number} [precision=0] The precision to round down to. * @returns {number} Returns the rounded down number. * @example * * _.floor(4.006); * // => 4 * * _.floor(0.046, 2); * // => 0.04 * * _.floor(4060, -2); * // => 4000 */ var floor = createRound('floor'); /** * Computes the maximum value of `array`. If `array` is empty or falsey, * `undefined` is returned. * * @static * @since 0.1.0 * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @returns {*} Returns the maximum value. * @example * * _.max([4, 2, 8, 6]); * // => 8 * * _.max([]); * // => undefined */ function max(array) { return (array && array.length) ? baseExtremum(array, identity, baseGt) : undefined; } /** * This method is like `_.max` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the criterion by which * the value is ranked. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @since 4.0.0 * @category Math * @param {Array} array The array to iterate over. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {*} Returns the maximum value. * @example * * var objects = [{ 'n': 1 }, { 'n': 2 }]; * * _.maxBy(objects, function(o) { return o.n; }); * // => { 'n': 2 } * * // The `_.property` iteratee shorthand. * _.maxBy(objects, 'n'); * // => { 'n': 2 } */ function maxBy(array, iteratee) { return (array && array.length) ? baseExtremum(array, getIteratee(iteratee, 2), baseGt) : undefined; } /** * Computes the mean of the values in `array`. * * @static * @memberOf _ * @since 4.0.0 * @category Math * @param {Array} array The array to iterate over. * @returns {number} Returns the mean. * @example * * _.mean([4, 2, 8, 6]); * // => 5 */ function mean(array) { return baseMean(array, identity); } /** * This method is like `_.mean` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the value to be averaged. * The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @since 4.7.0 * @category Math * @param {Array} array The array to iterate over. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {number} Returns the mean. * @example * * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; * * _.meanBy(objects, function(o) { return o.n; }); * // => 5 * * // The `_.property` iteratee shorthand. * _.meanBy(objects, 'n'); * // => 5 */ function meanBy(array, iteratee) { return baseMean(array, getIteratee(iteratee, 2)); } /** * Computes the minimum value of `array`. If `array` is empty or falsey, * `undefined` is returned. * * @static * @since 0.1.0 * @memberOf _ * @category Math * @param {Array} array The array to iterate over. * @returns {*} Returns the minimum value. * @example * * _.min([4, 2, 8, 6]); * // => 2 * * _.min([]); * // => undefined */ function min(array) { return (array && array.length) ? baseExtremum(array, identity, baseLt) : undefined; } /** * This method is like `_.min` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the criterion by which * the value is ranked. The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @since 4.0.0 * @category Math * @param {Array} array The array to iterate over. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {*} Returns the minimum value. * @example * * var objects = [{ 'n': 1 }, { 'n': 2 }]; * * _.minBy(objects, function(o) { return o.n; }); * // => { 'n': 1 } * * // The `_.property` iteratee shorthand. * _.minBy(objects, 'n'); * // => { 'n': 1 } */ function minBy(array, iteratee) { return (array && array.length) ? baseExtremum(array, getIteratee(iteratee, 2), baseLt) : undefined; } /** * Multiply two numbers. * * @static * @memberOf _ * @since 4.7.0 * @category Math * @param {number} multiplier The first number in a multiplication. * @param {number} multiplicand The second number in a multiplication. * @returns {number} Returns the product. * @example * * _.multiply(6, 4); * // => 24 */ var multiply = createMathOperation(function(multiplier, multiplicand) { return multiplier * multiplicand; }, 1); /** * Computes `number` rounded to `precision`. * * @static * @memberOf _ * @since 3.10.0 * @category Math * @param {number} number The number to round. * @param {number} [precision=0] The precision to round to. * @returns {number} Returns the rounded number. * @example * * _.round(4.006); * // => 4 * * _.round(4.006, 2); * // => 4.01 * * _.round(4060, -2); * // => 4100 */ var round = createRound('round'); /** * Subtract two numbers. * * @static * @memberOf _ * @since 4.0.0 * @category Math * @param {number} minuend The first number in a subtraction. * @param {number} subtrahend The second number in a subtraction. * @returns {number} Returns the difference. * @example * * _.subtract(6, 4); * // => 2 */ var subtract = createMathOperation(function(minuend, subtrahend) { return minuend - subtrahend; }, 0); /** * Computes the sum of the values in `array`. * * @static * @memberOf _ * @since 3.4.0 * @category Math * @param {Array} array The array to iterate over. * @returns {number} Returns the sum. * @example * * _.sum([4, 2, 8, 6]); * // => 20 */ function sum(array) { return (array && array.length) ? baseSum(array, identity) : 0; } /** * This method is like `_.sum` except that it accepts `iteratee` which is * invoked for each element in `array` to generate the value to be summed. * The iteratee is invoked with one argument: (value). * * @static * @memberOf _ * @since 4.0.0 * @category Math * @param {Array} array The array to iterate over. * @param {Function} [iteratee=_.identity] The iteratee invoked per element. * @returns {number} Returns the sum. * @example * * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]; * * _.sumBy(objects, function(o) { return o.n; }); * // => 20 * * // The `_.property` iteratee shorthand. * _.sumBy(objects, 'n'); * // => 20 */ function sumBy(array, iteratee) { return (array && array.length) ? baseSum(array, getIteratee(iteratee, 2)) : 0; } /*------------------------------------------------------------------------*/ // Add methods that return wrapped values in chain sequences. lodash.after = after; lodash.ary = ary; lodash.assign = assign; lodash.assignIn = assignIn; lodash.assignInWith = assignInWith; lodash.assignWith = assignWith; lodash.at = at; lodash.before = before; lodash.bind = bind; lodash.bindAll = bindAll; lodash.bindKey = bindKey; lodash.castArray = castArray; lodash.chain = chain; lodash.chunk = chunk; lodash.compact = compact; lodash.concat = concat; lodash.cond = cond; lodash.conforms = conforms; lodash.constant = constant; lodash.countBy = countBy; lodash.create = create; lodash.curry = curry; lodash.curryRight = curryRight; lodash.debounce = debounce; lodash.defaults = defaults; lodash.defaultsDeep = defaultsDeep; lodash.defer = defer; lodash.delay = delay; lodash.difference = difference; lodash.differenceBy = differenceBy; lodash.differenceWith = differenceWith; lodash.drop = drop; lodash.dropRight = dropRight; lodash.dropRightWhile = dropRightWhile; lodash.dropWhile = dropWhile; lodash.fill = fill; lodash.filter = filter; lodash.flatMap = flatMap; lodash.flatMapDeep = flatMapDeep; lodash.flatMapDepth = flatMapDepth; lodash.flatten = flatten; lodash.flattenDeep = flattenDeep; lodash.flattenDepth = flattenDepth; lodash.flip = flip; lodash.flow = flow; lodash.flowRight = flowRight; lodash.fromPairs = fromPairs; lodash.functions = functions; lodash.functionsIn = functionsIn; lodash.groupBy = groupBy; lodash.initial = initial; lodash.intersection = intersection; lodash.intersectionBy = intersectionBy; lodash.intersectionWith = intersectionWith; lodash.invert = invert; lodash.invertBy = invertBy; lodash.invokeMap = invokeMap; lodash.iteratee = iteratee; lodash.keyBy = keyBy; lodash.keys = keys; lodash.keysIn = keysIn; lodash.map = map; lodash.mapKeys = mapKeys; lodash.mapValues = mapValues; lodash.matches = matches; lodash.matchesProperty = matchesProperty; lodash.memoize = memoize; lodash.merge = merge; lodash.mergeWith = mergeWith; lodash.method = method; lodash.methodOf = methodOf; lodash.mixin = mixin; lodash.negate = negate; lodash.nthArg = nthArg; lodash.omit = omit; lodash.omitBy = omitBy; lodash.once = once; lodash.orderBy = orderBy; lodash.over = over; lodash.overArgs = overArgs; lodash.overEvery = overEvery; lodash.overSome = overSome; lodash.partial = partial; lodash.partialRight = partialRight; lodash.partition = partition; lodash.pick = pick; lodash.pickBy = pickBy; lodash.property = property; lodash.propertyOf = propertyOf; lodash.pull = pull; lodash.pullAll = pullAll; lodash.pullAllBy = pullAllBy; lodash.pullAllWith = pullAllWith; lodash.pullAt = pullAt; lodash.range = range; lodash.rangeRight = rangeRight; lodash.rearg = rearg; lodash.reject = reject; lodash.remove = remove; lodash.rest = rest; lodash.reverse = reverse; lodash.sampleSize = sampleSize; lodash.set = set; lodash.setWith = setWith; lodash.shuffle = shuffle; lodash.slice = slice; lodash.sortBy = sortBy; lodash.sortedUniq = sortedUniq; lodash.sortedUniqBy = sortedUniqBy; lodash.split = split; lodash.spread = spread; lodash.tail = tail; lodash.take = take; lodash.takeRight = takeRight; lodash.takeRightWhile = takeRightWhile; lodash.takeWhile = takeWhile; lodash.tap = tap; lodash.throttle = throttle; lodash.thru = thru; lodash.toArray = toArray; lodash.toPairs = toPairs; lodash.toPairsIn = toPairsIn; lodash.toPath = toPath; lodash.toPlainObject = toPlainObject; lodash.transform = transform; lodash.unary = unary; lodash.union = union; lodash.unionBy = unionBy; lodash.unionWith = unionWith; lodash.uniq = uniq; lodash.uniqBy = uniqBy; lodash.uniqWith = uniqWith; lodash.unset = unset; lodash.unzip = unzip; lodash.unzipWith = unzipWith; lodash.update = update; lodash.updateWith = updateWith; lodash.values = values; lodash.valuesIn = valuesIn; lodash.without = without; lodash.words = words; lodash.wrap = wrap; lodash.xor = xor; lodash.xorBy = xorBy; lodash.xorWith = xorWith; lodash.zip = zip; lodash.zipObject = zipObject; lodash.zipObjectDeep = zipObjectDeep; lodash.zipWith = zipWith; // Add aliases. lodash.entries = toPairs; lodash.entriesIn = toPairsIn; lodash.extend = assignIn; lodash.extendWith = assignInWith; // Add methods to `lodash.prototype`. mixin(lodash, lodash); /*------------------------------------------------------------------------*/ // Add methods that return unwrapped values in chain sequences. lodash.add = add; lodash.attempt = attempt; lodash.camelCase = camelCase; lodash.capitalize = capitalize; lodash.ceil = ceil; lodash.clamp = clamp; lodash.clone = clone; lodash.cloneDeep = cloneDeep; lodash.cloneDeepWith = cloneDeepWith; lodash.cloneWith = cloneWith; lodash.conformsTo = conformsTo; lodash.deburr = deburr; lodash.defaultTo = defaultTo; lodash.divide = divide; lodash.endsWith = endsWith; lodash.eq = eq; lodash.escape = escape; lodash.escapeRegExp = escapeRegExp; lodash.every = every; lodash.find = find; lodash.findIndex = findIndex; lodash.findKey = findKey; lodash.findLast = findLast; lodash.findLastIndex = findLastIndex; lodash.findLastKey = findLastKey; lodash.floor = floor; lodash.forEach = forEach; lodash.forEachRight = forEachRight; lodash.forIn = forIn; lodash.forInRight = forInRight; lodash.forOwn = forOwn; lodash.forOwnRight = forOwnRight; lodash.get = get; lodash.gt = gt; lodash.gte = gte; lodash.has = has; lodash.hasIn = hasIn; lodash.head = head; lodash.identity = identity; lodash.includes = includes; lodash.indexOf = indexOf; lodash.inRange = inRange; lodash.invoke = invoke; lodash.isArguments = isArguments; lodash.isArray = isArray; lodash.isArrayBuffer = isArrayBuffer; lodash.isArrayLike = isArrayLike; lodash.isArrayLikeObject = isArrayLikeObject; lodash.isBoolean = isBoolean; lodash.isBuffer = isBuffer; lodash.isDate = isDate; lodash.isElement = isElement; lodash.isEmpty = isEmpty; lodash.isEqual = isEqual; lodash.isEqualWith = isEqualWith; lodash.isError = isError; lodash.isFinite = isFinite; lodash.isFunction = isFunction; lodash.isInteger = isInteger; lodash.isLength = isLength; lodash.isMap = isMap; lodash.isMatch = isMatch; lodash.isMatchWith = isMatchWith; lodash.isNaN = isNaN; lodash.isNative = isNative; lodash.isNil = isNil; lodash.isNull = isNull; lodash.isNumber = isNumber; lodash.isObject = isObject; lodash.isObjectLike = isObjectLike; lodash.isPlainObject = isPlainObject; lodash.isRegExp = isRegExp; lodash.isSafeInteger = isSafeInteger; lodash.isSet = isSet; lodash.isString = isString; lodash.isSymbol = isSymbol; lodash.isTypedArray = isTypedArray; lodash.isUndefined = isUndefined; lodash.isWeakMap = isWeakMap; lodash.isWeakSet = isWeakSet; lodash.join = join; lodash.kebabCase = kebabCase; lodash.last = last; lodash.lastIndexOf = lastIndexOf; lodash.lowerCase = lowerCase; lodash.lowerFirst = lowerFirst; lodash.lt = lt; lodash.lte = lte; lodash.max = max; lodash.maxBy = maxBy; lodash.mean = mean; lodash.meanBy = meanBy; lodash.min = min; lodash.minBy = minBy; lodash.stubArray = stubArray; lodash.stubFalse = stubFalse; lodash.stubObject = stubObject; lodash.stubString = stubString; lodash.stubTrue = stubTrue; lodash.multiply = multiply; lodash.nth = nth; lodash.noConflict = noConflict; lodash.noop = noop; lodash.now = now; lodash.pad = pad; lodash.padEnd = padEnd; lodash.padStart = padStart; lodash.parseInt = parseInt; lodash.random = random; lodash.reduce = reduce; lodash.reduceRight = reduceRight; lodash.repeat = repeat; lodash.replace = replace; lodash.result = result; lodash.round = round; lodash.runInContext = runInContext; lodash.sample = sample; lodash.size = size; lodash.snakeCase = snakeCase; lodash.some = some; lodash.sortedIndex = sortedIndex; lodash.sortedIndexBy = sortedIndexBy; lodash.sortedIndexOf = sortedIndexOf; lodash.sortedLastIndex = sortedLastIndex; lodash.sortedLastIndexBy = sortedLastIndexBy; lodash.sortedLastIndexOf = sortedLastIndexOf; lodash.startCase = startCase; lodash.startsWith = startsWith; lodash.subtract = subtract; lodash.sum = sum; lodash.sumBy = sumBy; lodash.template = template; lodash.times = times; lodash.toFinite = toFinite; lodash.toInteger = toInteger; lodash.toLength = toLength; lodash.toLower = toLower; lodash.toNumber = toNumber; lodash.toSafeInteger = toSafeInteger; lodash.toString = toString; lodash.toUpper = toUpper; lodash.trim = trim; lodash.trimEnd = trimEnd; lodash.trimStart = trimStart; lodash.truncate = truncate; lodash.unescape = unescape; lodash.uniqueId = uniqueId; lodash.upperCase = upperCase; lodash.upperFirst = upperFirst; // Add aliases. lodash.each = forEach; lodash.eachRight = forEachRight; lodash.first = head; mixin(lodash, (function() { var source = {}; baseForOwn(lodash, function(func, methodName) { if (!hasOwnProperty.call(lodash.prototype, methodName)) { source[methodName] = func; } }); return source; }()), { 'chain': false }); /*------------------------------------------------------------------------*/ /** * The semantic version number. * * @static * @memberOf _ * @type {string} */ lodash.VERSION = VERSION; // Assign default placeholders. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) { lodash[methodName].placeholder = lodash; }); // Add `LazyWrapper` methods for `_.drop` and `_.take` variants. arrayEach(['drop', 'take'], function(methodName, index) { LazyWrapper.prototype[methodName] = function(n) { n = n === undefined ? 1 : nativeMax(toInteger(n), 0); var result = (this.__filtered__ && !index) ? new LazyWrapper(this) : this.clone(); if (result.__filtered__) { result.__takeCount__ = nativeMin(n, result.__takeCount__); } else { result.__views__.push({ 'size': nativeMin(n, MAX_ARRAY_LENGTH), 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') }); } return result; }; LazyWrapper.prototype[methodName + 'Right'] = function(n) { return this.reverse()[methodName](n).reverse(); }; }); // Add `LazyWrapper` methods that accept an `iteratee` value. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) { var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; LazyWrapper.prototype[methodName] = function(iteratee) { var result = this.clone(); result.__iteratees__.push({ 'iteratee': getIteratee(iteratee, 3), 'type': type }); result.__filtered__ = result.__filtered__ || isFilter; return result; }; }); // Add `LazyWrapper` methods for `_.head` and `_.last`. arrayEach(['head', 'last'], function(methodName, index) { var takeName = 'take' + (index ? 'Right' : ''); LazyWrapper.prototype[methodName] = function() { return this[takeName](1).value()[0]; }; }); // Add `LazyWrapper` methods for `_.initial` and `_.tail`. arrayEach(['initial', 'tail'], function(methodName, index) { var dropName = 'drop' + (index ? '' : 'Right'); LazyWrapper.prototype[methodName] = function() { return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); }; }); LazyWrapper.prototype.compact = function() { return this.filter(identity); }; LazyWrapper.prototype.find = function(predicate) { return this.filter(predicate).head(); }; LazyWrapper.prototype.findLast = function(predicate) { return this.reverse().find(predicate); }; LazyWrapper.prototype.invokeMap = baseRest(function(path, args) { if (typeof path == 'function') { return new LazyWrapper(this); } return this.map(function(value) { return baseInvoke(value, path, args); }); }); LazyWrapper.prototype.reject = function(predicate) { return this.filter(negate(getIteratee(predicate))); }; LazyWrapper.prototype.slice = function(start, end) { start = toInteger(start); var result = this; if (result.__filtered__ && (start > 0 || end < 0)) { return new LazyWrapper(result); } if (start < 0) { result = result.takeRight(-start); } else if (start) { result = result.drop(start); } if (end !== undefined) { end = toInteger(end); result = end < 0 ? result.dropRight(-end) : result.take(end - start); } return result; }; LazyWrapper.prototype.takeRightWhile = function(predicate) { return this.reverse().takeWhile(predicate).reverse(); }; LazyWrapper.prototype.toArray = function() { return this.take(MAX_ARRAY_LENGTH); }; // Add `LazyWrapper` methods to `lodash.prototype`. baseForOwn(LazyWrapper.prototype, function(func, methodName) { var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName], retUnwrapped = isTaker || /^find/.test(methodName); if (!lodashFunc) { return; } lodash.prototype[methodName] = function() { var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee = args[0], useLazy = isLazy || isArray(value); var interceptor = function(value) { var result = lodashFunc.apply(lodash, arrayPush([value], args)); return (isTaker && chainAll) ? result[0] : result; }; if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) { // Avoid lazy use if the iteratee has a "length" value other than `1`. isLazy = useLazy = false; } var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid; if (!retUnwrapped && useLazy) { value = onlyLazy ? value : new LazyWrapper(this); var result = func.apply(value, args); result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined }); return new LodashWrapper(result, chainAll); } if (isUnwrapped && onlyLazy) { return func.apply(this, args); } result = this.thru(interceptor); return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result; }; }); // Add `Array` methods to `lodash.prototype`. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru', retUnwrapped = /^(?:pop|shift)$/.test(methodName); lodash.prototype[methodName] = function() { var args = arguments; if (retUnwrapped && !this.__chain__) { var value = this.value(); return func.apply(isArray(value) ? value : [], args); } return this[chainName](function(value) { return func.apply(isArray(value) ? value : [], args); }); }; }); // Map minified method names to their real names. baseForOwn(LazyWrapper.prototype, function(func, methodName) { var lodashFunc = lodash[methodName]; if (lodashFunc) { var key = lodashFunc.name + ''; if (!hasOwnProperty.call(realNames, key)) { realNames[key] = []; } realNames[key].push({ 'name': methodName, 'func': lodashFunc }); } }); realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{ 'name': 'wrapper', 'func': undefined }]; // Add methods to `LazyWrapper`. LazyWrapper.prototype.clone = lazyClone; LazyWrapper.prototype.reverse = lazyReverse; LazyWrapper.prototype.value = lazyValue; // Add chain sequence methods to the `lodash` wrapper. lodash.prototype.at = wrapperAt; lodash.prototype.chain = wrapperChain; lodash.prototype.commit = wrapperCommit; lodash.prototype.next = wrapperNext; lodash.prototype.plant = wrapperPlant; lodash.prototype.reverse = wrapperReverse; lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue; // Add lazy aliases. lodash.prototype.first = lodash.prototype.head; if (symIterator) { lodash.prototype[symIterator] = wrapperToIterator; } return lodash; }); /*--------------------------------------------------------------------------*/ // Export lodash. var _ = runInContext(); // Some AMD build optimizers, like r.js, check for condition patterns like: if (true) { // Expose Lodash on the global object to prevent errors when Lodash is // loaded by a script tag in the presence of an AMD loader. // See http://requirejs.org/docs/errors.html#mismatch for more details. // Use `_.noConflict` to remove Lodash from the global object. root._ = _; // Define as an anonymous module so, through path mapping, it can be // referenced as the "underscore" module. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { return _; }).call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } // Check for `exports` after `define` in case a build optimizer adds it. else {} }.call(this)); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module))) /***/ }), /***/ "./node_modules/process/browser.js": /*!*****************************************!*\ !*** ./node_modules/process/browser.js ***! \*****************************************/ /*! no static exports found */ /***/ (function(module, exports) { // shim for using process in browser var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it // don't break things. But we need to wrap it in a try catch in case it is // wrapped in strict mode code which doesn't define any globals. It's inside a // function because try/catches deoptimize in certain engines. var cachedSetTimeout; var cachedClearTimeout; function defaultSetTimout() { throw new Error('setTimeout has not been defined'); } function defaultClearTimeout () { throw new Error('clearTimeout has not been defined'); } (function () { try { if (typeof setTimeout === 'function') { cachedSetTimeout = setTimeout; } else { cachedSetTimeout = defaultSetTimout; } } catch (e) { cachedSetTimeout = defaultSetTimout; } try { if (typeof clearTimeout === 'function') { cachedClearTimeout = clearTimeout; } else { cachedClearTimeout = defaultClearTimeout; } } catch (e) { cachedClearTimeout = defaultClearTimeout; } } ()) function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { //normal enviroments in sane situations return setTimeout(fun, 0); } // if setTimeout wasn't available but was latter defined if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { cachedSetTimeout = setTimeout; return setTimeout(fun, 0); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedSetTimeout(fun, 0); } catch(e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedSetTimeout.call(null, fun, 0); } catch(e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error return cachedSetTimeout.call(this, fun, 0); } } } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { //normal enviroments in sane situations return clearTimeout(marker); } // if clearTimeout wasn't available but was latter defined if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { cachedClearTimeout = clearTimeout; return clearTimeout(marker); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedClearTimeout(marker); } catch (e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedClearTimeout.call(null, marker); } catch (e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. // Some versions of I.E. have different rules for clearTimeout vs setTimeout return cachedClearTimeout.call(this, marker); } } } var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { if (!draining || !currentQueue) { return; } draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = runTimeout(cleanUpNextTick); draining = true; var len = queue.length; while(len) { currentQueue = queue; queue = []; while (++queueIndex < len) { if (currentQueue) { currentQueue[queueIndex].run(); } } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; runClearTimeout(timeout); } process.nextTick = function (fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) { for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); if (queue.length === 1 && !draining) { runTimeout(drainQueue); } }; // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.prependListener = noop; process.prependOnceListener = noop; process.listeners = function (name) { return [] } process.binding = function (name) { throw new Error('process.binding is not supported'); }; process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function() { return 0; }; /***/ }), /***/ "./node_modules/webpack/buildin/global.js": /*!***********************************!*\ !*** (webpack)/buildin/global.js ***! \***********************************/ /*! no static exports found */ /***/ (function(module, exports) { var g; // This works in non-strict mode g = (function() { return this; })(); try { // This works if eval is allowed (see CSP) g = g || new Function("return this")(); } catch (e) { // This works if the window reference is available if (typeof window === "object") g = window; } // g can still be undefined, but nothing to do about it... // We return undefined, instead of nothing here, so it's // easier to handle this case. if(!global) { ...} module.exports = g; /***/ }), /***/ "./node_modules/webpack/buildin/module.js": /*!***********************************!*\ !*** (webpack)/buildin/module.js ***! \***********************************/ /*! no static exports found */ /***/ (function(module, exports) { module.exports = function(module) { if (!module.webpackPolyfill) { module.deprecate = function() {}; module.paths = []; // module.parent = undefined by default if (!module.children) module.children = []; Object.defineProperty(module, "loaded", { enumerable: true, get: function() { return module.l; } }); Object.defineProperty(module, "id", { enumerable: true, get: function() { return module.i; } }); module.webpackPolyfill = 1; } return module; }; /***/ }), /***/ "./resources/js/app.js": /*!*****************************!*\ !*** ./resources/js/app.js ***! \*****************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js"); /***/ }), /***/ "./resources/js/bootstrap.js": /*!***********************************!*\ !*** ./resources/js/bootstrap.js ***! \***********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js"); /** * We'll load the axios HTTP library which allows us to easily issue requests * to our Laravel back-end. This library automatically handles sending the * CSRF token as a header based on the value of the "XSRF" token cookie. */ window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js"); window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; /** * Echo exposes an expressive API for subscribing to channels and listening * for events that are broadcast by Laravel. Echo and event broadcasting * allows your team to easily build robust real-time web applications. */ // import Echo from 'laravel-echo'; // window.Pusher = require('pusher-js'); // window.Echo = new Echo({ // broadcaster: 'pusher', // key: process.env.MIX_PUSHER_APP_KEY, // cluster: process.env.MIX_PUSHER_APP_CLUSTER, // forceTLS: true // }); /***/ }), /***/ "./resources/sass/app.scss": /*!*********************************!*\ !*** ./resources/sass/app.scss ***! \*********************************/ /*! no static exports found */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), /***/ 0: /*!*************************************************************!*\ !*** multi ./resources/js/app.js ./resources/sass/app.scss ***! \*************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(/*! C:\Users\utente\Desktop\Esercitazioni\laravel-one-to-many\resources\js\app.js */"./resources/js/app.js"); module.exports = __webpack_require__(/*! C:\Users\utente\Desktop\Esercitazioni\laravel-one-to-many\resources\sass\app.scss */"./resources/sass/app.scss"); /***/ }) /******/ });
let permId = ''; $(document).ready(function(){ $('ul.admin-perms li').each(function(key, value) { let liId = $(this).attr('id'); liId = liId.replace('li-', ''); if(key !== $('ul.admin-perms li').length - 1) { permId += liId + ','; } else { permId += liId; } addIdInput(); }); $('#add-permission').on('click', function(){ let selectedText = $("select option:selected").text(); let selectedId = $("select option:selected").attr('value'); if(selectedText !== '' && selectedText !== undefined) { $('.selected ul').append('\ <li style="list-style-type: none;" id="li-' + selectedId + '">' + selectedText + '\ <a href="#" class="close" aria-label="Close" onclick="destroyElem(' + selectedId + '); event.preventDefault()">\ <span aria-hidden="true">x</span>\ </a></li>'); if(permId === '') { permId += selectedId; } else { permId += ',' + selectedId; } addIdInput(); $("#" + selectedId).remove(); } }); }); function destroyElem(selectId) { let liToDestroy = $('#li-' + selectId); let liText = liToDestroy.text().replace('x', '').trim(); $('#li-' + selectId).remove(); removeId(selectId); addSelect(selectId, liText); } function addSelect(id, text) { return $("select").append('<option id="' + id + '" value="' + id + '">' + text + '</option>'); } function removeId(selectId) { permId.indexOf(',' + selectId) >= 0 ? permId = permId.replace(',' + selectId, '') : permId = permId.replace(selectId, ''); permId.indexOf(',') == 0 ? permId = permId.substring(1) : permId; addIdInput(); } function addIdInput() { $('#admin-permissions').val('').val(permId); }
var book = { "name": "سفر خروج", "numChapters": 40, "chapters": { "1": { "1": "<span>1 </span> &nbsp;و این‌ است‌ نامهای‌ پسران‌ اسرائیل‌ كه‌ به‌مصر آمدند، هر كس‌ با اهل‌ خانه‌اش‌ همراه‌ یعقوب‌ آمدند:", "2": "<span>2 </span> &nbsp;رؤبین‌ و شمعون‌ و لاوی‌ و یهودا،", "3": "<span>3 </span> &nbsp;یساكار و زبولون‌ و بنیامین‌،", "4": "<span>4 </span> &nbsp;و دان‌ و نفتالی‌، و جاد و اشیر.", "5": "<span>5 </span> &nbsp;و همۀ نفوسی‌ كه‌ از صُلب‌ یعقوب‌ پدید آمدند هفتاد نفر بودند. و یوسف‌ در مصر بود.", "6": "<span>6 </span> &nbsp;و یوسف‌ و همۀ برادرانش‌، و تمامی‌ آن‌ طبقه‌ مردند.", "7": "<span>7 </span> &nbsp;و بنی‌اسرائیل‌ بارور و منتشر شدند، و كثیر و بی‌نهایت‌ زورآور گردیدند و زمین‌ از ایشان‌ پر گشت‌.", "8": "<span>8 </span> &nbsp;اما پادشاهی‌ دیگر بر مصر برخاست‌ كه‌ یوسف‌ را نشناخت‌،", "9": "<span>9 </span> &nbsp;و به‌ قوم‌ خود گفت‌: «همانا قوم‌ بنی‌اسرائیل‌ از ما زیاده‌ و زورآورترند.", "10": "<span>10 </span> &nbsp;بیایید با ایشان‌ به‌ حكمت‌ رفتار كنیم‌، مبادا كه‌ زیاد شوند. و واقع‌ شود كه‌ چون‌ جنگ‌ پدید آید، ایشان‌ نیز با دشمنان‌ ما همداستان‌ شوند، و با ما جنگ‌ كرده‌، از زمین‌ بیرون‌ روند.»", "11": "<span>11 </span> &nbsp;پس‌ سركاران‌ بر ایشان‌ گماشتند، تا ایشان‌ را به‌ كارهای‌ دشوار ذلیل‌ سازند، و برای‌ فرعون‌ شهرهای‌ خزینه‌، یعنی‌ فیتوم‌ و رَعمسیس‌ را بنا كردند.", "12": "<span>12 </span> &nbsp;لیكن‌ چندانكه‌ بیشتر ایشان‌ را ذلیل‌ ساختند، زیادتر متزاید و منتشر گردیدند، و از بنی‌اسرائیل‌ احتراز می‌نمودند.", "13": "<span>13 </span> &nbsp;و مصریان‌ از بنی‌اسرائیل‌ به‌ ظلم‌ خدمت‌ گرفتند.", "14": "<span>14 </span> &nbsp;و جانهای‌ ایشان‌ را به‌ بندگی سخت‌، به‌ گل‌كاری‌ وخشت‌سازی‌ و هر گونه‌ عمل‌ صحرایی‌، تلخ‌ ساختندی‌. و هر خدمتی‌ كه‌ بر ایشان‌ نهادندی‌ به‌ ظلم‌ می‌بود.", "15": "<span>15 </span> &nbsp;و پادشاه‌ مصر به‌ قابله‌های‌ عبرانی‌ كه‌ یكی‌ را شِفرَه‌ و دیگری‌ را فُوعَه‌ نام‌ بود، امر كرده‌،", "16": "<span>16 </span> &nbsp;گفت‌: «چون‌ قابله‌گری‌ برای‌ زنان‌ عبرانی‌ بكنید، و بر سنگها نگاه‌ كنید. اگر پسر باشد او را بكُشید، و اگر دختر بود زنده‌ بماند.»", "17": "<span>17 </span> &nbsp;لكن‌ قابله‌ها از خدا ترسیدند، و آنچه‌ پادشاه‌ مصر بدیشان‌ فرموده‌ بود نكردند، بلكه‌ پسران‌ را زنده‌ گذاردند.", "18": "<span>18 </span> &nbsp;پس‌ پادشاه‌ مصر قابله‌ها را طلبیده‌، بدیشان‌ گفت‌: «چرا این‌ كار را كردید، و پسران‌ را زنده‌ گذاردید؟»", "19": "<span>19 </span> &nbsp;قابله‌ها به‌ فرعون‌ گفتند: «از این‌ سبب‌ كه‌ زنان‌ عبرانی‌ چون‌ زنان‌ مصری‌ نیستند، بلكه‌ زورآورند، و قبل‌ از رسیدن‌ قابله‌ می‌زایند.»", "20": "<span>20 </span> &nbsp;و خدا با قابله‌ها احسان‌ نمود، و قوم‌ كثیر شدند، و بسیار توانا گردیدند.", "21": "<span>21 </span> &nbsp;و واقع‌ شد چونكه‌ قابله‌ها از خدا ترسیدند، خانه‌ها برای‌ ایشان‌ بساخت‌.", "22": "<span>22 </span> &nbsp;و فرعون‌ قوم‌ خود را امر كرده‌، گفت‌: «هر پسری‌ كه‌ زاییده‌ شود به‌ نهر اندازید، و هر دختری‌ را زنده‌ نگاه‌ دارید.»" }, "2": { "1": "<span>1 </span> &nbsp;و شخصی‌ از خاندان‌ لاوی‌ رفته‌، یكی‌ از دختران‌ لاوی‌ را به‌ زنی‌ گرفت‌.", "2": "<span>2 </span> &nbsp;و آن‌ زن‌ حامله‌ شده‌، پسری‌ بزاد. و چون‌ او را نیكومنظردید، وی‌ را سه‌ ماه‌ نهان‌ داشت‌.", "3": "<span>3 </span> &nbsp;و چون‌ نتوانست‌ او را دیگر پنهان‌ دارد، تابوتی‌ از نی‌ برایش‌ گرفت‌، و آن‌ را به‌ قیر و زِفت‌ اندوده‌، طفل‌ را در آن‌ نهاد، و آن‌ را در نیزار به‌ كنار نهر گذاشت‌.", "4": "<span>4 </span> &nbsp;و خواهرش‌ از دور ایستاد تا بداند او را چه‌ می‌شود.", "5": "<span>5 </span> &nbsp;و دختر فرعون‌ برای‌ غسل‌ به‌ نهر فرود آمد. و كنیزانش‌ به‌ كنار نهر می‌گشتند. پس‌ تابوت‌ را در میان‌ نیزار دیده‌، كنیزك‌ خویش‌ را فرستاد تا آن‌ را بگیرد.", "6": "<span>6 </span> &nbsp;و چون‌ آن‌ را بگشاد، طفل‌ را دید و اینك‌ پسری‌ گریان‌ بود. پس‌ دلش‌ بر وی‌ بسوخت‌ و گفت‌: «این‌ از اطفال‌ عبرانیان‌ است‌.»", "7": "<span>7 </span> &nbsp;و خواهر وی‌ به‌ دختر فرعون‌ گفت‌: «آیا بروم‌ و زنی‌ شیرده‌ را از زنان‌ عبرانیان‌ نزدت‌ بخوانم‌ تا طفل‌ را برایت‌ شیر دهد؟»", "8": "<span>8 </span> &nbsp;دختر فرعون‌ به‌ وی‌ گفت‌: «برو.» پس‌ آن‌ دختر رفته‌، مادر طفل‌ را بخواند.", "9": "<span>9 </span> &nbsp;و دختر فرعون‌ گفت‌: «این‌ طفل‌ را ببَر و او را برای‌ من‌ شیر بده‌ و مزد تو را خواهم‌ داد.» پس‌ آن‌ زن‌ طفل‌ را برداشته‌، بدو شیر می‌داد.", "10": "<span>10 </span> &nbsp;و چون‌ طفل‌ نمو كرد، وی‌ را نزد دختر فرعون‌ برد، و او را پسر شد. و وی‌ را موسی‌ نام‌ نهاد زیرا گفت‌: «او را از آب‌ كشیدم‌.»", "11": "<span>11 </span> &nbsp;و واقع‌ شد در آن‌ ایام‌ كه‌ چون‌ موسی‌ بزرگ‌ شد، نزد برادران‌ خود بیرون‌ آمد، و به‌ كارهای‌ دشوار ایشان‌ نظر انداخته‌، شخصی‌ مصری‌ را دید كه‌ شخصی‌ عبرانی‌ را كه‌ از برادران‌ او بود، می‌زند.", "12": "<span>12 </span> &nbsp;پس‌ به‌ هر طرف‌ نظر افكنده‌، چون‌ كسی‌ را ندید، آن‌ مصری‌ را كشت‌، و او را در ریگ‌ پنهان‌ساخت‌.", "13": "<span>13 </span> &nbsp;و روز دیگر بیرون‌ آمد، كه‌ ناگاه‌ دو مرد عبرانی‌ منازعه‌ می‌كنند، پس‌ به‌ ظالم‌ گفت‌: «چرا همسایۀ خود را می‌زنی‌.»", "14": "<span>14 </span> &nbsp;گفت‌: «كیست‌ كه‌ تو را بر ما حاكم‌ یا داور ساخته‌ است‌؟ مگر تو می‌خواهی‌ مرا بكشی‌ چنانكه‌ آن‌ مصری‌ را كشتی‌؟» پس‌ موسی‌ ترسید و گفت‌: «یقیناً این‌ امر شیوع‌ یافته‌ است‌.»", "15": "<span>15 </span> &nbsp;و چون‌ فرعون‌ این‌ ماجرا را بشنید، قصد قتل‌ موسی‌ كرد. و موسی‌ از حضور فرعون‌ فرار كرده‌، در زمین‌ مدیان‌ ساكن‌ شد؛ و بر سر چاهی‌ بنشست‌.", "16": "<span>16 </span> &nbsp;و كاهن‌ مدیان‌ را هفت‌ دختر بود كه‌ آمدند و آب‌ كشیده‌، آبخورها را پر كردند، تا گلۀ پدر خویش‌ را سیراب‌ كنند.", "17": "<span>17 </span> &nbsp;و شبانان‌ نزدیك‌ آمدند، تا ایشان‌ را دور كنند. آنگاه‌ موسی‌ برخاسته‌، ایشان‌ را مدد كرد، و گلۀ ایشان‌ را سیراب‌ نمود.", "18": "<span>18 </span> &nbsp;و چون‌ نزد پدر خود رعوئیل‌ آمدند، او گفت‌: «چگونه‌ امروز بدین‌ زودی‌ برگشتید؟»", "19": "<span>19 </span> &nbsp;گفتند: «شخصی‌ مصری‌ ما را از دست‌ شبانان‌ رهایی‌ داد، و آب‌ نیز برای‌ ما كشیده‌، گله‌ را سیراب‌ نمود.»", "20": "<span>20 </span> &nbsp;پس‌ به‌ دختران‌ خود گفت‌: «او كجاست‌؟ چرا آن‌ مرد را ترك‌ كردید؟ وی‌ را بخوانید تا نان‌ خورَد.»", "21": "<span>21 </span> &nbsp;و موسی‌ راضی‌ شد كه‌ با آن‌ مرد ساكن‌ شود. و او دختر خود، صفوره‌ را به‌ موسی‌ داد.", "22": "<span>22 </span> &nbsp;و آن‌ زن‌ پسری‌ زایید، و (موسی‌) او را جِرشون‌ نام‌ نهاد، چه‌ گفت‌: «در زمین‌ بیگانه‌ نزیل‌ شدم‌.»", "23": "<span>23 </span> &nbsp;و واقع‌ شد بعد از ایام‌ بسیار كه‌ پادشاه‌ مصر بمرد، و بنی‌اسرائیل‌ به‌ سبب‌ بندگی‌ آه‌ كشیده‌، استغاثه‌ كردند، و نالۀ ایشان‌ به‌ سبب‌ بندگی‌ نزد خدا برآمد.", "24": "<span>24 </span> &nbsp;و خدا نالۀ ایشان‌ را شنید، و خداعهد خود را با ابراهیم‌ و اسحاق‌ و یعقوب‌ بیاد آورد.", "25": "<span>25 </span> &nbsp;و خدا بر بنی‌اسرائیل‌ نظر كرد و خدا دانست‌." }, "3": { "1": "<span>1 </span> &nbsp;و اما موسی‌ گلۀ پدر زن‌ خود، یترون‌، كاهن مدیان‌ را شبانی‌ می‌كرد؛ و گله‌ را بدان‌ طرف‌ صحرا راند و به‌ حوریب‌ كه‌ جبل‌الله‌ باشد آمد.", "2": "<span>2 </span> &nbsp;و فرشتۀ خداوند در شعلۀ آتش‌ از میان‌ بوته‌ای‌ بر وی‌ ظاهر شد. و چون‌ او نگریست‌، اینك‌ آن‌ بوته‌ به‌ آتش‌ مشتعل‌ است‌ اما سوخته‌ نمی‌شود.", "3": "<span>3 </span> &nbsp;و موسی‌ گفت‌: «اكنون‌ بدان‌ طرف‌ شوم‌، و این‌ امر غریب‌ را ببینم‌، كه‌ بوته‌ چرا سوخته‌ نمی‌شود.»", "4": "<span>4 </span> &nbsp;چون‌ خداوند دید كه‌ برای‌ دیدن‌ مایل‌ بدان‌ سو می‌شود، خدا از میان‌ بوته‌ به‌ وی‌ ندا درداد و گفت‌: «ای‌ موسی‌! ای‌ موسی‌!» گفت‌: «لبیك‌.»", "5": "<span>5 </span> &nbsp;گفت‌: «بدین‌ جا نزدیك‌ میا، نعلین‌ خود را از پایهایت‌ بیرون‌ كن‌، زیرا مكانی‌ كه‌ در آن‌ ایستاده‌ای‌ زمین‌ مقدس‌ است‌.»", "6": "<span>6 </span> &nbsp;و گفت‌: «من‌ هستم‌ خدای‌ پدرت‌، خدای‌ ابراهیم‌، و خدای‌ اسحاق‌، و خدای‌ یعقوب‌.»آنگاه‌ موسی‌ روی‌ خود را پوشانید، زیرا ترسید كه‌ به‌ خدا بنگرد.", "7": "<span>7 </span> &nbsp;و خداوند گفت‌: «هر آینه‌ مصیبت‌ قوم‌ خود را كه‌ در مصرند دیدم‌، و استغاثۀ ایشان‌ را از دست‌ سركاران‌ ایشان‌ شنیدم‌، زیرا غمهای‌ ایشان‌ را می‌دانم‌.", "8": "<span>8 </span> &nbsp;و نزول‌ كردم‌ تا ایشان‌ را از دست‌ مصریان‌ خلاصی‌ دهم‌، و ایشان‌ را از آن‌ زمین‌ به‌ زمین‌ نیكو و وسیع‌ برآورم‌، به‌ زمینی‌ كه‌ به‌ شیر و شهد جاری‌ است‌، به‌ مكان‌ كنعانیان‌ و حِتّیان‌ و اَموریان‌ و فَرِزِّیان‌ و حِوّیان‌ ویبوسیان‌.", "9": "<span>9 </span> &nbsp;و الا´ن‌ اینك‌ استغاثۀ بنی‌اسرائیل‌ نزد من‌ رسیده‌ است‌، و ظلمی‌ را نیز كه‌ مصریان‌ بر ایشان‌ می‌كنند، دیده‌ام‌.", "10": "<span>10 </span> &nbsp;پس‌ اكنون‌ بیا تا تو را نزد فرعون‌ بفرستم‌، و قوم‌ من‌، بنی‌اسرائیل‌ را از مصر بیرون‌ آوری‌.»", "11": "<span>11 </span> &nbsp;موسی‌ به‌ خدا گفت‌: «من‌ كیستم‌ كه‌ نزد فرعون‌ بروم‌، و بنی‌اسرائیل‌ را از مصر بیرون‌ آورم‌؟»", "12": "<span>12 </span> &nbsp;گفت‌: «البته‌ با تو خواهم‌ بود. و علامتی‌ كه‌ من‌ تو را فرستاده‌ام‌، این‌ باشد كه‌ چون‌ قوم‌ را از مصر بیرون‌ آوردی‌، خدا را بر این‌ كوه‌ عبادت‌ خواهید كرد.»", "13": "<span>13 </span> &nbsp;موسی‌ به‌ خدا گفت‌: «اینك‌ چون‌ من‌ نزد بنی‌اسرائیل‌ برسم‌، و بدیشان‌ گویم‌ خدای‌ پدران‌ شما مرا نزد شما فرستاده‌ است‌، و از من‌ بپرسند كه‌ نام‌ او چیست‌، بدیشان‌ چه‌ گویم‌؟»", "14": "<span>14 </span> &nbsp;خدا به‌ موسی‌ گفت‌: «هستم‌ آنكه‌ هستم‌.» و گفت‌: «به‌ بنی‌اسرائیل‌ چنین‌ بگو: اهْیه‌ (هستم‌) مرا نزد شما فرستاد.»", "15": "<span>15 </span> &nbsp;و خدا باز به‌ موسی‌ گفت‌: «به‌ بنی‌اسرائیل‌ چنین‌ بگو، یهوه‌ خدای‌ پدران‌ شما، خدای‌ ابراهیم‌ و خدای‌ اسحاق‌ و خدای‌ یعقوب‌، مرا نزد شما فرستاده‌. این‌ است‌ نام‌ من‌ تا ابدالا´باد، و این‌ است‌ یادگاری من‌ نسلاً بعد نسل‌.", "16": "<span>16 </span> &nbsp;برو و مشایخ‌ بنی‌اسرائیل‌ را جمع‌ كرده‌، بدیشان‌ بگو: یهوه‌ خدای‌ پدران‌ شما، خدای‌ ابراهیم‌ و اسحاق‌ و یعقوب‌، به‌ من‌ ظاهر شده‌، گفت‌: هر آینه‌ از شما و از آنچه‌ به‌ شما در مصر كرده‌اند، تفقد كرده‌ام‌،", "17": "<span>17 </span> &nbsp;و گفتم‌ شما را از مصیبت‌ مصر بیرون‌ خواهم‌ آورد، به‌ زمین‌ كنعانیان‌ و حتیان‌ و اموریان‌ و فرزیان‌ و حویان‌ و یبوسیان‌، به‌ زمینی‌ كه‌ به‌ شیر و شهد جاری‌ است‌.", "18": "<span>18 </span> &nbsp;و سخن‌ تو را خواهند شنید، و تو با مشایخ‌ اسرائیل‌، نزد پادشاه‌ مصربروید، و به‌ وی‌ گویید: یهوه‌ خدای‌ عبرانیان‌ ما را ملاقات‌ كرده‌ است‌. و الا´ن‌ سفر سه‌ روزه‌ به‌ صحرا برویم‌، تا برای‌ یهوه‌ خدای‌ خود قربانی‌ بگذرانیم‌.", "19": "<span>19 </span> &nbsp;و من‌ می‌دانم‌ كه‌ پادشاه‌ مصر شما را نمی‌گذارد بروید، و نه‌ هم‌ به‌ دست‌ زورآور.", "20": "<span>20 </span> &nbsp;پس‌ دست‌ خود را دراز خواهم‌ كرد، و مصر را به‌ همۀ عجایب‌ خود كه‌ در میانش‌ به‌ ظهور می‌آورم‌ خواهم‌ زد، و بعد از آن‌ شما را رها خواهد كرد.", "21": "<span>21 </span> &nbsp;و این‌ قوم‌ را در نظر مصریان‌ مكرّم‌ خواهم‌ ساخت‌، و واقع‌ خواهد شد كه‌ چون‌ بروید تهی‌ دست‌ نخواهید رفت‌.", "22": "<span>22 </span> &nbsp;بلكه‌ هر زنی‌ از همسایۀ خود و مهمانِ خانۀ خویش‌ آلات‌ نقره‌ و آلات‌ طلا و رخت‌ خواهد خواست‌، و به‌ پسران‌ و دختران‌ خود خواهید پوشانید، و مصریان‌ را غارت‌ خواهید نمود.»" }, "4": { "1": "<span>1 </span> &nbsp;و موسی‌ در جواب‌ گفت‌: «همانا مرا تصدیق‌ نخواهند كرد، و سخن‌ مرا نخواهند شنید، بلكه‌ خواهند گفت‌ یهوه‌ بر تو ظاهر نشده‌ است‌.»", "2": "<span>2 </span> &nbsp;پس‌ خداوند به‌ وی‌ گفت‌: «آن‌ چیست‌ در دست‌ تو؟» گفت‌: «عصا.»", "3": "<span>3 </span> &nbsp;گفت‌: «آن‌ را بر زمین‌ بینداز.» و چون‌ آن‌ را به‌ زمین‌ انداخت‌، ماری‌ گردید و موسی‌ از نزدش‌ گریخت‌.", "4": "<span>4 </span> &nbsp;پس‌ خداوند به‌ موسی‌ گفت‌: «دست‌ خود را دراز كن‌ و دُمش‌ را بگیر.» پس‌ دست‌ خود را دراز كرده‌، آن‌ را بگرفت‌، كه‌ در دستش‌ عصا شد.", "5": "<span>5 </span> &nbsp;«تا آنكه‌ باور كنند كه‌ یهوه‌ خدای‌ پدران‌ ایشان‌، خدای‌ ابراهیم‌، خدای‌ اسحاق‌، و خدای‌ یعقوب‌، به‌ تو ظاهر شد.»", "6": "<span>6 </span> &nbsp;و خداوند دیگرباره‌ وی‌ را گفت‌: «دست‌ خود را در گریبان‌ خود بگذار.» چون‌ دست‌ به‌گریبان‌ خود برد، و آن‌ را بیرون‌ آورد، اینك‌ دست‌ او مثل‌ برف‌ مبروص‌ شد.", "7": "<span>7 </span> &nbsp;پس‌ گفت‌: «دست‌ خود را باز به‌ گریبان‌ خود بگذار.» چون‌ دست‌ به‌ گریبان‌ خود باز برد، و آن‌ را بیرون‌ آورد، اینك‌ مثل‌ سایر بدنش‌ باز آمده‌ بود.", "8": "<span>8 </span> &nbsp;«و واقع‌ خواهد شد كه‌ اگر تو را تصدیق‌ نكنند، و آواز آیت‌ نخستین‌ را نشنوند، همانا آواز آیت‌ دوم‌ را باور خواهند كرد.", "9": "<span>9 </span> &nbsp;و هر گاه‌ این‌ دو آیت‌ را باور نكردند و سخن‌ تو را نشنیدند، آنگاه‌ از آب‌ نهر گرفته‌، به‌ خشكی‌ بریز، و آبی‌ كه‌ از نهر گرفتی‌ بر روی‌ خشكی‌ به‌ خون‌ مبدل‌ خواهد شد.»", "10": "<span>10 </span> &nbsp;پس‌ موسی‌ به‌ خداوند گفت‌: «ای‌ خداوند، من‌ مردی‌ فصیح‌ نیستم‌، نه‌ در سابق‌ و نه‌ از وقتی‌ كه‌ به‌ بندۀ خود سخن‌ گفتی‌، بلكه‌ بطیالكلام‌ و كند زبان‌.»", "11": "<span>11 </span> &nbsp;خداوند گفت‌: «كیست‌ كه‌ زبان‌ به‌ انسان‌ داد، و گنگ‌ و كر و بینا و نابینا را كه‌ آفرید؟ آیا نه‌ من‌ كه‌ یهوه‌ هستم‌؟", "12": "<span>12 </span> &nbsp;پس‌ الا´ن‌ برو و من‌ با زبانت‌ خواهم‌ بود، و هر چه‌ باید بگویی‌ تو را خواهم‌ آموخت‌.»", "13": "<span>13 </span> &nbsp;گفت‌: «استدعا دارم‌ ای‌ خداوند كه‌ بفرستی‌ به‌ دست‌ هر كه‌ می‌فرستی‌.»", "14": "<span>14 </span> &nbsp;آنگاه‌ خشم‌ خداوند بر موسی‌ مشتعل‌ شد و گفت‌: «آیا برادرت‌، هارون‌ لاوی‌ را نمی‌دانم‌ كه‌ او فصیح‌الكلام‌ است‌؟ و اینك‌ او نیز به‌ استقبال‌ تو بیرون‌ می‌آید، و چون‌ تو را بیند، در دل‌ خود شاد خواهد گردید.", "15": "<span>15 </span> &nbsp;و بدو سخن‌ خواهی‌ گفت‌ و كلام‌ را به‌ زبان‌ وی‌ القا خواهی‌ كرد، و من‌ با زبان‌ تو و با زبان‌ او خواهم‌ بود، و آنچه‌ باید بكنید شما را خواهم‌ آموخت‌.", "16": "<span>16 </span> &nbsp;و او برای‌ تو به‌ قوم‌ سخن‌ خواهد گفت‌، و او مر تو را به‌ جای‌ زبان‌ خواهد بود، و تو او را به‌ جای‌ خدا خواهی‌ بود.", "17": "<span>17 </span> &nbsp;و این‌عصا را به‌ دست‌ خود بگیر كه‌ به‌ آن‌ آیات‌ را ظاهر سازی‌.»", "18": "<span>18 </span> &nbsp;پس‌ موسی‌ روانه‌ شده‌، نزد پدر زن‌ خود، یترون‌، برگشت‌ و به‌ وی‌ گفت‌: «بروم‌ و نزد برادران‌ خود كه‌ در مصرند برگردم‌، و ببینم‌ كه‌ تا كنون‌ زنده‌اند.» یترون‌ به‌ موسی‌ گفت‌: «به‌ سلامتی‌ برو.»", "19": "<span>19 </span> &nbsp;و خداوند در مدیان‌ به‌ موسی‌ گفت‌: «روانه‌ شده‌ به‌ مصر برگرد، زیرا آنانی‌ كه‌ در قصد جان‌ تو بودند، مرده‌اند.»", "20": "<span>20 </span> &nbsp;پس‌ موسی‌ زن‌ خویش‌ و پسران‌ خود را برداشته‌، ایشان‌ را بر الاغ‌ سوار كرده‌، به‌ زمین‌ مصر مراجعت‌ نمود، و موسی‌ عصای‌ خدا را به‌ دست‌ خود گرفت‌.", "21": "<span>21 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «چون‌ روانه‌ شده‌، به‌ مصر مراجعت‌ كردی‌، آگاه‌ باش‌ كه‌ همۀ علاماتی‌ را كه‌ به‌ دستت‌ سپرده‌ام‌ به‌ حضور فرعون‌ ظاهر سازی‌، و من‌ دل‌ او را سخت‌ خواهم‌ ساخت‌ تا قوم‌ را رها نكند.", "22": "<span>22 </span> &nbsp;و به‌ فرعون‌ بگو خداوند چنین‌ می‌گوید: اسرائیل‌، پسر من‌ و نخست‌زادۀ من‌ است‌،", "23": "<span>23 </span> &nbsp;و به‌ تو می‌گویم‌ پسرم‌ را رها كن‌ تا مرا عبادت‌ نماید، و اگر از رها كردنش‌ اِبا نمایی‌، همانا پسر تو، یعنی‌ نخست‌زادۀ تو را می‌كشم‌.»", "24": "<span>24 </span> &nbsp;و واقع‌ شد در بین‌ راه‌ كه‌ خداوند در منزل‌ بدو برخورده‌، قصد قتل‌ وی‌ نمود.", "25": "<span>25 </span> &nbsp;آنگاه‌ صِفوره‌ سنگی‌ تیز گرفته‌، غُلْفۀ پسر خود را ختنه‌ كرد و نزد پای‌ وی‌ انداخته‌، گفت‌: «تو مرا شوهر خون‌ هستی‌.»", "26": "<span>26 </span> &nbsp;پس‌ او وی‌ را رها كرد. آنگاه‌ (صفوره‌) گفت‌: «شوهر خون‌ هستی‌،» به‌ سبب‌ ختنه‌.", "27": "<span>27 </span> &nbsp;و خداوند به‌ هارون‌ گفت‌: «به‌ سوی‌ صحرا به‌ استقبال‌ موسی‌ برو.» پس‌ روانه‌ شد و او را در جبل‌الله‌ ملاقات‌ كرده‌، او را بوسید.", "28": "<span>28 </span> &nbsp;و موسی‌ از جمیع‌ كلمات‌ خداوند كه‌ او را فرستاده‌ بود، و از همۀ آیاتی‌ كه‌ به‌ وی‌ امر فرموده‌ بود، هارون‌ را خبر داد.", "29": "<span>29 </span> &nbsp;پس‌ موسی‌ و هارون‌ رفته‌، كل‌ مشایخ‌ بنی‌اسرائیل‌ را جمع‌ كردند.", "30": "<span>30 </span> &nbsp;و هارون‌ همۀ سخنانی‌ را كه‌ خداوند به‌ موسی‌ فرموده‌ بود، باز گفت‌، و آیات‌ را به‌ نظر قوم‌ ظاهر ساخت‌.", "31": "<span>31 </span> &nbsp;و قوم‌ ایمان‌ آوردند. و چون‌ شنیدند كه‌ خداوند از بنی‌اسرائیل‌ تفقد نموده‌، و به‌ مصیبت‌ ایشان‌ نظر انداخته‌ است‌، به‌ روی‌ در افتاده‌، سجده‌ كردند." }, "5": { "1": "<span>1 </span> &nbsp;و بعد از آن‌ موسی‌ و هارون‌ آمده‌، به‌ فرعون گفتند: «یهوه‌ خدای‌ اسرائیل‌ چنین‌ می‌گوید: قوم‌ مرا رها كن‌ تا برای‌ من‌ در صحرا عید نگاه‌ دارند.»", "2": "<span>2 </span> &nbsp;فرعون‌ گفت‌: «یهوه‌ كیست‌ كه‌ قول‌ او را بشنوم‌ و اسرائیل‌ را رهایی‌ دهم‌؟ یهوه‌ را نمی‌شناسم‌ و اسرائیل‌ را نیز رها نخواهم‌ كرد.»", "3": "<span>3 </span> &nbsp;گفتند: «خدای‌ عبرانیان‌ ما را ملاقات‌ كرده‌ است‌، پس‌ الا´ن‌ سفر سه‌ روزه‌ به‌ صحرا برویم‌، و نزد یهوه‌، خدای‌ خود، قربانی‌ بگذرانیم‌، مبادا ما را به‌ وبا یا شمشیر مبتلا سازد.»", "4": "<span>4 </span> &nbsp;پس‌ پادشاه‌ مصر بدیشان‌ گفت‌: «ای‌ موسی‌ و هارون‌ چرا قوم‌ را از كارهای‌ ایشان‌ بازمی‌دارید؟ به‌ شغلهای‌ خود بروید!»", "5": "<span>5 </span> &nbsp;و فرعون‌ گفت‌: «اینك‌ الا´ن‌ اهل‌ زمین‌ بسیارند، و ایشان‌ را از شغلهای‌ ایشان‌ بیكار می‌سازید.»", "6": "<span>6 </span> &nbsp;و در آن‌ روز، فرعون‌ سركاران‌ و ناظران‌ قوم‌خود را قدغن‌ فرموده‌، گفت‌:", "7": "<span>7 </span> &nbsp;« بعد از این‌، كاه‌ برای‌ خشت‌ سازی‌ مثل‌ سابق‌ بدین‌ قوم‌ مدهید. خود بروند و كاه‌ برای‌ خویشتن‌ جمع‌ كنند،", "8": "<span>8 </span> &nbsp;و همان‌ حساب‌ خشتهایی‌ را كه‌ پیشتر می‌ساختند، برایشان‌ بگذارید، و از آن‌ هیچ‌ كم‌ مكنید، زیرا كاهلند، و از این‌ رو فریاد می‌كنند و می‌گویند: برویم‌ تا برای‌ خدای‌ خود قربانی‌ گذرانیم‌.", "9": "<span>9 </span> &nbsp;و خدمت‌ ایشان‌ سخت‌تر شود تا در آن‌ مشغول‌ شوند، و به‌ سخنان‌ باطل‌ اعتنا نكنند.»", "10": "<span>10 </span> &nbsp;پس‌ سركاران‌ و ناظران‌ قوم‌ بیرون‌ آمده‌، قوم‌ را خطاب‌ كرده‌، گفتند: «فرعون‌ چنین‌ می‌فرماید كه‌ من‌ كاه‌ به‌ شما نمی‌دهم‌.", "11": "<span>11 </span> &nbsp;خود بروید و كاه‌ برای‌ خود از هرجا كه‌ بیابید بگیرید، و از خدمت‌ شما هیچ‌ كم‌ نخواهد شد.»", "12": "<span>12 </span> &nbsp;پس‌ قوم‌ در تمامی‌ زمین‌ مصر پراكنده‌ شدند تا خاشاك‌ به‌ عوض‌ كاه‌ جمع‌ كنند.", "13": "<span>13 </span> &nbsp;و سركاران‌، ایشان‌ را شتابانیده‌، گفتند: «كارهای‌ خود را تمام‌ كنید، یعنی‌ حساب‌ هر روز را در روزش‌، مثل‌ وقتی‌ كه‌ كاه‌ بود.»", "14": "<span>14 </span> &nbsp;و ناظرانِ بنی‌اسرائیل‌ را كه‌ سركاران‌ فرعون‌ بر ایشان‌ گماشته‌ بودند، می‌زدند و می‌گفتند: «چرا خدمت‌ معین‌ خشت‌سازی‌ خود را در این‌ روزها مثل‌ سابق‌ تمام‌ نمی‌كنید؟»", "15": "<span>15 </span> &nbsp;آنگاه‌ ناظران‌ بنی‌اسرائیل‌ آمده‌، نزد فرعون‌ فریاد كرده‌، گفتند: «چرا به‌ بندگان‌ خود چنین‌ می‌كنی‌؟", "16": "<span>16 </span> &nbsp;كاه‌ به‌ بندگانت‌ نمی‌دهند و می‌گویند: خشت‌ برای‌ ما بسازید! و اینك‌ بندگانت‌ را می‌زنند و اما خطا از قوم‌ تو می‌باشد.»", "17": "<span>17 </span> &nbsp;گفت‌: «كاهل‌ هستید. شما كاهلید! از این‌ سبب‌ شما می‌گویید: برویم‌ و برای‌ خداوند قربانی‌ بگذرانیم‌.", "18": "<span>18 </span> &nbsp;اكنون‌ رفته‌، خدمت‌بكنید، و كاه‌ به‌ شما داده‌ نخواهد شد، و حساب‌ خشت‌ را خواهید داد.»", "19": "<span>19 </span> &nbsp;و ناظران‌ بنی‌اسرائیل‌ دیدند كه‌ در بدی‌ گرفتار شده‌اند، زیرا گفت‌: «از حساب‌ یومیۀ خشتهای‌ خود هیچ‌ كم‌ مكنید.»", "20": "<span>20 </span> &nbsp;و چون‌ از نزد فرعون‌ بیرون‌ آمدند، به‌ موسی‌ و هارون‌ برخوردند، كه‌ برای‌ ملاقات‌ ایشان‌ ایستاده‌ بودند.", "21": "<span>21 </span> &nbsp;و بدیشان‌ گفتند: « خداوند بر شما بنگرد و داوری‌ فرماید! زیرا كه‌ رایحۀ ما را نزد فرعون‌ و ملازمانش‌ متعفن‌ ساخته‌اید، و شمشیری‌ به‌ دست‌ ایشان‌ داده‌اید تا ما را بكشند.»", "22": "<span>22 </span> &nbsp;آنگاه‌ موسی‌ نزد خداوند برگشته‌، گفت‌: «خداوندا چرا بدین‌ قوم‌ بدی‌ كردی‌؟ و برای‌ چه‌ مرا فرستادی‌؟", "23": "<span>23 </span> &nbsp;زیرا از وقتی‌ كه‌ نزد فرعون‌ آمدم‌ تا به‌ نام‌ تو سخن‌ گویم‌، بدین‌ قوم‌ بدی‌ كرده‌ است‌ و قوم‌ خود را هرگز خلاصی‌ ندادی‌.»" }, "6": { "1": "<span>1 </span> &nbsp;خداوند به‌ موسی‌ گفت‌: «الا´ن‌ خواهی‌ دید آنچه‌ به‌ فرعون‌ می‌كنم‌، زیرا كه‌ به‌ دست‌ قوی‌ ایشان‌ را رها خواهد كرد، و به‌ دست‌ زورآور ایشان‌ را از زمین‌ خود خواهد راند.»", "2": "<span>2 </span> &nbsp;و خدا به‌ موسی‌ خطاب‌ كرده‌، وی‌ را گفت‌: «من‌ یهوه‌ هستم‌.", "3": "<span>3 </span> &nbsp;و به‌ ابراهیم‌ و اسحاق‌ و یعقوب‌ به‌ نام‌ خدای‌ قادرمطلق‌ ظاهر شدم‌، لیكن‌ به‌ نام‌ خود، یهوه‌، نزد ایشان‌ معروف‌ نگشتم‌.", "4": "<span>4 </span> &nbsp;و عهد خود را نیز با ایشان‌ استوار كردم‌، كه‌ زمین‌ كنعان‌ را بدیشان‌ دهم‌، یعنی‌ زمین‌ غربت‌ ایشان‌ را كه‌ در آن‌ غریب‌ بودند.", "5": "<span>5 </span> &nbsp;و من‌ نیز چون‌ نالۀ بنی‌اسرائیل‌ را كه‌ مصریان‌ ایشان‌ را مملوك‌ خود ساخته‌اند، شنیدم‌، عهد خود را بیاد آوردم‌.", "6": "<span>6 </span> &nbsp;بنابراین‌ بنی‌اسرائیل‌ رابگو، من‌ یهوه‌ هستم‌، و شما را از زیر مشقت‌های‌ مصریان‌ بیرون‌ خواهم‌ آورد، و شما را از بندگی‌ ایشان‌ رهایی‌ دهم‌، و شما را به‌ بازوی‌ بلند و به‌ داوری‌های‌ عظیم‌ نجات‌ دهم‌.", "7": "<span>7 </span> &nbsp;و شما را خواهم‌ گرفت‌ تا برای‌ من‌ قوم‌ شوید، و شما را خدا خواهم‌ بود، و خواهید دانست‌ كه‌ من‌ یهوه‌ هستم‌، خدای‌ شما، كه‌ شما را از مشقت‌های‌ مصریان‌ بیرون‌ آوردم‌.", "8": "<span>8 </span> &nbsp;و شما را خواهم‌ رسانید به‌ زمینی‌ كه‌ دربارۀ آن‌ قسم‌ خوردم‌ كه‌ آن‌ را به‌ ابراهیم‌ و اسحاق‌ و یعقوب‌ بخشم‌. پس‌ آن‌ را به‌ ارثیت‌ شما خواهم‌ داد. من‌ یهوه‌ هستم‌.»", "9": "<span>9 </span> &nbsp;و موسی‌ بنی‌اسرائیل‌ را بدین‌ مضمون‌ گفت‌، لیكن‌ بسبب‌ تنگی‌ روح‌ و سختی‌ خدمت‌، او را نشنیدند.", "10": "<span>10 </span> &nbsp;و خداوند موسی‌ را خطاب‌ كرده‌، گفت‌:", "11": "<span>11 </span> &nbsp;«برو و به‌ فرعون‌ پادشاه‌ مصر بگو گه‌ بنی‌اسرائیل‌ را از زمین‌ خود رهایی‌ دهد.»", "12": "<span>12 </span> &nbsp;و موسی‌ به‌ حضور خداوند عرض‌ كرده‌، گفت‌: «اینك‌ بنی‌اسرائیل‌ مرا نمی‌شنوند، پس‌ چگونه‌ فرعون‌ مرا بشنود، و حال‌ آنكه‌ من‌ نامختون‌ لب‌ هستم‌؟»", "13": "<span>13 </span> &nbsp;و خداوند به‌ موسی‌ و هارون‌ تكلم‌ نموده‌، ایشان‌ را به‌ سوی‌ بنی‌اسرائیل‌ و به‌ سوی‌ فرعون‌ پادشاه‌ مصر مأمور كرد، تا بنی‌اسرائیل‌ را از زمین‌ مصر بیرون‌ آورند.", "14": "<span>14 </span> &nbsp;و اینانند رؤسای‌ خاندانهای‌ آبای‌ ایشان‌: پسران‌ رؤبین‌، نخست‌زادۀ اسرائیل‌، حَنُوك‌ و فَلّو و حَصرون‌ و كَرْمی‌؛ اینانند قبایل‌ رؤبین‌.", "15": "<span>15 </span> &nbsp;و پسران‌ شمعون‌: یموئیل‌ و یامین‌ و اُوهَد و یاكین‌ و صوحر و شاؤل‌ كه‌ پسر زن‌ كنعانی‌ بود؛ اینانند قبایل‌ شمعون‌.", "16": "<span>16 </span> &nbsp;و این‌ است‌ نامهای‌ پسران‌ لاوی‌ به‌ حسب‌ پیدایش‌ ایشان‌:جرشون‌ و قهات‌ و مِراری‌. و سالهای‌ عمر لاوی‌ صد و سی‌ و هفت‌ سال‌ بود.", "17": "<span>17 </span> &nbsp;پسران‌ جرشون‌: لِبِنی‌ و شِمعی‌، به‌ حسب‌ قبایل‌ ایشان‌.", "18": "<span>18 </span> &nbsp;و پسران‌ قُهات‌: عَمْرام‌ و یصهار و حَبرون‌ و عُزّیئیل‌. و سالهای‌ عمر قُهات‌ صد و سی‌ و سه‌ سال‌ بود.", "19": "<span>19 </span> &nbsp;و پسران‌ مراری‌: مَحْلی‌ و موشی‌؛ اینانند قبایل‌ لاویان‌ به‌ حسب‌ پیدایش‌ ایشان‌.", "20": "<span>20 </span> &nbsp;و عَمْرام‌ عمۀ خود، یوكابد را به‌ زنی‌ گرفت‌، و او برای‌ وی‌ هارون‌ و موسی‌ را زایید، و سالهای‌ عمر عمرام‌ صد و سی‌ و هفت‌ سال‌ بود.", "21": "<span>21 </span> &nbsp;و پسران‌ یصهار: قورح‌ و نافج‌ و زكری.‌", "22": "<span>22 </span> &nbsp;و پسران‌ عُزِّیئیل‌: میشائیل‌ و ایلصافن‌ و ستری‌.", "23": "<span>23 </span> &nbsp;و هارون‌، الیشابع‌، دختر عَمّیناداب‌، خواهر نَحْشون‌ را به‌ زنی‌ گرفت‌، و برایش‌ ناداب‌ و ابیهو و العازر و ایتامر را زایید.", "24": "<span>24 </span> &nbsp;و پسران‌ قورح‌: اَسّیر و القانه‌ و اَبیاساف‌؛ اینانند قبایل‌ قورحیان‌.", "25": "<span>25 </span> &nbsp;و العازر بن‌ هارون‌ یكی‌ از دختران‌ فوتیئیل‌ را به‌ زنی‌ گرفت‌، و برایش‌ فینحاس‌ را زایید؛ اینانند رؤسای‌ آبای‌ لاویان‌، بحسب‌ قبایل‌ ایشان‌.", "26": "<span>26 </span> &nbsp;اینانند هارون‌ و موسی‌ كه‌ خداوند بدیشان‌ گفت‌: «بنی‌اسرائیل‌ را با جنود ایشان‌ از زمین‌ مصر بیرون‌ آورید.»", "27": "<span>27 </span> &nbsp;اینانند كه‌ به‌ فرعون‌ پادشاه‌ مصر سخن‌ گفتند، برای‌ بیرون‌ آوردن‌ بنی‌اسرائیل‌ از مصر. اینان‌ موسی‌ و هارونند.", "28": "<span>28 </span> &nbsp;و واقع‌ شد در روزی‌ كه‌ خداوند در زمین‌ مصر موسی‌ را خطاب‌ كرد،", "29": "<span>29 </span> &nbsp;كه‌ خداوند به‌ موسی‌ فرموده‌، گفت‌: «من‌ یهوه‌ هستم‌؛ هر آنچه‌ من‌ به‌ تو گویم‌ آن‌ را به‌ فرعون‌ پادشاه‌ مصر بگو.»", "30": "<span>30 </span> &nbsp;و موسی‌ به‌ حضور خداوند عرض‌ كرد: «اینك‌ من‌ نامختون‌ لب‌ هستم‌، پس‌ چگونه‌ فرعون‌ مرابشنود؟»" }, "7": { "1": "<span>1 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «ببین‌ تو را بر فرعون‌ خدا ساخته‌ام‌، و برادرت‌، هارون‌، نبی‌ تو خواهد بود.", "2": "<span>2 </span> &nbsp;هرآنچه‌ به‌ تو امر نمایم‌ تو آن‌ را بگو، و برادرت‌ هارون‌، آن‌ را به‌ فرعون‌ باز گوید، تا بنی‌اسرائیل‌ را از زمین‌ خود رهایی‌ دهد.", "3": "<span>3 </span> &nbsp;و من‌ دل‌ فرعون‌ را سخت‌ می‌كنم‌، و آیات‌ و علامات‌ خود را در زمین‌ مصر بسیار می‌سازم‌.", "4": "<span>4 </span> &nbsp;و فرعون‌ به‌ شما گوش‌ نخواهد گرفت‌، و دست‌ خود را بر مصر خواهم‌ انداخت‌، تا جنود خود، یعنی‌ قوم‌ خویش‌ بنی‌اسرائیل‌ را از زمین‌ مصر به‌ داوریهای‌ عظیم‌ بیرون‌ آورم‌.", "5": "<span>5 </span> &nbsp;و مصریان‌ خواهند دانست‌ كه‌ من‌ یهوه‌ هستم‌، چون‌ دست‌ خود را بر مصر دراز كرده‌، بنی‌اسرائیل‌ را از میان‌ ایشان‌ بیرون‌ آوردم‌.»", "6": "<span>6 </span> &nbsp;و موسی‌ و هارون‌ چنانكه‌ خداوند بدیشان‌ امر فرموده‌ بود كردند، و هم‌ چنین‌ عمل‌ نمودند.", "7": "<span>7 </span> &nbsp;و موسی‌ هشتاد ساله‌ بود و هارون‌ هشتاد و سه‌ ساله‌، وقتی‌ كه‌ به‌ فرعون‌ سخن‌ گفتند.", "8": "<span>8 </span> &nbsp;پس‌ خداوند موسی‌ و هارون‌ را خطاب‌ كرده‌، گفت‌:", "9": "<span>9 </span> &nbsp;«چون‌ فرعون‌ شما را خطاب‌ كرده‌، گوید معجزه‌ای‌ برای‌ خود ظاهر كنید، آنگاه‌ به‌ هارون‌ بگو عصای‌ خود را بگیر، و آن‌ را پیش‌ روی‌ فرعون‌ بینداز، تا اژدها شود.»", "10": "<span>10 </span> &nbsp;آنگاه‌ موسی‌ و هارون‌ نزد فرعون‌ رفتند، و آنچه‌ خداوند فرموده‌ بود كردند. و هارون‌ عصای‌ خود را پیش‌ روی‌ فرعون‌ و پیش‌ روی‌ ملازمانش‌ انداخت‌، و اژدها شد.", "11": "<span>11 </span> &nbsp;و فرعون‌ نیز حكیمان‌ و جادوگران‌را طلبید و ساحران‌ مصر هم‌ به‌ افسونهای‌ خود چنین‌ كردند،", "12": "<span>12 </span> &nbsp;هر یك‌ عصای‌ خود را انداختند و اژدها شد، ولی‌ عصای‌ هارون‌ عصاهای‌ ایشان‌ را بلعید.", "13": "<span>13 </span> &nbsp;و دل‌ فرعون‌ سخت‌ شد و ایشان‌ را نشنید، چنانكه‌ خداوند گفته‌ بود.", "14": "<span>14 </span> &nbsp;و خداوند موسی‌ را گفت‌: «دل‌ فرعون‌ سخت‌ شده‌، و از رها كردن‌ قوم‌ ابا كرده‌ است‌.", "15": "<span>15 </span> &nbsp;بامدادان‌ نزد فرعون‌ برو؛ اینك‌ به‌ سوی‌ آب‌ بیرون‌ می‌آید؛ و برای‌ ملاقات‌ وی‌ به‌ كنار نهر بایست‌، و عصا را كه‌ به‌ مار مبدل‌ گشت‌، بدست‌ خود بگیر.", "16": "<span>16 </span> &nbsp;و او را بگو: یهوه‌ خدای‌ عبرانیان‌ مرا نزد تو فرستاده‌، گفت‌: قوم‌ مرا رها كن‌ تا مرا در صحرا عبادت‌ نمایند و اینك‌ تا بحال‌ نشنیده‌ای‌؛", "17": "<span>17 </span> &nbsp;پس‌ خداوند چنین‌ می‌گوید، از این‌ خواهی‌ دانست‌ كه‌ من‌ یهوه‌ هستم‌، همانا من‌ به‌ عصایی‌ كه‌ در دست‌ دارم‌ آبِ نهر را می‌زنم‌ و به‌ خون‌ مبدل‌ خواهد شد.", "18": "<span>18 </span> &nbsp;و ماهیانی‌ كه‌ در نهرند خواهند مرد، و نهر گندیده‌ شود و مصریان‌ نوشیدن‌ آب‌ نهر را مكروه‌ خواهند داشت‌.»", "19": "<span>19 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «به‌ هارون‌ بگو عصای‌ خود را بگیر و دست‌ خود را بر آبهای‌ مصر دراز كن‌، بر نهرهای‌ ایشان‌، و جویهای‌ ایشان‌، و دریاچه‌های‌ ایشان‌، و همه‌ حوضهای‌ آب‌ ایشان‌، تا خون‌ شود، و در تمامی زمین‌ مصر در ظروف‌ چوبی‌ و ظروف‌ سنگی‌، خون‌ خواهد بود.»", "20": "<span>20 </span> &nbsp;و موسی‌ و هارون‌ چنانكه‌ خداوند امر فرموده‌ بود، كردند و عصا را بلند كرده‌، آب‌ نهر را به‌ حضور فرعون‌ و به‌ حضور ملازمانش‌ زد، وتمامی آب‌ نهر به‌ خون‌ مبدّل‌ شد.", "21": "<span>21 </span> &nbsp;و ماهیانی‌ كه‌ در نهر بودند، مردند. و نهر بگندید، و مصریان‌ از آب‌ نهر نتوانستند نوشید، و در تمامی‌ زمین‌ مصر خون‌ بود.", "22": "<span>22 </span> &nbsp;و جادوگران‌ مصر به‌ افسونهای‌ خویش‌ هم‌ چنین‌ كردند، و دل‌ فرعون‌ سخت‌ شد، كه‌ بدیشان‌ گوش‌ نگرفت‌، چنانكه‌ خداوند گفته‌ بود.", "23": "<span>23 </span> &nbsp;و فرعون‌ برگشته‌، به‌ خانه‌ خود رفت‌ و بر این‌ نیز دل‌ خود را متوجه‌ نساخت‌.", "24": "<span>24 </span> &nbsp;و همه‌ مصریان‌ گرداگرد نهر برای‌ آب‌ خوردن‌ حفره‌ می‌زدند زیرا كه‌ از آب‌ نهر نتوانستند نوشید.", "25": "<span>25 </span> &nbsp;و بعد از آنكه‌ خداوند نهر را زده‌ بود، هفت‌ روز سپری‌ شد." }, "8": { "1": "<span>1 </span> &nbsp;و خداوند موسی‌ را گفت‌: «نزد فرعون‌ برو،و به‌ وی‌ بگو خداوند چنین‌ می‌گوید: قوم‌ مـرا رها كـن‌ تا مرا عبادت‌ نمایند.", "2": "<span>2 </span> &nbsp;و اگـر تو از رها كردن‌ ایشان‌ اِبا می‌كنی‌، همانا من‌ تمامی حدود تو را به‌ وَزَغهـا مبتلا سازم‌.", "3": "<span>3 </span> &nbsp;و نهـر، وزغهـا را به‌ كثرت‌ پیدا نماید، به‌ حدی‌ كه‌ برآمده‌، به‌ خانه‌ات‌ و خوابگاهت‌ و بسترت‌ و خانه‌های‌ بندگانت‌ و بر قومت‌ و به‌ تنورهایت‌ و تغارهای‌ خمیرت‌ درخواهنـد آمد،", "4": "<span>4 </span> &nbsp;و بر تو و قوم‌ تـو و همه‌ بندگان‌ تو وزغهـا برخواهنـد آمـد.»", "5": "<span>5 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «به‌ هارون‌ بگو: دست‌ خود را با عصای‌ خویش‌ بر نهرها و جویها و دریاچه‌ها دراز كن‌، و وزغها را بر زمین‌ مصر برآور.»", "6": "<span>6 </span> &nbsp;پس‌ چون‌ هارون‌ دست‌ خود را بر آبهای‌ مصر دراز كرد، وزغها برآمده‌، زمین‌ مصر را پوشانیدند.", "7": "<span>7 </span> &nbsp;و جادوگران‌ به‌ افسونهای‌ خود چنین‌ كردند، و وزغها بر زمین‌ مصر برآوردند.", "8": "<span>8 </span> &nbsp;آنگاه‌ فرعون‌ موسی‌ و هارون‌ را خوانده‌، گفت‌: «نزد خداوند دعا كنید، تا وزغها را از من‌ و قوم‌ من‌ دور كند، و قوم‌ را رها خواهم‌ كرد تا برای‌ خداوند قربانی‌ گذرانند.»", "9": "<span>9 </span> &nbsp;موسی‌ به‌ فرعون‌ گفت‌: «وقتی‌ را برای‌ من‌ معین‌ فرما كه‌ برای‌ تو و بندگانت‌ و قومت‌ دعا كنم‌ تا وزغها از تو و خانه‌ات‌ نابود شوند و فقط‌ در نهر بمانند.»", "10": "<span>10 </span> &nbsp;گفت‌: «فردا»، موسی‌ گفت‌: «موافق‌ سخن‌ تو خواهد شد تا بدانی‌ كه‌ مثل‌ یهوه‌ خدای‌ ما دیگری‌ نیست‌،", "11": "<span>11 </span> &nbsp;و وزغها از تو و خانه‌ات‌ و بندگانت‌ و قومت‌ دور خواهند شد و فقط‌ در نهر باقی‌ خواهند ماند.»", "12": "<span>12 </span> &nbsp;و موسی‌ و هارون‌ از نزد فرعون‌ بیرون‌ آمدند و موسی‌ درباره‌ وزغهایی‌ كه‌ بر فرعون‌ فرستاده‌ بود، نزد خداوند استغاثه‌ نمود.", "13": "<span>13 </span> &nbsp;و خداوند موافق‌ سخن‌ موسی‌ عمل‌ نمود و وَزَغْها از خانه‌ها و از دهات‌ و از صحراها مردند،", "14": "<span>14 </span> &nbsp;و آنها را توده‌ توده‌ جمع‌ كردند و زمیـن‌ متعفـن‌ شـد.", "15": "<span>15 </span> &nbsp;اما فرعون‌ چون‌ دید كه‌ آسایش‌ پدید آمد، دل‌ خود را سخت‌ كرد و بدیشان‌ گوش‌ نگرفت‌، چنانكه‌ خداوند گفته‌ بود.", "16": "<span>16 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «به‌ هارون‌ بگو كه‌ عصای‌ خود را دراز كن‌ و غبار زمین‌ را بزن‌ تا در تمامی‌ زمین‌ مصر پشه‌ها بشود.»", "17": "<span>17 </span> &nbsp;پس‌ چنین‌ كردند و هارون‌ دست‌ خود را با عصای‌ خویش‌ دراز كرد و غبار زمین‌ را زد و پشه‌ها بر انسان‌ و بهایم‌ پدید آمد زیرا كه‌ تمامی‌ غبار زمین‌ در كلّ ارض‌ مصر پشه‌ها گردید،", "18": "<span>18 </span> &nbsp;و جـادوگران‌ به‌ افسونهای‌ خود چنین‌ كردند تا پشه‌ها بیرون‌ آورَند اما نتوانستند و پشه‌ها بر انسان‌ و بهایم‌ پدید شد.", "19": "<span>19 </span> &nbsp;و جادوگران‌ به‌ فرعون‌ گفتند: «این‌ انگشت‌ خداست‌.» اما فرعون‌ را دل‌ سخت‌ شد كه‌ بدیشان‌ گوش‌ نگرفت‌، چنانكه‌ خداوند گفته‌ بود.", "20": "<span>20 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «بامدادان‌ برخاسته‌ پیش‌روی‌ فرعون‌ بایست‌. اینك‌ بسوی‌ آب‌ بیرون‌ می‌آید. و او را بگو: خداوند چنین‌ می‌گوید: قوم‌ مرا رها كن‌ تا مرا عبادت‌ نمایند،", "21": "<span>21 </span> &nbsp;زیرا اگر قوم‌ مرا رها نكنی‌، همانا من‌ بر تو و بندگانت‌ و قومت‌ و خانه‌هایت‌ انواع‌ مگسها فرستم‌ و خانه‌های‌ مصریان‌ و زمینی‌ نیز كه‌ برآنند از انواع‌ مگسها پر خواهد شد.", "22": "<span>22 </span> &nbsp;و در آن‌ روز زمین‌ جوشن‌ را كه‌ قوم‌ من‌ در آن‌ مقیمند، جدا سازم‌ كه‌ در آنجا مگسی‌ نباشد تا بدانی‌ كه‌ من‌ در میان‌ این‌ زمین‌ یهوه‌ هستم‌.", "23": "<span>23 </span> &nbsp;و فرقی‌ در میان‌ قوم‌ خود و قوم‌ تو گذارم‌. فردا این‌ علامت‌ خواهد شد.»", "24": "<span>24 </span> &nbsp;و خداوند چنین‌ كرد و انواع‌ مگسهای‌ بسیار به‌ خانه‌ فرعون‌ و به‌ خانه‌های‌ بندگانش‌ و به‌ تمامی‌ زمین‌ مصر آمدند و زمین‌ از مگسها ویران‌ شد.", "25": "<span>25 </span> &nbsp;و فرعون‌ موسی‌ و هارون‌ را خوانده‌ گفت‌: «بروید و برای‌ خدای‌ خود قربانی‌ در این‌ زمین‌ بگذرانید.»", "26": "<span>26 </span> &nbsp;موسی‌ گفت‌: «چنین‌ كردن‌ نشاید زیرا آنچه‌ مكروه‌ مصریان‌ است‌ برای‌ یهوه‌ خدای‌ خود ذبح‌ می‌كنیم‌. اینك‌ چون‌ مكروه‌ مصریان‌ را پیش‌ روی‌ ایشان‌ ذبح‌ نماییم‌، آیا ما را سنگسار نمی‌كنند؟", "27": "<span>27 </span> &nbsp;سفر سه‌ روزه‌ به‌ صحرا برویم‌ و برای‌ یهوه‌ خدای‌ خود قربانی‌ بگذرانیم‌ چنانكه‌ به‌ ما امر خواهد فرمود.»", "28": "<span>28 </span> &nbsp;فرعون‌ گفت‌: «من‌ شما را رهایی‌ خواهم‌ داد تا برای‌ یهوه‌، خدای‌ خود، در صحرا قربانی‌ گذرانید لیكن‌ بسیار دور مروید و برای‌ من‌ دعا كنید.»", "29": "<span>29 </span> &nbsp;موسی‌ گفت‌: «همانا من‌ از حضورت‌ بیرون‌ می‌روم‌ و نزد خداوند دعا می‌كنم‌ و مگسها از فرعون‌ و بندگانش‌ و قومش‌ فردا دور خواهند شد. اما زنهار فرعون‌ بار دیگر حیله‌ نكند كه‌ قوم‌ را رهایی‌ ندهد تا برای‌ خداوند قربانی‌ گذرانند.»", "30": "<span>30 </span> &nbsp;پس‌ موسی‌ از حضور فرعون‌ بیرون‌ شده‌، نزد خداوند دعا كرد،", "31": "<span>31 </span> &nbsp;و خداوند موافق‌ سخن‌ موسی‌ عمل‌ كرد و مگسها را از فرعون‌ و بندگانش‌ و قومش‌ دور كرد كه‌ یكی‌ باقی‌ نماند.", "32": "<span>32 </span> &nbsp;اما در این‌ مرتبه‌ نیز فرعون‌ دل‌ خود را سخت‌ ساخته‌، قوم‌ را رهایی‌ نداد." }, "9": { "1": "<span>1 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «نزد فرعون‌ بروو به‌ وی‌ بگو: یهوه‌ خدای‌ عبرانیان‌ چنین‌ می‌گوید: قوم‌ مرا رها كن‌ تا مرا عبادت‌ كنند.", "2": "<span>2 </span> &nbsp;زیرا اگر تو از رهایی‌ دادن‌ ابا نمایی‌ و ایشان‌ را باز نگاه‌ داری‌،", "3": "<span>3 </span> &nbsp;همانا دست‌ خداوند بر مواشی‌ تو كه‌ در صحرایند خواهد شد، بر اسبان‌ و الاغان‌ و شتران‌ و گاوان‌ و گوسفندان‌، یعنی‌ وبایی‌ بسیار سخت‌.", "4": "<span>4 </span> &nbsp;و خداوند در میان‌ مواشی‌ اسرائیلیان‌ و مواشی‌ مصریان‌ فرقی‌ خواهد گذاشت‌ كه‌ از آنچه‌ مال‌ بنی‌اسرائیل‌ است‌، چیزی‌ نخواهد مرد.»", "5": "<span>5 </span> &nbsp;و خداوند وقتی‌ معین‌ نموده‌، گفت‌: «فردا خداوند این‌ كار را در این‌ زمین‌ خواهد كرد.»", "6": "<span>6 </span> &nbsp;پس‌ در فردا خداوند این‌ كار را كرد و همه‌ مواشی‌ مصریان‌ مردند و از مواشی‌ بنی‌اسرائیل‌ یكی‌ هم‌ نمرد.", "7": "<span>7 </span> &nbsp;وفرعون‌ فرستاد و اینك‌ از مواشی‌ اسرائیلیان‌ یكی‌ هم‌ نمرده‌ بود. اما دل‌ فرعون‌ سخت‌ شده‌، قوم‌ را رهایی‌ نداد.", "8": "<span>8 </span> &nbsp;و خداوند به‌ موسی‌ و هارون‌ گفت‌: «از خاكستر كوره‌، مُشتهای‌ خود را پر كرده‌، بردارید و موسی‌ آن‌ را به‌ حضور فرعون‌ بسوی‌ آسمان‌ برافشاندَ،", "9": "<span>9 </span> &nbsp;و غبار خواهد شد بر تمامی‌ زمین‌ مصر و سوزشی‌ كه‌ دمّلها بیرون‌ آورد بر انسان‌ و بر بهایم‌ در تمامی‌ زمین‌ مصر خواهد شد.»", "10": "<span>10 </span> &nbsp;پس‌ از خاكستر كوره‌ گرفتند و به‌ حضور فرعون‌ ایستادند و موسی‌ آن‌ را بسوی‌ آسمان‌ پراكند، و سوزشی‌ پدید شده‌، دملها بیرون‌ آورد، در انسان‌ و در بهایم‌.", "11": "<span>11 </span> &nbsp;و جادوگران‌ به‌ سبب‌ آن‌ سوزش‌ به‌ حضور موسی‌ نتوانستند ایستاد، زیرا كه‌ سوزش‌ بر جادوگران‌ و بر همۀ مصریان‌ بود.", "12": "<span>12 </span> &nbsp;و خداوند دل‌ فرعون‌ را سخت‌ ساخت‌ كه‌ بدیشان‌ گوش‌ نگرفت‌، چنانكه‌ خداوند به‌ موسی‌ گفته‌ بود.", "13": "<span>13 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «بامدادان‌ برخاسته‌، پیش‌ روی‌ فرعون‌ بایست‌، و به‌ وی‌ بگو: یهوه‌ خدای‌ عبرانیان‌ چنین‌ می‌گوید: قوم‌ مرا رها كن‌ تا مرا عبادت‌ نمایند.", "14": "<span>14 </span> &nbsp;زیرا در این‌ دفعه‌ تمامی‌ بلایای‌ خود را بر دل‌ تو و بندگانت‌ و قومت‌ خواهم‌ فرستاد، تا بدانی‌ كه‌ در تمامی‌ جهان‌ مثل‌ من‌ نیست‌.", "15": "<span>15 </span> &nbsp;زیرا اگر تاكنون‌ دست‌ خود را دراز كرده‌، و تو را و قومت‌ را به‌ وبا مبتلا ساخته‌ بودم‌، هرآینه‌ از زمین‌ هلاك‌ می‌شدی‌.", "16": "<span>16 </span> &nbsp;و لكن‌ برای‌ همین‌ تو را برپا داشته‌ام‌ تا قدرت‌ خود را به‌ تو نشان‌ دهم‌، و نام‌ من‌ در تمامی‌ جهان‌ شایع‌ شود.", "17": "<span>17 </span> &nbsp;و آیا تابحال‌ خویشتن‌ را بر قوم‌ من‌ برتر می‌سازی‌ و ایشان‌ را رهایی‌ نمی‌دهی‌؟", "18": "<span>18 </span> &nbsp;همانا فردا این‌ وقت‌، تگرگی‌ بسیار سخت‌ خواهم‌ بارانید، كه‌ مثل‌ آن‌ در مصر از روز بنیانش‌ تاكنون‌ نشده‌ است‌.", "19": "<span>19 </span> &nbsp;پس‌ الا´ن‌ بفرست‌ و مواشی‌ خود و آنچه‌ را در صحرا داری‌ جمع‌ كن‌، زیرا كه‌ بر هر انسان‌ و بهایمی‌ كه‌ در صحرا یافته‌ شوند، و به‌ خانه‌ها جمع‌ نشوند، تگرگ‌ فرود خواهد آمد و خواهند مرد.»", "20": "<span>20 </span> &nbsp;پس‌ هر كس‌ از بندگان‌ فرعون‌ كه‌ از قول‌ خداوند ترسید، نوكران‌ و مواشی‌ خود را به‌ خانه‌ها گریزانید.", "21": "<span>21 </span> &nbsp;اما هر كه‌ دل‌ خود را به‌ كلام‌ خداوند متوجه‌ نساخت‌، نوكران‌ و مواشی‌ خود را در صحرا واگذاشت.", "22": "<span>22 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «دست‌ خود را به‌ سوی‌ آسمان‌ دراز كن‌، تا در تمامی‌ زمین‌ مصر تگرگ‌ بشود، بر انسان‌ و بر بهایم‌ و بر همۀ نباتات‌ صحرا، در كل‌ ارض‌ مصر.»", "23": "<span>23 </span> &nbsp;پس‌ موسی‌ عصای‌ خود را به‌ سوی‌ آسمان‌ دراز كرد، و خداوند رعد و تگرگ‌ داد، و آتش‌ بر زمین‌ فرود آمد، و خداوند تگرگ‌ بر زمین‌ مصر بارانید.", "24": "<span>24 </span> &nbsp;و تگرگ‌ آمد و آتشی‌ كه‌ در میان‌ تگرگ‌ آمیخته‌ بود، و به‌ شدت‌ سخت‌ بود، كه‌ مثل‌ آن‌ در تمامی‌ زمین‌ مصر از زمانی‌ كه‌ اُمت‌ شده‌ بودند، نبود.", "25": "<span>25 </span> &nbsp;و در تمامی‌ زمین‌ مصر، تگرگ‌ آنچه‌ را كه‌ در صحرا بود، از انسان‌ و بهایم‌ زد. و تگرگ‌ همۀ نباتات‌ صحرا را زد، و جمیع‌ درختان‌ صحرا را شكست‌.", "26": "<span>26 </span> &nbsp;فقط‌ در زمین‌ جوشن‌، جایی‌ كه‌ بنی‌اسرائیل‌ بودند، تگرگ‌ نبود.", "27": "<span>27 </span> &nbsp;آنگاه‌ فرعون‌ فرستاده‌، موسی‌ و هارون‌ را خواند، و بدیشان‌ گفت‌: «در این‌ مرتبه‌ گناه‌ كرده‌ام‌؛ خداوند عادل‌ است‌ و من‌ و قوم‌ من‌ گناهكاریم‌.", "28": "<span>28 </span> &nbsp;نزد خداوند دعا كنید، زیرا كافی‌ است‌ تا رعدهای‌ خدا و تگرگ‌ دیگر نشود، و شما را رها خواهم‌ كرد، و دیگر درنگ‌ نخواهید نمود.»", "29": "<span>29 </span> &nbsp;موسی‌ به‌ وی‌ گفت‌: «چون‌ از شهر بیرون‌ روم‌، دستهای‌ خود را نزد خداوند خواهم‌ افراشت‌، تا رعدها موقوف‌ شود، و تگرگ‌ دیگر نیاید، تا بدانی‌ جهان‌ از آن‌ خداوند است‌.", "30": "<span>30 </span> &nbsp;و اما تو و بندگانت‌، می‌دانم‌ كه‌ تابحال‌ از یهوه‌ خدا نخواهید ترسید.»", "31": "<span>31 </span> &nbsp;و كتان‌ و جو زده‌ شد، زیرا كه‌ جو خوشه‌ آورده‌ بود، و كتان‌ تخم‌ داشته‌.", "32": "<span>32 </span> &nbsp;و اما گندم‌ و خُلَّر زده‌ نشد زیرا كه‌ متأخر بود.", "33": "<span>33 </span> &nbsp;و موسی‌ از حضور فرعون‌ از شهر بیرون‌ شده‌، دستهای‌ خود را نزد خداوند برافراشت‌، و رعدها و تگرگ‌ موقوف‌ شد، و باران‌ بر زمین‌ نبارید.", "34": "<span>34 </span> &nbsp;و چون‌ فرعون‌ دید كه‌ باران‌ و تگرگ‌ و رعدها موقوف‌ شد، باز گناه‌ ورزیده‌، دل‌ خود را سخت‌ ساخت‌، هم‌ او و هم‌ بندگانش‌.", "35": "<span>35 </span> &nbsp;پس‌ دل‌ فرعون‌ سخت‌ شده‌، بنی‌اسرائیل‌ را رهایی‌ نداد، چنانكه‌ خداوند به‌ دست‌ موسی‌ گفته‌ بود." }, "10": { "1": "<span>1 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «نزد فرعون‌ برو زیرا كه‌ من‌ دل‌ فرعون‌ و دل‌ بندگانش‌ را سخت‌ كرده‌ام‌، تا این‌ آیات‌ خود را در میان‌ ایشان‌ ظاهر سازم‌.", "2": "<span>2 </span> &nbsp;و تا آنچه‌ در مصر كردم‌ و آیات‌ خود را كه‌ در میان‌ ایشان‌ ظاهر ساختم‌، بگوش‌ پسرت‌ و پسر پسرت‌ بازگویی‌ تا بدانید كه‌ من‌ یهوه‌ هستم‌.»", "3": "<span>3 </span> &nbsp;پس‌ موسی‌ و هارون‌ نزد فرعون‌ آمده‌، به‌ وی‌ گفتند: «یهوه‌ خدای‌ عبرانیان‌ چنین‌ می‌گوید: تا به‌ كی‌ از تواضع‌ كردن‌ به‌ حضور من‌ ابا خواهی‌ نمود؟ قوم‌ مرا رها كن‌ تا مرا عبادت‌ كنند.", "4": "<span>4 </span> &nbsp;زیرا اگر تو از رها كردن‌ قوم‌ من‌ ابا كنی‌، هرآینه‌ من‌ فردا ملخها در حدود تو فرود آورم‌.", "5": "<span>5 </span> &nbsp;كه‌ روی‌ زمین‌ را مستور خواهند ساخت‌، به‌ حدی‌ كه‌ زمین‌ را نتوان‌ دید، و تتمّۀ آنچه‌ رَسته‌ است‌ كه‌ برای‌ شما از تگرگ‌ باقی‌ مانده‌، خواهند خورد، و هر درختی‌ را كه‌ برای‌ شما در صحرا روییده‌ است‌، خواهند خورد.", "6": "<span>6 </span> &nbsp;و خانۀ تو و خانه‌های‌ بندگانت‌ و خانه‌های‌ همۀ مصریان‌ را پر خواهند ساخت‌، به‌ مرتبه‌ای‌ كه‌ پدرانت‌ و پدران‌ پدرانت‌ از روزی‌ كه‌ بر زمین‌ بوده‌اند تا اَلیوم‌ ندیده‌اند.» پس‌ روگردانیده‌، از حضور فرعون‌ بیرون‌ رفت‌.", "7": "<span>7 </span> &nbsp;آنگاه‌ بندگان‌ فرعون‌ به‌ وی‌ گفتند: «تا به‌ كی‌ برای‌ ما این‌ مرد دامی‌ باشد؟ این‌ مردمان‌ را رها كن‌ تا یهوه‌، خدای‌ خود را عبادت‌ نمایند. مگر تابحال‌ ندانسته‌ای‌ كه‌ مصر ویران‌ شده‌ است‌؟»", "8": "<span>8 </span> &nbsp;پس‌ موسی‌ و هارون‌ را نزد فرعون‌ برگردانیدند، و او به‌ ایشان‌ گفت‌: «بروید و یهوه‌، خدای‌ خود را عبادت‌ كنید. لیكن‌ كیستند كه‌ می‌روند؟»", "9": "<span>9 </span> &nbsp;موسی‌ گفت‌: «با جوانان‌ و پیران‌ خود خواهیم‌ رفت‌، با پسران‌ و دختران‌، و گوسفندان‌ و گاوان‌ خود خواهیم‌ رفت‌، زیرا كه‌ ما را عیدی‌ برای‌ خداوند است‌.»", "10": "<span>10 </span> &nbsp;بدیشان‌ گفت‌: « خداوند با شما چنین‌ باشد، اگر شما را با اطفال‌ شما رهایی‌ دهم‌. با حذر باشید زیرا كه‌ بدی‌ پیش‌ روی‌ شماست‌!", "11": "<span>11 </span> &nbsp;نه‌ چنین‌! بلكه‌ شما كه‌ بالغ‌ هستید رفته‌، خداوند را عبادت‌ كنید، زیرا كه‌ این‌ است‌ آنچه‌ خواسته‌ بودید.» پس‌ ایشان‌ را از حضور فرعون‌ بیرون‌ راندند.", "12": "<span>12 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «دست‌ خود را برای‌ ملخها بر زمین‌ مصر دراز كن‌، تا بر زمین‌ مصر برآیند، و همۀ نباتات‌ زمین‌ را كه‌ از تگرگ‌ مانده‌ است‌، بخورند.»", "13": "<span>13 </span> &nbsp;پس‌ موسی‌ عصای‌ خود را برزمین‌ مصر دراز كرد، و خداوند تمامی‌ آن‌ روز، و تمامی‌ آن‌ شب‌ را بادی‌ شرقی‌ بر زمین‌ مصر وزانید، و چون‌ صبح‌ شد، باد شرقی‌ ملخها را آورد.", "14": "<span>14 </span> &nbsp;و ملخها بر تمامی‌ زمین‌ مصر برآمدند، و در همۀ حدود مصر نشستند، بسیار سخت‌ كه‌ قبل‌ از آن‌ چنین‌ ملخها نبود، و بعد از آن‌ نخواهد بود.", "15": "<span>15 </span> &nbsp;و روی‌ تمامی‌ زمین‌ را پوشانیدند، كه‌ زمین‌ تاریك‌ شد و همۀ نباتات‌ زمین‌ و همۀ میوۀ درختان‌ را كه‌ از تگرگ‌ باقی‌ مانده‌ بود، خوردند، به‌ حدی‌ كه‌ هیچ‌ سبزی‌ بر درخت‌ و نبات‌ صحرا در تمامی‌ زمین‌ مصر نماند.", "16": "<span>16 </span> &nbsp;آنگاه‌ فرعون‌، موسی‌ و هارون‌ را به‌ زودی‌ خوانده‌، گفت‌: «به‌ یهوه‌ خدای‌ شما و به‌ شما گناه‌ كرده‌ام‌.", "17": "<span>17 </span> &nbsp;و اكنون‌ این‌ مرتبه‌ فقط‌ گناه‌ مرا عفو فرمایید، و از یهوه‌ خدای‌ خود استدعا نمایید تا این‌ موت‌ را فقط‌ از من‌ برطرف‌ نماید.»", "18": "<span>18 </span> &nbsp;پس‌ از حضور فرعون‌ بیرون‌ شده‌، از خداوند استدعا نمود.", "19": "<span>19 </span> &nbsp;و خداوند باد غربی‌ای‌ بسیار سخت‌ برگردانید، كه‌ ملخها را برداشته‌، آنها را به‌ دریای‌ قلزم‌ ریخت‌، و در تمامی‌ حدود مصر ملخی‌ نماند.", "20": "<span>20 </span> &nbsp;اما خداوند دل‌ فرعون‌ را سخت‌ گردانید، كه‌ بنی‌اسرائیل‌ را رهایی‌ نداد.", "21": "<span>21 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «دست‌ خود را به‌ سوی‌ آسمان‌ برافراز، تا تاریكی‌ای‌ بر زمین‌ مصر پدید آید، تاریكی‌ای‌ كه‌ بتوان‌ احساس‌ كرد.»", "22": "<span>22 </span> &nbsp;پس‌ موسی‌ دست‌ خود را به‌ سوی‌ آسمان‌ برافراشت‌، و تاریكی غلیظ‌ تا سه‌ روز در تمامی‌ زمین‌ مصر پدید آمد", "23": "<span>23 </span> &nbsp;و یكدیگر را نمی‌دیدند.و تا سه‌ روز كسی‌ از جای‌ خود برنخاست‌، لیكن‌ برای‌ جمیع‌ بنی‌اسرائیل‌ در مسكنهای‌ ایشان‌ روشنایی‌ بود.", "24": "<span>24 </span> &nbsp;و فرعون‌ موسی‌ را خوانده‌، گفت‌: «بروید خداوند را عبادت‌ كنید، فقط‌ گله‌ها و رمه‌های‌ شما بماند، اطفال‌ شما نیز با شما بروند.»", "25": "<span>25 </span> &nbsp;موسی‌ گفت‌: «ذبایح‌ و قربانی‌های‌ سوختنی‌ نیز می‌باید به‌ دست‌ ما بدهی‌، تا نزد یهوه‌، خدای‌ خود بگذرانیم‌.", "26": "<span>26 </span> &nbsp;مواشی‌ ما نیز با ما خواهد آمد، یك‌ سُمی‌ باقی‌ نخواهد ماند زیرا كه‌ از اینها برای‌ عبادت‌ یهوه‌، خدای‌ خود می‌باید گرفت‌، و تا بدانجا نرسیم‌، نخواهیم‌ دانست‌ به‌ چه‌ چیز خداوند را عبادت‌ كنیم‌.»", "27": "<span>27 </span> &nbsp;و خداوند ، دل‌ فرعون‌ را سخت‌ گردانید كه‌ از رهایی‌ دادن‌ ایشان‌ اِبا نمود.", "28": "<span>28 </span> &nbsp;پس‌ فرعون‌ وی‌ را گفت‌: «از حضور من‌ برو! و با حذر باش‌ كه‌ روی‌ مرا دیگر نبینی‌، زیرا در روزی‌ كه‌ مرا ببینی‌ خواهی‌ مرد.»", "29": "<span>29 </span> &nbsp;موسی‌ گفت‌: «نیكو گفتی‌، روی‌ تو را دیگر نخواهم‌ دید.»" }, "11": { "1": "<span>1 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «یك‌ بلای‌دیگر بر فرعون‌ و بر مصر می‌آورم‌، و بعد از آن‌ شما را از اینجا رهایی‌ خواهد داد، و چون‌ شما را رها كند، البته‌ شما را بالكلّیه‌ از اینجا خواهد راند.", "2": "<span>2 </span> &nbsp;اكنون‌ به‌ گوش‌ قوم‌ بگو كه‌ هر مرد از همسایۀ خود، و هر زن‌ از همسایه‌اش‌ آلات‌ نقره‌ و آلات‌ طلا بخواهند.»", "3": "<span>3 </span> &nbsp;و خداوند قوم‌ را در نظر مصریان‌ محترم‌ ساخت‌. و شخص‌ موسی‌ نیز در زمین‌ مصر، در نظر بندگان‌ فرعون‌ و در نظر قوم‌، بسیار بزرگ‌ بود.", "4": "<span>4 </span> &nbsp;و موسی‌ گفت‌: « خداوند چنین‌ می‌گوید: قریب‌ به‌ نصف‌ شب‌ در میان‌ مصر بیرون‌ خواهم‌ آمد.", "5": "<span>5 </span> &nbsp;و هر نخست‌زاده‌ای‌ كه‌ در زمین‌ مصر باشد، از نخست‌زادۀ فرعون‌ كه‌ بر تختش‌ نشسته‌ است‌، تا نخست‌زادۀ كنیزی‌ كه‌ در پشت‌ دستاس‌ باشد، و همۀ نخست‌زادگان‌ بهایم‌ خواهند مرد.", "6": "<span>6 </span> &nbsp;و نعرۀ عظیمی‌ در تمامی‌ زمین‌ مصر خواهد بود كه‌ مثل‌ آن‌ نشده‌، و مانند آن‌ دیگر نخواهد شد.", "7": "<span>7 </span> &nbsp;اما بر جمیع‌ بنی‌اسرائیل‌ سگی‌ زبان‌ خود را تیز نكند، نه‌ بر انسان‌ و نه‌ بر بهایم‌، تا بدانید كه‌ خداوند در میان‌ مصریان‌ و اسرائیلیان‌ فرقی‌ گذارده‌ است.", "8": "<span>8 </span> &nbsp;و این‌ همۀ بندگان‌ تو به‌ نزد من‌ فرود آمده‌، و مرا تعظیم‌ كرده‌، خواهند گفت‌: تو و تمامی‌ قوم‌ كه‌ تابع‌ تو باشند، بیرون‌ روید! و بعد از آن‌ بیرون‌ خواهم‌ رفت‌.» پس‌ از حضور فرعون‌ در شدت‌ غضب‌ بیرون‌ آمد.", "9": "<span>9 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «فرعون‌ به‌ شما گوش‌ نخواهد گرفت‌، تا آیات‌ من‌ در زمین‌ مصر زیاد شود.»", "10": "<span>10 </span> &nbsp;و موسی‌ و هارون‌ جمیع‌ این‌ آیات‌ را به‌ حضور فرعون‌ ظاهر ساختند. اما خداوند دل‌ فرعون‌ را سخت‌ گردانید، و بنی‌اسرائیل‌ را از زمین‌ خود رهایی‌ نداد." }, "12": { "1": "<span>1 </span> &nbsp;و خداوند موسی‌ و هارون‌ را در زمین مصر مخاطب‌ ساخته‌، گفت‌:", "2": "<span>2 </span> &nbsp;«این‌ ماه‌ برای‌ شما سر ماهها باشد، این‌ اول‌ از ماههای‌ سال‌ برای‌ شماست‌.", "3": "<span>3 </span> &nbsp;تمامی‌ جماعت‌ اسرائیل‌ را خطاب‌ كرده‌، گویید كه‌ در دهم‌ این‌ ماه‌ هر یكی‌ از ایشان‌ بره‌ای‌ به‌ حسب‌ خانه‌های‌ پدران‌ خود بگیرند، یعنی‌ برای‌ هر خانه‌ یك‌ بره‌.", "4": "<span>4 </span> &nbsp;و اگر اهل‌خانه‌ برای‌ بره‌ كم‌ باشند، آنگاه‌ او و همسایه‌اش‌ كه‌ مجاور خانۀ او باشد آن‌ را به‌ حسب‌ شمارۀ نفوس‌ بگیرند، یعنی‌ هر كس‌ موافق‌ خوراكش‌ بره‌ را حساب‌ كند.", "5": "<span>5 </span> &nbsp;برۀ شما بی‌عیب‌، نرینۀ یكساله‌ باشد، از گوسفندان‌ یا از بزها آن‌ را بگیرید.", "6": "<span>6 </span> &nbsp;و آن‌ را تا چهاردهم‌ این‌ ماه‌ نگاه‌ دارید، و تمامی‌ انجمن‌ جماعت‌ بنی‌اسرائیل‌ آن‌ را در عصر ذبح‌ كنند", "7": "<span>7 </span> &nbsp;و از خون‌ آن‌ بگیرند، و آن‌ را بر هر دو قایمه‌، و سردر خانه‌ كه‌ در آن‌، آن‌ را می‌خورند، بپاشند.", "8": "<span>8 </span> &nbsp;و گوشتش‌ را در آن‌ شب‌ بخورند. به‌ آتش‌ بریان‌ كرده‌، با نان‌ فطیر و سبزیهای‌ تلخ‌ آن‌ را بخورند.", "9": "<span>9 </span> &nbsp;و از آن‌ هیچ‌ خام‌ نخورید، و نه‌ پخته‌ با آب‌، بلكه‌ به‌ آتش‌ بریان‌ شده‌، كله‌اش‌ و پاچه‌هایش‌ و اندرونش‌ را.", "10": "<span>10 </span> &nbsp;و چیزی‌ از آن‌ تا صبح‌ نگاه‌ مدارید. و آنچه‌ تا صبح‌ مانده‌ باشد، به‌ آتش‌ بسوزانید.", "11": "<span>11 </span> &nbsp;و آن‌ را بدین‌ طور بخورید: كمر شما بسته‌، و نعلین‌ بر پایهای‌ شما، و عصا در دست‌ شما، و آن‌ را به‌ تعجیل‌ بخورید، چونكه‌ فِصَح‌ خداوند است‌.", "12": "<span>12 </span> &nbsp;« و در آن‌ شب‌ از زمین‌ مصر عبور خواهم‌ كرد، و همۀ نخست‌زادگان‌ زمین‌ مصر را از انسان‌ و بهایم‌ خواهم‌ زد، و بر تمامی‌ خدایان‌ مصر داوری‌ خواهم‌ كرد. من‌ یهوه‌ هستم‌.", "13": "<span>13 </span> &nbsp;و آن‌ خون‌، علامتی‌ برای‌ شما خواهد بود، بر خانه‌هایی‌ كه‌ در آنها می‌باشید. و چون‌ خون‌ را ببینم‌، از شما خواهم‌ گذشت‌ و هنگامی‌ كه‌ زمین‌ مصر را می‌زنم‌، آن‌ بلا برای‌ هلاك‌ شما بر شما نخواهد آمد.", "14": "<span>14 </span> &nbsp;و آن‌ روز، شما را برای‌ یادگاری‌ خواهد بود، و در آن‌، عیدی‌ برای‌ خداوند نگاه‌ دارید، و آن‌ را به‌ قانون‌ ابدی‌، نسلاً بعد نسل‌ عید نگاه‌ دارید.", "15": "<span>15 </span> &nbsp;هفت‌ روز نان‌ فطیر خورید، در روز اول‌ خمیرمایه‌ را از خانه‌های‌ خود بیرون‌ كنید، زیرا هر كه‌ از روز نخستین‌ تا روز هفتمین‌ چیزی‌ خمیر شده‌ بخورد، آن‌ شخص‌ از اسرائیل‌ منقطع‌ گردد.", "16": "<span>16 </span> &nbsp;و در روز اول‌، محفل‌ مقدس‌، و در روز هفتم‌، محفل‌ مقدس‌ برای‌ شما خواهد بود. در آنها هیچ‌ كار كرده‌ نشود جز آنچه‌ هر كس‌ باید بخورد؛ آن‌ فقط‌ در میان‌ شما كرده‌ شود.", "17": "<span>17 </span> &nbsp;پس‌ عید فطیر را نگاه‌ دارید، زیرا كه‌ در همان‌ روز لشكرهای‌ شما را از زمین‌ مصر بیرون‌ آوردم‌. بنابراین‌، این‌ روز را در نسلهای‌ خود به‌ فریضۀ ابدی‌ نگاه‌ دارید.", "18": "<span>18 </span> &nbsp;در ماه‌ اول‌ در روز چهاردهم‌ ماه‌، در شام‌، نان‌ فطیر بخورید، تا شام‌ بیست‌ و یكم‌ ماه‌.", "19": "<span>19 </span> &nbsp;هفت‌ روز خمیرمایه‌ در خانه‌های‌ شما یافت‌ نشود، زیرا هر كه‌ چیزی‌ خمیر شده‌ بخورد، آن‌ شخص‌ از جماعت‌ اسرائیل‌ منقطع‌ گردد، خواه‌ غریب‌ باشد خواه‌ بومی‌ آن‌ زمین‌.", "20": "<span>20 </span> &nbsp;هیچ‌ چیز خمیر شده‌ مخورید، در همۀ مساكن‌ خود فطیر بخورید.»", "21": "<span>21 </span> &nbsp;پس‌ موسی‌ جمیع‌ مشایخ‌ اسرائیل‌ را خوانده‌، بدیشان‌ گفت‌: «بروید و بره‌ای‌ برای‌ خود موافق‌ خاندانهای‌ خویش‌ بگیرید، و فِصَح‌ را ذبح‌ نمایید.", "22": "<span>22 </span> &nbsp;و دسته‌ای‌ از زوفا گرفته‌، در خونی‌ كه‌ در طشت‌ است‌ فروبرید، و بر سر در و دو قایمۀ آن‌، از خونی‌ كه‌ در طشت‌ است‌ بزنید، و كسی‌ از شما از در خانۀ خود تا صبح‌ بیرون‌ نرود.", "23": "<span>23 </span> &nbsp;زیرا خداوند عبور خواهد كرد تا مصریان‌ را بزند و چون‌ خون‌ را بر سردر و دو قایمه‌اش‌ بیند، همانا خداوند از در گذرد و نگذارد كه‌ هلاك‌ كننده‌ به‌ خانه‌های‌ شما درآید تا شما را بزند.", "24": "<span>24 </span> &nbsp;و این‌ امررا برای‌ خود و پسران‌ خود به‌ فریضۀ ابدی‌ نگاه‌ دارید.", "25": "<span>25 </span> &nbsp;و هنگامی‌ كه‌ داخل‌ زمینی‌ شدید كه‌ خداوند حسب‌ قول‌ خود، آن‌ را به‌ شما خواهد داد. آنگاه‌ این‌ عبادت‌ را مَرعی‌ دارید.", "26": "<span>26 </span> &nbsp;و چون‌ پسران‌ شما به‌ شما گویند كه‌ این‌ عبادت‌ شما چیست‌،", "27": "<span>27 </span> &nbsp;گویید این‌ قربانی فِصَح‌ خداوند است‌، كه‌ از خانه‌های‌ بنی‌اسرائیل‌ در مصر عبور كرد، وقتی‌ كه‌ مصریان‌ را زد و خانه‌های‌ ما را خلاصی‌ داد.» پس‌ قوم‌ به‌ روی‌ درافتاده‌، سجده‌ كردند.", "28": "<span>28 </span> &nbsp;پس‌ بنی‌اسرائیل‌ رفته‌، آن‌ را كردند، چنانكه‌ خداوند به‌ موسی‌ و هارون‌ امر فرموده‌ بود، همچنان‌ كردند.", "29": "<span>29 </span> &nbsp;و واقع‌ شد كه‌ در نصف‌ شب‌، خداوند همۀ نخست‌زادگان‌ زمین‌ مصر را، از نخست‌زادۀ فرعون‌ كه‌ بر تخت‌ نشسته‌ بود تا نخست‌زادۀ اسیری‌ كه‌ در زندان‌ بود، و همۀ نخست‌ زاده‌های‌ بهایم‌ را زد.", "30": "<span>30 </span> &nbsp;و در آن‌ شب‌ فرعون‌ و همۀ بندگانش‌ و جمیع‌ مصریان‌ برخاستند و نعرۀ عظیمی‌ در مصر برپا شد، زیرا خانه‌ای‌ نبود كه‌ در آن‌ مِیتی‌ نباشد.", "31": "<span>31 </span> &nbsp;و موسی‌ و هارون‌ را در شب‌ طلبیده‌، گفت‌: «برخیزید! و از میان‌ قوم‌ من‌ بیرون‌ شوید، هم‌ شما و جمیع‌ بنی‌اسرائیل‌! و رفته‌، خداوند را عبادت‌ نمایید، چنانكه‌ گفتید.", "32": "<span>32 </span> &nbsp;گله‌ها و رمه‌های‌ خود را نیز چنانكه‌ گفتید، برداشته‌، بروید و مرا نیز بركت‌ دهید.»", "33": "<span>33 </span> &nbsp;و مصریان‌ نیز بر قوم‌ اِلحاح‌ نمودند تا ایشان‌ را بزودی‌ از زمین‌ روانه‌ كنند، زیرا گفتند ما همه‌ مرده‌ایم‌.", "34": "<span>34 </span> &nbsp;و قوم‌، آرد سرشتۀ خود را پیش‌از آنكه‌ خمیر شود برداشتند، و تَغارهای‌ خویش‌ را در رختها بر دوش‌ خود بستند.", "35": "<span>35 </span> &nbsp;و بنی‌اسرائیل‌ به‌ قول‌ موسی‌ عمل‌ كرده‌، از مصریان‌ آلات‌ نقره‌ و آلات‌ طلا و رختها خواستند.", "36": "<span>36 </span> &nbsp;و خداوند قوم‌ را در نظر مصریان‌ مُكَرّم‌ ساخت‌، كه‌ هرآنچه‌ خواستند بدیشان‌ دادند. پس‌ مصریان‌ را غارت‌ كردند.", "37": "<span>37 </span> &nbsp;و بنی‌اسرائیل‌ از رعمسیس‌ به‌ سكوت‌ كوچ‌ كردند، قریبِ ششصدهزار مرد پیاده‌، سوای‌ اطفال‌.", "38": "<span>38 </span> &nbsp;و گروهی‌ مختلفۀ بسیار نیز همراه‌ ایشان‌ بیرون‌ رفتند، و گله‌ها و رمه‌ها و مواشی‌ بسیار سنگین‌.", "39": "<span>39 </span> &nbsp;و از آرد سرشته‌، كه‌ از مصر بیرون‌ آورده‌ بودند، قرصهای‌ فطیر پختند، زیرا خمیر نشده‌ بود، چونكه‌ از مصر رانده‌ شده‌ بودند، و نتوانستند درنگ‌ كنند، و زاد سفر نیز برای‌ خود مهیا نكرده‌ بودند.", "40": "<span>40 </span> &nbsp;و توقف‌ بنی‌اسرائیل‌ كه‌ در مصر كرده‌ بودند، چهارصد و سی‌ سال‌ بود.", "41": "<span>41 </span> &nbsp;و بعد از انقضای‌ چهار صد و سی‌ سال‌ در همان‌ روز به‌ وقوع‌ پیوست‌ كه‌ جمیع‌ لشكرهای‌ خدا از زمین‌ مصر بیرون‌ رفتند.", "42": "<span>42 </span> &nbsp;این‌ است‌ شبی‌ كه‌ برای‌ خداوند باید نگاه‌ داشت‌، چون‌ ایشان‌ را از زمین‌ مصر بیرون‌ آورد. این‌ همان‌ شب‌ خداوند است‌ كه‌ بر جمیع‌ بنی‌اسرائیل‌ نسلاً بعد نسل‌ واجب‌ است‌ كه‌ آن‌ را نگاه‌ دارند.", "43": "<span>43 </span> &nbsp;و خداوند به‌ موسی‌ و هارون‌ گفت‌: «این‌ است‌ فریضۀ فِصَح‌ كه‌ هیچ‌ بیگانه‌ از آن‌ نخورد.", "44": "<span>44 </span> &nbsp;و اما هر غلام‌ زرخرید، او را ختنه‌ كن‌ و پس‌ آن‌ را بخورد.", "45": "<span>45 </span> &nbsp;نزیل‌ و مزدور آن‌ را نخورند.", "46": "<span>46 </span> &nbsp;در یك‌ خانه‌ خورده‌ شود، و چیزی‌ از گوشتش‌ از خانه‌ بیرون‌ مبر، و استخوانی‌ از آن‌ مشكنید.", "47": "<span>47 </span> &nbsp;تمامی‌ جماعت‌ بنی‌اسرائیل‌ آن‌ را نگاه‌ بدارند.", "48": "<span>48 </span> &nbsp;و اگر غریبی‌ نزد تو نزیل‌ شود، و بخواهد فِصَح‌ را برای‌ خداوند مَرعی‌ بدارد، تمامی‌ ذكورانش‌ مختون‌ شوند، و بعد از آن‌ نزدیك‌ آمده‌، آن‌ را نگاه‌ دارد، و مانند بومی‌ زمین‌ خواهد بود؛ و اما هر نامختون‌ از آن‌ نخورد.", "49": "<span>49 </span> &nbsp;یك‌ قانون‌ خواهد بود برای‌ اهل‌ وطن‌ و بجهت‌ غریبی‌ كه‌ در میان‌ شما نزیل‌ شود.»", "50": "<span>50 </span> &nbsp;پس‌ تمامی‌ بنی‌اسرائیل‌ این‌ را كردند؛ چنانكه‌ خداوند به‌ موسی‌ و هارون‌ امر فرموده‌ بود، عمل‌ نمودند.", "51": "<span>51 </span> &nbsp;و واقع‌ شد كه‌ خداوند در همان‌ روز بنی‌اسرائیل‌ را با لشكرهای‌ ایشان‌ از زمین‌ مصر بیرون‌ آورد." }, "13": { "1": "<span>1 </span> &nbsp;و خداوند موسی‌ را خطاب‌ كرده‌، گفت‌:", "2": "<span>2 </span> &nbsp;«هر نخست‌زاده‌ای‌ را كه‌ رحم‌ را بگشاید، در میان‌ بنی‌اسرائیل‌، خواه‌ از انسان‌ خواه‌ از بهایم‌، تقدیس‌ نما؛ او از آن‌ من‌ است‌.»", "3": "<span>3 </span> &nbsp;و موسی‌ به‌ قوم‌ گفت‌: «این‌ روز را كه‌ از مصر از خانۀ غلامی‌ بیرون‌ آمدید، یاد دارید، زیرا خداوند شما را به‌ قوت‌ دست‌ از آنجا بیرون‌ آورد، پس‌ نان‌ خمیر، خورده‌ نشود.", "4": "<span>4 </span> &nbsp;این‌ روز، در ماه‌ اَبیب‌ بیرون‌ آمدید.", "5": "<span>5 </span> &nbsp;و هنگامی‌ كه‌ خداوند تو را به‌ زمین‌ كنعانیان‌ و حتیان‌ و اموریان‌ و حویان‌ و یبوسیان‌داخل‌ كند، كه‌ با پدران‌ تو قسم‌ خورد كه‌ آن‌ را به‌ تو بدهد، زمینی‌ كه‌ به‌ شیر و شهد جاری‌ است‌، آنگاه‌ این‌ عبادت‌ را در این‌ ماه‌ بجا بیاور.", "6": "<span>6 </span> &nbsp;هفت‌ روز نان‌ فطیر بخور، و در روز هفتمین‌ عید خداوند است‌.", "7": "<span>7 </span> &nbsp;هفت‌ روز نان‌ فطیر خورده‌ شود، و هیچ‌ چیز خمیر شده‌ نزد تو دیده‌ نشود، و خمیر مایه‌ نزد تو در تمامی‌ حدودت‌ پیدا نشود.", "8": "<span>8 </span> &nbsp;و در آن‌ روز پسر خود را خبر داده‌، بگو: این‌ است‌ به‌ سبب‌ آنچه‌ خداوند به‌ من‌ كرد، وقتی‌ كه‌ از مصر بیرون‌ آمدم‌.", "9": "<span>9 </span> &nbsp;و این‌ برای‌ تو علامتی‌ بر دستت‌ خواهد بود و تذكره‌ای‌ در میان‌ دو چشمت‌، تا شریعت‌ خداوند در دهانت‌ باشد. زیرا خداوند تو را به‌ دست‌ قوی‌ از مصر بیرون‌ آورد.", "10": "<span>10 </span> &nbsp;و این‌ فریضه‌ را در موسمش‌ سال‌ به‌ سال‌ نگاه‌ دار.", "11": "<span>11 </span> &nbsp;« و هنگامی‌ كه‌ خداوند تو را به‌ زمین‌ كنعانیان‌ درآورد، چنانكه‌ برای‌ تو و پدرانت‌ قسم‌ خورد، و آن‌ را به‌ تو بخشد،", "12": "<span>12 </span> &nbsp;آنگاه‌ هر چه‌ رحم‌ را گشاید، آن‌ را برای‌ خدا جدا بساز، و هر نخست‌زاده‌ای‌ از بچه‌های‌ بهایم‌ كه‌ از آن‌ توست‌، نرینه‌ها از آن‌ خداوند باشد.", "13": "<span>13 </span> &nbsp;و هر نخست‌زادۀ الاغ‌ را به‌ بره‌ای‌ فدیه‌ بده‌، و اگر فدیه‌ ندهی‌ گردنش‌ را بشكن‌، و هر نخست‌زادۀ انسان‌ را از پسرانت‌ فدیه‌ بده‌.", "14": "<span>14 </span> &nbsp;و در زمان‌ آینده‌ چون‌ پسرت‌ از تو سؤال‌ كرده‌، گوید كه‌ این‌ چیست‌، او را بگو، یهوه‌ ما را به‌ قوت‌ دست‌ از مصر، از خانۀ غلامی‌ بیرون‌ آورد.", "15": "<span>15 </span> &nbsp;و چون‌ فرعون‌ از رها كردن‌ ما دل‌ خود را سخت‌ ساخت‌، واقع‌ شد كه‌ خداوند جمیع‌ نخست‌زادگان‌ مصر را از نخست‌زادۀ انسان‌ تا نخست‌زادۀ بهایم‌ كشت‌. بنابراین‌ من‌ همۀ نرینه‌ها را كه‌ رحم‌ را گشایند، برای‌ خداوند ذبح‌می‌كنم‌، لیكن‌ هر نخست‌زاده‌ای‌ از پسران‌ خود را فدیه‌ می‌دهم‌.", "16": "<span>16 </span> &nbsp;و این‌ علامتی‌ بر دستت‌ و عصابه‌ای‌ در میان‌ چشمان‌ تو خواهد بود، زیرا خداوند ما را بقوت‌ دست‌ از مصر بیرون‌ آورد.»", "17": "<span>17 </span> &nbsp;و واقع‌ شد كه‌ چون‌ فرعون‌ قوم‌ را رها كرده‌ بود، خدا ایشان‌ را از راه‌ زمین‌ فلسطینیان‌ رهبری‌ نكرد، هرچند آن‌ نزدیكتر بود. زیرا خدا گفت‌: «مبادا كه‌ چون‌ قوم‌ جنگ‌ بینند، پشیمان‌ شوند و به‌ مصر برگردند.»", "18": "<span>18 </span> &nbsp;اما خدا قوم‌ را از راه‌ صحرای‌ دریای‌ قلزم‌ دور گردانید. پس‌ بنی‌اسرائیل‌ مسلح‌ شده‌، از زمین‌ مصر برآمدند.", "19": "<span>19 </span> &nbsp;و موسی‌ استخوانهای‌ یوسف‌ را با خود برداشت‌، زیرا كه‌ او بنی‌اسرائیل‌ را قسم‌ سخت‌ داده‌، گفته‌ بود: «هرآینه‌ خدا از شما تفقد خواهد نمود و استخوانهای‌ مرا از اینجا با خود خواهید برد.»", "20": "<span>20 </span> &nbsp;و از سُكُّوت‌ كوچ‌ كرده‌، در ایتام‌ به‌ كنار صحرا اردو زدند.", "21": "<span>21 </span> &nbsp;و خداوند در روز، پیش‌ روی‌ قوم‌ در ستون‌ ابر می‌رفت‌ تا راه‌ را به‌ ایشان‌ دلالت‌ كند، و شبانگاه‌ در ستون‌ آتش‌، تا ایشان‌ را روشنایی‌ بخشد، و روز و شب‌ راه‌ روند.", "22": "<span>22 </span> &nbsp;و ستون‌ ابر را در روز و ستون‌ آتش‌ را در شب‌، از پیش‌ روی‌ قوم‌ برنداشت‌." }, "14": { "1": "<span>1 </span> &nbsp;و خداوند موسی‌ را خطاب‌ كرده‌،گفت‌:", "2": "<span>2 </span> &nbsp;«به‌ بنی‌اسرائیل‌ بگو كه‌ برگردیده‌، برابر فَمُالحیروت‌ در میان‌ مَجْدُل‌ و دریا اردو زنند. و در مقابل‌ بَعَل‌ صَفُون‌، در برابر آن‌به‌ كنار دریا اردو زنید.", "3": "<span>3 </span> &nbsp;و فرعون‌ دربارۀ بنی‌اسرائیل‌ خواهد گفت‌: در زمین‌ گرفتار شده‌اند، و صحرا آنها را محصور كرده‌ است‌.", "4": "<span>4 </span> &nbsp;و دل‌ فرعون‌ را سخت‌ گردانم‌ تا ایشان‌ را تعاقب‌ كند، و در فرعون‌ و تمامی‌ لشكرش‌ جلال‌ خود را جلوه‌ دهم‌، تا مصریان‌ بدانند كه‌ من‌ یهوه‌ هستم‌.» پس‌ چنین‌ كردند.", "5": "<span>5 </span> &nbsp;و به‌ پادشاه‌ مصر گفته‌ شد كه‌ قوم‌ فرار كردند، و دل‌ فرعون‌ و بندگانش‌ بر قوم‌ متغیر شد، پس‌ گفتند: «این‌ چیست‌ كه‌ كردیم‌ كه‌ بنی‌اسرائیل‌ را از بندگی‌ خود رهایی‌ دادیم‌؟»", "6": "<span>6 </span> &nbsp;پس‌ ارابۀ خود را بیاراست‌، و قوم‌ خود را با خود برداشت‌،", "7": "<span>7 </span> &nbsp;و ششصد ارابۀ برگزیده‌ برداشت‌، و همۀ ارابه‌های‌ مصر را و سرداران‌ را بر جمیع‌ آنها.", "8": "<span>8 </span> &nbsp;و خداوند دل‌ فرعون‌، پادشاه‌ مصر را سخت‌ ساخت‌ تا بنی‌اسرائیل‌ را تعاقب‌ كرد. و بنی‌اسرائیل‌ به‌ دست‌ بلند بیرون‌ رفتند.", "9": "<span>9 </span> &nbsp;و مصریان‌ با تمامی‌ اسبان‌ و ارابه‌های‌ فرعون‌ و سوارانش‌ و لشكرش‌ در عقب‌ ایشان‌ تاخته‌، بدیشان‌ دررسیدند، وقتی‌ كه‌ به‌ كنار دریا نزد فم‌الحیروت‌، برابر بعل‌ صفون‌ فرود آمده‌ بودند.", "10": "<span>10 </span> &nbsp;و چون‌ فرعون‌ نزدیك‌ شد، بنی‌اسرائیل‌ چشمان‌ خود را بالا كرده‌، دیدند كه‌ اینك‌ مصریان‌ از عقب‌ ایشان‌ می‌آیند. پس‌ بنی‌اسرائیل‌ سخت‌ بترسیدند، و نزد خداوند فریاد برآوردند،", "11": "<span>11 </span> &nbsp;و به‌ موسی‌ گفتند: «آیا در مصر قبرها نبود كه‌ ما را برداشته‌ای‌ تا در صحرا بمیریم‌؟ این‌ چیست‌ به‌ ما كردی‌ كه‌ ما را از مصر بیرون‌ آوردی‌؟", "12": "<span>12 </span> &nbsp;آیا این‌ آن‌ سخن‌ نیست‌ كه‌ به‌ تو در مصر گفتیم‌ كه‌ ما را بگذار تا مصریان‌ را خدمت‌ كنیم‌؟ زیرا كه‌ ما را خدمت‌ مصریان‌ بهتر است‌ از مردن‌ در صحرا!»", "13": "<span>13 </span> &nbsp;موسی‌ به‌ قوم‌ گفت‌: «مترسید! بایستید و نجات‌ خداوند را ببینید، كه‌ امروز آن‌ را برای‌ شما خواهد كرد، زیرا مصریان‌ را كه‌ امروز دیدید تا به‌ ابد دیگر نخواهید دید.", "14": "<span>14 </span> &nbsp;خداوند برای‌ شما جنگ‌ خواهد كرد و شما خاموش‌ باشید.»", "15": "<span>15 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «چرا نزد من‌ فریاد می‌كنی‌؟ بنی‌اسرائیل‌ را بگو كه‌ كوچ‌ كنند.", "16": "<span>16 </span> &nbsp;و اما تو عصای‌ خود را برافراز و دست‌ خود را بر دریا دراز كرده‌، آن‌ را مُنْشَقّ كن‌، تا بنی‌اسرائیل‌ از میان‌ دریا بر خشكی‌ راه‌ سپر شوند.", "17": "<span>17 </span> &nbsp;و اما من‌ اینك‌، دل‌ مصریان‌ را سخت‌ می‌سازم‌، تا از عقب‌ ایشان‌ بیایند، و از فرعون‌ و تمامی‌ لشكر او و ارابه‌ها و سوارانش‌ جلال‌ خواهم‌ یافت‌.", "18": "<span>18 </span> &nbsp;و مصریان‌ خواهند دانست‌ كه‌ من‌ یهوه‌ هستم‌، وقتی‌ كه‌ از فرعون‌ و ارابه‌هایش‌ و سوارانش‌ جلال‌ یافته‌ باشم‌.»", "19": "<span>19 </span> &nbsp;و فرشتۀ خدا كه‌ پیش‌ اردوی‌ اسرائیل‌ می‌رفت‌، حركت‌ كرده‌، از عقب‌ ایشان‌ خرامید، و ستون‌ ابر از پیش‌ ایشان‌ نقل‌ كرده‌، در عقب‌ ایشان‌ بایستاد.", "20": "<span>20 </span> &nbsp;و میان‌ اردوی‌ مصریان‌ و اردوی‌ اسرائیل‌ آمده‌، از برای‌ آنها ابر و تاریكی‌ می‌بود، و اینها را در شب‌ روشنایی‌ می‌داد كه‌ تمامی‌ شب‌ نزدیك‌ یكدیگر نیامدند.", "21": "<span>21 </span> &nbsp;پس‌ موسی‌ دست‌ خود را بر دریا دراز كرد و خداوند دریا را به‌ باد شرقی‌ شدید، تمامی‌ آن‌ شب‌ برگردانیده‌، دریا را خشك‌ ساخت‌ و آب‌ مُنْشَقّ گردید.", "22": "<span>22 </span> &nbsp;و بنی‌اسرائیل‌ در میان‌ دریا بر خشكی‌ می‌رفتند و آبها برای‌ ایشان‌ بر راست‌ و چپ‌، دیوار بود.", "23": "<span>23 </span> &nbsp;و مصریان‌ با تمامی‌ اسبان‌ و ارابه‌ها و سواران‌ فرعون‌ از عقب‌ ایشان‌ تاخته‌، به‌ میان‌ دریا درآمدند.", "24": "<span>24 </span> &nbsp;ودر پاس‌ سحری‌ واقع‌ شد كه‌ خداوند بر اردوی‌ مصریان‌ از ستون‌ آتش‌ و ابر نظر انداخت‌، و اردوی‌ مصریان‌ را آشفته‌ كرد.", "25": "<span>25 </span> &nbsp;و چرخهای‌ ارابه‌های‌ ایشان‌ را بیرون‌ كرد، تا آنها را به‌ سنگینی‌ برانند و مصریان‌ گفتند: «از حضور بنی‌اسرائیل‌ بگریزیم‌! زیرا خداوند برای‌ ایشان‌ با مصریان‌ جنگ‌ می‌كند.»", "26": "<span>26 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «دست‌ خود را بر دریا دراز كن‌، تا آبها بر مصریان‌ برگردد، و بر ارابه‌ها و سواران‌ ایشان‌.»", "27": "<span>27 </span> &nbsp;پس‌ موسی‌ دست‌ خود را بر دریا دراز كرد، و به‌ وقت‌ طلوع‌ صبح‌، دریا به‌ جریان‌ خود برگشت‌، و مصریان‌ به‌ مقابلش‌ گریختند، و خداوند مصریان‌ را در میان‌ دریا به‌ زیر انداخت‌.", "28": "<span>28 </span> &nbsp;و آبها برگشته‌، ارابه‌ها و سواران‌ و تمام‌ لشكر فرعون‌ را كه‌ از عقب‌ ایشان‌ به‌ دریا درآمده‌ بودند، پوشانید، كه‌ یكی‌ از ایشان‌ هم‌ باقی‌ نماند.", "29": "<span>29 </span> &nbsp;اما بنی‌اسرائیل‌ در میان‌ دریا به‌ خشكی‌ رفتند، و آبها برای‌ ایشان‌ دیواری‌ بود به‌ طرف‌ راست‌ و به‌ طرف‌ چپ.", "30": "<span>30 </span> &nbsp;و در آن‌ روز خداوند اسرائیل‌ را از دست‌ مصریان‌ خلاصی‌ داد و اسرائیل‌ مصریان‌ را به‌ كنار دریا مرده‌ دیدند.", "31": "<span>31 </span> &nbsp;و اسرائیل‌ آن‌ كار عظیمی‌ را كه‌ خداوند به‌ مصریان‌ كرده‌ بود دیدند، و قوم‌ از خداوند ترسیدند، و به‌ خداوند و به‌ بندۀ او موسی‌ ایمان‌ آوردند." }, "15": { "1": "<span>1 </span> &nbsp;آنگاه‌ موسی‌ و بنی‌اسرائیل‌ این‌ سرود را برای‌ خداوند سراییده‌، گفتند كه‌: «یهوه‌ را سرود می‌خوانم‌ زیرا كه‌ با جلال‌ مظفر شده‌ است‌. اسب‌ و سوارش‌ را به‌ دریا انداخت‌.", "2": "<span>2 </span> &nbsp;خداوند قوت‌ و تسبیح‌ من‌ است‌. و او نجات‌ من‌ گردیده‌ است‌. این‌ خدای‌ من‌ است‌، پس‌ او را تمجید می‌كنم‌. خدای‌ پدر من‌ است‌، پس‌ او را متعال‌ می‌خوانم‌.", "3": "<span>3 </span> &nbsp;خداوند مرد جنگی‌ است‌. نام‌ او یهوه‌ است‌.", "4": "<span>4 </span> &nbsp;ارابه‌ها و لشكر فرعون‌ را به‌ دریا انداخت‌. مبارزان‌ برگزیدۀ او در دریای‌ قلزم‌ غرق‌ شدند.", "5": "<span>5 </span> &nbsp;لُجّه‌ها ایشان‌ را پوشانید. مثل‌ سنگ‌ به‌ ژرفیها فرو رفتند.", "6": "<span>6 </span> &nbsp;دست‌ راست‌ تو ای‌ خداوند ، به‌ قوت‌ جلیل‌ گردیده‌. دست‌ راست‌ تو ای‌ خداوند ، دشمن‌ را خرد شكسته‌ است‌،", "7": "<span>7 </span> &nbsp;و به‌ كثرت‌ جلال‌ خود خصمان‌ را منهدم‌ ساخته‌ای‌. غضب‌ خود را فرستاده‌، ایشان‌ را چون‌ خاشاك‌ سوزانیده‌ای‌،", "8": "<span>8 </span> &nbsp;و به‌ نَفْخِۀ بینی‌ تو آبها فراهم‌ گردید. و موجها مثل‌ توده‌ بایستاد و لجه‌ها در میان‌ دریا منجمد گردید.", "9": "<span>9 </span> &nbsp;دشمن‌ گفت‌ تعاقب‌ می‌كنم‌ و ایشان‌ را فرو می‌گیرم‌، و غارت‌ را تقسیم‌ كرده‌، جانم‌ از ایشان‌ سیر خواهد شد. شمشیر خود را كشیده‌، دست‌ من‌ ایشان‌ را هلاك‌ خواهد ساخت‌،", "10": "<span>10 </span> &nbsp;و چون‌ به‌ نفخۀ خود دمیدی‌، دریا ایشان‌ را پوشانید. مثل‌ سرب‌ در آبهای‌ زورآور غرق‌ شدند.", "11": "<span>11 </span> &nbsp;كیست‌ مانند تو ای‌ خداوند در میان‌ خدایان‌؟ كیست‌ مانند تو جلیل‌ در قدوسیت‌؟ تو مهیب‌ هستی‌ در تسبیح‌ خود و صانع‌ عجایب‌!", "12": "<span>12 </span> &nbsp;چون‌ دست‌ راست‌ خود را دراز كردی‌، زمین‌ ایشان‌ را فرو برد.", "13": "<span>13 </span> &nbsp;این‌ قومِ خویش‌ را كه‌ فدیه‌ دادی‌، به‌ رحمانیت‌ خود، رهبری‌ نمودی‌. ایشان‌ را به‌ قوت‌ خویش‌ به‌ سوی‌ مسكن‌ قدس‌ خود هدایت‌ كردی‌.", "14": "<span>14 </span> &nbsp;امتها چون‌ شنیدند، مضطرب‌ گردیدند. لرزه‌ بر سكنۀ فلسطین‌ مستولی‌ گردید.", "15": "<span>15 </span> &nbsp;آنگاه‌ امرای‌ ادوم‌ در حیرت‌ افتادند. و اكابر موآب‌ را لرزه‌ فرو گرفت‌، و جمیع‌ سكنۀ كنعان‌ گداخته‌ گردیدند.", "16": "<span>16 </span> &nbsp;ترس‌ و هراس‌، ایشان‌ را فروگرفت‌. از بزرگی‌ بازوی‌ تو مثل‌ سنگ‌ ساكت‌ شدند، تا قوم‌ تو ای‌ خداوند عبور كنند، تا این‌ قومی‌ كه‌ تو خریده‌ای‌، عبور كنند.", "17": "<span>17 </span> &nbsp;ایشان‌ را داخل‌ ساخته‌، در جبل‌ میراث‌ خود غرس‌ خواهی‌ كرد، به‌ مكانی‌ كه‌ تو ای‌ خداوند مسكن‌ خود ساخته‌ای‌، یعنی‌ آن‌ مقام‌ مقدسی‌ كه‌ دستهای‌ تو ای‌ خداوند مستحكم‌ كرده‌ است‌.", "18": "<span>18 </span> &nbsp;خداوند سلطنت‌ خواهد كرد تا ابدالا´باد.»", "19": "<span>19 </span> &nbsp;زیرا كه‌ اسبهای‌ فرعون‌ با ارابه‌ها و سوارانش‌ به‌ دریا درآمدند، و خداوند آب‌ دریا را بر ایشان‌ برگردانید. اما بنی‌اسرائیل‌ از میان‌ دریا به‌ خشكی‌ رفتند.", "20": "<span>20 </span> &nbsp;و مریمِ نبیه‌، خواهر هارون‌، دف‌ را به‌ دست‌ خود گرفته‌، و همۀ زنان‌ از عقب‌ وی‌ دفها گرفته‌، رقص‌ كنان‌ بیرون‌ آمدند.", "21": "<span>21 </span> &nbsp;پس‌ مریم‌ در جواب‌ ایشان‌ گفت‌: « خداوند را بسرایید، زیرا كه‌ با جلال‌مظفر شده‌ است‌؛ اسب‌ و سوارش‌ را به‌ دریا انداخت‌.»", "22": "<span>22 </span> &nbsp;پس‌ موسی‌ اسرائیل‌ را از بحر قلزم‌ كوچانید، و به‌ صحرای‌ شور آمدند، و سه‌ روز در صحرا می‌رفتند و آب‌ نیافتند.", "23": "<span>23 </span> &nbsp;پس‌ به‌ مارّه‌ رسیدند، و از آب‌ مارّه‌ نتوانستند نوشید زیرا كه‌ تلخ‌ بود. از این‌ سبب‌، آن‌ را ماره‌ نامیدند.", "24": "<span>24 </span> &nbsp;و قوم‌ بر موسی‌ شكایت‌ كرده‌، گفتند: «چه‌ بنوشیم‌؟»", "25": "<span>25 </span> &nbsp;چون‌ نزد خداوند استغاثه‌ كرد، خداوند درختی‌ بدو نشان‌ داد، پس‌ آن‌ را به‌ آب‌ انداخت‌ و آب‌ شیرین‌ گردید. و در آنجا فریضه‌ای‌ و شریعتی‌ برای‌ ایشان‌ قرار داد، و در آنجا ایشان‌ را امتحان‌ كرد.", "26": "<span>26 </span> &nbsp;و گفت‌: «هرآینه‌ اگر قول‌ یهوه‌، خدای‌ خود را بشنوی‌، و آنچه‌ را در نظر او راست‌ است‌ بجا آوری‌، و احكام‌ او را بشنوی‌، و تمامی‌ فرایض‌ او را نگاه‌ داری‌، همانا هیچ‌ یك‌ از همۀ مرضهایی‌ را كه‌ بر مصریان‌ آورده‌ام‌ بر تو نیاورم‌، زیرا كه‌ من‌ یهوه‌، شفا دهندۀ تو هستم‌.»", "27": "<span>27 </span> &nbsp;پس‌ به‌ ایلیم‌ آمدند، و در آنجا دوازده‌ چشمۀ آب‌ و هفتاد درخت‌ خرما بود، و در آنجا نزد آب‌ خیمه‌ زدند." }, "16": { "1": "<span>1 </span> &nbsp;پس‌ تمامی‌ جماعت‌ بنی‌اسرائیل‌ از ایلیم‌ كوچ‌ كرده‌، به‌ صحرای‌ سین‌ كه‌ در میان‌ ایلیم‌ و سینا است‌ در روز پانزدهم‌ از ماه‌ دوم‌، بعد از بیرون‌ آمدن‌ ایشان‌ از زمین‌ مصر، رسیدند.", "2": "<span>2 </span> &nbsp;و تمامی‌ جماعت‌ بنی‌اسرائیل‌ در آن‌ صحرا بر موسی‌ و هارون‌ شكایت‌ كردند.", "3": "<span>3 </span> &nbsp;و بنی‌اسرائیل‌ بدیشان‌ گفتند: «كاش‌ كه‌ در زمین‌ مصر به‌ دست‌ خداوند مرده‌ بودیم‌، وقتی‌ كه‌ نزد دیگهای‌گوشت‌ می‌نشستیم‌ و نان‌ را سیر می‌خوردیم‌، زیرا كه‌ ما را بدین‌ صحرا بیرون‌ آوردید، تا تمامی‌ این‌ جماعت‌ را به‌ گرسنگی‌ بكشید.»", "4": "<span>4 </span> &nbsp;آنگاه‌ خداوند به‌ موسی‌ گفت‌: «همانا من‌ نان‌ از آسمان‌ برای‌ شما بارانم‌، و قوم‌ رفته‌، كفایت‌ هر روز را در روزش‌ گیرند، تا ایشان‌ را امتحان‌ كنم‌ كه‌ بر شریعت‌ من‌ رفتار می‌كنند یا نه‌.", "5": "<span>5 </span> &nbsp;و واقع‌ خواهد شد در روز ششم‌، كه‌ چون‌ آنچه‌ را كه‌ آورده‌ باشند درست‌ نمایند، همانا دوچندان‌ آن‌ خواهد بود كه‌ هر روز برمی‌چیدند.»", "6": "<span>6 </span> &nbsp;و موسی‌ و هارون‌ به‌ همۀ بنی‌اسرائیل‌ گفتند: «شامگاهان‌ خواهید دانست‌ كه‌ خداوند شما را از زمین‌ مصر بیرون‌ آورده‌ است‌.", "7": "<span>7 </span> &nbsp;و بامدادان‌ جلال‌ خداوند را خواهید دید، زیرا كه‌ او شكایتی‌ را كه‌ بر خداوند كرده‌اید شنیده‌ است‌، و ما چیستیم‌ كه‌ بر ما شكایت‌ می‌كنید؟»", "8": "<span>8 </span> &nbsp;و موسی‌ گفت‌: «این‌ خواهد بود چون‌ خداوند ، شامگاه‌ شما را گوشت‌ دهد تا بخورید، و بامداد نان‌، تا سیر شوید، زیرا خداوند شكایتهای‌ شما را كه‌ بر وی‌ كرده‌اید شنیده‌ است‌، و ما چیستیم‌؟ بر ما نی‌، بلكه‌ بر خداوند شكایت‌ نموده‌اید.»", "9": "<span>9 </span> &nbsp;و موسی‌ به‌ هارون‌ گفت‌: «به‌ تمامی‌ جماعت‌ بنی‌اسرائیل‌ بگو به‌ حضور خداوند نزدیك‌ بیایید، زیرا كه‌ شكایتهای‌ شما را شنیده‌ است‌.»", "10": "<span>10 </span> &nbsp;و واقع‌ شد كه‌ چون‌ هارون‌ به‌ تمامی‌ جماعت‌ بنی‌اسرائیل‌ سخن‌ گفت‌، به‌ سوی‌ صحرا نگریستند و اینك‌ جلال‌ خداوند در ابر ظاهر شد.", "11": "<span>11 </span> &nbsp;و خداوند موسی‌ را خطاب‌ كرده‌، گفت‌:", "12": "<span>12 </span> &nbsp;«شكایتهای‌ بنی‌اسرائیل‌ را شنیده‌ام‌، پس‌ ایشان‌ را خطاب‌ كرده‌، بگو: در عصر گوشت‌خواهید خورد، و بامداد از نان‌ سیر خواهید شد تا بدانید كه‌ من‌ یهوه‌ خدای‌ شما هستم‌.»", "13": "<span>13 </span> &nbsp;و واقع‌ شد كه‌ در عصر، سَلوی‌ برآمده‌، لشكرگاه‌ را پوشانیدند، و بامدادان‌ شبنم‌ گرداگرد اردو نشست‌.", "14": "<span>14 </span> &nbsp;و چون‌ شبنمی‌ كه‌ نشسته‌ بود برخاست‌، اینك‌ بر روی‌ صحرا چیزی‌ دقیق‌، مدور و خُرد، مثل‌ ژاله‌ بر زمین‌ بود.", "15": "<span>15 </span> &nbsp;و چون‌ بنی‌اسرائیل‌ این‌ را دیدند به‌ یكدیگر گفتند كه‌ این‌ منّ است‌، زیرا كه‌ ندانستند چه‌ بود. موسی‌ به‌ ایشان‌ گفت‌: «این‌ آن‌ نان‌ است‌ كه‌ خداوند به‌ شما می‌دهد تا بخورید.", "16": "<span>16 </span> &nbsp;این‌ است‌ امری‌ كه‌ خداوند فرموده‌ است‌، كه‌ هر كس‌ به‌ قدر خوراك‌ خود از این‌ بگیرد، یعنی‌ یك‌ عُومَر برای‌ هر نفر به‌ حسب‌ شمارۀ نفوس‌ خویش‌، هر شخص‌ برای‌ كسانی‌ كه‌ در خیمۀ او باشند بگیرد.»", "17": "<span>17 </span> &nbsp;پس‌ بنی‌اسرائیل‌ چنین‌ كردند، بعضی‌ زیاد و بعضی‌ كم‌ برچیدند.", "18": "<span>18 </span> &nbsp;اما چون‌ به‌ عومر پیمودند، آنكه‌ زیاد برچیده‌ بود، زیاده‌ نداشت‌، و آنكه‌ كم‌ برچیده‌ بود، كم‌ نداشت‌، بلكه‌ هر كس‌ به‌ قدر خوراكش‌ برچیده‌ بود.", "19": "<span>19 </span> &nbsp;و موسی‌ بدیشان‌ گفت‌: «زنهار كسی‌ چیزی‌ از این‌ تا صبح‌ نگاه‌ ندارد.»", "20": "<span>20 </span> &nbsp;لكن‌ به‌ موسی‌ گوش‌ ندادند، بلكه‌ بعضی‌ چیزی‌ از آن‌ تا صبح‌ نگاه‌ داشتند. و كرمها بهم‌ رسانیده‌، متعفن‌ گردید، و موسی‌ بدیشان‌ خشمناك‌ شد.", "21": "<span>21 </span> &nbsp;و هر صبح‌، هر كس‌ به‌ قدر خوراك‌ خود برمی‌چید، و چون‌ آفتاب‌ گرم‌ می‌شد، می‌گداخت‌.", "22": "<span>22 </span> &nbsp;و واقع‌ شد در روز ششم‌ كه‌ نان‌ مضاعف‌، یعنی‌ برای‌ هر نفری‌ دو عومر برچیدند. پس‌ همۀ رؤسای‌ جماعت‌ آمده‌، موسی‌ را خبر دادند.", "23": "<span>23 </span> &nbsp;او بدیشان‌ گفت‌: «این‌ است‌ آنچه‌ خداوند گفت‌، كه‌ فردا آرامی‌ است‌، و سَبَّتِ مقدسِ خداوند . پس‌ آنچه‌ بر آتش‌ باید پخت‌ بپزید، و آنچه‌ در آب‌ باید جوشانید بجوشانید، و آنچه‌ باقی‌ باشد، برای‌ خود ذخیره‌ كرده‌، بجهت‌ صبح‌ نگاه‌ دارید.»", "24": "<span>24 </span> &nbsp;پس‌ آن‌ را تا صبح‌ ذخیره‌ كردند، چنانكه‌ موسی‌ فرموده‌ بود، و نه‌ متعفن‌ گردید و نه‌ كرم‌ در آن‌ پیدا شد.", "25": "<span>25 </span> &nbsp;و موسی‌ گفت‌: «امروز این‌ را بخورید زیرا كه‌ امروز سَبَّت‌ خداوند است‌، و در این‌ روز آن‌ را در صحرا نخواهید یافت‌.", "26": "<span>26 </span> &nbsp;شش‌ روز آن‌ را برچینید، و روز هفتمین‌، سَبَّت‌ است‌. در آن‌ نخواهد بود.»", "27": "<span>27 </span> &nbsp;و واقع‌ شد كه‌ در روز هفتم‌، بعضی‌ از قوم‌ برای‌ برچیدن‌ بیرون‌ رفتند، اما نیافتند.", "28": "<span>28 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «تا به‌ كی‌ از نگاه‌ داشتن‌ وصایا و شریعت‌ من‌ ابا می‌نمایید؟", "29": "<span>29 </span> &nbsp;ببینید چونكه‌ خداوند سَبَّت‌ را به‌ شما بخشیده‌ است‌، از این‌ سبب‌ در روز ششم‌، نانِ دو روز را به‌ شما می‌دهد، پس‌ هر كس‌ در جای‌ خود بنشیند و در روز هفتم‌ هیچ‌ كس‌ از مكانش‌ بیرون‌ نرود.»", "30": "<span>30 </span> &nbsp;پس‌ قوم‌ در روز هفتمین‌ آرام‌ گرفتند.", "31": "<span>31 </span> &nbsp;و خاندان‌ اسرائیل‌ آن‌ را منّ نامیدند، و آن‌ مثل‌ تخم‌ گشنیز سفید بود، و طعمش‌ مثل‌ قرصهای‌ عسلی‌.", "32": "<span>32 </span> &nbsp;و موسی‌ گفت‌: «این‌ امری‌ است‌ كه‌ خداوند فرموده‌ است‌ كه‌ عومری‌ از آن‌ پر كنی‌، تا در نسلهای‌ شما نگاه‌ داشته‌ شود، تا آن‌ نان‌ را ببینند كه‌ در صحرا، وقتی‌ كه‌ شما را از زمین‌ مصر بیرون‌ آوردم‌، آن‌ را به‌ شما خورانیدم‌.»", "33": "<span>33 </span> &nbsp;پس‌ موسی‌ به‌ هارون‌ گفت‌: «ظرفی‌ بگیر، و عومری‌ پر از منّ در آن‌ بنه‌ و آن‌ را به‌ حضور خداوند بگذار، تا در نسلهای‌ شما نگاه‌ داشته‌شود.»", "34": "<span>34 </span> &nbsp;چنانكه‌ خداوند به‌ موسی‌ امر فرموده‌ بود، همچنان‌ هارون‌ آن‌ را پیش‌ (تابوت‌) شهادت‌ گذاشت‌ تا نگاه‌ داشته‌ شود.", "35": "<span>35 </span> &nbsp;و بنی‌اسرائیل‌ مدت‌ چهل‌ سال‌ منّ را می‌خوردند، تا به‌ زمین‌ آباد رسیدند، یعنی‌ تا به‌ سرحد زمین‌ كنعان‌ داخل‌ شدند، خوراك‌ ایشان‌ منّ بود.", "36": "<span>36 </span> &nbsp;و اما عومر، ده‌ یك‌ ایفه‌ است‌." }, "17": { "1": "<span>1 </span> &nbsp;و تمامی‌ جماعت‌ بنی‌اسرائیل‌ به حكم‌ خداوند طی‌ منازل‌ كرده‌، از صحرای‌ سین‌ كوچ‌ كردند، و در رفیدیم‌ اردو زدند، و آب‌ نوشیدن‌ برای‌ قوم‌ نبود.", "2": "<span>2 </span> &nbsp;و قوم‌ با موسی‌ منازعه‌ كرده‌، گفتند: «ما را آب‌ بدهید تا بنوشیم‌.» موسی‌ بدیشان‌ گفت‌: «چرا با من‌ منازعه‌ می‌كنید، و چرا خداوند را امتحان‌ می‌نمایید؟»", "3": "<span>3 </span> &nbsp;و در آنجا قوم‌ تشنۀ آب‌ بودند، و قوم‌ بر موسی‌ شكایت‌ كرده‌، گفتند: «چرا ما را از مصر بیرون‌ آوردی‌، تا ما و فرزندان‌ و مواشی‌ ما را به‌ تشنگی‌ بكشی‌؟»", "4": "<span>4 </span> &nbsp;آنگاه‌ موسی‌ نزد خداوند استغاثه‌ نموده‌، گفت‌: «با این‌ قوم‌ چه‌ كنم‌؟ نزدیك‌ است‌ مرا سنگسار كنند.»", "5": "<span>5 </span> &nbsp;خداوند به‌ موسی‌ گفت‌: «پیش‌ روی‌ قوم‌ برو، و بعضی‌ از مشایخ‌ اسرائیل‌ را با خود بردار، و عصای‌ خود را كه‌ بدان‌ نهر را زدی‌ به‌ دست‌ خود گرفته‌، برو.", "6": "<span>6 </span> &nbsp;همانا من‌ در آنجا پیش‌ روی‌ تو بر آن‌ صخره‌ای‌ كه‌ در حوریب‌ است‌، می‌ایستم‌، و صخره‌ را خواهی‌ زد تا آب‌ از آن‌ بیرون‌ آید، و قوم‌ بنوشند.» پس‌ موسی‌ به‌ حضور مشایخ‌ اسرائیل‌ چنین‌ كرد.", "7": "<span>7 </span> &nbsp;و آن‌ موضع‌ را مَسَّه‌ و مَریبه‌ نامید، به‌ سبب‌ منازعۀبنی‌اسرائیل‌، و امتحان‌ كردن‌ ایشان‌ خداوند را، زیرا گفته‌ بودند: «آیا خداوند در میان‌ ما هست‌ یا نه‌؟»", "8": "<span>8 </span> &nbsp;پس‌ عمالیق‌ آمده‌، در رفیدیم‌ با اسرائیل‌ جنگ‌ كردند.", "9": "<span>9 </span> &nbsp;و موسی‌ به‌ یوشع‌ گفت‌: «مردان‌ برای‌ ما برگزین‌ و بیرون‌ رفته‌، با عمالیق‌ مقاتله‌ نما، و بامدادان‌ من‌ عصای‌ خدا را به‌ دست‌ گرفته‌، بر قلۀ كوه‌ خواهم‌ ایستاد.»", "10": "<span>10 </span> &nbsp;پس‌ یوشع‌ بطوری‌ كه‌ موسی‌ او را امر فرموده‌ بود كرد، تا با عمالیق‌ محاربه‌ كند. و موسی‌ و هارون‌ و حور بر قلۀ كوه‌ برآمدند.", "11": "<span>11 </span> &nbsp;و واقع‌ شد كه‌ چون‌ موسی‌ دست‌ خود را برمی‌افراشت‌، اسرائیل‌ غلبه‌ می‌یافتند و چون‌ دست‌ خود را فرو می‌گذاشت‌، عمالیق‌ چیره‌ می‌شدند.", "12": "<span>12 </span> &nbsp;و دستهای‌ موسی‌ سنگین‌ شد. پس‌ ایشان‌ سنگی‌ گرفته‌، زیرش‌ نهادند كه‌ بر آن‌ بنشیند. و هارون‌ و حور، یكی‌ از این‌ طرف‌ و دیگری‌ از آن‌ طرف‌، دستهای‌ او را بر می‌داشتند، و دستهایش‌ تا غروب‌ آفتاب‌ برقرار ماند.", "13": "<span>13 </span> &nbsp;و یوشع‌، عمالیق‌ و قوم‌ او را به‌ دم‌ شمشیر منهزم‌ ساخت‌.", "14": "<span>14 </span> &nbsp;پس‌ خداوند به‌ موسی‌ گفت‌: «این‌ را برای‌ یادگاری‌ در كتاب‌ بنویس‌، و به‌ سمع‌ یوشع‌ برسان‌ كه‌ هرآینه‌ ذكر عمالیق‌ را از زیر آسمان‌ محو خواهم‌ ساخت‌.»", "15": "<span>15 </span> &nbsp;و موسی‌ مذبحی‌ بنا كرد و آن‌ را یهوه‌ نِسّی‌ نامید.", "16": "<span>16 </span> &nbsp;و گفت‌: «زیرا كه‌ دست‌ بر تخت‌ خداوند است‌، كه‌ خداوند را جنگ‌ با عمالیق‌ نسلاً بعد نسل‌ خواهد بود.»" }, "18": { "1": "<span>1 </span> &nbsp;و چون‌ یتْرون‌، كاهن‌ مدیان‌، پدر زن موسی‌، آنچه‌ را كه‌ خدا با موسی‌ و قوم‌ خود، اسرائیل‌ كرده‌ بود شنید كه‌ خداوند چگونه‌ اسرائیل‌ را از مصر بیرون‌ آورده‌ بود،", "2": "<span>2 </span> &nbsp;آنگاه‌ یترون‌ پدرزن‌ موسی‌، صَفّوره‌، زن‌ موسی‌ را برداشت‌، بعد از آنكه‌ او را پس‌ فرستاده‌ بود.", "3": "<span>3 </span> &nbsp;و دو پسر او را كه‌ یكی‌ را جرشون‌ نام‌ بود، زیرا گفت‌: «در زمین‌ بیگانه‌ غریب‌ هستم‌،»", "4": "<span>4 </span> &nbsp;و دیگری‌ را الیعازر نام‌ بود، زیرا گفت‌: «كه‌ خدای‌ پدرم‌ مددكار من‌ بوده‌، مرا از شمشیر فرعون‌ رهانید.»", "5": "<span>5 </span> &nbsp;پس‌ یترون‌، پدر زن‌ موسی‌، با پسران‌ و زوجه‌اش‌ نزد موسی‌ به‌ صحرا آمدند، در جایی‌ كه‌ او نزد كوه‌ خدا خیمه‌ زده‌ بود.", "6": "<span>6 </span> &nbsp;و به‌ موسی‌ خبر داد كه‌ من‌ یترون‌، پدر زن‌ تو با زن‌ تو و دو پسرش‌ نزد تو آمده‌ایم‌.", "7": "<span>7 </span> &nbsp;پس‌ موسی‌ به‌ استقبال‌ پدر زن‌ خود بیرون‌ آمد و او را تعظیم‌ كرده‌، بوسید و سلامتی‌ یكدیگر را پرسیده‌، به‌ خیمه‌ درآمدند.", "8": "<span>8 </span> &nbsp;و موسی‌ پدر زن‌ خود را از آنچه‌ خداوند به‌ فرعون‌ و مصریان‌ به‌ خاطر اسرائیل‌ كرده‌ بود خبر داد، و از تمامی‌ مشقتی‌ كه‌ در راه‌ بدیشان‌ واقع‌ شده‌، خداوند ایشان‌ را از آن‌ رهانیده‌ بود.", "9": "<span>9 </span> &nbsp;و یترون‌ شاد گردید، به‌ سبب‌ تمامی‌ احسانی‌ كه‌ خداوند به‌ اسرائیل‌ كرده‌، و ایشان‌ را از دست‌ مصریان‌ رهانیده‌ بود.", "10": "<span>10 </span> &nbsp;و یترون‌ گفت‌: «متبارك‌ است‌ خداوند كه‌ شما را از دست‌ مصریان‌ و از دست‌ فرعون‌ خلاصی‌ داده‌ است‌، و قوم‌ خود را از دست‌ مصریان‌ رهانیده‌.", "11": "<span>11 </span> &nbsp;الا´ن‌ دانستم‌ كه‌ یهوه‌ از جمیع‌ خدایان‌ بزرگتر است‌، خصوصاً در همان‌ امری‌ كه‌ بر ایشان‌ تكبر می‌كردند.»", "12": "<span>12 </span> &nbsp;و یترون‌،پدر زن‌ موسی‌، قربانی سوختنی‌ و ذبایح‌ برای‌ خدا گرفت‌، و هارون‌ و جمیع‌ مشایخ‌ اسرائیل‌ آمدند تا با پدر زن‌ موسی‌ به‌ حضور خدا نان‌ بخورند.", "13": "<span>13 </span> &nbsp;بامدادان‌ واقع‌ شد كه‌ موسی‌ برای‌ داوری‌ قوم‌ بنشست‌، و قوم‌ به‌ حضور موسی‌ از صبح‌ تا شام‌ ایستاده‌ بودند.", "14": "<span>14 </span> &nbsp;و چون‌ پدر زن‌ موسی‌ آنچه‌ را كه‌ او به‌ قوم‌ می‌كرد دید، گفت‌: «این‌ چه‌ كار است‌ كه‌ تو با قوم‌ می‌نمایی‌؟ چرا تو تنها می‌نشینی‌ و تمامی‌ قوم‌ نزد تو از صبح‌ تا شام‌ می‌ایستند؟»", "15": "<span>15 </span> &nbsp;موسی‌ به‌ پدر زن‌ خود گفت‌ كه‌ «قوم‌ نزد من‌ می‌آیند تا از خدا مسألت‌ نمایند.", "16": "<span>16 </span> &nbsp;هرگاه‌ ایشان‌ را دعوی‌ شود، نزد من‌ می‌آیند، و میان‌ هر كس‌ و همسایه‌اش‌ داوری‌ می‌كنم‌، و فرایض‌ و شرایع‌ خدا را بدیشان‌ تعلیم‌ می‌دهم‌.»", "17": "<span>17 </span> &nbsp;پدر زن‌ موسی‌ به‌ وی‌ گفت‌: «كاری‌ كه‌ تو می‌كنی‌، خوب‌ نیست‌.", "18": "<span>18 </span> &nbsp;هرآینه‌ تو و این‌ قوم‌ نیز كه‌ با تو هستند، خسته‌ خواهید شد، زیرا كه‌ این‌ امر برای‌ تو سنگین‌ است‌. تنها این‌ را نمی‌توانی‌ كرد.", "19": "<span>19 </span> &nbsp;اكنون‌ سخن‌ مرا بشنو. تو را پند می‌دهم‌ و خدا با تو باد؛ و تو برای‌ قوم‌ به‌ حضور خدا باش‌، و امور ایشان‌ را نزد خدا عرضه‌ دار.", "20": "<span>20 </span> &nbsp;و فرایض‌ و شرایع‌ را بدیشان‌ تعلیم‌ ده‌، و طریقی‌ را كه‌ بدان‌ می‌باید رفتار نمود، و عملی‌ را كه‌ می‌باید كرد، بدیشان‌ اعلام‌ نما.", "21": "<span>21 </span> &nbsp;و از میان‌ تمامی‌ قوم‌، مردان‌ قابل‌ را كه‌ خداترس‌ و مردان‌ امین‌، كه‌ از رشوت‌ نفرت‌ كنند، جستجو كرده‌، بر ایشان‌ بگمار، تا رؤسای‌ هزاره‌ و رؤسای‌ صده‌ و رؤسای‌ پنجاه‌ و رؤسای‌ ده‌ باشند.", "22": "<span>22 </span> &nbsp;تا بر قوم‌ پیوسته‌ داوری‌ نمایند، و هر امر بزرگ‌ را نزد تو بیاورند، و هر امركوچك‌ را خود فیصل‌ دهند. بدین‌ طور بار خود را سبك‌ خواهی‌ كرد، و ایشان‌ با تو متحمل‌ آن‌ خواهند شد.", "23": "<span>23 </span> &nbsp;اگر این‌ كار را بكنی‌ و خدا تو را چنین‌ امر فرماید، آنگاه‌ یارای‌ استقامت‌ خواهی‌ داشت‌، و جمیع‌ این‌ قوم‌ نیز به‌ مكان‌ خود به‌ سلامتی‌ خواهند رسید.»", "24": "<span>24 </span> &nbsp;پس‌ موسی‌ سخن‌ پدر زن‌ خود را اجابت‌ كرده‌، آنچه‌ او گفته‌ بود به‌ عمل‌ آورد.", "25": "<span>25 </span> &nbsp;و موسی‌ مردان‌ قابل‌ از تمامی‌ اسرائیل‌ انتخاب‌ كرده‌، ایشان‌ را رؤسای‌ قوم‌ ساخت‌، رؤسای‌ هزاره‌ و رؤسای‌ صده‌ و رؤسای‌ پنجاه‌ و رؤسای‌ ده‌.", "26": "<span>26 </span> &nbsp;و در داوری قوم‌ پیوسته‌ مشغول‌ می‌بودند. هر امر مشكل‌ را نزد موسی‌ می‌آوردند، و هر دعوی‌ كوچك‌ را خود فیصل‌ می‌دادند.", "27": "<span>27 </span> &nbsp;و موسی‌ پدر زن‌ خود را رخصت‌ داد و او به‌ ولایت‌ خود رفت‌." }, "19": { "1": "<span>1 </span> &nbsp;و در ماه‌ سوم‌ از بیرون‌ آمدن‌بنی‌اسرائیل‌ از زمین‌ مصر، در همان‌ روز به‌ صحرای‌ سینا آمدند.", "2": "<span>2 </span> &nbsp;و از رَفیدیم‌ كوچ‌ كرده‌، به‌ صحرای‌ سینا رسیدند، و در بیابان‌ اردو زدند، و اسرائیل‌ در آنجا در مقابل‌ كوه‌ فرود آمدند.", "3": "<span>3 </span> &nbsp;و موسی‌ نزد خدا بالا رفت‌، و خداوند از میان‌ كوه‌ او را ندا درداد و گفت‌: «به‌ خاندان‌ یعقوب‌ چنین‌ بگو، و بنی‌اسرائیل‌ را خبر بده‌:", "4": "<span>4 </span> &nbsp;شما آنچه‌ را كه‌ من‌ به‌ مصریان‌ كردم‌، دیده‌اید، و چگونه‌ شما را بر بالهای‌ عقاب‌ برداشته‌، نزد خود آورده‌ام‌.", "5": "<span>5 </span> &nbsp;و اكنون‌ اگر آواز مرا فی‌الحقیقه‌ بشنوید، و عهد مرا نگاه‌ دارید، همانا خزانۀ خاص‌ من‌ از جمیع‌ قومها خواهید بود. زیرا كه‌ تمامی‌ جهان‌، از آن‌ من‌ است‌.", "6": "<span>6 </span> &nbsp;و شما برای‌ من‌ مملكت‌ كَهَنه‌ و امتِ مقدس‌ خواهید بود. این‌ است‌ آن‌ سخنانی‌ كه‌ به‌ بنی‌اسرائیل‌ می‌باید گفت‌.»", "7": "<span>7 </span> &nbsp;پس‌ موسی‌ آمده‌، مشایخ‌ قوم‌ را خواند، و همۀ این‌ سخنان‌ را كه‌ خداوند او را فرموده‌ بود، بر ایشان‌ اِلقا كرد.", "8": "<span>8 </span> &nbsp;و تمامی‌ قوم‌ به‌ یك‌ زبان‌ در جواب‌ گفتند: «آنچه‌ خداوند امر فرموده‌ است‌، خواهیم‌ كرد.» و موسی‌ سخنان‌ قوم‌ را باز به‌ خداوند عرض‌ كرد.", "9": "<span>9 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «اینك‌ من‌ در ابرمُظْلِم‌ نزد تو می‌آیم‌، تا هنگامی‌ كه‌ به‌ تو سخن‌ گویم‌ قوم‌ بشنوند، و بر تو نیز همیشه‌ ایمان‌ داشته‌ باشند.» پس‌ موسی‌ سخنان‌ قوم‌ را به‌ خداوند باز گفت‌.", "10": "<span>10 </span> &nbsp;خداوند به‌ موسی‌ گفت‌: «نزد قوم‌ برو و ایشان‌ را امروز و فردا تقدیس‌ نما، و ایشان‌ رخت‌ خود را بشویند.", "11": "<span>11 </span> &nbsp;و در روز سوم‌ مهیا باشید، زیرا كه‌ در روز سوم‌ خداوند در نظر تمامی‌ قوم‌ بر كوه‌ سینا نازل‌ شود.", "12": "<span>12 </span> &nbsp;و حدود برای‌ قوم‌ از هر طرف‌ قرار ده‌، و بگو: باحذر باشید از اینكه‌ به‌ فراز كوه‌ برآیید، یا دامنۀ آن‌ را لمس‌ نمایید، زیرا هر كه‌ كوه‌ را لمس‌ كند، هرآینه‌ كشته‌ شود.", "13": "<span>13 </span> &nbsp;دست‌ بر آن‌ گذارده‌ نشود بلكه‌ یا سنگسار شود یا به‌ تیر كشته‌ شود، خواه‌ بهایم‌ باشد خواه‌ انسان‌، زنده‌ نماند. اما چون‌ كَرِنّا نواخته‌ شود، ایشان‌ به‌ كوه‌ برآیند.»", "14": "<span>14 </span> &nbsp;پس‌ موسی‌ از كوه‌ نزد قوم‌ فرود آمده‌، قوم‌ را تقدیس‌ نمود و رخت‌ خود را شستند.", "15": "<span>15 </span> &nbsp;و به‌ قوم‌ گفت‌: «در روز سوم‌ حاضر باشید، و به‌ زنان‌ نزدیكی‌ منمایید.»", "16": "<span>16 </span> &nbsp;و واقع‌ شد در روز سوم‌ به‌ وقت‌ طلوع‌ صبح‌، كه‌ رعدها و برقها و ابر غلیظ‌ بر كوه‌ پدید آمد، و آواز كَرِنّای‌ بسیار سخت‌،بطوری‌ كه‌ تمامی‌ قوم‌ كه‌ در لشكرگاه‌ بودند، بلرزیدند.", "17": "<span>17 </span> &nbsp;و موسی‌ قوم‌ را برای‌ ملاقات‌ خدا از لشكرگاه‌ بیرون‌ آورد، و در پایان‌ كوه‌ ایستادند.", "18": "<span>18 </span> &nbsp;و تمامی‌ كوه‌ سینا را دود فرو گرفت‌، زیرا خداوند در آتش‌ بر آن‌ نزول‌ كرد، و دودش‌ مثل‌ دود كوره‌ای‌ بالا می‌شد، و تمامی‌ كوه‌ سخت‌ متزلزل‌ گردید.", "19": "<span>19 </span> &nbsp;و چون‌ آواز كَرِنّا زیاده‌ و زیاده‌ سخت‌ نواخته‌ می‌شد، موسی‌ سخن‌ گفت‌، و خدا او را به‌ زبان‌ جواب‌ داد.", "20": "<span>20 </span> &nbsp;و خداوند بر كوه‌ سینا بر قله‌ كوه‌ نازل‌ شد، و خداوند موسی‌ را به‌ قلۀ كوه‌ خواند، و موسی‌ بالا رفت‌.", "21": "<span>21 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «پایین‌ برو و قوم‌ را قدغن‌ نما، مبادا نزد خداوند برای‌ نظر كردن‌، از حد تجاوز نمایند، كه‌ بسیاری‌ از ایشان‌ هلاك‌ خواهند شد.", "22": "<span>22 </span> &nbsp;و كهنه‌ نیز كه‌ نزد خداوند می‌آیند، خویشتن‌ را تقدیس‌ نمایند، مبادا خداوند بر ایشان‌ هجوم‌ آورد.»", "23": "<span>23 </span> &nbsp;موسی‌ به‌ خداوند گفت‌: «قوم‌ نمی‌توانند به‌ فراز كوه‌ سینا آیند، زیرا كه‌ تو ما را قدغن‌ كرده‌، گفته‌ای‌ كوه‌ را حدود قرار ده‌ و آن‌ را تقدیس‌ نما.»", "24": "<span>24 </span> &nbsp;خداوند وی‌ را گفت‌: «پایین‌ برو و تو و هارون‌ همراهت‌ برآیید، اما كَهَنه‌ و قوم‌ از حد تجاوز ننمایند، تا نزد خداوند بالا بیایند، مبادا بر ایشان‌ هجوم‌ آورد.»", "25": "<span>25 </span> &nbsp;پس‌ موسی‌ نزد قوم‌ فرود شده‌، بدیشان‌ سخن‌ گفت‌." }, "20": { "1": "<span>1 </span> &nbsp;و خدا تكلم‌ فرمود و همۀ این‌ كلمات‌را بگفت‌:", "2": "<span>2 </span> &nbsp;« من‌ هستم‌ یهوه‌، خدای‌ تو، كه‌ تو را از زمین‌مصر و از خانۀ غلامی‌ بیرون‌ آوردم‌.", "3": "<span>3 </span> &nbsp;تو را خدایان‌ دیگر غیر از من‌ نباشد.", "4": "<span>4 </span> &nbsp;« صورتی‌ تراشیده‌ و هیچ‌ تمثالی‌ از آنچه‌ بالا در آسمان‌ است‌، و از آنچه‌ پایین‌ در زمین‌ است‌، و از آنچه‌ در آب‌ زیر زمین‌ است‌، برای‌ خود مساز.", "5": "<span>5 </span> &nbsp;نزد آنها سجده‌ مكن‌، و آنها را عبادت‌ منما، زیرا من‌ كه‌ یهوه‌، خدای‌ تو می‌باشم‌، خدای‌ غیور هستم‌، كه‌ انتقام‌ گناه‌ پدران‌ را از پسران‌ تا پشت‌ سوم‌ و چهارم‌ از آنانی‌ كه‌ مرا دشمن‌ دارند می‌گیرم‌.", "6": "<span>6 </span> &nbsp;و تا هزار پشت‌ بر آنانی‌ كه‌ مرا دوست‌ دارند و احكام‌ مرا نگاه‌ دارند، رحمت‌ می‌كنم‌.", "7": "<span>7 </span> &nbsp;« نام‌ یهوه‌، خدای‌ خود را به‌ باطل‌ مبر، زیرا خداوند كسی‌ را كه‌ اسم‌ او را به‌ باطل‌ بَرَد، بی‌گناه‌ نخواهد شمرد.", "8": "<span>8 </span> &nbsp;« روز سَبَّت‌ را یاد كن‌ تا آن‌ را تقدیس‌ نمایی‌.", "9": "<span>9 </span> &nbsp;شش‌ روز مشغول‌ باش‌ و همۀ كارهای‌ خود را بجا آور.", "10": "<span>10 </span> &nbsp;اما روز هفتمین‌، سَبَّتِ یهوه‌، خدای‌ توست‌. در آن‌ هیچ‌ كار مكن‌، تو و پسرت‌ و دخترت‌ و غلامت‌ و كنیزت‌ و بهیمه‌ات‌ و مهمان‌ تو كه‌ درون‌ دروازه‌های‌ تو باشد.", "11": "<span>11 </span> &nbsp;زیرا كه‌ در شش‌ روز، خداوند آسمان‌ و زمین‌ و دریا و آنچه‌ را كه‌ در آنهاست‌ بساخت‌، و در روز هفتم‌ آرام‌ فرمود. از این‌ سبب‌ خداوند روز هفتم‌ را مبارك‌ خوانده‌، آن‌ را تقدیس‌ نمود.", "12": "<span>12 </span> &nbsp;پدر و مادر خود را احترام‌ نما، تا روزهای‌تو در زمینی‌ كه‌ یهوه‌ خدایت‌ به‌ تو می‌بخشد، دراز شود.", "13": "<span>13 </span> &nbsp;« قتل‌ مكن‌.", "14": "<span>14 </span> &nbsp;« زنا مكن‌.", "15": "<span>15 </span> &nbsp;« دزدی‌ مكن‌.", "16": "<span>16 </span> &nbsp;« بر همسایۀ خود شهادت‌ دروغ‌ مده‌.", "17": "<span>17 </span> &nbsp;«به‌ خانۀ همسایۀ خود طمع‌ مورز، و به‌ زن‌ همسایه‌ات‌ و غلامش‌ و كنیزش‌ و گاوش‌ و الاغش‌ و به‌ هیچ‌ چیزی‌ كه‌ از آن‌ همسایۀ تو باشد، طمع‌ مكن‌.»", "18": "<span>18 </span> &nbsp;و جمیع‌ قوم‌ رعدها و زبانه‌های‌ آتش‌ و صدای‌ كَرِنّا و كوه‌ را كه‌ پر از دود بود دیدند، و چون‌ قوم‌ این‌ را بدیدند لرزیدند، و از دور بایستادند.", "19": "<span>19 </span> &nbsp;و به‌ موسی‌ گفتند: «تو به‌ ما سخن‌ بگو و خواهیم‌ شنید، اما خدا به‌ ما نگوید، مبادا بمیریم‌.»", "20": "<span>20 </span> &nbsp;موسی‌ به‌ قوم‌ گفت‌: «مترسید زیرا خدا برای‌ امتحان‌ شما آمده‌ است‌، تا ترس‌ او پیش‌ روی‌ شما باشد و گناه‌ نكنید.»", "21": "<span>21 </span> &nbsp;پس‌ قوم‌ از دور ایستادند و موسی‌ به‌ ظلمت‌ غلیظ كه‌ خدا در آن‌ بود، نزدیك‌ آمد.", "22": "<span>22 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «به‌ بنی‌اسرائیل‌ چنین‌ بگو: شما دیدید كه‌ از آسمان‌ به‌ شما سخن‌ گفتم‌:", "23": "<span>23 </span> &nbsp;با من‌ خدایان‌ نقره‌ مسازید و خدایان‌ طلا برای‌ خود مسازید.", "24": "<span>24 </span> &nbsp;مذبحی‌ از خاك‌ برای‌ من‌ بساز، و قربانی‌های‌ سوختنی‌ خود و هدایای‌ سلامتی‌خود را از گله‌ و رمۀ خویش‌ بر آن‌ بگذران‌، در هر جایی‌ كه‌ یادگاری‌ برای‌ نام‌ خود سازم‌، نزد تو خواهم‌ آمد، و تو را بركت‌ خواهم‌ داد.", "25": "<span>25 </span> &nbsp;و اگر مذبحی‌ از سنگ‌ برای‌ من‌ سازی‌، آن‌ را از سنگهای‌ تراشیده‌ بنا مكن‌، زیرا اگر افزار خود را بر آن‌ بلند كردی‌، آن‌ را نجس‌ خواهی‌ ساخت‌.", "26": "<span>26 </span> &nbsp;و بر مذبح‌ من‌ از پله‌ها بالا مرو، مبادا عورَت‌ تو بر آن‌ مكشوف‌ شود.»" }, "21": { "1": "<span>1 </span> &nbsp;و این‌ است‌ احكامی‌ كه‌ پیش‌ ایشان ‌می‌گذاری:", "2": "<span>2 </span> &nbsp;« اگر غلام‌ عبری‌ بخری‌، شش‌ سال‌ خدمت‌ كند، و در هفتمین‌، بی‌قیمت‌، آزاد بیرون‌ رود.", "3": "<span>3 </span> &nbsp;اگر تنها آمده‌، تنها بیرون‌ رود و اگر صاحب‌ زن‌ بوده‌، زنش‌ همراه‌ او بیرون‌ رود.", "4": "<span>4 </span> &nbsp;اگر آقایش‌ زنی‌ بدو دهد و پسران‌ یا دختران‌ برایش‌ بزاید، آنگاه‌ زن‌ و اولادش‌ از آن‌ آقایش‌ باشند، و آن‌ مرد تنها بیرون‌ رود.", "5": "<span>5 </span> &nbsp;لیكن‌ هرگاه‌ آن‌ غلام‌ بگوید كه‌ هرآینه‌ آقایم‌ و زن‌ و فرزندان‌ خود را دوست‌ می‌دارم‌ و نمی‌خواهم‌ كه‌ آزاد بیرون‌ روم‌،", "6": "<span>6 </span> &nbsp;آنگاه‌ آقایش‌ او را به‌ حضور خدا بیاورد، و او را نزدیك‌ در یا قایمۀ در برساند، و آقایش‌ گوش‌ او را با درفشی‌ سوراخ‌ كند، و او وی‌ را همیشه‌ بندگی‌ نماید.", "7": "<span>7 </span> &nbsp;« اما اگر شخصی‌، دختر خود را به‌ كنیزی‌ بفروشد، مثل‌ غلامان‌ بیرون‌ نرود.", "8": "<span>8 </span> &nbsp;هر گاه‌ به‌ نظر آقایش‌ كه‌ او را برای‌ خود نامزد كرده‌ است‌ ناپسند آید، بگذارد كه‌ او را فدیه‌ دهند، اما هیچ‌ حق‌ ندارد كه‌ او را به‌ قوم‌ بیگانه‌ بفروشد، زیرا كه‌ بدوخیانت‌ كرده‌ است‌.", "9": "<span>9 </span> &nbsp;و هرگاه‌ او را به‌ پسر خود نامزد كند، موافق‌ رسم‌ دختران‌ با او عمل‌ نماید.", "10": "<span>10 </span> &nbsp;اگر زنی‌ دیگر برای‌ خود گیرد، آنگاه‌ خوراك‌ و لباس‌ و مباشرت‌ او را كم‌ نكند.", "11": "<span>11 </span> &nbsp;و اگر این‌ سه‌ چیز را برای‌ او نكند، آنگاه‌ بی‌قیمت‌ و رایگان‌ بیرون‌ رود.", "12": "<span>12 </span> &nbsp;« هر كه‌ انسانی‌ را بزند و او بمیرد، هر آینه‌ كشته‌ شود.", "13": "<span>13 </span> &nbsp;اما اگر قصد او نداشت‌، بلكه‌ خدا وی‌ را بدستش‌ رسانید، آنگاه‌ مكانی‌ برای‌ تو معین‌ كنم‌ تا بدانجا فرار كند.", "14": "<span>14 </span> &nbsp;لیكن‌ اگر شخصی‌ عمداً بر همسایۀ خود آید، تا او را به‌ مكر بكُشد، آنگاه‌ او را از مذبح‌ من‌ كشیده‌، به‌ قتل‌ برسان‌.", "15": "<span>15 </span> &nbsp;« و هر كه‌ پدر یا مادر خود را زند، هرآینه‌ كشته‌ شود.", "16": "<span>16 </span> &nbsp;« و هر كه‌ آدمی‌ را بدزدد و او را بفروشد یا در دستش‌ یافت‌ شود، هرآینه‌ كشته‌ شود.", "17": "<span>17 </span> &nbsp;« و هر كه‌ پدر یا مادر خود را لعنت‌ كند، هرآینه‌ كشته‌ شود.", "18": "<span>18 </span> &nbsp;« و اگر دو مرد نزاع‌ كنند، و یكی‌ دیگری‌ را به‌ سنگ‌ یا به‌ مشت‌ زند، و او نمیرد لیكن‌ بستری‌ شود،", "19": "<span>19 </span> &nbsp;اگر برخیزد و با عصا بیرون‌ رود، آنگاه‌ زنندۀ او بی‌گناه‌ شمرده‌ شود، اما عوض‌ بیكاری‌اش‌ را ادا نماید، و خرج‌ معالجۀ او را بدهد.", "20": "<span>20 </span> &nbsp;« و اگر كسی‌ غلام‌ یا كنیز خود را به‌ عصا بزند، و او زیر دست‌ او بمیرد، هرآینه‌ انتقام‌ او گرفته‌ شود.", "21": "<span>21 </span> &nbsp;لیكن‌ اگر یك‌ دو روز زنده‌ بماند، ازاو انتقام‌ كشیده‌ نشود، زیرا كه‌ زرخرید اوست‌.", "22": "<span>22 </span> &nbsp;« و اگر مردم‌ جنگ‌ كنند، و زنی‌ حامله‌ را بزنند، و اولاد او سقط‌ گردد، و ضرری‌ دیگر نشود، البته‌ غرامتی‌ بدهد موافق‌ آنچه‌ شوهر زن‌ بدو گذارد، و به‌ حضور داوران‌ ادا نماید.", "23": "<span>23 </span> &nbsp;و اگر اذیتی‌ دیگر حاصل‌ شود، آنگاه‌ جان‌ به‌ عوض‌ جان‌ بده‌،", "24": "<span>24 </span> &nbsp;و چشم‌ به‌ عوض‌ چشم‌، و دندان‌ به‌ عوض‌ دندان‌، و دست‌ به‌ عوض‌ دست‌، و پا به‌ عوض‌ پا،", "25": "<span>25 </span> &nbsp;و داغ‌ به‌ عوض‌ داغ‌، و زخم‌ به‌ عوض‌ زخم‌، و لطمه‌ به‌ عوض‌ لطمه‌.", "26": "<span>26 </span> &nbsp;« و اگر كسی‌ چشم‌ غلام‌ یا چشم‌ كنیز خود را بزند كه‌ ضایع‌ شود، او را به‌ عوض‌ چشمش‌ آزاد كند.", "27": "<span>27 </span> &nbsp;و اگر دندان‌ غلام‌ یا دندان‌ كنیز خود را بیندازد، او را به‌ عوض‌ دندانش‌ آزاد كند.", "28": "<span>28 </span> &nbsp;« و هرگاه‌ گاوی‌ به‌ شاخ‌ خود مردی‌ یا زنی‌ را بزند كه‌ او بمیرد، گاو را البته‌ سنگسار كنند، و گوشتش‌ را نخورند و صاحب‌ گاو بی‌گناه‌ باشد.", "29": "<span>29 </span> &nbsp;و لیكن‌ اگر گاو قبل‌ از آن‌ شاخ‌زن‌ می‌بود، و صاحبش‌ آگاه‌ بود، و آن‌ را نگاه‌ نداشت‌، و او مردی‌ یا زنی‌ را كشت‌، گاو را سنگسار كنند، و صاحبش‌ را نیز به‌ قتل‌ رسانند.", "30": "<span>30 </span> &nbsp;و اگر دیه‌ بر او گذاشته‌ شود، آنگاه‌ برای‌ فدیۀ جان‌ خود هرآنچه‌ بر او مقرر شود، ادا نماید.", "31": "<span>31 </span> &nbsp;خواه‌ پسر خواه‌ دختر را شاخ‌ زده‌ باشد، به‌ حسب‌ این‌ حكم‌ با او عمل‌ كنند.", "32": "<span>32 </span> &nbsp;اگر گاو، غلامی‌ یا كنیزی‌ را بزند، سی‌ مثقال‌ نقره‌ به‌ صاحب‌ او داده‌ شود، و گاو سنگسار شود.", "33": "<span>33 </span> &nbsp;« و اگر كسی‌ چاهی‌ گشاید یا كسی‌ چاهی‌ حفر كند و آن‌ را نپوشاند، و گاوی‌ یا الاغی‌ در آن‌ افتد،", "34": "<span>34 </span> &nbsp;صاحب‌ چاه‌ عوض‌ او را بدهد، و قیمتش‌را به‌ صاحبش‌ ادا نماید، و میته‌ از آن‌ او باشد.", "35": "<span>35 </span> &nbsp;« و اگر گاو شخصی‌، گاو همسایۀ او را بزند، و آن‌ بمیرد پس‌ گاو زنده‌ را بفروشند، و قیمت‌ آن‌ را تقسیم‌ كنند، و میته‌ را نیز تقسیم‌ نمایند.", "36": "<span>36 </span> &nbsp;اما اگر معلوم‌ بوده‌ باشد كه‌ آن‌ گاو قبل‌ از آن‌ شاخ‌زن‌ می‌بود، و صاحبش‌ آن‌ را نگاه‌ نداشت‌، البته‌ گاو به‌ عوض‌ گاو بدهد و میته‌ از آن‌ او باشد." }, "22": { "1": "<span>1 </span> &nbsp;« اگر كسی‌ گاوی‌ یا گوسفندی‌ بدزدد،و آن‌ را بكشد یا بفروشد، به‌ عوض‌ گاو پنج‌ گاو، و به‌ عوض‌ گوسفند چهار گوسفند بدهد.", "2": "<span>2 </span> &nbsp;«اگر دزدی‌ در رخنه‌ كردن‌ گرفته‌ شود، و او را بزنند بطوری‌ كه‌ بمیرد، بازخواستِ خون‌ برای‌ او نباشد.", "3": "<span>3 </span> &nbsp;اما اگر آفتاب‌ بر او طلوع‌ كرد، بازخواست‌ خون‌ برای‌ او هست‌. البته‌ مكافات‌ باید داد، و اگر چیزی‌ ندارد، به‌ عوض‌ دزدی‌ كه‌ كرد، فروخته‌ شود.", "4": "<span>4 </span> &nbsp;اگر چیزی‌ دزدیده‌ شده‌، از گاو یا الاغ‌ یا گوسفند زنده‌ در دست‌ او یافت‌ شود، دو مقابل‌ آن‌ را رد كند.", "5": "<span>5 </span> &nbsp;« اگر كسی‌ مرتعی‌ یا تاكستانی‌ را بچراند، یعنی‌ مواشی‌ خود را براند تا مرتع‌ دیگری‌ را بچراند، از نیكوترین‌ مرتع‌ و از بهترین‌ تاكستان‌ خود عوض‌ بدهد.", "6": "<span>6 </span> &nbsp;« اگر آتشی‌ بیرون‌ رود، و خارها را فراگیرد و بافه‌های‌ غله‌ یا خوشه‌های‌ نادرویده‌ یا مزرعه‌ای‌ سوخته‌ گردد، هر كه‌ آتش‌ را افروخته‌ است‌، البته‌ عوض‌ بدهد.", "7": "<span>7 </span> &nbsp;« اگر كسی‌ پول‌ یا اسباب‌ نزد همسایۀ خود امانت‌ گذارد، و از خانۀ آن‌ شخص‌ دزدیده‌ شود،هر گاه‌ دزد پیدا شود، دو چندان‌ رد نماید.", "8": "<span>8 </span> &nbsp;و اگر دزد گرفته‌ نشود، آنگاه‌ صاحب‌ خانه‌ را به‌ حضور حكام‌ بیاورند، تا حكم‌ شود كه‌ آیا دست‌ خود را بر اموال‌ همسایۀ خویش‌ دراز كرده‌است‌ یا نه‌.", "9": "<span>9 </span> &nbsp;در هر خیانتی‌ از گاو و الاغ‌ و گوسفند و رخت‌ و هر چیزِ گم‌ شده‌، كه‌ كسی‌ بر آن‌ ادعا كند، امر هر دو به‌ حضور خدا برده‌ شود، و بر گناه‌ هر كدام‌ كه‌ خدا حكم‌ كند، دو چندان‌ به‌ همسایۀ خود رد نماید.", "10": "<span>10 </span> &nbsp;« اگر كسی‌ الاغی‌ یا گاوی‌ یا گوسفندی‌ یا جانوری‌ دیگر به‌ همسایۀ خود امانت‌ دهد، و آن‌ بمیرد یا پایش‌ شكسته‌ شود یا دزدیده‌ شود، و شاهدی‌ نباشد،", "11": "<span>11 </span> &nbsp;قسم‌ خداوند در میان‌ هر دو نهاده‌ شود، كه‌ دست‌ خود را به‌ مال‌ همسایۀ خویش‌ دراز نكرده‌ است‌. پس‌ مالكش‌ قبول‌ بكند و او عوض‌ ندهد.", "12": "<span>12 </span> &nbsp;لیكن‌ اگر از او دزدیده‌ شد، به‌ صاحبش‌ عوض‌ باید داد.", "13": "<span>13 </span> &nbsp;و اگر دریده‌ شد، آن‌ را برای‌ شهادت‌ بیاورد، و برای‌ دریده‌ شده‌، عوض‌ ندهد.", "14": "<span>14 </span> &nbsp;و اگر كسی‌ حیوانی‌ از همسایۀ خود عاریت‌ گرفت‌، و پای‌ آن‌ شكست‌ یا مرد، و صاحبش‌ همراهش‌ نبود، البته‌ عوض‌ باید داد.", "15": "<span>15 </span> &nbsp;اما اگر صاحبش‌ همراهش‌ بود، عوض‌ نباید داد، و اگر كرایه‌ شد، برای‌ كرایه‌ آمده‌ بود.", "16": "<span>16 </span> &nbsp;« اگر كسی‌ دختری‌ را كه‌ نامزد نبود فریب‌ داده‌، با او هم‌ بستر شد، البته‌ می‌باید او را زن‌ منكوحۀ خویش‌ سازد.", "17": "<span>17 </span> &nbsp;و هرگاه‌ پدرش‌ راضی‌باشد كه‌ او را بدو دهد، موافق‌ مهر دوشیزگان‌ نقدی‌ بدو باید داد.", "18": "<span>18 </span> &nbsp;« زن‌ جادوگر را زنده‌ مگذار.", "19": "<span>19 </span> &nbsp;« هر كه‌ با حیوانی‌ مقاربت‌ كند، هرآینه‌ كشته‌ شود.", "20": "<span>20 </span> &nbsp;« هر كه‌ برای‌ خدایی‌ غیر از یهوه‌ و بس‌ قربانی‌ گذراند، البته‌ هلاك‌ گردد.", "21": "<span>21 </span> &nbsp;« غریب‌ را اذیت‌ مرسانید و بر او ظلم‌ مكنید، زیرا كه‌ در زمین‌ مصر غریب‌ بودید.", "22": "<span>22 </span> &nbsp;« بر بیوه‌ زن‌ یا یتیم‌ ظلم‌ مكنید.", "23": "<span>23 </span> &nbsp;و هر گاه‌ بر او ظلم‌ كردی‌، و او نزد من‌ فریاد برآورد، البته‌ فریاد او را مستجاب‌ خواهم‌ فرمود", "24": "<span>24 </span> &nbsp;و خشم‌ من‌ مشتعل‌ شود، و شما را به‌ شمشیر خواهم‌ كشت‌، و زنان‌ شما بیوه‌ شوند و پسران‌ شما یتیم‌.", "25": "<span>25 </span> &nbsp;« اگر نقدی‌ به‌ فقیری‌ از قوم‌ من‌ كه‌ همسایۀ تو باشد قرض‌ دادی‌، مثل‌ رباخوار با او رفتار مكن‌ و هیچ‌ سود بر او مگذار.", "26": "<span>26 </span> &nbsp;« اگر رخت‌ همسایۀ خود را به‌ گرو گرفتی‌، آن‌ را قبل‌ از غروب‌ آفتاب‌ بدو رد كن‌،", "27": "<span>27 </span> &nbsp;زیرا كه‌ آن‌ فقط‌ پوشش‌ او و لباس‌ برای‌ بدن‌ اوست‌؛ پس‌ در چه‌ چیز بخوابد؟ و اگر نزد من‌ فریاد برآوَرَد، هرآینه‌ اجابت‌ خواهم‌ فرمود، زیرا كه‌ من‌ كریم‌ هستم‌.", "28": "<span>28 </span> &nbsp;« به‌ خدا ناسزا مگو و رئیس‌ قوم‌ خود را لعنت‌ مكن‌.", "29": "<span>29 </span> &nbsp;« درآوردن‌ نوبر غله‌ و عصیر رز خود تأخیر منما. و نخست‌زادۀ پسران‌ خود را به‌ من‌ بده‌.", "30": "<span>30 </span> &nbsp;با گاوان‌ و گوسفندان‌ خود چنین‌ بكن‌. هفت‌ روز نزدمادر خود بماند و در روز هشتمین‌ آن‌ را به‌ من‌ بده‌.", "31": "<span>31 </span> &nbsp;« و برای‌ من‌ مردان‌ مقدس‌ باشید، و گوشتی‌ را كه‌ در صحرا دریده‌ شود مخورید؛ آن‌ را نزد سگان‌ بیندازید." }, "23": { "1": "<span>1 </span> &nbsp;« خبر باطل‌ را انتشار مده‌، و با شریران همداستان‌ مشو، كه‌ شهادت‌ دروغ‌ دهی‌.", "2": "<span>2 </span> &nbsp;« پیروی‌ بسیاری‌ برای‌ عمل‌ بد مكن‌؛ و در مرافعه‌، محضِ متابعتِ كثیری‌، سخنی‌ برای‌ انحراف‌ حق‌ مگو.", "3": "<span>3 </span> &nbsp;و در مرافعۀ فقیر نیز طرفداری او منما.", "4": "<span>4 </span> &nbsp;« اگر گاو یا الاغ‌ دشمن‌ خود را یافتی‌ كه‌ گم‌ شده‌ باشد، البته‌ آن‌ را نزد او باز بیاور.", "5": "<span>5 </span> &nbsp;اگر الاغ‌ دشمن‌ خود را زیر بارش‌ خوابیده‌ یافتی‌، و از گشادن‌ او روگردان‌ هستی‌، البته‌ آن‌ را همراه‌ او باید بگشایی‌.", "6": "<span>6 </span> &nbsp;« حق‌ فقیر خود را در دعوی‌ او منحرف‌ مساز.", "7": "<span>7 </span> &nbsp;از امر دروغ‌ اجتناب‌ نما و بی‌گناه‌ و صالح‌ را به‌ قتل‌ مرسان‌ زیرا كه‌ ظالم‌ را عادل‌ نخواهم‌ شمرد.", "8": "<span>8 </span> &nbsp;« و رشوت‌ مخور زیرا كه‌ رشوت‌ بینایان‌ را كور می‌كند و سخن‌ صدّیقان‌ را كج‌ می‌سازد.", "9": "<span>9 </span> &nbsp;« و بر شخص‌ غریب‌ ظلم‌ منما زیرا كه‌ از دل‌ غریبان‌ خبر دارید، چونكه‌ در زمین‌ مصر غریب‌ بودید.", "10": "<span>10 </span> &nbsp;« و شش‌ سال‌ مزرعۀ خود را بكار و محصولش‌ را جمع‌ كن‌،", "11": "<span>11 </span> &nbsp;لیكن‌ در هفتمین‌ آن‌ را بگذار و ترك‌ كن‌ تا فقیران‌ قوم‌ تو از آن‌ بخورند و آنچه‌ از ایشان‌ باقی‌ ماند، حیوانات‌ صحرا بخورند. همچنین‌ با تاكستان‌ و درختان‌ زیتون‌ خود عمل‌ نما.", "12": "<span>12 </span> &nbsp;« شش‌ روز به‌ شغل‌ خود بپرداز و در روز هفتمین‌ آرام‌ كن‌ تا گاوت‌ و الاغت‌ آرام‌ گیرند و پسر كنیزت‌ و مهمانت‌ استراحت‌ كنند.", "13": "<span>13 </span> &nbsp;« و آنچه‌ را به‌ شما گفته‌ام‌، نگاه‌ دارید و نام‌ خدایان‌ غیر را ذكر مكنید، از زبانت‌ شنیده‌ نشود.", "14": "<span>14 </span> &nbsp;« در هر سال‌ سه‌ مرتبه‌ عید برای‌ من‌ نگاه‌ دار.", "15": "<span>15 </span> &nbsp;عید فطیر را نگاه‌ دار، و چنانكه‌ تو را امر فرموده‌ام‌، هفت‌ روز نان‌ فطیر بخور در زمان‌ معین‌ در ماه‌ اَبیب‌، زیرا كه‌ در آن‌ از مصر بیرون‌ آمدی‌. و هیچ‌ كس‌ به‌ حضور من‌ تهی‌ دست‌ حاضر نشود.", "16": "<span>16 </span> &nbsp;و عید حصاد نوبر غلات‌ خود را كه‌ در مزرعه‌ كاشته‌ای‌، و عید جمع‌ را در آخر سال‌ وقتی‌ كه‌ حاصل‌ خود را از صحرا جمع‌ كرده‌ای‌.", "17": "<span>17 </span> &nbsp;در هر سال‌ سه‌ مرتبه‌ همۀ ذكورانت‌ به‌ حضور خداوند یهوه‌ حاضر شوند.", "18": "<span>18 </span> &nbsp;« خون‌ قربانی‌ مرا با نان‌ خمیرمایه‌دار مگذران‌ و پیه‌ عید من‌ تا صبح‌ باقی‌ نماند.", "19": "<span>19 </span> &nbsp;« نوبر نخستین‌ زمین‌ خود را به‌ خانۀ یهوه‌خدای‌ خود بیاور؛«و بزغاله‌ را در شیر مادرش‌ مپز.", "20": "<span>20 </span> &nbsp;« اینك‌ من‌ فرشته‌ای‌ پیش‌ روی‌ تو می‌فرستم‌ تا تو را در راه‌ محافظت‌ نموده‌، بدان‌ مكانی‌ كه‌ مهیا كرده‌ام‌ برساند.", "21": "<span>21 </span> &nbsp;از او با حذر باش‌ و آواز او را بشنو و از او تَمَرُّد منما زیرا گناهان‌ شما را نخواهد آمرزید، چونكه‌ نام‌ من‌ در اوست.", "22": "<span>22 </span> &nbsp;و اگر قول‌ او را شنیدی‌ و به‌ آنچه‌ گفته‌ام‌ عمل‌ نمودی‌، هرآینه‌ دشمن‌ دشمنانت‌ و مخالف‌ مخالفانت‌ خواهم‌ بود،", "23": "<span>23 </span> &nbsp;زیرا فرشتۀ من‌ پیش‌ روی‌ تو می‌رود و تو را به‌ اَموریان‌ و حتیان‌ و فرزیان‌ و كنعانیان‌ و حویان‌ و یبوسیان خواهد رسانید و ایشان‌ را هلاك‌ خواهم‌ ساخت‌.", "24": "<span>24 </span> &nbsp;خدایان‌ ایشان‌ را سجده‌ منما و آنها را عبادت‌ مكن‌ و موافق‌ كارهای‌ ایشان‌ مكن‌، البته‌ آنها را منهدم‌ ساز و بتهای ایشان‌ را بشكن‌.", "25": "<span>25 </span> &nbsp;و یهوه‌، خدای‌ خود را عبادت‌ نمایید تا نان‌ و آب‌ تو را بركت‌ دهد و بیماری‌ را از میان‌ تو دور خواهم‌ كرد،", "26": "<span>26 </span> &nbsp;و در زمینت‌ سقط‌ كننده‌ و نازاد نخواهد بود و شمارۀ روزهایت‌ را تمام‌ خواهم‌ كرد.", "27": "<span>27 </span> &nbsp;و خوف‌ خود را پیش‌ روی‌ تو خواهم‌ فرستاد و هر قومی‌ را كه‌ بدیشان‌ برسی‌ متحیر خواهم‌ ساخت‌ و جمیع‌ دشمنانت‌ را پیش‌ تو روگردان‌ خواهم‌ ساخت‌.", "28": "<span>28 </span> &nbsp;و زنبورها پیش‌ روی‌ تو خواهم‌ فرستاد تا حویان‌ و كنعانیان‌ و حتیان‌ را از حضورت‌ برانند.", "29": "<span>29 </span> &nbsp;ایشان‌ را در یك‌ سال‌ از حضور تو نخواهم‌ راند، مبادا زمین‌ ویران‌ گردد و حیوانات‌ صحرا بر تو زیاده‌ شوند.", "30": "<span>30 </span> &nbsp;ایشان‌ را از پیش‌ روی‌ تو به‌ تدریج‌ خواهم‌ راند تا كثیر شوی‌ و زمین‌ را متصرف‌ گردی‌.", "31": "<span>31 </span> &nbsp;و حدود تو را از بحر قلزم‌ تا بحر فلسطین‌، و از صحرا تا نهر فرات‌ قرار دهم‌ زیرا ساكنان‌ آن زمین‌ را بدست‌ شما خواهم‌ سپرد و ایشان‌ را از پیش‌ روی‌ خود خواهی‌ راند.", "32": "<span>32 </span> &nbsp;با ایشان‌ و با خدایان‌ ایشان‌ عهد مبند.", "33": "<span>33 </span> &nbsp;در زمین‌ تو ساكن‌ نشوند، مبادا تو را بر من‌ عاصی‌ گردانند و خدایان‌ ایشان‌ را عبادت‌ كنی‌ و دامی‌ برای‌ تو باشد.»" }, "24": { "1": "<span>1 </span> &nbsp;و به‌ موسی‌ گفت‌: «نزد خداوند بالا بیا، تو و هارون‌ و ناداب‌ و اَبِیهُو و هفتاد نفر از مشایخ‌ اسرائیل‌ و از دور سجده‌ كنید.", "2": "<span>2 </span> &nbsp;و موسی‌ تنها نزدیك‌ خداوند بیاید و ایشان‌ نزدیك‌ نیایند و قوم‌ همراه‌ او بالا نیایند.»", "3": "<span>3 </span> &nbsp;پس‌ موسی‌ آمده‌، همۀ سخنان‌ خداوند و همۀ این‌ احكام‌ را به‌ قوم‌ باز گفت‌ و تمامی قوم‌ به‌ یك‌ زبان‌ در جواب‌ گفتند: «همۀ سخنانی‌ كه‌ خداوند گفته‌ است‌، بجا خواهیم‌ آورد.»", "4": "<span>4 </span> &nbsp;و موسی‌ تمامی‌ سخنان‌ خداوند را نوشت‌ و بامدادان‌ برخاسته‌، مذبحی‌ در پای‌ كوه‌ و دوازده‌ ستون‌، موافق‌ دوازده‌ سبط‌ اسرائیل بنا نهاد.", "5": "<span>5 </span> &nbsp;و بعضی‌ از جوانان‌ بنی‌اسرائیل را فرستاد و قربانی‌های‌ سوختنی‌ گذرانیدندو قربانی‌های‌ سلامتی‌ از گاوان‌ برای‌ خداوند ذبح‌ كردند.", "6": "<span>6 </span> &nbsp;و موسی‌ نصف‌ خون‌ را گرفته‌، در لگنها ریخت‌ و نصف‌ خون‌ را بر مذبح‌ پاشید،", "7": "<span>7 </span> &nbsp;و كتاب‌ عهد را گرفته‌، به‌ سمع‌ قوم‌ خواند. پس‌ گفتند: «هر آنچه‌ خداوند گفته‌ است‌، خواهیم‌ كرد و گوش‌ خواهیم‌ گرفت‌.»", "8": "<span>8 </span> &nbsp;و موسی‌ خون‌ را گرفت‌ و بر قوم‌ پاشیده‌، گفت‌: «اینك‌ خون‌ آن‌ عهدی‌ كه‌ خداوند بر جمیع‌ این‌ سخنان‌ با شما بسته‌ است‌.»", "9": "<span>9 </span> &nbsp;و موسی‌ با هارون‌ و ناداب‌ و ابیهو و هفتاد نفر از مشایخ‌ اسرائیل‌ بالا رفت‌.", "10": "<span>10 </span> &nbsp;و خدای‌ اسرائیل‌ را دیدند، و زیر پایهایش‌ مثل‌ صنعتی‌ از یاقوت‌ كبود شفاف‌ و مانند ذات‌ آسمان‌ در صفا.", "11": "<span>11 </span> &nbsp;و بر سروران‌ بنی‌اسرائیل‌ دست‌ خود را نگذارد، پس‌ خدا را دیدند و خوردند و آشامیدند.", "12": "<span>12 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «نزد من‌ به‌ كوه‌ بالا بیا، و آنجا باش‌ تا لوحهای‌ سنگی‌ و تورات‌ و احكامی‌ را كه‌ نوشته‌ام‌ تا ایشان‌ را تعلیم‌ نمایی‌، به‌ تو دهم‌.»", "13": "<span>13 </span> &nbsp;پس‌ موسی‌ با خادم‌ خود یوشع‌ برخاست‌، و موسی‌ به‌ كوه‌ خدا بالا آمد.", "14": "<span>14 </span> &nbsp;و به‌ مشایخ‌ گفت‌: «برای‌ ما در اینجا توقف‌ كنید، تا نزد شما برگردیم‌؛ همانا هارون‌ و حور با شما می‌باشند. پس‌ هر كه‌ امری‌ دارد، نزد ایشان‌ برود.»", "15": "<span>15 </span> &nbsp;و چون‌ موسی‌ به‌ فراز كوه‌ برآمد، ابر كوه‌ را فرو گرفت‌.", "16": "<span>16 </span> &nbsp;و جلال‌ خداوند بر كوه‌ سینا قرار گرفت‌، و شش‌ روز ابر آن‌ را پوشانید، و روز هفتمین‌، موسی‌ را از میان‌ ابر ندا درداد.", "17": "<span>17 </span> &nbsp;و منظر جلال‌ خداوند ، مثل‌ آتش‌ سوزنده‌ در نظر بنی‌اسرائیل‌ بر قله‌ كوه‌ بود.", "18": "<span>18 </span> &nbsp;و موسی‌ به‌ میان‌ ابر داخل‌ شده‌، به‌ فراز كوه‌ برآمد. و موسی‌ چهل‌ روز و چهل‌ شب‌ در كوه‌ ماند." }, "25": { "1": "<span>1 </span> &nbsp;و خداوند موسی‌ را خطاب‌ كرده‌،گفت‌:", "2": "<span>2 </span> &nbsp;«به‌ بنی‌اسرائیل‌ بگو كه‌ برای‌ من‌هدایا بیاورند؛ از هر كه‌ به‌ میلِ دل‌ بیاورد، هدایای‌ مرا بگیرید.", "3": "<span>3 </span> &nbsp;و این‌ است‌ هدایا كه‌ از ایشان‌ می‌گیرید: طلا و نقره‌ و برنج‌،", "4": "<span>4 </span> &nbsp;و لاجورد و ارغوان‌ و قرمز و كتان‌ نازك‌ و پشم‌ بز،", "5": "<span>5 </span> &nbsp;و پوست‌ قوچ‌ سرخ‌ شده‌ و پوست‌ خز و چوب‌ شطیم‌،", "6": "<span>6 </span> &nbsp;و روغن‌ برای‌ چراغها، و ادویه‌ برای‌ روغن‌ مسح‌، و برای‌ بخور معطر،", "7": "<span>7 </span> &nbsp;و سنگهای‌ عقیق‌ و سنگهای‌ مرصعی‌ برای‌ ایفود و سینه‌ بند.", "8": "<span>8 </span> &nbsp;و مقامی‌ و مَقدَسی‌ برای‌ من‌ بسازند تا در میان‌ ایشان‌ ساكن‌ شوم‌.", "9": "<span>9 </span> &nbsp;موافق‌ هر آنچه‌ به‌ تو نشان‌ دهم‌ از نمونۀ مسكن‌ و نمونۀ جمیع‌ اسبابش‌، همچنین‌ بسازید.", "10": "<span>10 </span> &nbsp;« و تابوتی‌ از چوب‌ شطیم‌ بسازند كه‌ طولش‌ دو ذراع‌ و نیم‌، و عرضش‌ یك‌ ذراع‌ و نیم‌ و بلندیش‌ یك‌ ذراع‌ و نیم‌ باشد.", "11": "<span>11 </span> &nbsp;و آن‌ را به‌ طلای‌ خالص‌ بپوشان‌. آن‌ را از درون‌ و بیرون‌ بپوشان‌، و بر زبرش‌ به‌ هر طرف‌ تاجی‌ زرین‌ بساز.", "12": "<span>12 </span> &nbsp;و برایش‌ چهار حلقۀ زرین‌ بریز، و آنها را بر چهار قایمه‌اش‌ بگذار، دو حلقه‌ بر یك‌ طرفش‌ و دو حلقه‌ بر طرف‌ دیگر.", "13": "<span>13 </span> &nbsp;و دو عصا از چوب‌ شطیم‌ بساز، و آنها را به‌ طلا بپوشان‌.", "14": "<span>14 </span> &nbsp;و آن‌ عصاها را در حلقه‌هایی‌ كه‌ بر طرفین‌ تابوت‌ باشد بگذران‌، تا تابوت‌ را به‌ آنها بردارند.", "15": "<span>15 </span> &nbsp;و عصاها در حلقه‌های‌ تابوت‌ بماند و از آنها برداشته‌ نشود.", "16": "<span>16 </span> &nbsp;و آن‌ شهادتی‌ را كه‌ به‌ تو می‌دهم‌، در تابوت‌ بگذار.", "17": "<span>17 </span> &nbsp;و تخت‌ رحمت‌ را از طلای‌ خالص‌ بساز. طولش‌ دو ذراع‌ و نیم‌، و عرضش‌ یك‌ ذراع‌ و نیم‌.", "18": "<span>18 </span> &nbsp;و دو كروبی‌ از طلا بساز، آنها را ازچرخكاری‌ از هر دو طرف‌ تخت‌ رحمت‌ بساز.", "19": "<span>19 </span> &nbsp;و یك‌ كروبی‌ در این‌ سر و كروبی‌ دیگر در آن‌ سر بساز. كروبیان‌ را از تخت‌ رحمت‌ بر هر دو طرفش‌ بساز.", "20": "<span>20 </span> &nbsp;و كروبیان‌ بالهای‌ خود را بر زِبَر آن‌ پهن‌ كنند، و تخت‌ رحمت‌ را به‌ بالهای‌ خود بپوشانند. و رویهای‌ ایشان‌ به‌ سوی‌ یكدیگر باشد، و رویهای‌ كروبیان‌ به‌ طرف‌ تخت‌ رحمت‌ باشد.", "21": "<span>21 </span> &nbsp;و تخت‌ رحمت‌ را بر روی‌ تابوت‌ بگذار و شهادتی‌ را كه‌ به‌ تو می‌دهم‌ در تابوت‌ بنه‌.", "22": "<span>22 </span> &nbsp;و در آنجا با تو ملاقات‌ خواهم‌ كرد و از بالای‌ تخت‌ رحمت‌ از میان‌ دو كروبی‌ كه‌ بر تابوت‌ شهادت‌ می‌باشند، با تو سخن‌ خواهم‌ گفت‌، دربارۀ همۀ اموری‌ كه‌ بجهت‌ بنی‌اسرائیل‌ تو را امر خواهم‌ فرمود.", "23": "<span>23 </span> &nbsp;« و خوانی‌ از چوب‌ شطیم‌ بساز كه‌ طولش‌ دو ذراع‌، و عرضش‌ یك‌ ذراع‌، و بلندیش‌ یك‌ ذراع‌ و نیم‌ باشد.", "24": "<span>24 </span> &nbsp;و آن‌ را به‌ طلای‌ خالص‌ بپوشان‌، و تاجی‌ از طلا به‌ هر طرفش‌ بساز.", "25": "<span>25 </span> &nbsp;و حاشیه‌ای‌ به‌ قدر چهار انگشت‌ به‌ اطرافش‌ بساز، و برای‌ حاشیه‌اش‌ تاجی‌ زرین‌ از هر طرف‌ بساز.", "26": "<span>26 </span> &nbsp;و چهار حلقۀ زرین‌ برایش‌ بساز، و حلقه‌ها را بر چهار گوشۀ چهار قایمه‌اش‌ بگذار.", "27": "<span>27 </span> &nbsp;و حلقه‌ها در برابر حاشیه‌ باشد، تا خانه‌ها باشد بجهت‌ عصاها برای‌ برداشتن‌ خوان‌.", "28": "<span>28 </span> &nbsp;و عصاها را از چوب‌ شطیم‌ بساز، و آنها را به‌ طلا بپوشان‌ تا خوان‌ را بدانها بردارند.", "29": "<span>29 </span> &nbsp;و صحنها و كاسه‌ها و جامها و پیاله‌هایش‌ را كه‌ به‌ آنها هدایای‌ ریختنی‌ می‌ریزند بساز، آنها را از طلای‌ خالص‌ بساز.", "30": "<span>30 </span> &nbsp;ونانِ تَقْدِمِه‌ را بر خوان‌، همیشه‌ به‌ حضور من‌ بگذار.", "31": "<span>31 </span> &nbsp;« و چراغدانی‌ از طلای‌ خالص‌ بساز، و از چرخكاری‌ چراغدان‌ ساخته‌ شود؛ قاعده‌اش‌ و پایه‌اش‌ و پیاله‌هایش‌ و سیبهایش‌ و گلهایش‌ از همان‌ باشد.", "32": "<span>32 </span> &nbsp;و شش‌ شاخه‌ از طرفینش‌ بیرون‌ آید، یعنی‌ سه‌ شاخۀ چراغدان‌ از یك‌ طرف‌ و سه‌ شاخۀ چراغدان‌ از طرف‌ دیگر.", "33": "<span>33 </span> &nbsp;سه‌ پیالۀ بادامی‌ با سیبی‌ و گلی‌ در یك‌ شاخه‌ و سه‌ پیالۀ بادامی‌ با سیبی‌ و گلی‌ در شاخۀ دیگر و هم‌ چنین‌ در شش‌ شاخه‌ای‌ كه‌ از چراغدان‌ بیرون‌ می‌آید.", "34": "<span>34 </span> &nbsp;و در چراغدان‌ چهار پیالۀ بادامی‌ با سیبها و گلهای‌ آنها باشد.", "35": "<span>35 </span> &nbsp;و سیبی‌ زیر دو شاخۀ آن‌ و سیبی‌ زیر دو شاخۀ آن‌ و سیبی‌ زیر دو شاخۀ آن‌ بر شش‌ شاخه‌ای‌ كه‌ از چراغدان‌ بیرون‌ می‌آید.", "36": "<span>36 </span> &nbsp;و سیبها و شاخه‌هایش‌ از همان‌ باشد، یعنی‌ از یك‌ چرخكاری‌ طلای‌ خالص‌.", "37": "<span>37 </span> &nbsp;و هفت‌ چراغ‌ برای‌ آن‌ بساز، و چراغهایش‌ را بر بالای‌ آن‌ بگذار تا پیش‌ روی‌ آن‌ را روشنایی‌ دهند.", "38": "<span>38 </span> &nbsp;و گُل‌گیرها و سینیهایش‌ از طلای‌ خالص‌ باشد.", "39": "<span>39 </span> &nbsp;خودش‌ با همۀ اسبابش‌ از یك‌ وزنۀ طلای‌ خالص‌ ساخته‌ شود.", "40": "<span>40 </span> &nbsp;و آگاه‌ باش‌ كه‌ آنها را موافق‌ نمونۀ آنها كه‌ در كوه‌ به‌ تو نشان‌ داده‌ شد بسازی‌." }, "26": { "1": "<span>1 </span> &nbsp;« و مسكن‌ را از ده‌ پردۀ كتان‌ نازك‌تابیده‌، و لاجورد و ارغوان‌ و قرمز بساز. با كروبیان‌ از صنعت‌ نساج‌ ماهر آنها را ترتیب‌ نما.", "2": "<span>2 </span> &nbsp;طول‌ یك‌ پرده‌ بیست‌ و هشت‌ ذراع‌، و عرض‌یك‌ پرده‌ چهار ذراع‌، و همۀ پرده‌ها را یك‌ اندازه‌ باشد.", "3": "<span>3 </span> &nbsp;پنج‌ پرده‌ با یكدیگر پیوسته‌ باشد، و پنج‌ پرده‌ با یكدیگر پیوسته‌.", "4": "<span>4 </span> &nbsp;و مادگیهای‌ لاجورد بر كنار هر پرده‌ای‌ بر لب‌ پیوستگی‌اش‌ بساز، و بر كنار پردۀ بیرونی‌ در پیوستگی‌ دوم‌ چنین‌ بساز.", "5": "<span>5 </span> &nbsp;پنجاه‌ مادگی‌ در یك‌ پرده‌ بساز، و پنجاه‌ مادگی‌ در كنار پرده‌ای‌ كه‌ در پیوستگی‌ دوم‌ است‌ بساز، به‌ قسمی‌ كه‌ مادگیها مقابل‌ یكدیگر باشد.", "6": "<span>6 </span> &nbsp;و پنجاه‌ تكمۀ زرین‌ بساز و پرده‌ها را به‌ تكمه‌ها با یكدیگر پیوسته‌ ساز، تا مسكن‌ یك‌ باشد.", "7": "<span>7 </span> &nbsp;و خیمۀ بالای‌ مسكن‌ را از پرده‌های‌ پشم‌ بز بساز، و برای‌ آن‌ یازده‌ پرده‌ درست‌ كن‌.", "8": "<span>8 </span> &nbsp;طول‌ یك‌ پرده‌ سی‌ ذراع‌، و عرض‌ یك‌ پرده‌ چهار ذراع‌، و اندازۀ هر یازده‌ پرده‌ یك‌ باشد.", "9": "<span>9 </span> &nbsp;و پنج‌ پرده‌ را جدا و شش‌ پرده‌ را جدا، پیوسته‌ ساز، و پردۀ ششم‌ را پیش‌ روی‌ خیمه‌ دولا كن‌.", "10": "<span>10 </span> &nbsp;و پنجاه‌ مادگی‌ بر كنار پرده‌ای‌ كه‌ در پیوستگی‌ بیرون‌ است‌ بساز، و پنجاه‌ مادگی‌ بر كنار پرده‌ای‌ كه‌ در پیوستگی‌ دوم‌ است‌.", "11": "<span>11 </span> &nbsp;و پنجاه‌ تكمۀ برنجین‌ بساز، و تكمه‌ها را در مادگیها بگذران‌، و خیمه‌ را با هم‌ پیوسته‌ ساز تا یك‌ باشد.", "12": "<span>12 </span> &nbsp;و زیادتی پرده‌های‌ خیمه‌ كه‌ باقی‌ باشد، یعنی‌ نصف‌ پرده‌ كه‌ زیاده‌ است‌، از پشت‌ خیمه‌ آویزان‌ شود.", "13": "<span>13 </span> &nbsp;و ذراعی‌ از این‌ طرف‌ و ذراعی‌ از آن‌ طرف‌ كه‌ در طول‌ پرده‌های‌ خیمه‌ زیاده‌ باشد، بر طرفین‌ مسكن‌ از هر دو جانب‌ آویزان‌ شود تا آن‌ را بپوشد.", "14": "<span>14 </span> &nbsp;و پوششی‌ برای‌ خیمه‌ از پوست‌ قوچ‌ سرخ‌ شده‌ بساز، و پوششی‌ از پوست‌ خز بر زبر آن‌.", "15": "<span>15 </span> &nbsp;« و تخته‌های‌ قایم‌ از چوب‌ شطیم‌ برای‌ مسكن‌ بساز.", "16": "<span>16 </span> &nbsp;طول‌ هر تخته‌ ده‌ ذراع‌، و عرض‌ هر تخته‌ یك‌ ذراع‌ و نیم‌.", "17": "<span>17 </span> &nbsp;و در هر تخته‌ دو زبانه‌ قرینۀ یكدیگر باشد، و همۀ تخته‌های‌ مسكن‌ راچنین‌ بساز.", "18": "<span>18 </span> &nbsp;و تخته‌ها برای‌ مسكن‌ بساز، یعنی‌ بیست‌ تخته‌ از طرف‌ جنوب‌ به‌ سمت‌ یمانی‌.", "19": "<span>19 </span> &nbsp;و چهل‌ پایۀ نقره‌ در زیر آن‌ بیست‌ تخته‌ بساز، یعنی‌ دو پایه‌ زیر یك‌ تخته‌ برای‌ دو زبانه‌اش‌، و دو پایه‌ زیر یك‌ تخته‌ برای‌ دو زبانه‌اش‌.", "20": "<span>20 </span> &nbsp;و برای‌ جانب‌ دیگر مسكن‌، از طرف‌ شمال‌ بیست‌ تخته‌ باشد.", "21": "<span>21 </span> &nbsp;و چهل‌ پایۀ نقرۀ آنها، یعنی‌ دو پایه‌ زیر یك‌ تخته‌ و دو پایه‌ زیر تختۀ دیگر.", "22": "<span>22 </span> &nbsp;و برای‌ مؤخر مسكن‌ از جانب‌ غربی‌ شش‌ تخته‌ بساز.", "23": "<span>23 </span> &nbsp;و برای‌ گوشه‌های‌ مسكن‌ در مؤخرش‌ دو تخته‌ بساز.", "24": "<span>24 </span> &nbsp;و از زیر وصل‌ كرده‌ شود، و تا بالا نیز در یك‌ حلقه‌ با هم‌ پیوسته‌ شود، و برای‌ هر دو چنین‌ بشود، در هر دو گوشه‌ باشد.", "25": "<span>25 </span> &nbsp;و هشت‌ تخته‌ باشد و پایه‌های‌ آنها از نقره‌ شانزده‌ پایه‌ باشد، یعنی‌ دو پایه‌ زیر یك‌ تخته‌ و دو پایه‌ زیر تختۀ دیگر.", "26": "<span>26 </span> &nbsp;« و پشت‌بندها از چوب‌ شطیم‌ بساز، پنج‌ از برای‌ تخته‌های‌ یك‌ طرف‌ مسكن‌،", "27": "<span>27 </span> &nbsp;و پنج‌ پشت‌بند برای‌ تخته‌های‌ طرف‌ دیگر مسكن‌، و پنج‌ پشت‌بند برای‌ تخته‌های‌ طرف‌ مسكن‌ در مؤخرش‌ به‌ سمت‌ مغرب‌.", "28": "<span>28 </span> &nbsp;و پشت‌ بند وسطی‌ كه‌ میان‌ تخته‌هاست‌، از این‌ سر تا آن‌ سر بگذرد.", "29": "<span>29 </span> &nbsp;و تخته‌ها را به‌ طلا بپوشان‌ و حلقه‌های‌ آنها را از طلا بساز تا خانه‌های‌ پشت‌بندها باشد و پشت‌بندها را به‌ طلا بپوشان‌.", "30": "<span>30 </span> &nbsp;« پس‌ مسكن‌ را برپا كن‌ موافق‌ نمونه‌ای‌ كه‌ در كوه‌ به‌ تو نشان‌ داده‌ شد.", "31": "<span>31 </span> &nbsp;و حجابی‌ از لاجورد و ارغوان‌ و قرمز و كتان‌ نازك‌ تابیده‌ شده‌ بساز، از صنعت‌ نساج‌ ماهر با كروبیان‌ ساخته‌ شود.", "32": "<span>32 </span> &nbsp;و آن‌ را بر چهار ستون‌ چوب‌ شطیم‌ پوشیده‌ شدۀ به‌ طلا بگذار، و قلابهای‌ آنها از طلاباشد و بر چهار پایۀ نقره‌ قایم‌ شود.", "33": "<span>33 </span> &nbsp;و حجاب‌ را زیر تكمه‌ها آویزان‌ كن‌، و تابوت‌ شهادت‌ را در آنجا به‌ اندرون‌ حجاب‌ بیاور، و حجاب‌، قدس‌ را برای‌ شما از قدس‌الاقداس‌ جدا خواهد كرد.", "34": "<span>34 </span> &nbsp;و تخت‌ رحمت‌ را بر تابوت‌ شهادت‌ در قدس‌الاقداس‌ بگذار.", "35": "<span>35 </span> &nbsp;و خوان‌ را بیرون‌ حجاب‌ و چراغدان‌ را برابر خوان‌ به‌ طرف‌ جنوبی‌ مسكن‌ بگذار، و خوان‌ را به‌ طرف‌ شمالی‌ آن‌ برپا كن‌.", "36": "<span>36 </span> &nbsp;و پرده‌ای‌ برای‌ دروازۀ مسكن‌ از لاجورد و ارغوان‌ و قرمز و كتان‌ نازك‌ تابیده‌ شده‌ از صنعت‌ طراز بساز.", "37": "<span>37 </span> &nbsp;و برای‌ پرده‌ پنج‌ ستون‌ از چوب‌ شطیم‌ بساز، و آنها را به‌ طلا بپوشان‌، و قلابهای‌ آنها از طلا باشد، و برای‌ آنها پنج‌ پایۀ برنجین‌ بریز." }, "27": { "1": "<span>1 </span> &nbsp;« و مذبح‌ را از چوب‌ شطیم‌ بساز،طولش‌ پنج‌ ذراع‌ و عرضش‌ پنج‌ ذراع‌. و مذبح‌ مربع‌ باشد. و بلندی‌اش‌ سه‌ ذراع‌.", "2": "<span>2 </span> &nbsp;و شاخه‌هایش‌ را بر چهار گوشه‌اش‌ بساز و شاخه‌هایش‌ از همان‌ باشد و آن‌ را به‌ برنج‌ بپوشان‌.", "3": "<span>3 </span> &nbsp;و لگنهایش‌ را برای‌ برداشتن‌ خاكسترش‌ بساز. و خاك‌ اندازهایش‌ و جامهایش‌ و چنگالهایش‌ و مِجْمَرهایش‌ و همۀ اسبابش‌ را از برنج‌ بساز.", "4": "<span>4 </span> &nbsp;و برایش‌ آتش‌دانی‌ مشبك‌ برنجین‌ بساز و بر آن‌ شبكه‌ چهار حلقۀ برنجین‌ بر چهار گوشه‌اش‌ بساز.", "5": "<span>5 </span> &nbsp;و آن‌ را در زیر، كنار مذبح‌ بگذار تا شبكه‌ به‌ نصف‌ مذبح‌ برسد.", "6": "<span>6 </span> &nbsp;و دو عصا برای‌ مذبح‌ بساز. عصاها از چوب‌ شطیم‌ باشد و آنها را به‌ برنج‌ بپوشان‌.", "7": "<span>7 </span> &nbsp;و عصاها را در حلقه‌ها بگذرانند، و عصاها بر هر دو طرف‌ مذبح‌ باشد تا آن‌ را بردارند.", "8": "<span>8 </span> &nbsp;و آن‌ را مُجَوَّف‌ از تخته‌ها بساز، همچنانكه‌ در كوه‌ به‌ تو نشان‌ داده‌ شد، به‌ این‌ طور ساخته‌ شود.", "9": "<span>9 </span> &nbsp;« و صحن‌ مسكن‌ را بساز به‌ طرف‌ جنوب‌ به‌ سمت‌ یمانی‌. پرده‌های‌ صحن‌ از كتان‌ نازك‌ تابیده‌ شده‌ باشد، و طولش‌ صد ذراع‌ به‌ یك‌ طرف‌.", "10": "<span>10 </span> &nbsp;و ستونهایش‌ بیست‌ و پایه‌های‌ آنها بیست‌، از برنج‌ باشد و قلابهای‌ ستونها و پشت‌بندهای‌ آنها از نقره‌ باشد.", "11": "<span>11 </span> &nbsp;و همچنین‌ به‌ طرف‌ شمال‌، در طولش‌ پرده‌ها باشد كه‌ طول‌ آنها صد ذراع‌ باشد و بیست‌ ستون‌ آن‌ و بیست‌ پایۀ آنها از برنج‌ باشد و قلابهای‌ ستونها و پشت‌ بندهای‌ آنها از نقره‌ باشد.", "12": "<span>12 </span> &nbsp;و برای‌ عرض‌ صحن‌ به‌ سمت‌ مغرب‌، پرده‌های‌ پنجاه‌ ذراعی‌ باشد. و ستونهای‌ آنها ده‌ و پایه‌های‌ آنها ده‌.", "13": "<span>13 </span> &nbsp;و عرض‌ صحن‌ به‌ جانب‌ مشرق‌ از سمت‌ طلوع‌ پنجاه‌ ذراع‌ باشد.", "14": "<span>14 </span> &nbsp;و پرده‌های‌ یك‌ طرفِ دروازه‌، پانزده‌ ذراع‌ و ستونهای‌ آنها سه‌ و پایه‌های‌ آنها سه‌.", "15": "<span>15 </span> &nbsp;و پرده‌های‌ طرف‌ دیگر پانزده‌ ذراعی‌ و ستونهای‌ آنها سه‌ و پایه‌های‌ آنها سه‌.", "16": "<span>16 </span> &nbsp;و برای‌ دروازۀ صحن‌، پردۀ بیست‌ ذراعی‌ از لاجورد و ارغوان‌ و قرمز و كتان‌ نازك‌ تابیده‌ شده‌ از صنعت‌ طراز باشد. و ستونهایش‌ چهار و پایه‌هایش‌ چهار.", "17": "<span>17 </span> &nbsp;همۀ ستونهای‌ گرداگرد صحن‌ با پشت‌بندهای‌ نقره‌ پیوسته‌ شود، و قلابهای‌ آنها از نقره‌ و پایه‌های‌ آنها از برنج‌ باشد.", "18": "<span>18 </span> &nbsp;طول‌ صحن‌ صد ذراع‌، و عرضش‌ در هر جا پنجاه‌ ذراع‌، و بلندی‌اش‌ پنج‌ ذراع‌ از كتان‌ نازك‌ تابیده‌ شده‌، و پایه‌هایش‌ از برنج‌ باشد.", "19": "<span>19 </span> &nbsp;و همۀ اسباب‌ مسكن‌برای‌ هر خدمتی‌، و همۀ میخهایش‌، و همۀ میخهای‌ صحن‌ از برنج‌ باشد.", "20": "<span>20 </span> &nbsp;« و تو بنی‌اسرائیل‌ را امر فرما كه‌ روغن‌ زیتون‌ مصفی‌ و كوبیده‌ شده‌ برای‌ روشنایی‌ نزد تو بیاورند تا چراغها دائماً روشن‌ شود.", "21": "<span>21 </span> &nbsp;در خیمۀ اجتماع‌، بیرون‌ پرده‌ای‌ كه‌ در برابر شهادت‌ است‌، هارون‌ و پسرانش‌ از شام‌ تا صبح‌، به‌ حضور خداوند آن‌ را درست‌ كنند. و این‌ برای‌ بنی‌اسرائیل‌ نسلاً بعد نسل‌ فریضۀ ابدی‌ باشد." }, "28": { "1": "<span>1 </span> &nbsp;« و تو برادر خود، هارون‌ و پسرانش‌را با وی‌ از میان‌ بنی‌اسرائیل‌ نزد خود بیاور تا برای‌ من‌ كهانت‌ بكند، یعنی‌ هارون‌ و ناداب‌ و ابیهو و العازار و ایتامار، پسران‌ هارون‌.", "2": "<span>2 </span> &nbsp;و رختهای‌ مقدس‌ برای‌ برادرت‌، هارون‌، بجهت‌ عزت‌ و زینت‌ بساز.", "3": "<span>3 </span> &nbsp;و تو به‌ جمیع‌ دانادلانی‌ كه‌ ایشان‌ را به‌ روح‌ حكمت‌ پر ساخته‌ام‌، بگو كه‌ رختهای‌ هارون‌ را بسازند برای‌ تقدیس‌ كردن‌ او تا برای‌ من‌ كهانت‌ كند.", "4": "<span>4 </span> &nbsp;و رختهایی‌ كه‌ می‌سازند این‌ است‌: سینه‌بند و ایفود و ردا و پیراهن‌ مُطَرَّز و عمامه‌ و كمربند. این‌ رختهای‌ مقدس‌ را برای‌ برادرت‌ هارون‌ و پسرانش‌ بسازند تا بجهت‌ من‌ كهانت‌ كنند.", "5": "<span>5 </span> &nbsp;و ایشان‌ طلا و لاجورد و ارغوان‌ و قرمز و كتان‌ نازك‌ را بگیرند.", "6": "<span>6 </span> &nbsp;« و ایفود را از طلا و لاجورد و ارغوان‌ و قرمز و كتانِ نازكِ تابیده‌ شده‌، از صنعت‌ نساج‌ ماهر بسازند.", "7": "<span>7 </span> &nbsp;و دو كتفش‌ را بر دو كناره‌اش‌ بپیوندند تا پیوسته‌ شود.", "8": "<span>8 </span> &nbsp;و زُنّار ایفود كه‌ برآن‌ است‌، از همان‌ صنعت‌ و از همان‌ پارچه‌ باشد، یعنی‌ از طلاو لاجورد و ارغوان‌ و قرمز و كتان‌ نازك‌ تابیده‌ شده‌.", "9": "<span>9 </span> &nbsp;و دو سنگ‌ جزع‌ بگیر و نامهای‌ بنی‌اسرائیل‌ را بر آنها نقش‌ كن‌.", "10": "<span>10 </span> &nbsp;شش‌ نام‌ ایشان‌ را بر یك‌ سنگ‌ و شش‌ نام‌ باقی‌ ایشان‌ را بر سنگ‌ دیگر موافق‌ تولد ایشان‌.", "11": "<span>11 </span> &nbsp;از صنعتِ نقاشِ سنگ‌ مثل‌ نقش‌ خاتم‌ نامهای‌ بنی‌اسرائیل‌ را بر هر دو سنگ‌ نقش‌ نما و آنها را در طوقهای‌ طلا نصب‌ كن‌.", "12": "<span>12 </span> &nbsp;و آن‌ دو سنگ‌ را بر كتفهای‌ ایفود بگذار تا سنگهای‌ یادگاری‌ برای‌ بنی‌اسرائیل‌ باشد، و هارون‌ نامهای‌ ایشان‌ را بر دو كتف‌ خود، بحضور خداوند برای‌ یادگاری‌ بردارد.", "13": "<span>13 </span> &nbsp;و دو طوق‌ از طلا بساز.", "14": "<span>14 </span> &nbsp;و دو زنجیر از طلای‌ خالص‌ بساز مثل‌ طناب‌ بهم‌ پیچیده‌ شده‌، و آن‌ دو زنجیر بهم‌ پیچیده‌ شده‌ را در طوقها بگذار.", "15": "<span>15 </span> &nbsp;« و سینه‌بند عدالت‌ را از صنعت‌ نساج‌ ماهر، موافق‌ كار ایفود بساز و آن‌ را از طلا و لاجورد و ارغوان‌ و قرمز و كتان‌ نازك‌ تابیده‌ شده‌ بساز.", "16": "<span>16 </span> &nbsp;و مربع‌ و دولا باشد، طولش‌ یك‌ وجب‌ و عرضش‌ یك‌ وجب‌.", "17": "<span>17 </span> &nbsp;و آن‌ را به‌ ترصیع‌ سنگها، یعنی‌ به‌ چهار رسته‌ از سنگها مرصع‌ كن‌ كه‌ رستۀ اول‌ عقیق‌ احمر و یاقوت‌ اصفر و زمرد باشد،", "18": "<span>18 </span> &nbsp;و رستۀ دوم‌ بهرمان‌ و یاقوت‌ كبود و عقیق‌ سفید،", "19": "<span>19 </span> &nbsp;و رستۀ سوم‌ عین‌ الهر و یشم‌ و جمشت‌،", "20": "<span>20 </span> &nbsp;و رستۀ چهارم‌ زبرجد و جزع‌ و یشب‌. و آنها در رسته‌های‌ خود با طلا نشانده‌ شود.", "21": "<span>21 </span> &nbsp;و سنگها موافق‌ نامهای‌ بنی‌اسرائیل‌ مطابق‌ اسامی‌ ایشان‌، دوازده‌ باشد، مثل‌ نقش‌ خاتم‌، و هر یك‌ برای‌ دوازده‌ سبط‌ موافق‌ اسمش‌ باشد.", "22": "<span>22 </span> &nbsp;و بر سینه‌بند، زنجیرهای‌ بهم‌ پیچیده‌ شده‌، مثل‌ طناب‌ از طلای‌ خالص‌ بساز.", "23": "<span>23 </span> &nbsp;و بر سینه‌بند، دو حلقه‌ از طلا بساز و آن‌ دو حلقه‌ را بر دو طرف‌ سینه‌بند بگذار.", "24": "<span>24 </span> &nbsp;و آن‌ دو زنجیر طلا را بر آن‌ دو حلقه‌ای‌ كه‌ برسر سینه‌بند است‌ بگذار.", "25": "<span>25 </span> &nbsp;و دو سر دیگر آن‌ دو زنجیر را در آن‌ دو طوق‌ ببند و بر دو كتف‌ ایفود بطرف‌ پیش‌ بگذار.", "26": "<span>26 </span> &nbsp;و دو حلقۀ زرین‌ بساز و آنها را بر دو سر سینه‌بند، به‌ كنار آن‌ كه‌ بطرف‌ اندرون‌ ایفود است‌، بگذار.", "27": "<span>27 </span> &nbsp;و دو حلقۀ دیگر زرین‌ بساز و آنها را بر دو كتف‌ ایفود از پایین‌ بجانب‌ پیش‌، در برابر پیوستگی‌ آن‌، بر زبر زنار ایفود بگذار.", "28": "<span>28 </span> &nbsp;و سینه‌بند را به‌ حلقه‌هایش‌ بر حلقه‌های‌ ایفود به‌ نوار لاجورد ببندند تا بالای‌ زنار ایفود باشد و تا سینه‌بند از ایفود جدا نشود.", "29": "<span>29 </span> &nbsp;و هارون‌ نامهای‌ بنی‌اسرائیل‌ را بر سینه‌بند عدالت‌ بر دل‌ خود، وقتی‌ كه‌ به‌ قدس‌ داخل‌ شود، به‌ حضور خداوند بجهت‌ یادگاری‌ دائماً بردارد.", "30": "<span>30 </span> &nbsp;و اوریم‌ و تُمّیم‌ را در سینه‌بند عدالت‌ بگذار تا بر دل‌ هارون‌ باشد، وقتی‌ كه‌ به‌ حضور خداوند بیاید، و عدالت‌ بنی‌اسرائیل‌ را بر دل‌ خود بحضور خداوند دائماً متحمل‌ شود.", "31": "<span>31 </span> &nbsp;« و ردای‌ ایفود را تماماً از لاجورد بساز.", "32": "<span>32 </span> &nbsp;و شكافی‌ برای‌ سر، در وسطش‌ باشد. و حاشیۀ گرداگرد شكافش‌ از كار نساج‌ مثل‌ گریبان‌ زره‌، تا دریده‌ نشود.", "33": "<span>33 </span> &nbsp;و در دامنش‌، انارها بساز از لاجورد و ارغوان‌ و قرمز، گرداگرد دامنش‌، و زنگوله‌های‌ زرین‌ در میان‌ آنها به‌ هر طرف‌.", "34": "<span>34 </span> &nbsp;زنگولۀ زرین‌ و اناری‌ و زنگولۀ زرین‌ و اناری‌ گرداگرد دامن‌ ردا.", "35": "<span>35 </span> &nbsp;و در بر هارون‌ باشد، هنگامی‌ كه‌ خدمت‌ می‌كند، تا آواز آنها شنیده‌ شود، هنگامی‌ كه‌ در قدس‌ بحضور خداوند داخل‌ می‌شود و هنگامی‌ كه‌ بیرون‌ می‌آید تا نمیرد.", "36": "<span>36 </span> &nbsp;و تُنكه‌ای‌ از طلای‌ خالص‌ بساز و بر آن‌ مثل‌ نقش‌ خاتم‌ قدوسیت‌ برای‌ یهوه‌ نقش‌ كن‌.", "37": "<span>37 </span> &nbsp;و آن‌ را به‌نوار لاجوردی‌ ببند تا بر عمامه‌ باشد، بر پیشانی‌ عمامه‌ خواهد بود.", "38": "<span>38 </span> &nbsp;و بر پیشانی‌ هارون‌ باشد تا هارون‌ گناه‌ موقوفاتی‌ كه‌ بنی‌اسرائیل‌ وقف‌ می‌نمایند، در همۀ هدایای‌ مقدس‌ ایشان‌ متحمل‌ شود. و آن‌ دائماً بر پیشانی‌ او باشد تا بحضور خداوند مقبول‌ شوند.", "39": "<span>39 </span> &nbsp;و پیراهن‌ كتان‌ نازك‌ را بباف‌ و عمامه‌ای‌ از كتان‌ نازك‌ بساز و كمربندی‌ از صنعت‌ طراز بساز.", "40": "<span>40 </span> &nbsp;و برای‌ پسران‌ هارون‌ پیراهنها بساز و بجهت‌ ایشان‌ كمربندها بساز و برای‌ ایشان‌ عمامه‌ها بساز بجهت‌ عزت‌ و زینت‌.", "41": "<span>41 </span> &nbsp;و برادر خود هارون‌ و پسرانش‌ را همراه‌ او به‌ آنها آراسته‌ كن‌، و ایشان‌ را مسح‌ كن‌ و ایشان‌ را تخصیص‌ و تقدیس‌ نما تا برای‌ من‌ كهانت‌ كنند.", "42": "<span>42 </span> &nbsp;و زیر جامه‌های‌ كتان‌ برای‌ ستر عورت‌ ایشان‌ بساز كه‌ از كمر تا ران‌ برسد،", "43": "<span>43 </span> &nbsp;و بر هارون‌ و پسرانش‌ باشد، هنگامی‌كه‌ به‌ خیمۀ اجتماع‌ داخل‌ شوند یا نزد مذبح‌ آیند تا در قدس‌ خدمت‌ نمایند، مبادا متحمل‌ گناه‌ شوند و بمیرند. این‌ برای‌ وی‌ و بعد از او برای‌ ذریتش‌ فریضۀ ابدی‌ است‌." }, "29": { "1": "<span>1 </span> &nbsp;« و این‌ است‌ كاری‌ كه‌ بدیشان‌ می‌كنی‌،برای‌ تقدیس‌ نمودن‌ ایشان‌ تا بجهت‌ من‌ كهانت‌ كنند: یك‌ گوساله‌ و دو قوچ‌ بی‌عیب‌ بگیر،", "2": "<span>2 </span> &nbsp;و نان‌ فطیر و قرصهای‌ فطیر سرشته‌ به‌ روغن‌ و رقیقهای‌ فطیر مسح‌ شده‌ به‌ روغن‌. آنها را از آرد نرم‌ گندم‌ بساز.", "3": "<span>3 </span> &nbsp;و آنها را در یك‌ سبد بگذار و آنها را در سبد با گوساله‌ و دو قوچ‌ بگذران‌.", "4": "<span>4 </span> &nbsp;و هارون‌ و پسرانش‌ را نزد دروازۀ خیمۀ اجتماع‌ آورده‌، ایشان‌ را به‌ آب‌ غسل‌ ده‌،", "5": "<span>5 </span> &nbsp;و آن‌ رختها را گرفته‌،هارون‌ را به‌ پیراهن‌ و ردای‌ ایفود و ایفود و سینه‌بند آراسته‌ كن‌ و زنار ایفود را بر وی‌ ببند.", "6": "<span>6 </span> &nbsp;و عمامه‌ را بر سرش‌ بنه‌ و افسر قدوسیت‌ را بر عمامه‌ بگذار،", "7": "<span>7 </span> &nbsp;و روغن‌ مسح‌ را گرفته‌، برسرش‌ بریز و او را مسح‌ كن‌.", "8": "<span>8 </span> &nbsp;و پسرانش‌ را نزدیك‌ آورده‌، ایشان‌ را به‌ پیراهنها بپوشان‌.", "9": "<span>9 </span> &nbsp;و بر ایشان‌، یعنی‌ هارون‌ و پسرانش‌ كمربندها ببند و عمامه‌ها را بر ایشان‌ بگذار و كهانت‌ برای‌ ایشان‌ فریضۀ ابدی‌ خواهد بود. پس‌ هارون‌ و پسرانش‌ را تخصیص‌ نما.", "10": "<span>10 </span> &nbsp;و گوساله‌ را پیش‌ خیمۀ اجتماع‌ برسان‌، و هارون‌ و پسرانش‌ دستهای‌ خود را بر سر گوساله‌ بگذارند.", "11": "<span>11 </span> &nbsp;و گوساله‌ را به‌ حضور خداوند نزد در خیمۀ اجتماع‌ ذبح‌ كن‌.", "12": "<span>12 </span> &nbsp;و از خون‌ گوساله‌ گرفته‌، بر شاخهای‌ مذبح‌ به‌ انگشت‌ خود بگذار، و باقی‌ خون‌ را بر بنیان‌ مذبح‌ بریز.", "13": "<span>13 </span> &nbsp;و همۀ پیه‌ را كه‌ احشا را می‌پوشاند، و سفیدی‌ كه‌ بر جگر است‌، و دو گُرده‌ را با پیهی‌ كه‌ بر آنهاست‌، گرفته‌، بر مذبح‌ بسوزان‌.", "14": "<span>14 </span> &nbsp;اما گوشت‌ گوساله‌ را و پوست‌ و سرگینش‌ را بیرون‌ از اردو به‌ آتش‌ بسوزان‌، زیرا قربانی‌ گناه‌ است‌.", "15": "<span>15 </span> &nbsp;« و یك‌ قوچ‌ بگیر و هارون‌ و پسرانش‌، دستهای‌ خود را بر سر قوچ‌ بگذارند.", "16": "<span>16 </span> &nbsp;و قوچ‌ را ذبح‌ كرده‌، خونش‌ را بگیر و گرداگرد مذبح‌ بپاش‌.", "17": "<span>17 </span> &nbsp;و قوچ‌ را به‌ قطعه‌هایش‌ ببر، و احشا و پاچه‌هایش‌ را بشوی‌، و آنها را بر قطعه‌ها و سرش‌ بنه‌.", "18": "<span>18 </span> &nbsp;و تمام‌ قوچ‌ را بر مذبح‌ بسوزان‌، زیرا برای‌ خداوند قربانی‌ سوختنی‌ است‌، و عطر خوشبو، و قربانی‌ آتشین‌ برای‌ خداوند است‌.", "19": "<span>19 </span> &nbsp;پس‌ قوچ‌ دوم‌ را بگیر و هارون‌ و پسرانش‌ دستهای‌ خود را بر سر قوچ‌ بگذارند.", "20": "<span>20 </span> &nbsp;و قوچ‌ را ذبح‌ كرده‌، ازخونش‌ بگیر و به‌ نرمۀ گوش‌ راست‌ هارون‌، و به‌ نرمۀ گوش‌ پسرانش‌، و به‌ شست‌ دست‌ راست‌ ایشان‌، و به‌ شست‌ پای‌ راست‌ ایشان‌، بگذار، و باقی‌ خون‌ را گرداگرد مذبح‌ بپاش‌.", "21": "<span>21 </span> &nbsp;و از خونی‌ كه‌ بر مذبح‌ است‌، و از روغن‌ مسح‌ گرفته‌، آن‌ را بر هارون‌ و رخت‌ وی‌ و بر پسرانش‌ و رخت‌ پسرانش‌ با وی‌ بپاش‌، تا او و رختش‌ و پسرانش‌ و رخت‌ پسرانش‌ با وی‌ تقدیس‌ شوند.", "22": "<span>22 </span> &nbsp;پس‌ پیه‌ قوچ‌ را، و دنبه‌ و پیهی‌ كه‌ احشا را می‌پوشاند، و سفیدی‌ جگر، و دو گُرده‌ و پیهی‌ كه‌ بر آنهاست‌، و ساق‌ راست‌ را بگیر، زیرا كه‌ قوچ‌، قربانی تخصیص‌ است‌.", "23": "<span>23 </span> &nbsp;و یك‌ گِردۀ نان‌ و یك‌ قرص‌ نان‌ روغنی‌، و یك‌ رقیق‌ از سبد نان‌ فطیر را كه‌ به‌ حضور خداوند است‌،", "24": "<span>24 </span> &nbsp;و این‌ همه‌ را به‌ دست‌ هارون‌ و به‌ دست‌ پسرانش‌ بنه‌، و آنها را برای‌ هدیۀ جنبانیدنی‌ به‌ حضور خداوند بجنبان‌.", "25": "<span>25 </span> &nbsp;و آنها را از دست‌ ایشان‌ گرفته‌، برای‌ قربانی‌ سوختنی‌ بر مذبح‌ بسوزان‌، تا برای‌ خداوند عطر خوشبو باشد، زیرا كه‌ این‌ قربانی‌ آتشین‌ خداوند است‌.", "26": "<span>26 </span> &nbsp;و سینۀ قوچِ قربانی تخصیص‌ را كه‌ برای‌ هارون‌ است‌ گرفته‌، آن‌ را برای‌ هدیۀ جنبانیدنی‌ به‌ حضور خداوند بجنبان‌. و آن‌ حصۀ تو می‌باشد.", "27": "<span>27 </span> &nbsp;و سینۀ جنبانیدنی‌ و ساق‌ رفیعه‌ را كه‌ از قوچ‌ قربانی تخصیصِ هارون‌ و پسرانش‌ جنبانیده‌، و برداشته‌ شد، تقدیس‌ نمای‌.", "28": "<span>28 </span> &nbsp;و آن‌ از آنِ هارون‌ و پسرانش‌ از جانب‌ بنی‌اسرائیل‌ به‌ فریضۀ ابدی‌ خواهد بود، زیرا كه‌ هدیۀ رفیعه‌ است‌ و هدیۀ رفیعه‌ از جانب‌ بنی‌اسرائیل‌ از قربانی‌های‌ سلامتی‌ ایشان‌ برای‌ خداوند خواهد بود.", "29": "<span>29 </span> &nbsp;و رخت‌ مقدس‌ هارون‌ بعد از او، از آن‌ پسرانش‌خواهد بود، تا در آنها مسح‌ و تخصیص‌ شوند.", "30": "<span>30 </span> &nbsp;هفت‌ روز، آن‌ كاهن‌ كه‌ جانشین‌ او می‌باشد از پسرانش‌ و به‌ خیمۀ اجتماع‌ داخل‌ شده‌، خدمت‌ قدس‌ را می‌كند، آنها را بپوشد.", "31": "<span>31 </span> &nbsp;و قوچ‌ قربانی‌ تخصیص‌ را گرفته‌، گوشتش‌ را در قدس‌ آب‌پز كن‌.", "32": "<span>32 </span> &nbsp;و هارون‌ و پسرانش‌ گوشت‌ قوچ‌ را با نانی‌ كه‌ در سبد است‌، به‌ در خیمۀ اجتماع‌ بخورند.", "33": "<span>33 </span> &nbsp;و آنانی‌ كه‌ برای‌ تخصیص‌ و تقدیس‌ خود بدین‌ چیزها كفاره‌ كرده‌ شدند، آنها را بخورند، لیكن‌ شخص‌ اجنبی‌ نخورد زیرا كه‌ مقدس‌ است‌.", "34": "<span>34 </span> &nbsp;و اگر چیزی‌ از گوشت‌ هدیۀ تخصیص‌ و از نان‌، تا صبح‌ باقی‌ ماند، آن‌ باقی‌ را به‌ آتش‌ بسوزان‌، و آن‌ را نخورند، زیرا كه‌ مقدس‌ است‌.", "35": "<span>35 </span> &nbsp;« همچنان‌ به‌ هارون‌ و پسرانش‌ عمل‌ نما، موافق‌ آنچه‌ به‌ تو امر فرموده‌ام‌، هفت‌ روز ایشان‌ را تخصیص‌ نما.", "36": "<span>36 </span> &nbsp;و گوسالۀ قربانی‌ گناه‌ را هر روز بجهت‌ كفاره‌ ذبح‌ كن‌. و مذبح‌ را طاهر ساز به‌ كفاره‌ای‌ كه‌ بر آن‌ می‌كنی‌، و آن‌ را مسح‌ كن‌ تا مقدس‌ شود.", "37": "<span>37 </span> &nbsp;هفت‌ روز برای‌ مذبح‌ كفاره‌ كن‌، و آن‌ را مقدّس‌ ساز، و مذبح‌، قدس‌اقداس‌ خواهد بود. هر كه‌ مذبح‌ را لمس‌ كند، مقدّس‌ باشد.", "38": "<span>38 </span> &nbsp;و این‌ است‌ قربانی‌هایی‌ كه‌ بر مذبح‌ باید گذرانید: دو برۀ یكساله‌. هر روز پیوسته‌", "39": "<span>39 </span> &nbsp;یك‌ بره‌ را در صبح‌ ذبح‌ كن‌، و برۀ دیگر را در عصر ذبح‌ نما.", "40": "<span>40 </span> &nbsp;و ده‌ یك‌ از آرد نرم‌ سرشته‌ شده‌ با یك‌ ربع‌ هین‌ روغن‌ كوبیده‌، و برای‌ هدیۀ ریختنی‌، یك‌ ربع‌ هین‌ شراب‌ برای‌ هر بره‌ خواهد بود.", "41": "<span>41 </span> &nbsp;و برۀ دیگر را در عصر ذبح‌ كن‌ و برای‌ آن‌ موافق‌ هدیۀ صبح‌ و موافق‌ هدیۀ ریختنی‌ آن‌ بگذران‌، تا عطر خوشبو و قربانی‌ آتشین‌ برای‌ خداوند باشد.", "42": "<span>42 </span> &nbsp;این‌ قربانی‌ سوختنی‌ دائمی‌، در نسلهای‌ شما نزد دروازۀ خیمۀ اجتماع‌ خواهد بود، به‌ حضور خداوند ، درجایی‌ كه‌ با شما ملاقات‌ می‌كنم‌ تا آنجا به‌ تو سخن‌ گویم‌.", "43": "<span>43 </span> &nbsp;و در آنجا با بنی‌اسرائیل‌ ملاقات‌ می‌كنم‌، تا از جلال‌ من‌ مقدس‌ شود.", "44": "<span>44 </span> &nbsp;و خیمۀ اجتماع‌ و مذبح‌ را مقدس‌ می‌كنم‌، و هارون‌ و پسرانش‌ را تقدیس‌ می‌كنم‌ تا برای‌ من‌ كهانت‌ كنند.", "45": "<span>45 </span> &nbsp;و در میان‌ بنی‌اسرائیل‌ ساكن‌ شده‌، خدای‌ ایشان‌ می‌باشم‌.", "46": "<span>46 </span> &nbsp;و خواهند دانست‌ كه‌ من‌ یهوه‌، خدای‌ ایشان‌ هستم‌، كه‌ ایشان‌ را از زمین‌ مصر بیرون‌ آورده‌ام‌، تا در میان‌ ایشان‌ ساكن‌ شوم‌. من‌ یهوه‌ خدای‌ ایشان‌ هستم‌." }, "30": { "1": "<span>1 </span> &nbsp;« و مذبحی‌ برای‌ سوزانیدن‌ بخور بساز. آن‌ را از چوب‌ شطیم‌ بساز.", "2": "<span>2 </span> &nbsp;طولش‌ ذراعی‌ باشد، و عرضش‌ ذراعی‌، یعنی‌ مربع‌ باشد، و بلندی‌اش‌ دو ذراع‌، و شاخهایش‌ از خودش‌ باشد.", "3": "<span>3 </span> &nbsp;و آن‌ را به‌ طلای‌ خالص‌ بپوشان‌. سطحش‌ و جانبهایش‌ به‌ هر طرف‌ و شاخهایش‌ را و تاجی‌ از طلا گرداگردش‌ بساز.", "4": "<span>4 </span> &nbsp;و دو حلقۀ زرین‌ برایش‌ در زیر تاجش‌ بساز، بر دو گوشه‌اش‌، بر هر دو طرفش‌، آنها را بساز. و آنها خانه‌ها باشد برای‌ عصاها، تا آن‌ را بدانها بردارند.", "5": "<span>5 </span> &nbsp;و عصاها را از چوب‌ شطیم‌ بساز و آنها را به‌ طلا بپوشان‌.", "6": "<span>6 </span> &nbsp;و آن‌ را پیش‌ حجابی‌ كه‌ روبروی‌ تابوت‌ شهادت‌ است‌، در مقابل‌ كرسی‌ رحمت‌ كه‌ بر زبر شهادت‌ است‌، در جایی‌ كه‌ با تو ملاقات‌ می‌كنم‌، بگذار.", "7": "<span>7 </span> &nbsp;و هر بامداد هارون‌ بخور معطر بر روی‌ آن‌ بسوزاند، وقتی‌ كه‌ چراغها را می‌آراید، آن‌ را بسوزاند.", "8": "<span>8 </span> &nbsp;و در عصر چون‌ هارون‌ چراغها را روشن‌ می‌كند، آن‌ را بسوزاند تا بخور دائمی‌ به‌ حضور خداوند در نسلهای‌ شما باشد.", "9": "<span>9 </span> &nbsp;هیچ‌ بخور غریب‌ و قربانی‌ سوختنی‌ و هدیه‌ای‌ بر آن‌مگذرانید، و هدیۀ ریختنی‌ بر آن‌ مریزید.", "10": "<span>10 </span> &nbsp;و هارون‌ سالی‌ یك‌ مرتبه‌ بر شاخهایش‌ كفاره‌ كند، به‌ خون‌ قربانی‌ گناه‌ كه‌ برای‌ كفاره‌ است‌، سالی‌ یك‌ مرتبه‌ بر آن‌ كفاره‌ كند در نسلهای‌ شما، زیرا كه‌ آن‌ برای‌ خداوند قدس‌اقداس‌ است‌.»", "11": "<span>11 </span> &nbsp;و خداوند به‌ موسی‌ خطاب‌ كرده‌، گفت‌:", "12": "<span>12 </span> &nbsp;«وقتی‌ كه‌ شمارۀ بنی‌اسرائیل‌ را برحسب‌ شمرده‌شدگان‌ ایشان‌ می‌گیری‌، آنگاه‌ هركس‌ فدیۀ جان‌ خود را به‌ خداوند دهد، هنگامی‌ كه‌ ایشان‌ را می‌شماری‌، مبادا در حین‌ شمردن‌ ایشان‌، وبایی‌ در ایشان‌ حادث‌ شود.", "13": "<span>13 </span> &nbsp;هر كه‌ به‌ سوی‌ شمرده‌شدگان‌ می‌گذرد، این‌ را بدهد، یعنی‌ نیم‌ مثقال‌ موافق‌ مثقال‌ قدس‌، كه‌ یك‌ مثقال‌ بیست‌ قیراط‌ است‌، و این‌ نیم‌ مثقال‌ هدیۀ خداوند است‌.", "14": "<span>14 </span> &nbsp;هركس‌ از بیست‌ ساله‌ و بالاتر كه‌ بسوی‌ شمرده‌شدگان‌ بگذرد، هدیۀ خداوند را بدهد.", "15": "<span>15 </span> &nbsp;دولتمند از نیم‌ مثقال‌ زیاده‌ ندهد، و فقیر كمتر ندهد، هنگامی‌ كه‌ هدیه‌ای‌ برای‌ كفاره‌ جانهای‌ خود به‌ خداوند می‌دهند.", "16": "<span>16 </span> &nbsp;و نقد كفاره‌ را از بنی‌اسرائیل‌ گرفته‌، آن‌ را برای‌ خدمت‌ خیمۀ اجتماع‌ بده‌، تا برای‌ بنی‌اسرائیل‌ یادگاری‌ به‌ حضور خداوند باشد، و بجهت‌ جانهای‌ ایشان‌ كفاره‌ كند.»", "17": "<span>17 </span> &nbsp;و خداوند به‌ موسی‌ خطاب‌ كرده‌، گفت‌:", "18": "<span>18 </span> &nbsp;«حوضی‌ نیز برای‌ شستن‌ از برنج‌ بساز، و پایه‌اش‌ از برنج‌ و آن‌ را در میان‌ خیمۀ اجتماع‌ ومذبح‌ بگذار، و آب‌ در آن‌ بریز.", "19": "<span>19 </span> &nbsp;و هارون‌ و پسرانش‌ دست‌ و پای‌ خود را از آن‌ بشویند.", "20": "<span>20 </span> &nbsp;هنگامی‌ كه‌ به‌ خیمۀ اجتماع‌ داخل‌ شوند، به‌ آب‌ بشویند، مبادا بمیرند. و وقتی‌ كه‌ برای‌ خدمت‌ كردن‌ و سوزانیدن‌ قربانی‌های‌ آتشین‌ بجهت‌ خداوند به‌ مذبح‌ نزدیك‌ آیند،", "21": "<span>21 </span> &nbsp;آنگاه‌ دست‌ و پای‌ خود را بشویند، مبادا بمیرند. و این‌ برای‌ ایشان‌، یعنی‌ برای‌ او و ذریتش‌، نسلاً بعد نسل‌ فریضۀ ابدی‌ باشد.»", "22": "<span>22 </span> &nbsp;و خداوند موسی‌ را خطاب‌ كرده‌، گفت‌:", "23": "<span>23 </span> &nbsp;«و تو عطریات‌ خاص‌ بگیر، از مُرّ چكیده‌ پانصد مثقال‌، و از دارچینی‌ معطر، نصف‌ آن‌، دویست‌ و پنجاه‌ مثقال‌، و از قصب‌الذریره‌، دویست‌ و پنجاه‌ مثقال‌.", "24": "<span>24 </span> &nbsp;و از سلیخه‌ پانصد مثقال‌ موافق‌ مثقال‌ قدس‌، و از روغن‌ زیتون‌ یك‌ هین‌.", "25": "<span>25 </span> &nbsp;و از آنها روغن‌ مسح‌ مقدس‌ را بساز، عطری‌ كه‌ از صنعت‌ عطار ساخته‌ شود، تا روغن‌ مسح‌ مقدس‌ باشد.", "26": "<span>26 </span> &nbsp;و خیمۀ اجتماع‌ و تابوت‌ شهادت‌ را بدان‌ مسح‌ كن‌.", "27": "<span>27 </span> &nbsp;و خوان‌ را با تمامی‌ اسبابش‌، و چراغدان‌ را با اسبابش‌، و مذبح‌ بخور را،", "28": "<span>28 </span> &nbsp;و مذبح‌ قربانی‌ سوختنی‌ را با همۀ اسبابش‌، و حوض‌ را با پایه‌اش‌.", "29": "<span>29 </span> &nbsp;و آنها را تقدیس‌ نما، تا قدس‌ اقداس‌ باشد. هر كه‌ آنها را لمس‌ نماید مقدس‌ باشد.", "30": "<span>30 </span> &nbsp;و هارون‌ و پسرانش‌ را مسح‌ نموده‌، ایشان‌ را تقدیس‌ نما، تا برای‌ من‌ كهانت‌ كنند.", "31": "<span>31 </span> &nbsp;و بنی‌اسرائیل‌ را خطاب‌ كرده‌، بگو: این‌ است‌ روغن‌ مسح‌ مقدس‌ برای‌ من‌ در نسلهای‌ شما.", "32": "<span>32 </span> &nbsp;و بر بدن‌ انسان‌ ریخته‌ نشود، و مثل‌ آن‌موافق‌ تركیبش‌ مسازید، زیرا كه‌ مقدّس‌ است‌ و نزد شما مقدّس‌ خواهد بود.", "33": "<span>33 </span> &nbsp;هر كه‌ مثل‌ آن‌ تركیب‌ نماید، و هر كه‌ چیزی‌ از آن‌ بر شخصی‌ بیگانه‌ بمالد، از قوم‌ خود منقطع‌ شود.»", "34": "<span>34 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «عطریات‌ بگیر، یعنی‌ مَیعه‌ و اظفار و قِنّه‌ و از این‌ عطریات‌ با ندر صاف‌ حصه‌ها مساوی‌ باشد.", "35": "<span>35 </span> &nbsp;و از اینها بخور بساز، عطری‌ از صنعت‌ عطار نمكین‌ و مصفی‌ و مقدس‌.", "36": "<span>36 </span> &nbsp;و قدری‌ از آن‌ را نرم‌ بكوب‌، و آن‌ را پیش‌ شهادت‌ در خیمۀ اجتماع‌، جایی‌ كه‌ با تو ملاقات‌ می‌كنم‌ بگذار، و نزد شما قدس‌ اقداس‌ باشد.", "37": "<span>37 </span> &nbsp;و موافق‌ تركیب‌ این‌ بخور كه‌ می‌سازی‌، دیگری‌ برای‌ خود مسازید؛ نزد تو برای‌ خداوند مقدس‌ باشد.", "38": "<span>38 </span> &nbsp;هر كه‌ مثل‌ آن‌ را برای‌ بوییدن‌ بسازد، از قوم‌ خود منقطع‌ شود.»" }, "31": { "1": "<span>1 </span> &nbsp;و خداوند موسی‌ را خطاب‌ كرده‌،گفت‌:", "2": "<span>2 </span> &nbsp;«آگاه‌ باش‌ بَصَلْئیل‌ بن‌ اوری‌ بن‌ حور را از سبط‌ یهودا به‌ نام‌ خوانده‌ام‌.", "3": "<span>3 </span> &nbsp;و او را به‌ روح‌ خدا پر ساخته‌ام‌، و به‌ حكمت‌ و فهم‌ و معرفت‌ و هر هنری‌،", "4": "<span>4 </span> &nbsp;برای‌ اختراع‌ مُخْتَرَعات‌، تا در طلا و نقره‌ و برنج‌ كار كند.", "5": "<span>5 </span> &nbsp;و برای‌ تراشیدن‌ سنگ‌ و ترصیع‌ آن‌ و درودگری‌ چوب‌، تا در هر صنعتی‌ اشتغال‌ نماید.", "6": "<span>6 </span> &nbsp;و اینك‌ من‌، اُهُولیاب‌ بن‌ اخیسامَك‌ را از سبط‌ دان‌، انباز او ساخته‌ام‌، و در دل‌ همۀ دانادلان‌ حكمت‌ بخشیده‌ام‌، تا آنچه‌ را به توامرفرموده‌ام‌،بسازند.", "7": "<span>7 </span> &nbsp;خیمۀ اجتماع‌ وتابوت‌ شهادت‌ و كرسی‌ رحمت‌ كه‌ بر آن‌ است‌، و تمامی‌ اسباب‌ خیمه‌،", "8": "<span>8 </span> &nbsp;و خوان‌ و اسبابش‌ و چراغدان‌ طاهر و همۀ اسبابش‌ و مذبح‌ بخور،", "9": "<span>9 </span> &nbsp;و مذبح‌ قربانی‌ سوختنی‌ و همۀ اسبابش‌، و حوض‌ و پایه‌اش‌،", "10": "<span>10 </span> &nbsp;و لباس‌ خدمت‌ و لباس‌ مقدّس‌ برای‌ هارون‌ كاهن‌، و لباس‌ پسرانش‌ بجهت‌ كهانت‌،", "11": "<span>11 </span> &nbsp;و روغن‌ مسح‌ و بخور معطر بجهت‌ قدس‌، موافق‌ آنچه‌ به‌ تو امر فرموده‌ام‌، بسازند.»", "12": "<span>12 </span> &nbsp;و خداوند موسی‌ را خطاب‌ كرده‌، گفت‌:", "13": "<span>13 </span> &nbsp;«و تو بنی‌اسرائیل‌ را مخاطب‌ ساخته‌، بگو: البته‌ سَبَّت‌های‌ مرا نگاه‌ دارید. زیرا كه‌ این‌ در میان‌ من‌ و شما در نسلهای‌ شما آیتی‌ خواهد بود تا بدانید كه‌ من‌ یهوه‌ هستم‌ كه‌ شما را تقدیس‌ می‌كنم‌.", "14": "<span>14 </span> &nbsp;پس‌ سَبَّت‌ را نگاه‌ دارید، زیرا كه‌ برای‌ شما مقدس‌ است‌، هر كه‌ آن‌ را بی‌حرمت‌ كند، هرآینه‌ كشته‌ شود، و هر كه‌ در آن‌ كار كند، آن‌ شخص‌ از میان‌ قوم‌ خود منقطع‌ شود.", "15": "<span>15 </span> &nbsp;شش‌ روز كار كرده‌ شود، و در روز هفتم‌ سَبَّت‌ آرام‌ و مقدس‌ خداوند است‌. هر كه‌ در روز سَبَّت‌ كار كند، هرآینه كشته‌ شود.", "16": "<span>16 </span> &nbsp;پس‌ بنی‌اسرائیل‌ سَبَّت‌ را نگاه‌ بدارند، نسلاً بعد نسل‌ سَبَّت‌ را به‌ عهد ابدی‌ مَرعی دارند.", "17": "<span>17 </span> &nbsp;این‌ در میان‌ من‌ و بنی‌اسرائیل‌ آیتی‌ ابدی‌ است‌، زیرا كه‌ در شش‌ روز، خداوند آسمان‌ و زمین‌ را ساخت‌ و در روز هفتمین‌ آرام‌ فرموده‌، استراحت‌ یافت‌.»", "18": "<span>18 </span> &nbsp;و چون‌ گفتگو را با موسی‌ در كوه‌ سینا بپایان‌ برد، دو لوح‌ شهادت‌، یعنی‌ دو لوح‌ سنگ‌ مرقوم‌ به‌ انگشت‌ خدا را به‌ وی‌ داد." }, "32": { "1": "<span>1 </span> &nbsp;و چون‌ قوم‌ دیدند كه‌ موسی‌ در فرود آمدن‌ از كوه‌ تأخیر نمود، قوم‌ نزد هارون‌ جمع‌ شده‌، وی‌ را گفتند: «برخیز و برای‌ ما خدایان‌ بساز كه‌ پیش‌ روی‌ ما بخرامند، زیرا این‌ مرد، موسی‌، كه‌ ما را از زمین‌ مصر بیرون‌ آورد، نمی‌دانیم‌ او را چه‌ شده‌ است‌.»", "2": "<span>2 </span> &nbsp;هارون‌ بدیشان‌ گفت‌: «گوشواره‌های‌ طلا را كه‌ در گوش‌ زنان‌ و پسران‌ و دختران‌ شماست‌، بیرون‌ كرده‌، نزد من‌ بیاورید.»", "3": "<span>3 </span> &nbsp;پس‌ تمامی‌ قومْ گوشواره‌های‌ زرین‌ را كه‌ در گوشهای‌ ایشان‌ بود بیرون‌ كرده‌، نزد هارون‌ آوردند.", "4": "<span>4 </span> &nbsp;و آنها را از دست‌ ایشان‌ گرفته‌، آن‌ را با قلم‌ نقش‌ كرد، و از آن‌ گوسالۀ ریخته‌ شده‌ ساخت‌، و ایشان‌ گفتند: «ای‌ اسرائیل‌ این‌ خدایان‌ تو می‌باشند، كه‌ تو را از زمین‌ مصر بیرون‌ آوردند.»", "5": "<span>5 </span> &nbsp;و چون‌ هارون‌ این‌ را بدید، مذبحی‌ پیش‌ آن‌ بنا كرد و هارون‌ ندا درداده‌، گفت‌: «فردا عید یهوه‌ می‌باشد.»", "6": "<span>6 </span> &nbsp;و بامدادان‌ برخاسته‌، قربانی‌های‌ سوختنی‌ گذرانیدند، و هدایای‌ سلامتی‌ آوردند، و قوم‌ برای‌ خوردن‌ و نوشیدن‌ نشستند، و بجهت‌ لعب‌ برپا شدند.", "7": "<span>7 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «روانه‌ شده‌، بزیر برو، زیرا كه‌ این‌ قوم‌ تو كه‌ از زمین‌ مصر بیرون‌ آورده‌ای‌، فاسد شده‌اند.", "8": "<span>8 </span> &nbsp;و به‌ زودی‌ از آن‌ طریقی‌ كه‌ بدیشان‌ امر فرموده‌ام‌، انحراف‌ ورزیده‌، گوسالۀ ریخته‌ شده‌ برای‌ خویشتن‌ ساخته‌اند، و نزد آن‌ سجده‌ كرده‌، و قربانی‌ گذرانیده‌، می‌گویند كه‌ ای‌ اسرائیل‌ این‌ خدایان‌ تو می‌باشند كه‌ تو را از زمین‌ مصر بیرون‌ آورده‌اند.»", "9": "<span>9 </span> &nbsp;و خداوند به‌ موسی‌گفت‌: «این‌ قوم‌ را دیده‌ام‌ و اینك‌ قوم‌ گردنكش‌ می‌باشند.", "10": "<span>10 </span> &nbsp;و اكنون‌ مرا بگذار تا خشم‌ من‌ بر ایشان‌ مشتعل‌ شده‌، ایشان‌ را هلاك‌ كنم‌ و تو را قوم‌ عظیم‌ خواهم‌ ساخت‌.»", "11": "<span>11 </span> &nbsp;پس‌ موسی‌ نزد یهوه‌، خدای‌ خود تضرع‌ كرده‌، گفت‌: «ای‌ خداوند چرا خشم‌ تو بر قوم‌ خود كه‌ با قوت‌ عظیم‌ و دست‌ زورآور از زمین‌ مصر بیرون‌ آورده‌ای‌، مشتعل‌ شده‌ است‌؟", "12": "<span>12 </span> &nbsp;چرا مصریان‌ این‌ سخن‌ گویند كه‌ ایشان‌ را برای‌ بدی‌ بیرون‌ آورد، تا ایشان‌ را در كوهها بكشد، و از روی‌ زمین‌ تلف‌ كند؟ پس‌ از شدت‌ خشم‌ خود برگرد، و از این‌ قصد بدی قوم‌ خویش‌ رجوع‌ فرما.", "13": "<span>13 </span> &nbsp;بندگان‌ خود ابراهیم‌ و اسحاق‌ و اسرائیل‌ را بیاد آور كه‌ برای‌ ایشان‌ به‌ ذات‌ خود قسم‌ خورده‌، بدیشان‌ گفتی‌ كه‌ ذریت‌ شما را مثل‌ ستارگان‌ آسمان‌ كثیر گردانم‌، و تمامی‌ این‌ زمین‌ را كه‌ دربارۀ آن‌ سخن‌ گفته‌ام‌ به‌ ذریت‌ شما بخشم‌، تا آن‌ را متصرف‌ شوند تا ابدالا´باد.»", "14": "<span>14 </span> &nbsp;پس‌ خداوند از آن‌ بدی‌ كه‌ گفته‌ بود كه‌ به‌ قوم‌ خود برساند، رجوع‌ فرمود.", "15": "<span>15 </span> &nbsp;آنگاه‌ موسی‌ برگشته‌، از كوه‌ به‌ زیر آمد، و دو لوح‌ شهادت‌ به‌ دست‌ وی‌ بود، و لوحها به‌ هر دو طرف‌ نوشته‌ بود، بدین‌ طرف‌ و بدان‌ طرف‌ مرقوم‌ بود.", "16": "<span>16 </span> &nbsp;و لوح‌ها صنعت‌ خدا بود، و نوشته‌، نوشتۀ خدا بود، منقوش‌ بر لوح‌ها.", "17": "<span>17 </span> &nbsp;و چون‌ یوشع‌ آواز قوم‌ را كه‌ می‌خروشیدند شنید، به‌ موسی‌ گفت‌: «در اردو صدای‌ جنگ‌ است‌.»", "18": "<span>18 </span> &nbsp;گفت‌: «صدای‌ خروش‌ ظفر نیست‌، و صدای‌ خروش‌ شكست‌ نیست‌، بلكه‌ آواز مُغَنّیان‌ را من‌ می‌شنوم‌.»", "19": "<span>19 </span> &nbsp;و واقع‌ شد كه‌ چون‌ نزدیك‌ به‌ اردو رسید، و گوساله‌ و رقص‌كنندگان‌ را دید، خشم‌ موسی‌ مشتعل‌ شد، و لوحها را از دست‌ خود افكنده‌، آنها را زیر كوه‌ شكست‌.", "20": "<span>20 </span> &nbsp;و گوساله‌ای‌ را كه‌ ساخته‌ بودند گرفته‌، به‌ آتش‌ سوزانید، و آن‌ را خرد كرده‌، نرم‌ ساخت‌، و بر روی‌ آب‌ پاشیده‌، بنی‌اسرائیل‌ را نوشانید.", "21": "<span>21 </span> &nbsp;و موسی‌ به‌ هارون‌ گفت‌: «این‌ قوم‌ به‌ تو چه‌ كرده‌ بودند كه‌ گناه‌ عظیمی‌ بر ایشان‌ آوردی‌؟»", "22": "<span>22 </span> &nbsp;هارون‌ گفت‌: «خشم‌ آقایم‌ افروخته‌ نشود، تو این‌ قوم‌ را می‌شناسی‌ كه‌ مایل‌ به‌ بدی‌ می‌باشند.", "23": "<span>23 </span> &nbsp;و به‌ من‌ گفتند، برای‌ ما خدایان‌ بساز كه‌ پیش‌ روی‌ ما بخرامند، زیرا كه‌ این‌ مَرد، موسی‌، كه‌ ما را از زمین‌ مصر بیرون‌ آورده‌ است‌، نمی‌دانیم‌ او را چه‌ شده‌.", "24": "<span>24 </span> &nbsp;بدیشان‌ گفتم‌ هر كه‌ را طلا باشد آن‌ را بیرون‌ كند، پس‌ به‌ من‌ دادند، و آن‌ را در آتش‌ انداختم‌ و این‌ گوساله‌ بیرون‌ آمد.»", "25": "<span>25 </span> &nbsp;و چون‌ موسی‌ قوم‌ را دید كه‌ بی‌لگام‌ شده‌اند، زیرا كه‌ هارون‌ ایشان‌ را برای‌ رسوایی‌ ایشان‌ در میان‌ دشمنان‌ ایشان‌ بی‌لگام‌ ساخته‌ بود،", "26": "<span>26 </span> &nbsp;آنگاه‌ موسی‌ به‌ دروازۀ اردو ایستاده‌، گفت‌: «هر كه‌ به‌ طرف‌ خداوند باشد، نزد من‌ آید.» پس‌ جمیع‌ بنی‌لاوی‌ نزد وی‌ جمع‌ شدند.", "27": "<span>27 </span> &nbsp;او بدیشان‌ گفت‌: «یهوه‌، خدای‌ اسرائیل‌، چنین‌ می‌گوید: هر كس‌ شمشیر خود را بر ران‌ خویش‌ بگذارد، و از دروازه‌ تا دروازۀ اردو آمد و رفت‌ كند، و هر كس‌ برادر خود و دوست‌ خویش‌ و همسایۀ خود را بكشد.»", "28": "<span>28 </span> &nbsp;و بنی‌لاوی‌ موافق‌ سخن‌ موسی‌ كردند. و در آن‌ روز قریب‌ سه‌ هزار نفر از قوم‌ افتادند.", "29": "<span>29 </span> &nbsp;و موسی‌ گفت‌: «امروز خویشتن‌ را برای‌خداوند تخصیص‌ نمایید حتی‌ هر كس‌ به‌ پسر خود و به‌ برادر خویش‌؛ تا امروز شما را بركت‌ دهد.»", "30": "<span>30 </span> &nbsp;و بامدادان‌ واقع‌ شد كه‌ موسی‌ به‌ قوم‌ گفت‌: «شما گناهی‌ عظیم‌ كرده‌اید. اكنون‌ نزد خداوند بالا می‌روم‌، شاید گناه‌ شما را كفاره‌ كنم‌.»", "31": "<span>31 </span> &nbsp;پس‌ موسی‌ به‌ حضور خداوند برگشت‌ و گفت‌: «آه‌، این‌ قوم‌ گناهی‌ عظیم‌ كرده‌، و خدایان‌ طلا برای‌ خویشتن‌ ساخته‌اند.", "32": "<span>32 </span> &nbsp;الا´ن‌ هرگاه‌ گناه‌ ایشان‌ را می‌آمرزی‌ و اگرنه‌ مرا از دفترت‌ كه‌ نوشته‌ای‌، محو ساز.»", "33": "<span>33 </span> &nbsp;خداوند به‌ موسی‌ گفت‌: «هر كه‌ گناه‌ كرده‌ است‌، او را از دفتر خود محو سازم‌.", "34": "<span>34 </span> &nbsp;و اكنون‌ برو و این‌ قوم‌ را بدانجایی‌ كه‌ به‌ تو گفته‌ام‌، راهنمایی‌ كن‌. اینك‌ فرشتۀ من‌ پیش‌ روی‌ تو خواهد خرامید، لیكن‌ در یوم‌ تفقد من‌، گناه‌ ایشان‌ را از ایشان‌ بازخواست‌ خواهم‌ كرد.»", "35": "<span>35 </span> &nbsp;و خداوند قوم‌ را مبتلا ساخت‌ زیرا گوساله‌ای‌ را كه‌ هارون‌ ساخته‌ بود، ساخته‌ بودند." }, "33": { "1": "<span>1 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «روانه‌ شده‌،از اینجا كوچ‌ كن‌، تو و این‌ قوم‌ كه‌ از زمین‌ مصر برآورده‌ای‌، بدان‌ زمینی‌ كه‌ برای‌ ابراهیم‌، اسحاق‌ و یعقوب‌ قسم‌ خورده‌، گفته‌ام‌ آن‌ را به‌ ذریت‌ تو عطا خواهم‌ كرد.", "2": "<span>2 </span> &nbsp;و فرشته‌ای‌ پیش‌ روی‌ تو می‌فرستم‌، و كنعانیان‌ و اَموریان‌ و حتیان‌ و فرزیان‌ و حویان‌ و یبوسیان‌ را بیرون‌ خواهم‌ كرد", "3": "<span>3 </span> &nbsp;به‌ زمینی‌ كه‌ به‌ شیر و شهد جاری‌ است‌؛ زیرا كه‌ در میان‌ شما نمی‌آیم‌، چونكه‌ قوم‌ گردن‌كش‌ هستی‌، مبادا تو را در بین‌ راه‌ هلاك‌ سازم‌.»", "4": "<span>4 </span> &nbsp;و چون‌ قوم‌ این‌ سخنان‌ بد را شنیدند، ماتم‌ گرفتند، و هیچكس‌ زیور خود را برخود ننهاد.", "5": "<span>5 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «بنی‌اسرائیل‌ را بگو: شما قوم‌ گردن‌كش‌ هستید؛ اگر لحظه‌ای‌ در میان‌ تو آیم‌، همانا تو را هلاك‌ سازم‌. پس‌ اكنون‌ زیور خود را از خود بیرون‌ كن‌ تا بدانم‌ با تو چه‌ كنم‌.»", "6": "<span>6 </span> &nbsp;پس‌ بنی‌اسرائیل‌ زیورهای‌ خود را از جَبَل‌ حوریب‌ از خود بیرون‌ كردند.", "7": "<span>7 </span> &nbsp;و موسی‌ خیمۀ خود را برداشته‌، آن‌ را بیرون‌ لشكرگاه‌، دور از اردو زد، و آن‌ را «خیمۀ اجتماع‌» نامید. و واقع‌ شد كه‌ هر كه‌ طالب‌ یهوه‌ می‌بود، به‌ خیمۀ اجتماع‌ كه‌ خارج‌ لشكرگاه‌ بود، بیرون‌ می‌رفت‌.", "8": "<span>8 </span> &nbsp;و هنگامی‌ كه‌ موسی‌ به‌ سوی‌ خیمه‌ بیرون‌ می‌رفت‌، تمامی‌ قوم‌ برخاسته‌، هر یكی‌ به‌ در خیمۀ خود می‌ایستاد، و در عقب‌ موسی‌ می‌نگریست‌ تا داخل‌ خیمه‌ می‌شد.", "9": "<span>9 </span> &nbsp;و چون‌ موسی‌ به‌ خیمه‌ داخل‌ می‌شد، ستون‌ ابر نازل‌ شده‌، به‌ در خیمه‌ می‌ایستاد، و خدا با موسی‌ سخن‌ می‌گفت‌.", "10": "<span>10 </span> &nbsp;و چون‌ تمامی‌ قوم‌، ستون‌ ابر را بر در خیمه‌ ایستاده‌ می‌دیدند، همۀ قوم‌ برخاسته‌، هر كس‌ به‌ در خیمۀ خود سجده‌ می‌كرد.", "11": "<span>11 </span> &nbsp;و خداوند با موسی‌ روبرو سخن‌ می‌گفت‌، مثل‌ شخصی‌ كه‌ با دوست‌ خود سخن‌ گوید. پس‌ به‌ اردو برمی‌گشت‌. اما خادم او یوشع‌ بن‌ نونِ جوان‌، از میان‌ خیمه‌ بیرون‌ نمی‌آمد.", "12": "<span>12 </span> &nbsp;و موسی‌ به‌ خداوند گفت‌: «اینك‌ تو به‌ من‌ می‌گویی‌: این‌ قوم‌ را ببر. و تو مرا خبر می‌دهی‌ كه‌همراه‌ من‌ كه‌ را می‌فرستی‌. و تو گفته‌ای‌، تو را به‌ نام‌ می‌شناسم‌، و ایضاً در حضور من‌ فیض‌ یافته‌ای‌.", "13": "<span>13 </span> &nbsp;الا´ن‌ اگر فی‌الحقیقه‌ منظور نظر تو شده‌ام‌، طریق‌ خود را به‌ من‌ بیاموز تا تو را بشناسم‌، و در حضور تو فیض‌ یابم‌، و ملاحظه‌ بفرما كه‌ این‌ طایفه‌، قوم‌ تو می‌باشند.»", "14": "<span>14 </span> &nbsp;گفت‌: «روی‌ من‌ خواهد آمد و تو را آرامی‌ خواهم‌ بخشید.»", "15": "<span>15 </span> &nbsp;به‌ وی‌ عرض‌ كرد: «هر گاه‌ روی‌ تو نیاید، ما را از اینجا مبر.", "16": "<span>16 </span> &nbsp;زیرا به‌ چه‌ چیز معلوم‌ می‌شود كه‌ من‌ و قوم‌ تو منظور نظر تو شده‌ایم‌؟ آیا نه‌ از آمدن‌ تو با ما؟ پس‌ من‌ و قوم‌ تو از جمیع‌ قومهایی‌ كه‌ بر روی‌ زمینند، ممتاز خواهیم‌ شد.»", "17": "<span>17 </span> &nbsp;خداوند به‌ موسی‌ گفت‌: «این‌ كار را نیز كه‌ گفته‌ای‌ خواهم‌ كرد، زیرا كه‌ در نظر من‌ فیض‌ یافته‌ای‌ و تو را بنام‌ می‌شناسم‌.»", "18": "<span>18 </span> &nbsp;عرض‌ كرد: «مستدعی‌ آنكه‌ جلال‌ خود را به‌ من‌ بنمایی‌.»", "19": "<span>19 </span> &nbsp;گفت‌: «من تمامی‌ احسان‌ خود را پیش‌ روی‌ تو می‌گذرانم‌ و نام‌ یهوه‌ را پیش‌ روی‌ تو ندا می‌كنم‌، و رأفت‌ می‌كنم‌ بر هر كه‌ رئوف‌ هستم‌ و رحمت‌ خواهم‌ كرد بر هر كه‌ رحیم‌ هستم‌.»", "20": "<span>20 </span> &nbsp;و گفت‌: «روی‌ مرا نمی‌توانی‌ دید، زیرا انسان‌ نمی‌تواند مرا ببیند و زنده‌ بماند.»", "21": "<span>21 </span> &nbsp;و خداوند گفت‌: «اینك‌ مقامی‌ نزد من‌ است‌. پس‌ بر صخره‌ بایست‌.", "22": "<span>22 </span> &nbsp;و واقع‌ می‌شود كه‌ چون‌ جلال‌ من‌ می‌گذرد، تو را در شكاف‌ صخره‌ می‌گذارم‌، و تو را به‌ دست‌ خود خواهم‌ پوشانید تا عبور كنم‌.", "23": "<span>23 </span> &nbsp;پس‌ دست‌ خود را خواهم‌ برداشت‌ تا قفای‌ مرا ببینی‌، اما روی‌ من‌ دیده‌ نمی‌شود.»" }, "34": { "1": "<span>1 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «دو لوح‌سنگی‌ مثل‌ اولین‌ برای‌ خود بتراش‌، و سخنانی‌ را كه‌ بر لوح‌های‌ اول‌ بود و شكستی‌، بر این‌ لوح‌ها خواهم‌ نوشت‌.", "2": "<span>2 </span> &nbsp;و بامدادان‌ حاضر شو و صبحگاهان‌ به‌ كوه‌ سینا بالا بیا، و در آنجا نزد من‌ بر قله‌ كوه‌ بایست‌.", "3": "<span>3 </span> &nbsp;و هیچكس‌ با تو بالا نیاید، و هیچكس‌ نیز در تمامی‌ كوه‌ دیده‌ نشود، و گله‌ و رمه‌ نیز به‌ طرف‌ این‌ كوه‌ چرا نكند.»", "4": "<span>4 </span> &nbsp;پس‌ موسی‌ دو لوح‌ سنگی‌ مثل‌ اولین‌ تراشید و بامدادان‌ برخاسته‌، به‌ كوه‌ سینا بالا آمد، چنانكه‌ خداوند او را امر فرموده‌ بود، و دو لوح‌ سنگی‌ را به‌ دست‌ خود برداشت‌.", "5": "<span>5 </span> &nbsp;و خداوند در ابر نازل‌ شده‌، در آنجا با وی‌ بایستاد، و به‌ نام‌ خداوند ندا درداد.", "6": "<span>6 </span> &nbsp;و خداوند پیش‌ روی‌ وی‌ عبور كرده‌، ندا درداد كه‌ «یهوه‌، یهوه‌، خدای‌ رحیم‌ و رئوف‌ و دیرخشم‌ و كثیر احسان‌ و وفا؛", "7": "<span>7 </span> &nbsp;نگاه‌ دارندۀ رحمت‌ برای‌ هزاران‌، و آمرزندۀ خطا و عصیان‌ و گناه‌؛ لكن‌ گناه‌ را هرگز بی‌سزا نخواهد گذاشت‌، بلكه‌ خطایای‌ پدران‌ را بر پسران‌ و پسران‌ پسران‌ ایشان‌ تا پشت‌ سوم‌ و چهارم‌ خواهد گرفت‌.»", "8": "<span>8 </span> &nbsp;و موسی‌ به‌ زودی‌ رو به‌ زمین‌ نهاده‌، سجده‌ كرد.", "9": "<span>9 </span> &nbsp;و گفت‌: «ای‌ خداوند اگر فی‌الحقیقه‌ منظور نظر تو شده‌ام‌، مستدعی‌ آنكه‌ خداوند در میان‌ ما بیاید، زیرا كه‌ این‌ قوم‌ گردن‌كش‌ می‌باشند، پس‌ خطا و گناه‌ ما را بیامرز و ما را میراث‌ خود بساز.»", "10": "<span>10 </span> &nbsp;گفت‌: «اینك‌ عهدی‌ می‌بندم‌ و در نظر تمامی‌ قوم‌ تو كارهای‌ عجیب‌ می‌كنم‌، كه‌ درتمامی‌ جهان‌ و در جمیع‌ امتها كرده‌ نشده‌ باشد، و تمامی‌ این‌ قومی‌ كه‌ تو در میان‌ ایشان‌ هستی‌، كار خداوند را خواهند دید، زیراكه‌ این‌ كاری‌ كه‌ با تو خواهم‌ كرد، كاری‌ هولناك‌ است‌.", "11": "<span>11 </span> &nbsp;آنچه‌ را من‌ امروز به‌ تو امر می‌فرمایم‌، نگاه‌ دار. اینك‌ من‌ از پیش‌ روی‌ تو اموریان‌ و كنعانیان‌ و حتیان‌ و فرزیان‌ و حویان‌ و یبوسیان‌ را خواهم‌ راند.", "12": "<span>12 </span> &nbsp;با حذر باش‌ كه‌ با ساكنان‌ آن‌ زمین‌ كه‌ تو بدانجا می‌روی‌، عهد نبندی‌، مبادا در میان‌ شما دامی‌ باشد.", "13": "<span>13 </span> &nbsp;بلكه‌ مذبحهای‌ ایشان‌ را منهدم‌ سازید، و بتهای‌ ایشان‌ را بشكنید و اشیریم‌ ایشان‌ را قطع‌ نمایید.", "14": "<span>14 </span> &nbsp;زنهار خدای‌ غیر را عبادت‌ منما، زیرا یهوه‌ كه‌ نام‌ او غیور است‌، خدای‌ غیور است‌.", "15": "<span>15 </span> &nbsp;زنهار با ساكنان‌ آن‌ زمین‌ عهد مبند، والاّ از عقب‌ خدایان‌ ایشان‌ زنا می‌كنند، و نزد خدایان‌ ایشان‌ قربانی‌ می‌گذرانند، و تو را دعوت‌ می‌نمایند و از قربانی‌های‌ ایشان‌ می‌خوری‌.", "16": "<span>16 </span> &nbsp;و از دختران‌ ایشان‌ برای‌ پسران‌ خود می‌گیری‌، و چون‌ دختران‌ ایشان‌ از عقب‌ خدایان‌ خود زنا كنند، آنگاه‌ پسران‌ شما را در پیروی‌ خدایان‌ خود مرتكب‌ زنا خواهند نمود.", "17": "<span>17 </span> &nbsp;خدایان‌ ریخته‌ شده‌ برای‌ خویشتن‌ مساز.", "18": "<span>18 </span> &nbsp;عید فطیر را نگاه‌ دار، و هفت‌ روز نان‌ فطیر چنانكه‌ تو را امر فرمودم‌، در وقت‌ معین‌ در ماه‌ اَبیب‌ بخور، زیراكه‌ در ماه‌ ابیب‌ از مصر بیرون‌ آمدی‌.", "19": "<span>19 </span> &nbsp;هر كه‌ رحم‌ را گشاید، از آن‌ من‌ است‌ و هر نخست‌زادۀ ذكور از مواشی‌ تو، چه‌ از گاو چه‌ از گوسفند؛", "20": "<span>20 </span> &nbsp;و برای‌ نخست‌زادۀ الاغ‌، بره‌ای‌ فدیه‌ بده‌، و اگر فدیه‌ ندهی‌، گردنش‌ را بشكن‌. و هرنخست‌زاده‌ای‌ از پسرانت‌ را فدیه‌ بده‌. و هیچكس‌ به‌ حضور من‌ تهی‌ دست‌ حاضر نشود.", "21": "<span>21 </span> &nbsp;شش‌ روز مشغول‌ باش‌، و روز هفتمین‌، سَبَّت‌ را نگاه‌ دار. در وقت‌ شیار و در حصاد، سَبَّت‌ را نگاه‌ دار.", "22": "<span>22 </span> &nbsp;و عید هفته‌ها را نگاه‌دار، یعنی‌ عید نوبر حصاد گندم‌ و عید جمع‌ در تحویل‌ سال‌.", "23": "<span>23 </span> &nbsp;سالی‌ سه‌ مرتبه‌ همۀ ذكورانت‌ به‌ حضور خداوند یهوه‌، خدای‌ اسرائیل‌، حاضر شوند.", "24": "<span>24 </span> &nbsp;زیرا كه‌ امتها را از پیش‌ روی‌ تو خواهم‌ راند، و حدود تو را وسیع‌ خواهم‌ گردانید. و هنگامی‌ كه‌ در هر سال‌ سه‌ مرتبه‌ می‌آیی‌ تا به‌ حضور یهوه‌، خدای‌ خود حاضر شوی‌، هیچكس‌ زمین‌ تو را طمع‌ نخواهد كرد.", "25": "<span>25 </span> &nbsp;خون‌ قربانی‌ مرا با خمیرمایه‌ مگذران‌، و قربانی‌ عید فِصَح‌ تا صبح‌ نماند.", "26": "<span>26 </span> &nbsp;نخستین‌ نوبر زمین‌ خود را به‌ خانۀ یهوه‌، خدای‌ خود، بیاور. و بزغاله‌ را در شیر مادرش‌ مپز.»", "27": "<span>27 </span> &nbsp;و خداوند به‌ موسی‌ گفت‌: «این‌ سخنان‌ را تو بنویس‌، زیرا كه‌ به‌ حسب‌ این‌ سخنان‌، عهد با تو و با اسرائیل‌ بسته‌ام‌.»", "28": "<span>28 </span> &nbsp;و چهل‌ روز و چهل‌ شب‌ آنجا نزد خداوند بوده‌، نان‌ نخورد و آب‌ ننوشید و او سخنان‌ عهد، یعنی‌ ده‌ كلام‌ را بر لوحها نوشت‌.", "29": "<span>29 </span> &nbsp;و چون‌ موسی‌ از كوه‌ سینا بزیر می‌آمد، و دو لوح‌ سنگی‌ در دست‌ موسی‌ بود، هنگامی‌ كه‌ از كوه‌ بزیر می‌آمد، واقع‌ شد كه‌ موسی‌ ندانست‌ كه‌ به‌ سبب‌ گفتگوی‌ با او پوست‌ چهرۀ وی‌ می‌درخشید.", "30": "<span>30 </span> &nbsp;اما هارون‌ و جمیع‌ بنی‌اسرائیل‌ موسی‌ را دیدند كه‌ اینك‌ پوست‌ چهرۀ او می‌درخشد. پس‌ ترسیدند كه‌ نزدیك‌ او بیایند.", "31": "<span>31 </span> &nbsp;و موسی‌ ایشان‌ را خواند، و هارون‌ و همۀ سرداران‌ جماعت‌ نزد او برگشتند، و موسی‌ بدیشان‌ سخن‌ گفت‌.", "32": "<span>32 </span> &nbsp;و بعد از آن‌ همۀ بنی‌اسرائیل‌ نزدیك‌ آمدند، و آنچه‌ خداوند در كوه‌ سینا بدو گفته‌ بود، بدیشان‌ امر فرمود.", "33": "<span>33 </span> &nbsp;و چون‌ موسی‌ از سخن‌ گفتن‌ با ایشان‌ فارغ‌ شد، نقابی‌ بر روی‌ خود كشید.", "34": "<span>34 </span> &nbsp;و چون‌ موسی‌ به‌ حضور خداوند داخل‌ می‌شد كه‌ با وی‌ گفتگو كند، نقاب‌ را برمی‌داشت‌ تا بیرون‌ آمدن‌ او. پس‌ بیرون‌ آمده‌، آنچه‌ به‌ وی‌ امر شده‌ بود، به‌ بنی‌اسرائیل‌ می‌گفت‌.", "35": "<span>35 </span> &nbsp;و بنی‌اسرائیل‌ روی‌ موسی‌ را می‌دیدند كه‌ پوست‌ چهرۀ او می‌درخشد. پس‌ موسی‌ نقاب‌ را به‌ روی‌ خود باز می‌كشید، تا وقتی‌ كه‌ برای‌ گفتگوی‌ او می‌رفت‌." }, "35": { "1": "<span>1 </span> &nbsp;و موسی‌ تمام‌ جماعت‌ بنی‌اسرائیل را جمع‌ كرده‌، بدیشان‌ گفت‌: «این‌ است‌ سخنانی‌ كه‌ خداوند امر فرموده‌ است‌ كه‌ آنها را بكنی‌:", "2": "<span>2 </span> &nbsp;شش‌ روز كار كرده‌ شود، و در روز هفتمین‌، سَبَّتِ آرامی مقدس‌ خداوند برای‌ شماست‌؛ هر كه‌ در آن‌ كاری‌ كند، كشته‌ شود.", "3": "<span>3 </span> &nbsp;در روز سَبَّت‌ آتش‌ در همۀ مسكنهای‌ خود میفروزید.»", "4": "<span>4 </span> &nbsp;و موسی‌ تمامی‌ جماعت‌ بنی‌اسرائیل‌ را خطاب‌ كرده‌، گفت‌: «این‌ است‌ امری‌ كه‌ خداوندفرموده‌، و گفته‌ است‌:", "5": "<span>5 </span> &nbsp;از خودتان‌ هدیه‌ای‌ برای‌ خداوند بگیرید. هر كه‌ از دل‌ راغب‌ است‌، هدیۀ خداوند را از طلا و نقره‌ و برنج‌ بیاورد،", "6": "<span>6 </span> &nbsp;و از لاجورد و ارغوان‌ و قرمز و كتان‌ نازك‌ و پشم‌ بز،", "7": "<span>7 </span> &nbsp;و پوست‌ قوچ‌ سرخ‌شده‌ و پوست‌ خز و چوب‌ شطیم‌،", "8": "<span>8 </span> &nbsp;و روغن‌ برای‌ روشنایی‌، و عطریات‌ برای‌ روغن‌ مسح‌ و برای‌ بخور معطر،", "9": "<span>9 </span> &nbsp;و سنگهای‌ جزع‌ و سنگهای‌ ترصیع‌ برای‌ ایفود و سینه‌بند.»", "10": "<span>10 </span> &nbsp;و همۀ دانادلان‌ از شما بیایند و آنچه‌ را خداوند امر فرموده‌ است‌، بسازند.", "11": "<span>11 </span> &nbsp;مسكن‌ و خیمه‌اش‌ و پوشش‌ آن‌ و تكمه‌هایش‌ و تخته‌هایش‌ و پشت‌بندهایش‌ و ستونهایش‌ و پایه‌هایش‌،", "12": "<span>12 </span> &nbsp;و تابوت‌ و عصاهایش‌ و كرسی‌ رحمت‌ و حجاب‌ ستر،", "13": "<span>13 </span> &nbsp;و خوان‌ و عصاهایش‌ و كل‌ اسبابش‌ و نانِ تَقْدِمِه‌،", "14": "<span>14 </span> &nbsp;و چراغدان‌ برای‌ روشنایی‌ و اسبابش‌ و چراغهایش‌ و روغن‌ برای‌ روشنایی‌،", "15": "<span>15 </span> &nbsp;و مذبح‌ بخور و عصاهایش‌ و روغن‌ مسح‌ و بخور معطر، و پردۀ دروازه‌ برای‌ درگاه‌ مسكن‌،", "16": "<span>16 </span> &nbsp;و مذبح‌ قربانی‌ سوختنی‌ و شبكۀ برنجین‌ آن‌، و عصاهایش‌ و كل‌ اسبابش‌ و حوض‌ و پایه‌اش‌،", "17": "<span>17 </span> &nbsp;و پرده‌های‌ صحن‌ و ستونهایش‌ و پایه‌های‌ آنها و پردۀ دروازۀ صحن‌،", "18": "<span>18 </span> &nbsp;و میخهای‌ مسكن‌ و میخهای‌ صحن‌ و طنابهای‌ آنها،", "19": "<span>19 </span> &nbsp;و رختهای‌ بافته‌ شده‌ برای‌ خدمت‌ قدس‌، یعنی‌ رخت‌ مقدس‌ هارون‌ كاهن‌، و رختهای‌ پسرانش‌ را تا كهانت‌ نمایند.»", "20": "<span>20 </span> &nbsp;پس‌ تمامی‌ جماعت‌ بنی‌اسرائیل‌ از حضور موسی‌ بیرون‌ شدند.", "21": "<span>21 </span> &nbsp;و هر كه‌ دلش‌ او را ترغیب‌ كرد، و هر كه‌ روحش‌ او را با اراده‌ گردانید، آمدند و هدیۀ خداوند را برای‌ كار خیمۀ اجتماع‌، و برای‌ تمام‌ خدمتش‌ و برای‌ رختهای‌ مقدس‌ آوردند.", "22": "<span>22 </span> &nbsp;مردان‌ و زنان‌ آمدند، هر كه‌ از دل‌ راغب‌ بود، وحلقه‌های‌ بینی‌ و گوشواره‌ها و انگشتریها و گردن‌بندها و هر قسم‌ آلات‌ طلا آوردند، و هر كه‌ هدیۀ طلا برای‌ خداوند گذرانیده‌ بود.", "23": "<span>23 </span> &nbsp;و هر كسی‌ كه‌ لاجورد و ارغوان‌ و قرمز و كتان‌ نازك‌ و پشم‌ بز و پوست‌ قوچ‌ سرخ‌شده‌ و پوست‌ خز نزد او یافت‌ شد، آنها را آورد.", "24": "<span>24 </span> &nbsp;هر كه‌ خواست‌ هدیۀ نقره‌ و برنج‌ بیاورد، هدیۀ خداوند را آورد، و هر كه‌ چوب‌ شطیم‌ برای‌ هر كار خدمت‌ نزد او یافت‌ شد، آن‌ را آورد.", "25": "<span>25 </span> &nbsp;و همۀ زنان‌ دانادل‌ به‌ دستهای‌ خود می‌رشتند، و رشته‌ شده‌ را از لاجورد و ارغوان‌ و قرمز و كتان‌ نازك‌، آوردند.", "26": "<span>26 </span> &nbsp;و همۀ زنانی‌ كه‌ دل‌ ایشان‌ به‌ حكمت‌ مایل‌ بود، پشم‌ بز را می‌رشتند.", "27": "<span>27 </span> &nbsp;و سروران‌، سنگهای‌ جزع‌ و سنگهای‌ ترصیع‌ برای‌ ایفود و سینه‌بند آوردند.", "28": "<span>28 </span> &nbsp;و عطریات‌ و روغن‌ برای‌ روشنایی‌ و برای‌ روغن‌ مسح‌ و برای‌ بخور معطر.", "29": "<span>29 </span> &nbsp;و همۀ مردان‌ و زنان‌ بنی‌اسرائیل‌ كه‌ دل‌ ایشان‌، ایشان‌ را راغب‌ ساخت‌ كه‌ چیزی‌ برای‌ هر كاری‌ كه‌ خداوند امر فرموده‌ بود كه‌ به‌ وسیلۀ موسی‌ ساخته‌ شود، برای‌ خداوند به‌ ارادۀ دل‌ آوردند.", "30": "<span>30 </span> &nbsp;و موسی‌ بنی‌اسرائیل‌ را گفت‌: «آگاه‌ باشید كه‌ خداوند بَصَلئیل‌ بن‌ اوری‌ بن‌ حور را از سبط‌ یهودا به‌ نام‌ دعوت‌ كرده‌ است‌،", "31": "<span>31 </span> &nbsp;و او را به‌ روح‌ خدا از حكمت‌ و فطانت‌ و علم‌ و هر هنری‌ پر ساخته‌،", "32": "<span>32 </span> &nbsp;و برای‌ اختراع‌ مخترعات‌ و برای‌ كار كردن‌ در طلا و نقره‌ و برنج‌،", "33": "<span>33 </span> &nbsp;و برای‌ تراشیدن‌ و مرصع‌ ساختن‌ سنگها، و برای‌ درودگری‌ چوب‌ تا هر صنعت‌ هنری‌ را بكند.", "34": "<span>34 </span> &nbsp;و در دل‌ او تعلیم‌ دادن‌ را القا نمود، و همچنین‌ اُهُولیاب‌ بن‌ اخیسامك‌ را از سبط‌ دان‌،", "35": "<span>35 </span> &nbsp;و ایشان‌ را به‌ حكمت‌ دلی‌ پر ساخت‌، برای‌ هر عمل‌ نقاش‌ و نساج‌ ماهر و طراز در لاجورد و ارغوان‌ و قرمز وكتان‌ نازك‌، و در هر كار نساج‌ تا صانع‌ هر صنعتی‌ و مخترع‌ مخترعات‌ بشوند." }, "36": { "1": "<span>1 </span> &nbsp;« و بصلئیل‌ و اهولیاب‌ و همۀ دانادلانی كه‌ خداوند حكمت‌ و فطانت‌ بدیشان‌ داده‌ است‌، تا برای‌ كردن‌ هر صنعتِ خدمتِ قدس‌، ماهر باشند، موافق‌ آنچه‌ خداوند امر فرموده‌ است‌، كار بكنند.»", "2": "<span>2 </span> &nbsp;پس‌ موسی‌، بصلئیل‌ و اهولیاب‌ و همۀ دانادلانی‌ را كه‌ خداوند در دل‌ ایشان‌ حكمت‌ داده‌ بود، و آنانی‌ را كه‌ دل‌ ایشان‌، ایشان‌ را راغب‌ ساخته‌ بود كه‌ برای‌ كردن‌ كار نزدیك‌ بیایند، دعوت‌ كرد.", "3": "<span>3 </span> &nbsp;و همۀ هدایایی‌ را كه‌ بنی‌اسرائیل‌ برای‌ بجا آوردن‌ كار خدمت‌ قدس‌ آورده‌ بودند، از حضور موسی‌ برداشتند، و هر بامداد هدایای‌ تبرعی‌ دیگر نزد وی‌ می‌آوردند.", "4": "<span>4 </span> &nbsp;و همۀ دانایانی‌ كه‌ هر گونه‌ كار قدس‌ را می‌ساختند، هر یك‌ از كار خود كه‌ در آن‌ مشغول‌ می‌بود، آمدند.", "5": "<span>5 </span> &nbsp;و موسی‌ را عرض‌ كرده‌، گفتند: «قوم‌ زیاده‌ از آنچه‌ لازم‌ است‌ برای‌ عمل‌ آن‌ كاری‌ كه‌ خداوند فرموده‌است‌ كه‌ ساخته‌ شود، می‌آورند.»", "6": "<span>6 </span> &nbsp;و موسی‌ فرمود تا در اردو ندا كرده‌، گویند كه‌ «مردان‌ و زنان‌ هیچ‌ كاری‌ دیگر برای‌ هدایای‌ قدس‌ نكنند.» پس‌ قوم‌ از آوردن‌ باز داشته‌ شدند.", "7": "<span>7 </span> &nbsp;و اسباب‌ برای‌ انجام‌ تمام‌ كار، كافی‌، بلكه‌ زیاده‌ بود.", "8": "<span>8 </span> &nbsp;پس‌ همۀ دانادلانی‌ كه‌ در كار اشتغال‌ داشتند، ده‌ پردۀ مسكن‌ را ساختند، از كتان‌ نازك‌ تابیده‌ شده‌ و لاجورد و ارغوان‌ و قرمز، و آنها را با كروبیان‌ از صنعت‌ نساج‌ ماهر ترتیب‌ دادند.", "9": "<span>9 </span> &nbsp;طول‌ هر پرده‌ بیست‌ و هشت‌ ذراع‌، و عرض‌ هر پرده‌ چهار ذراع‌. همۀ پرده‌ها را یك‌ اندازه‌ بود.", "10": "<span>10 </span> &nbsp;وپنج‌ پرده‌ را با یكدیگر بپیوست‌، و پنج‌ پرده‌ را با یكدیگر بپیوست‌،", "11": "<span>11 </span> &nbsp;و بر لب‌ یك‌ پرده‌ در كنار پیوستگی‌اش‌ مادگیهای‌ لاجورد ساخت‌، و همچنین‌ در لب‌ پردۀ بیرونی‌ در پیوستگی‌ دوم‌ ساخت‌.", "12": "<span>12 </span> &nbsp;و در یك‌ پرده‌، پنجاه‌ مادگی‌ ساخت‌، و در كنار پرده‌ای‌ كه‌ در پیوستگی‌ دومین‌ بود، پنجاه‌ مادگی‌ ساخت‌. و مادگیها مقابل‌ یكدیگر بود.", "13": "<span>13 </span> &nbsp;و پنجاه‌ تكمۀ زرین‌ ساخت‌، و پرده‌ها را به‌ تكمه‌ها با یكدیگر بپیوست‌، تا مسكن‌ یك‌ باشد.", "14": "<span>14 </span> &nbsp;و پرده‌ها از پشم‌ بز ساخت‌ بجهت‌ خیمه‌ای‌ كه‌ بالای‌ مسكن‌ بود؛ آنها را پانزده‌ پرده‌ ساخت‌.", "15": "<span>15 </span> &nbsp;طول‌ هر پرده‌ سی‌ ذراع‌، و عرض‌ هر پرده‌ چهار ذراع‌؛ و یازده‌ پرده‌ را یك‌ اندازه‌ بود.", "16": "<span>16 </span> &nbsp;و پنج‌ پرده‌ را جدا پیوست‌، و شش‌ پرده‌ را جدا.", "17": "<span>17 </span> &nbsp;و پنجاه‌ مادگی‌ بر كنار پرده‌ای‌ كه‌ در پیوستگی‌ بیرونی‌ بود ساخت‌، و پنجاه‌ مادگی‌ در كنار پرده‌ در پیوستگی‌ دوم‌.", "18": "<span>18 </span> &nbsp;و پنجاه‌ تكمۀ برنجین‌ برای‌ پیوستن‌ خیمه‌ بساخت‌ تا یك‌ باشد.", "19": "<span>19 </span> &nbsp;و پوششی‌ از پوست‌ قوچ‌ سرخ‌شده‌ برای‌ خیمه‌ ساخت‌، و پوششی‌ بر زبر آن‌ از پوست‌ خز.", "20": "<span>20 </span> &nbsp;و تخته‌های‌ قایم‌ از چوب‌ شطیم‌ برای‌ مسكن‌ ساخت‌.", "21": "<span>21 </span> &nbsp;طول‌ هر تخته‌ ده‌ ذراع‌، و عرض‌ هر تخته‌ یك‌ ذراع‌ و نیم‌.", "22": "<span>22 </span> &nbsp;هر تخته‌ را دو زبانه‌ بود مقرون‌ یكدیگر، و بدین‌ تركیب‌ همۀ تخته‌های‌ مسكن‌ را ساخت‌.", "23": "<span>23 </span> &nbsp;و تخته‌های‌ مسكن‌ را ساخت‌، بیست‌ تخته‌ به‌ جانب‌ جنوب‌ به‌ طرف‌ یمانی‌،", "24": "<span>24 </span> &nbsp;و چهل‌ پایۀ نقره‌ زیر بیست‌ تخته‌ ساخت‌، یعنی‌ دو پایه‌ زیر تخته‌ای‌ برای‌ دو زبانه‌اش‌، و دو پایه‌ زیر تختۀ دیگر برای‌ دو زبانه‌اش‌.", "25": "<span>25 </span> &nbsp;و برای‌ جانب‌ دیگر مسكن‌ به‌ طرف‌ شمال‌، بیست‌ تخته‌ ساخت‌.", "26": "<span>26 </span> &nbsp;و چهل‌ پایۀ نقرۀ آنها را یعنی‌ دو پایه‌ زیر یك‌ تخته‌ای‌ و دو پایه‌ زیرتختۀ دیگر.", "27": "<span>27 </span> &nbsp;و برای‌ مؤخر مسكن‌ به‌ طرف‌ مغرب‌، شش‌ تخته‌ ساخت‌.", "28": "<span>28 </span> &nbsp;و دو تخته‌ برای‌ گوشه‌های‌ مسكن‌ در هر دو جانبش‌ ساخت‌.", "29": "<span>29 </span> &nbsp;و از زیر با یكدیگر پیوسته‌ شد، و تا سر آن‌ با هم‌ در یك‌ حلقه‌ تمام‌ شد. و همچنین‌ برای‌ هر دو در هر دو گوشه‌ كرد.", "30": "<span>30 </span> &nbsp;پس‌ هشت‌ تخته‌ بود، و پایه‌های‌ آنها از نقره‌ شانزده‌ پایه‌، یعنی‌ دو پایه‌ زیر هر تخته‌.", "31": "<span>31 </span> &nbsp;و پشت‌بندها از چوب‌ شطیم‌ ساخت‌، یعنی‌ پنج‌ برای‌ تخته‌های‌ یك‌ جانب‌ مسكن‌،", "32": "<span>32 </span> &nbsp;و پنج‌ پشت‌بند برای‌ تخته‌های‌ جانب‌ دیگر مسكن‌، و پنج‌ پشت‌بند برای‌ تخته‌های‌ مؤخر جانب‌ غربی‌ مسكن‌.", "33": "<span>33 </span> &nbsp;و پشت‌بند وسطی‌ را ساخت‌ تا در میان‌ تخته‌ها از سر تا سر بگذرد.", "34": "<span>34 </span> &nbsp;تخته‌ها را به‌ طلا پوشانید، و حلقه‌های‌ آنها را از طلا ساخت‌ تا برای‌ پشت‌بندها، خانه‌ها باشد، و پشت‌بندها را به‌ طلا پوشانید.", "35": "<span>35 </span> &nbsp;و حجاب‌ را از لاجورد و ارغوان‌ و قرمز و كتان‌ نازك‌ تابیده‌ شده‌ ساخت‌، و آن‌ را با كروبیان‌ از صنعت‌ نساج‌ ماهر ترتیب‌ داد.", "36": "<span>36 </span> &nbsp;و چهار ستون‌ از چوب‌ شطیم‌ برایش‌ ساخت‌، و آنها را به‌ طلا پوشانید و قلابهای‌ آنها از طلا بود، و برای‌ آنها چهار پایۀ نقره‌ ریخت‌.", "37": "<span>37 </span> &nbsp;و پرده‌ای‌ برای‌ دروازۀ خیمه‌ از لاجورد و ارغوان‌ و قرمز و كتان‌ نازك‌ تابیده‌ شده‌ از صنعت‌ طراز بساخت‌.", "38": "<span>38 </span> &nbsp;و پنج‌ ستون‌ آن‌ و قلابهای‌ آنها را ساخت‌ و سرها و عصاهای‌ آنها را به‌ طلا پوشانید و پنج‌ پایۀ آنها از برنج‌ بود." }, "37": { "1": "<span>1 </span> &nbsp;و بَصلئِیل‌، تابوت‌ را از چوب‌ شطیم‌ساخت‌، طولش‌ دو ذراع‌ و نیم‌، و عرضش‌ یك‌ ذراع‌ و نیم‌، و بلندیش‌ یك‌ ذراع‌ ونیم‌.", "2": "<span>2 </span> &nbsp;و آن‌ را به‌ طلای‌ خالص‌ از درون‌ و بیرون‌ پوشانید. و برای‌ آن‌ تاجی‌ از طلا بر طرفش‌ ساخت.", "3": "<span>3 </span> &nbsp;و چهار حلقۀ زرین‌ برای‌ چهار قایمه‌اش‌ بریخت‌، یعنی‌ دو حلقه‌ بر یك‌ طرفش‌ و دو حلقه‌ بر طرف‌ دیگر.", "4": "<span>4 </span> &nbsp;و دو عصا از چوب‌ شطیم‌ ساخته‌، آنها را به‌ طلا پوشانید.", "5": "<span>5 </span> &nbsp;و عصاها را در حلقه‌ها بر دو جانب‌ تابوت‌ گذرانید، برای‌ برداشتن‌ تابوت‌.", "6": "<span>6 </span> &nbsp;و كرسی‌ رحمت‌ را از طلای‌ خالص‌ ساخت‌. طولش‌ دو ذراع‌ و نیم‌، و عرضش‌ یك‌ ذراع‌ و نیم‌.", "7": "<span>7 </span> &nbsp;و دو كروبی‌ از طلا ساخت‌. و آنها را بر هر دو طرف‌ كرسی‌ رحمت‌ از چرخكاری‌ ساخت‌.", "8": "<span>8 </span> &nbsp;یك‌ كروبی‌ بر این‌ طرف‌ و كروبی‌ دیگر بر آن‌ طرف‌، و از كرسی‌ رحمت‌، كروبیان‌ را بر هر دو طرفش‌ ساخت‌.", "9": "<span>9 </span> &nbsp;و كروبیان‌ بالهای‌ خود را بر زبر آن‌ پهن‌ می‌كردند، و به‌ بالهای‌ خویش‌ كرسی‌ رحمت‌ را می‌پوشانیدند، و رویهای‌ ایشان‌ به‌ سوی‌ یكدیگر می‌بود، یعنی‌ رویهای‌ كروبیان‌ به‌ جانب‌ كرسی‌ رحمت‌ می‌بود.", "10": "<span>10 </span> &nbsp;و خوان‌ را از چوب‌ شطیم‌ ساخت‌. طولش‌ دو ذراع‌، و عرضش‌ یك‌ ذراع‌، و بلندیش‌ یك‌ ذراع‌ و نیم‌.", "11": "<span>11 </span> &nbsp;و آن‌ را به‌ طلای‌ خالص‌ پوشانید، و تاجی‌ زرین‌ گرداگردش‌ ساخت‌.", "12": "<span>12 </span> &nbsp;و حاشیه‌ای‌ به‌ مقدار چهار انگشت‌ گرداگردش‌ ساخت‌، و تاجی‌ زرین‌ گرداگرد حاشیه‌ ساخت‌.", "13": "<span>13 </span> &nbsp;و چهار حلقۀ زرین‌ برایش‌ ریخت‌، و حلقه‌ها را بر چهار گوشه‌ای‌ كه‌ بر چهار قایمه‌اش‌ بود گذاشت‌.", "14": "<span>14 </span> &nbsp;و حلقه‌ها مقابل‌ حاشیه‌ بود، تا خانه‌های‌ عصاها باشد، برای‌ برداشتن‌ خوان‌.", "15": "<span>15 </span> &nbsp;و دو عصا را از چوب‌ شطیم‌ ساخته‌، آنها را به‌ طلا پوشانید، برای‌ برداشتن‌ خوان‌.", "16": "<span>16 </span> &nbsp;و ظروفی‌ را كه‌ بر خوان‌ می‌بوداز صحنها و كاسه‌ها و پیاله‌ها و جامهایش‌ كه‌ بدانها هدایای‌ ریختنی‌ می‌ریختند، از طلای‌ خالص‌ ساخت‌.", "17": "<span>17 </span> &nbsp;و چراغدان‌ را از طلای‌ خالص‌ ساخت‌. از چرخكاری‌، چراغدان‌ را ساخت‌، و پایه‌اش‌ و شاخه‌هایش‌ و پیاله‌هایش‌ و سیبهایش‌ و گلهایش‌ از همین‌ بود.", "18": "<span>18 </span> &nbsp;و از دو طرفش‌ شش‌ شاخه‌ بیرون‌ آمد، یعنی‌ سه‌ شاخۀ چراغدان‌ از یك‌ طرف‌، و سه‌ شاخۀ چراغدان‌ از طرف‌ دیگر.", "19": "<span>19 </span> &nbsp;و سه‌ پیالۀ بادامی‌ با سیبی‌ و گلی‌ در یك‌ شاخه‌، و سه‌ پیالۀ بادامی‌ و سیبی‌ و گلی‌ بر شاخۀ دیگر، و همچنین‌ برای‌ شش‌ شاخه‌ای‌ كه‌ از چراغدان‌ بیرون‌ می‌آمد.", "20": "<span>20 </span> &nbsp;و بر چراغدان‌ چهار پیالۀ بادامی‌ با سیبها و گلهای‌ آن‌.", "21": "<span>21 </span> &nbsp;و سیبی‌ زیر دو شاخۀ آن‌، و سیبی‌ زیر دو شاخۀ آن‌، و سیبی‌ زیر دو شاخۀ آن‌، برای‌ شش‌ شاخه‌ای‌ كه‌ از آن‌ بیرون‌ می‌آمد.", "22": "<span>22 </span> &nbsp;سیبهای‌ آنها و شاخه‌های‌ آنها از همین‌ بود، یعنی‌ همه‌ از یك‌ چرخكاری‌ طلای‌ خالص‌.", "23": "<span>23 </span> &nbsp;و هفت‌ چراغش‌ و گلگیرهایش‌ و سینیهایش‌ را از طلای‌ خالص‌ ساخت‌.", "24": "<span>24 </span> &nbsp;از یك‌ وزنه‌ طلای‌ خالص‌ آن‌ را با همۀ اسبابش‌ ساخت‌.", "25": "<span>25 </span> &nbsp;و مذبح‌ بخور را از چوب‌ شطیم‌ ساخت‌، طولش‌ یك‌ ذراع‌، و عرضش‌ یك‌ ذراع‌ مربع‌، و بلندیش‌ دو ذراع‌، و شاخهایش‌ از همان‌ بود.", "26": "<span>26 </span> &nbsp;و آن‌ را به‌ طلای‌ خالص‌ پوشانید، یعنی‌ سطحش‌ و طرفهای‌ گرداگردش‌، و شاخهایش‌، و تاجی‌ گرداگردش‌ از طلای‌ خالص‌ ساخت‌.", "27": "<span>27 </span> &nbsp;و دو حلقۀ زرین‌ برایش‌ زیر تاج‌ بر دو گوشه‌اش‌ بر دوطرفش‌ ساخت‌، تا خانه‌های‌ عصاها باشد برای‌ برداشتنش‌ به‌ آنها.", "28": "<span>28 </span> &nbsp;و عصاها را از چوب‌ شطیم‌ ساخته‌، آنها را به‌ طلا پوشانید.", "29": "<span>29 </span> &nbsp;و روغن‌ مسح‌ مقدس‌ و بخور معطر طاهر را از صنعت‌ عطار ساخت‌." }, "38": { "1": "<span>1 </span> &nbsp;و مذبح‌ قربانی‌ سوختنی‌ را از چوب شطیم‌ ساخت‌. طولش‌ پنج‌ ذراع‌، و عرضش‌ پنج‌ ذراع‌ مربع‌، و بلندیش‌ سه‌ ذراع‌.", "2": "<span>2 </span> &nbsp;و شاخهایش‌ را بر چهار گوشه‌اش‌ ساخت‌. شاخهایش‌ از همان‌ بود و آن‌ را از برنج‌ پوشانید.", "3": "<span>3 </span> &nbsp;و همۀ اسباب‌ مذبح‌ را ساخت‌، یعنی‌: دیگها و خاك‌اندازها و كاسه‌ها و چنگالها و مِجْمَرها و همۀ ظروفش‌ را از برنج‌ ساخت‌.", "4": "<span>4 </span> &nbsp;و برای‌ مذبح‌، آتش‌دانی‌ مشبك‌ از برنج‌ ساخت‌، كه‌ زیر حاشیه‌اش‌ بطرف‌ پایین‌ تا نصفش‌ برسد.", "5": "<span>5 </span> &nbsp;و چهار حلقه‌ برای‌ چهار سر آتش‌دان‌ برنجین‌ ریخت‌، تا خانه‌های‌ عصاها باشد.", "6": "<span>6 </span> &nbsp;و عصاها را از چوب‌ شطیم‌ ساخته‌، آنها را به‌ برنج‌ بپوشانید.", "7": "<span>7 </span> &nbsp;و عصاها را در حلقه‌ها بر دو طرف‌ مذبح‌ گذرانید، برای‌ برداشتنش‌ به‌ آنها، و مذبح‌ را از چوبها مجوف‌ ساخت‌.", "8": "<span>8 </span> &nbsp;و حوض‌ را از برنج‌ ساخت‌، و پایه‌اش‌ را از برنج‌ از آینه‌های‌ زنانی‌ كه‌ نزد دروازۀ خیمۀ اجتماع‌ برای‌ خدمت‌ جمع‌ می‌شدند.", "9": "<span>9 </span> &nbsp;و صحن‌ را ساخت‌ كه‌ برای‌ طرف‌ جنوبی‌ به‌ سمت‌ یمانی‌، پرده‌های‌ صحن‌ از كتان‌ نازك‌ تابیده‌ شده‌ صد ذراعی‌ بود.", "10": "<span>10 </span> &nbsp;ستونهای‌ آنها بیست‌ بود، و پایه‌های‌ آنها بیست‌ بود، از برنج‌ و قلابهای‌ آنها و پشت‌بندهای‌ آنها از نقره‌.", "11": "<span>11 </span> &nbsp;و برای‌ طرف‌شمالی‌ صد ذراعی‌ بود، و ستونهای‌ آنها بیست‌ از برنج‌، و قلابهای‌ ستونها و پشت‌بندهای‌ آنها از نقره‌ بود.", "12": "<span>12 </span> &nbsp;و برای‌ طرف‌ غربی‌، پرده‌های‌ پنجاه‌ ذراعی‌ بود، و ستونهای‌ آنها ده‌ و پایه‌های‌ آنها ده‌، و قلابها و پشت‌ بندهای‌ ستونها از نقره‌ بود.", "13": "<span>13 </span> &nbsp;و برای‌ طرف‌ شرقی‌ به‌ سمت‌ طلوع‌، پنجاه‌ ذراعی‌ بود.", "14": "<span>14 </span> &nbsp;و پرده‌های‌ یك‌ طرف‌ دروازه‌ پانزده‌ ذراعی‌ بود، ستونهای‌ آنها سه‌ و پایه‌های‌ آنها سه‌.", "15": "<span>15 </span> &nbsp;و برای‌ طرف‌ دیگر دروازۀ صحن‌ از این‌ طرف‌ و از آن‌ طرف‌ پرده‌ها پانزده‌ ذراعی‌ بود، ستونهای‌ آنها سه‌ و پایه‌های‌ آنها سه‌.", "16": "<span>16 </span> &nbsp;همۀ پرده‌های‌ صحن‌ به‌ هر طرف‌ از كتان‌ نازك‌ تابیده‌ شده‌ بود.", "17": "<span>17 </span> &nbsp;و پایه‌های‌ ستونها از برنج‌ بود، و قلابها و پشت‌بندهای‌ ستونها از نقره‌، و پوشش‌ سرهای‌ آنها از نقره‌، و جمیع‌ ستونهای‌ صحن‌ به‌ پشت‌بندهای‌ نقره‌ پیوسته‌ شده‌ بود.", "18": "<span>18 </span> &nbsp;و پردۀ دروازۀ صحن‌ از صنعت‌ طراز از لاجورد و ارغوان‌ و قرمز و كتان‌ نازك‌ تابیده‌ شده‌ بود. طولش‌ بیست‌ ذراع‌، و بلندیش‌ به‌ عرض‌ پنج‌ ذراع‌ موافق‌ پرده‌های‌ صحن‌.", "19": "<span>19 </span> &nbsp;و ستونهای‌ آنها چهار، و پایه‌های‌ برنجین‌ آنها چهار، و قلابهای‌ آنها از نقره‌، و پوشش‌ سرهای‌ آنها و پشت‌بندهای‌ آنها از نقره‌ بود.", "20": "<span>20 </span> &nbsp;و همۀ میخهای‌ مسكن‌ و صحن‌، به‌ هر طرف‌ از برنج‌ بود.", "21": "<span>21 </span> &nbsp;این‌ است‌ حساب‌ مسكن‌، یعنی‌ مسكن‌ شهادت‌، چنانكه‌ حسب‌ فرمان‌ موسی‌ به‌ خدمت‌ لاویان‌، به‌ توسط‌ ایتاماربن‌ هارون‌ كاهن‌ حساب‌ آن‌ گرفته‌ شد.", "22": "<span>22 </span> &nbsp;و بصلئیل‌ بن‌ اوری‌ بن‌ حور از سبط‌یهودا، آنچه‌ را كه‌ خداوند به‌ موسی‌ امر فرموده‌ بود بساخت‌.", "23": "<span>23 </span> &nbsp;و با وی‌ اُهُولِیاب‌ بن‌ اخیسامك‌ از سبط‌ دان‌ بود، نقاش‌ و مخترع‌ و طراز در لاجورد و ارغوان‌ و قرمز و كتان‌ نازك‌.", "24": "<span>24 </span> &nbsp;و تمام‌ طلایی‌ كه‌ در كار صرف‌ شد، یعنی‌ در همه‌ كار قدس‌، از طلای‌ هدایا بیست‌ و نه‌ وزنه‌ و هفتصد و سی‌ مثقال‌ موافق‌ مثقال‌ قدس‌ بود.", "25": "<span>25 </span> &nbsp;و نقرۀ شمرده‌ شدگان‌ جماعت‌ صد وزنه‌ و هزار و هفتصد و هفتاد و پنج‌ مثقال‌ بود، موافق‌ مثقال‌ قدس‌.", "26": "<span>26 </span> &nbsp;یك‌ درهم‌ یعنی‌ نیم‌ مثقال‌ موافق‌ مثقال‌ قدس‌، برای‌ هر نفری‌ از آنانی‌ كه‌ به‌ سوی‌ شمرده‌شدگان‌ گذشتند، از بیست‌ ساله‌ و بالاتر، كه‌ ششصد و سه‌ هزار و پانصد و پنجاه‌ نفر بودند.", "27": "<span>27 </span> &nbsp;و اما آن‌ صد وزنۀ نقره‌ برای‌ ریختن‌ پایه‌های‌ قدس‌ و پایه‌های‌ پرده‌ بود. صد پایه‌ از صد وزنه‌ یعنی‌ یك‌ وزنه‌ برای‌ یك‌ پایه‌.", "28": "<span>28 </span> &nbsp;و از آن‌ هزار و هفتصد و هفتاد و پنج‌ مثقال‌ قلابها برای‌ ستونها ساخت‌، و سرهای‌ آنها را پوشانید، و پشت‌بندها برای‌ آنها ساخت‌.", "29": "<span>29 </span> &nbsp;و برنج‌ هدایا هفتاد وزنه‌ و دو هزار و چهارصد مثقال‌ بود.", "30": "<span>30 </span> &nbsp;و از آن‌ پایه‌های‌ دروازۀ خیمۀ اجتماع‌، و مذبح‌ برنجین‌، و شبكۀ برنجین‌ آن‌ و همۀ اسباب‌ مذبح‌ را ساخت‌.", "31": "<span>31 </span> &nbsp;و پایه‌های‌ صحن‌ را به‌ هر طرف‌، و پایه‌های‌ دروازۀ صحن‌ و همۀ میخهای‌ مسكن‌ و همۀ میخهای‌ گرداگرد صحن‌ را." }, "39": { "1": "<span>1 </span> &nbsp;و از لاجورد و ارغوان‌ و قرمز رختهای‌بافته‌ شده‌ ساختند، برای‌ خدمت‌ كردن‌ در قدس‌، و رختهای‌ مقدس‌ برای‌ هارون‌ ساختند، چنانكه‌ خداوند به‌ موسی‌ امر نموده‌ بود.", "2": "<span>2 </span> &nbsp;و ایفود را از طلا و لاجورد و ارغوان‌ و قرمز و كتان‌ نازك‌ تابیده‌ شده‌، ساخت‌.", "3": "<span>3 </span> &nbsp;و تنگه‌های‌ نازك‌ از طلا ساختند و تارها كشیدند تا آنها را در میان‌ لاجورد و ارغوان‌ و قرمز و كتان‌ نازك‌ به‌ صنعت‌ نساج‌ ماهر ببافند.", "4": "<span>4 </span> &nbsp;و كتفهای‌ پیوسته‌ شده‌ برایش‌ ساختند، كه‌ بر دو كنار پیوسته‌ شد.", "5": "<span>5 </span> &nbsp;و زنار بسته‌ شده‌ای‌ كه‌ بر آن‌ بود از همان‌ پارچه‌ و از همان‌ صنعت‌ بود، از طلا و لاجورد و ارغوان‌ و قرمز و كتان‌ نازك‌ تابیده‌ شده‌، چنانكه‌ خداوند به‌ موسی‌ امر فرموده‌ بود.", "6": "<span>6 </span> &nbsp;و سنگهای‌ جزع‌ مرصع‌ در دو طوق‌ طلا، و منقوش‌ به‌ نقش‌ خاتم‌، موافق‌ نامهای‌ بنی‌اسرائیل‌ درست‌ كردند.", "7": "<span>7 </span> &nbsp;آنها را بر كتفهای‌ ایفود نصب‌ كرد، تا سنگهای‌ یادگاری‌ برای‌ بنی‌اسرائیل‌ باشد، چنانكه‌ خداوند به‌ موسی‌ امر فرموده‌بود.", "8": "<span>8 </span> &nbsp;و سینه‌بند را موافق‌ كار ایفود از صنعت‌ نساج‌ ماهر ساخت‌، از طلا و لاجورد و ارغوان‌ و قرمز و كتان‌ نازك‌ تابیده‌ شده‌.", "9": "<span>9 </span> &nbsp;و آن‌ مربع‌ بود و سینه‌بند را دولا ساختند طولش‌ یك‌ وجب‌ و عرضش‌ یك‌ وجب‌ دولا.", "10": "<span>10 </span> &nbsp;و در آن‌ چهار رسته‌ سنگ‌ نصب‌ كردند، رسته‌ای‌ از عقیق‌ سرخ‌ و یاقوت‌ زرد و زمرد. این‌ بود رستۀ اول‌.", "11": "<span>11 </span> &nbsp;و رستۀ دوم‌ از بهرمان‌ و یاقوت‌ كبود و عقیق‌ سفید.", "12": "<span>12 </span> &nbsp;و رستۀ سوم‌ از عین‌ الهر و یشم‌ و جمست‌.", "13": "<span>13 </span> &nbsp;و رستۀ چهارم‌ از زبرجد و جزع‌ و یشب‌ در ترصیعۀ خود كه‌ به‌ دیوارهای‌ طلا احاطه‌ شده‌ بود.", "14": "<span>14 </span> &nbsp;و سنگها موافق‌ نامهای‌ بنی‌اسرائیل‌ دوازده‌ بود، مطابق‌ اسامی‌ ایشان‌، مثل‌ نقش‌ خاتم‌، هر یكی‌ به‌ اسم‌ خود برای‌ دوازده‌ سبط.", "15": "<span>15 </span> &nbsp;و بر سینه‌بند زنجیرهای‌ تابیده‌ شده‌، مثل‌ كار طنابها از طلای‌ خالص‌ ساختند.", "16": "<span>16 </span> &nbsp;و دو طوق‌ زرین‌ و دو حلقۀ زرین‌ ساختند و دو حلقه‌ را بر دو سر سینه‌بندگذاشتند.", "17": "<span>17 </span> &nbsp;و آن‌ دو زنجیر تابیده‌ شدۀ زرین‌ را در دو حلقه‌ای‌ كه‌ بر سرهای‌ سینه‌بند بود، گذاشتند.", "18": "<span>18 </span> &nbsp;و دو سر دیگر آن‌ دو زنجیر را بر دو طوق‌ گذاشتند، و آنها را بر دو كتف‌ ایفود در پیش‌ نصب‌ كردند.", "19": "<span>19 </span> &nbsp;و دو حلقۀ زرین‌ ساختند، آنها را بر دو سر سینه‌بند گذاشتند، بر كناری‌ كه‌ بر طرف‌ اندرونی‌ ایفود بود.", "20": "<span>20 </span> &nbsp;و دو حلقۀ زرین‌ دیگر ساختند، و آنها را بر دو كتف‌ ایفود، به‌ طرف‌ پایین‌، از جانب‌ پیش‌، مقابل‌ پیوستگیش‌ بالای‌ زنار ایفود گذاشتند.", "21": "<span>21 </span> &nbsp;و سینه‌بند را به‌ حلقه‌هایش‌ با حلقه‌های‌ ایفود به‌ نوار لاجوردی‌ بستند، تا بالای‌ زنار ایفود باشد. و سینه‌بند از ایفود جدا نشود، چنانكه‌ خداوند به‌ موسی‌ امر فرموده‌ بود.", "22": "<span>22 </span> &nbsp;و ردای‌ ایفود را از صنعت‌ نساج‌، تماماً لاجوردی‌ ساخت‌.", "23": "<span>23 </span> &nbsp;و دهنه‌ای‌ در وسط‌ ردا بود، مثل‌ دهنۀ زره‌ با حاشیه‌ای‌ گرداگرد دهنه‌ تا دریده‌ نشود.", "24": "<span>24 </span> &nbsp;و بر دامن‌ ردا، انارها از لاجورد و ارغوان‌ و قرمز و كتان‌ تابیده‌ شده‌ ساختند.", "25": "<span>25 </span> &nbsp;و زنگوله‌ها از طلای‌ خالص‌ ساختند. و زنگوله‌ها را در میان‌ انارها بر دامن‌ ردا گذاشتند، گرداگردش‌ در میان‌ انارها.", "26": "<span>26 </span> &nbsp;و زنگوله‌ای‌ و اناری‌، و زنگوله‌ای‌ و اناری‌ گرداگرد دامن‌ ردا برای‌ خدمت‌ كردن‌، چنانكه‌ خداوند به‌ موسی‌ امر فرموده‌ بود.", "27": "<span>27 </span> &nbsp;و پیراهنها را برای‌ هارون‌ و پسرانش‌ از كتان‌ نازك‌ از صنعت‌ نساج‌ ساختند.", "28": "<span>28 </span> &nbsp;و عمامه‌ را از كتان‌ نازك‌ و دستارهای‌ زیبا را از كتان‌ نازك‌، و زیرجامه‌های‌ كتانی‌ را از كتان‌ نازك‌ تابیده‌ شده‌.", "29": "<span>29 </span> &nbsp;و كمربند را از كتان‌ نازك‌ تابیده‌ شده‌، و لاجورد و ارغوان‌ و قرمز از صنعت‌ طراز، چنانكه‌ خداوند به‌ موسی‌ امر فرموده‌ بود.", "30": "<span>30 </span> &nbsp;و تنگۀ افسر مقدس‌ را از طلای‌ خالص‌ ساختند، و بر آن‌ كتابتی‌ مثل‌ نقش‌خاتم‌ مرقوم‌ داشتند: قدوسیت‌ برای‌ یهوه‌.", "31": "<span>31 </span> &nbsp;و بر آن‌ نواری‌ لاجوردی‌ بستند تا آن‌ را بالای‌ عمامه‌ ببندنـد، چنانكه‌ خداوند به‌ موسـی‌ امر فرموده‌ بود.", "32": "<span>32 </span> &nbsp;پس‌ همۀ كار مسكن‌ خیمۀ اجتماع‌ تمام‌ شد، و بنی‌اسرائیل‌ ساختند. موافق‌ آنچه‌ خداوند به‌ موسی‌ امر فرموده‌ بود، عمل‌ نمودند.", "33": "<span>33 </span> &nbsp;و مسكن‌ خیمه‌ را نزد موسی‌ آوردند، با همۀ اسبابش‌ و تكمه‌ها و تخته‌ها و پشت‌بندها و ستونها و پایه‌هایش‌.", "34": "<span>34 </span> &nbsp;و پوشش‌ از پوست‌ قوچ‌ سرخ‌شده‌ و پوشش‌ از پوست‌ خز و حجاب‌ ستر.", "35": "<span>35 </span> &nbsp;و تابوت‌ شهادت‌ و عصاهایش‌ و كرسی‌ رحمت‌.", "36": "<span>36 </span> &nbsp;و خوان‌ و همۀ اسبابش‌ و نانِ تَقْدِمِه‌.", "37": "<span>37 </span> &nbsp;و چراغدان‌ طاهر و چراغهایش‌، چراغهای‌ آراسته‌ شده‌ و همۀ اسبابش‌، و روغن‌ برای‌ روشنایی‌.", "38": "<span>38 </span> &nbsp;و مذبح‌ زرین‌ و روغن‌ مسح‌ و بخور معطر و پرده‌ برای‌ دروازۀ خیمه‌.", "39": "<span>39 </span> &nbsp;و مذبح‌ برنجین‌ و شبكۀ برنجین‌ آن‌، و عصاهایش‌ و همۀ اسبابش‌ و حوض‌ و پایه‌اش‌.", "40": "<span>40 </span> &nbsp;و پرده‌های‌ صحن‌ و ستونها و پایه‌هایش‌ و پردۀ دروازۀ صحن‌، و طنابهایش‌ و میخهایش‌ و همۀ اسباب‌ خدمت‌ مسكن‌ برای‌ خیمۀ اجتماع‌.", "41": "<span>41 </span> &nbsp;و رختهای‌ بافته‌ شده‌ برای‌ خدمت‌ قدس‌، و رخت‌ مقدس‌ برای‌ هارون‌ كاهن‌، و رختها برای‌ پسرانش‌ تا كهانت‌ نمایند.", "42": "<span>42 </span> &nbsp;موافق‌ آنچه‌ خداوند به‌ موسی‌ امر فرموده‌ بود، بنی‌اسرائیل‌ همچنین‌ تمام‌ كار را ساختند.", "43": "<span>43 </span> &nbsp;و موسی‌ تمام‌ كارها را ملاحظه‌ كرد، و اینك‌ موافق‌ آنچه‌ خداوند امر فرموده‌ بود ساخته‌ بودند، همچنین‌ كرده‌ بودند. و موسی‌ ایشان‌ را بركت‌ داد." }, "40": { "1": "<span>1 </span> &nbsp;و خداوند موسی‌ را خطاب‌ كرده‌، گفت‌:", "2": "<span>2 </span> &nbsp;«در غُرّۀ ماه‌ اول‌ مسكن‌ خیمۀ اجتماع‌ را برپا نما.", "3": "<span>3 </span> &nbsp;و تابوت‌ شهادت‌ را در آن‌ بگذار. و حجاب‌ را پیش‌ تابوت‌ پهن‌ كن‌.", "4": "<span>4 </span> &nbsp;و خوان‌ را درآورده‌، چیزهایی‌ را كه‌ می‌باید، بر آن‌ ترتیب‌ نما. و چراغدان‌ را درآور و چراغهایش‌ را آراسته‌ كن‌.", "5": "<span>5 </span> &nbsp;و مذبح‌ زرین‌ را برای‌ بخور پیش‌ تابوت‌ شهادت‌ بگذار، و پردۀ دروازه‌ را بر مسكن‌ بیاویز.", "6": "<span>6 </span> &nbsp;و مذبح‌ قربانی‌ سوختنی‌ را پیش‌ دروازۀ مسكن‌ خیمۀ اجتماع‌ بگذار.", "7": "<span>7 </span> &nbsp;و حوض‌ را در میان‌ خیمۀ اجتماع‌ و مذبح‌ بگذار، و آب‌ در آن‌ بریز.", "8": "<span>8 </span> &nbsp;و صحن‌ را گرداگرد برپا كن‌. و پردۀ دروازۀ صحن‌ را بیاویز.", "9": "<span>9 </span> &nbsp;و روغن‌ مسح‌ را گرفته‌، مسكن‌ را با آنچه‌ در آن‌ است‌ مسح‌ كن‌، و آن‌ را با همۀ اسبابش‌ تقدیس‌ نما تا مقدس‌ شود.", "10": "<span>10 </span> &nbsp;و مذبح‌ قربانی‌ سوختنی‌ را با همۀ اسبابش‌ مسح‌ كرده‌، مذبح‌ را تقدیس‌ نما. و مذبح‌، قدس‌ اقداس‌ خواهد بود.", "11": "<span>11 </span> &nbsp;و حوض‌ را با پایه‌اش‌ مسح‌ نموده‌، تقدیس‌ كن‌.", "12": "<span>12 </span> &nbsp;و هارون‌ و پسرانش‌ را نزد دروازۀ خیمۀ اجتماع‌ آورده‌، ایشان‌ را به‌ آب‌ غسل‌ ده‌.", "13": "<span>13 </span> &nbsp;و هارون‌ را به‌ رخت‌ مقدس‌ بپوشان‌، و او را مسح‌ كرده‌، تقدیس‌ نما، تا برای‌ من‌ كهانت‌ كند.", "14": "<span>14 </span> &nbsp;و پسرانش‌ را نزدیك‌ آورده‌، ایشان‌ را به‌ پیراهنها بپوشان‌.", "15": "<span>15 </span> &nbsp;و ایشان‌ را مسح‌ كن‌، چنانكه‌ پدر ایشان‌ را مسح‌ كردی‌ تا برای‌ من‌ كهانت‌ نماید. و مسح‌ ایشان‌ هر آینه‌ برای‌ كهانت‌ ابدی‌ در نسلهای‌ ایشان‌ خواهد بود.»", "16": "<span>16 </span> &nbsp;پس‌ موسی‌ موافق‌ آنچه‌ خداوند او را امر فرموده‌ بود كرد، و همچنین‌ به‌ عمل‌ آورد.", "17": "<span>17 </span> &nbsp;و واقع‌ شد در غُرّۀ ماه‌ اول‌ از سال‌ دوم‌ كه‌ مسكن‌ برپا شد،", "18": "<span>18 </span> &nbsp;و موسی‌ مسكن‌ را برپا نمود، وپایه‌هایش‌ را بنهاد و تخته‌هایش‌ را قایم‌ كرد، و پشت‌ بندهایش‌ را گذاشت‌، و ستونهایش‌ را برپا نمود،", "19": "<span>19 </span> &nbsp;و خیمه‌ را بالای‌ مسكن‌ كشید، و پوشش‌ خیمه‌ را بر زبر آن‌ گسترانید، چنانكه‌ خداوند به‌ موسی‌ امر نموده‌ بود.", "20": "<span>20 </span> &nbsp;و شهادت‌ را گرفته‌، آن‌ را در تابوت‌ نهاد، و عصاها را بر تابوت‌ گذارد، و كرسی‌ رحمت‌ را بالای‌ تابوت‌ گذاشت‌.", "21": "<span>21 </span> &nbsp;و تابوت‌ را به‌ مسكن‌ درآورد، و حجاب‌ ستر را آویخته‌، آن‌ را پیش‌ تابوت‌ شهادت‌ كشید. چنانكه‌ خداوند به‌ موسی‌ امر فرموده‌ بود.", "22": "<span>22 </span> &nbsp;و خوان‌ را در خیمۀ اجتماع‌ به‌ طرف‌ شمالی‌ مسكن‌، بیرون‌ حجاب‌ نهاد.", "23": "<span>23 </span> &nbsp;و نان‌ را به‌ حضور خداوند بر آن‌ ترتیب‌ داد، چنانكه‌ خداوند به‌ موسی‌ امر فرموده‌ بود.", "24": "<span>24 </span> &nbsp;و چراغدان‌ را در خیمۀ اجتماع‌، مقابل‌ خوان‌ به‌ طرف‌ جنوبی‌ مسكن‌ نهاد.", "25": "<span>25 </span> &nbsp;و چراغها را به‌ حضور خداوند گذاشت‌، چنانكه‌ خداوند به‌ موسی‌ امر فرموده‌ بود.", "26": "<span>26 </span> &nbsp;و مذبح‌ زرین‌ را در خیمۀ اجتماع‌، پیش‌ حجاب‌ نهاد.", "27": "<span>27 </span> &nbsp;و بخور معطر بر آن‌ سوزانید، چنانكه‌ خداوند به‌ موسی‌ امر فرموده‌ بود.", "28": "<span>28 </span> &nbsp;و پردۀ دروازۀ مسكن‌ را آویخت‌.", "29": "<span>29 </span> &nbsp;و مذبح‌ قربانی‌ سوختنی‌ را پیش‌ دروازۀ مسكن‌ خیمۀ اجتماع‌ وضع‌ كرد، و قربانی‌ سوختنی‌ و هدیه‌ را بر آن‌ گذرانید، چنانكه‌خداوند به‌ موسـی‌ امر فرمـوده‌ بود.", "30": "<span>30 </span> &nbsp;و حوض‌ را در میان‌ خیمۀ اجتماع‌ و مذبـح‌ وضـع‌ كرده‌، آب‌ برای‌ شستن‌ در آن‌ بریخت‌.", "31": "<span>31 </span> &nbsp;و موسی‌ و هارون‌ و پسرانش‌ دست‌ و پای‌ خود را در آن‌ شستند.", "32": "<span>32 </span> &nbsp;وقتی‌ كه‌ به‌ خیمۀ اجتماع‌ داخل‌ شدند و نزد مذبح‌ آمدند شست‌ و شو كردند، چنانكه‌ خداوند به‌ موسی‌ امر فرموده‌ بود.", "33": "<span>33 </span> &nbsp;و صحن‌ را گرداگرد مسكن‌ و مذبح‌ برپا نمود، و پردۀ دروازۀ صحن‌ را آویخت‌. پس‌ موسی‌ كار را به‌ انجام‌ رسانید.", "34": "<span>34 </span> &nbsp;آنگاه‌ ابر، خیمۀ اجتماع‌ را پوشانید و جلال‌ خداوند مسكن‌ را پر ساخت‌.", "35": "<span>35 </span> &nbsp;و موسی‌ نتوانست‌ به‌ خیمۀ اجتماع‌ داخل‌ شود، زیراكه‌ ابر بر آن‌ ساكن‌ بود، و جلال‌ خداوند مسكن‌ را پر ساخته‌ بود.", "36": "<span>36 </span> &nbsp;و چون‌ ابر از بالای‌ مسكن‌ برمی‌خاست‌، بنی‌اسرائیل‌ در همۀ مراحل‌ خود كوچ‌ می‌كردند.", "37": "<span>37 </span> &nbsp;و هرگاه‌ ابر برنمی‌خاست‌، تا روز برخاستن‌ آن‌، نمی‌كوچیدند.", "38": "<span>38 </span> &nbsp;زیرا كه‌ در روز، ابر خداوند بر مسكن‌ و در شب‌، آتش‌ بر آن‌ می‌بود، در نظر تمامی‌ خاندان‌ اسرائیل‌، در همۀ منازل‌ ایشان‌." } } }; module.exports = book;
import Link from "next/link"; import Layout from "../components/layout/layout"; import NewsDisplay from "../components/newsDisplay/newsDisplay"; export default function HealthPage({ newsNews, guardianNews, nytNews }) { const newsApiArticles = newsNews; const gAndNytArticles = [...guardianNews, ...nytNews].flat(); return ( <> <Layout> <NewsDisplay newsApiArticles={newsApiArticles} gAndNytArticles={gAndNytArticles} /> </Layout> </> ); } export async function getStaticProps(context) { const apiKey = process.env.NEWS_API_KEY; const GApiKey = process.env.GUARDIAN_NEWS_API_KEY; const NytApiKey = process.env.NYT_NEWS_API_KEY; const [newsNews, guardianNews, nytNews] = await Promise.all([ fetch( `https://newsapi.org/v2/top-headlines?country=us&category=health&apiKey=${apiKey}` ) .then((r) => r.json()) .then((res) => res.articles), fetch( `http://content.guardianapis.com/lifeandstyle/health-and-wellbeing?&api-key=${GApiKey}` ) .then((r) => r.json()) .then((res) => res.response.results), fetch( `https://api.nytimes.com/svc/search/v2/articlesearch.json?fq=news_desk:("health")&api-key=${NytApiKey}` ) .then((r) => r.json()) .then((res) => res.response.docs), ]); return { props: { newsNews, guardianNews, nytNews, }, }; }
/* Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dojox.mobile.app.TextBox"]){dojo._hasResource["dojox.mobile.app.TextBox"]=true;dojo.provide("dojox.mobile.app.TextBox");dojo.experimental("dojox.mobile.app.TextBox");dojo.require("dojox.mobile.app._Widget");dojo.require("dojox.mobile.app._FormWidget");dojo.declare("dojox.mobile.app.TextBox",dojox.mobile.app._FormValueWidget,{trim:false,uppercase:false,lowercase:false,propercase:false,maxLength:"",selectOnClick:false,placeHolder:"",baseClass:"mblTextBox",attributeMap:dojo.delegate(dojox.mobile.app._FormValueWidget.prototype.attributeMap,{maxLength:"focusNode"}),buildRendering:function(){var _1=this.srcNodeRef;if(!_1||_1.tagName!="INPUT"){_1=dojo.create("input",{});}dojo.attr(_1,{type:"text",value:dojo.attr(this.srcNodeRef,"value")||"",placeholder:this.placeHolder||null});this.domNode=this.textbox=this.focusNode=_1;},_setPlaceHolderAttr:function(v){this.placeHolder=v;if(this.textbox){dojo.attr(this.textbox,"placeholder",v);}},_getValueAttr:function(){return this.parse(this.get("displayedValue"),this.constraints);},_setValueAttr:function(_2,_3,_4){var _5;if(_2!==undefined){_5=this.filter(_2);if(typeof _4!="string"){if(_5!==null&&((typeof _5!="number")||!isNaN(_5))){_4=this.filter(this.format(_5,this.constraints));}else{_4="";}}}if(_4!=null&&_4!=undefined&&((typeof _4)!="number"||!isNaN(_4))&&this.textbox.value!=_4){this.textbox.value=_4;}this.inherited(arguments,[_5,_3]);},displayedValue:"",_getDisplayedValueAttr:function(){return this.filter(this.textbox.value);},_setDisplayedValueAttr:function(_6){if(_6===null||_6===undefined){_6="";}else{if(typeof _6!="string"){_6=String(_6);}}this.textbox.value=_6;this._setValueAttr(this.get("value"),undefined,_6);},format:function(_7,_8){return ((_7==null||_7==undefined)?"":(_7.toString?_7.toString():_7));},parse:function(_9,_a){return _9;},_refreshState:function(){},_onInput:function(e){if(e&&e.type&&/key/i.test(e.type)&&e.keyCode){switch(e.keyCode){case dojo.keys.SHIFT:case dojo.keys.ALT:case dojo.keys.CTRL:case dojo.keys.TAB:return;}}if(this.intermediateChanges){var _b=this;setTimeout(function(){_b._handleOnChange(_b.get("value"),false);},0);}this._refreshState();},postCreate:function(){console.log("postCreate of textinput");this.textbox.setAttribute("value",this.textbox.value);this.inherited(arguments);if(dojo.isMoz||dojo.isOpera){this.connect(this.textbox,"oninput",this._onInput);}else{this.connect(this.textbox,"onkeydown",this._onInput);this.connect(this.textbox,"onkeyup",this._onInput);this.connect(this.textbox,"onpaste",this._onInput);this.connect(this.textbox,"oncut",this._onInput);}},_blankValue:"",filter:function(_c){if(_c===null){return this._blankValue;}if(typeof _c!="string"){return _c;}if(this.trim){_c=dojo.trim(_c);}if(this.uppercase){_c=_c.toUpperCase();}if(this.lowercase){_c=_c.toLowerCase();}if(this.propercase){_c=_c.replace(/[^\s]+/g,function(_d){return _d.substring(0,1).toUpperCase()+_d.substring(1);});}return _c;},_setBlurValue:function(){this._setValueAttr(this.get("value"),true);},_onBlur:function(e){if(this.disabled){return;}this._setBlurValue();this.inherited(arguments);if(this._selectOnClickHandle){this.disconnect(this._selectOnClickHandle);}if(this.selectOnClick&&dojo.isMoz){this.textbox.selectionStart=this.textbox.selectionEnd=undefined;}},_onFocus:function(by){if(this.disabled||this.readOnly){return;}if(this.selectOnClick&&by=="mouse"){this._selectOnClickHandle=this.connect(this.domNode,"onmouseup",function(){this.disconnect(this._selectOnClickHandle);var _e;_e=this.textbox.selectionStart==this.textbox.selectionEnd;if(_e){this.selectInputText(this.textbox);}});}this._refreshState();this.inherited(arguments);},reset:function(){this.textbox.value="";this.inherited(arguments);}});}
const _urlData = "https://www.datos.gov.co/resource/sfav-4met.json" var vlSpec = { "data": { "url": "https://www.datos.gov.co/resource/sfav-4met.json" }, "transform": [{ "fold": ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "_noviembre"] }], "mark": "bar", "encoding": { "column": { "field": "indicadores", "type": "nominal" }, "color": {"field": "key", "type": "nominal"}, "y": { "field": "value", "type": "quantitative" }, "x": { "field": "key", "type": "nominal" }, "tooltip": { "field": "value", "type": "quantitative" }, "width": { "step": 12 } } }; console.log(vlSpec);
// Given two words word1 and word2, find the minimum number of steps required to make word1 and word2 the same, where in each step you can delete one character in either string. // // Example 1: // Input: "sea", "eat" // Output: 2 // Explanation: You need one step to make "sea" to "ea" and another step to make "eat" to "ea". // Note: // The length of given words won't exceed 500. // Characters in given words can only be lower-case letters. function minDistance(string1,string2){ var letters = {}; var firstSplit = string1.split(''); var secondSplit = string2.split(''); var common = []; var uncommon = []; for(var i = 0; i < secondSplit.length; i++){ if(firstSplit.includes(secondSplit[i])){ common+=secondSplit[i]; }else{ uncommon+=secondSplit[i]; } } // console.log(common,' common'); // console.log(uncommon,' uncommon'); for(var j = 0; j < firstSplit.length; j++){ if(secondSplit.includes(firstSplit[j]) && !common.includes(firstSplit[j])){ common+=firstSplit[j]; }else if(!secondSplit.includes(firstSplit[j]) && !uncommon.includes(firstSplit[j])){ uncommon+=firstSplit[j]; } } return uncommon.length; } console.log(minDistance('calvin','kelvin')); console.log(minDistance('crate','great')); // does not work if there are multiple same letters in test -> // console.log(minDistance('joanna','banana')) returns 3 when it should be 4
// modules are defined as an array // [ module function, map of requires ] // // map of requires is short require name -> numeric require // // anything defined in a previous bundle is accessed via the // orig method which is the require for previous bundles parcelRequire = (function (modules, cache, entry, globalName) { // Save the require from previous bundle to this closure if any var previousRequire = typeof parcelRequire === 'function' && parcelRequire; var nodeRequire = typeof require === 'function' && require; function newRequire(name, jumped) { if (!cache[name]) { if (!modules[name]) { // if we cannot find the module within our internal map or // cache jump to the current global require ie. the last bundle // that was added to the page. var currentRequire = typeof parcelRequire === 'function' && parcelRequire; if (!jumped && currentRequire) { return currentRequire(name, true); } // If there are other bundles on this page the require from the // previous one is saved to 'previousRequire'. Repeat this as // many times as there are bundles until the module is found or // we exhaust the require chain. if (previousRequire) { return previousRequire(name, true); } // Try the node require function if it exists. if (nodeRequire && typeof name === 'string') { return nodeRequire(name); } var err = new Error('Cannot find module \'' + name + '\''); err.code = 'MODULE_NOT_FOUND'; throw err; } localRequire.resolve = resolve; localRequire.cache = {}; var module = cache[name] = new newRequire.Module(name); modules[name][0].call(module.exports, localRequire, module, module.exports, this); } return cache[name].exports; function localRequire(x){ return newRequire(localRequire.resolve(x)); } function resolve(x){ return modules[name][1][x] || x; } } function Module(moduleName) { this.id = moduleName; this.bundle = newRequire; this.exports = {}; } newRequire.isParcelRequire = true; newRequire.Module = Module; newRequire.modules = modules; newRequire.cache = cache; newRequire.parent = previousRequire; newRequire.register = function (id, exports) { modules[id] = [function (require, module) { module.exports = exports; }, {}]; }; var error; for (var i = 0; i < entry.length; i++) { try { newRequire(entry[i]); } catch (e) { // Save first error but execute all entries if (!error) { error = e; } } } if (entry.length) { // Expose entry point to Node, AMD or browser globals // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js var mainExports = newRequire(entry[entry.length - 1]); // CommonJS if (typeof exports === "object" && typeof module !== "undefined") { module.exports = mainExports; // RequireJS } else if (typeof define === "function" && define.amd) { define(function () { return mainExports; }); // <script> } else if (globalName) { this[globalName] = mainExports; } } // Override the current require with this new one parcelRequire = newRequire; if (error) { // throw error from earlier, _after updating parcelRequire_ throw error; } return newRequire; })({"js/particles/app.js":[function(require,module,exports) { /* particlesJS.load(@dom-id, @path-json, @callback (optional)); */ // particlesJS.load('particles-js', './js/particles/particles.json', function () { // console.log('callback - particles.js config loaded'); // }); particlesJS('particles-js', { "particles": { "number": { "value": 120, "density": { "enable": true, "value_area": 800 } }, "color": { // "value": "#ffffff" "value": "#ffffff" }, "shape": { "type": "circle", "stroke": { "width": 0, // "color": "#000000" "color": "#ff0000" }, "polygon": { "nb_sides": 5 }, "image": { // "src": "img/github.svg", "src": "", "width": 100, "height": 100 } }, "opacity": { // "value": 0.5, "value": 1, "random": false, "anim": { "enable": false, "speed": 1, "opacity_min": 0.1, "sync": false } }, "size": { "value": 5, "random": true, "anim": { "enable": false, "speed": 40, "size_min": 0.1, "sync": false } }, "line_linked": { "enable": true, "distance": 150, // "color": "#ffffff", "color": "#ffffff", // "opacity": 0.4, "opacity": .75, "width": 1 }, "move": { "enable": true, "speed": 6, "direction": "none", "random": false, "straight": false, "out_mode": "out", "attract": { "enable": false, "rotateX": 600, "rotateY": 1200 } } }, "interactivity": { "detect_on": "canvas", "events": { "onhover": { "enable": true, "mode": "repulse" }, "onclick": { "enable": true, "mode": "push" }, "resize": true }, "modes": { "grab": { "distance": 400, "line_linked": { "opacity": 1 } }, "bubble": { "distance": 400, "size": 40, "duration": 2, "opacity": 8, "speed": 3 }, "repulse": { "distance": 200 }, "push": { "particles_nb": 4 }, "remove": { "particles_nb": 2 } } }, "retina_detect": true, "config_demo": { "hide_card": false, "background_color": "#b61924", "background_image": "", "background_position": "50% 50%", "background_repeat": "no-repeat", "background_size": "cover" } }); },{}],"C:/Users/Administrator/AppData/Local/Yarn/Data/global/node_modules/parcel-bundler/src/builtins/hmr-runtime.js":[function(require,module,exports) { var global = arguments[3]; var OVERLAY_ID = '__parcel__error__overlay__'; var OldModule = module.bundle.Module; function Module(moduleName) { OldModule.call(this, moduleName); this.hot = { data: module.bundle.hotData, _acceptCallbacks: [], _disposeCallbacks: [], accept: function (fn) { this._acceptCallbacks.push(fn || function () {}); }, dispose: function (fn) { this._disposeCallbacks.push(fn); } }; module.bundle.hotData = null; } module.bundle.Module = Module; var checkedAssets, assetsToAccept; var parent = module.bundle.parent; if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') { var hostname = "" || location.hostname; var protocol = location.protocol === 'https:' ? 'wss' : 'ws'; var ws = new WebSocket(protocol + '://' + hostname + ':' + "63602" + '/'); ws.onmessage = function (event) { checkedAssets = {}; assetsToAccept = []; var data = JSON.parse(event.data); if (data.type === 'update') { var handled = false; data.assets.forEach(function (asset) { if (!asset.isNew) { var didAccept = hmrAcceptCheck(global.parcelRequire, asset.id); if (didAccept) { handled = true; } } }); // Enable HMR for CSS by default. handled = handled || data.assets.every(function (asset) { return asset.type === 'css' && asset.generated.js; }); if (handled) { console.clear(); data.assets.forEach(function (asset) { hmrApply(global.parcelRequire, asset); }); assetsToAccept.forEach(function (v) { hmrAcceptRun(v[0], v[1]); }); } else { window.location.reload(); } } if (data.type === 'reload') { ws.close(); ws.onclose = function () { location.reload(); }; } if (data.type === 'error-resolved') { console.log('[parcel] ✨ Error resolved'); removeErrorOverlay(); } if (data.type === 'error') { console.error('[parcel] 🚨 ' + data.error.message + '\n' + data.error.stack); removeErrorOverlay(); var overlay = createErrorOverlay(data); document.body.appendChild(overlay); } }; } function removeErrorOverlay() { var overlay = document.getElementById(OVERLAY_ID); if (overlay) { overlay.remove(); } } function createErrorOverlay(data) { var overlay = document.createElement('div'); overlay.id = OVERLAY_ID; // html encode message and stack trace var message = document.createElement('div'); var stackTrace = document.createElement('pre'); message.innerText = data.error.message; stackTrace.innerText = data.error.stack; overlay.innerHTML = '<div style="background: black; font-size: 16px; color: white; position: fixed; height: 100%; width: 100%; top: 0px; left: 0px; padding: 30px; opacity: 0.85; font-family: Menlo, Consolas, monospace; z-index: 9999;">' + '<span style="background: red; padding: 2px 4px; border-radius: 2px;">ERROR</span>' + '<span style="top: 2px; margin-left: 5px; position: relative;">🚨</span>' + '<div style="font-size: 18px; font-weight: bold; margin-top: 20px;">' + message.innerHTML + '</div>' + '<pre>' + stackTrace.innerHTML + '</pre>' + '</div>'; return overlay; } function getParents(bundle, id) { var modules = bundle.modules; if (!modules) { return []; } var parents = []; var k, d, dep; for (k in modules) { for (d in modules[k][1]) { dep = modules[k][1][d]; if (dep === id || Array.isArray(dep) && dep[dep.length - 1] === id) { parents.push(k); } } } if (bundle.parent) { parents = parents.concat(getParents(bundle.parent, id)); } return parents; } function hmrApply(bundle, asset) { var modules = bundle.modules; if (!modules) { return; } if (modules[asset.id] || !bundle.parent) { var fn = new Function('require', 'module', 'exports', asset.generated.js); asset.isNew = !modules[asset.id]; modules[asset.id] = [fn, asset.deps]; } else if (bundle.parent) { hmrApply(bundle.parent, asset); } } function hmrAcceptCheck(bundle, id) { var modules = bundle.modules; if (!modules) { return; } if (!modules[id] && bundle.parent) { return hmrAcceptCheck(bundle.parent, id); } if (checkedAssets[id]) { return; } checkedAssets[id] = true; var cached = bundle.cache[id]; assetsToAccept.push([bundle, id]); if (cached && cached.hot && cached.hot._acceptCallbacks.length) { return true; } return getParents(global.parcelRequire, id).some(function (id) { return hmrAcceptCheck(global.parcelRequire, id); }); } function hmrAcceptRun(bundle, id) { var cached = bundle.cache[id]; bundle.hotData = {}; if (cached) { cached.hot.data = bundle.hotData; } if (cached && cached.hot && cached.hot._disposeCallbacks.length) { cached.hot._disposeCallbacks.forEach(function (cb) { cb(bundle.hotData); }); } delete bundle.cache[id]; bundle(id); cached = bundle.cache[id]; if (cached && cached.hot && cached.hot._acceptCallbacks.length) { cached.hot._acceptCallbacks.forEach(function (cb) { cb(); }); return true; } } },{}]},{},["C:/Users/Administrator/AppData/Local/Yarn/Data/global/node_modules/parcel-bundler/src/builtins/hmr-runtime.js","js/particles/app.js"], null) //# sourceMappingURL=/app.21b5ae02.js.map
function imagePreview(input) { console.log('Hecho'); filePreview(input); }; function filePreview(input) { if (input.files && input.files[0]) { var reader = new FileReader(); reader.readAsDataURL(input.files[0]); reader.onload = function (e) { $('#preview + img').remove(); $('#preview').html('<img src="'+e.target.result+'" width="150" height="150"/>'); } } } function editaCategoria(id) { $.get("/categoria/"+id+"/edit", function( data ) { $( "#contenido" ).html( data ); }); } function editaSub(id) { $.get("/subcategoria/"+id+"/edit", function( data ) { $( "#contenido" ).html( data ); }); }
/** * First we will load all of this project's JavaScript dependencies which * includes Vue and other libraries. It is a great starting point when * building robust, powerful web applications using Vue and Laravel. */ import Vue from 'vue'; window.Vue = require('vue'); Vue.use(require('vue-resource')); window._ = require('lodash'); window.axios = require('axios'); window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; // require('./bootstrap'); require('./functions'); require('./validator'); Vue.http.interceptors.push((request, next) => { let token = document.head.querySelector('meta[name="csrf-token"]'); request.headers.set('X-CSRF-TOKEN', token.content); next(); }); // Front Vue.component('index-page', require('./components/front/index.vue').default); Vue.component('category-page', require('./components/front/category.vue').default); Vue.component('product-page', require('./components/front/product.vue').default); // Common Vue.component('item-block', require('./components/front/itemBlock.vue').default); Vue.component('preloader', require('./components/front/preloader.vue').default); const app = new Vue({ el: '#home', data: { }, });
import { useState, useCallback } from 'react'; function useHooks({ columns, dataSource, onAdd, onEdit, onDelete }) { const ds = (dataSource || []).map(d => Object.assign(d, { key: d.id })); const [data, setData] = useState(ds); const [loading, setLoading] = useState(false); const handleAdd = useCallback( () => async () => { if (onAdd) { await onAdd(); } }, [onAdd], ); const handleEdit = useCallback( key => async () => { if (onEdit) { await onEdit(key); } }, [onEdit], ); const handleRemove = useCallback( key => async () => { setLoading(true); if (onDelete) { const success = await onDelete(key); if (success) { setData(data.filter(item => item.key !== key)); } } setLoading(false); }, [data, onDelete], ); return { data, columns, loading, events: { handleAdd, handleEdit, handleRemove, }, }; } export { useHooks };
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["keyboard-dd970efc-js"],{ /***/ "./node_modules/@ionic/core/dist/esm/keyboard-dd970efc.js": /*!****************************************************************!*\ !*** ./node_modules/@ionic/core/dist/esm/keyboard-dd970efc.js ***! \****************************************************************/ /*! exports provided: KEYBOARD_DID_CLOSE, KEYBOARD_DID_OPEN, copyVisualViewport, keyboardDidClose, keyboardDidOpen, keyboardDidResize, resetKeyboardAssist, setKeyboardClose, setKeyboardOpen, startKeyboardAssist, trackViewportChanges */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KEYBOARD_DID_CLOSE", function() { return KEYBOARD_DID_CLOSE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KEYBOARD_DID_OPEN", function() { return KEYBOARD_DID_OPEN; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "copyVisualViewport", function() { return copyVisualViewport; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "keyboardDidClose", function() { return keyboardDidClose; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "keyboardDidOpen", function() { return keyboardDidOpen; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "keyboardDidResize", function() { return keyboardDidResize; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resetKeyboardAssist", function() { return resetKeyboardAssist; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setKeyboardClose", function() { return setKeyboardClose; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setKeyboardOpen", function() { return setKeyboardOpen; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "startKeyboardAssist", function() { return startKeyboardAssist; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "trackViewportChanges", function() { return trackViewportChanges; }); const KEYBOARD_DID_OPEN = 'ionKeyboardDidShow'; const KEYBOARD_DID_CLOSE = 'ionKeyboardDidHide'; const KEYBOARD_THRESHOLD = 150; let previousVisualViewport = {}; let currentVisualViewport = {}; let keyboardOpen = false; /** * This is only used for tests */ const resetKeyboardAssist = () => { previousVisualViewport = {}; currentVisualViewport = {}; keyboardOpen = false; }; const startKeyboardAssist = (win) => { startNativeListeners(win); if (!win.visualViewport) { return; } currentVisualViewport = copyVisualViewport(win.visualViewport); win.visualViewport.onresize = () => { trackViewportChanges(win); if (keyboardDidOpen() || keyboardDidResize(win)) { setKeyboardOpen(win); } else if (keyboardDidClose(win)) { setKeyboardClose(win); } }; }; /** * Listen for events fired by native keyboard plugin * in Capacitor/Cordova so devs only need to listen * in one place. */ const startNativeListeners = (win) => { win.addEventListener('keyboardDidShow', ev => setKeyboardOpen(win, ev)); win.addEventListener('keyboardDidHide', () => setKeyboardClose(win)); }; const setKeyboardOpen = (win, ev) => { fireKeyboardOpenEvent(win, ev); keyboardOpen = true; }; const setKeyboardClose = (win) => { fireKeyboardCloseEvent(win); keyboardOpen = false; }; /** * Returns `true` if the `keyboardOpen` flag is not * set, the previous visual viewport width equal the current * visual viewport width, and if the scaled difference * of the previous visual viewport height minus the current * visual viewport height is greater than KEYBOARD_THRESHOLD * * We need to be able to accommodate users who have zooming * enabled in their browser (or have zoomed in manually) which * is why we take into account the current visual viewport's * scale value. */ const keyboardDidOpen = () => { const scaledHeightDifference = (previousVisualViewport.height - currentVisualViewport.height) * currentVisualViewport.scale; return (!keyboardOpen && previousVisualViewport.width === currentVisualViewport.width && scaledHeightDifference > KEYBOARD_THRESHOLD); }; /** * Returns `true` if the keyboard is open, * but the keyboard did not close */ const keyboardDidResize = (win) => { return keyboardOpen && !keyboardDidClose(win); }; /** * Determine if the keyboard was closed * Returns `true` if the `keyboardOpen` flag is set and * the current visual viewport height equals the * layout viewport height. */ const keyboardDidClose = (win) => { return keyboardOpen && currentVisualViewport.height === win.innerHeight; }; /** * Dispatch a keyboard open event */ const fireKeyboardOpenEvent = (win, nativeEv) => { const keyboardHeight = nativeEv ? nativeEv.keyboardHeight : win.innerHeight - currentVisualViewport.height; const ev = new CustomEvent(KEYBOARD_DID_OPEN, { detail: { keyboardHeight } }); win.dispatchEvent(ev); }; /** * Dispatch a keyboard close event */ const fireKeyboardCloseEvent = (win) => { const ev = new CustomEvent(KEYBOARD_DID_CLOSE); win.dispatchEvent(ev); }; /** * Given a window object, create a copy of * the current visual and layout viewport states * while also preserving the previous visual and * layout viewport states */ const trackViewportChanges = (win) => { previousVisualViewport = Object.assign({}, currentVisualViewport); currentVisualViewport = copyVisualViewport(win.visualViewport); }; /** * Creates a deep copy of the visual viewport * at a given state */ const copyVisualViewport = (visualViewport) => { return { width: Math.round(visualViewport.width), height: Math.round(visualViewport.height), offsetTop: visualViewport.offsetTop, offsetLeft: visualViewport.offsetLeft, pageTop: visualViewport.pageTop, pageLeft: visualViewport.pageLeft, scale: visualViewport.scale }; }; /***/ }) }]); //# sourceMappingURL=keyboard-dd970efc-js-es2015.js.map
'use strict'; const express = require('express'); const jwt = require('jsonwebtoken'); const passport = require('passport'); const router = express.Router(); require('../config/passport')(passport); const msg = require('../config/msg'); const Adza_Profile = require('../models').Adza_Profile; const Buyer_Profile = require('../models').Buyer_Profile; const Review = require('../models').Review; // get reviews for Special Adza router.get('/:AdzaProfileId', passport.authenticate('jwt', {session: false}), function(req, res) { var AdzaProfileId = req.params.AdzaProfileId; Review .findAll({where:{AdzaProfileId: AdzaProfileId}}) .then(function( reviews ) { if( reviews.length ) return res.status(201).send({success: true, reviews:reviews}); else return res.status(201).send({success: true, message: msg.noResult }); }) .catch((error) => res.status(500).send({success: false, message: error })) }); // post new review to Adza router.post('/', passport.authenticate('jwt', {session: false}), async function(req, res) { var auth_user = req.user; var buyer = await Buyer_Profile.getBuyerFromUserID( auth_user.id, function(err, profile ){ if( !err ) return profile; else return res.status(400).send( {success: false, message: err }); } ); Review .create({ AdzaProfileId: req.body.AdzaProfileId, BuyerProfileId: buyer.id, review_point: req.body.review_point, review_description: req.body.review_description, review_date: new Date() }) .then(( review ) => res.status(201).send({success: true, review:review})) .catch((error) => res.status(400).send( {success: false, message: error })); }); module.exports = router;
let joke = document.getElementById("fetch_Joke"); let randomJoke = document.getElementById("randomJokeBtn"); let allJokes = document.getElementById("getAllJokesBtn"); joke.addEventListener('submit', function (e) { e.preventDefault(); let jokeByID = document.getElementById("jokeID").value; fetchJokeByID(jokeByID); }); randomJoke.addEventListener('click', function (e) { e.preventDefault(); fetchRandomJoke(); }); allJokes.addEventListener('click', function (e) { e.preventDefault(); fetchAllJokes(); }); function fetchJokeByID(id) { let url = './api/jokes/id/' + id; let selectedJoke = document.getElementById("table_body"); fetch(url) .then(res => res.json()) .then(data => { if (data == null) { selectedJoke.innerHTML = "<tr><td>" + id + "</td><td>Der findes ikke en joke på dette id</td><td></td><td></td></tr>"; } else { let sj = `<tr> <td>${data.id}</td> <td>${data.joke}</td> <td>${data.reference}</td> <td>${data.type}</td> </tr>`; selectedJoke.innerHTML = sj; } }); } function fetchRandomJoke() { let url = './api/jokes/random'; let selectedJoke = document.getElementById("table_body"); fetch(url) .then(res => res.json()) .then(data => { let sj = `<tr> <td>${data.id}</td> <td>${data.joke}</td> <td>${data.reference}</td> <td>${data.type}</td> </tr>`; selectedJoke.innerHTML = sj; }); } function fetchAllJokes() { let url = './api/jokes/all'; let table = document.getElementById("table_body"); fetch(url) .then(res => res.json()) .then(data => { let jokesArray = data.map(joke => `<tr> <td></td> <td>${joke.joke}</td> <td>${joke.reference}</td> <td>${joke.type}</td> </tr>`); table.innerHTML = jokesArray.join(""); }); }
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); tslib_1.__exportStar(require("@styled-icons/crypto/Ary"), exports);
/* global SettingsHelper */ /* global asyncStorage */ /* global Requester */ /* global Commands */ /* global Config */ /* global DUMP */ /* global IAC_API_WAKEUP_REASON_ENABLED_CHANGED */ /* global IAC_API_WAKEUP_REASON_LOGIN */ /* global IAC_API_WAKEUP_REASON_LOGOUT */ /* global IAC_API_WAKEUP_REASON_STALE_REGISTRATION */ /* global IAC_API_WAKEUP_REASON_TRY_DISABLE */ 'use strict'; var FindMyDevice = { _state: null, _registering: false, _refreshingClientID: false, _reply: {}, _registered: false, _registeredHelper: null, _enabled: false, _enabledHelper: null, _loggedIn: false, _currentClientID: '', _currentClientIDHelper: null, _canDisable: false, _canDisableHelper: null, _disableAttempt: false, // There are two situations in which we want to make sure // FMD is alive: // - when it is running client logic that accesses the network; // - when it is executing a command with a duration. // Command wakelocks are managed by individual commands. // For client logic wakelocks, we use the fact that when a network // request succeeds, we'll either update 'findmydevice.registered', // or 'findmydevice.can-disable', or process a command and set // a 'ping' timer, and when it fails, we'll set a timer to retry. // Since each network transaction finishes with either a change // in one of these settings or with a timer, we release the locks // in the observers for the settings and in _scheduleAlarm. _highPriorityWakeLocks: { clientLogic: [], command: [] }, _fxaReady: false, init: function fmd_init() { var self = this; navigator.mozId.watch({ wantIssuer: 'firefox-accounts', audience: Config.audience_url, onready: self._onReady.bind(self), onlogin: self._onLogin.bind(self), onlogout: self._onLogout.bind(self), onerror: self._onFxAError.bind(self) }); this._observeSettings(); }, _observeSettings: function fmd_observe_settings() { var settings = navigator.mozSettings; settings.addObserver('findmydevice.registered', this._onRegisteredChanged.bind(this)); settings.addObserver('findmydevice.enabled', this._onEnabledChanged.bind(this)); settings.addObserver('findmydevice.current-clientid', this._onClientIDChanged.bind(this)); // We only allow disabling Find My Device if the same person // who first enabled it is logged in to FxA, and in that case // 'findmydevice.can-disable' is true. // However, note that FMD doesn't store the user's email address, // but rather a client ID that is derived from the FxA assertion // and stored in this._state.clientid. settings.addObserver('findmydevice.can-disable', this._onCanDisableChanged.bind(this)); }, _onReady: function fmd_fxa_onready() { var self = this; this._loadState(function() { self._initSettings(self._initMessageHandlers.bind(self)); }); this._fxaReady = true; }, _loadState: function fmd_load_state(callback) { var self = this; asyncStorage.getItem('findmydevice-state', function(state) { self._state = state; if (state) { Requester.setHawkCredentials(state.deviceid, state.secret); } callback && callback(); }); }, _initSettings: function fmd_init_settings(callback) { // for each setting we're interested in, create a SettingsHelper, // cache its initial value in a property (e.g., _enabled), and // store the SettingsHelper as another property (e.g., _enabledHelper). var settingsToProperties = { // setting name : property name for cached value 'findmydevice.enabled': '_enabled', 'findmydevice.registered': '_registered', 'findmydevice.current-clientid': '_currentClientID', 'findmydevice.can-disable': '_canDisable' }; var settings = Object.keys(settingsToProperties); var loaded = 0; var totalSettings = Object.keys(settingsToProperties).length; settings.forEach(function(s) { var prop = settingsToProperties[s]; var helper = this[prop + 'Helper'] = SettingsHelper(s); helper.get((function(value) { this[prop] = value; if (++loaded === totalSettings) { callback && callback(); } }).bind(this)); }, this); }, _initMessageHandlers: function fmd_init_message_handlers() { navigator.mozSetMessageHandler('push', (function(message) { DUMP('findmydevice got push notification!'); this._contactServer(); }).bind(this)); navigator.mozSetMessageHandler('push-register', (function(message) { DUMP('findmydevice lost push endpoint, re-registering'); this.beginHighPriority('clientLogic'); this._registeredHelper.set(false); }).bind(this)); navigator.mozSetMessageHandler('alarm', (function(alarm) { DUMP('findmydevice alarm!'); this._contactServer(); this._refreshClientIDIfRegistered(false); }).bind(this)); navigator.mozSetMessageHandler('connection', (function(request) { var port = request.port; port.onmessage = (function(event) { if (request.keyword === 'findmydevice-wakeup') { DUMP('got wake up request'); var reason = event.data; if (reason === IAC_API_WAKEUP_REASON_ENABLED_CHANGED) { DUMP('enabled state changed, trying to reach the server'); this._contactServer(); } else if (reason === IAC_API_WAKEUP_REASON_STALE_REGISTRATION) { DUMP('stale registration, re-registering'); this.beginHighPriority('clientLogic'); this._registeredHelper.set(false); } else if (reason === IAC_API_WAKEUP_REASON_LOGIN) { DUMP('new login, invalidating client id'); this.beginHighPriority('clientLogic'); this._loggedIn = true; this._currentClientIDHelper.set(''); } else if (reason === IAC_API_WAKEUP_REASON_LOGOUT) { DUMP('logout, invalidating client id'); this.beginHighPriority('clientLogic'); this._loggedIn = false; this._currentClientIDHelper.set(''); } else if (reason === IAC_API_WAKEUP_REASON_TRY_DISABLE) { DUMP('refreshing client id and attempting to disable'); this._disableAttempt = true; this._refreshClientIDIfRegistered(true); } return; } if (request.keyword === 'findmydevice-test') { DUMP('got request for test command!'); event.data.testing = true; this._processCommands(event.data); } }).bind(this); }).bind(this)); }, _contactServer: function fmd_contact_server() { this.beginHighPriority('clientLogic'); if (this._registered && this._enabled) { this._replyAndFetchCommands(); } else if (this._registered && !this._enabled) { this._reportDisabled(); } else if (!this._registered && this._enabled) { this._register(); } else { // XXX(ggp) this should never happen, but let's play // it safe and release lock we acquired DUMP('can\'t contact the server while not registered and not enabled!!'); this.endHighPriority('clientLogic'); } }, _reportDisabled: function fmd_report_disabled() { DUMP('reporting disabled'); Requester.post( this._getCommandEndpoint(), {enabled: false}, null, // no need to do anything on success this._handleServerError.bind(this)); }, _register: function fmd_register() { DUMP('findmydevice attempting registration.'); DUMP('registering: ' + this._registering); if (this._registering) { return; } this._registering = true; if (this._state === null) { // We are not registered yet, so we need to give the server a FxA // assertion. Request a fresh one here and continue the registration // process from the login callback. if (!this._loggedIn) { // Can't request() while not logged in, as that would bring up the // FxA dialog. Attempting a first registration while logged out is // theoretically possible (if, for example, a first registration // failed, and this is an alarm-driven re-attempt, and the user logged // out while we slept before this attempt), but it's a very unlikely // corner case. For now, just give up if this happens, but we still // need to notify the user somehow (bug 1013423). this._registering = false; return; } navigator.mozId.request(); } else { // We don't need to send assertions on re-registrations, just rely on // our client ID and HAWK signature to authenticate us. This works even // if we're logged out of FxA, so use null for the assertion. this._continueRegistration(null); } }, _onLogin: function fmd_on_login(assertion) { DUMP('logged in to FxA'); // XXX(ggp) When initializing, we'll process FxA's automatic invocation // of onlogin/onlogout before any IAC message, so use these calls to // initialize _loggedIn. However, when FMD is already running, there's // no guaranteee that onlogin/onlogout will fire before the IAC handler, // so we have dedicated IAC messages (IAC_API_WAKEUP_REASON_LOGIN and // IAC_API_WAKEUP_REASON_LOGOUT) to cover login state changes, and we // use the handlers for these messages to update _loggedIn. this._loggedIn = true; if (this._refreshingClientID) { DUMP('resuming client id refresh'); this._fetchClientID(assertion); } if (!this._enabled || !this._registering) { return; } // We are in the middle of a registration, so continue here this._continueRegistration(assertion); }, _continueRegistration: function fmd_continue_registration(assertion) { var self = this; if (assertion == null && this._state == null) { // this shouldn't happen throw new Error('Trying to register with no assertion and no state!'); } var pushRequest = navigator.push.register(); pushRequest.onsuccess = function fmd_push_handler() { DUMP('findmydevice received push endpoint!'); var endpoint = pushRequest.result; if (self._enabled) { self._requestRegistration(assertion, endpoint); } self._registering = false; }; pushRequest.onerror = function fmd_push_error_handler() { DUMP('findmydevice push request failed!'); self._registering = false; self._scheduleAlarm('retry'); }; }, _requestRegistration: function fmd_request_registration(assertion, endpoint) { var obj = { pushurl: endpoint, accepts: Commands.getEnabledCommands() }; if (assertion != null) { obj.assert = assertion; } if (this._state !== null) { obj.deviceid = this._state.deviceid; } var self = this; Requester.post('/register/', obj, function(response) { DUMP('findmydevice successfully registered: ', response); asyncStorage.setItem('findmydevice-state', response, function() { self._registeredHelper.set(true); }); }, this._handleServerError.bind(this)); }, _onLogout: function fmd_fxa_onlogout() { DUMP('logged out of FxA'); this._loggedIn = false; }, _onFxAError: function fmd_on_error(error) { DUMP('FxA error: ' + error); if (!this._fxaReady) { // FIXME(ggp) workaround for bug 1040935, if FxA errors out // while we are initializing (usually due to an unverified // account), just give up for now. window.close(); } if (this._refreshingClientID) { this._cancelClientIDRefresh(); } this._scheduleAlarm('retry'); }, _cancelClientIDRefresh: function fmd_cancel_clientid_refresh() { this._disableAttempt = false; this._refreshingClientID = false; // If we've been woken up by the Settings app because of a disable // attempt, it expects us to change these two settings at the end // of the operation, so set them to their current values if we're // canceling to make sure the state in the Settings is updated // properly. this._enabledHelper.set(this._enabled); this._currentClientIDHelper.set(this._currentClientID); // XXX(ggp) no need to unlock the 'currentClient' lock here, let // _onClientIDChanged do it for us }, _scheduleAlarm: function fmd_schedule_alarm(mode) { var nextAlarm = new Date(); if (mode === 'ping') { // this is just a regular ping to the server to make // sure we're still registered, so use a long interval nextAlarm.setHours(nextAlarm.getHours() + 6); } else if (mode === 'retry') { // something went wrong when registering or talking to the // server, we should check back shortly var interval = 1 + Math.floor(5 * Math.random()); nextAlarm.setMinutes(nextAlarm.getMinutes() + interval); } else { DUMP('invalid alarm mode!'); return; } var self = this; var request = navigator.mozAlarms.getAll(); request.onsuccess = function fmd_alarms_get_all() { this.result.forEach(function(alarm) { navigator.mozAlarms.remove(alarm.id); }); var data = {type: 'findmydevice-alarm'}; var request = navigator.mozAlarms.add(nextAlarm, 'honorTimezone', data); request.onsuccess = function() { self.endHighPriority('clientLogic'); }; }; }, _replyAndFetchCommands: function fmd_reply_and_fetch() { this._reply.has_passcode = Commands.deviceHasPasscode(); Requester.post( this._getCommandEndpoint(), this._reply, this._processCommands.bind(this), this._handleServerError.bind(this)); this._reply = {}; }, _onRegisteredChanged: function fmd_registered_changed(event) { this._registered = event.settingValue; DUMP('registered: ' + this._registered); if (!this._registered) { this._contactServer(); this.endHighPriority('clientLogic'); } else { this._loadState((function() { this._contactServer(); this._currentClientIDHelper.set(this._state.clientid); // XXX(ggp) since every re-registration causes a change in the // client id, we don't need to release the 'clientLogic' lock // here, let _onCanDisableChanged do it }).bind(this)); } }, _onEnabledChanged: function fmd_enabled_changed(event) { // No need to contact the server here if we've been enabled, // since that means we'll get a wake up request from the System // app this._enabled = event.settingValue; DUMP('enabled: ' + this._enabled); }, _onClientIDChanged: function fmd_client_id_changed(event) { this._currentClientID = event.settingValue; DUMP('current id set to: ', this._currentClientID); if (this._loggedIn && this._currentClientID === '') { this._refreshClientIDIfRegistered(false); this.endHighPriority('clientLogic'); } else if (this._registered) { this._canDisableHelper.set( this._loggedIn && this._currentClientID === this._state.clientid); } }, _onCanDisableChanged: function fmd_can_disable_changed(event) { if (event.settingValue === true && this._disableAttempt) { this._enabledHelper.set(false); } this._disableAttempt = false; this.endHighPriority('clientLogic'); }, _refreshClientIDIfRegistered: function fmd_refresh_client_id(forceReauth) { DUMP('refreshing client id if registered and logged in: ', {registered: this._registered, loggedIn: this._loggedIn}); if (!this._registered || !this._loggedIn) { return; } DUMP('requesting assertion to refresh client id, forceReauth: ' + forceReauth); this.beginHighPriority('clientLogic'); this._refreshingClientID = true; var mozIdRequestOptions = {}; if (forceReauth) { mozIdRequestOptions.refreshAuthentication = 0; mozIdRequestOptions.oncancel = this._cancelClientIDRefresh.bind(this); } navigator.mozId.request(mozIdRequestOptions); }, _fetchClientID: function fmd_fetch_client_id(assertion) { Requester.post('/validate/', {assert: assertion}, this._onClientIDResponse.bind(this), this._onClientIDServerError.bind(this)); this._refreshingClientID = false; }, _onClientIDResponse: function fmd_on_client_id(response) { DUMP('got clientid reponse: ', response); if (response.valid) { this._currentClientIDHelper.set(response.uid); return; } DUMP('failed to verify assertion for client id!'); this._scheduleAlarm('retry'); }, _onClientIDServerError: function fmd_on_client_id_error(err) { DUMP('failed to fetch client id with status: ' + err.status); this._scheduleAlarm('retry'); this._disableAttempt = false; }, _processCommands: function fmd_process_commands(cmdobj) { if (cmdobj === null) { return; } // only do something if enabled, but bypass this check // while testing if (!this._enabled && cmdobj.testing !== true) { return; } function noop() {} // callback for testing for (var cmd in cmdobj) { // map server (short) commands to methods in the // commands object, and parse the arguments. var argsObj = cmdobj[cmd], command, args; switch (cmd) { case 't': command = 'track'; args = [parseInt(argsObj.d, 10)]; break; case 'e': command = 'erase'; args = []; break; case 'l': command = 'lock'; args = [argsObj.m, argsObj.c]; break; case 'r': command = 'ring'; args = [parseInt(argsObj.d, 10)]; break; default: this._replyCallback(cmd, false, 'command not available'); return; } DUMP('command ' + cmd + ', args ' + JSON.stringify(args)); // add the callback as the last argument if (cmdobj.testing !== true) { args.push(this._replyCallback.bind(this, cmd)); } else { args.push(noop); } Commands.invokeCommand(command, args); } this._scheduleAlarm('ping'); }, _handleServerError: function fmd_handle_server_error(err) { DUMP('findmydevice request failed with status: ' + err.status); if (err.status === 401 && this._registered) { this._registeredHelper.set(false); } else { this._scheduleAlarm('retry'); } }, _replyCallback: function fmd_reply(cmd, ok, retval) { var value = {ok: ok}; if (cmd === 't' && ok === true && retval !== undefined) { value.la = retval.coords.latitude; value.lo = retval.coords.longitude; value.acc = retval.coords.accuracy; value.ti = retval.timestamp; } else if (ok === false) { value.error = retval; } this._reply[cmd] = value; this._contactServer(); }, _getCommandEndpoint: function fmd_get_command_endpoint() { return '/cmd/' + this._state.deviceid; }, beginHighPriority: function(reason) { DUMP('begin high priority section, reason: ', reason); if (Object.keys(this._highPriorityWakeLocks).indexOf(reason) === -1) { DUMP('unknown reason for high priority section?!'); return; } DUMP('acquiring one wakelock, wakelocks are: ', this._highPriorityWakeLocks); this._highPriorityWakeLocks[reason].push( navigator.requestWakeLock('high-priority')); }, endHighPriority: function(reason) { DUMP('end high priority section, reason: ', reason); if (!this._highPriorityWakeLocks[reason]) { return; } DUMP('releasing one wakelock, wakelocks are: ', this._highPriorityWakeLocks); this._highPriorityWakeLocks[reason].pop().unlock(); } }; navigator.mozL10n.once(FindMyDevice.init.bind(FindMyDevice));
import * as shell from 'shelljs'; import { prompt } from '@pyramation/prompt'; import dargs from 'dargs'; const glob = require('glob').sync; const fs = require('fs'); const path = require('path'); const mkdirp = require('mkdirp'); const repo = 'git@github.com:coolir/tmpl-ts-npm-module.git'; const clone = async argv => { if (!shell.which('git')) { shell.echo('Sorry, this script requires git'); return shell.exit(1); } const { name } = argv; shell.exec(`git clone ${repo} ${name}`); shell.cd(name); const questions = JSON.parse(fs.readFileSync(`.questions.json`)); const fullname = shell .exec('git config --global user.name', { silent: true }) .trim(); const email = shell .exec('git config --global user.email', { silent: true }) .trim(); // @__USERNAME__/__MODULENAME__ // __PACKAGE_IDENTIFIER__ const args = dargs( { _: [], ...argv, __MODULENAME__: name, __USERFULLNAME__: fullname, __USEREMAIL__: email, }, { allowCamelCase: true } ); const results = await prompt(questions, args); let scopedResults; const license = await prompt( [ { name: '__LICENSE__', message: 'Which license?', choices: ['MIT', 'closed'], type: 'list', required: true, }, ], [] ); if (results.__ACCESS__ === 'public') { scopedResults = await prompt( [ { type: 'confirm', name: 'scoped', message: 'use npm scopes?', required: true, }, ], [] ); } const files = [] .concat(glob(process.cwd() + '/**/.*')) .concat(glob(process.cwd() + '/**/*')); for (let i = 0; i < files.length; i++) { const templateFile = files[i]; if (fs.lstatSync(templateFile).isDirectory()) continue; let content = fs.readFileSync(templateFile).toString(); if ( path.basename(templateFile) === 'LICENSE' && license.__LICENSE__ === 'closed' ) { content = `Copyright (c) 2020 __USERFULLNAME__ <__USEREMAIL__> - All Rights Reserved Unauthorized copying via any medium is strictly prohibited Proprietary and confidential`; } Object.keys(results).forEach(key => { if (/^__/.test(key)) { content = content.replace(new RegExp(key, 'g'), results[key]); } }); if (results.__ACCESS__ === 'public') { if (scopedResults.scoped) { content = content.replace( /__PACKAGE_IDENTIFIER__/g, `@${results.__USERNAME__}/${results.__MODULENAME__}` ); } else { content = content.replace( /__PACKAGE_IDENTIFIER__/g, `${results.__MODULENAME__}` ); } } else { content = content.replace( /__PACKAGE_IDENTIFIER__/g, `@${results.__USERNAME__}/${results.__MODULENAME__}` ); } if (path.basename(templateFile) === 'README.md') { content = `# ${results.__MODULENAME__}`; } fs.writeFileSync(templateFile, content); } shell.rm('-rf', '.git'); shell.rm('-rf', '.questions.json'); console.log(` ||| (o o) ooO--(_)--Ooo- ✨ Great work! `); }; clone.questions = [ { name: 'name', message: 'Enter your new module name', required: true, }, ]; export { clone };
const {remote, ipcRenderer} = require('electron') const fs = require('fs') const path = require('path') const $ = window.$ /* ██████ ██████ ██████ ████████ ██████ ████████ ██ ██ ██████ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██████ ██ ██ ██ ██ ██ ██ ████ ██████ █████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██ ██████ ██ ██ ██ ███████ */ // <region> Prototype /** * Gets a string's title * @return {string} The titled string */ String.prototype.toTitleCase = function () { return this.toLowerCase().split(' ').map(function (word) { return `${(word.charAt(0).toUpperCase())}${(word.slice(1))}` }).join(' ') } /** * Sorts a table based on column content * @param {element} tbl The table to sort * @param {integer} n The number column to sort by */ async function sortTable (tbl, n) { var rows, i, x, y, shouldSwitch var switchCount = 0 var switching = true var dir = 'asc' while (switching) { switching = false rows = tbl.getElementsByTagName('tr') for (i = 1; i < rows.length - 1; i++) { shouldSwitch = false x = rows[i].getElementsByTagName('td')[n].innerHTML x = isNaN(x) ? x.toLowerCase() : parseFloat(x) y = rows[i + 1].getElementsByTagName('td')[n].innerHTML y = isNaN(y) ? y.toLowerCase() : parseFloat(y) if (dir === 'asc') { if (x > y) { shouldSwitch = true break } } else if (dir === 'desc') { if (x < y) { shouldSwitch = true break } } } if (shouldSwitch) { rows[i].parentNode.insertBefore(rows[i + 1], rows[i]) switching = true switchCount++ } else { if (switchCount === 0 && dir === 'asc') { dir = 'desc' switching = true } } } } // </region> /* ██████ ██ ██ ██ ██ ██████ ███████ ██████ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██ ██ ██ ██ ██ ██ █████ ██████ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██████ ██ ███████ ██████ ███████ ██ ██ ███████ */ // <region> Builders /** * Constructs the main content of the site * @param {object} div The div to render */ function buildContents (div) { $('#main-content').get(0).innerHTML += '<div></div>' let par = $('#main-content div').get(-1) for (let prt of div) { let add = '' switch (prt.proton) { case 'textbox': add = `<p>${prt.text.join('</p><p>')}</p></div>` break case 'list': if (prt.group !== undefined) { let groups = {} add = `<table>` for (let li of prt.items) { if (groups[li[prt.group]] === undefined) { groups[li[prt.group]] = [] } groups[li[prt.group]].push(li) } for (var g in groups) { if (groups.hasOwnProperty(g)) { add += `<tr><td colspan="${Object.keys(prt.header).length - 1}"><h3>${g}</h3></td></tr>` add += `<tr><th>${prt.header.slice(prt.group + 1).join('</th><th>')}</th></tr>` for (let li of groups[g]) { add += `<tr><td>${li.slice(prt.group + 1).join('</td><td>')}</td></tr>` } } } add += `</table>` } else { add = `<table><thead><tr><th>${prt.header.join('</th><th>')}</th></tr></thead><tbody>` for (let li of prt.items) { add += `<tr><td>${li.join('</td><td>')}</td></tr>` } add += `</tbody></table>` } break } par.innerHTML += ` <div class="proton-${prt.proton}"> <h2 class="text-title">${prt.title}</h2> <hr> ${add} </div> ` } } // </region> /* ███████ ██████ ██ ████████ ██████ █████ ██████ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █████ ██ ██ ██ ██ ██████ ███████ ██ ███ █████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██████ ██ ██ ██ ██ ██ ██████ ███████ */ // <region> Edit Page /** * Sets the site's viewing mode * @param {string} md The viewing mode */ async function setSiteMode (md) { let disp, func, elms window.site.mode = 'view' disp = 'add' func = newSite // XXX: Editing it too much for me to do // if (site.editable) { // site.mode = md // disp = md === 'view' ? 'edit' : 'pageview' // func = function () {setSiteMode(md === 'view' ? 'edit' : 'view')} // } else { // site.mode = 'view' // disp = 'add' // func = newSite // } if (window.site.mode === 'edit') { engageEditMode() } else { disengageEditMode() } $('#site-mode').html(disp) $('#site-mode').each(function () { this.onclick = func} ) } function engageEditMode () { $('#site-title').css('cursor', 'pointer') $('#site-title').click(function () { window.edit = { ref: window.site, path: 'window.site' } $('#edit-form').append(` <div class="input-group"> <input id="submit-title" name="title" type="text" value="${window.site.title}" required> <label for="submit-title">Title</label> <div class="input-bar"></div> </div> <input type="button" class="edit-button" value="Submit" onclick="stopEdit(0)"> <input type="button" class="edit-button" value="Cancel" onclick="stopEdit(1)"> `) showOverlay() }) $('#site-links').append(`<a href="javascript:newNodeLink()" style="font-family:'Material Icons'">add</a>`) } function disengageEditMode () { $('#site-title').css('cursor', '') $('#site-title').click(function () {}) $('#site-links a:last-child').remove() } /** * Hides the overlay */ function hideOverlay () { $('#edit-overlay').addClass('hidden') setTimeout(function () { $('#edit-overlay').addClass('gone') $('#edit-form').html('') }, 550) } /** * Shows the overlay */ function showOverlay () { $('#edit-overlay.hidden').removeClass('gone') $('#edit-overlay').removeClass('hidden') } /** * Quits editing and save * @param {boolean} success Whether or not the user cancelled */ function stopEdit (code) { let tsite = {} for (var prop in window.site) { if (window.site.hasOwnProperty(prop)) { tsite[prop] = window.site[prop] } } delete tsite.name delete tsite.src delete tsite.mode if (code === 0) { if (window.edit !== undefined && window.site.editable) { $('#edit-form .input-group').each(function () { let k = this.children[1].innerText.toLowerCase() let v = this.children[0].value window.edit.ref[k] = v }) } else if (window.site.editable === false) { console.log('<FileEdit> User attempted to edit a non-editable file!') } else { console.log('<FileEdit> Edit confirmed but no selected node.') } } else if (code === 1) { console.log('<FileEdit> User began to edit a node, but cancelled.') } else if (code === 2) { // HACK: The deletion code uses an exact copy of the data structure (can be duplicants) tsite = JSON.parse(JSON.stringify(tsite).replace(JSON.stringify(window.edit.ref), '')) } if (code !== 1) { fs.writeFile(window.site.src, JSON.stringify(tsite), function (e) { if (e) { throw e } }) console.log('<FileEdit> File has been updated, now refreshing') } siteEmpty(false); siteLoad() hideOverlay() } /** * Generates a node edit form * @param {object} path The node's path * @param {boolean} del Whether or not the node is deleteable */ function editNode (path, del = true) { window.edit = { ref: eval(path), path: path } for (var prop in window.edit.ref) { if (window.edit.ref.hasOwnProperty(prop)) { $('#edit-form').append(` <div class="input-group"> <input id="submit-${prop}" name="${prop}" type="text" value="${window.edit.ref[prop]}" required> <label for="submit-${prop}">${prop.toTitleCase()}</label> <div class="input-bar"></div> </div> `) } } $('#edit-form').append(` <input type="button" class="edit-button" value="Submit" onclick="stopEdit(0)"> <input type="button" class="edit-button" value="Cancel" onclick="stopEdit(1)"> ${del ? '<input type="button" class="edit-button" value="Delete" onclick="stopEdit(2)">' : ''} `) showOverlay() } // </region> /* ███ ██ ███████ ██ ██ ██████ ██████ ███ ██ ████████ ███████ ███ ██ ████████ ████ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ████ ██ ██ ██ ██ ██ █████ ██ █ ██ ██ ██ ██ ██ ██ ██ ██ █████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ███████ ███ ███ ██████ ██████ ██ ████ ██ ███████ ██ ████ ██ */ // <region> New Content /** * Creates a new site * @param {boolean} success Whether or not the user cancelled */ function crtSite (success) { if (success) { let tsite = {} let dsite = { editable: 'true', links: [], contents: [[ { proton: 'textbox', title: 'Fresh Site', text: [ 'This is a brand-new site. Please use a JSON program to edit this site.' ] } ]] } $('#edit-form .input-group').each(function () { let k = this.children[1].innerText.toLowerCase() let v = this.children[0].value tsite[k] = v }) dsite.title = tsite.title try { fs.writeFileSync(path.join(window.userData, 'sites', `${tsite.codename}.json`), JSON.stringify(dsite)) } catch (e) { throw e } } fs.readdir(path.join(window.userData, 'sites'), function (e, f) { if (e) { throw e } window.subsites = f changeSite(window.site.name) hideOverlay() }) } /** * Generates a new site form */ async function newSite () { let ns = {codename: '', title: ''} for (var prop in ns) { if (ns.hasOwnProperty(prop)) { $('#edit-form').append(` <div class="input-group"> <input id="submit-${prop}" name="${prop}" type="text" value="${ns[prop]}" required> <label for="submit-${prop}">${prop.toTitleCase()}</label> <div class="input-bar"></div> </div> `) } } $('#edit-form').append(` <input type="button" class="edit-button" value="Submit" onclick="crtSite(true)"> <input type="button" class="edit-button" value="Cancel" onclick="crtSite(false)"> `) showOverlay() } /** * Create a new link */ async function newNodeLink () { window.site.links.push( { display: 'New Link', link: 'http://example.com/' } ) editNode(`window.site.links[${eval(window.site.links.length - 1)}]`, true) } // </region> /* ██ ██████ █████ ██████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██████ ██ ██ ██████ */ // <region> Load $(function () { window.settings = Object.assign({}, remote.getGlobal('settings')) window.subsites = Object.assign({}, remote.getGlobal('subsites')) window.site = Object.assign({}, remote.getGlobal('site')) window.userData = remote.app.getPath('userData') fs.readdir(path.join(window.userData, 'sites'), function (e, f) { if (e) { throw e } window.subsites = f }) setupIpc() changeSite(window.site.name) }) /** * Configures IPC for renderer */ function setupIpc () { ipcRenderer.send('ipcReady') } /** * Changes the active site * @param {string} name The new site's name */ function changeSite (name) { window.site.src = path.join(window.userData, 'sites', `${name}.json`) if (name === 'home') { window.site.src = path.join(__dirname, 'home.json') } $.getJSON(window.site.src, (d) => { window.site = Object.assign({src: window.site.src}, d) window.site.name = name if (window.site.script) { eval(window.site.script.join('\n')) } siteEmpty(); siteLoad() ipcRenderer.send('siteChange', window.site) }) } /** * Empties the current site's contents */ function siteEmpty (res = true) { if (res) { setSiteMode('view') } $('#site-links').html('') $('#site-title').html('') $('#main-content').html('') } /** * Renders the new site */ function siteLoad () { document.title = `GameDay - ${window.site.title}` $('#site-title').html(window.site.title) if (window.site.name !== 'home') { $('.flex-header #site-links').append('<a href="javascript:changeSite(\'home\')" data-edit="false">GameDay Home</a>') } for (let a of window.site.links) { $('.flex-header #site-links').append(`<a href="${a.link}">${a.display}</a>`) } for (let div of window.site.contents) { buildContents(div) } protonsLoad() if (window.site.mode === 'edit') { engageEditMode() } } /** * Handles the different protons */ function protonsLoad () { $('.proton-list span.sortable').click(function () { sortTable($(this).parents('table').get(0), $(this).parent().index()) this.innerHTML = this.innerHTML === '▼' ? '▲' : '▼' }) $('a').click(function (e) { if (window.site.mode === 'edit' && !this.dataset.edit) { if ($(this).parent().get(0) === $('#site-links').get(0)) { editNode(`window.site.links[${eval($(this).index()-1)}]`) } e.preventDefault() } else { if (this.href.startsWith('http')) { remote.shell.openExternal(this.href) e.preventDefault() } } }) } // </region>
import { moduleFor, test } from 'ember-qunit'; moduleFor('route:store/orders', 'Unit | Route | store/orders', { // Specify the other units that are required for this test. // needs: ['controller:foo'] }); test('it exists', function(assert) { var route = this.subject(); assert.ok(route); });
import React from 'react' import Navbar from './Navbar' import '../styles/global.scss' const Layout = (props) => { return ( <> <Navbar /> <span>Load me</span> {props.children} </> ) } export default Layout
/* eslint-disable fp/no-nil, fp/no-unused-expression */ /** * External dependencies. */ const R = require('ramda') /** * Internal dependencies. */ const getYoutubeDirectUrl = require('./core/get-youtube-direct-url') const getYoutubeDirectUrlForMany = async ids => { const youTubeIds = ids.split(',') const uniqueIds = [...new Set(youTubeIds)] const promises = uniqueIds.map(id => getYoutubeDirectUrl(id) .then(res => ({ [id]: res.url })) .catch(error => { console.log(`Error fetching for ID ${id}`) return { [id]: null, error } }) ) const response = await Promise.all(promises) const returnPayload = R.o(R.reduce(R.mergeRight, {}), R.reject(R.has('error')))(response) return returnPayload } /** * For a collection of "things" - for example, ALL videos. * None currently supported. */ const collectionHandlers = { GET: getYoutubeDirectUrlForMany } /** * For a singular "thing" - for example, ONE video. * Only `GET` currently supported. */ const itemHandlers = { GET: getYoutubeDirectUrl } module.exports = { itemHandlers, collectionHandlers }
export { default } from 'ember-metrics/metrics-adapters/mixpanel';
// core import React, { Component } from 'react' import { connect } from 'react-redux' import PropTypes from 'prop-types' import { withRouter } from 'react-router-dom' // assets // components import Menu from '@material-ui/core/Menu' import MenuItem from '@material-ui/core/MenuItem' import ListItemIcon from '@material-ui/core/ListItemIcon' import ListItemText from '@material-ui/core/ListItemText' import Divider from '@material-ui/core/Divider' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { plMemberAlt, plKey, plExit, psCaretDown, plDraft } from '@pgyer/icons' import { withStyles } from '@material-ui/core/styles' import Avatar from '@material-ui/core/Avatar' import Typography from '@material-ui/core/Typography' import Constants from 'APPSRC/config/Constants' import { injectIntl } from 'react-intl' // style const styles = theme => ({ settings: { display: 'flex', alignItems: 'center', cursor: 'pointer' }, menu: { width: theme.spacing(30), marginTop: theme.spacing(1), padding: 0 }, list: { '& > li': { height: theme.spacing(5) }, '& > hr': { marginTop: theme.spacing(1), marginBottom: theme.spacing(1) } }, name: { opacity: '1 !important', display: 'block', height: 'auto !important' }, icon: { width: theme.spacing(4), height: theme.spacing(4) }, down: { marginLeft: theme.spacing(2), fontSize: theme.spacing(1) } }) class UserOption extends Component { constructor (props) { super(props) this.state = { anchorEl: null } this.handleUserMenuClick = this.handleUserMenuClick.bind(this) this.handleUserMenuClose = this.handleUserMenuClose.bind(this) this.logout = this.logout.bind(this) } handleUserMenuClick (event) { this.setState({ anchorEl: event.currentTarget }) } handleUserMenuClose () { this.setState({ anchorEl: null }) } logout () { this.setState({ anchorEl: null }) window.location.href = '/user/logout' } goView (path) { this.setState({ anchorEl: null }) this.props.history.push(path) } render () { const { currentUserInfo, classes, className, intl } = this.props return ( <React.Fragment> <div className={[classes.settings, className].join(' ')} onClick={this.handleUserMenuClick}> <Avatar src={Constants.HOSTS.PGYER_AVATAR_HOST + currentUserInfo.icon} className={classes.icon} /> <FontAwesomeIcon icon={psCaretDown} className={classes.down} /> </div> <Menu id='user-menu' anchorEl={this.state.anchorEl} open={Boolean(this.state.anchorEl)} onClose={this.handleUserMenuClose} anchorOrigin={{ horizontal: 'right', vertical: 'bottom' }} transformOrigin={{ horizontal: 'right', vertical: 'top' }} PaperProps={{ className: classes.menu }} MenuListProps={{ className: classes.list }} getContentAnchorEl={null} transitionDuration={0} > <MenuItem disabled className={classes.name}> <Typography variant='h6' component='div'> { currentUserInfo.name } </Typography> <Typography variant='body2' component='div'> { currentUserInfo.email } </Typography> </MenuItem> <Divider /> <MenuItem onClick={(ev) => { this.goView('/settings/profile') }}> <ListItemIcon> <FontAwesomeIcon icon={plMemberAlt} /> </ListItemIcon> <ListItemText disableTypography primary={intl.formatMessage({ id: 'menu.profile' })} /> </MenuItem> <MenuItem onClick={(ev) => { this.goView('/settings/email') }}> <ListItemIcon> <FontAwesomeIcon icon={plDraft} /> </ListItemIcon> <ListItemText disableTypography primary={intl.formatMessage({ id: 'menu.mail' })} /> </MenuItem> <MenuItem onClick={(ev) => { this.goView('/settings/sshkey') }}> <ListItemIcon> <FontAwesomeIcon icon={plKey} /> </ListItemIcon> <ListItemText disableTypography primary={intl.formatMessage({ id: 'menu.SSHKey_pl' })} /> </MenuItem> <Divider /> <MenuItem onClick={this.logout}> <ListItemIcon> <FontAwesomeIcon icon={plExit} /> </ListItemIcon> <ListItemText disableTypography primary={intl.formatMessage({ id: 'menu.logout' })} /> </MenuItem> </Menu> </React.Fragment> ) } } UserOption.propTypes = { history: PropTypes.object.isRequired, classes: PropTypes.object.isRequired, className: PropTypes.string, currentUserInfo: PropTypes.object.isRequired, intl: PropTypes.object.isRequired } const mapStateToProps = (state, ownProps) => { return { currentUserInfo: state.DataStore.currentUserInfo } } const mapDispatchToProps = (dispatch, ownProps) => { return { dispatchEvent: (event) => { dispatch(event) } } } export default injectIntl( withStyles(styles)( withRouter( connect(mapStateToProps, mapDispatchToProps)( UserOption ) ) ) )
if(!dojo._hasResource["dojox.off.ui"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. dojo._hasResource["dojox.off.ui"] = true; dojo.provide("dojox.off.ui"); dojo.require("dojox.storage.Provider"); dojo.require("dojox.storage.manager"); dojo.require("dojox.storage.GearsStorageProvider"); // Author: Brad Neuberg, bkn3@columbia.edu, http://codinginparadise.org // summary: // dojox.off.ui provides a standard, // default user-interface for a // Dojo Offline Widget that can easily // be dropped into applications that would // like to work offline. dojo.mixin(dojox.off.ui, { // appName: String // This application's name, such as "Foobar". Note that // this is a string, not HTML, so embedded markup will // not work, including entities. Only the following // characters are allowed: numbers, letters, and spaces. // You must set this property. appName: "setme", // autoEmbed: boolean // For advanced usage; most developers can ignore this. // Whether to automatically auto-embed the default Dojo Offline // widget into this page; default is true. autoEmbed: true, // autoEmbedID: String // For advanced usage; most developers can ignore this. // The ID of the DOM element that will contain our // Dojo Offline widget; defaults to the ID 'dot-widget'. autoEmbedID: "dot-widget", // runLink: String // For advanced usage; most developers can ignore this. // The URL that should be navigated to to run this // application offline; this will be placed inside of a // link that the user can drag to their desktop and double // click. Note that this URL must exactly match the URL // of the main page of our resource that is offline for // it to be retrieved from the offline cache correctly. // For example, if you have cached your main page as // http://foobar.com/index.html, and you set this to // http://www.foobar.com/index.html, the run link will // not work. By default this value is automatically set to // the URL of this page, so it does not need to be set // manually unless you have unusual needs. runLink: window.location.href, // runLinkTitle: String // For advanced usage; most developers can ignore this. // The text that will be inside of the link that a user // can drag to their desktop to run this application offline. // By default this is automatically set to "Run " plus your // application's name. runLinkTitle: "Run Application", // learnHowPath: String // For advanced usage; most developers can ignore this. // The path to a web page that has information on // how to use this web app offline; defaults to // src/off/ui-template/learnhow.html, relative to // your Dojo installation. Make sure to set // dojo.to.ui.customLearnHowPath to true if you want // a custom Learn How page. learnHowPath: dojo.moduleUrl("dojox", "off/resources/learnhow.html"), // customLearnHowPath: boolean // For advanced usage; most developers can ignore this. // Whether the developer is using their own custom page // for the Learn How instructional page; defaults to false. // Use in conjunction with dojox.off.ui.learnHowPath. customLearnHowPath: false, htmlTemplatePath: dojo.moduleUrl("dojox", "off/resources/offline-widget.html").uri, cssTemplatePath: dojo.moduleUrl("dojox", "off/resources/offline-widget.css").uri, onlineImagePath: dojo.moduleUrl("dojox", "off/resources/greenball.png").uri, offlineImagePath: dojo.moduleUrl("dojox", "off/resources/redball.png").uri, rollerImagePath: dojo.moduleUrl("dojox", "off/resources/roller.gif").uri, checkmarkImagePath: dojo.moduleUrl("dojox", "off/resources/checkmark.png").uri, learnHowJSPath: dojo.moduleUrl("dojox", "off/resources/learnhow.js").uri, _initialized: false, onLoad: function(){ // summary: // A function that should be connected to allow your // application to know when Dojo Offline, the page, and // the Offline Widget are all initialized and ready to be // used: // // dojo.connect(dojox.off.ui, "onLoad", someFunc) }, _initialize: function(){ //console.debug("dojox.off.ui._initialize"); // make sure our app name is correct if(this._validateAppName(this.appName) == false){ alert("You must set dojox.off.ui.appName; it can only contain " + "letters, numbers, and spaces; right now it " + "is incorrectly set to '" + dojox.off.ui.appName + "'"); dojox.off.enabled = false; return; } // set our run link text to its default this.runLinkText = "Run " + this.appName; // setup our event listeners for Dojo Offline events // to update our UI dojo.connect(dojox.off, "onNetwork", this, "_onNetwork"); dojo.connect(dojox.off.sync, "onSync", this, "_onSync"); // cache our default UI resources dojox.off.files.cache([ this.htmlTemplatePath, this.cssTemplatePath, this.onlineImagePath, this.offlineImagePath, this.rollerImagePath, this.checkmarkImagePath ]); // embed the offline widget UI if(this.autoEmbed){ this._doAutoEmbed(); } }, _doAutoEmbed: function(){ // fetch our HTML for the offline widget // dispatch the request dojo.xhrGet({ url: this.htmlTemplatePath, handleAs: "text", error: function(err){ dojox.off.enabled = false; err = err.message||err; alert("Error loading the Dojo Offline Widget from " + this.htmlTemplatePath + ": " + err); }, load: dojo.hitch(this, this._templateLoaded) }); }, _templateLoaded: function(data){ //console.debug("dojox.off.ui._templateLoaded"); // inline our HTML var container = dojo.byId(this.autoEmbedID); if(container){ container.innerHTML = data; } // fill out our image paths this._initImages(); // update our network indicator status ball this._updateNetIndicator(); // update our 'Learn How' text this._initLearnHow(); this._initialized = true; // check offline cache settings if(!dojox.off.hasOfflineCache){ this._showNeedsOfflineCache(); return; } // check to see if we need a browser restart // to be able to use this web app offline if(dojox.off.hasOfflineCache && dojox.off.browserRestart){ this._needsBrowserRestart(); return; }else{ var browserRestart = dojo.byId("dot-widget-browser-restart"); if(browserRestart){ browserRestart.style.display = "none"; } } // update our sync UI this._updateSyncUI(); // register our event listeners for our main buttons this._initMainEvtHandlers(); // if offline functionality is disabled, disable everything this._setOfflineEnabled(dojox.off.enabled); // update our UI based on the state of the network this._onNetwork(dojox.off.isOnline ? "online" : "offline"); // try to go online this._testNet(); }, _testNet: function(){ dojox.off.goOnline(dojo.hitch(this, function(isOnline){ //console.debug("testNet callback, isOnline="+isOnline); // display our online/offline results this._onNetwork(isOnline ? "online" : "offline"); // indicate that our default UI // and Dojo Offline are now ready to // be used this.onLoad(); })); }, _updateNetIndicator: function(){ var onlineImg = dojo.byId("dot-widget-network-indicator-online"); var offlineImg = dojo.byId("dot-widget-network-indicator-offline"); var titleText = dojo.byId("dot-widget-title-text"); if(onlineImg && offlineImg){ if(dojox.off.isOnline == true){ onlineImg.style.display = "inline"; offlineImg.style.display = "none"; }else{ onlineImg.style.display = "none"; offlineImg.style.display = "inline"; } } if(titleText){ if(dojox.off.isOnline){ titleText.innerHTML = "Online"; }else{ titleText.innerHTML = "Offline"; } } }, _initLearnHow: function(){ var learnHow = dojo.byId("dot-widget-learn-how-link"); if(!learnHow){ return; } if(!this.customLearnHowPath){ // add parameters to URL so the Learn How page // can customize itself and display itself // correctly based on framework settings var dojoPath = djConfig.baseRelativePath; this.learnHowPath += "?appName=" + encodeURIComponent(this.appName) + "&hasOfflineCache=" + dojox.off.hasOfflineCache + "&runLink=" + encodeURIComponent(this.runLink) + "&runLinkText=" + encodeURIComponent(this.runLinkText) + "&baseRelativePath=" + encodeURIComponent(dojoPath); // cache our Learn How JavaScript page and // the HTML version with full query parameters // so it is available offline without a cache miss dojox.off.files.cache(this.learnHowJSPath); dojox.off.files.cache(this.learnHowPath); } learnHow.setAttribute("href", this.learnHowPath); var appName = dojo.byId("dot-widget-learn-how-app-name"); if(!appName){ return; } appName.innerHTML = ""; appName.appendChild(document.createTextNode(this.appName)); }, _validateAppName: function(appName){ if(!appName){ return false; } return (/^[a-z0-9 ]*$/i.test(appName)); }, _updateSyncUI: function(){ var roller = dojo.byId("dot-roller"); var checkmark = dojo.byId("dot-success-checkmark"); var syncMessages = dojo.byId("dot-sync-messages"); var details = dojo.byId("dot-sync-details"); var cancel = dojo.byId("dot-sync-cancel"); if(dojox.off.sync.isSyncing){ this._clearSyncMessage(); if(roller){ roller.style.display = "inline"; } if(checkmark){ checkmark.style.display = "none"; } if(syncMessages){ dojo.removeClass(syncMessages, "dot-sync-error"); } if(details){ details.style.display = "none"; } if(cancel){ cancel.style.display = "inline"; } }else{ if(roller){ roller.style.display = "none"; } if(cancel){ cancel.style.display = "none"; } if(syncMessages){ dojo.removeClass(syncMessages, "dot-sync-error"); } } }, _setSyncMessage: function(message){ var syncMessage = dojo.byId("dot-sync-messages"); if(syncMessage){ // when used with Google Gears pre-release in Firefox/Mac OS X, // the browser would crash when testing in Moxie // if we set the message this way for some reason. // Brad Neuberg, bkn3@columbia.edu //syncMessage.innerHTML = message; while(syncMessage.firstChild){ syncMessage.removeChild(syncMessage.firstChild); } syncMessage.appendChild(document.createTextNode(message)); } }, _clearSyncMessage: function(){ this._setSyncMessage(""); }, _initImages: function(){ var onlineImg = dojo.byId("dot-widget-network-indicator-online"); if(onlineImg){ onlineImg.setAttribute("src", this.onlineImagePath); } var offlineImg = dojo.byId("dot-widget-network-indicator-offline"); if(offlineImg){ offlineImg.setAttribute("src", this.offlineImagePath); } var roller = dojo.byId("dot-roller"); if(roller){ roller.setAttribute("src", this.rollerImagePath); } var checkmark = dojo.byId("dot-success-checkmark"); if(checkmark){ checkmark.setAttribute("src", this.checkmarkImagePath); } }, _showDetails: function(evt){ // cancel the button's default behavior evt.preventDefault(); evt.stopPropagation(); if(!dojox.off.sync.details.length){ return; } // determine our HTML message to display var html = ""; html += "<html><head><title>Sync Details</title><head><body>"; html += "<h1>Sync Details</h1>\n"; html += "<ul>\n"; for(var i = 0; i < dojox.off.sync.details.length; i++){ html += "<li>"; html += dojox.off.sync.details[i]; html += "</li>"; } html += "</ul>\n"; html += "<a href='javascript:window.close()' " + "style='text-align: right; padding-right: 2em;'>" + "Close Window" + "</a>\n"; html += "</body></html>"; // open a popup window with this message var windowParams = "height=400,width=600,resizable=true," + "scrollbars=true,toolbar=no,menubar=no," + "location=no,directories=no,dependent=yes"; var popup = window.open("", "SyncDetails", windowParams); if(!popup){ // aggressive popup blocker alert("Please allow popup windows for this domain; can't display sync details window"); return; } popup.document.open(); popup.document.write(html); popup.document.close(); // put the focus on the popup window if(popup.focus){ popup.focus(); } }, _cancel: function(evt){ // cancel the button's default behavior evt.preventDefault(); evt.stopPropagation(); dojox.off.sync.cancel(); }, _needsBrowserRestart: function(){ var browserRestart = dojo.byId("dot-widget-browser-restart"); if(browserRestart){ dojo.addClass(browserRestart, "dot-needs-browser-restart"); } var appName = dojo.byId("dot-widget-browser-restart-app-name"); if(appName){ appName.innerHTML = ""; appName.appendChild(document.createTextNode(this.appName)); } var status = dojo.byId("dot-sync-status"); if(status){ status.style.display = "none"; } }, _showNeedsOfflineCache: function(){ var widgetContainer = dojo.byId("dot-widget-container"); if(widgetContainer){ dojo.addClass(widgetContainer, "dot-needs-offline-cache"); } }, _hideNeedsOfflineCache: function(){ var widgetContainer = dojo.byId("dot-widget-container"); if(widgetContainer){ dojo.removeClass(widgetContainer, "dot-needs-offline-cache"); } }, _initMainEvtHandlers: function(){ var detailsButton = dojo.byId("dot-sync-details-button"); if(detailsButton){ dojo.connect(detailsButton, "onclick", this, this._showDetails); } var cancelButton = dojo.byId("dot-sync-cancel-button"); if(cancelButton){ dojo.connect(cancelButton, "onclick", this, this._cancel); } }, _setOfflineEnabled: function(enabled){ var elems = []; elems.push(dojo.byId("dot-sync-status")); for(var i = 0; i < elems.length; i++){ if(elems[i]){ elems[i].style.visibility = (enabled ? "visible" : "hidden"); } } }, _syncFinished: function(){ this._updateSyncUI(); var checkmark = dojo.byId("dot-success-checkmark"); var details = dojo.byId("dot-sync-details"); if(dojox.off.sync.successful == true){ this._setSyncMessage("Sync Successful"); if(checkmark){ checkmark.style.display = "inline"; } }else if(dojox.off.sync.cancelled == true){ this._setSyncMessage("Sync Cancelled"); if(checkmark){ checkmark.style.display = "none"; } }else{ this._setSyncMessage("Sync Error"); var messages = dojo.byId("dot-sync-messages"); if(messages){ dojo.addClass(messages, "dot-sync-error"); } if(checkmark){ checkmark.style.display = "none"; } } if(dojox.off.sync.details.length && details){ details.style.display = "inline"; } }, _onFrameworkEvent: function(type, saveData){ if(type == "save"){ if(saveData.status == dojox.storage.FAILED && !saveData.isCoreSave){ alert("Please increase the amount of local storage available " + "to this application"); if(dojox.storage.hasSettingsUI()){ dojox.storage.showSettingsUI(); } // FIXME: Be able to know if storage size has changed // due to user configuration } }else if(type == "coreOperationFailed"){ console.log("Application does not have permission to use Dojo Offline"); if(!this._userInformed){ alert("This application will not work if Google Gears is not allowed to run"); this._userInformed = true; } }else if(type == "offlineCacheInstalled"){ // clear out the 'needs offline cache' info this._hideNeedsOfflineCache(); // check to see if we need a browser restart // to be able to use this web app offline if(dojox.off.hasOfflineCache == true && dojox.off.browserRestart == true){ this._needsBrowserRestart(); return; }else{ var browserRestart = dojo.byId("dot-widget-browser-restart"); if(browserRestart){ browserRestart.style.display = "none"; } } // update our sync UI this._updateSyncUI(); // register our event listeners for our main buttons this._initMainEvtHandlers(); // if offline is disabled, disable everything this._setOfflineEnabled(dojox.off.enabled); // try to go online this._testNet(); } }, _onSync: function(type){ //console.debug("ui, onSync="+type); switch(type){ case "start": this._updateSyncUI(); break; case "refreshFiles": this._setSyncMessage("Downloading UI..."); break; case "upload": this._setSyncMessage("Uploading new data..."); break; case "download": this._setSyncMessage("Downloading new data..."); break; case "finished": this._syncFinished(); break; case "cancel": this._setSyncMessage("Canceling Sync..."); break; default: dojo.warn("Programming error: " + "Unknown sync type in dojox.off.ui: " + type); break; } }, _onNetwork: function(type){ // summary: // Called when we go on- or off-line // description: // When we go online or offline, this method is called to update // our UI. Default behavior is to update the Offline // Widget UI and to attempt a synchronization. // type: String // "online" if we just moved online, and "offline" if we just // moved offline. if(!this._initialized){ return; } // update UI this._updateNetIndicator(); if(type == "offline"){ this._setSyncMessage("You are working offline"); // clear old details var details = dojo.byId("dot-sync-details"); if(details){ details.style.display = "none"; } // if we fell offline during a sync, hide // the sync info this._updateSyncUI(); }else{ // online // synchronize, but pause for a few seconds // so that the user can orient themselves if(dojox.off.sync.autoSync){ window.setTimeout("dojox.off.sync.synchronize()", 1000); } } } }); // register ourselves for low-level framework events dojo.connect(dojox.off, "onFrameworkEvent", dojox.off.ui, "_onFrameworkEvent"); // start our magic when the Dojo Offline framework is ready to go dojo.connect(dojox.off, "onLoad", dojox.off.ui, dojox.off.ui._initialize); }
const Block = require('./block'); describe('Block' , () => { let data, lastBlock, block; beforeEach(() =>{ data = 'bar'; lastBlock = Block.genesis(); block = Block.mineBlock(lastBlock, data); }) it('sets the `data` to match the inpute' , () => { expect(block.data).toEqual(data); }); it('sets the `lastHash` to match the hash to the last block' , () => { expect(block.lastHash).toEqual(lastBlock.hash); }); });
import React, { useState } from 'react'; import Scroll from './Scroll'; export default function MarksCalculator() { const [firstInSem, setfirstInSem] = useState(0); const [secondInSem, setsecondInSem] = useState(0); const [finalSem, setfinalSem] = useState(0); const [assignment, setassignment] = useState(0); const [attendance, setattendance] = useState(0); const [MarksResult, setMarksResult] = useState('Not Available'); const [MarksRecomendation, setMarksRecomendation] = useState('Not Available'); function gpacalc(event) { event.preventDefault(); var total = ( (firstInSem * 30) / 100 + (secondInSem * 30) / 100 + (finalSem * 50) / 100 + assignment + attendance ).toFixed(2); setMarksResult(`Your Marks :- ${total}`); console.log(total); if (total >= 35) { if (finalSem >= 35) { setMarksRecomendation(` 'You are Safe and you crossed Danger Zone, Your extra marks is ${ total - 35 }.`); } else { setMarksRecomendation(`You Have a Backlog in this paper and have to give this paper again You are UnSafe and you have to gain ${ 35 - finalSem } more marks from Teacher (Current Time). Means Next time in Final Back Paper you have to score Only 35 Marks.`); } } else { if (finalSem + (35 - total) * 2 < 35) { setMarksRecomendation(`You are UnSafe and you have to gain ${ (35 - total) * 2 } more marks from Teacher (Current Time).\nMeans Next time in Final Back Paper you have to score Only 35 Marks.`); } else { setMarksRecomendation( ` You are UnSafe and you have to gain ${ (35 - total) * 2 } more marks from Teacher (Current Time).\n Means Next time in Final Back Paper you have to score Only ${ finalSem + (35 - total) * 2 } Marks` ); } } } return ( <> <section id="first"> <header> <h2>KNOW YOUR MARKS</h2> </header> <div className="content"> <h2>Enter Your Marks to check</h2> <form onSubmit={gpacalc}> <div className="row gtr-uniform"> <div className="col-4 col-12-xsmall"> <h3>First InSem</h3> <input type="number" placeholder="Enter the number of Grades" onChange={(e) => setfirstInSem(e.target.valueAsNumber)} /> </div> <div className="col-4 col-12-xsmall"> <h3>Second InSem</h3> <input type="number" placeholder="Enter the number of Grades" onChange={(e) => setsecondInSem(e.target.valueAsNumber)} /> </div> <div className="col-4 col-12-xsmall"> <h3>End Term</h3> <input type="number" placeholder="Enter the number of Grades" onChange={(e) => setfinalSem(e.target.valueAsNumber)} /> </div> <div className="col-4 col-12-xsmall"> <h3>Assignment</h3> <input type="number" placeholder="Enter the number of Grades" onChange={(e) => setassignment(e.target.valueAsNumber)} /> </div> <div className="col-4 col-12-xsmall"> <h3>Attendence</h3> <input type="number" placeholder="Enter the number of Grades" onChange={(e) => setattendance(e.target.valueAsNumber)} /> </div> <div className="col-12"> <ul className="actions"> <li> <a onClick={gpacalc}> <Scroll type="id" element="markstotal"> <a className=" button primary">Calculate</a> </Scroll> </a> </li> <li> <input type="reset" value="Reset" /> </li> </ul> </div> </div> </form> </div> </section> <section id="markstotal"> <header> <h2>Result</h2> </header> <div className="content"> <h1>{MarksResult}</h1> <h3>{MarksRecomendation}</h3> <h5> DISCLAIMER: YOUR CALCULATED MARKS HERE MAY HAVE AN ERROR OF +/-0.3. </h5> </div> </section> </> ); }
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("omi")); else if(typeof define === 'function' && define.amd) define(["omi"], factory); else if(typeof exports === 'object') exports["missed-video-call-rounded"] = factory(require("omi")); else root["missed-video-call-rounded"] = factory(root["Omi"]); })(this, function(__WEBPACK_EXTERNAL_MODULE_omi__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = "./esm/missed-video-call-rounded.js"); /******/ }) /************************************************************************/ /******/ ({ /***/ "./esm/missed-video-call-rounded.js": /*!******************************************!*\ !*** ./esm/missed-video-call-rounded.js ***! \******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval("\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar omi_1 = __webpack_require__(/*! omi */ \"omi\");\nvar createSvgIcon_1 = __webpack_require__(/*! ./utils/createSvgIcon */ \"./esm/utils/createSvgIcon.js\");\nexports.default = createSvgIcon_1.default(omi_1.h(\"path\", {\n d: \"M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l2.29 2.29c.63.63 1.71.18 1.71-.71V8.91c0-.89-1.08-1.34-1.71-.71L17 10.5zm-6.29 3.79c-.39.39-1.02.39-1.41 0l-3.18-3.18v2.55H5V9.72c0-.28.22-.5.5-.5h3.94v1.11H6.89l3.11 3.1 4.22-4.22.78.79-4.29 4.29z\"\n}), 'MissedVideoCallRounded');\n\n\n//# sourceURL=webpack://%5Bname%5D/./esm/missed-video-call-rounded.js?"); /***/ }), /***/ "./esm/utils/createSvgIcon.js": /*!************************************!*\ !*** ./esm/utils/createSvgIcon.js ***! \************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; eval("\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar omi_1 = __webpack_require__(/*! omi */ \"omi\");\nvar hyphenateRE = /\\B([A-Z])/g;\nvar hyphenate = function (str) {\n return str.replace(hyphenateRE, '-$1').toLowerCase();\n};\nfunction createSvgIcon(path, displayName) {\n omi_1.define(hyphenate('OIcon' + displayName), function (_) {\n return omi_1.h('svg', __assign({ viewBox: \"0 0 24 24\", title: displayName }, _.props), path);\n }, {\n css: \":host {\\n fill: currentColor;\\n width: 1em;\\n height: 1em;\\n display: inline-block;\\n vertical-align: -0.125em;\\n transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\\n flex-shrink: 0;\\n user-select: none;\\n}\"\n });\n}\nexports.default = createSvgIcon;\n\n\n//# sourceURL=webpack://%5Bname%5D/./esm/utils/createSvgIcon.js?"); /***/ }), /***/ "omi": /*!******************************************************************************!*\ !*** external {"commonjs":"omi","commonjs2":"omi","amd":"omi","root":"Omi"} ***! \******************************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("module.exports = __WEBPACK_EXTERNAL_MODULE_omi__;\n\n//# sourceURL=webpack://%5Bname%5D/external_%7B%22commonjs%22:%22omi%22,%22commonjs2%22:%22omi%22,%22amd%22:%22omi%22,%22root%22:%22Omi%22%7D?"); /***/ }) /******/ })["default"]; });
import React from 'react' import styled from '@emotion/styled' import { Box } from 'rebass' import { Container } from './blocks' import { useColorMode } from 'theme-ui' import theme from './theme' const data = { sponsors: [ { name: 'GitHub', link: 'https://github.com/', image: 'https://schacks.org/static/images/sponsors/github-logo.png' }, { name: 'Hack Club Bank', link: 'https://hackclub.com/bank', image: 'https://schacks.org/static/images/sponsors/hackclub-bank-logo.png' } ], additionalSupport: [ { name: 'Sticker Mule', link: 'https://stickermule.com/', image: 'https://schacks.org/static/images/sponsors/stickermule-logo.png' } ] } const Base = styled(Box)` display: grid; grid-row-gap: ${theme.space[2]}px; grid-template-columns: repeat( auto-fit, minmax(${props => (props.section === 'sponsors' ? 256 : 192)}px, 1fr) ); align-items: center; justify-content: center; margin-bottom: ${theme.space[4]}px; a { width: 100%; } img { max-width: 75%; max-height: ${props => (props.section === 'sponsors' ? 6 : 4)}rem; ${props => props.colorMode === 'dark' && `filter: invert() hue-rotate(180deg);`} } ` const Sponsors = ({ section = 'sponsors', ...props }) => { const [colorMode] = useColorMode() return ( <Base colorMode={colorMode} section={section} {...props}> {data[section].map(sponsor => ( <a href={sponsor.link} target="_blank" key={sponsor.name}> <img alt={sponsor.name} src={sponsor.image} /> </a> ))} </Base> ) } export default Sponsors
'use strict'; const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const TerserPlugin = require('terser-webpack-plugin'); module.exports = { entry: { 'entry.min': './src/entry.js', }, mode: 'production', output: { chunkFilename: '[name].[contenthash].js', filename: '[name].js', }, module: { rules: [], }, plugins: [ new MiniCssExtractPlugin({ filename: '[name].css', chunkFilename: '[name][contenthash].css', }), ], optimization: { minimize: true, minimizer: [ new TerserPlugin({ include: /\.min\.js$/, parallel: true, terserOptions: { ecma: 5, }, }), ], }, };
const Builder = require('./webpack/build') const fs = require('fs-extra') const path = require('path') const cli = require('./cli') const CWD = process.cwd() const defBuild = { env: 'production', outputPath: path.resolve(CWD, 'dist'), dir: path.resolve(CWD, ''), static: '', outHtml: true, favicon: false, useUglify: true, ie8: true, imgBase64: 1024, publicPath: { source: '', img: '' }, mode: 'alone', merge: 'base', debug: false, iswx: false, x2xOptions: { type: 'rem2rpx' } } module.exports = async function (options) { if (typeof options.dir !== 'undefined') { options.dir = path.resolve(CWD, options.dir) } if (typeof options.output !== 'undefined') { options.outputPath = path.resolve(CWD, options.output) } options = Object.assign(defBuild, options) process.env.NODE_ENV = options.env const builder = new Builder(options) try { if (options.clean) { await fs.remove(options.output) } cli.info('开始编译...') await builder.build() cli.info('编译成功!') } catch (e) { cli.error('编译失败') if (Array.isArray(e)) { e.forEach(err => { cli.error(err) cli.info(' ') }) } else { cli.error(e) } throw e } }
module.exports = function(candidate) { var max = Math.floor(Math.sqrt(candidate)); var index = 3; if(candidate % 2 == 0 && candidate != 2) { return false; } while(index <= max) { if(candidate % index == 0) { return false; } index += 2; } return true; }
// @flow import {allViewNames as defaultViewOrder} from '../../views/views' import difference from 'lodash/difference' import { trackHomescreenOrder, trackHomescreenDisabledItem, trackHomescreenReenabledItem, } from '../../lib/analytics' import * as storage from '../../lib/storage' import {type ReduxState} from '../index' import isEqual from 'lodash/isEqual' import debounce from 'lodash/debounce' // see https://css-tricks.com/debouncing-throttling-explained-examples/ // we only invoke trackHomescreenOrder once every three seconds, to avoid // reporting every permutation of someone's home screen while they're editing it const debouncedTrackHomescreenOrder = debounce(trackHomescreenOrder, 3000) type Dispatch<A: Action> = (action: A | Promise<A> | ThunkAction<A>) => any type GetState = () => ReduxState type ThunkAction<A: Action> = (dispatch: Dispatch<A>, getState: GetState) => any type Action = | SaveViewOrderAction | LoadDisabledViewsAction | ToggleViewDisabledAction | LoadViewOrderAction const LOAD_HOMESCREEN_ORDER = 'homescreen/LOAD_HOMESCREEN_ORDER' const SAVE_HOMESCREEN_ORDER = 'homescreen/SAVE_HOMESCREEN_ORDER' const LOAD_DISABLED_VIEWS = 'homescreen/LOAD_DISABLED_VIEWS' const TOGGLE_VIEW_DISABLED = 'homescreen/TOGGLE_VIEW_DISABLED' type ViewName = string export function updateViewOrder( currentOrder: Array<ViewName>, defaultOrder: Array<ViewName> = defaultViewOrder, ): Array<ViewName> { currentOrder = currentOrder || [] // lodash/difference: Creates an array of array values _not included_ in the // other given arrays. // In case new screens have been added, get a list of the new screens let addedScreens = difference(defaultOrder, currentOrder) // check for removed screens let removedScreens = difference(currentOrder, defaultOrder) // add the new screens to the list currentOrder = currentOrder.concat(addedScreens) // now we remove the screens that were removed currentOrder = difference(currentOrder, removedScreens) return currentOrder } type LoadViewOrderAction = { type: 'homescreen/LOAD_HOMESCREEN_ORDER', payload: Array<ViewName>, } export async function loadHomescreenOrder(): Promise<LoadViewOrderAction> { // get the saved list from persistent storage let savedOrder = await storage.getHomescreenOrder() // update the order, in case new views have been added/removed let order = updateViewOrder(savedOrder, defaultViewOrder) // return an action to save it to persistent storage return {type: LOAD_HOMESCREEN_ORDER, payload: order} } type SaveViewOrderAction = { type: 'homescreen/SAVE_HOMESCREEN_ORDER', payload: Array<ViewName>, } export function saveHomescreenOrder( order: Array<ViewName>, ): SaveViewOrderAction { debouncedTrackHomescreenOrder(order, isEqual(order, defaultViewOrder)) storage.setHomescreenOrder(order) return {type: SAVE_HOMESCREEN_ORDER, payload: order} } type LoadDisabledViewsAction = { type: 'homescreen/LOAD_DISABLED_VIEWS', payload: Array<ViewName>, } export async function loadDisabledViews(): Promise<LoadDisabledViewsAction> { let disabledViews = await storage.getDisabledViews() if (disabledViews.length === 0) { disabledViews = [] } disabledViews = disabledViews.filter(view => defaultViewOrder.includes(view)) return {type: LOAD_DISABLED_VIEWS, payload: disabledViews} } type ToggleViewDisabledAction = { type: 'homescreen/TOGGLE_VIEW_DISABLED', payload: Array<string>, } export function toggleViewDisabled( viewName: string, ): ThunkAction<ToggleViewDisabledAction> { return (dispatch, getState) => { const state = getState() const currentDisabledViews = state.homescreen ? state.homescreen.inactiveViews : [] const newDisabledViews = currentDisabledViews.includes(viewName) ? currentDisabledViews.filter(name => name !== viewName) : [...currentDisabledViews, viewName] if (newDisabledViews.includes(viewName)) { trackHomescreenDisabledItem(viewName) } else { trackHomescreenReenabledItem(viewName) } storage.setDisabledViews(newDisabledViews) dispatch({type: TOGGLE_VIEW_DISABLED, payload: newDisabledViews}) } } export type State = {| order: Array<ViewName>, inactiveViews: Array<ViewName>, |} const initialState: State = { order: [], inactiveViews: [], } export function homescreen(state: State = initialState, action: Action) { switch (action.type) { case LOAD_HOMESCREEN_ORDER: { return {...state, order: action.payload} } case SAVE_HOMESCREEN_ORDER: { return {...state, order: action.payload} } case LOAD_DISABLED_VIEWS: { return {...state, inactiveViews: action.payload} } case TOGGLE_VIEW_DISABLED: { return {...state, inactiveViews: action.payload} } default: { return state } } }
const path = require("path"); const slsw = require("serverless-webpack"); const nodeExternals = require("webpack-node-externals"); module.exports = { entry: slsw.lib.entries, target: "node", mode: slsw.lib.webpack.isLocal ? "development" : "production", optimization: { minimize: false, concatenateModules: false, }, performance: { // Turn off size warnings for entry points hints: false, }, devtool: "nosources-source-map", externals: [nodeExternals()], module: { rules: [ { test: /\.js$/, exclude: /node_modules/, use: [ { loader: "babel-loader", // Do not set options here -- configure .babelrc instead }, ], }, ], }, output: { libraryTarget: "commonjs2", path: path.join(__dirname, ".webpack"), filename: "[name].js", sourceMapFilename: "[file].map", }, };
// CodeMirror is the only global var we claim window.CodeMirror = (function() { "use strict"; // BROWSER SNIFFING // Crude, but necessary to handle a number of hard-to-feature-detect // bugs and behavior differences. var gecko = /gecko\/\d/i.test(navigator.userAgent); var ie = /MSIE \d/.test(navigator.userAgent); var ie_lt8 = ie && (document.documentMode == null || document.documentMode < 8); var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9); var webkit = /WebKit\//.test(navigator.userAgent); var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(navigator.userAgent); var chrome = /Chrome\//.test(navigator.userAgent); var opera = /Opera\//.test(navigator.userAgent); var safari = /Apple Computer/.test(navigator.vendor); var khtml = /KHTML\//.test(navigator.userAgent); var mac_geLion = /Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent); var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent); var phantom = /PhantomJS/.test(navigator.userAgent); var ios = /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent); // This is woefully incomplete. Suggestions for alternative methods welcome. var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent); var mac = ios || /Mac/.test(navigator.platform); var windows = /windows/i.test(navigator.platform); var opera_version = opera && navigator.userAgent.match(/Version\/(\d*\.\d*)/); if (opera_version) opera_version = Number(opera_version[1]); if (opera_version && opera_version >= 15) { opera = false; webkit = true; } // Some browsers use the wrong event properties to signal cmd/ctrl on OS X var flipCtrlCmd = mac && (qtwebkit || opera && (opera_version == null || opera_version < 12.11)); var captureMiddleClick = gecko || (ie && !ie_lt9); // Optimize some code when these features are not used var sawReadOnlySpans = false, sawCollapsedSpans = false; // CONSTRUCTOR function CodeMirror(place, options) { if (!(this instanceof CodeMirror)) return new CodeMirror(place, options); this.options = options = options || {}; // Determine effective options based on given values and defaults. for (var opt in defaults) if (!options.hasOwnProperty(opt) && defaults.hasOwnProperty(opt)) options[opt] = defaults[opt]; setGuttersForLineNumbers(options); var docStart = typeof options.value == "string" ? 0 : options.value.first; var display = this.display = makeDisplay(place, docStart); display.wrapper.CodeMirror = this; updateGutters(this); if (options.autofocus && !mobile) focusInput(this); this.state = {keyMaps: [], overlays: [], modeGen: 0, overwrite: false, focused: false, suppressEdits: false, pasteIncoming: false, draggingText: false, highlight: new Delayed()}; themeChanged(this); if (options.lineWrapping) this.display.wrapper.className += " CodeMirror-wrap"; var doc = options.value; if (typeof doc == "string") doc = new Doc(options.value, options.mode); operation(this, attachDoc)(this, doc); // Override magic textarea content restore that IE sometimes does // on our hidden textarea on reload if (ie) setTimeout(bind(resetInput, this, true), 20); registerEventHandlers(this); // IE throws unspecified error in certain cases, when // trying to access activeElement before onload var hasFocus; try { hasFocus = (document.activeElement == display.input); } catch(e) { } if (hasFocus || (options.autofocus && !mobile)) setTimeout(bind(onFocus, this), 20); else onBlur(this); operation(this, function() { for (var opt in optionHandlers) if (optionHandlers.propertyIsEnumerable(opt)) optionHandlers[opt](this, options[opt], Init); for (var i = 0; i < initHooks.length; ++i) initHooks[i](this); })(); } // DISPLAY CONSTRUCTOR function makeDisplay(place, docStart) { var d = {}; var input = d.input = elt("textarea", null, null, "position: absolute; padding: 0; width: 1px; height: 1em; outline: none; font-size: 4px;"); if (webkit) input.style.width = "1000px"; else input.setAttribute("wrap", "off"); // if border: 0; -- iOS fails to open keyboard (issue #1287) if (ios) input.style.border = "1px solid black"; input.setAttribute("autocorrect", "off"); input.setAttribute("autocapitalize", "off"); input.setAttribute("spellcheck", "false"); // Wraps and hides input textarea d.inputDiv = elt("div", [input], null, "overflow: hidden; position: relative; width: 3px; height: 0px;"); // The actual fake scrollbars. d.scrollbarH = elt("div", [elt("div", null, null, "height: 1px")], "CodeMirror-hscrollbar"); d.scrollbarV = elt("div", [elt("div", null, null, "width: 1px")], "CodeMirror-vscrollbar"); d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler"); d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler"); // DIVs containing the selection and the actual code d.lineDiv = elt("div", null, "CodeMirror-code"); d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1"); // Blinky cursor, and element used to ensure cursor fits at the end of a line d.cursor = elt("div", "\u00a0", "CodeMirror-cursor"); // Secondary cursor, shown when on a 'jump' in bi-directional text d.otherCursor = elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"); // Used to measure text size d.measure = elt("div", null, "CodeMirror-measure"); // Wraps everything that needs to exist inside the vertically-padded coordinate system d.lineSpace = elt("div", [d.measure, d.selectionDiv, d.lineDiv, d.cursor, d.otherCursor], null, "position: relative; outline: none"); // Moved around its parent to cover visible view d.mover = elt("div", [elt("div", [d.lineSpace], "CodeMirror-lines")], null, "position: relative"); // Set to the height of the text, causes scrolling d.sizer = elt("div", [d.mover], "CodeMirror-sizer"); // D is needed because behavior of elts with overflow: auto and padding is inconsistent across browsers d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerCutOff + "px; width: 1px;"); // Will contain the gutters, if any d.gutters = elt("div", null, "CodeMirror-gutters"); d.lineGutter = null; // Provides scrolling d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll"); d.scroller.setAttribute("tabIndex", "-1"); // The element in which the editor lives. d.wrapper = elt("div", [d.inputDiv, d.scrollbarH, d.scrollbarV, d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror"); // Work around IE7 z-index bug if (ie_lt8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; } if (place.appendChild) place.appendChild(d.wrapper); else place(d.wrapper); // Needed to hide big blue blinking cursor on Mobile Safari if (ios) input.style.width = "0px"; if (!webkit) d.scroller.draggable = true; // Needed to handle Tab key in KHTML if (khtml) { d.inputDiv.style.height = "1px"; d.inputDiv.style.position = "absolute"; } // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8). else if (ie_lt8) d.scrollbarH.style.minWidth = d.scrollbarV.style.minWidth = "18px"; // Current visible range (may be bigger than the view window). d.viewOffset = d.lastSizeC = 0; d.showingFrom = d.showingTo = docStart; // Used to only resize the line number gutter when necessary (when // the amount of lines crosses a boundary that makes its width change) d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null; // See readInput and resetInput d.prevInput = ""; // Set to true when a non-horizontal-scrolling widget is added. As // an optimization, widget aligning is skipped when d is false. d.alignWidgets = false; // Flag that indicates whether we currently expect input to appear // (after some event like 'keypress' or 'input') and are polling // intensively. d.pollingFast = false; // Self-resetting timeout for the poller d.poll = new Delayed(); d.cachedCharWidth = d.cachedTextHeight = null; d.measureLineCache = []; d.measureLineCachePos = 0; // Tracks when resetInput has punted to just putting a short // string instead of the (large) selection. d.inaccurateSelection = false; // Tracks the maximum line length so that the horizontal scrollbar // can be kept static when scrolling. d.maxLine = null; d.maxLineLength = 0; d.maxLineChanged = false; // Used for measuring wheel scrolling granularity d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null; return d; } // STATE UPDATES // Used to get the editor into a consistent state again when options change. function loadMode(cm) { cm.doc.mode = CodeMirror.getMode(cm.options, cm.doc.modeOption); cm.doc.iter(function(line) { if (line.stateAfter) line.stateAfter = null; if (line.styles) line.styles = null; }); cm.doc.frontier = cm.doc.first; startWorker(cm, 100); cm.state.modeGen++; if (cm.curOp) regChange(cm); } function wrappingChanged(cm) { if (cm.options.lineWrapping) { cm.display.wrapper.className += " CodeMirror-wrap"; cm.display.sizer.style.minWidth = ""; } else { cm.display.wrapper.className = cm.display.wrapper.className.replace(" CodeMirror-wrap", ""); computeMaxLength(cm); } estimateLineHeights(cm); regChange(cm); clearCaches(cm); setTimeout(function(){updateScrollbars(cm);}, 100); } function estimateHeight(cm) { var th = textHeight(cm.display), wrapping = cm.options.lineWrapping; var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3); return function(line) { if (lineIsHidden(cm.doc, line)) return 0; else if (wrapping) return (Math.ceil(line.text.length / perLine) || 1) * th; else return th; }; } function estimateLineHeights(cm) { var doc = cm.doc, est = estimateHeight(cm); doc.iter(function(line) { var estHeight = est(line); if (estHeight != line.height) updateLineHeight(line, estHeight); }); } function keyMapChanged(cm) { var map = keyMap[cm.options.keyMap], style = map.style; cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-keymap-\S+/g, "") + (style ? " cm-keymap-" + style : ""); cm.state.disableInput = map.disableInput; } function themeChanged(cm) { cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") + cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-"); clearCaches(cm); } function guttersChanged(cm) { updateGutters(cm); regChange(cm); setTimeout(function(){alignHorizontally(cm);}, 20); } function updateGutters(cm) { var gutters = cm.display.gutters, specs = cm.options.gutters; removeChildren(gutters); for (var i = 0; i < specs.length; ++i) { var gutterClass = specs[i]; var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass)); if (gutterClass == "CodeMirror-linenumbers") { cm.display.lineGutter = gElt; gElt.style.width = (cm.display.lineNumWidth || 1) + "px"; } } gutters.style.display = i ? "" : "none"; } function lineLength(doc, line) { if (line.height == 0) return 0; var len = line.text.length, merged, cur = line; while (merged = collapsedSpanAtStart(cur)) { var found = merged.find(); cur = getLine(doc, found.from.line); len += found.from.ch - found.to.ch; } cur = line; while (merged = collapsedSpanAtEnd(cur)) { var found = merged.find(); len -= cur.text.length - found.from.ch; cur = getLine(doc, found.to.line); len += cur.text.length - found.to.ch; } return len; } function computeMaxLength(cm) { var d = cm.display, doc = cm.doc; d.maxLine = getLine(doc, doc.first); d.maxLineLength = lineLength(doc, d.maxLine); d.maxLineChanged = true; doc.iter(function(line) { var len = lineLength(doc, line); if (len > d.maxLineLength) { d.maxLineLength = len; d.maxLine = line; } }); } // Make sure the gutters options contains the element // "CodeMirror-linenumbers" when the lineNumbers option is true. function setGuttersForLineNumbers(options) { var found = false; for (var i = 0; i < options.gutters.length; ++i) { if (options.gutters[i] == "CodeMirror-linenumbers") { if (options.lineNumbers) found = true; else options.gutters.splice(i--, 1); } } if (!found && options.lineNumbers) options.gutters.push("CodeMirror-linenumbers"); } // SCROLLBARS // Re-synchronize the fake scrollbars with the actual size of the // content. Optionally force a scrollTop. function updateScrollbars(cm) { var d = cm.display, docHeight = cm.doc.height; var totalHeight = docHeight + paddingVert(d); d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + "px"; d.gutters.style.height = Math.max(totalHeight, d.scroller.clientHeight - scrollerCutOff) + "px"; var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight); var needsH = d.scroller.scrollWidth > (d.scroller.clientWidth + 1); var needsV = scrollHeight > (d.scroller.clientHeight + 1); if (needsV) { d.scrollbarV.style.display = "block"; d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + "px" : "0"; d.scrollbarV.firstChild.style.height = (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + "px"; } else { d.scrollbarV.style.display = ""; d.scrollbarV.firstChild.style.height = "0"; } if (needsH) { d.scrollbarH.style.display = "block"; d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + "px" : "0"; d.scrollbarH.firstChild.style.width = (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + "px"; } else { d.scrollbarH.style.display = ""; d.scrollbarH.firstChild.style.width = "0"; } if (needsH && needsV) { d.scrollbarFiller.style.display = "block"; d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + "px"; } else d.scrollbarFiller.style.display = ""; if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) { d.gutterFiller.style.display = "block"; d.gutterFiller.style.height = scrollbarWidth(d.measure) + "px"; d.gutterFiller.style.width = d.gutters.offsetWidth + "px"; } else d.gutterFiller.style.display = ""; if (mac_geLion && scrollbarWidth(d.measure) === 0) d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? "18px" : "12px"; } function visibleLines(display, doc, viewPort) { var top = display.scroller.scrollTop, height = display.wrapper.clientHeight; if (typeof viewPort == "number") top = viewPort; else if (viewPort) {top = viewPort.top; height = viewPort.bottom - viewPort.top;} top = Math.floor(top - paddingTop(display)); var bottom = Math.ceil(top + height); return {from: lineAtHeight(doc, top), to: lineAtHeight(doc, bottom)}; } // LINE NUMBERS function alignHorizontally(cm) { var display = cm.display; if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return; var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft; var gutterW = display.gutters.offsetWidth, l = comp + "px"; for (var n = display.lineDiv.firstChild; n; n = n.nextSibling) if (n.alignable) { for (var i = 0, a = n.alignable; i < a.length; ++i) a[i].style.left = l; } if (cm.options.fixedGutter) display.gutters.style.left = (comp + gutterW) + "px"; } function maybeUpdateLineNumberWidth(cm) { if (!cm.options.lineNumbers) return false; var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display; if (last.length != display.lineNumChars) { var test = display.measure.appendChild(elt("div", [elt("div", last)], "CodeMirror-linenumber CodeMirror-gutter-elt")); var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW; display.lineGutter.style.width = ""; display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding); display.lineNumWidth = display.lineNumInnerWidth + padding; display.lineNumChars = display.lineNumInnerWidth ? last.length : -1; display.lineGutter.style.width = display.lineNumWidth + "px"; return true; } return false; } function lineNumberFor(options, i) { return String(options.lineNumberFormatter(i + options.firstLineNumber)); } function compensateForHScroll(display) { return getRect(display.scroller).left - getRect(display.sizer).left; } // DISPLAY DRAWING function updateDisplay(cm, changes, viewPort, forced) { var oldFrom = cm.display.showingFrom, oldTo = cm.display.showingTo, updated; var visible = visibleLines(cm.display, cm.doc, viewPort); for (;;) { if (!updateDisplayInner(cm, changes, visible, forced)) break; forced = false; updated = true; updateSelection(cm); updateScrollbars(cm); // Clip forced viewport to actual scrollable area if (viewPort) viewPort = Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, typeof viewPort == "number" ? viewPort : viewPort.top); visible = visibleLines(cm.display, cm.doc, viewPort); if (visible.from >= cm.display.showingFrom && visible.to <= cm.display.showingTo) break; changes = []; } if (updated) { signalLater(cm, "update", cm); if (cm.display.showingFrom != oldFrom || cm.display.showingTo != oldTo) signalLater(cm, "viewportChange", cm, cm.display.showingFrom, cm.display.showingTo); } return updated; } // Uses a set of changes plus the current scroll position to // determine which DOM updates have to be made, and makes the // updates. function updateDisplayInner(cm, changes, visible, forced) { var display = cm.display, doc = cm.doc; if (!display.wrapper.clientWidth) { display.showingFrom = display.showingTo = doc.first; display.viewOffset = 0; return; } // Bail out if the visible area is already rendered and nothing changed. if (!forced && changes.length == 0 && visible.from > display.showingFrom && visible.to < display.showingTo) return; if (maybeUpdateLineNumberWidth(cm)) changes = [{from: doc.first, to: doc.first + doc.size}]; var gutterW = display.sizer.style.marginLeft = display.gutters.offsetWidth + "px"; display.scrollbarH.style.left = cm.options.fixedGutter ? gutterW : "0"; // Used to determine which lines need their line numbers updated var positionsChangedFrom = Infinity; if (cm.options.lineNumbers) for (var i = 0; i < changes.length; ++i) if (changes[i].diff) { positionsChangedFrom = changes[i].from; break; } var end = doc.first + doc.size; var from = Math.max(visible.from - cm.options.viewportMargin, doc.first); var to = Math.min(end, visible.to + cm.options.viewportMargin); if (display.showingFrom < from && from - display.showingFrom < 20) from = Math.max(doc.first, display.showingFrom); if (display.showingTo > to && display.showingTo - to < 20) to = Math.min(end, display.showingTo); if (sawCollapsedSpans) { from = lineNo(visualLine(doc, getLine(doc, from))); while (to < end && lineIsHidden(doc, getLine(doc, to))) ++to; } // Create a range of theoretically intact lines, and punch holes // in that using the change info. var intact = [{from: Math.max(display.showingFrom, doc.first), to: Math.min(display.showingTo, end)}]; if (intact[0].from >= intact[0].to) intact = []; else intact = computeIntact(intact, changes); // When merged lines are present, we might have to reduce the // intact ranges because changes in continued fragments of the // intact lines do require the lines to be redrawn. if (sawCollapsedSpans) for (var i = 0; i < intact.length; ++i) { var range = intact[i], merged; while (merged = collapsedSpanAtEnd(getLine(doc, range.to - 1))) { var newTo = merged.find().from.line; if (newTo > range.from) range.to = newTo; else { intact.splice(i--, 1); break; } } } // Clip off the parts that won't be visible var intactLines = 0; for (var i = 0; i < intact.length; ++i) { var range = intact[i]; if (range.from < from) range.from = from; if (range.to > to) range.to = to; if (range.from >= range.to) intact.splice(i--, 1); else intactLines += range.to - range.from; } if (!forced && intactLines == to - from && from == display.showingFrom && to == display.showingTo) { updateViewOffset(cm); return; } intact.sort(function(a, b) {return a.from - b.from;}); // Avoid crashing on IE's "unspecified error" when in iframes try { var focused = document.activeElement; } catch(e) {} if (intactLines < (to - from) * .7) display.lineDiv.style.display = "none"; patchDisplay(cm, from, to, intact, positionsChangedFrom); display.lineDiv.style.display = ""; if (focused && document.activeElement != focused && focused.offsetHeight) focused.focus(); var different = from != display.showingFrom || to != display.showingTo || display.lastSizeC != display.wrapper.clientHeight; // This is just a bogus formula that detects when the editor is // resized or the font size changes. if (different) { display.lastSizeC = display.wrapper.clientHeight; startWorker(cm, 400); } display.showingFrom = from; display.showingTo = to; updateHeightsInViewport(cm); updateViewOffset(cm); return true; } function updateHeightsInViewport(cm) { var display = cm.display; var prevBottom = display.lineDiv.offsetTop; for (var node = display.lineDiv.firstChild, height; node; node = node.nextSibling) if (node.lineObj) { if (ie_lt8) { var bot = node.offsetTop + node.offsetHeight; height = bot - prevBottom; prevBottom = bot; } else { var box = getRect(node); height = box.bottom - box.top; } var diff = node.lineObj.height - height; if (height < 2) height = textHeight(display); if (diff > .001 || diff < -.001) { updateLineHeight(node.lineObj, height); var widgets = node.lineObj.widgets; if (widgets) for (var i = 0; i < widgets.length; ++i) widgets[i].height = widgets[i].node.offsetHeight; } } } function updateViewOffset(cm) { var off = cm.display.viewOffset = heightAtLine(cm, getLine(cm.doc, cm.display.showingFrom)); // Position the mover div to align with the current virtual scroll position cm.display.mover.style.top = off + "px"; } function computeIntact(intact, changes) { for (var i = 0, l = changes.length || 0; i < l; ++i) { var change = changes[i], intact2 = [], diff = change.diff || 0; for (var j = 0, l2 = intact.length; j < l2; ++j) { var range = intact[j]; if (change.to <= range.from && change.diff) { intact2.push({from: range.from + diff, to: range.to + diff}); } else if (change.to <= range.from || change.from >= range.to) { intact2.push(range); } else { if (change.from > range.from) intact2.push({from: range.from, to: change.from}); if (change.to < range.to) intact2.push({from: change.to + diff, to: range.to + diff}); } } intact = intact2; } return intact; } function getDimensions(cm) { var d = cm.display, left = {}, width = {}; for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) { left[cm.options.gutters[i]] = n.offsetLeft; width[cm.options.gutters[i]] = n.offsetWidth; } return {fixedPos: compensateForHScroll(d), gutterTotalWidth: d.gutters.offsetWidth, gutterLeft: left, gutterWidth: width, wrapperWidth: d.wrapper.clientWidth}; } function patchDisplay(cm, from, to, intact, updateNumbersFrom) { var dims = getDimensions(cm); var display = cm.display, lineNumbers = cm.options.lineNumbers; if (!intact.length && (!webkit || !cm.display.currentWheelTarget)) removeChildren(display.lineDiv); var container = display.lineDiv, cur = container.firstChild; function rm(node) { var next = node.nextSibling; if (webkit && mac && cm.display.currentWheelTarget == node) { node.style.display = "none"; node.lineObj = null; } else { node.parentNode.removeChild(node); } return next; } var nextIntact = intact.shift(), lineN = from; cm.doc.iter(from, to, function(line) { if (nextIntact && nextIntact.to == lineN) nextIntact = intact.shift(); if (lineIsHidden(cm.doc, line)) { if (line.height != 0) updateLineHeight(line, 0); if (line.widgets && cur.previousSibling) for (var i = 0; i < line.widgets.length; ++i) { var w = line.widgets[i]; if (w.showIfHidden) { var prev = cur.previousSibling; if (/pre/i.test(prev.nodeName)) { var wrap = elt("div", null, null, "position: relative"); prev.parentNode.replaceChild(wrap, prev); wrap.appendChild(prev); prev = wrap; } var wnode = prev.appendChild(elt("div", [w.node], "CodeMirror-linewidget")); if (!w.handleMouseEvents) wnode.ignoreEvents = true; positionLineWidget(w, wnode, prev, dims); } } } else if (nextIntact && nextIntact.from <= lineN && nextIntact.to > lineN) { // This line is intact. Skip to the actual node. Update its // line number if needed. while (cur.lineObj != line) cur = rm(cur); if (lineNumbers && updateNumbersFrom <= lineN && cur.lineNumber) setTextContent(cur.lineNumber, lineNumberFor(cm.options, lineN)); cur = cur.nextSibling; } else { // For lines with widgets, make an attempt to find and reuse // the existing element, so that widgets aren't needlessly // removed and re-inserted into the dom if (line.widgets) for (var j = 0, search = cur, reuse; search && j < 20; ++j, search = search.nextSibling) if (search.lineObj == line && /div/i.test(search.nodeName)) { reuse = search; break; } // This line needs to be generated. var lineNode = buildLineElement(cm, line, lineN, dims, reuse); if (lineNode != reuse) { container.insertBefore(lineNode, cur); } else { while (cur != reuse) cur = rm(cur); cur = cur.nextSibling; } lineNode.lineObj = line; } ++lineN; }); while (cur) cur = rm(cur); } function buildLineElement(cm, line, lineNo, dims, reuse) { var lineElement = lineContent(cm, line); var markers = line.gutterMarkers, display = cm.display, wrap; if (!cm.options.lineNumbers && !markers && !line.bgClass && !line.wrapClass && !line.widgets) return lineElement; // Lines with gutter elements, widgets or a background class need // to be wrapped again, and have the extra elements added to the // wrapper div if (reuse) { reuse.alignable = null; var isOk = true, widgetsSeen = 0, insertBefore = null; for (var n = reuse.firstChild, next; n; n = next) { next = n.nextSibling; if (!/\bCodeMirror-linewidget\b/.test(n.className)) { reuse.removeChild(n); } else { for (var i = 0; i < line.widgets.length; ++i) { var widget = line.widgets[i]; if (widget.node == n.firstChild) { if (!widget.above && !insertBefore) insertBefore = n; positionLineWidget(widget, n, reuse, dims); ++widgetsSeen; break; } } if (i == line.widgets.length) { isOk = false; break; } } } reuse.insertBefore(lineElement, insertBefore); if (isOk && widgetsSeen == line.widgets.length) { wrap = reuse; reuse.className = line.wrapClass || ""; } } if (!wrap) { wrap = elt("div", null, line.wrapClass, "position: relative"); wrap.appendChild(lineElement); } // Kludge to make sure the styled element lies behind the selection (by z-index) if (line.bgClass) wrap.insertBefore(elt("div", null, line.bgClass + " CodeMirror-linebackground"), wrap.firstChild); if (cm.options.lineNumbers || markers) { var gutterWrap = wrap.insertBefore(elt("div", null, null, "position: absolute; left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"), wrap.firstChild); if (cm.options.fixedGutter) (wrap.alignable || (wrap.alignable = [])).push(gutterWrap); if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"])) wrap.lineNumber = gutterWrap.appendChild( elt("div", lineNumberFor(cm.options, lineNo), "CodeMirror-linenumber CodeMirror-gutter-elt", "left: " + dims.gutterLeft["CodeMirror-linenumbers"] + "px; width: " + display.lineNumInnerWidth + "px")); if (markers) for (var k = 0; k < cm.options.gutters.length; ++k) { var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id]; if (found) gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt", "left: " + dims.gutterLeft[id] + "px; width: " + dims.gutterWidth[id] + "px")); } } if (ie_lt8) wrap.style.zIndex = 2; if (line.widgets && wrap != reuse) for (var i = 0, ws = line.widgets; i < ws.length; ++i) { var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget"); if (!widget.handleMouseEvents) node.ignoreEvents = true; positionLineWidget(widget, node, wrap, dims); if (widget.above) wrap.insertBefore(node, cm.options.lineNumbers && line.height != 0 ? gutterWrap : lineElement); else wrap.appendChild(node); signalLater(widget, "redraw"); } return wrap; } function positionLineWidget(widget, node, wrap, dims) { if (widget.noHScroll) { (wrap.alignable || (wrap.alignable = [])).push(node); var width = dims.wrapperWidth; node.style.left = dims.fixedPos + "px"; if (!widget.coverGutter) { width -= dims.gutterTotalWidth; node.style.paddingLeft = dims.gutterTotalWidth + "px"; } node.style.width = width + "px"; } if (widget.coverGutter) { node.style.zIndex = 5; node.style.position = "relative"; if (!widget.noHScroll) node.style.marginLeft = -dims.gutterTotalWidth + "px"; } } // SELECTION / CURSOR function updateSelection(cm) { var display = cm.display; var collapsed = posEq(cm.doc.sel.from, cm.doc.sel.to); if (collapsed || cm.options.showCursorWhenSelecting) updateSelectionCursor(cm); else display.cursor.style.display = display.otherCursor.style.display = "none"; if (!collapsed) updateSelectionRange(cm); else display.selectionDiv.style.display = "none"; // Move the hidden textarea near the cursor to prevent scrolling artifacts if (cm.options.moveInputWithCursor) { var headPos = cursorCoords(cm, cm.doc.sel.head, "div"); var wrapOff = getRect(display.wrapper), lineOff = getRect(display.lineDiv); display.inputDiv.style.top = Math.max(0, Math.min(display.wrapper.clientHeight - 10, headPos.top + lineOff.top - wrapOff.top)) + "px"; display.inputDiv.style.left = Math.max(0, Math.min(display.wrapper.clientWidth - 10, headPos.left + lineOff.left - wrapOff.left)) + "px"; } } // No selection, plain cursor function updateSelectionCursor(cm) { var display = cm.display, pos = cursorCoords(cm, cm.doc.sel.head, "div"); display.cursor.style.left = pos.left + "px"; display.cursor.style.top = pos.top + "px"; display.cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px"; display.cursor.style.display = ""; if (pos.other) { display.otherCursor.style.display = ""; display.otherCursor.style.left = pos.other.left + "px"; display.otherCursor.style.top = pos.other.top + "px"; display.otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px"; } else { display.otherCursor.style.display = "none"; } } // Highlight selection function updateSelectionRange(cm) { var display = cm.display, doc = cm.doc, sel = cm.doc.sel; var fragment = document.createDocumentFragment(); var clientWidth = display.lineSpace.offsetWidth, pl = paddingLeft(cm.display); function add(left, top, width, bottom) { if (top < 0) top = 0; fragment.appendChild(elt("div", null, "CodeMirror-selected", "position: absolute; left: " + left + "px; top: " + top + "px; width: " + (width == null ? clientWidth - left : width) + "px; height: " + (bottom - top) + "px")); } function drawForLine(line, fromArg, toArg) { var lineObj = getLine(doc, line); var lineLen = lineObj.text.length; var start, end; function coords(ch, bias) { return charCoords(cm, Pos(line, ch), "div", lineObj, bias); } iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) { var leftPos = coords(from, "left"), rightPos, left, right; if (from == to) { rightPos = leftPos; left = right = leftPos.left; } else { rightPos = coords(to - 1, "right"); if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; } left = leftPos.left; right = rightPos.right; } if (fromArg == null && from == 0) left = pl; if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part add(left, leftPos.top, null, leftPos.bottom); left = pl; if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top); } if (toArg == null && to == lineLen) right = clientWidth; if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left) start = leftPos; if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right) end = rightPos; if (left < pl + 1) left = pl; add(left, rightPos.top, right - left, rightPos.bottom); }); return {start: start, end: end}; } if (sel.from.line == sel.to.line) { drawForLine(sel.from.line, sel.from.ch, sel.to.ch); } else { var fromLine = getLine(doc, sel.from.line), toLine = getLine(doc, sel.to.line); var singleVLine = visualLine(doc, fromLine) == visualLine(doc, toLine); var leftEnd = drawForLine(sel.from.line, sel.from.ch, singleVLine ? fromLine.text.length : null).end; var rightStart = drawForLine(sel.to.line, singleVLine ? 0 : null, sel.to.ch).start; if (singleVLine) { if (leftEnd.top < rightStart.top - 2) { add(leftEnd.right, leftEnd.top, null, leftEnd.bottom); add(pl, rightStart.top, rightStart.left, rightStart.bottom); } else { add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom); } } if (leftEnd.bottom < rightStart.top) add(pl, leftEnd.bottom, null, rightStart.top); } removeChildrenAndAdd(display.selectionDiv, fragment); display.selectionDiv.style.display = ""; } // Cursor-blinking function restartBlink(cm) { if (!cm.state.focused) return; var display = cm.display; clearInterval(display.blinker); var on = true; display.cursor.style.visibility = display.otherCursor.style.visibility = ""; display.blinker = setInterval(function() { display.cursor.style.visibility = display.otherCursor.style.visibility = (on = !on) ? "" : "hidden"; }, cm.options.cursorBlinkRate); } // HIGHLIGHT WORKER function startWorker(cm, time) { if (cm.doc.mode.startState && cm.doc.frontier < cm.display.showingTo) cm.state.highlight.set(time, bind(highlightWorker, cm)); } function highlightWorker(cm) { var doc = cm.doc; if (doc.frontier < doc.first) doc.frontier = doc.first; if (doc.frontier >= cm.display.showingTo) return; var end = +new Date + cm.options.workTime; var state = copyState(doc.mode, getStateBefore(cm, doc.frontier)); var changed = [], prevChange; doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.showingTo + 500), function(line) { if (doc.frontier >= cm.display.showingFrom) { // Visible var oldStyles = line.styles; line.styles = highlightLine(cm, line, state); var ischange = !oldStyles || oldStyles.length != line.styles.length; for (var i = 0; !ischange && i < oldStyles.length; ++i) ischange = oldStyles[i] != line.styles[i]; if (ischange) { if (prevChange && prevChange.end == doc.frontier) prevChange.end++; else changed.push(prevChange = {start: doc.frontier, end: doc.frontier + 1}); } line.stateAfter = copyState(doc.mode, state); } else { processLine(cm, line, state); line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null; } ++doc.frontier; if (+new Date > end) { startWorker(cm, cm.options.workDelay); return true; } }); if (changed.length) operation(cm, function() { for (var i = 0; i < changed.length; ++i) regChange(this, changed[i].start, changed[i].end); })(); } // Finds the line to start with when starting a parse. Tries to // find a line with a stateAfter, so that it can start with a // valid state. If that fails, it returns the line with the // smallest indentation, which tends to need the least context to // parse correctly. function findStartLine(cm, n, precise) { var minindent, minline, doc = cm.doc, maxScan = cm.doc.mode.innerMode ? 1000 : 100; for (var search = n, lim = n - maxScan; search > lim; --search) { if (search <= doc.first) return doc.first; var line = getLine(doc, search - 1); if (line.stateAfter && (!precise || search <= doc.frontier)) return search; var indented = countColumn(line.text, null, cm.options.tabSize); if (minline == null || minindent > indented) { minline = search - 1; minindent = indented; } } return minline; } function getStateBefore(cm, n, precise) { var doc = cm.doc, display = cm.display; if (!doc.mode.startState) return true; var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter; if (!state) state = startState(doc.mode); else state = copyState(doc.mode, state); doc.iter(pos, n, function(line) { processLine(cm, line, state); var save = pos == n - 1 || pos % 5 == 0 || pos >= display.showingFrom && pos < display.showingTo; line.stateAfter = save ? copyState(doc.mode, state) : null; ++pos; }); return state; } // POSITION MEASUREMENT function paddingTop(display) {return display.lineSpace.offsetTop;} function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight;} function paddingLeft(display) { var e = removeChildrenAndAdd(display.measure, elt("pre", null, null, "text-align: left")).appendChild(elt("span", "x")); return e.offsetLeft; } function measureChar(cm, line, ch, data, bias) { var dir = -1; data = data || measureLine(cm, line); for (var pos = ch;; pos += dir) { var r = data[pos]; if (r) break; if (dir < 0 && pos == 0) dir = 1; } bias = pos > ch ? "left" : pos < ch ? "right" : bias; if (bias == "left" && r.leftSide) r = r.leftSide; else if (bias == "right" && r.rightSide) r = r.rightSide; return {left: pos < ch ? r.right : r.left, right: pos > ch ? r.left : r.right, top: r.top, bottom: r.bottom}; } function findCachedMeasurement(cm, line) { var cache = cm.display.measureLineCache; for (var i = 0; i < cache.length; ++i) { var memo = cache[i]; if (memo.text == line.text && memo.markedSpans == line.markedSpans && cm.display.scroller.clientWidth == memo.width && memo.classes == line.textClass + "|" + line.bgClass + "|" + line.wrapClass) return memo; } } function clearCachedMeasurement(cm, line) { var exists = findCachedMeasurement(cm, line); if (exists) exists.text = exists.measure = exists.markedSpans = null; } function measureLine(cm, line) { // First look in the cache var cached = findCachedMeasurement(cm, line); if (cached) return cached.measure; // Failing that, recompute and store result in cache var measure = measureLineInner(cm, line); var cache = cm.display.measureLineCache; var memo = {text: line.text, width: cm.display.scroller.clientWidth, markedSpans: line.markedSpans, measure: measure, classes: line.textClass + "|" + line.bgClass + "|" + line.wrapClass}; if (cache.length == 16) cache[++cm.display.measureLineCachePos % 16] = memo; else cache.push(memo); return measure; } function measureLineInner(cm, line) { var display = cm.display, measure = emptyArray(line.text.length); var pre = lineContent(cm, line, measure, true); // IE does not cache element positions of inline elements between // calls to getBoundingClientRect. This makes the loop below, // which gathers the positions of all the characters on the line, // do an amount of layout work quadratic to the number of // characters. When line wrapping is off, we try to improve things // by first subdividing the line into a bunch of inline blocks, so // that IE can reuse most of the layout information from caches // for those blocks. This does interfere with line wrapping, so it // doesn't work when wrapping is on, but in that case the // situation is slightly better, since IE does cache line-wrapping // information and only recomputes per-line. if (ie && !ie_lt8 && !cm.options.lineWrapping && pre.childNodes.length > 100) { var fragment = document.createDocumentFragment(); var chunk = 10, n = pre.childNodes.length; for (var i = 0, chunks = Math.ceil(n / chunk); i < chunks; ++i) { var wrap = elt("div", null, null, "display: inline-block"); for (var j = 0; j < chunk && n; ++j) { wrap.appendChild(pre.firstChild); --n; } fragment.appendChild(wrap); } pre.appendChild(fragment); } removeChildrenAndAdd(display.measure, pre); var outer = getRect(display.lineDiv); var vranges = [], data = emptyArray(line.text.length), maxBot = pre.offsetHeight; // Work around an IE7/8 bug where it will sometimes have randomly // replaced our pre with a clone at this point. if (ie_lt9 && display.measure.first != pre) removeChildrenAndAdd(display.measure, pre); function measureRect(rect) { var top = rect.top - outer.top, bot = rect.bottom - outer.top; if (bot > maxBot) bot = maxBot; if (top < 0) top = 0; for (var i = vranges.length - 2; i >= 0; i -= 2) { var rtop = vranges[i], rbot = vranges[i+1]; if (rtop > bot || rbot < top) continue; if (rtop <= top && rbot >= bot || top <= rtop && bot >= rbot || Math.min(bot, rbot) - Math.max(top, rtop) >= (bot - top) >> 1) { vranges[i] = Math.min(top, rtop); vranges[i+1] = Math.max(bot, rbot); break; } } if (i < 0) { i = vranges.length; vranges.push(top, bot); } return {left: rect.left - outer.left, right: rect.right - outer.left, top: i, bottom: null}; } function finishRect(rect) { rect.bottom = vranges[rect.top+1]; rect.top = vranges[rect.top]; } for (var i = 0, cur; i < measure.length; ++i) if (cur = measure[i]) { var node = cur, rect = null; // A widget might wrap, needs special care if (/\bCodeMirror-widget\b/.test(cur.className) && cur.getClientRects) { if (cur.firstChild.nodeType == 1) node = cur.firstChild; var rects = node.getClientRects(); if (rects.length > 1) { rect = data[i] = measureRect(rects[0]); rect.rightSide = measureRect(rects[rects.length - 1]); } } if (!rect) rect = data[i] = measureRect(getRect(node)); if (cur.measureRight) rect.right = getRect(cur.measureRight).left; if (cur.leftSide) rect.leftSide = measureRect(getRect(cur.leftSide)); } removeChildren(cm.display.measure); for (var i = 0, cur; i < data.length; ++i) if (cur = data[i]) { finishRect(cur); if (cur.leftSide) finishRect(cur.leftSide); if (cur.rightSide) finishRect(cur.rightSide); } return data; } function measureLineWidth(cm, line) { var hasBadSpan = false; if (line.markedSpans) for (var i = 0; i < line.markedSpans; ++i) { var sp = line.markedSpans[i]; if (sp.collapsed && (sp.to == null || sp.to == line.text.length)) hasBadSpan = true; } var cached = !hasBadSpan && findCachedMeasurement(cm, line); if (cached) return measureChar(cm, line, line.text.length, cached.measure, "right").right; var pre = lineContent(cm, line, null, true); var end = pre.appendChild(zeroWidthElement(cm.display.measure)); removeChildrenAndAdd(cm.display.measure, pre); return getRect(end).right - getRect(cm.display.lineDiv).left; } function clearCaches(cm) { cm.display.measureLineCache.length = cm.display.measureLineCachePos = 0; cm.display.cachedCharWidth = cm.display.cachedTextHeight = null; if (!cm.options.lineWrapping) cm.display.maxLineChanged = true; cm.display.lineNumChars = null; } function pageScrollX() { return window.pageXOffset || (document.documentElement || document.body).scrollLeft; } function pageScrollY() { return window.pageYOffset || (document.documentElement || document.body).scrollTop; } // Context is one of "line", "div" (display.lineDiv), "local"/null (editor), or "page" function intoCoordSystem(cm, lineObj, rect, context) { if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) { var size = widgetHeight(lineObj.widgets[i]); rect.top += size; rect.bottom += size; } if (context == "line") return rect; if (!context) context = "local"; var yOff = heightAtLine(cm, lineObj); if (context == "local") yOff += paddingTop(cm.display); else yOff -= cm.display.viewOffset; if (context == "page" || context == "window") { var lOff = getRect(cm.display.lineSpace); yOff += lOff.top + (context == "window" ? 0 : pageScrollY()); var xOff = lOff.left + (context == "window" ? 0 : pageScrollX()); rect.left += xOff; rect.right += xOff; } rect.top += yOff; rect.bottom += yOff; return rect; } // Context may be "window", "page", "div", or "local"/null // Result is in "div" coords function fromCoordSystem(cm, coords, context) { if (context == "div") return coords; var left = coords.left, top = coords.top; // First move into "page" coordinate system if (context == "page") { left -= pageScrollX(); top -= pageScrollY(); } else if (context == "local" || !context) { var localBox = getRect(cm.display.sizer); left += localBox.left; top += localBox.top; } var lineSpaceBox = getRect(cm.display.lineSpace); return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}; } function charCoords(cm, pos, context, lineObj, bias) { if (!lineObj) lineObj = getLine(cm.doc, pos.line); return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, null, bias), context); } function cursorCoords(cm, pos, context, lineObj, measurement) { lineObj = lineObj || getLine(cm.doc, pos.line); if (!measurement) measurement = measureLine(cm, lineObj); function get(ch, right) { var m = measureChar(cm, lineObj, ch, measurement, right ? "right" : "left"); if (right) m.left = m.right; else m.right = m.left; return intoCoordSystem(cm, lineObj, m, context); } function getBidi(ch, partPos) { var part = order[partPos], right = part.level % 2; if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) { part = order[--partPos]; ch = bidiRight(part) - (part.level % 2 ? 0 : 1); right = true; } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) { part = order[++partPos]; ch = bidiLeft(part) - part.level % 2; right = false; } if (right && ch == part.to && ch > part.from) return get(ch - 1); return get(ch, right); } var order = getOrder(lineObj), ch = pos.ch; if (!order) return get(ch); var partPos = getBidiPartAt(order, ch); var val = getBidi(ch, partPos); if (bidiOther != null) val.other = getBidi(ch, bidiOther); return val; } function PosWithInfo(line, ch, outside, xRel) { var pos = new Pos(line, ch); pos.xRel = xRel; if (outside) pos.outside = true; return pos; } // Coords must be lineSpace-local function coordsChar(cm, x, y) { var doc = cm.doc; y += cm.display.viewOffset; if (y < 0) return PosWithInfo(doc.first, 0, true, -1); var lineNo = lineAtHeight(doc, y), last = doc.first + doc.size - 1; if (lineNo > last) return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1); if (x < 0) x = 0; for (;;) { var lineObj = getLine(doc, lineNo); var found = coordsCharInner(cm, lineObj, lineNo, x, y); var merged = collapsedSpanAtEnd(lineObj); var mergedPos = merged && merged.find(); if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0)) lineNo = mergedPos.to.line; else return found; } } function coordsCharInner(cm, lineObj, lineNo, x, y) { var innerOff = y - heightAtLine(cm, lineObj); var wrongLine = false, adjust = 2 * cm.display.wrapper.clientWidth; var measurement = measureLine(cm, lineObj); function getX(ch) { var sp = cursorCoords(cm, Pos(lineNo, ch), "line", lineObj, measurement); wrongLine = true; if (innerOff > sp.bottom) return sp.left - adjust; else if (innerOff < sp.top) return sp.left + adjust; else wrongLine = false; return sp.left; } var bidi = getOrder(lineObj), dist = lineObj.text.length; var from = lineLeft(lineObj), to = lineRight(lineObj); var fromX = getX(from), fromOutside = wrongLine, toX = getX(to), toOutside = wrongLine; if (x > toX) return PosWithInfo(lineNo, to, toOutside, 1); // Do a binary search between these bounds. for (;;) { if (bidi ? to == from || to == moveVisually(lineObj, from, 1) : to - from <= 1) { var ch = x < fromX || x - fromX <= toX - x ? from : to; var xDiff = x - (ch == from ? fromX : toX); while (isExtendingChar.test(lineObj.text.charAt(ch))) ++ch; var pos = PosWithInfo(lineNo, ch, ch == from ? fromOutside : toOutside, xDiff < 0 ? -1 : xDiff ? 1 : 0); return pos; } var step = Math.ceil(dist / 2), middle = from + step; if (bidi) { middle = from; for (var i = 0; i < step; ++i) middle = moveVisually(lineObj, middle, 1); } var middleX = getX(middle); if (middleX > x) {to = middle; toX = middleX; if (toOutside = wrongLine) toX += 1000; dist = step;} else {from = middle; fromX = middleX; fromOutside = wrongLine; dist -= step;} } } var measureText; function textHeight(display) { if (display.cachedTextHeight != null) return display.cachedTextHeight; if (measureText == null) { measureText = elt("pre"); // Measure a bunch of lines, for browsers that compute // fractional heights. for (var i = 0; i < 49; ++i) { measureText.appendChild(document.createTextNode("x")); measureText.appendChild(elt("br")); } measureText.appendChild(document.createTextNode("x")); } removeChildrenAndAdd(display.measure, measureText); var height = measureText.offsetHeight / 50; if (height > 3) display.cachedTextHeight = height; removeChildren(display.measure); return height || 1; } function charWidth(display) { if (display.cachedCharWidth != null) return display.cachedCharWidth; var anchor = elt("span", "x"); var pre = elt("pre", [anchor]); removeChildrenAndAdd(display.measure, pre); var width = anchor.offsetWidth; if (width > 2) display.cachedCharWidth = width; return width || 10; } // OPERATIONS // Operations are used to wrap changes in such a way that each // change won't have to update the cursor and display (which would // be awkward, slow, and error-prone), but instead updates are // batched and then all combined and executed at once. var nextOpId = 0; function startOperation(cm) { cm.curOp = { // An array of ranges of lines that have to be updated. See // updateDisplay. changes: [], forceUpdate: false, updateInput: null, userSelChange: null, textChanged: null, selectionChanged: false, cursorActivity: false, updateMaxLine: false, updateScrollPos: false, id: ++nextOpId }; if (!delayedCallbackDepth++) delayedCallbacks = []; } function endOperation(cm) { var op = cm.curOp, doc = cm.doc, display = cm.display; cm.curOp = null; if (op.updateMaxLine) computeMaxLength(cm); if (display.maxLineChanged && !cm.options.lineWrapping && display.maxLine) { var width = measureLineWidth(cm, display.maxLine); display.sizer.style.minWidth = Math.max(0, width + 3 + scrollerCutOff) + "px"; display.maxLineChanged = false; var maxScrollLeft = Math.max(0, display.sizer.offsetLeft + display.sizer.offsetWidth - display.scroller.clientWidth); if (maxScrollLeft < doc.scrollLeft && !op.updateScrollPos) setScrollLeft(cm, Math.min(display.scroller.scrollLeft, maxScrollLeft), true); } var newScrollPos, updated; if (op.updateScrollPos) { newScrollPos = op.updateScrollPos; } else if (op.selectionChanged && display.scroller.clientHeight) { // don't rescroll if not visible var coords = cursorCoords(cm, doc.sel.head); newScrollPos = calculateScrollPos(cm, coords.left, coords.top, coords.left, coords.bottom); } if (op.changes.length || op.forceUpdate || newScrollPos && newScrollPos.scrollTop != null) { updated = updateDisplay(cm, op.changes, newScrollPos && newScrollPos.scrollTop, op.forceUpdate); if (cm.display.scroller.offsetHeight) cm.doc.scrollTop = cm.display.scroller.scrollTop; } if (!updated && op.selectionChanged) updateSelection(cm); if (op.updateScrollPos) { display.scroller.scrollTop = display.scrollbarV.scrollTop = doc.scrollTop = newScrollPos.scrollTop; display.scroller.scrollLeft = display.scrollbarH.scrollLeft = doc.scrollLeft = newScrollPos.scrollLeft; alignHorizontally(cm); if (op.scrollToPos) scrollPosIntoView(cm, clipPos(cm.doc, op.scrollToPos), op.scrollToPosMargin); } else if (newScrollPos) { scrollCursorIntoView(cm); } if (op.selectionChanged) restartBlink(cm); if (cm.state.focused && op.updateInput) resetInput(cm, op.userSelChange); var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers; if (hidden) for (var i = 0; i < hidden.length; ++i) if (!hidden[i].lines.length) signal(hidden[i], "hide"); if (unhidden) for (var i = 0; i < unhidden.length; ++i) if (unhidden[i].lines.length) signal(unhidden[i], "unhide"); var delayed; if (!--delayedCallbackDepth) { delayed = delayedCallbacks; delayedCallbacks = null; } if (op.textChanged) signal(cm, "change", cm, op.textChanged); if (op.cursorActivity) signal(cm, "cursorActivity", cm); if (delayed) for (var i = 0; i < delayed.length; ++i) delayed[i](); } // Wraps a function in an operation. Returns the wrapped function. function operation(cm1, f) { return function() { var cm = cm1 || this, withOp = !cm.curOp; if (withOp) startOperation(cm); try { var result = f.apply(cm, arguments); } finally { if (withOp) endOperation(cm); } return result; }; } function docOperation(f) { return function() { var withOp = this.cm && !this.cm.curOp, result; if (withOp) startOperation(this.cm); try { result = f.apply(this, arguments); } finally { if (withOp) endOperation(this.cm); } return result; }; } function runInOp(cm, f) { var withOp = !cm.curOp, result; if (withOp) startOperation(cm); try { result = f(); } finally { if (withOp) endOperation(cm); } return result; } function regChange(cm, from, to, lendiff) { if (from == null) from = cm.doc.first; if (to == null) to = cm.doc.first + cm.doc.size; cm.curOp.changes.push({from: from, to: to, diff: lendiff}); } // INPUT HANDLING function slowPoll(cm) { if (cm.display.pollingFast) return; cm.display.poll.set(cm.options.pollInterval, function() { readInput(cm); if (cm.state.focused) slowPoll(cm); }); } function fastPoll(cm) { var missed = false; cm.display.pollingFast = true; function p() { var changed = readInput(cm); if (!changed && !missed) {missed = true; cm.display.poll.set(60, p);} else {cm.display.pollingFast = false; slowPoll(cm);} } cm.display.poll.set(20, p); } // prevInput is a hack to work with IME. If we reset the textarea // on every change, that breaks IME. So we look for changes // compared to the previous content instead. (Modern browsers have // events that indicate IME taking place, but these are not widely // supported or compatible enough yet to rely on.) function readInput(cm) { var input = cm.display.input, prevInput = cm.display.prevInput, doc = cm.doc, sel = doc.sel; if (!cm.state.focused || hasSelection(input) || isReadOnly(cm) || cm.state.disableInput) return false; if (cm.state.pasteIncoming && cm.state.fakedLastChar) { input.value = input.value.substring(0, input.value.length - 1); cm.state.fakedLastChar = false; } var text = input.value; if (text == prevInput && posEq(sel.from, sel.to)) return false; if (ie && !ie_lt9 && cm.display.inputHasSelection === text) { resetInput(cm, true); return false; } var withOp = !cm.curOp; if (withOp) startOperation(cm); sel.shift = false; var same = 0, l = Math.min(prevInput.length, text.length); while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) ++same; var from = sel.from, to = sel.to; if (same < prevInput.length) from = Pos(from.line, from.ch - (prevInput.length - same)); else if (cm.state.overwrite && posEq(from, to) && !cm.state.pasteIncoming) to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + (text.length - same))); var updateInput = cm.curOp.updateInput; var changeEvent = {from: from, to: to, text: splitLines(text.slice(same)), origin: cm.state.pasteIncoming ? "paste" : "+input"}; makeChange(cm.doc, changeEvent, "end"); cm.curOp.updateInput = updateInput; signalLater(cm, "inputRead", cm, changeEvent); if (text.length > 1000 || text.indexOf("\n") > -1) input.value = cm.display.prevInput = ""; else cm.display.prevInput = text; if (withOp) endOperation(cm); cm.state.pasteIncoming = false; return true; } function resetInput(cm, user) { var minimal, selected, doc = cm.doc; if (!posEq(doc.sel.from, doc.sel.to)) { cm.display.prevInput = ""; minimal = hasCopyEvent && (doc.sel.to.line - doc.sel.from.line > 100 || (selected = cm.getSelection()).length > 1000); var content = minimal ? "-" : selected || cm.getSelection(); cm.display.input.value = content; if (cm.state.focused) selectInput(cm.display.input); if (ie && !ie_lt9) cm.display.inputHasSelection = content; } else if (user) { cm.display.prevInput = cm.display.input.value = ""; if (ie && !ie_lt9) cm.display.inputHasSelection = null; } cm.display.inaccurateSelection = minimal; } function focusInput(cm) { if (cm.options.readOnly != "nocursor" && (!mobile || document.activeElement != cm.display.input)) cm.display.input.focus(); } function isReadOnly(cm) { return cm.options.readOnly || cm.doc.cantEdit; } // EVENT HANDLERS function registerEventHandlers(cm) { var d = cm.display; on(d.scroller, "mousedown", operation(cm, onMouseDown)); if (ie) on(d.scroller, "dblclick", operation(cm, function(e) { if (signalDOMEvent(cm, e)) return; var pos = posFromMouse(cm, e); if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) return; e_preventDefault(e); var word = findWordAt(getLine(cm.doc, pos.line).text, pos); extendSelection(cm.doc, word.from, word.to); })); else on(d.scroller, "dblclick", function(e) { signalDOMEvent(cm, e) || e_preventDefault(e); }); on(d.lineSpace, "selectstart", function(e) { if (!eventInWidget(d, e)) e_preventDefault(e); }); // Gecko browsers fire contextmenu *after* opening the menu, at // which point we can't mess with it anymore. Context menu is // handled in onMouseDown for Gecko. if (!captureMiddleClick) on(d.scroller, "contextmenu", function(e) {onContextMenu(cm, e);}); on(d.scroller, "scroll", function() { if (d.scroller.clientHeight) { setScrollTop(cm, d.scroller.scrollTop); setScrollLeft(cm, d.scroller.scrollLeft, true); signal(cm, "scroll", cm); } }); on(d.scrollbarV, "scroll", function() { if (d.scroller.clientHeight) setScrollTop(cm, d.scrollbarV.scrollTop); }); on(d.scrollbarH, "scroll", function() { if (d.scroller.clientHeight) setScrollLeft(cm, d.scrollbarH.scrollLeft); }); on(d.scroller, "mousewheel", function(e){onScrollWheel(cm, e);}); on(d.scroller, "DOMMouseScroll", function(e){onScrollWheel(cm, e);}); function reFocus() { if (cm.state.focused) setTimeout(bind(focusInput, cm), 0); } on(d.scrollbarH, "mousedown", reFocus); on(d.scrollbarV, "mousedown", reFocus); // Prevent wrapper from ever scrolling on(d.wrapper, "scroll", function() { d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; }); var resizeTimer; function onResize() { if (resizeTimer == null) resizeTimer = setTimeout(function() { resizeTimer = null; // Might be a text scaling operation, clear size caches. d.cachedCharWidth = d.cachedTextHeight = knownScrollbarWidth = null; clearCaches(cm); runInOp(cm, bind(regChange, cm)); }, 100); } on(window, "resize", onResize); // Above handler holds on to the editor and its data structures. // Here we poll to unregister it when the editor is no longer in // the document, so that it can be garbage-collected. function unregister() { for (var p = d.wrapper.parentNode; p && p != document.body; p = p.parentNode) {} if (p) setTimeout(unregister, 5000); else off(window, "resize", onResize); } setTimeout(unregister, 5000); on(d.input, "keyup", operation(cm, function(e) { if (signalDOMEvent(cm, e) || cm.options.onKeyEvent && cm.options.onKeyEvent(cm, addStop(e))) return; if (e.keyCode == 16) cm.doc.sel.shift = false; })); on(d.input, "input", bind(fastPoll, cm)); on(d.input, "keydown", operation(cm, onKeyDown)); on(d.input, "keypress", operation(cm, onKeyPress)); on(d.input, "focus", bind(onFocus, cm)); on(d.input, "blur", bind(onBlur, cm)); function drag_(e) { if (signalDOMEvent(cm, e) || cm.options.onDragEvent && cm.options.onDragEvent(cm, addStop(e))) return; e_stop(e); } if (cm.options.dragDrop) { on(d.scroller, "dragstart", function(e){onDragStart(cm, e);}); on(d.scroller, "dragenter", drag_); on(d.scroller, "dragover", drag_); on(d.scroller, "drop", operation(cm, onDrop)); } on(d.scroller, "paste", function(e){ if (eventInWidget(d, e)) return; focusInput(cm); fastPoll(cm); }); on(d.input, "paste", function() { // Workaround for webkit bug https://bugs.webkit.org/show_bug.cgi?id=90206 // Add a char to the end of textarea before paste occur so that // selection doesn't span to the end of textarea. if (webkit && !cm.state.fakedLastChar) { var start = d.input.selectionStart, end = d.input.selectionEnd; d.input.value += "$"; d.input.selectionStart = start; d.input.selectionEnd = end; cm.state.fakedLastChar = true; } cm.state.pasteIncoming = true; fastPoll(cm); }); function prepareCopy() { if (d.inaccurateSelection) { d.prevInput = ""; d.inaccurateSelection = false; d.input.value = cm.getSelection(); selectInput(d.input); } } on(d.input, "cut", prepareCopy); on(d.input, "copy", prepareCopy); // Needed to handle Tab key in KHTML if (khtml) on(d.sizer, "mouseup", function() { if (document.activeElement == d.input) d.input.blur(); focusInput(cm); }); } function eventInWidget(display, e) { for (var n = e_target(e); n != display.wrapper; n = n.parentNode) { if (!n || n.ignoreEvents || n.parentNode == display.sizer && n != display.mover) return true; } } function posFromMouse(cm, e, liberal) { var display = cm.display; if (!liberal) { var target = e_target(e); if (target == display.scrollbarH || target == display.scrollbarH.firstChild || target == display.scrollbarV || target == display.scrollbarV.firstChild || target == display.scrollbarFiller || target == display.gutterFiller) return null; } var x, y, space = getRect(display.lineSpace); // Fails unpredictably on IE[67] when mouse is dragged around quickly. try { x = e.clientX; y = e.clientY; } catch (e) { return null; } return coordsChar(cm, x - space.left, y - space.top); } var lastClick, lastDoubleClick; function onMouseDown(e) { if (signalDOMEvent(this, e)) return; var cm = this, display = cm.display, doc = cm.doc, sel = doc.sel; sel.shift = e.shiftKey; if (eventInWidget(display, e)) { if (!webkit) { display.scroller.draggable = false; setTimeout(function(){display.scroller.draggable = true;}, 100); } return; } if (clickInGutter(cm, e)) return; var start = posFromMouse(cm, e); switch (e_button(e)) { case 3: if (captureMiddleClick) onContextMenu.call(cm, cm, e); return; case 2: if (start) extendSelection(cm.doc, start); setTimeout(bind(focusInput, cm), 20); e_preventDefault(e); return; } // For button 1, if it was clicked inside the editor // (posFromMouse returning non-null), we have to adjust the // selection. if (!start) {if (e_target(e) == display.scroller) e_preventDefault(e); return;} if (!cm.state.focused) onFocus(cm); var now = +new Date, type = "single"; if (lastDoubleClick && lastDoubleClick.time > now - 400 && posEq(lastDoubleClick.pos, start)) { type = "triple"; e_preventDefault(e); setTimeout(bind(focusInput, cm), 20); selectLine(cm, start.line); } else if (lastClick && lastClick.time > now - 400 && posEq(lastClick.pos, start)) { type = "double"; lastDoubleClick = {time: now, pos: start}; e_preventDefault(e); var word = findWordAt(getLine(doc, start.line).text, start); extendSelection(cm.doc, word.from, word.to); } else { lastClick = {time: now, pos: start}; } var last = start; if (cm.options.dragDrop && dragAndDrop && !isReadOnly(cm) && !posEq(sel.from, sel.to) && !posLess(start, sel.from) && !posLess(sel.to, start) && type == "single") { var dragEnd = operation(cm, function(e2) { if (webkit) display.scroller.draggable = false; cm.state.draggingText = false; off(document, "mouseup", dragEnd); off(display.scroller, "drop", dragEnd); if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) { e_preventDefault(e2); extendSelection(cm.doc, start); focusInput(cm); } }); // Let the drag handler handle this. if (webkit) display.scroller.draggable = true; cm.state.draggingText = dragEnd; // IE's approach to draggable if (display.scroller.dragDrop) display.scroller.dragDrop(); on(document, "mouseup", dragEnd); on(display.scroller, "drop", dragEnd); return; } e_preventDefault(e); if (type == "single") extendSelection(cm.doc, clipPos(doc, start)); var startstart = sel.from, startend = sel.to, lastPos = start; function doSelect(cur) { if (posEq(lastPos, cur)) return; lastPos = cur; if (type == "single") { extendSelection(cm.doc, clipPos(doc, start), cur); return; } startstart = clipPos(doc, startstart); startend = clipPos(doc, startend); if (type == "double") { var word = findWordAt(getLine(doc, cur.line).text, cur); if (posLess(cur, startstart)) extendSelection(cm.doc, word.from, startend); else extendSelection(cm.doc, startstart, word.to); } else if (type == "triple") { if (posLess(cur, startstart)) extendSelection(cm.doc, startend, clipPos(doc, Pos(cur.line, 0))); else extendSelection(cm.doc, startstart, clipPos(doc, Pos(cur.line + 1, 0))); } } var editorSize = getRect(display.wrapper); // Used to ensure timeout re-tries don't fire when another extend // happened in the meantime (clearTimeout isn't reliable -- at // least on Chrome, the timeouts still happen even when cleared, // if the clear happens after their scheduled firing time). var counter = 0; function extend(e) { var curCount = ++counter; var cur = posFromMouse(cm, e, true); if (!cur) return; if (!posEq(cur, last)) { if (!cm.state.focused) onFocus(cm); last = cur; doSelect(cur); var visible = visibleLines(display, doc); if (cur.line >= visible.to || cur.line < visible.from) setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150); } else { var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0; if (outside) setTimeout(operation(cm, function() { if (counter != curCount) return; display.scroller.scrollTop += outside; extend(e); }), 50); } } function done(e) { counter = Infinity; e_preventDefault(e); focusInput(cm); off(document, "mousemove", move); off(document, "mouseup", up); } var move = operation(cm, function(e) { if (!ie && !e_button(e)) done(e); else extend(e); }); var up = operation(cm, done); on(document, "mousemove", move); on(document, "mouseup", up); } function clickInGutter(cm, e) { var display = cm.display; try { var mX = e.clientX, mY = e.clientY; } catch(e) { return false; } if (mX >= Math.floor(getRect(display.gutters).right)) return false; e_preventDefault(e); if (!hasHandler(cm, "gutterClick")) return true; var lineBox = getRect(display.lineDiv); if (mY > lineBox.bottom) return true; mY -= lineBox.top - display.viewOffset; for (var i = 0; i < cm.options.gutters.length; ++i) { var g = display.gutters.childNodes[i]; if (g && getRect(g).right >= mX) { var line = lineAtHeight(cm.doc, mY); var gutter = cm.options.gutters[i]; signalLater(cm, "gutterClick", cm, line, gutter, e); break; } } return true; } // Kludge to work around strange IE behavior where it'll sometimes // re-fire a series of drag-related events right after the drop (#1551) var lastDrop = 0; function onDrop(e) { var cm = this; if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e) || (cm.options.onDragEvent && cm.options.onDragEvent(cm, addStop(e)))) return; e_preventDefault(e); if (ie) lastDrop = +new Date; var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files; if (!pos || isReadOnly(cm)) return; if (files && files.length && window.FileReader && window.File) { var n = files.length, text = Array(n), read = 0; var loadFile = function(file, i) { var reader = new FileReader; reader.onload = function() { text[i] = reader.result; if (++read == n) { pos = clipPos(cm.doc, pos); makeChange(cm.doc, {from: pos, to: pos, text: splitLines(text.join("\n")), origin: "paste"}, "around"); } }; reader.readAsText(file); }; for (var i = 0; i < n; ++i) loadFile(files[i], i); } else { // Don't do a replace if the drop happened inside of the selected text. if (cm.state.draggingText && !(posLess(pos, cm.doc.sel.from) || posLess(cm.doc.sel.to, pos))) { cm.state.draggingText(e); // Ensure the editor is re-focused setTimeout(bind(focusInput, cm), 20); return; } try { var text = e.dataTransfer.getData("Text"); if (text) { var curFrom = cm.doc.sel.from, curTo = cm.doc.sel.to; setSelection(cm.doc, pos, pos); if (cm.state.draggingText) replaceRange(cm.doc, "", curFrom, curTo, "paste"); cm.replaceSelection(text, null, "paste"); focusInput(cm); onFocus(cm); } } catch(e){} } } function onDragStart(cm, e) { if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return; } if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) return; var txt = cm.getSelection(); e.dataTransfer.setData("Text", txt); // Use dummy image instead of default browsers image. // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there. if (e.dataTransfer.setDragImage && !safari) { var img = elt("img", null, null, "position: fixed; left: 0; top: 0;"); if (opera) { img.width = img.height = 1; cm.display.wrapper.appendChild(img); // Force a relayout, or Opera won't use our image for some obscure reason img._top = img.offsetTop; } e.dataTransfer.setDragImage(img, 0, 0); if (opera) img.parentNode.removeChild(img); } } function setScrollTop(cm, val) { if (Math.abs(cm.doc.scrollTop - val) < 2) return; cm.doc.scrollTop = val; if (!gecko) updateDisplay(cm, [], val); if (cm.display.scroller.scrollTop != val) cm.display.scroller.scrollTop = val; if (cm.display.scrollbarV.scrollTop != val) cm.display.scrollbarV.scrollTop = val; if (gecko) updateDisplay(cm, []); startWorker(cm, 100); } function setScrollLeft(cm, val, isScroller) { if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) return; val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth); cm.doc.scrollLeft = val; alignHorizontally(cm); if (cm.display.scroller.scrollLeft != val) cm.display.scroller.scrollLeft = val; if (cm.display.scrollbarH.scrollLeft != val) cm.display.scrollbarH.scrollLeft = val; } // Since the delta values reported on mouse wheel events are // unstandardized between browsers and even browser versions, and // generally horribly unpredictable, this code starts by measuring // the scroll effect that the first few mouse wheel events have, // and, from that, detects the way it can convert deltas to pixel // offsets afterwards. // // The reason we want to know the amount a wheel event will scroll // is that it gives us a chance to update the display before the // actual scrolling happens, reducing flickering. var wheelSamples = 0, wheelPixelsPerUnit = null; // Fill in a browser-detected starting value on browsers where we // know one. These don't have to be accurate -- the result of them // being wrong would just be a slight flicker on the first wheel // scroll (if it is large enough). if (ie) wheelPixelsPerUnit = -.53; else if (gecko) wheelPixelsPerUnit = 15; else if (chrome) wheelPixelsPerUnit = -.7; else if (safari) wheelPixelsPerUnit = -1/3; function onScrollWheel(cm, e) { var dx = e.wheelDeltaX, dy = e.wheelDeltaY; if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) dx = e.detail; if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) dy = e.detail; else if (dy == null) dy = e.wheelDelta; var display = cm.display, scroll = display.scroller; // Quit if there's nothing to scroll here if (!(dx && scroll.scrollWidth > scroll.clientWidth || dy && scroll.scrollHeight > scroll.clientHeight)) return; // Webkit browsers on OS X abort momentum scrolls when the target // of the scroll event is removed from the scrollable element. // This hack (see related code in patchDisplay) makes sure the // element is kept around. if (dy && mac && webkit) { for (var cur = e.target; cur != scroll; cur = cur.parentNode) { if (cur.lineObj) { cm.display.currentWheelTarget = cur; break; } } } // On some browsers, horizontal scrolling will cause redraws to // happen before the gutter has been realigned, causing it to // wriggle around in a most unseemly way. When we have an // estimated pixels/delta value, we just handle horizontal // scrolling entirely here. It'll be slightly off from native, but // better than glitching out. if (dx && !gecko && !opera && wheelPixelsPerUnit != null) { if (dy) setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight))); setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth))); e_preventDefault(e); display.wheelStartX = null; // Abort measurement, if in progress return; } if (dy && wheelPixelsPerUnit != null) { var pixels = dy * wheelPixelsPerUnit; var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight; if (pixels < 0) top = Math.max(0, top + pixels - 50); else bot = Math.min(cm.doc.height, bot + pixels + 50); updateDisplay(cm, [], {top: top, bottom: bot}); } if (wheelSamples < 20) { if (display.wheelStartX == null) { display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop; display.wheelDX = dx; display.wheelDY = dy; setTimeout(function() { if (display.wheelStartX == null) return; var movedX = scroll.scrollLeft - display.wheelStartX; var movedY = scroll.scrollTop - display.wheelStartY; var sample = (movedY && display.wheelDY && movedY / display.wheelDY) || (movedX && display.wheelDX && movedX / display.wheelDX); display.wheelStartX = display.wheelStartY = null; if (!sample) return; wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1); ++wheelSamples; }, 200); } else { display.wheelDX += dx; display.wheelDY += dy; } } } function doHandleBinding(cm, bound, dropShift) { if (typeof bound == "string") { bound = commands[bound]; if (!bound) return false; } // Ensure previous input has been read, so that the handler sees a // consistent view of the document if (cm.display.pollingFast && readInput(cm)) cm.display.pollingFast = false; var doc = cm.doc, prevShift = doc.sel.shift, done = false; try { if (isReadOnly(cm)) cm.state.suppressEdits = true; if (dropShift) doc.sel.shift = false; done = bound(cm) != Pass; } finally { doc.sel.shift = prevShift; cm.state.suppressEdits = false; } return done; } function allKeyMaps(cm) { var maps = cm.state.keyMaps.slice(0); if (cm.options.extraKeys) maps.push(cm.options.extraKeys); maps.push(cm.options.keyMap); return maps; } var maybeTransition; function handleKeyBinding(cm, e) { // Handle auto keymap transitions var startMap = getKeyMap(cm.options.keyMap), next = startMap.auto; clearTimeout(maybeTransition); if (next && !isModifierKey(e)) maybeTransition = setTimeout(function() { if (getKeyMap(cm.options.keyMap) == startMap) { cm.options.keyMap = (next.call ? next.call(null, cm) : next); keyMapChanged(cm); } }, 50); var name = keyName(e, true), handled = false; if (!name) return false; var keymaps = allKeyMaps(cm); if (e.shiftKey) { // First try to resolve full name (including 'Shift-'). Failing // that, see if there is a cursor-motion command (starting with // 'go') bound to the keyname without 'Shift-'. handled = lookupKey("Shift-" + name, keymaps, function(b) {return doHandleBinding(cm, b, true);}) || lookupKey(name, keymaps, function(b) { if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion) return doHandleBinding(cm, b); }); } else { handled = lookupKey(name, keymaps, function(b) { return doHandleBinding(cm, b); }); } if (handled) { e_preventDefault(e); restartBlink(cm); if (ie_lt9) { e.oldKeyCode = e.keyCode; e.keyCode = 0; } signalLater(cm, "keyHandled", cm, name, e); } return handled; } function handleCharBinding(cm, e, ch) { var handled = lookupKey("'" + ch + "'", allKeyMaps(cm), function(b) { return doHandleBinding(cm, b, true); }); if (handled) { e_preventDefault(e); restartBlink(cm); signalLater(cm, "keyHandled", cm, "'" + ch + "'", e); } return handled; } var lastStoppedKey = null; function onKeyDown(e) { var cm = this; if (!cm.state.focused) onFocus(cm); if (ie && e.keyCode == 27) { e.returnValue = false; } if (signalDOMEvent(cm, e) || cm.options.onKeyEvent && cm.options.onKeyEvent(cm, addStop(e))) return; var code = e.keyCode; // IE does strange things with escape. cm.doc.sel.shift = code == 16 || e.shiftKey; // First give onKeyEvent option a chance to handle this. var handled = handleKeyBinding(cm, e); if (opera) { lastStoppedKey = handled ? code : null; // Opera has no cut event... we try to at least catch the key combo if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey)) cm.replaceSelection(""); } } function onKeyPress(e) { var cm = this; if (signalDOMEvent(cm, e) || cm.options.onKeyEvent && cm.options.onKeyEvent(cm, addStop(e))) return; var keyCode = e.keyCode, charCode = e.charCode; if (opera && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;} if (((opera && (!e.which || e.which < 10)) || khtml) && handleKeyBinding(cm, e)) return; var ch = String.fromCharCode(charCode == null ? keyCode : charCode); if (this.options.electricChars && this.doc.mode.electricChars && this.options.smartIndent && !isReadOnly(this) && this.doc.mode.electricChars.indexOf(ch) > -1) setTimeout(operation(cm, function() {indentLine(cm, cm.doc.sel.to.line, "smart");}), 75); if (handleCharBinding(cm, e, ch)) return; if (ie && !ie_lt9) cm.display.inputHasSelection = null; fastPoll(cm); } function onFocus(cm) { if (cm.options.readOnly == "nocursor") return; if (!cm.state.focused) { signal(cm, "focus", cm); cm.state.focused = true; if (cm.display.wrapper.className.search(/\bCodeMirror-focused\b/) == -1) cm.display.wrapper.className += " CodeMirror-focused"; if (!cm.curOp) { resetInput(cm, true); if (webkit) setTimeout(bind(resetInput, cm, true), 0); // Issue #1730 } } slowPoll(cm); restartBlink(cm); } function onBlur(cm) { if (cm.state.focused) { signal(cm, "blur", cm); cm.state.focused = false; cm.display.wrapper.className = cm.display.wrapper.className.replace(" CodeMirror-focused", ""); } clearInterval(cm.display.blinker); setTimeout(function() {if (!cm.state.focused) cm.doc.sel.shift = false;}, 150); } var detectingSelectAll; function onContextMenu(cm, e) { if (signalDOMEvent(cm, e, "contextmenu")) return; var display = cm.display, sel = cm.doc.sel; if (eventInWidget(display, e)) return; var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop; if (!pos || opera) return; // Opera is difficult. if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to)) operation(cm, setSelection)(cm.doc, pos, pos); var oldCSS = display.input.style.cssText; display.inputDiv.style.position = "absolute"; display.input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) + "px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: white; outline: none;" + "border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);"; focusInput(cm); resetInput(cm, true); // Adds "Select all" to context menu in FF if (posEq(sel.from, sel.to)) display.input.value = display.prevInput = " "; function prepareSelectAllHack() { if (display.input.selectionStart != null) { var extval = display.input.value = " " + (posEq(sel.from, sel.to) ? "" : display.input.value); display.prevInput = " "; display.input.selectionStart = 1; display.input.selectionEnd = extval.length; } } function rehide() { display.inputDiv.style.position = "relative"; display.input.style.cssText = oldCSS; if (ie_lt9) display.scrollbarV.scrollTop = display.scroller.scrollTop = scrollPos; slowPoll(cm); // Try to detect the user choosing select-all if (display.input.selectionStart != null) { if (!ie || ie_lt9) prepareSelectAllHack(); clearTimeout(detectingSelectAll); var i = 0, poll = function(){ if (display.prevInput == " " && display.input.selectionStart == 0) operation(cm, commands.selectAll)(cm); else if (i++ < 10) detectingSelectAll = setTimeout(poll, 500); else resetInput(cm); }; detectingSelectAll = setTimeout(poll, 200); } } if (ie && !ie_lt9) prepareSelectAllHack(); if (captureMiddleClick) { e_stop(e); var mouseup = function() { off(window, "mouseup", mouseup); setTimeout(rehide, 20); }; on(window, "mouseup", mouseup); } else { setTimeout(rehide, 50); } } // UPDATING var changeEnd = CodeMirror.changeEnd = function(change) { if (!change.text) return change.to; return Pos(change.from.line + change.text.length - 1, lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0)); }; // Make sure a position will be valid after the given change. function clipPostChange(doc, change, pos) { if (!posLess(change.from, pos)) return clipPos(doc, pos); var diff = (change.text.length - 1) - (change.to.line - change.from.line); if (pos.line > change.to.line + diff) { var preLine = pos.line - diff, lastLine = doc.first + doc.size - 1; if (preLine > lastLine) return Pos(lastLine, getLine(doc, lastLine).text.length); return clipToLen(pos, getLine(doc, preLine).text.length); } if (pos.line == change.to.line + diff) return clipToLen(pos, lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0) + getLine(doc, change.to.line).text.length - change.to.ch); var inside = pos.line - change.from.line; return clipToLen(pos, change.text[inside].length + (inside ? 0 : change.from.ch)); } // Hint can be null|"end"|"start"|"around"|{anchor,head} function computeSelAfterChange(doc, change, hint) { if (hint && typeof hint == "object") // Assumed to be {anchor, head} object return {anchor: clipPostChange(doc, change, hint.anchor), head: clipPostChange(doc, change, hint.head)}; if (hint == "start") return {anchor: change.from, head: change.from}; var end = changeEnd(change); if (hint == "around") return {anchor: change.from, head: end}; if (hint == "end") return {anchor: end, head: end}; // hint is null, leave the selection alone as much as possible var adjustPos = function(pos) { if (posLess(pos, change.from)) return pos; if (!posLess(change.to, pos)) return end; var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch; if (pos.line == change.to.line) ch += end.ch - change.to.ch; return Pos(line, ch); }; return {anchor: adjustPos(doc.sel.anchor), head: adjustPos(doc.sel.head)}; } function filterChange(doc, change, update) { var obj = { canceled: false, from: change.from, to: change.to, text: change.text, origin: change.origin, cancel: function() { this.canceled = true; } }; if (update) obj.update = function(from, to, text, origin) { if (from) this.from = clipPos(doc, from); if (to) this.to = clipPos(doc, to); if (text) this.text = text; if (origin !== undefined) this.origin = origin; }; signal(doc, "beforeChange", doc, obj); if (doc.cm) signal(doc.cm, "beforeChange", doc.cm, obj); if (obj.canceled) return null; return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}; } // Replace the range from from to to by the strings in replacement. // change is a {from, to, text [, origin]} object function makeChange(doc, change, selUpdate, ignoreReadOnly) { if (doc.cm) { if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, selUpdate, ignoreReadOnly); if (doc.cm.state.suppressEdits) return; } if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) { change = filterChange(doc, change, true); if (!change) return; } // Possibly split or suppress the update based on the presence // of read-only spans in its range. var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to); if (split) { for (var i = split.length - 1; i >= 1; --i) makeChangeNoReadonly(doc, {from: split[i].from, to: split[i].to, text: [""]}); if (split.length) makeChangeNoReadonly(doc, {from: split[0].from, to: split[0].to, text: change.text}, selUpdate); } else { makeChangeNoReadonly(doc, change, selUpdate); } } function makeChangeNoReadonly(doc, change, selUpdate) { var selAfter = computeSelAfterChange(doc, change, selUpdate); addToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN); makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change)); var rebased = []; linkedDocs(doc, function(doc, sharedHist) { if (!sharedHist && indexOf(rebased, doc.history) == -1) { rebaseHist(doc.history, change); rebased.push(doc.history); } makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change)); }); } function makeChangeFromHistory(doc, type) { if (doc.cm && doc.cm.state.suppressEdits) return; var hist = doc.history; var event = (type == "undo" ? hist.done : hist.undone).pop(); if (!event) return; var anti = {changes: [], anchorBefore: event.anchorAfter, headBefore: event.headAfter, anchorAfter: event.anchorBefore, headAfter: event.headBefore, generation: hist.generation}; (type == "undo" ? hist.undone : hist.done).push(anti); hist.generation = event.generation || ++hist.maxGeneration; var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange"); for (var i = event.changes.length - 1; i >= 0; --i) { var change = event.changes[i]; change.origin = type; if (filter && !filterChange(doc, change, false)) { (type == "undo" ? hist.done : hist.undone).length = 0; return; } anti.changes.push(historyChangeFromChange(doc, change)); var after = i ? computeSelAfterChange(doc, change, null) : {anchor: event.anchorBefore, head: event.headBefore}; makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change)); var rebased = []; linkedDocs(doc, function(doc, sharedHist) { if (!sharedHist && indexOf(rebased, doc.history) == -1) { rebaseHist(doc.history, change); rebased.push(doc.history); } makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change)); }); } } function shiftDoc(doc, distance) { function shiftPos(pos) {return Pos(pos.line + distance, pos.ch);} doc.first += distance; if (doc.cm) regChange(doc.cm, doc.first, doc.first, distance); doc.sel.head = shiftPos(doc.sel.head); doc.sel.anchor = shiftPos(doc.sel.anchor); doc.sel.from = shiftPos(doc.sel.from); doc.sel.to = shiftPos(doc.sel.to); } function makeChangeSingleDoc(doc, change, selAfter, spans) { if (doc.cm && !doc.cm.curOp) return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans); if (change.to.line < doc.first) { shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line)); return; } if (change.from.line > doc.lastLine()) return; // Clip the change to the size of this doc if (change.from.line < doc.first) { var shift = change.text.length - 1 - (doc.first - change.from.line); shiftDoc(doc, shift); change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch), text: [lst(change.text)], origin: change.origin}; } var last = doc.lastLine(); if (change.to.line > last) { change = {from: change.from, to: Pos(last, getLine(doc, last).text.length), text: [change.text[0]], origin: change.origin}; } change.removed = getBetween(doc, change.from, change.to); if (!selAfter) selAfter = computeSelAfterChange(doc, change, null); if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans, selAfter); else updateDoc(doc, change, spans, selAfter); } function makeChangeSingleDocInEditor(cm, change, spans, selAfter) { var doc = cm.doc, display = cm.display, from = change.from, to = change.to; var recomputeMaxLength = false, checkWidthStart = from.line; if (!cm.options.lineWrapping) { checkWidthStart = lineNo(visualLine(doc, getLine(doc, from.line))); doc.iter(checkWidthStart, to.line + 1, function(line) { if (line == display.maxLine) { recomputeMaxLength = true; return true; } }); } if (!posLess(doc.sel.head, change.from) && !posLess(change.to, doc.sel.head)) cm.curOp.cursorActivity = true; updateDoc(doc, change, spans, selAfter, estimateHeight(cm)); if (!cm.options.lineWrapping) { doc.iter(checkWidthStart, from.line + change.text.length, function(line) { var len = lineLength(doc, line); if (len > display.maxLineLength) { display.maxLine = line; display.maxLineLength = len; display.maxLineChanged = true; recomputeMaxLength = false; } }); if (recomputeMaxLength) cm.curOp.updateMaxLine = true; } // Adjust frontier, schedule worker doc.frontier = Math.min(doc.frontier, from.line); startWorker(cm, 400); var lendiff = change.text.length - (to.line - from.line) - 1; // Remember that these lines changed, for updating the display regChange(cm, from.line, to.line + 1, lendiff); if (hasHandler(cm, "change")) { var changeObj = {from: from, to: to, text: change.text, removed: change.removed, origin: change.origin}; if (cm.curOp.textChanged) { for (var cur = cm.curOp.textChanged; cur.next; cur = cur.next) {} cur.next = changeObj; } else cm.curOp.textChanged = changeObj; } } function replaceRange(doc, code, from, to, origin) { if (!to) to = from; if (posLess(to, from)) { var tmp = to; to = from; from = tmp; } if (typeof code == "string") code = splitLines(code); makeChange(doc, {from: from, to: to, text: code, origin: origin}, null); } // POSITION OBJECT function Pos(line, ch) { if (!(this instanceof Pos)) return new Pos(line, ch); this.line = line; this.ch = ch; } CodeMirror.Pos = Pos; function posEq(a, b) {return a.line == b.line && a.ch == b.ch;} function posLess(a, b) {return a.line < b.line || (a.line == b.line && a.ch < b.ch);} function copyPos(x) {return Pos(x.line, x.ch);} // SELECTION function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1));} function clipPos(doc, pos) { if (pos.line < doc.first) return Pos(doc.first, 0); var last = doc.first + doc.size - 1; if (pos.line > last) return Pos(last, getLine(doc, last).text.length); return clipToLen(pos, getLine(doc, pos.line).text.length); } function clipToLen(pos, linelen) { var ch = pos.ch; if (ch == null || ch > linelen) return Pos(pos.line, linelen); else if (ch < 0) return Pos(pos.line, 0); else return pos; } function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size;} // If shift is held, this will move the selection anchor. Otherwise, // it'll set the whole selection. function extendSelection(doc, pos, other, bias) { if (doc.sel.shift || doc.sel.extend) { var anchor = doc.sel.anchor; if (other) { var posBefore = posLess(pos, anchor); if (posBefore != posLess(other, anchor)) { anchor = pos; pos = other; } else if (posBefore != posLess(pos, other)) { pos = other; } } setSelection(doc, anchor, pos, bias); } else { setSelection(doc, pos, other || pos, bias); } if (doc.cm) doc.cm.curOp.userSelChange = true; } function filterSelectionChange(doc, anchor, head) { var obj = {anchor: anchor, head: head}; signal(doc, "beforeSelectionChange", doc, obj); if (doc.cm) signal(doc.cm, "beforeSelectionChange", doc.cm, obj); obj.anchor = clipPos(doc, obj.anchor); obj.head = clipPos(doc, obj.head); return obj; } // Update the selection. Last two args are only used by // updateDoc, since they have to be expressed in the line // numbers before the update. function setSelection(doc, anchor, head, bias, checkAtomic) { if (!checkAtomic && hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange")) { var filtered = filterSelectionChange(doc, anchor, head); head = filtered.head; anchor = filtered.anchor; } var sel = doc.sel; sel.goalColumn = null; // Skip over atomic spans. if (checkAtomic || !posEq(anchor, sel.anchor)) anchor = skipAtomic(doc, anchor, bias, checkAtomic != "push"); if (checkAtomic || !posEq(head, sel.head)) head = skipAtomic(doc, head, bias, checkAtomic != "push"); if (posEq(sel.anchor, anchor) && posEq(sel.head, head)) return; sel.anchor = anchor; sel.head = head; var inv = posLess(head, anchor); sel.from = inv ? head : anchor; sel.to = inv ? anchor : head; if (doc.cm) doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = doc.cm.curOp.cursorActivity = true; signalLater(doc, "cursorActivity", doc); } function reCheckSelection(cm) { setSelection(cm.doc, cm.doc.sel.from, cm.doc.sel.to, null, "push"); } function skipAtomic(doc, pos, bias, mayClear) { var flipped = false, curPos = pos; var dir = bias || 1; doc.cantEdit = false; search: for (;;) { var line = getLine(doc, curPos.line); if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) { var sp = line.markedSpans[i], m = sp.marker; if ((sp.from == null || (m.inclusiveLeft ? sp.from <= curPos.ch : sp.from < curPos.ch)) && (sp.to == null || (m.inclusiveRight ? sp.to >= curPos.ch : sp.to > curPos.ch))) { if (mayClear) { signal(m, "beforeCursorEnter"); if (m.explicitlyCleared) { if (!line.markedSpans) break; else {--i; continue;} } } if (!m.atomic) continue; var newPos = m.find()[dir < 0 ? "from" : "to"]; if (posEq(newPos, curPos)) { newPos.ch += dir; if (newPos.ch < 0) { if (newPos.line > doc.first) newPos = clipPos(doc, Pos(newPos.line - 1)); else newPos = null; } else if (newPos.ch > line.text.length) { if (newPos.line < doc.first + doc.size - 1) newPos = Pos(newPos.line + 1, 0); else newPos = null; } if (!newPos) { if (flipped) { // Driven in a corner -- no valid cursor position found at all // -- try again *with* clearing, if we didn't already if (!mayClear) return skipAtomic(doc, pos, bias, true); // Otherwise, turn off editing until further notice, and return the start of the doc doc.cantEdit = true; return Pos(doc.first, 0); } flipped = true; newPos = pos; dir = -dir; } } curPos = newPos; continue search; } } } return curPos; } } // SCROLLING function scrollCursorIntoView(cm) { var coords = scrollPosIntoView(cm, cm.doc.sel.head, cm.options.cursorScrollMargin); if (!cm.state.focused) return; var display = cm.display, box = getRect(display.sizer), doScroll = null; if (coords.top + box.top < 0) doScroll = true; else if (coords.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) doScroll = false; if (doScroll != null && !phantom) { var hidden = display.cursor.style.display == "none"; if (hidden) { display.cursor.style.display = ""; display.cursor.style.left = coords.left + "px"; display.cursor.style.top = (coords.top - display.viewOffset) + "px"; } display.cursor.scrollIntoView(doScroll); if (hidden) display.cursor.style.display = "none"; } } function scrollPosIntoView(cm, pos, margin) { if (margin == null) margin = 0; for (;;) { var changed = false, coords = cursorCoords(cm, pos); var scrollPos = calculateScrollPos(cm, coords.left, coords.top - margin, coords.left, coords.bottom + margin); var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft; if (scrollPos.scrollTop != null) { setScrollTop(cm, scrollPos.scrollTop); if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true; } if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true; } if (!changed) return coords; } } function scrollIntoView(cm, x1, y1, x2, y2) { var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2); if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop); if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft); } function calculateScrollPos(cm, x1, y1, x2, y2) { var display = cm.display, snapMargin = textHeight(cm.display); if (y1 < 0) y1 = 0; var screen = display.scroller.clientHeight - scrollerCutOff, screentop = display.scroller.scrollTop, result = {}; var docBottom = cm.doc.height + paddingVert(display); var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin; if (y1 < screentop) { result.scrollTop = atTop ? 0 : y1; } else if (y2 > screentop + screen) { var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen); if (newTop != screentop) result.scrollTop = newTop; } var screenw = display.scroller.clientWidth - scrollerCutOff, screenleft = display.scroller.scrollLeft; x1 += display.gutters.offsetWidth; x2 += display.gutters.offsetWidth; var gutterw = display.gutters.offsetWidth; var atLeft = x1 < gutterw + 10; if (x1 < screenleft + gutterw || atLeft) { if (atLeft) x1 = 0; result.scrollLeft = Math.max(0, x1 - 10 - gutterw); } else if (x2 > screenw + screenleft - 3) { result.scrollLeft = x2 + 10 - screenw; } return result; } function updateScrollPos(cm, left, top) { cm.curOp.updateScrollPos = {scrollLeft: left == null ? cm.doc.scrollLeft : left, scrollTop: top == null ? cm.doc.scrollTop : top}; } function addToScrollPos(cm, left, top) { var pos = cm.curOp.updateScrollPos || (cm.curOp.updateScrollPos = {scrollLeft: cm.doc.scrollLeft, scrollTop: cm.doc.scrollTop}); var scroll = cm.display.scroller; pos.scrollTop = Math.max(0, Math.min(scroll.scrollHeight - scroll.clientHeight, pos.scrollTop + top)); pos.scrollLeft = Math.max(0, Math.min(scroll.scrollWidth - scroll.clientWidth, pos.scrollLeft + left)); } // API UTILITIES function indentLine(cm, n, how, aggressive) { var doc = cm.doc; if (how == null) how = "add"; if (how == "smart") { if (!cm.doc.mode.indent) how = "prev"; else var state = getStateBefore(cm, n); } var tabSize = cm.options.tabSize; var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize); var curSpaceString = line.text.match(/^\s*/)[0], indentation; if (how == "smart") { indentation = cm.doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text); if (indentation == Pass) { if (!aggressive) return; how = "prev"; } } if (how == "prev") { if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize); else indentation = 0; } else if (how == "add") { indentation = curSpace + cm.options.indentUnit; } else if (how == "subtract") { indentation = curSpace - cm.options.indentUnit; } else if (typeof how == "number") { indentation = curSpace + how; } indentation = Math.max(0, indentation); var indentString = "", pos = 0; if (cm.options.indentWithTabs) for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";} if (pos < indentation) indentString += spaceStr(indentation - pos); if (indentString != curSpaceString) replaceRange(cm.doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input"); line.stateAfter = null; } function changeLine(cm, handle, op) { var no = handle, line = handle, doc = cm.doc; if (typeof handle == "number") line = getLine(doc, clipLine(doc, handle)); else no = lineNo(handle); if (no == null) return null; if (op(line, no)) regChange(cm, no, no + 1); else return null; return line; } function findPosH(doc, pos, dir, unit, visually) { var line = pos.line, ch = pos.ch, origDir = dir; var lineObj = getLine(doc, line); var possible = true; function findNextLine() { var l = line + dir; if (l < doc.first || l >= doc.first + doc.size) return (possible = false); line = l; return lineObj = getLine(doc, l); } function moveOnce(boundToLine) { var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true); if (next == null) { if (!boundToLine && findNextLine()) { if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj); else ch = dir < 0 ? lineObj.text.length : 0; } else return (possible = false); } else ch = next; return true; } if (unit == "char") moveOnce(); else if (unit == "column") moveOnce(true); else if (unit == "word" || unit == "group") { var sawType = null, group = unit == "group"; for (var first = true;; first = false) { if (dir < 0 && !moveOnce(!first)) break; var cur = lineObj.text.charAt(ch) || "\n"; var type = isWordChar(cur) ? "w" : !group ? null : /\s/.test(cur) ? null : "p"; if (sawType && sawType != type) { if (dir < 0) {dir = 1; moveOnce();} break; } if (type) sawType = type; if (dir > 0 && !moveOnce(!first)) break; } } var result = skipAtomic(doc, Pos(line, ch), origDir, true); if (!possible) result.hitSide = true; return result; } function findPosV(cm, pos, dir, unit) { var doc = cm.doc, x = pos.left, y; if (unit == "page") { var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight); y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display)); } else if (unit == "line") { y = dir > 0 ? pos.bottom + 3 : pos.top - 3; } for (;;) { var target = coordsChar(cm, x, y); if (!target.outside) break; if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; } y += dir * 5; } return target; } function findWordAt(line, pos) { var start = pos.ch, end = pos.ch; if (line) { if ((pos.xRel < 0 || end == line.length) && start) --start; else ++end; var startChar = line.charAt(start); var check = isWordChar(startChar) ? isWordChar : /\s/.test(startChar) ? function(ch) {return /\s/.test(ch);} : function(ch) {return !/\s/.test(ch) && !isWordChar(ch);}; while (start > 0 && check(line.charAt(start - 1))) --start; while (end < line.length && check(line.charAt(end))) ++end; } return {from: Pos(pos.line, start), to: Pos(pos.line, end)}; } function selectLine(cm, line) { extendSelection(cm.doc, Pos(line, 0), clipPos(cm.doc, Pos(line + 1, 0))); } // PROTOTYPE // The publicly visible API. Note that operation(null, f) means // 'wrap f in an operation, performed on its `this` parameter' CodeMirror.prototype = { constructor: CodeMirror, focus: function(){window.focus(); focusInput(this); onFocus(this); fastPoll(this);}, setOption: function(option, value) { var options = this.options, old = options[option]; if (options[option] == value && option != "mode") return; options[option] = value; if (optionHandlers.hasOwnProperty(option)) operation(this, optionHandlers[option])(this, value, old); }, getOption: function(option) {return this.options[option];}, getDoc: function() {return this.doc;}, addKeyMap: function(map, bottom) { this.state.keyMaps[bottom ? "push" : "unshift"](map); }, removeKeyMap: function(map) { var maps = this.state.keyMaps; for (var i = 0; i < maps.length; ++i) if (maps[i] == map || (typeof maps[i] != "string" && maps[i].name == map)) { maps.splice(i, 1); return true; } }, addOverlay: operation(null, function(spec, options) { var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec); if (mode.startState) throw new Error("Overlays may not be stateful."); this.state.overlays.push({mode: mode, modeSpec: spec, opaque: options && options.opaque}); this.state.modeGen++; regChange(this); }), removeOverlay: operation(null, function(spec) { var overlays = this.state.overlays; for (var i = 0; i < overlays.length; ++i) { var cur = overlays[i].modeSpec; if (cur == spec || typeof spec == "string" && cur.name == spec) { overlays.splice(i, 1); this.state.modeGen++; regChange(this); return; } } }), indentLine: operation(null, function(n, dir, aggressive) { if (typeof dir != "string" && typeof dir != "number") { if (dir == null) dir = this.options.smartIndent ? "smart" : "prev"; else dir = dir ? "add" : "subtract"; } if (isLine(this.doc, n)) indentLine(this, n, dir, aggressive); }), indentSelection: operation(null, function(how) { var sel = this.doc.sel; if (posEq(sel.from, sel.to)) return indentLine(this, sel.from.line, how); var e = sel.to.line - (sel.to.ch ? 0 : 1); for (var i = sel.from.line; i <= e; ++i) indentLine(this, i, how); }), // Fetch the parser token for a given character. Useful for hacks // that want to inspect the mode state (say, for completion). getTokenAt: function(pos, precise) { var doc = this.doc; pos = clipPos(doc, pos); var state = getStateBefore(this, pos.line, precise), mode = this.doc.mode; var line = getLine(doc, pos.line); var stream = new StringStream(line.text, this.options.tabSize); while (stream.pos < pos.ch && !stream.eol()) { stream.start = stream.pos; var style = mode.token(stream, state); } return {start: stream.start, end: stream.pos, string: stream.current(), className: style || null, // Deprecated, use 'type' instead type: style || null, state: state}; }, getTokenTypeAt: function(pos) { pos = clipPos(this.doc, pos); var styles = getLineStyles(this, getLine(this.doc, pos.line)); var before = 0, after = (styles.length - 1) / 2, ch = pos.ch; if (ch == 0) return styles[2]; for (;;) { var mid = (before + after) >> 1; if ((mid ? styles[mid * 2 - 1] : 0) >= ch) after = mid; else if (styles[mid * 2 + 1] < ch) before = mid + 1; else return styles[mid * 2 + 2]; } }, getModeAt: function(pos) { var mode = this.doc.mode; if (!mode.innerMode) return mode; return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode; }, getHelper: function(pos, type) { if (!helpers.hasOwnProperty(type)) return; var help = helpers[type], mode = this.getModeAt(pos); return mode[type] && help[mode[type]] || mode.helperType && help[mode.helperType] || help[mode.name]; }, getStateAfter: function(line, precise) { var doc = this.doc; line = clipLine(doc, line == null ? doc.first + doc.size - 1: line); return getStateBefore(this, line + 1, precise); }, cursorCoords: function(start, mode) { var pos, sel = this.doc.sel; if (start == null) pos = sel.head; else if (typeof start == "object") pos = clipPos(this.doc, start); else pos = start ? sel.from : sel.to; return cursorCoords(this, pos, mode || "page"); }, charCoords: function(pos, mode) { return charCoords(this, clipPos(this.doc, pos), mode || "page"); }, coordsChar: function(coords, mode) { coords = fromCoordSystem(this, coords, mode || "page"); return coordsChar(this, coords.left, coords.top); }, lineAtHeight: function(height, mode) { height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top; return lineAtHeight(this.doc, height + this.display.viewOffset); }, heightAtLine: function(line, mode) { var end = false, last = this.doc.first + this.doc.size - 1; if (line < this.doc.first) line = this.doc.first; else if (line > last) { line = last; end = true; } var lineObj = getLine(this.doc, line); return intoCoordSystem(this, getLine(this.doc, line), {top: 0, left: 0}, mode || "page").top + (end ? lineObj.height : 0); }, defaultTextHeight: function() { return textHeight(this.display); }, defaultCharWidth: function() { return charWidth(this.display); }, setGutterMarker: operation(null, function(line, gutterID, value) { return changeLine(this, line, function(line) { var markers = line.gutterMarkers || (line.gutterMarkers = {}); markers[gutterID] = value; if (!value && isEmpty(markers)) line.gutterMarkers = null; return true; }); }), clearGutter: operation(null, function(gutterID) { var cm = this, doc = cm.doc, i = doc.first; doc.iter(function(line) { if (line.gutterMarkers && line.gutterMarkers[gutterID]) { line.gutterMarkers[gutterID] = null; regChange(cm, i, i + 1); if (isEmpty(line.gutterMarkers)) line.gutterMarkers = null; } ++i; }); }), addLineClass: operation(null, function(handle, where, cls) { return changeLine(this, handle, function(line) { var prop = where == "text" ? "textClass" : where == "background" ? "bgClass" : "wrapClass"; if (!line[prop]) line[prop] = cls; else if (new RegExp("(?:^|\\s)" + cls + "(?:$|\\s)").test(line[prop])) return false; else line[prop] += " " + cls; return true; }); }), removeLineClass: operation(null, function(handle, where, cls) { return changeLine(this, handle, function(line) { var prop = where == "text" ? "textClass" : where == "background" ? "bgClass" : "wrapClass"; var cur = line[prop]; if (!cur) return false; else if (cls == null) line[prop] = null; else { var found = cur.match(new RegExp("(?:^|\\s+)" + cls + "(?:$|\\s+)")); if (!found) return false; var end = found.index + found[0].length; line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null; } return true; }); }), addLineWidget: operation(null, function(handle, node, options) { return addLineWidget(this, handle, node, options); }), removeLineWidget: function(widget) { widget.clear(); }, lineInfo: function(line) { if (typeof line == "number") { if (!isLine(this.doc, line)) return null; var n = line; line = getLine(this.doc, line); if (!line) return null; } else { var n = lineNo(line); if (n == null) return null; } return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers, textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass, widgets: line.widgets}; }, getViewport: function() { return {from: this.display.showingFrom, to: this.display.showingTo};}, addWidget: function(pos, node, scroll, vert, horiz) { var display = this.display; pos = cursorCoords(this, clipPos(this.doc, pos)); var top = pos.bottom, left = pos.left; node.style.position = "absolute"; display.sizer.appendChild(node); if (vert == "over") { top = pos.top; } else if (vert == "above" || vert == "near") { var vspace = Math.max(display.wrapper.clientHeight, this.doc.height), hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth); // Default to positioning above (if specified and possible); otherwise default to positioning below if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight) top = pos.top - node.offsetHeight; else if (pos.bottom + node.offsetHeight <= vspace) top = pos.bottom; if (left + node.offsetWidth > hspace) left = hspace - node.offsetWidth; } node.style.top = top + "px"; node.style.left = node.style.right = ""; if (horiz == "right") { left = display.sizer.clientWidth - node.offsetWidth; node.style.right = "0px"; } else { if (horiz == "left") left = 0; else if (horiz == "middle") left = (display.sizer.clientWidth - node.offsetWidth) / 2; node.style.left = left + "px"; } if (scroll) scrollIntoView(this, left, top, left + node.offsetWidth, top + node.offsetHeight); }, triggerOnKeyDown: operation(null, onKeyDown), execCommand: function(cmd) {return commands[cmd](this);}, findPosH: function(from, amount, unit, visually) { var dir = 1; if (amount < 0) { dir = -1; amount = -amount; } for (var i = 0, cur = clipPos(this.doc, from); i < amount; ++i) { cur = findPosH(this.doc, cur, dir, unit, visually); if (cur.hitSide) break; } return cur; }, moveH: operation(null, function(dir, unit) { var sel = this.doc.sel, pos; if (sel.shift || sel.extend || posEq(sel.from, sel.to)) pos = findPosH(this.doc, sel.head, dir, unit, this.options.rtlMoveVisually); else pos = dir < 0 ? sel.from : sel.to; extendSelection(this.doc, pos, pos, dir); }), deleteH: operation(null, function(dir, unit) { var sel = this.doc.sel; if (!posEq(sel.from, sel.to)) replaceRange(this.doc, "", sel.from, sel.to, "+delete"); else replaceRange(this.doc, "", sel.from, findPosH(this.doc, sel.head, dir, unit, false), "+delete"); this.curOp.userSelChange = true; }), findPosV: function(from, amount, unit, goalColumn) { var dir = 1, x = goalColumn; if (amount < 0) { dir = -1; amount = -amount; } for (var i = 0, cur = clipPos(this.doc, from); i < amount; ++i) { var coords = cursorCoords(this, cur, "div"); if (x == null) x = coords.left; else coords.left = x; cur = findPosV(this, coords, dir, unit); if (cur.hitSide) break; } return cur; }, moveV: operation(null, function(dir, unit) { var sel = this.doc.sel; var pos = cursorCoords(this, sel.head, "div"); if (sel.goalColumn != null) pos.left = sel.goalColumn; var target = findPosV(this, pos, dir, unit); if (unit == "page") addToScrollPos(this, 0, charCoords(this, target, "div").top - pos.top); extendSelection(this.doc, target, target, dir); sel.goalColumn = pos.left; }), toggleOverwrite: function(value) { if (value != null && value == this.state.overwrite) return; if (this.state.overwrite = !this.state.overwrite) this.display.cursor.className += " CodeMirror-overwrite"; else this.display.cursor.className = this.display.cursor.className.replace(" CodeMirror-overwrite", ""); }, hasFocus: function() { return this.state.focused; }, scrollTo: operation(null, function(x, y) { updateScrollPos(this, x, y); }), getScrollInfo: function() { var scroller = this.display.scroller, co = scrollerCutOff; return {left: scroller.scrollLeft, top: scroller.scrollTop, height: scroller.scrollHeight - co, width: scroller.scrollWidth - co, clientHeight: scroller.clientHeight - co, clientWidth: scroller.clientWidth - co}; }, scrollIntoView: operation(null, function(pos, margin) { if (typeof pos == "number") pos = Pos(pos, 0); if (!margin) margin = 0; var coords = pos; if (!pos || pos.line != null) { this.curOp.scrollToPos = pos ? clipPos(this.doc, pos) : this.doc.sel.head; this.curOp.scrollToPosMargin = margin; coords = cursorCoords(this, this.curOp.scrollToPos); } var sPos = calculateScrollPos(this, coords.left, coords.top - margin, coords.right, coords.bottom + margin); updateScrollPos(this, sPos.scrollLeft, sPos.scrollTop); }), setSize: operation(null, function(width, height) { function interpret(val) { return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val; } if (width != null) this.display.wrapper.style.width = interpret(width); if (height != null) this.display.wrapper.style.height = interpret(height); if (this.options.lineWrapping) this.display.measureLineCache.length = this.display.measureLineCachePos = 0; this.curOp.forceUpdate = true; }), operation: function(f){return runInOp(this, f);}, refresh: operation(null, function() { clearCaches(this); updateScrollPos(this, this.doc.scrollLeft, this.doc.scrollTop); regChange(this); }), swapDoc: operation(null, function(doc) { var old = this.doc; old.cm = null; attachDoc(this, doc); clearCaches(this); resetInput(this, true); updateScrollPos(this, doc.scrollLeft, doc.scrollTop); return old; }), getInputField: function(){return this.display.input;}, getWrapperElement: function(){return this.display.wrapper;}, getScrollerElement: function(){return this.display.scroller;}, getGutterElement: function(){return this.display.gutters;} }; eventMixin(CodeMirror); // OPTION DEFAULTS var optionHandlers = CodeMirror.optionHandlers = {}; // The default configuration options. var defaults = CodeMirror.defaults = {}; function option(name, deflt, handle, notOnInit) { CodeMirror.defaults[name] = deflt; if (handle) optionHandlers[name] = notOnInit ? function(cm, val, old) {if (old != Init) handle(cm, val, old);} : handle; } var Init = CodeMirror.Init = {toString: function(){return "CodeMirror.Init";}}; // These two are, on init, called from the constructor because they // have to be initialized before the editor can start at all. option("value", "", function(cm, val) { cm.setValue(val); }, true); option("mode", null, function(cm, val) { cm.doc.modeOption = val; loadMode(cm); }, true); option("indentUnit", 2, loadMode, true); option("indentWithTabs", false); option("smartIndent", true); option("tabSize", 4, function(cm) { loadMode(cm); clearCaches(cm); regChange(cm); }, true); option("electricChars", true); option("rtlMoveVisually", !windows); option("theme", "default", function(cm) { themeChanged(cm); guttersChanged(cm); }, true); option("keyMap", "default", keyMapChanged); option("extraKeys", null); option("onKeyEvent", null); option("onDragEvent", null); option("lineWrapping", false, wrappingChanged, true); option("gutters", [], function(cm) { setGuttersForLineNumbers(cm.options); guttersChanged(cm); }, true); option("fixedGutter", true, function(cm, val) { cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0"; cm.refresh(); }, true); option("coverGutterNextToScrollbar", false, updateScrollbars, true); option("lineNumbers", false, function(cm) { setGuttersForLineNumbers(cm.options); guttersChanged(cm); }, true); option("firstLineNumber", 1, guttersChanged, true); option("lineNumberFormatter", function(integer) {return integer;}, guttersChanged, true); option("showCursorWhenSelecting", false, updateSelection, true); option("readOnly", false, function(cm, val) { if (val == "nocursor") {onBlur(cm); cm.display.input.blur();} else if (!val) resetInput(cm, true); }); option("dragDrop", true); option("cursorBlinkRate", 530); option("cursorScrollMargin", 0); option("cursorHeight", 1); option("workTime", 100); option("workDelay", 100); option("flattenSpans", true); option("pollInterval", 100); option("undoDepth", 40, function(cm, val){cm.doc.history.undoDepth = val;}); option("historyEventDelay", 500); option("viewportMargin", 10, function(cm){cm.refresh();}, true); option("maxHighlightLength", 10000, function(cm){loadMode(cm); cm.refresh();}, true); option("moveInputWithCursor", true, function(cm, val) { if (!val) cm.display.inputDiv.style.top = cm.display.inputDiv.style.left = 0; }); option("tabindex", null, function(cm, val) { cm.display.input.tabIndex = val || ""; }); option("autofocus", null); // MODE DEFINITION AND QUERYING // Known modes, by name and by MIME var modes = CodeMirror.modes = {}, mimeModes = CodeMirror.mimeModes = {}; CodeMirror.defineMode = function(name, mode) { if (!CodeMirror.defaults.mode && name != "null") CodeMirror.defaults.mode = name; if (arguments.length > 2) { mode.dependencies = []; for (var i = 2; i < arguments.length; ++i) mode.dependencies.push(arguments[i]); } modes[name] = mode; }; CodeMirror.defineMIME = function(mime, spec) { mimeModes[mime] = spec; }; CodeMirror.resolveMode = function(spec) { if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) { spec = mimeModes[spec]; } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) { var found = mimeModes[spec.name]; spec = createObj(found, spec); spec.name = found.name; } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) { return CodeMirror.resolveMode("application/xml"); } if (typeof spec == "string") return {name: spec}; else return spec || {name: "null"}; }; CodeMirror.getMode = function(options, spec) { var spec = CodeMirror.resolveMode(spec); var mfactory = modes[spec.name]; if (!mfactory) return CodeMirror.getMode(options, "text/plain"); var modeObj = mfactory(options, spec); if (modeExtensions.hasOwnProperty(spec.name)) { var exts = modeExtensions[spec.name]; for (var prop in exts) { if (!exts.hasOwnProperty(prop)) continue; if (modeObj.hasOwnProperty(prop)) modeObj["_" + prop] = modeObj[prop]; modeObj[prop] = exts[prop]; } } modeObj.name = spec.name; return modeObj; }; CodeMirror.defineMode("null", function() { return {token: function(stream) {stream.skipToEnd();}}; }); CodeMirror.defineMIME("text/plain", "null"); var modeExtensions = CodeMirror.modeExtensions = {}; CodeMirror.extendMode = function(mode, properties) { var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {}); copyObj(properties, exts); }; // EXTENSIONS CodeMirror.defineExtension = function(name, func) { CodeMirror.prototype[name] = func; }; CodeMirror.defineDocExtension = function(name, func) { Doc.prototype[name] = func; }; CodeMirror.defineOption = option; var initHooks = []; CodeMirror.defineInitHook = function(f) {initHooks.push(f);}; var helpers = CodeMirror.helpers = {}; CodeMirror.registerHelper = function(type, name, value) { if (!helpers.hasOwnProperty(type)) helpers[type] = CodeMirror[type] = {}; helpers[type][name] = value; }; // UTILITIES CodeMirror.isWordChar = isWordChar; // MODE STATE HANDLING // Utility functions for working with state. Exported because modes // sometimes need to do this. function copyState(mode, state) { if (state === true) return state; if (mode.copyState) return mode.copyState(state); var nstate = {}; for (var n in state) { var val = state[n]; if (val instanceof Array) val = val.concat([]); nstate[n] = val; } return nstate; } CodeMirror.copyState = copyState; function startState(mode, a1, a2) { return mode.startState ? mode.startState(a1, a2) : true; } CodeMirror.startState = startState; CodeMirror.innerMode = function(mode, state) { while (mode.innerMode) { var info = mode.innerMode(state); if (!info || info.mode == mode) break; state = info.state; mode = info.mode; } return info || {mode: mode, state: state}; }; // STANDARD COMMANDS var commands = CodeMirror.commands = { selectAll: function(cm) {cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()));}, killLine: function(cm) { var from = cm.getCursor(true), to = cm.getCursor(false), sel = !posEq(from, to); if (!sel && cm.getLine(from.line).length == from.ch) cm.replaceRange("", from, Pos(from.line + 1, 0), "+delete"); else cm.replaceRange("", from, sel ? to : Pos(from.line), "+delete"); }, deleteLine: function(cm) { var l = cm.getCursor().line; cm.replaceRange("", Pos(l, 0), Pos(l), "+delete"); }, delLineLeft: function(cm) { var cur = cm.getCursor(); cm.replaceRange("", Pos(cur.line, 0), cur, "+delete"); }, undo: function(cm) {cm.undo();}, redo: function(cm) {cm.redo();}, goDocStart: function(cm) {cm.extendSelection(Pos(cm.firstLine(), 0));}, goDocEnd: function(cm) {cm.extendSelection(Pos(cm.lastLine()));}, goLineStart: function(cm) { cm.extendSelection(lineStart(cm, cm.getCursor().line)); }, goLineStartSmart: function(cm) { var cur = cm.getCursor(), start = lineStart(cm, cur.line); var line = cm.getLineHandle(start.line); var order = getOrder(line); if (!order || order[0].level == 0) { var firstNonWS = Math.max(0, line.text.search(/\S/)); var inWS = cur.line == start.line && cur.ch <= firstNonWS && cur.ch; cm.extendSelection(Pos(start.line, inWS ? 0 : firstNonWS)); } else cm.extendSelection(start); }, goLineEnd: function(cm) { cm.extendSelection(lineEnd(cm, cm.getCursor().line)); }, goLineRight: function(cm) { var top = cm.charCoords(cm.getCursor(), "div").top + 5; cm.extendSelection(cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div")); }, goLineLeft: function(cm) { var top = cm.charCoords(cm.getCursor(), "div").top + 5; cm.extendSelection(cm.coordsChar({left: 0, top: top}, "div")); }, goLineUp: function(cm) {cm.moveV(-1, "line");}, goLineDown: function(cm) {cm.moveV(1, "line");}, goPageUp: function(cm) {cm.moveV(-1, "page");}, goPageDown: function(cm) {cm.moveV(1, "page");}, goCharLeft: function(cm) {cm.moveH(-1, "char");}, goCharRight: function(cm) {cm.moveH(1, "char");}, goColumnLeft: function(cm) {cm.moveH(-1, "column");}, goColumnRight: function(cm) {cm.moveH(1, "column");}, goWordLeft: function(cm) {cm.moveH(-1, "word");}, goGroupRight: function(cm) {cm.moveH(1, "group");}, goGroupLeft: function(cm) {cm.moveH(-1, "group");}, goWordRight: function(cm) {cm.moveH(1, "word");}, delCharBefore: function(cm) {cm.deleteH(-1, "char");}, delCharAfter: function(cm) {cm.deleteH(1, "char");}, delWordBefore: function(cm) {cm.deleteH(-1, "word");}, delWordAfter: function(cm) {cm.deleteH(1, "word");}, delGroupBefore: function(cm) {cm.deleteH(-1, "group");}, delGroupAfter: function(cm) {cm.deleteH(1, "group");}, indentAuto: function(cm) {cm.indentSelection("smart");}, indentMore: function(cm) {cm.indentSelection("add");}, indentLess: function(cm) {cm.indentSelection("subtract");}, insertTab: function(cm) {cm.replaceSelection("\t", "end", "+input");}, defaultTab: function(cm) { if (cm.somethingSelected()) cm.indentSelection("add"); else cm.replaceSelection("\t", "end", "+input"); }, transposeChars: function(cm) { var cur = cm.getCursor(), line = cm.getLine(cur.line); if (cur.ch > 0 && cur.ch < line.length - 1) cm.replaceRange(line.charAt(cur.ch) + line.charAt(cur.ch - 1), Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1)); }, newlineAndIndent: function(cm) { operation(cm, function() { cm.replaceSelection("\n", "end", "+input"); cm.indentLine(cm.getCursor().line, null, true); })(); }, toggleOverwrite: function(cm) {cm.toggleOverwrite();} }; // STANDARD KEYMAPS var keyMap = CodeMirror.keyMap = {}; keyMap.basic = { "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown", "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown", "Delete": "delCharAfter", "Backspace": "delCharBefore", "Tab": "defaultTab", "Shift-Tab": "indentAuto", "Enter": "newlineAndIndent", "Insert": "toggleOverwrite" }; // Note that the save and find-related commands aren't defined by // default. Unknown commands are simply ignored. keyMap.pcDefault = { "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo", "Ctrl-Home": "goDocStart", "Alt-Up": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Down": "goDocEnd", "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", fallthrough: "basic" }; keyMap.macDefault = { "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo", "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft", "Alt-Right": "goGroupRight", "Cmd-Left": "goLineStart", "Cmd-Right": "goLineEnd", "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": "delLineLeft", fallthrough: ["basic", "emacsy"] }; keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault; keyMap.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" }; // KEYMAP DISPATCH function getKeyMap(val) { if (typeof val == "string") return keyMap[val]; else return val; } function lookupKey(name, maps, handle) { function lookup(map) { map = getKeyMap(map); var found = map[name]; if (found === false) return "stop"; if (found != null && handle(found)) return true; if (map.nofallthrough) return "stop"; var fallthrough = map.fallthrough; if (fallthrough == null) return false; if (Object.prototype.toString.call(fallthrough) != "[object Array]") return lookup(fallthrough); for (var i = 0, e = fallthrough.length; i < e; ++i) { var done = lookup(fallthrough[i]); if (done) return done; } return false; } for (var i = 0; i < maps.length; ++i) { var done = lookup(maps[i]); if (done) return done != "stop"; } } function isModifierKey(event) { var name = keyNames[event.keyCode]; return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod"; } function keyName(event, noShift) { if (opera && event.keyCode == 34 && event["char"]) return false; var name = keyNames[event.keyCode]; if (name == null || event.altGraphKey) return false; if (event.altKey) name = "Alt-" + name; if (flipCtrlCmd ? event.metaKey : event.ctrlKey) name = "Ctrl-" + name; if (flipCtrlCmd ? event.ctrlKey : event.metaKey) name = "Cmd-" + name; if (!noShift && event.shiftKey) name = "Shift-" + name; return name; } CodeMirror.lookupKey = lookupKey; CodeMirror.isModifierKey = isModifierKey; CodeMirror.keyName = keyName; // FROMTEXTAREA CodeMirror.fromTextArea = function(textarea, options) { if (!options) options = {}; options.value = textarea.value; if (!options.tabindex && textarea.tabindex) options.tabindex = textarea.tabindex; if (!options.placeholder && textarea.placeholder) options.placeholder = textarea.placeholder; // Set autofocus to true if this textarea is focused, or if it has // autofocus and no other element is focused. if (options.autofocus == null) { var hasFocus = document.body; // doc.activeElement occasionally throws on IE try { hasFocus = document.activeElement; } catch(e) {} options.autofocus = hasFocus == textarea || textarea.getAttribute("autofocus") != null && hasFocus == document.body; } function save() {textarea.value = cm.getValue();} if (textarea.form) { on(textarea.form, "submit", save); // Deplorable hack to make the submit method do the right thing. if (!options.leaveSubmitMethodAlone) { var form = textarea.form, realSubmit = form.submit; try { var wrappedSubmit = form.submit = function() { save(); form.submit = realSubmit; form.submit(); form.submit = wrappedSubmit; }; } catch(e) {} } } textarea.style.display = "none"; var cm = CodeMirror(function(node) { textarea.parentNode.insertBefore(node, textarea.nextSibling); }, options); cm.save = save; cm.getTextArea = function() { return textarea; }; cm.toTextArea = function() { save(); textarea.parentNode.removeChild(cm.getWrapperElement()); textarea.style.display = ""; if (textarea.form) { off(textarea.form, "submit", save); if (typeof textarea.form.submit == "function") textarea.form.submit = realSubmit; } }; return cm; }; // STRING STREAM // Fed to the mode parsers, provides helper functions to make // parsers more succinct. // The character stream used by a mode's parser. function StringStream(string, tabSize) { this.pos = this.start = 0; this.string = string; this.tabSize = tabSize || 8; this.lastColumnPos = this.lastColumnValue = 0; } StringStream.prototype = { eol: function() {return this.pos >= this.string.length;}, sol: function() {return this.pos == 0;}, peek: function() {return this.string.charAt(this.pos) || undefined;}, next: function() { if (this.pos < this.string.length) return this.string.charAt(this.pos++); }, eat: function(match) { var ch = this.string.charAt(this.pos); if (typeof match == "string") var ok = ch == match; else var ok = ch && (match.test ? match.test(ch) : match(ch)); if (ok) {++this.pos; return ch;} }, eatWhile: function(match) { var start = this.pos; while (this.eat(match)){} return this.pos > start; }, eatSpace: function() { var start = this.pos; while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos; return this.pos > start; }, skipToEnd: function() {this.pos = this.string.length;}, skipTo: function(ch) { var found = this.string.indexOf(ch, this.pos); if (found > -1) {this.pos = found; return true;} }, backUp: function(n) {this.pos -= n;}, column: function() { if (this.lastColumnPos < this.start) { this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue); this.lastColumnPos = this.start; } return this.lastColumnValue; }, indentation: function() {return countColumn(this.string, null, this.tabSize);}, match: function(pattern, consume, caseInsensitive) { if (typeof pattern == "string") { var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;}; var substr = this.string.substr(this.pos, pattern.length); if (cased(substr) == cased(pattern)) { if (consume !== false) this.pos += pattern.length; return true; } } else { var match = this.string.slice(this.pos).match(pattern); if (match && match.index > 0) return null; if (match && consume !== false) this.pos += match[0].length; return match; } }, current: function(){return this.string.slice(this.start, this.pos);} }; CodeMirror.StringStream = StringStream; // TEXTMARKERS function TextMarker(doc, type) { this.lines = []; this.type = type; this.doc = doc; } CodeMirror.TextMarker = TextMarker; eventMixin(TextMarker); TextMarker.prototype.clear = function() { if (this.explicitlyCleared) return; var cm = this.doc.cm, withOp = cm && !cm.curOp; if (withOp) startOperation(cm); if (hasHandler(this, "clear")) { var found = this.find(); if (found) signalLater(this, "clear", found.from, found.to); } var min = null, max = null; for (var i = 0; i < this.lines.length; ++i) { var line = this.lines[i]; var span = getMarkedSpanFor(line.markedSpans, this); if (span.to != null) max = lineNo(line); line.markedSpans = removeMarkedSpan(line.markedSpans, span); if (span.from != null) min = lineNo(line); else if (this.collapsed && !lineIsHidden(this.doc, line) && cm) updateLineHeight(line, textHeight(cm.display)); } if (cm && this.collapsed && !cm.options.lineWrapping) for (var i = 0; i < this.lines.length; ++i) { var visual = visualLine(cm.doc, this.lines[i]), len = lineLength(cm.doc, visual); if (len > cm.display.maxLineLength) { cm.display.maxLine = visual; cm.display.maxLineLength = len; cm.display.maxLineChanged = true; } } if (min != null && cm) regChange(cm, min, max + 1); this.lines.length = 0; this.explicitlyCleared = true; if (this.atomic && this.doc.cantEdit) { this.doc.cantEdit = false; if (cm) reCheckSelection(cm); } if (withOp) endOperation(cm); }; TextMarker.prototype.find = function() { var from, to; for (var i = 0; i < this.lines.length; ++i) { var line = this.lines[i]; var span = getMarkedSpanFor(line.markedSpans, this); if (span.from != null || span.to != null) { var found = lineNo(line); if (span.from != null) from = Pos(found, span.from); if (span.to != null) to = Pos(found, span.to); } } if (this.type == "bookmark") return from; return from && {from: from, to: to}; }; TextMarker.prototype.changed = function() { var pos = this.find(), cm = this.doc.cm; if (!pos || !cm) return; if (this.type != "bookmark") pos = pos.from; var line = getLine(this.doc, pos.line); clearCachedMeasurement(cm, line); if (pos.line >= cm.display.showingFrom && pos.line < cm.display.showingTo) { for (var node = cm.display.lineDiv.firstChild; node; node = node.nextSibling) if (node.lineObj == line) { if (node.offsetHeight != line.height) updateLineHeight(line, node.offsetHeight); break; } runInOp(cm, function() { cm.curOp.selectionChanged = cm.curOp.forceUpdate = cm.curOp.updateMaxLine = true; }); } }; TextMarker.prototype.attachLine = function(line) { if (!this.lines.length && this.doc.cm) { var op = this.doc.cm.curOp; if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1) (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); } this.lines.push(line); }; TextMarker.prototype.detachLine = function(line) { this.lines.splice(indexOf(this.lines, line), 1); if (!this.lines.length && this.doc.cm) { var op = this.doc.cm.curOp; (op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this); } }; function markText(doc, from, to, options, type) { if (options && options.shared) return markTextShared(doc, from, to, options, type); if (doc.cm && !doc.cm.curOp) return operation(doc.cm, markText)(doc, from, to, options, type); var marker = new TextMarker(doc, type); if (type == "range" && !posLess(from, to)) return marker; if (options) copyObj(options, marker); if (marker.replacedWith) { marker.collapsed = true; marker.replacedWith = elt("span", [marker.replacedWith], "CodeMirror-widget"); if (!options.handleMouseEvents) marker.replacedWith.ignoreEvents = true; } if (marker.collapsed) sawCollapsedSpans = true; if (marker.addToHistory) addToHistory(doc, {from: from, to: to, origin: "markText"}, {head: doc.sel.head, anchor: doc.sel.anchor}, NaN); var curLine = from.line, size = 0, collapsedAtStart, collapsedAtEnd, cm = doc.cm, updateMaxLine; doc.iter(curLine, to.line + 1, function(line) { if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(doc, line) == cm.display.maxLine) updateMaxLine = true; var span = {from: null, to: null, marker: marker}; size += line.text.length; if (curLine == from.line) {span.from = from.ch; size -= from.ch;} if (curLine == to.line) {span.to = to.ch; size -= line.text.length - to.ch;} if (marker.collapsed) { if (curLine == to.line) collapsedAtEnd = collapsedSpanAt(line, to.ch); if (curLine == from.line) collapsedAtStart = collapsedSpanAt(line, from.ch); else updateLineHeight(line, 0); } addMarkedSpan(line, span); ++curLine; }); if (marker.collapsed) doc.iter(from.line, to.line + 1, function(line) { if (lineIsHidden(doc, line)) updateLineHeight(line, 0); }); if (marker.clearOnEnter) on(marker, "beforeCursorEnter", function() { marker.clear(); }); if (marker.readOnly) { sawReadOnlySpans = true; if (doc.history.done.length || doc.history.undone.length) doc.clearHistory(); } if (marker.collapsed) { if (collapsedAtStart != collapsedAtEnd) throw new Error("Inserting collapsed marker overlapping an existing one"); marker.size = size; marker.atomic = true; } if (cm) { if (updateMaxLine) cm.curOp.updateMaxLine = true; if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.collapsed) regChange(cm, from.line, to.line + 1); if (marker.atomic) reCheckSelection(cm); } return marker; } // SHARED TEXTMARKERS function SharedTextMarker(markers, primary) { this.markers = markers; this.primary = primary; for (var i = 0, me = this; i < markers.length; ++i) { markers[i].parent = this; on(markers[i], "clear", function(){me.clear();}); } } CodeMirror.SharedTextMarker = SharedTextMarker; eventMixin(SharedTextMarker); SharedTextMarker.prototype.clear = function() { if (this.explicitlyCleared) return; this.explicitlyCleared = true; for (var i = 0; i < this.markers.length; ++i) this.markers[i].clear(); signalLater(this, "clear"); }; SharedTextMarker.prototype.find = function() { return this.primary.find(); }; function markTextShared(doc, from, to, options, type) { options = copyObj(options); options.shared = false; var markers = [markText(doc, from, to, options, type)], primary = markers[0]; var widget = options.replacedWith; linkedDocs(doc, function(doc) { if (widget) options.replacedWith = widget.cloneNode(true); markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type)); for (var i = 0; i < doc.linked.length; ++i) if (doc.linked[i].isParent) return; primary = lst(markers); }); return new SharedTextMarker(markers, primary); } // TEXTMARKER SPANS function getMarkedSpanFor(spans, marker) { if (spans) for (var i = 0; i < spans.length; ++i) { var span = spans[i]; if (span.marker == marker) return span; } } function removeMarkedSpan(spans, span) { for (var r, i = 0; i < spans.length; ++i) if (spans[i] != span) (r || (r = [])).push(spans[i]); return r; } function addMarkedSpan(line, span) { line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]; span.marker.attachLine(line); } function markedSpansBefore(old, startCh, isInsert) { if (old) for (var i = 0, nw; i < old.length; ++i) { var span = old[i], marker = span.marker; var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh); if (startsBefore || marker.type == "bookmark" && span.from == startCh && (!isInsert || !span.marker.insertLeft)) { var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh); (nw || (nw = [])).push({from: span.from, to: endsAfter ? null : span.to, marker: marker}); } } return nw; } function markedSpansAfter(old, endCh, isInsert) { if (old) for (var i = 0, nw; i < old.length; ++i) { var span = old[i], marker = span.marker; var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh); if (endsAfter || marker.type == "bookmark" && span.from == endCh && (!isInsert || span.marker.insertLeft)) { var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh); (nw || (nw = [])).push({from: startsBefore ? null : span.from - endCh, to: span.to == null ? null : span.to - endCh, marker: marker}); } } return nw; } function stretchSpansOverChange(doc, change) { var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans; var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans; if (!oldFirst && !oldLast) return null; var startCh = change.from.ch, endCh = change.to.ch, isInsert = posEq(change.from, change.to); // Get the spans that 'stick out' on both sides var first = markedSpansBefore(oldFirst, startCh, isInsert); var last = markedSpansAfter(oldLast, endCh, isInsert); // Next, merge those two ends var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0); if (first) { // Fix up .to properties of first for (var i = 0; i < first.length; ++i) { var span = first[i]; if (span.to == null) { var found = getMarkedSpanFor(last, span.marker); if (!found) span.to = startCh; else if (sameLine) span.to = found.to == null ? null : found.to + offset; } } } if (last) { // Fix up .from in last (or move them into first in case of sameLine) for (var i = 0; i < last.length; ++i) { var span = last[i]; if (span.to != null) span.to += offset; if (span.from == null) { var found = getMarkedSpanFor(first, span.marker); if (!found) { span.from = offset; if (sameLine) (first || (first = [])).push(span); } } else { span.from += offset; if (sameLine) (first || (first = [])).push(span); } } } if (sameLine && first) { // Make sure we didn't create any zero-length spans for (var i = 0; i < first.length; ++i) if (first[i].from != null && first[i].from == first[i].to && first[i].marker.type != "bookmark") first.splice(i--, 1); if (!first.length) first = null; } var newMarkers = [first]; if (!sameLine) { // Fill gap with whole-line-spans var gap = change.text.length - 2, gapMarkers; if (gap > 0 && first) for (var i = 0; i < first.length; ++i) if (first[i].to == null) (gapMarkers || (gapMarkers = [])).push({from: null, to: null, marker: first[i].marker}); for (var i = 0; i < gap; ++i) newMarkers.push(gapMarkers); newMarkers.push(last); } return newMarkers; } function mergeOldSpans(doc, change) { var old = getOldSpans(doc, change); var stretched = stretchSpansOverChange(doc, change); if (!old) return stretched; if (!stretched) return old; for (var i = 0; i < old.length; ++i) { var oldCur = old[i], stretchCur = stretched[i]; if (oldCur && stretchCur) { spans: for (var j = 0; j < stretchCur.length; ++j) { var span = stretchCur[j]; for (var k = 0; k < oldCur.length; ++k) if (oldCur[k].marker == span.marker) continue spans; oldCur.push(span); } } else if (stretchCur) { old[i] = stretchCur; } } return old; } function removeReadOnlyRanges(doc, from, to) { var markers = null; doc.iter(from.line, to.line + 1, function(line) { if (line.markedSpans) for (var i = 0; i < line.markedSpans.length; ++i) { var mark = line.markedSpans[i].marker; if (mark.readOnly && (!markers || indexOf(markers, mark) == -1)) (markers || (markers = [])).push(mark); } }); if (!markers) return null; var parts = [{from: from, to: to}]; for (var i = 0; i < markers.length; ++i) { var mk = markers[i], m = mk.find(); for (var j = 0; j < parts.length; ++j) { var p = parts[j]; if (posLess(p.to, m.from) || posLess(m.to, p.from)) continue; var newParts = [j, 1]; if (posLess(p.from, m.from) || !mk.inclusiveLeft && posEq(p.from, m.from)) newParts.push({from: p.from, to: m.from}); if (posLess(m.to, p.to) || !mk.inclusiveRight && posEq(p.to, m.to)) newParts.push({from: m.to, to: p.to}); parts.splice.apply(parts, newParts); j += newParts.length - 1; } } return parts; } function collapsedSpanAt(line, ch) { var sps = sawCollapsedSpans && line.markedSpans, found; if (sps) for (var sp, i = 0; i < sps.length; ++i) { sp = sps[i]; if (!sp.marker.collapsed) continue; if ((sp.from == null || sp.from < ch) && (sp.to == null || sp.to > ch) && (!found || found.width < sp.marker.width)) found = sp.marker; } return found; } function collapsedSpanAtStart(line) { return collapsedSpanAt(line, -1); } function collapsedSpanAtEnd(line) { return collapsedSpanAt(line, line.text.length + 1); } function visualLine(doc, line) { var merged; while (merged = collapsedSpanAtStart(line)) line = getLine(doc, merged.find().from.line); return line; } function lineIsHidden(doc, line) { var sps = sawCollapsedSpans && line.markedSpans; if (sps) for (var sp, i = 0; i < sps.length; ++i) { sp = sps[i]; if (!sp.marker.collapsed) continue; if (sp.from == null) return true; if (sp.marker.replacedWith) continue; if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp)) return true; } } function lineIsHiddenInner(doc, line, span) { if (span.to == null) { var end = span.marker.find().to, endLine = getLine(doc, end.line); return lineIsHiddenInner(doc, endLine, getMarkedSpanFor(endLine.markedSpans, span.marker)); } if (span.marker.inclusiveRight && span.to == line.text.length) return true; for (var sp, i = 0; i < line.markedSpans.length; ++i) { sp = line.markedSpans[i]; if (sp.marker.collapsed && !sp.marker.replacedWith && sp.from == span.to && (sp.marker.inclusiveLeft || span.marker.inclusiveRight) && lineIsHiddenInner(doc, line, sp)) return true; } } function detachMarkedSpans(line) { var spans = line.markedSpans; if (!spans) return; for (var i = 0; i < spans.length; ++i) spans[i].marker.detachLine(line); line.markedSpans = null; } function attachMarkedSpans(line, spans) { if (!spans) return; for (var i = 0; i < spans.length; ++i) spans[i].marker.attachLine(line); line.markedSpans = spans; } // LINE WIDGETS var LineWidget = CodeMirror.LineWidget = function(cm, node, options) { if (options) for (var opt in options) if (options.hasOwnProperty(opt)) this[opt] = options[opt]; this.cm = cm; this.node = node; }; eventMixin(LineWidget); function widgetOperation(f) { return function() { var withOp = !this.cm.curOp; if (withOp) startOperation(this.cm); try {var result = f.apply(this, arguments);} finally {if (withOp) endOperation(this.cm);} return result; }; } LineWidget.prototype.clear = widgetOperation(function() { var ws = this.line.widgets, no = lineNo(this.line); if (no == null || !ws) return; for (var i = 0; i < ws.length; ++i) if (ws[i] == this) ws.splice(i--, 1); if (!ws.length) this.line.widgets = null; var aboveVisible = heightAtLine(this.cm, this.line) < this.cm.doc.scrollTop; updateLineHeight(this.line, Math.max(0, this.line.height - widgetHeight(this))); if (aboveVisible) addToScrollPos(this.cm, 0, -this.height); regChange(this.cm, no, no + 1); }); LineWidget.prototype.changed = widgetOperation(function() { var oldH = this.height; this.height = null; var diff = widgetHeight(this) - oldH; if (!diff) return; updateLineHeight(this.line, this.line.height + diff); var no = lineNo(this.line); regChange(this.cm, no, no + 1); }); function widgetHeight(widget) { if (widget.height != null) return widget.height; if (!widget.node.parentNode || widget.node.parentNode.nodeType != 1) removeChildrenAndAdd(widget.cm.display.measure, elt("div", [widget.node], null, "position: relative")); return widget.height = widget.node.offsetHeight; } function addLineWidget(cm, handle, node, options) { var widget = new LineWidget(cm, node, options); if (widget.noHScroll) cm.display.alignWidgets = true; changeLine(cm, handle, function(line) { var widgets = line.widgets || (line.widgets = []); if (widget.insertAt == null) widgets.push(widget); else widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget); widget.line = line; if (!lineIsHidden(cm.doc, line) || widget.showIfHidden) { var aboveVisible = heightAtLine(cm, line) < cm.doc.scrollTop; updateLineHeight(line, line.height + widgetHeight(widget)); if (aboveVisible) addToScrollPos(cm, 0, widget.height); } return true; }); return widget; } // LINE DATA STRUCTURE // Line objects. These hold state related to a line, including // highlighting info (the styles array). var Line = CodeMirror.Line = function(text, markedSpans, estimateHeight) { this.text = text; attachMarkedSpans(this, markedSpans); this.height = estimateHeight ? estimateHeight(this) : 1; }; eventMixin(Line); function updateLine(line, text, markedSpans, estimateHeight) { line.text = text; if (line.stateAfter) line.stateAfter = null; if (line.styles) line.styles = null; if (line.order != null) line.order = null; detachMarkedSpans(line); attachMarkedSpans(line, markedSpans); var estHeight = estimateHeight ? estimateHeight(line) : 1; if (estHeight != line.height) updateLineHeight(line, estHeight); } function cleanUpLine(line) { line.parent = null; detachMarkedSpans(line); } // Run the given mode's parser over a line, update the styles // array, which contains alternating fragments of text and CSS // classes. function runMode(cm, text, mode, state, f) { var flattenSpans = mode.flattenSpans; if (flattenSpans == null) flattenSpans = cm.options.flattenSpans; var curStart = 0, curStyle = null; var stream = new StringStream(text, cm.options.tabSize), style; if (text == "" && mode.blankLine) mode.blankLine(state); while (!stream.eol()) { if (stream.pos > cm.options.maxHighlightLength) { flattenSpans = false; // Webkit seems to refuse to render text nodes longer than 57444 characters stream.pos = Math.min(text.length, stream.start + 50000); style = null; } else { style = mode.token(stream, state); } if (!flattenSpans || curStyle != style) { if (curStart < stream.start) f(stream.start, curStyle); curStart = stream.start; curStyle = style; } stream.start = stream.pos; } if (curStart < stream.pos) f(stream.pos, curStyle); } function highlightLine(cm, line, state) { // A styles array always starts with a number identifying the // mode/overlays that it is based on (for easy invalidation). var st = [cm.state.modeGen]; // Compute the base array of styles runMode(cm, line.text, cm.doc.mode, state, function(end, style) {st.push(end, style);}); // Run overlays, adjust style array. for (var o = 0; o < cm.state.overlays.length; ++o) { var overlay = cm.state.overlays[o], i = 1, at = 0; runMode(cm, line.text, overlay.mode, true, function(end, style) { var start = i; // Ensure there's a token end at the current position, and that i points at it while (at < end) { var i_end = st[i]; if (i_end > end) st.splice(i, 1, end, st[i+1], i_end); i += 2; at = Math.min(end, i_end); } if (!style) return; if (overlay.opaque) { st.splice(start, i - start, end, style); i = start + 2; } else { for (; start < i; start += 2) { var cur = st[start+1]; st[start+1] = cur ? cur + " " + style : style; } } }); } return st; } function getLineStyles(cm, line) { if (!line.styles || line.styles[0] != cm.state.modeGen) line.styles = highlightLine(cm, line, line.stateAfter = getStateBefore(cm, lineNo(line))); return line.styles; } // Lightweight form of highlight -- proceed over this line and // update state, but don't save a style array. function processLine(cm, line, state) { var mode = cm.doc.mode; var stream = new StringStream(line.text, cm.options.tabSize); if (line.text == "" && mode.blankLine) mode.blankLine(state); while (!stream.eol() && stream.pos <= cm.options.maxHighlightLength) { mode.token(stream, state); stream.start = stream.pos; } } var styleToClassCache = {}; function styleToClass(style) { if (!style) return null; return styleToClassCache[style] || (styleToClassCache[style] = "cm-" + style.replace(/ +/g, " cm-")); } function lineContent(cm, realLine, measure, copyWidgets) { var merged, line = realLine, empty = true; while (merged = collapsedSpanAtStart(line)) line = getLine(cm.doc, merged.find().from.line); var builder = {pre: elt("pre"), col: 0, pos: 0, measure: null, measuredSomething: false, cm: cm, copyWidgets: copyWidgets}; if (line.textClass) builder.pre.className = line.textClass; do { if (line.text) empty = false; builder.measure = line == realLine && measure; builder.pos = 0; builder.addToken = builder.measure ? buildTokenMeasure : buildToken; if ((ie || webkit) && cm.getOption("lineWrapping")) builder.addToken = buildTokenSplitSpaces(builder.addToken); var next = insertLineContent(line, builder, getLineStyles(cm, line)); if (measure && line == realLine && !builder.measuredSomething) { measure[0] = builder.pre.appendChild(zeroWidthElement(cm.display.measure)); builder.measuredSomething = true; } if (next) line = getLine(cm.doc, next.to.line); } while (next); if (measure && !builder.measuredSomething && !measure[0]) measure[0] = builder.pre.appendChild(empty ? elt("span", "\u00a0") : zeroWidthElement(cm.display.measure)); if (!builder.pre.firstChild && !lineIsHidden(cm.doc, realLine)) builder.pre.appendChild(document.createTextNode("\u00a0")); var order; // Work around problem with the reported dimensions of single-char // direction spans on IE (issue #1129). See also the comment in // cursorCoords. if (measure && ie && (order = getOrder(line))) { var l = order.length - 1; if (order[l].from == order[l].to) --l; var last = order[l], prev = order[l - 1]; if (last.from + 1 == last.to && prev && last.level < prev.level) { var span = measure[builder.pos - 1]; if (span) span.parentNode.insertBefore(span.measureRight = zeroWidthElement(cm.display.measure), span.nextSibling); } } signal(cm, "renderLine", cm, realLine, builder.pre); return builder.pre; } var tokenSpecialChars = /[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\uFEFF]/g; function buildToken(builder, text, style, startStyle, endStyle, title) { if (!text) return; if (!tokenSpecialChars.test(text)) { builder.col += text.length; var content = document.createTextNode(text); } else { var content = document.createDocumentFragment(), pos = 0; while (true) { tokenSpecialChars.lastIndex = pos; var m = tokenSpecialChars.exec(text); var skipped = m ? m.index - pos : text.length - pos; if (skipped) { content.appendChild(document.createTextNode(text.slice(pos, pos + skipped))); builder.col += skipped; } if (!m) break; pos += skipped + 1; if (m[0] == "\t") { var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize; content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab")); builder.col += tabWidth; } else { var token = elt("span", "\u2022", "cm-invalidchar"); token.title = "\\u" + m[0].charCodeAt(0).toString(16); content.appendChild(token); builder.col += 1; } } } if (style || startStyle || endStyle || builder.measure) { var fullStyle = style || ""; if (startStyle) fullStyle += startStyle; if (endStyle) fullStyle += endStyle; var token = elt("span", [content], fullStyle); if (title) token.title = title; return builder.pre.appendChild(token); } builder.pre.appendChild(content); } function buildTokenMeasure(builder, text, style, startStyle, endStyle) { var wrapping = builder.cm.options.lineWrapping; for (var i = 0; i < text.length; ++i) { var ch = text.charAt(i), start = i == 0; if (ch >= "\ud800" && ch < "\udbff" && i < text.length - 1) { ch = text.slice(i, i + 2); ++i; } else if (i && wrapping && spanAffectsWrapping(text, i)) { builder.pre.appendChild(elt("wbr")); } var old = builder.measure[builder.pos]; var span = builder.measure[builder.pos] = buildToken(builder, ch, style, start && startStyle, i == text.length - 1 && endStyle); if (old) span.leftSide = old.leftSide || old; // In IE single-space nodes wrap differently than spaces // embedded in larger text nodes, except when set to // white-space: normal (issue #1268). if (ie && wrapping && ch == " " && i && !/\s/.test(text.charAt(i - 1)) && i < text.length - 1 && !/\s/.test(text.charAt(i + 1))) span.style.whiteSpace = "normal"; builder.pos += ch.length; } if (text.length) builder.measuredSomething = true; } function buildTokenSplitSpaces(inner) { function split(old) { var out = " "; for (var i = 0; i < old.length - 2; ++i) out += i % 2 ? " " : "\u00a0"; out += " "; return out; } return function(builder, text, style, startStyle, endStyle, title) { return inner(builder, text.replace(/ {3,}/, split), style, startStyle, endStyle, title); }; } function buildCollapsedSpan(builder, size, marker, ignoreWidget) { var widget = !ignoreWidget && marker.replacedWith; if (widget) { if (builder.copyWidgets) widget = widget.cloneNode(true); builder.pre.appendChild(widget); if (builder.measure) { if (size) { builder.measure[builder.pos] = widget; } else { var elt = zeroWidthElement(builder.cm.display.measure); if (marker.type == "bookmark" && !marker.insertLeft) builder.measure[builder.pos] = builder.pre.appendChild(elt); else if (builder.measure[builder.pos]) return; else builder.measure[builder.pos] = builder.pre.insertBefore(elt, widget); } builder.measuredSomething = true; } } builder.pos += size; } // Outputs a number of spans to make up a line, taking highlighting // and marked text into account. function insertLineContent(line, builder, styles) { var spans = line.markedSpans, allText = line.text, at = 0; if (!spans) { for (var i = 1; i < styles.length; i+=2) builder.addToken(builder, allText.slice(at, at = styles[i]), styleToClass(styles[i+1])); return; } var len = allText.length, pos = 0, i = 1, text = "", style; var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed; for (;;) { if (nextChange == pos) { // Update current marker set spanStyle = spanEndStyle = spanStartStyle = title = ""; collapsed = null; nextChange = Infinity; var foundBookmarks = []; for (var j = 0; j < spans.length; ++j) { var sp = spans[j], m = sp.marker; if (sp.from <= pos && (sp.to == null || sp.to > pos)) { if (sp.to != null && nextChange > sp.to) { nextChange = sp.to; spanEndStyle = ""; } if (m.className) spanStyle += " " + m.className; if (m.startStyle && sp.from == pos) spanStartStyle += " " + m.startStyle; if (m.endStyle && sp.to == nextChange) spanEndStyle += " " + m.endStyle; if (m.title && !title) title = m.title; if (m.collapsed && (!collapsed || collapsed.marker.size < m.size)) collapsed = sp; } else if (sp.from > pos && nextChange > sp.from) { nextChange = sp.from; } if (m.type == "bookmark" && sp.from == pos && m.replacedWith) foundBookmarks.push(m); } if (collapsed && (collapsed.from || 0) == pos) { buildCollapsedSpan(builder, (collapsed.to == null ? len : collapsed.to) - pos, collapsed.marker, collapsed.from == null); if (collapsed.to == null) return collapsed.marker.find(); } if (!collapsed && foundBookmarks.length) for (var j = 0; j < foundBookmarks.length; ++j) buildCollapsedSpan(builder, 0, foundBookmarks[j]); } if (pos >= len) break; var upto = Math.min(len, nextChange); while (true) { if (text) { var end = pos + text.length; if (!collapsed) { var tokenText = end > upto ? text.slice(0, upto - pos) : text; builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle, spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", title); } if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;} pos = end; spanStartStyle = ""; } text = allText.slice(at, at = styles[i++]); style = styleToClass(styles[i++]); } } } // DOCUMENT DATA STRUCTURE function updateDoc(doc, change, markedSpans, selAfter, estimateHeight) { function spansFor(n) {return markedSpans ? markedSpans[n] : null;} function update(line, text, spans) { updateLine(line, text, spans, estimateHeight); signalLater(line, "change", line, change); } var from = change.from, to = change.to, text = change.text; var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line); var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line; // First adjust the line structure if (from.ch == 0 && to.ch == 0 && lastText == "") { // This is a whole-line replace. Treated specially to make // sure line objects move the way they are supposed to. for (var i = 0, e = text.length - 1, added = []; i < e; ++i) added.push(new Line(text[i], spansFor(i), estimateHeight)); update(lastLine, lastLine.text, lastSpans); if (nlines) doc.remove(from.line, nlines); if (added.length) doc.insert(from.line, added); } else if (firstLine == lastLine) { if (text.length == 1) { update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans); } else { for (var added = [], i = 1, e = text.length - 1; i < e; ++i) added.push(new Line(text[i], spansFor(i), estimateHeight)); added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight)); update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0)); doc.insert(from.line + 1, added); } } else if (text.length == 1) { update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0)); doc.remove(from.line + 1, nlines); } else { update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0)); update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans); for (var i = 1, e = text.length - 1, added = []; i < e; ++i) added.push(new Line(text[i], spansFor(i), estimateHeight)); if (nlines > 1) doc.remove(from.line + 1, nlines - 1); doc.insert(from.line + 1, added); } signalLater(doc, "change", doc, change); setSelection(doc, selAfter.anchor, selAfter.head, null, true); } function LeafChunk(lines) { this.lines = lines; this.parent = null; for (var i = 0, e = lines.length, height = 0; i < e; ++i) { lines[i].parent = this; height += lines[i].height; } this.height = height; } LeafChunk.prototype = { chunkSize: function() { return this.lines.length; }, removeInner: function(at, n) { for (var i = at, e = at + n; i < e; ++i) { var line = this.lines[i]; this.height -= line.height; cleanUpLine(line); signalLater(line, "delete"); } this.lines.splice(at, n); }, collapse: function(lines) { lines.splice.apply(lines, [lines.length, 0].concat(this.lines)); }, insertInner: function(at, lines, height) { this.height += height; this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at)); for (var i = 0, e = lines.length; i < e; ++i) lines[i].parent = this; }, iterN: function(at, n, op) { for (var e = at + n; at < e; ++at) if (op(this.lines[at])) return true; } }; function BranchChunk(children) { this.children = children; var size = 0, height = 0; for (var i = 0, e = children.length; i < e; ++i) { var ch = children[i]; size += ch.chunkSize(); height += ch.height; ch.parent = this; } this.size = size; this.height = height; this.parent = null; } BranchChunk.prototype = { chunkSize: function() { return this.size; }, removeInner: function(at, n) { this.size -= n; for (var i = 0; i < this.children.length; ++i) { var child = this.children[i], sz = child.chunkSize(); if (at < sz) { var rm = Math.min(n, sz - at), oldHeight = child.height; child.removeInner(at, rm); this.height -= oldHeight - child.height; if (sz == rm) { this.children.splice(i--, 1); child.parent = null; } if ((n -= rm) == 0) break; at = 0; } else at -= sz; } if (this.size - n < 25) { var lines = []; this.collapse(lines); this.children = [new LeafChunk(lines)]; this.children[0].parent = this; } }, collapse: function(lines) { for (var i = 0, e = this.children.length; i < e; ++i) this.children[i].collapse(lines); }, insertInner: function(at, lines, height) { this.size += lines.length; this.height += height; for (var i = 0, e = this.children.length; i < e; ++i) { var child = this.children[i], sz = child.chunkSize(); if (at <= sz) { child.insertInner(at, lines, height); if (child.lines && child.lines.length > 50) { while (child.lines.length > 50) { var spilled = child.lines.splice(child.lines.length - 25, 25); var newleaf = new LeafChunk(spilled); child.height -= newleaf.height; this.children.splice(i + 1, 0, newleaf); newleaf.parent = this; } this.maybeSpill(); } break; } at -= sz; } }, maybeSpill: function() { if (this.children.length <= 10) return; var me = this; do { var spilled = me.children.splice(me.children.length - 5, 5); var sibling = new BranchChunk(spilled); if (!me.parent) { // Become the parent node var copy = new BranchChunk(me.children); copy.parent = me; me.children = [copy, sibling]; me = copy; } else { me.size -= sibling.size; me.height -= sibling.height; var myIndex = indexOf(me.parent.children, me); me.parent.children.splice(myIndex + 1, 0, sibling); } sibling.parent = me.parent; } while (me.children.length > 10); me.parent.maybeSpill(); }, iterN: function(at, n, op) { for (var i = 0, e = this.children.length; i < e; ++i) { var child = this.children[i], sz = child.chunkSize(); if (at < sz) { var used = Math.min(n, sz - at); if (child.iterN(at, used, op)) return true; if ((n -= used) == 0) break; at = 0; } else at -= sz; } } }; var nextDocId = 0; var Doc = CodeMirror.Doc = function(text, mode, firstLine) { if (!(this instanceof Doc)) return new Doc(text, mode, firstLine); if (firstLine == null) firstLine = 0; BranchChunk.call(this, [new LeafChunk([new Line("", null)])]); this.first = firstLine; this.scrollTop = this.scrollLeft = 0; this.cantEdit = false; this.history = makeHistory(); this.cleanGeneration = 1; this.frontier = firstLine; var start = Pos(firstLine, 0); this.sel = {from: start, to: start, head: start, anchor: start, shift: false, extend: false, goalColumn: null}; this.id = ++nextDocId; this.modeOption = mode; if (typeof text == "string") text = splitLines(text); updateDoc(this, {from: start, to: start, text: text}, null, {head: start, anchor: start}); }; Doc.prototype = createObj(BranchChunk.prototype, { constructor: Doc, iter: function(from, to, op) { if (op) this.iterN(from - this.first, to - from, op); else this.iterN(this.first, this.first + this.size, from); }, insert: function(at, lines) { var height = 0; for (var i = 0, e = lines.length; i < e; ++i) height += lines[i].height; this.insertInner(at - this.first, lines, height); }, remove: function(at, n) { this.removeInner(at - this.first, n); }, getValue: function(lineSep) { var lines = getLines(this, this.first, this.first + this.size); if (lineSep === false) return lines; return lines.join(lineSep || "\n"); }, setValue: function(code) { var top = Pos(this.first, 0), last = this.first + this.size - 1; makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length), text: splitLines(code), origin: "setValue"}, {head: top, anchor: top}, true); }, replaceRange: function(code, from, to, origin) { from = clipPos(this, from); to = to ? clipPos(this, to) : from; replaceRange(this, code, from, to, origin); }, getRange: function(from, to, lineSep) { var lines = getBetween(this, clipPos(this, from), clipPos(this, to)); if (lineSep === false) return lines; return lines.join(lineSep || "\n"); }, getLine: function(line) {var l = this.getLineHandle(line); return l && l.text;}, setLine: function(line, text) { if (isLine(this, line)) replaceRange(this, text, Pos(line, 0), clipPos(this, Pos(line))); }, removeLine: function(line) { if (line) replaceRange(this, "", clipPos(this, Pos(line - 1)), clipPos(this, Pos(line))); else replaceRange(this, "", Pos(0, 0), clipPos(this, Pos(1, 0))); }, getLineHandle: function(line) {if (isLine(this, line)) return getLine(this, line);}, getLineNumber: function(line) {return lineNo(line);}, getLineHandleVisualStart: function(line) { if (typeof line == "number") line = getLine(this, line); return visualLine(this, line); }, lineCount: function() {return this.size;}, firstLine: function() {return this.first;}, lastLine: function() {return this.first + this.size - 1;}, clipPos: function(pos) {return clipPos(this, pos);}, getCursor: function(start) { var sel = this.sel, pos; if (start == null || start == "head") pos = sel.head; else if (start == "anchor") pos = sel.anchor; else if (start == "end" || start === false) pos = sel.to; else pos = sel.from; return copyPos(pos); }, somethingSelected: function() {return !posEq(this.sel.head, this.sel.anchor);}, setCursor: docOperation(function(line, ch, extend) { var pos = clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line); if (extend) extendSelection(this, pos); else setSelection(this, pos, pos); }), setSelection: docOperation(function(anchor, head) { setSelection(this, clipPos(this, anchor), clipPos(this, head || anchor)); }), extendSelection: docOperation(function(from, to) { extendSelection(this, clipPos(this, from), to && clipPos(this, to)); }), getSelection: function(lineSep) {return this.getRange(this.sel.from, this.sel.to, lineSep);}, replaceSelection: function(code, collapse, origin) { makeChange(this, {from: this.sel.from, to: this.sel.to, text: splitLines(code), origin: origin}, collapse || "around"); }, undo: docOperation(function() {makeChangeFromHistory(this, "undo");}), redo: docOperation(function() {makeChangeFromHistory(this, "redo");}), setExtending: function(val) {this.sel.extend = val;}, historySize: function() { var hist = this.history; return {undo: hist.done.length, redo: hist.undone.length}; }, clearHistory: function() {this.history = makeHistory(this.history.maxGeneration);}, markClean: function() { this.cleanGeneration = this.changeGeneration(); }, changeGeneration: function() { this.history.lastOp = this.history.lastOrigin = null; return this.history.generation; }, isClean: function (gen) { return this.history.generation == (gen || this.cleanGeneration); }, getHistory: function() { return {done: copyHistoryArray(this.history.done), undone: copyHistoryArray(this.history.undone)}; }, setHistory: function(histData) { var hist = this.history = makeHistory(this.history.maxGeneration); hist.done = histData.done.slice(0); hist.undone = histData.undone.slice(0); }, markText: function(from, to, options) { return markText(this, clipPos(this, from), clipPos(this, to), options, "range"); }, setBookmark: function(pos, options) { var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options), insertLeft: options && options.insertLeft}; pos = clipPos(this, pos); return markText(this, pos, pos, realOpts, "bookmark"); }, findMarksAt: function(pos) { pos = clipPos(this, pos); var markers = [], spans = getLine(this, pos.line).markedSpans; if (spans) for (var i = 0; i < spans.length; ++i) { var span = spans[i]; if ((span.from == null || span.from <= pos.ch) && (span.to == null || span.to >= pos.ch)) markers.push(span.marker.parent || span.marker); } return markers; }, getAllMarks: function() { var markers = []; this.iter(function(line) { var sps = line.markedSpans; if (sps) for (var i = 0; i < sps.length; ++i) if (sps[i].from != null) markers.push(sps[i].marker); }); return markers; }, posFromIndex: function(off) { var ch, lineNo = this.first; this.iter(function(line) { var sz = line.text.length + 1; if (sz > off) { ch = off; return true; } off -= sz; ++lineNo; }); return clipPos(this, Pos(lineNo, ch)); }, indexFromPos: function (coords) { coords = clipPos(this, coords); var index = coords.ch; if (coords.line < this.first || coords.ch < 0) return 0; this.iter(this.first, coords.line, function (line) { index += line.text.length + 1; }); return index; }, copy: function(copyHistory) { var doc = new Doc(getLines(this, this.first, this.first + this.size), this.modeOption, this.first); doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft; doc.sel = {from: this.sel.from, to: this.sel.to, head: this.sel.head, anchor: this.sel.anchor, shift: this.sel.shift, extend: false, goalColumn: this.sel.goalColumn}; if (copyHistory) { doc.history.undoDepth = this.history.undoDepth; doc.setHistory(this.getHistory()); } return doc; }, linkedDoc: function(options) { if (!options) options = {}; var from = this.first, to = this.first + this.size; if (options.from != null && options.from > from) from = options.from; if (options.to != null && options.to < to) to = options.to; var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from); if (options.sharedHist) copy.history = this.history; (this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist}); copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}]; return copy; }, unlinkDoc: function(other) { if (other instanceof CodeMirror) other = other.doc; if (this.linked) for (var i = 0; i < this.linked.length; ++i) { var link = this.linked[i]; if (link.doc != other) continue; this.linked.splice(i, 1); other.unlinkDoc(this); break; } // If the histories were shared, split them again if (other.history == this.history) { var splitIds = [other.id]; linkedDocs(other, function(doc) {splitIds.push(doc.id);}, true); other.history = makeHistory(); other.history.done = copyHistoryArray(this.history.done, splitIds); other.history.undone = copyHistoryArray(this.history.undone, splitIds); } }, iterLinkedDocs: function(f) {linkedDocs(this, f);}, getMode: function() {return this.mode;}, getEditor: function() {return this.cm;} }); Doc.prototype.eachLine = Doc.prototype.iter; // The Doc methods that should be available on CodeMirror instances var dontDelegate = "iter insert remove copy getEditor".split(" "); for (var prop in Doc.prototype) if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0) CodeMirror.prototype[prop] = (function(method) { return function() {return method.apply(this.doc, arguments);}; })(Doc.prototype[prop]); eventMixin(Doc); function linkedDocs(doc, f, sharedHistOnly) { function propagate(doc, skip, sharedHist) { if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) { var rel = doc.linked[i]; if (rel.doc == skip) continue; var shared = sharedHist && rel.sharedHist; if (sharedHistOnly && !shared) continue; f(rel.doc, shared); propagate(rel.doc, doc, shared); } } propagate(doc, null, true); } function attachDoc(cm, doc) { if (doc.cm) throw new Error("This document is already in use."); cm.doc = doc; doc.cm = cm; estimateLineHeights(cm); loadMode(cm); if (!cm.options.lineWrapping) computeMaxLength(cm); cm.options.mode = doc.modeOption; regChange(cm); } // LINE UTILITIES function getLine(chunk, n) { n -= chunk.first; while (!chunk.lines) { for (var i = 0;; ++i) { var child = chunk.children[i], sz = child.chunkSize(); if (n < sz) { chunk = child; break; } n -= sz; } } return chunk.lines[n]; } function getBetween(doc, start, end) { var out = [], n = start.line; doc.iter(start.line, end.line + 1, function(line) { var text = line.text; if (n == end.line) text = text.slice(0, end.ch); if (n == start.line) text = text.slice(start.ch); out.push(text); ++n; }); return out; } function getLines(doc, from, to) { var out = []; doc.iter(from, to, function(line) { out.push(line.text); }); return out; } function updateLineHeight(line, height) { var diff = height - line.height; for (var n = line; n; n = n.parent) n.height += diff; } function lineNo(line) { if (line.parent == null) return null; var cur = line.parent, no = indexOf(cur.lines, line); for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) { for (var i = 0;; ++i) { if (chunk.children[i] == cur) break; no += chunk.children[i].chunkSize(); } } return no + cur.first; } function lineAtHeight(chunk, h) { var n = chunk.first; outer: do { for (var i = 0, e = chunk.children.length; i < e; ++i) { var child = chunk.children[i], ch = child.height; if (h < ch) { chunk = child; continue outer; } h -= ch; n += child.chunkSize(); } return n; } while (!chunk.lines); for (var i = 0, e = chunk.lines.length; i < e; ++i) { var line = chunk.lines[i], lh = line.height; if (h < lh) break; h -= lh; } return n + i; } function heightAtLine(cm, lineObj) { lineObj = visualLine(cm.doc, lineObj); var h = 0, chunk = lineObj.parent; for (var i = 0; i < chunk.lines.length; ++i) { var line = chunk.lines[i]; if (line == lineObj) break; else h += line.height; } for (var p = chunk.parent; p; chunk = p, p = chunk.parent) { for (var i = 0; i < p.children.length; ++i) { var cur = p.children[i]; if (cur == chunk) break; else h += cur.height; } } return h; } function getOrder(line) { var order = line.order; if (order == null) order = line.order = bidiOrdering(line.text); return order; } // HISTORY function makeHistory(startGen) { return { // Arrays of history events. Doing something adds an event to // done and clears undo. Undoing moves events from done to // undone, redoing moves them in the other direction. done: [], undone: [], undoDepth: Infinity, // Used to track when changes can be merged into a single undo // event lastTime: 0, lastOp: null, lastOrigin: null, // Used by the isClean() method generation: startGen || 1, maxGeneration: startGen || 1 }; } function attachLocalSpans(doc, change, from, to) { var existing = change["spans_" + doc.id], n = 0; doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) { if (line.markedSpans) (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; ++n; }); } function historyChangeFromChange(doc, change) { var from = { line: change.from.line, ch: change.from.ch }; var histChange = {from: from, to: changeEnd(change), text: getBetween(doc, change.from, change.to)}; attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true); return histChange; } function addToHistory(doc, change, selAfter, opId) { var hist = doc.history; hist.undone.length = 0; var time = +new Date, cur = lst(hist.done); if (cur && (hist.lastOp == opId || hist.lastOrigin == change.origin && change.origin && ((change.origin.charAt(0) == "+" && doc.cm && hist.lastTime > time - doc.cm.options.historyEventDelay) || change.origin.charAt(0) == "*"))) { // Merge this change into the last event var last = lst(cur.changes); if (posEq(change.from, change.to) && posEq(change.from, last.to)) { // Optimized case for simple insertion -- don't want to add // new changesets for every character typed last.to = changeEnd(change); } else { // Add new sub-event cur.changes.push(historyChangeFromChange(doc, change)); } cur.anchorAfter = selAfter.anchor; cur.headAfter = selAfter.head; } else { // Can not be merged, start a new event. cur = {changes: [historyChangeFromChange(doc, change)], generation: hist.generation, anchorBefore: doc.sel.anchor, headBefore: doc.sel.head, anchorAfter: selAfter.anchor, headAfter: selAfter.head}; hist.done.push(cur); hist.generation = ++hist.maxGeneration; while (hist.done.length > hist.undoDepth) hist.done.shift(); } hist.lastTime = time; hist.lastOp = opId; hist.lastOrigin = change.origin; } function removeClearedSpans(spans) { if (!spans) return null; for (var i = 0, out; i < spans.length; ++i) { if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); } else if (out) out.push(spans[i]); } return !out ? spans : out.length ? out : null; } function getOldSpans(doc, change) { var found = change["spans_" + doc.id]; if (!found) return null; for (var i = 0, nw = []; i < change.text.length; ++i) nw.push(removeClearedSpans(found[i])); return nw; } // Used both to provide a JSON-safe object in .getHistory, and, when // detaching a document, to split the history in two function copyHistoryArray(events, newGroup) { for (var i = 0, copy = []; i < events.length; ++i) { var event = events[i], changes = event.changes, newChanges = []; copy.push({changes: newChanges, anchorBefore: event.anchorBefore, headBefore: event.headBefore, anchorAfter: event.anchorAfter, headAfter: event.headAfter}); for (var j = 0; j < changes.length; ++j) { var change = changes[j], m; newChanges.push({from: change.from, to: change.to, text: change.text}); if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\d+)$/)) { if (indexOf(newGroup, Number(m[1])) > -1) { lst(newChanges)[prop] = change[prop]; delete change[prop]; } } } } return copy; } // Rebasing/resetting history to deal with externally-sourced changes function rebaseHistSel(pos, from, to, diff) { if (to < pos.line) { pos.line += diff; } else if (from < pos.line) { pos.line = from; pos.ch = 0; } } // Tries to rebase an array of history events given a change in the // document. If the change touches the same lines as the event, the // event, and everything 'behind' it, is discarded. If the change is // before the event, the event's positions are updated. Uses a // copy-on-write scheme for the positions, to avoid having to // reallocate them all on every rebase, but also avoid problems with // shared position objects being unsafely updated. function rebaseHistArray(array, from, to, diff) { for (var i = 0; i < array.length; ++i) { var sub = array[i], ok = true; for (var j = 0; j < sub.changes.length; ++j) { var cur = sub.changes[j]; if (!sub.copied) { cur.from = copyPos(cur.from); cur.to = copyPos(cur.to); } if (to < cur.from.line) { cur.from.line += diff; cur.to.line += diff; } else if (from <= cur.to.line) { ok = false; break; } } if (!sub.copied) { sub.anchorBefore = copyPos(sub.anchorBefore); sub.headBefore = copyPos(sub.headBefore); sub.anchorAfter = copyPos(sub.anchorAfter); sub.readAfter = copyPos(sub.headAfter); sub.copied = true; } if (!ok) { array.splice(0, i + 1); i = 0; } else { rebaseHistSel(sub.anchorBefore); rebaseHistSel(sub.headBefore); rebaseHistSel(sub.anchorAfter); rebaseHistSel(sub.headAfter); } } } function rebaseHist(hist, change) { var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1; rebaseHistArray(hist.done, from, to, diff); rebaseHistArray(hist.undone, from, to, diff); } // EVENT OPERATORS function stopMethod() {e_stop(this);} // Ensure an event has a stop method. function addStop(event) { if (!event.stop) event.stop = stopMethod; return event; } function e_preventDefault(e) { if (e.preventDefault) e.preventDefault(); else e.returnValue = false; } function e_stopPropagation(e) { if (e.stopPropagation) e.stopPropagation(); else e.cancelBubble = true; } function e_defaultPrevented(e) { return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false; } function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);} CodeMirror.e_stop = e_stop; CodeMirror.e_preventDefault = e_preventDefault; CodeMirror.e_stopPropagation = e_stopPropagation; function e_target(e) {return e.target || e.srcElement;} function e_button(e) { var b = e.which; if (b == null) { if (e.button & 1) b = 1; else if (e.button & 2) b = 3; else if (e.button & 4) b = 2; } if (mac && e.ctrlKey && b == 1) b = 3; return b; } // EVENT HANDLING function on(emitter, type, f) { if (emitter.addEventListener) emitter.addEventListener(type, f, false); else if (emitter.attachEvent) emitter.attachEvent("on" + type, f); else { var map = emitter._handlers || (emitter._handlers = {}); var arr = map[type] || (map[type] = []); arr.push(f); } } function off(emitter, type, f) { if (emitter.removeEventListener) emitter.removeEventListener(type, f, false); else if (emitter.detachEvent) emitter.detachEvent("on" + type, f); else { var arr = emitter._handlers && emitter._handlers[type]; if (!arr) return; for (var i = 0; i < arr.length; ++i) if (arr[i] == f) { arr.splice(i, 1); break; } } } function signal(emitter, type /*, values...*/) { var arr = emitter._handlers && emitter._handlers[type]; if (!arr) return; var args = Array.prototype.slice.call(arguments, 2); for (var i = 0; i < arr.length; ++i) arr[i].apply(null, args); } var delayedCallbacks, delayedCallbackDepth = 0; function signalLater(emitter, type /*, values...*/) { var arr = emitter._handlers && emitter._handlers[type]; if (!arr) return; var args = Array.prototype.slice.call(arguments, 2); if (!delayedCallbacks) { ++delayedCallbackDepth; delayedCallbacks = []; setTimeout(fireDelayed, 0); } function bnd(f) {return function(){f.apply(null, args);};}; for (var i = 0; i < arr.length; ++i) delayedCallbacks.push(bnd(arr[i])); } function signalDOMEvent(cm, e, override) { signal(cm, override || e.type, cm, e); return e_defaultPrevented(e) || e.codemirrorIgnore; } function fireDelayed() { --delayedCallbackDepth; var delayed = delayedCallbacks; delayedCallbacks = null; for (var i = 0; i < delayed.length; ++i) delayed[i](); } function hasHandler(emitter, type) { var arr = emitter._handlers && emitter._handlers[type]; return arr && arr.length > 0; } CodeMirror.on = on; CodeMirror.off = off; CodeMirror.signal = signal; function eventMixin(ctor) { ctor.prototype.on = function(type, f) {on(this, type, f);}; ctor.prototype.off = function(type, f) {off(this, type, f);}; } // MISC UTILITIES // Number of pixels added to scroller and sizer to hide scrollbar var scrollerCutOff = 30; // Returned or thrown by various protocols to signal 'I'm not // handling this'. var Pass = CodeMirror.Pass = {toString: function(){return "CodeMirror.Pass";}}; function Delayed() {this.id = null;} Delayed.prototype = {set: function(ms, f) {clearTimeout(this.id); this.id = setTimeout(f, ms);}}; // Counts the column offset in a string, taking tabs into account. // Used mostly to find indentation. function countColumn(string, end, tabSize, startIndex, startValue) { if (end == null) { end = string.search(/[^\s\u00a0]/); if (end == -1) end = string.length; } for (var i = startIndex || 0, n = startValue || 0; i < end; ++i) { if (string.charAt(i) == "\t") n += tabSize - (n % tabSize); else ++n; } return n; } CodeMirror.countColumn = countColumn; var spaceStrs = [""]; function spaceStr(n) { while (spaceStrs.length <= n) spaceStrs.push(lst(spaceStrs) + " "); return spaceStrs[n]; } function lst(arr) { return arr[arr.length-1]; } function selectInput(node) { if (ios) { // Mobile Safari apparently has a bug where select() is broken. node.selectionStart = 0; node.selectionEnd = node.value.length; } else { // Suppress mysterious IE10 errors try { node.select(); } catch(_e) {} } } function indexOf(collection, elt) { if (collection.indexOf) return collection.indexOf(elt); for (var i = 0, e = collection.length; i < e; ++i) if (collection[i] == elt) return i; return -1; } function createObj(base, props) { function Obj() {} Obj.prototype = base; var inst = new Obj(); if (props) copyObj(props, inst); return inst; } function copyObj(obj, target) { if (!target) target = {}; for (var prop in obj) if (obj.hasOwnProperty(prop)) target[prop] = obj[prop]; return target; } function emptyArray(size) { for (var a = [], i = 0; i < size; ++i) a.push(undefined); return a; } function bind(f) { var args = Array.prototype.slice.call(arguments, 1); return function(){return f.apply(null, args);}; } var nonASCIISingleCaseWordChar = /[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/; function isWordChar(ch) { return /\w/.test(ch) || ch > "\x80" && (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch)); } function isEmpty(obj) { for (var n in obj) if (obj.hasOwnProperty(n) && obj[n]) return false; return true; } var isExtendingChar = /[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\uA670-\uA672\uA674-\uA67D\uA69F\udc00-\udfff]/; // DOM UTILITIES function elt(tag, content, className, style) { var e = document.createElement(tag); if (className) e.className = className; if (style) e.style.cssText = style; if (typeof content == "string") setTextContent(e, content); else if (content) for (var i = 0; i < content.length; ++i) e.appendChild(content[i]); return e; } function removeChildren(e) { for (var count = e.childNodes.length; count > 0; --count) e.removeChild(e.firstChild); return e; } function removeChildrenAndAdd(parent, e) { return removeChildren(parent).appendChild(e); } function setTextContent(e, str) { if (ie_lt9) { e.innerHTML = ""; e.appendChild(document.createTextNode(str)); } else e.textContent = str; } function getRect(node) { return node.getBoundingClientRect(); } CodeMirror.replaceGetRect = function(f) { getRect = f; }; // FEATURE DETECTION // Detect drag-and-drop var dragAndDrop = function() { // There is *some* kind of drag-and-drop support in IE6-8, but I // couldn't get it to work yet. if (ie_lt9) return false; var div = elt('div'); return "draggable" in div || "dragDrop" in div; }(); // For a reason I have yet to figure out, some browsers disallow // word wrapping between certain characters *only* if a new inline // element is started between them. This makes it hard to reliably // measure the position of things, since that requires inserting an // extra span. This terribly fragile set of tests matches the // character combinations that suffer from this phenomenon on the // various browsers. function spanAffectsWrapping() { return false; } if (gecko) // Only for "$'" spanAffectsWrapping = function(str, i) { return str.charCodeAt(i - 1) == 36 && str.charCodeAt(i) == 39; }; else if (safari && !/Version\/([6-9]|\d\d)\b/.test(navigator.userAgent)) spanAffectsWrapping = function(str, i) { return /\-[^ \-?]|\?[^ !\'\"\),.\-\/:;\?\]\}]/.test(str.slice(i - 1, i + 1)); }; else if (webkit && !/Chrome\/(?:29|[3-9]\d|\d\d\d)\./.test(navigator.userAgent)) spanAffectsWrapping = function(str, i) { if (i > 1 && str.charCodeAt(i - 1) == 45) { if (/\w/.test(str.charAt(i - 2)) && /[^\-?\.]/.test(str.charAt(i))) return true; if (i > 2 && /[\d\.,]/.test(str.charAt(i - 2)) && /[\d\.,]/.test(str.charAt(i))) return false; } return /[~!#%&*)=+}\]|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|…[\w~`@#$%\^&*(_=+{[><]/.test(str.slice(i - 1, i + 1)); }; var knownScrollbarWidth; function scrollbarWidth(measure) { if (knownScrollbarWidth != null) return knownScrollbarWidth; var test = elt("div", null, null, "width: 50px; height: 50px; overflow-x: scroll"); removeChildrenAndAdd(measure, test); if (test.offsetWidth) knownScrollbarWidth = test.offsetHeight - test.clientHeight; return knownScrollbarWidth || 0; } var zwspSupported; function zeroWidthElement(measure) { if (zwspSupported == null) { var test = elt("span", "\u200b"); removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")])); if (measure.firstChild.offsetHeight != 0) zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !ie_lt8; } if (zwspSupported) return elt("span", "\u200b"); else return elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px"); } // See if "".split is the broken IE version, if so, provide an // alternative way to split lines. var splitLines = "\n\nb".split(/\n/).length != 3 ? function(string) { var pos = 0, result = [], l = string.length; while (pos <= l) { var nl = string.indexOf("\n", pos); if (nl == -1) nl = string.length; var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl); var rt = line.indexOf("\r"); if (rt != -1) { result.push(line.slice(0, rt)); pos += rt + 1; } else { result.push(line); pos = nl + 1; } } return result; } : function(string){return string.split(/\r\n?|\n/);}; CodeMirror.splitLines = splitLines; var hasSelection = window.getSelection ? function(te) { try { return te.selectionStart != te.selectionEnd; } catch(e) { return false; } } : function(te) { try {var range = te.ownerDocument.selection.createRange();} catch(e) {} if (!range || range.parentElement() != te) return false; return range.compareEndPoints("StartToEnd", range) != 0; }; var hasCopyEvent = (function() { var e = elt("div"); if ("oncopy" in e) return true; e.setAttribute("oncopy", "return;"); return typeof e.oncopy == 'function'; })(); // KEY NAMING var keyNames = {3: "Enter", 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: ";", 91: "Mod", 92: "Mod", 93: "Mod", 109: "-", 107: "=", 127: "Delete", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\", 221: "]", 222: "'", 63276: "PageUp", 63277: "PageDown", 63275: "End", 63273: "Home", 63234: "Left", 63232: "Up", 63235: "Right", 63233: "Down", 63302: "Insert", 63272: "Delete"}; CodeMirror.keyNames = keyNames; (function() { // Number keys for (var i = 0; i < 10; i++) keyNames[i + 48] = String(i); // Alphabetic keys for (var i = 65; i <= 90; i++) keyNames[i] = String.fromCharCode(i); // Function keys for (var i = 1; i <= 12; i++) keyNames[i + 111] = keyNames[i + 63235] = "F" + i; })(); // BIDI HELPERS function iterateBidiSections(order, from, to, f) { if (!order) return f(from, to, "ltr"); var found = false; for (var i = 0; i < order.length; ++i) { var part = order[i]; if (part.from < to && part.to > from || from == to && part.to == from) { f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr"); found = true; } } if (!found) f(from, to, "ltr"); } function bidiLeft(part) { return part.level % 2 ? part.to : part.from; } function bidiRight(part) { return part.level % 2 ? part.from : part.to; } function lineLeft(line) { var order = getOrder(line); return order ? bidiLeft(order[0]) : 0; } function lineRight(line) { var order = getOrder(line); if (!order) return line.text.length; return bidiRight(lst(order)); } function lineStart(cm, lineN) { var line = getLine(cm.doc, lineN); var visual = visualLine(cm.doc, line); if (visual != line) lineN = lineNo(visual); var order = getOrder(visual); var ch = !order ? 0 : order[0].level % 2 ? lineRight(visual) : lineLeft(visual); return Pos(lineN, ch); } function lineEnd(cm, lineN) { var merged, line; while (merged = collapsedSpanAtEnd(line = getLine(cm.doc, lineN))) lineN = merged.find().to.line; var order = getOrder(line); var ch = !order ? line.text.length : order[0].level % 2 ? lineLeft(line) : lineRight(line); return Pos(lineN, ch); } function compareBidiLevel(order, a, b) { var linedir = order[0].level; if (a == linedir) return true; if (b == linedir) return false; return a < b; } var bidiOther; function getBidiPartAt(order, pos) { for (var i = 0, found; i < order.length; ++i) { var cur = order[i]; if (cur.from < pos && cur.to > pos) { bidiOther = null; return i; } if (cur.from == pos || cur.to == pos) { if (found == null) { found = i; } else if (compareBidiLevel(order, cur.level, order[found].level)) { bidiOther = found; return i; } else { bidiOther = i; return found; } } } bidiOther = null; return found; } function moveInLine(line, pos, dir, byUnit) { if (!byUnit) return pos + dir; do pos += dir; while (pos > 0 && isExtendingChar.test(line.text.charAt(pos))); return pos; } // This is somewhat involved. It is needed in order to move // 'visually' through bi-directional text -- i.e., pressing left // should make the cursor go left, even when in RTL text. The // tricky part is the 'jumps', where RTL and LTR text touch each // other. This often requires the cursor offset to move more than // one unit, in order to visually move one unit. function moveVisually(line, start, dir, byUnit) { var bidi = getOrder(line); if (!bidi) return moveLogically(line, start, dir, byUnit); var pos = getBidiPartAt(bidi, start), part = bidi[pos]; var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit); for (;;) { if (target > part.from && target < part.to) return target; if (target == part.from || target == part.to) { if (getBidiPartAt(bidi, target) == pos) return target; part = bidi[pos += dir]; return (dir > 0) == part.level % 2 ? part.to : part.from; } else { part = bidi[pos += dir]; if (!part) return null; if ((dir > 0) == part.level % 2) target = moveInLine(line, part.to, -1, byUnit); else target = moveInLine(line, part.from, 1, byUnit); } } } function moveLogically(line, start, dir, byUnit) { var target = start + dir; if (byUnit) while (target > 0 && isExtendingChar.test(line.text.charAt(target))) target += dir; return target < 0 || target > line.text.length ? null : target; } // Bidirectional ordering algorithm // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm // that this (partially) implements. // One-char codes used for character types: // L (L): Left-to-Right // R (R): Right-to-Left // r (AL): Right-to-Left Arabic // 1 (EN): European Number // + (ES): European Number Separator // % (ET): European Number Terminator // n (AN): Arabic Number // , (CS): Common Number Separator // m (NSM): Non-Spacing Mark // b (BN): Boundary Neutral // s (B): Paragraph Separator // t (S): Segment Separator // w (WS): Whitespace // N (ON): Other Neutrals // Returns null if characters are ordered as they appear // (left-to-right), or an array of sections ({from, to, level} // objects) in the order in which they occur visually. var bidiOrdering = (function() { // Character types for codepoints 0 to 0xff var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL"; // Character types for codepoints 0x600 to 0x6ff var arabicTypes = "rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr"; function charType(code) { if (code <= 0xff) return lowTypes.charAt(code); else if (0x590 <= code && code <= 0x5f4) return "R"; else if (0x600 <= code && code <= 0x6ff) return arabicTypes.charAt(code - 0x600); else if (0x700 <= code && code <= 0x8ac) return "r"; else return "L"; } var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/; var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/; // Browsers seem to always treat the boundaries of block elements as being L. var outerType = "L"; return function(str) { if (!bidiRE.test(str)) return false; var len = str.length, types = []; for (var i = 0, type; i < len; ++i) types.push(type = charType(str.charCodeAt(i))); // W1. Examine each non-spacing mark (NSM) in the level run, and // change the type of the NSM to the type of the previous // character. If the NSM is at the start of the level run, it will // get the type of sor. for (var i = 0, prev = outerType; i < len; ++i) { var type = types[i]; if (type == "m") types[i] = prev; else prev = type; } // W2. Search backwards from each instance of a European number // until the first strong type (R, L, AL, or sor) is found. If an // AL is found, change the type of the European number to Arabic // number. // W3. Change all ALs to R. for (var i = 0, cur = outerType; i < len; ++i) { var type = types[i]; if (type == "1" && cur == "r") types[i] = "n"; else if (isStrong.test(type)) { cur = type; if (type == "r") types[i] = "R"; } } // W4. A single European separator between two European numbers // changes to a European number. A single common separator between // two numbers of the same type changes to that type. for (var i = 1, prev = types[0]; i < len - 1; ++i) { var type = types[i]; if (type == "+" && prev == "1" && types[i+1] == "1") types[i] = "1"; else if (type == "," && prev == types[i+1] && (prev == "1" || prev == "n")) types[i] = prev; prev = type; } // W5. A sequence of European terminators adjacent to European // numbers changes to all European numbers. // W6. Otherwise, separators and terminators change to Other // Neutral. for (var i = 0; i < len; ++i) { var type = types[i]; if (type == ",") types[i] = "N"; else if (type == "%") { for (var end = i + 1; end < len && types[end] == "%"; ++end) {} var replace = (i && types[i-1] == "!") || (end < len - 1 && types[end] == "1") ? "1" : "N"; for (var j = i; j < end; ++j) types[j] = replace; i = end - 1; } } // W7. Search backwards from each instance of a European number // until the first strong type (R, L, or sor) is found. If an L is // found, then change the type of the European number to L. for (var i = 0, cur = outerType; i < len; ++i) { var type = types[i]; if (cur == "L" && type == "1") types[i] = "L"; else if (isStrong.test(type)) cur = type; } // N1. A sequence of neutrals takes the direction of the // surrounding strong text if the text on both sides has the same // direction. European and Arabic numbers act as if they were R in // terms of their influence on neutrals. Start-of-level-run (sor) // and end-of-level-run (eor) are used at level run boundaries. // N2. Any remaining neutrals take the embedding direction. for (var i = 0; i < len; ++i) { if (isNeutral.test(types[i])) { for (var end = i + 1; end < len && isNeutral.test(types[end]); ++end) {} var before = (i ? types[i-1] : outerType) == "L"; var after = (end < len - 1 ? types[end] : outerType) == "L"; var replace = before || after ? "L" : "R"; for (var j = i; j < end; ++j) types[j] = replace; i = end - 1; } } // Here we depart from the documented algorithm, in order to avoid // building up an actual levels array. Since there are only three // levels (0, 1, 2) in an implementation that doesn't take // explicit embedding into account, we can build up the order on // the fly, without following the level-based algorithm. var order = [], m; for (var i = 0; i < len;) { if (countsAsLeft.test(types[i])) { var start = i; for (++i; i < len && countsAsLeft.test(types[i]); ++i) {} order.push({from: start, to: i, level: 0}); } else { var pos = i, at = order.length; for (++i; i < len && types[i] != "L"; ++i) {} for (var j = pos; j < i;) { if (countsAsNum.test(types[j])) { if (pos < j) order.splice(at, 0, {from: pos, to: j, level: 1}); var nstart = j; for (++j; j < i && countsAsNum.test(types[j]); ++j) {} order.splice(at, 0, {from: nstart, to: j, level: 2}); pos = j; } else ++j; } if (pos < i) order.splice(at, 0, {from: pos, to: i, level: 1}); } } if (order[0].level == 1 && (m = str.match(/^\s+/))) { order[0].from = m[0].length; order.unshift({from: 0, to: m[0].length, level: 0}); } if (lst(order).level == 1 && (m = str.match(/\s+$/))) { lst(order).to -= m[0].length; order.push({from: len - m[0].length, to: len, level: 0}); } if (order[0].level != lst(order).level) order.push({from: len, to: len, level: order[0].level}); return order; }; })(); // THE END CodeMirror.version = "3.15.1"; return CodeMirror; })();
var Area = [ { "provinceCode": "110000", "provinceName": "北京市", "mallCityList": [ { "cityCode": "110100", "cityName": "北京市", "mallAreaList": [ { "areaCode": "110101", "areaName": "东城区" }, { "areaCode": "110102", "areaName": "西城区" }, { "areaCode": "110105", "areaName": "朝阳区" }, { "areaCode": "110106", "areaName": "丰台区" }, { "areaCode": "110107", "areaName": "石景山区" }, { "areaCode": "110108", "areaName": "海淀区" }, { "areaCode": "110109", "areaName": "门头沟区" }, { "areaCode": "110111", "areaName": "房山区" }, { "areaCode": "110112", "areaName": "通州区" }, { "areaCode": "110113", "areaName": "顺义区" }, { "areaCode": "110114", "areaName": "昌平区" }, { "areaCode": "110115", "areaName": "大兴区" }, { "areaCode": "110116", "areaName": "怀柔区" }, { "areaCode": "110117", "areaName": "平谷区" } ] }, { "cityCode": "110200", "cityName": "北京市辖县", "mallAreaList": [ { "areaCode": "110228", "areaName": "密云县" }, { "areaCode": "110229", "areaName": "延庆县" } ] } ] }, { "provinceCode": "120000", "provinceName": "天津市", "mallCityList": [ { "cityCode": "120100", "cityName": "天津市", "mallAreaList": [ { "areaCode": "120101", "areaName": "和平区" }, { "areaCode": "120102", "areaName": "河东区" }, { "areaCode": "120103", "areaName": "河西区" }, { "areaCode": "120104", "areaName": "南开区" }, { "areaCode": "120105", "areaName": "河北区" }, { "areaCode": "120106", "areaName": "红桥区" }, { "areaCode": "120110", "areaName": "东丽区" }, { "areaCode": "120111", "areaName": "西青区" }, { "areaCode": "120112", "areaName": "津南区" }, { "areaCode": "120113", "areaName": "北辰区" }, { "areaCode": "120114", "areaName": "武清区" }, { "areaCode": "120115", "areaName": "宝坻区" }, { "areaCode": "120116", "areaName": "滨海新区" } ] }, { "cityCode": "120200", "cityName": "天津市辖县", "mallAreaList": [ { "areaCode": "120221", "areaName": "宁河县" }, { "areaCode": "120223", "areaName": "静海县" }, { "areaCode": "120225", "areaName": "蓟县" } ] } ] }, { "provinceCode": "130000", "provinceName": "河北省", "mallCityList": [ { "cityCode": "130100", "cityName": "石家庄市", "mallAreaList": [ { "areaCode": "130102", "areaName": "长安区" }, { "areaCode": "130104", "areaName": "桥西区" }, { "areaCode": "130105", "areaName": "新华区" }, { "areaCode": "130107", "areaName": "井陉矿区" }, { "areaCode": "130108", "areaName": "裕华区" }, { "areaCode": "130109", "areaName": "藁城区" }, { "areaCode": "130110", "areaName": "鹿泉区" }, { "areaCode": "130111", "areaName": "栾城区" }, { "areaCode": "130121", "areaName": "井陉县" }, { "areaCode": "130123", "areaName": "正定县" }, { "areaCode": "130125", "areaName": "行唐县" }, { "areaCode": "130126", "areaName": "灵寿县" }, { "areaCode": "130127", "areaName": "高邑县" }, { "areaCode": "130128", "areaName": "深泽县" }, { "areaCode": "130129", "areaName": "赞皇县" }, { "areaCode": "130130", "areaName": "无极县" }, { "areaCode": "130131", "areaName": "平山县" }, { "areaCode": "130132", "areaName": "元氏县" }, { "areaCode": "130133", "areaName": "赵县" }, { "areaCode": "130181", "areaName": "辛集市" }, { "areaCode": "130183", "areaName": "晋州市" }, { "areaCode": "130184", "areaName": "新乐市" } ] }, { "cityCode": "130200", "cityName": "唐山市", "mallAreaList": [ { "areaCode": "130202", "areaName": "路南区" }, { "areaCode": "130203", "areaName": "路北区" }, { "areaCode": "130204", "areaName": "古冶区" }, { "areaCode": "130205", "areaName": "开平区" }, { "areaCode": "130207", "areaName": "丰南区" }, { "areaCode": "130208", "areaName": "丰润区" }, { "areaCode": "130209", "areaName": "曹妃甸区" }, { "areaCode": "130223", "areaName": "滦县" }, { "areaCode": "130224", "areaName": "滦南县" }, { "areaCode": "130225", "areaName": "乐亭县" }, { "areaCode": "130227", "areaName": "迁西县" }, { "areaCode": "130229", "areaName": "玉田县" }, { "areaCode": "130281", "areaName": "遵化市" }, { "areaCode": "130283", "areaName": "迁安市" } ] }, { "cityCode": "130300", "cityName": "秦皇岛市", "mallAreaList": [ { "areaCode": "130302", "areaName": "海港区" }, { "areaCode": "130303", "areaName": "山海关区" }, { "areaCode": "130304", "areaName": "北戴河区" }, { "areaCode": "130321", "areaName": "青龙满族自治县" }, { "areaCode": "130322", "areaName": "昌黎县" }, { "areaCode": "130323", "areaName": "抚宁县" }, { "areaCode": "130324", "areaName": "卢龙县" } ] }, { "cityCode": "130400", "cityName": "邯郸市", "mallAreaList": [ { "areaCode": "130402", "areaName": "邯山区" }, { "areaCode": "130403", "areaName": "丛台区" }, { "areaCode": "130404", "areaName": "复兴区" }, { "areaCode": "130406", "areaName": "峰峰矿区" }, { "areaCode": "130421", "areaName": "邯郸县" }, { "areaCode": "130423", "areaName": "临漳县" }, { "areaCode": "130424", "areaName": "成安县" }, { "areaCode": "130425", "areaName": "大名县" }, { "areaCode": "130426", "areaName": "涉县" }, { "areaCode": "130427", "areaName": "磁县" }, { "areaCode": "130428", "areaName": "肥乡县" }, { "areaCode": "130429", "areaName": "永年县" }, { "areaCode": "130430", "areaName": "邱县" }, { "areaCode": "130431", "areaName": "鸡泽县" }, { "areaCode": "130432", "areaName": "广平县" }, { "areaCode": "130433", "areaName": "馆陶县" }, { "areaCode": "130434", "areaName": "魏县" }, { "areaCode": "130435", "areaName": "曲周县" }, { "areaCode": "130481", "areaName": "武安市" } ] }, { "cityCode": "130500", "cityName": "邢台市", "mallAreaList": [ { "areaCode": "130502", "areaName": "桥东区" }, { "areaCode": "130503", "areaName": "桥西区" }, { "areaCode": "130521", "areaName": "邢台县" }, { "areaCode": "130522", "areaName": "临城县" }, { "areaCode": "130523", "areaName": "内丘县" }, { "areaCode": "130524", "areaName": "柏乡县" }, { "areaCode": "130525", "areaName": "隆尧县" }, { "areaCode": "130526", "areaName": "任县" }, { "areaCode": "130527", "areaName": "南和县" }, { "areaCode": "130528", "areaName": "宁晋县" }, { "areaCode": "130529", "areaName": "巨鹿县" }, { "areaCode": "130530", "areaName": "新河县" }, { "areaCode": "130531", "areaName": "广宗县" }, { "areaCode": "130532", "areaName": "平乡县" }, { "areaCode": "130533", "areaName": "威县" }, { "areaCode": "130534", "areaName": "清河县" }, { "areaCode": "130535", "areaName": "临西县" }, { "areaCode": "130581", "areaName": "南宫市" }, { "areaCode": "130582", "areaName": "沙河市" } ] }, { "cityCode": "130600", "cityName": "保定市", "mallAreaList": [ { "areaCode": "130602", "areaName": "新市区" }, { "areaCode": "130603", "areaName": "北市区" }, { "areaCode": "130604", "areaName": "南市区" }, { "areaCode": "130621", "areaName": "满城县" }, { "areaCode": "130622", "areaName": "清苑县" }, { "areaCode": "130623", "areaName": "涞水县" }, { "areaCode": "130624", "areaName": "阜平县" }, { "areaCode": "130625", "areaName": "徐水县" }, { "areaCode": "130626", "areaName": "定兴县" }, { "areaCode": "130627", "areaName": "唐县" }, { "areaCode": "130628", "areaName": "高阳县" }, { "areaCode": "130629", "areaName": "容城县" }, { "areaCode": "130630", "areaName": "涞源县" }, { "areaCode": "130631", "areaName": "望都县" }, { "areaCode": "130632", "areaName": "安新县" }, { "areaCode": "130633", "areaName": "易县" }, { "areaCode": "130634", "areaName": "曲阳县" }, { "areaCode": "130635", "areaName": "蠡县" }, { "areaCode": "130636", "areaName": "顺平县" }, { "areaCode": "130637", "areaName": "博野县" }, { "areaCode": "130638", "areaName": "雄县" }, { "areaCode": "130681", "areaName": "涿州市" }, { "areaCode": "130682", "areaName": "定州市" }, { "areaCode": "130683", "areaName": "安国市" }, { "areaCode": "130684", "areaName": "高碑店市" } ] }, { "cityCode": "130700", "cityName": "张家口市", "mallAreaList": [ { "areaCode": "130702", "areaName": "桥东区" }, { "areaCode": "130703", "areaName": "桥西区" }, { "areaCode": "130705", "areaName": "宣化区" }, { "areaCode": "130706", "areaName": "下花园区" }, { "areaCode": "130721", "areaName": "宣化县" }, { "areaCode": "130722", "areaName": "张北县" }, { "areaCode": "130723", "areaName": "康保县" }, { "areaCode": "130724", "areaName": "沽源县" }, { "areaCode": "130725", "areaName": "尚义县" }, { "areaCode": "130726", "areaName": "蔚县" }, { "areaCode": "130727", "areaName": "阳原县" }, { "areaCode": "130728", "areaName": "怀安县" }, { "areaCode": "130729", "areaName": "万全县" }, { "areaCode": "130730", "areaName": "怀来县" }, { "areaCode": "130731", "areaName": "涿鹿县" }, { "areaCode": "130732", "areaName": "赤城县" }, { "areaCode": "130733", "areaName": "崇礼县" } ] }, { "cityCode": "130800", "cityName": "承德市", "mallAreaList": [ { "areaCode": "130802", "areaName": "双桥区" }, { "areaCode": "130803", "areaName": "双滦区" }, { "areaCode": "130804", "areaName": "鹰手营子矿区" }, { "areaCode": "130821", "areaName": "承德县" }, { "areaCode": "130822", "areaName": "兴隆县" }, { "areaCode": "130823", "areaName": "平泉县" }, { "areaCode": "130824", "areaName": "滦平县" }, { "areaCode": "130825", "areaName": "隆化县" }, { "areaCode": "130826", "areaName": "丰宁满族自治县" }, { "areaCode": "130827", "areaName": "宽城满族自治县" }, { "areaCode": "130828", "areaName": "围场满族蒙古族自治县" } ] }, { "cityCode": "130900", "cityName": "沧州市", "mallAreaList": [ { "areaCode": "130902", "areaName": "新华区" }, { "areaCode": "130903", "areaName": "运河区" }, { "areaCode": "130921", "areaName": "沧县" }, { "areaCode": "130922", "areaName": "青县" }, { "areaCode": "130923", "areaName": "东光县" }, { "areaCode": "130924", "areaName": "海兴县" }, { "areaCode": "130925", "areaName": "盐山县" }, { "areaCode": "130926", "areaName": "肃宁县" }, { "areaCode": "130927", "areaName": "南皮县" }, { "areaCode": "130928", "areaName": "吴桥县" }, { "areaCode": "130929", "areaName": "献县" }, { "areaCode": "130930", "areaName": "孟村回族自治县" }, { "areaCode": "130981", "areaName": "泊头市" }, { "areaCode": "130982", "areaName": "任丘市" }, { "areaCode": "130983", "areaName": "黄骅市" }, { "areaCode": "130984", "areaName": "河间市" } ] }, { "cityCode": "131000", "cityName": "廊坊市", "mallAreaList": [ { "areaCode": "131002", "areaName": "安次区" }, { "areaCode": "131003", "areaName": "广阳区" }, { "areaCode": "131022", "areaName": "固安县" }, { "areaCode": "131023", "areaName": "永清县" }, { "areaCode": "131024", "areaName": "香河县" }, { "areaCode": "131025", "areaName": "大城县" }, { "areaCode": "131026", "areaName": "文安县" }, { "areaCode": "131028", "areaName": "大厂回族自治县" }, { "areaCode": "131081", "areaName": "霸州市" }, { "areaCode": "131082", "areaName": "三河市" } ] }, { "cityCode": "131100", "cityName": "衡水市", "mallAreaList": [ { "areaCode": "131102", "areaName": "桃城区" }, { "areaCode": "131121", "areaName": "枣强县" }, { "areaCode": "131122", "areaName": "武邑县" }, { "areaCode": "131123", "areaName": "武强县" }, { "areaCode": "131124", "areaName": "饶阳县" }, { "areaCode": "131125", "areaName": "安平县" }, { "areaCode": "131126", "areaName": "故城县" }, { "areaCode": "131127", "areaName": "景县" }, { "areaCode": "131128", "areaName": "阜城县" }, { "areaCode": "131181", "areaName": "冀州市" }, { "areaCode": "131182", "areaName": "深州市" } ] } ] }, { "provinceCode": "140000", "provinceName": "山西省", "mallCityList": [ { "cityCode": "140100", "cityName": "太原市", "mallAreaList": [ { "areaCode": "140105", "areaName": "小店区" }, { "areaCode": "140106", "areaName": "迎泽区" }, { "areaCode": "140107", "areaName": "杏花岭区" }, { "areaCode": "140108", "areaName": "尖草坪区" }, { "areaCode": "140109", "areaName": "万柏林区" }, { "areaCode": "140110", "areaName": "晋源区" }, { "areaCode": "140121", "areaName": "清徐县" }, { "areaCode": "140122", "areaName": "阳曲县" }, { "areaCode": "140123", "areaName": "娄烦县" }, { "areaCode": "140181", "areaName": "古交市" } ] }, { "cityCode": "140200", "cityName": "大同市", "mallAreaList": [ { "areaCode": "140202", "areaName": "城区" }, { "areaCode": "140203", "areaName": "矿区" }, { "areaCode": "140211", "areaName": "南郊区" }, { "areaCode": "140212", "areaName": "新荣区" }, { "areaCode": "140221", "areaName": "阳高县" }, { "areaCode": "140222", "areaName": "天镇县" }, { "areaCode": "140223", "areaName": "广灵县" }, { "areaCode": "140224", "areaName": "灵丘县" }, { "areaCode": "140225", "areaName": "浑源县" }, { "areaCode": "140226", "areaName": "左云县" }, { "areaCode": "140227", "areaName": "大同县" } ] }, { "cityCode": "140300", "cityName": "阳泉市", "mallAreaList": [ { "areaCode": "140302", "areaName": "城区" }, { "areaCode": "140303", "areaName": "矿区" }, { "areaCode": "140311", "areaName": "郊区" }, { "areaCode": "140321", "areaName": "平定县" }, { "areaCode": "140322", "areaName": "盂县" } ] }, { "cityCode": "140400", "cityName": "长治市", "mallAreaList": [ { "areaCode": "140402", "areaName": "城区" }, { "areaCode": "140411", "areaName": "郊区" }, { "areaCode": "140421", "areaName": "长治县" }, { "areaCode": "140423", "areaName": "襄垣县" }, { "areaCode": "140424", "areaName": "屯留县" }, { "areaCode": "140425", "areaName": "平顺县" }, { "areaCode": "140426", "areaName": "黎城县" }, { "areaCode": "140427", "areaName": "壶关县" }, { "areaCode": "140428", "areaName": "长子县" }, { "areaCode": "140429", "areaName": "武乡县" }, { "areaCode": "140430", "areaName": "沁县" }, { "areaCode": "140431", "areaName": "沁源县" }, { "areaCode": "140481", "areaName": "潞城市" } ] }, { "cityCode": "140500", "cityName": "晋城市", "mallAreaList": [ { "areaCode": "140502", "areaName": "城区" }, { "areaCode": "140521", "areaName": "沁水县" }, { "areaCode": "140522", "areaName": "阳城县" }, { "areaCode": "140524", "areaName": "陵川县" }, { "areaCode": "140525", "areaName": "泽州县" }, { "areaCode": "140581", "areaName": "高平市" } ] }, { "cityCode": "140600", "cityName": "朔州市", "mallAreaList": [ { "areaCode": "140602", "areaName": "朔城区" }, { "areaCode": "140603", "areaName": "平鲁区" }, { "areaCode": "140621", "areaName": "山阴县" }, { "areaCode": "140622", "areaName": "应县" }, { "areaCode": "140623", "areaName": "右玉县" }, { "areaCode": "140624", "areaName": "怀仁县" } ] }, { "cityCode": "140700", "cityName": "晋中市", "mallAreaList": [ { "areaCode": "140702", "areaName": "榆次区" }, { "areaCode": "140721", "areaName": "榆社县" }, { "areaCode": "140722", "areaName": "左权县" }, { "areaCode": "140723", "areaName": "和顺县" }, { "areaCode": "140724", "areaName": "昔阳县" }, { "areaCode": "140725", "areaName": "寿阳县" }, { "areaCode": "140726", "areaName": "太谷县" }, { "areaCode": "140727", "areaName": "祁县" }, { "areaCode": "140728", "areaName": "平遥县" }, { "areaCode": "140729", "areaName": "灵石县" }, { "areaCode": "140781", "areaName": "介休市" } ] }, { "cityCode": "140800", "cityName": "运城市", "mallAreaList": [ { "areaCode": "140802", "areaName": "盐湖区" }, { "areaCode": "140821", "areaName": "临猗县" }, { "areaCode": "140822", "areaName": "万荣县" }, { "areaCode": "140823", "areaName": "闻喜县" }, { "areaCode": "140824", "areaName": "稷山县" }, { "areaCode": "140825", "areaName": "新绛县" }, { "areaCode": "140826", "areaName": "绛县" }, { "areaCode": "140827", "areaName": "垣曲县" }, { "areaCode": "140828", "areaName": "夏县" }, { "areaCode": "140829", "areaName": "平陆县" }, { "areaCode": "140830", "areaName": "芮城县" }, { "areaCode": "140881", "areaName": "永济市" }, { "areaCode": "140882", "areaName": "河津市" } ] }, { "cityCode": "140900", "cityName": "忻州市", "mallAreaList": [ { "areaCode": "140902", "areaName": "忻府区" }, { "areaCode": "140921", "areaName": "定襄县" }, { "areaCode": "140922", "areaName": "五台县" }, { "areaCode": "140923", "areaName": "代县" }, { "areaCode": "140924", "areaName": "繁峙县" }, { "areaCode": "140925", "areaName": "宁武县" }, { "areaCode": "140926", "areaName": "静乐县" }, { "areaCode": "140927", "areaName": "神池县" }, { "areaCode": "140928", "areaName": "五寨县" }, { "areaCode": "140929", "areaName": "岢岚县" }, { "areaCode": "140930", "areaName": "河曲县" }, { "areaCode": "140931", "areaName": "保德县" }, { "areaCode": "140932", "areaName": "偏关县" }, { "areaCode": "140981", "areaName": "原平市" } ] }, { "cityCode": "141000", "cityName": "临汾市", "mallAreaList": [ { "areaCode": "141002", "areaName": "尧都区" }, { "areaCode": "141021", "areaName": "曲沃县" }, { "areaCode": "141022", "areaName": "翼城县" }, { "areaCode": "141023", "areaName": "襄汾县" }, { "areaCode": "141024", "areaName": "洪洞县" }, { "areaCode": "141025", "areaName": "古县" }, { "areaCode": "141026", "areaName": "安泽县" }, { "areaCode": "141027", "areaName": "浮山县" }, { "areaCode": "141028", "areaName": "吉县" }, { "areaCode": "141029", "areaName": "乡宁县" }, { "areaCode": "141030", "areaName": "大宁县" }, { "areaCode": "141031", "areaName": "隰县" }, { "areaCode": "141032", "areaName": "永和县" }, { "areaCode": "141033", "areaName": "蒲县" }, { "areaCode": "141034", "areaName": "汾西县" }, { "areaCode": "141081", "areaName": "侯马市" }, { "areaCode": "141082", "areaName": "霍州市" } ] }, { "cityCode": "141100", "cityName": "吕梁市", "mallAreaList": [ { "areaCode": "141102", "areaName": "离石区" }, { "areaCode": "141121", "areaName": "文水县" }, { "areaCode": "141122", "areaName": "交城县" }, { "areaCode": "141123", "areaName": "兴县" }, { "areaCode": "141124", "areaName": "临县" }, { "areaCode": "141125", "areaName": "柳林县" }, { "areaCode": "141126", "areaName": "石楼县" }, { "areaCode": "141127", "areaName": "岚县" }, { "areaCode": "141128", "areaName": "方山县" }, { "areaCode": "141129", "areaName": "中阳县" }, { "areaCode": "141130", "areaName": "交口县" }, { "areaCode": "141181", "areaName": "孝义市" }, { "areaCode": "141182", "areaName": "汾阳市" } ] } ] }, { "provinceCode": "150000", "provinceName": "内蒙古自治区", "mallCityList": [ { "cityCode": "150100", "cityName": "呼和浩特市", "mallAreaList": [ { "areaCode": "150102", "areaName": "新城区" }, { "areaCode": "150103", "areaName": "回民区" }, { "areaCode": "150104", "areaName": "玉泉区" }, { "areaCode": "150105", "areaName": "赛罕区" }, { "areaCode": "150121", "areaName": "土默特左旗" }, { "areaCode": "150122", "areaName": "托克托县" }, { "areaCode": "150123", "areaName": "和林格尔县" }, { "areaCode": "150124", "areaName": "清水河县" }, { "areaCode": "150125", "areaName": "武川县" } ] }, { "cityCode": "150200", "cityName": "包头市", "mallAreaList": [ { "areaCode": "150202", "areaName": "东河区" }, { "areaCode": "150203", "areaName": "昆都仑区" }, { "areaCode": "150204", "areaName": "青山区" }, { "areaCode": "150205", "areaName": "石拐区" }, { "areaCode": "150206", "areaName": "白云鄂博矿区" }, { "areaCode": "150207", "areaName": "九原区" }, { "areaCode": "150221", "areaName": "土默特右旗" }, { "areaCode": "150222", "areaName": "固阳县" }, { "areaCode": "150223", "areaName": "达尔罕茂明安联合旗" } ] }, { "cityCode": "150300", "cityName": "乌海市", "mallAreaList": [ { "areaCode": "150302", "areaName": "海勃湾区" }, { "areaCode": "150303", "areaName": "海南区" }, { "areaCode": "150304", "areaName": "乌达区" } ] }, { "cityCode": "150400", "cityName": "赤峰市", "mallAreaList": [ { "areaCode": "150402", "areaName": "红山区" }, { "areaCode": "150403", "areaName": "元宝山区" }, { "areaCode": "150404", "areaName": "松山区" }, { "areaCode": "150421", "areaName": "阿鲁科尔沁旗" }, { "areaCode": "150422", "areaName": "巴林左旗" }, { "areaCode": "150423", "areaName": "巴林右旗" }, { "areaCode": "150424", "areaName": "林西县" }, { "areaCode": "150425", "areaName": "克什克腾旗" }, { "areaCode": "150426", "areaName": "翁牛特旗" }, { "areaCode": "150428", "areaName": "喀喇沁旗" }, { "areaCode": "150429", "areaName": "宁城县" }, { "areaCode": "150430", "areaName": "敖汉旗" } ] }, { "cityCode": "150500", "cityName": "通辽市", "mallAreaList": [ { "areaCode": "150502", "areaName": "科尔沁区" }, { "areaCode": "150521", "areaName": "科尔沁左翼中旗" }, { "areaCode": "150522", "areaName": "科尔沁左翼后旗" }, { "areaCode": "150523", "areaName": "开鲁县" }, { "areaCode": "150524", "areaName": "库伦旗" }, { "areaCode": "150525", "areaName": "奈曼旗" }, { "areaCode": "150526", "areaName": "扎鲁特旗" }, { "areaCode": "150581", "areaName": "霍林郭勒市" } ] }, { "cityCode": "150600", "cityName": "鄂尔多斯市", "mallAreaList": [ { "areaCode": "150602", "areaName": "东胜区" }, { "areaCode": "150621", "areaName": "达拉特旗" }, { "areaCode": "150622", "areaName": "准格尔旗" }, { "areaCode": "150623", "areaName": "鄂托克前旗" }, { "areaCode": "150624", "areaName": "鄂托克旗" }, { "areaCode": "150625", "areaName": "杭锦旗" }, { "areaCode": "150626", "areaName": "乌审旗" }, { "areaCode": "150627", "areaName": "伊金霍洛旗" } ] }, { "cityCode": "150700", "cityName": "呼伦贝尔市", "mallAreaList": [ { "areaCode": "150702", "areaName": "海拉尔区" }, { "areaCode": "150703", "areaName": "扎赉诺尔区" }, { "areaCode": "150721", "areaName": "阿荣旗" }, { "areaCode": "150722", "areaName": "莫力达瓦达斡尔族自治旗" }, { "areaCode": "150723", "areaName": "鄂伦春自治旗" }, { "areaCode": "150724", "areaName": "鄂温克族自治旗" }, { "areaCode": "150725", "areaName": "陈巴尔虎旗" }, { "areaCode": "150726", "areaName": "新巴尔虎左旗" }, { "areaCode": "150727", "areaName": "新巴尔虎右旗" }, { "areaCode": "150781", "areaName": "满洲里市" }, { "areaCode": "150782", "areaName": "牙克石市" }, { "areaCode": "150783", "areaName": "扎兰屯市" }, { "areaCode": "150784", "areaName": "额尔古纳市" }, { "areaCode": "150785", "areaName": "根河市" } ] }, { "cityCode": "150800", "cityName": "巴彦淖尔市", "mallAreaList": [ { "areaCode": "150802", "areaName": "临河区" }, { "areaCode": "150821", "areaName": "五原县" }, { "areaCode": "150822", "areaName": "磴口县" }, { "areaCode": "150823", "areaName": "乌拉特前旗" }, { "areaCode": "150824", "areaName": "乌拉特中旗" }, { "areaCode": "150825", "areaName": "乌拉特后旗" }, { "areaCode": "150826", "areaName": "杭锦后旗" } ] }, { "cityCode": "150900", "cityName": "乌兰察布市", "mallAreaList": [ { "areaCode": "150902", "areaName": "集宁区" }, { "areaCode": "150921", "areaName": "卓资县" }, { "areaCode": "150922", "areaName": "化德县" }, { "areaCode": "150923", "areaName": "商都县" }, { "areaCode": "150924", "areaName": "兴和县" }, { "areaCode": "150925", "areaName": "凉城县" }, { "areaCode": "150926", "areaName": "察哈尔右翼前旗" }, { "areaCode": "150927", "areaName": "察哈尔右翼中旗" }, { "areaCode": "150928", "areaName": "察哈尔右翼后旗" }, { "areaCode": "150929", "areaName": "四子王旗" }, { "areaCode": "150981", "areaName": "丰镇市" } ] }, { "cityCode": "152200", "cityName": "兴安盟", "mallAreaList": [ { "areaCode": "152201", "areaName": "乌兰浩特市" }, { "areaCode": "152202", "areaName": "阿尔山市" }, { "areaCode": "152221", "areaName": "科尔沁右翼前旗" }, { "areaCode": "152222", "areaName": "科尔沁右翼中旗" }, { "areaCode": "152223", "areaName": "扎赉特旗" }, { "areaCode": "152224", "areaName": "突泉县" } ] }, { "cityCode": "152500", "cityName": "锡林郭勒盟", "mallAreaList": [ { "areaCode": "152501", "areaName": "二连浩特市" }, { "areaCode": "152502", "areaName": "锡林浩特市" }, { "areaCode": "152522", "areaName": "阿巴嘎旗" }, { "areaCode": "152523", "areaName": "苏尼特左旗" }, { "areaCode": "152524", "areaName": "苏尼特右旗" }, { "areaCode": "152525", "areaName": "东乌珠穆沁旗" }, { "areaCode": "152526", "areaName": "西乌珠穆沁旗" }, { "areaCode": "152527", "areaName": "太仆寺旗" }, { "areaCode": "152528", "areaName": "镶黄旗" }, { "areaCode": "152529", "areaName": "正镶白旗" }, { "areaCode": "152530", "areaName": "正蓝旗" }, { "areaCode": "152531", "areaName": "多伦县" } ] }, { "cityCode": "152900", "cityName": "阿拉善盟", "mallAreaList": [ { "areaCode": "152921", "areaName": "阿拉善左旗" }, { "areaCode": "152922", "areaName": "阿拉善右旗" }, { "areaCode": "152923", "areaName": "额济纳旗" } ] } ] }, { "provinceCode": "210000", "provinceName": "辽宁省", "mallCityList": [ { "cityCode": "210100", "cityName": "沈阳市", "mallAreaList": [ { "areaCode": "210102", "areaName": "和平区" }, { "areaCode": "210103", "areaName": "沈河区" }, { "areaCode": "210104", "areaName": "大东区" }, { "areaCode": "210105", "areaName": "皇姑区" }, { "areaCode": "210106", "areaName": "铁西区" }, { "areaCode": "210111", "areaName": "苏家屯区" }, { "areaCode": "210112", "areaName": "浑南区" }, { "areaCode": "210113", "areaName": "沈北新区" }, { "areaCode": "210114", "areaName": "于洪区" }, { "areaCode": "210122", "areaName": "辽中县" }, { "areaCode": "210123", "areaName": "康平县" }, { "areaCode": "210124", "areaName": "法库县" }, { "areaCode": "210181", "areaName": "新民市" } ] }, { "cityCode": "210200", "cityName": "大连市", "mallAreaList": [ { "areaCode": "210202", "areaName": "中山区" }, { "areaCode": "210203", "areaName": "西岗区" }, { "areaCode": "210204", "areaName": "沙河口区" }, { "areaCode": "210211", "areaName": "甘井子区" }, { "areaCode": "210212", "areaName": "旅顺口区" }, { "areaCode": "210213", "areaName": "金州区" }, { "areaCode": "210224", "areaName": "长海县" }, { "areaCode": "210281", "areaName": "瓦房店市" }, { "areaCode": "210282", "areaName": "普兰店市" }, { "areaCode": "210283", "areaName": "庄河市" } ] }, { "cityCode": "210300", "cityName": "鞍山市", "mallAreaList": [ { "areaCode": "210302", "areaName": "铁东区" }, { "areaCode": "210303", "areaName": "铁西区" }, { "areaCode": "210304", "areaName": "立山区" }, { "areaCode": "210311", "areaName": "千山区" }, { "areaCode": "210321", "areaName": "台安县" }, { "areaCode": "210323", "areaName": "岫岩满族自治县" }, { "areaCode": "210381", "areaName": "海城市" } ] }, { "cityCode": "210400", "cityName": "抚顺市", "mallAreaList": [ { "areaCode": "210402", "areaName": "新抚区" }, { "areaCode": "210403", "areaName": "东洲区" }, { "areaCode": "210404", "areaName": "望花区" }, { "areaCode": "210411", "areaName": "顺城区" }, { "areaCode": "210421", "areaName": "抚顺县" }, { "areaCode": "210422", "areaName": "新宾满族自治县" }, { "areaCode": "210423", "areaName": "清原满族自治县" } ] }, { "cityCode": "210500", "cityName": "本溪市", "mallAreaList": [ { "areaCode": "210502", "areaName": "平山区" }, { "areaCode": "210503", "areaName": "溪湖区" }, { "areaCode": "210504", "areaName": "明山区" }, { "areaCode": "210505", "areaName": "南芬区" }, { "areaCode": "210521", "areaName": "本溪满族自治县" }, { "areaCode": "210522", "areaName": "桓仁满族自治县" } ] }, { "cityCode": "210600", "cityName": "丹东市", "mallAreaList": [ { "areaCode": "210602", "areaName": "元宝区" }, { "areaCode": "210603", "areaName": "振兴区" }, { "areaCode": "210604", "areaName": "振安区" }, { "areaCode": "210624", "areaName": "宽甸满族自治县" }, { "areaCode": "210681", "areaName": "东港市" }, { "areaCode": "210682", "areaName": "凤城市" } ] }, { "cityCode": "210700", "cityName": "锦州市", "mallAreaList": [ { "areaCode": "210702", "areaName": "古塔区" }, { "areaCode": "210703", "areaName": "凌河区" }, { "areaCode": "210711", "areaName": "太和区" }, { "areaCode": "210726", "areaName": "黑山县" }, { "areaCode": "210727", "areaName": "义县" }, { "areaCode": "210781", "areaName": "凌海市" }, { "areaCode": "210782", "areaName": "北镇市" } ] }, { "cityCode": "210800", "cityName": "营口市", "mallAreaList": [ { "areaCode": "210802", "areaName": "站前区" }, { "areaCode": "210803", "areaName": "西市区" }, { "areaCode": "210804", "areaName": "鲅鱼圈区" }, { "areaCode": "210811", "areaName": "老边区" }, { "areaCode": "210881", "areaName": "盖州市" }, { "areaCode": "210882", "areaName": "大石桥市" } ] }, { "cityCode": "210900", "cityName": "阜新市", "mallAreaList": [ { "areaCode": "210902", "areaName": "海州区" }, { "areaCode": "210903", "areaName": "新邱区" }, { "areaCode": "210904", "areaName": "太平区" }, { "areaCode": "210905", "areaName": "清河门区" }, { "areaCode": "210911", "areaName": "细河区" }, { "areaCode": "210921", "areaName": "阜新蒙古族自治县" }, { "areaCode": "210922", "areaName": "彰武县" } ] }, { "cityCode": "211000", "cityName": "辽阳市", "mallAreaList": [ { "areaCode": "211002", "areaName": "白塔区" }, { "areaCode": "211003", "areaName": "文圣区" }, { "areaCode": "211004", "areaName": "宏伟区" }, { "areaCode": "211005", "areaName": "弓长岭区" }, { "areaCode": "211011", "areaName": "太子河区" }, { "areaCode": "211021", "areaName": "辽阳县" }, { "areaCode": "211081", "areaName": "灯塔市" } ] }, { "cityCode": "211100", "cityName": "盘锦市", "mallAreaList": [ { "areaCode": "211102", "areaName": "双台子区" }, { "areaCode": "211103", "areaName": "兴隆台区" }, { "areaCode": "211121", "areaName": "大洼县" }, { "areaCode": "211122", "areaName": "盘山县" } ] }, { "cityCode": "211200", "cityName": "铁岭市", "mallAreaList": [ { "areaCode": "211202", "areaName": "银州区" }, { "areaCode": "211204", "areaName": "清河区" }, { "areaCode": "211221", "areaName": "铁岭县" }, { "areaCode": "211223", "areaName": "西丰县" }, { "areaCode": "211224", "areaName": "昌图县" }, { "areaCode": "211281", "areaName": "调兵山市" }, { "areaCode": "211282", "areaName": "开原市" } ] }, { "cityCode": "211300", "cityName": "朝阳市", "mallAreaList": [ { "areaCode": "211302", "areaName": "双塔区" }, { "areaCode": "211303", "areaName": "龙城区" }, { "areaCode": "211321", "areaName": "朝阳县" }, { "areaCode": "211322", "areaName": "建平县" }, { "areaCode": "211324", "areaName": "喀喇沁左翼蒙古族自治县" }, { "areaCode": "211381", "areaName": "北票市" }, { "areaCode": "211382", "areaName": "凌源市" } ] }, { "cityCode": "211400", "cityName": "葫芦岛市", "mallAreaList": [ { "areaCode": "211402", "areaName": "连山区" }, { "areaCode": "211403", "areaName": "龙港区" }, { "areaCode": "211404", "areaName": "南票区" }, { "areaCode": "211421", "areaName": "绥中县" }, { "areaCode": "211422", "areaName": "建昌县" }, { "areaCode": "211481", "areaName": "兴城市" } ] } ] }, { "provinceCode": "220000", "provinceName": "吉林省", "mallCityList": [ { "cityCode": "220100", "cityName": "长春市", "mallAreaList": [ { "areaCode": "220102", "areaName": "南关区" }, { "areaCode": "220103", "areaName": "宽城区" }, { "areaCode": "220104", "areaName": "朝阳区" }, { "areaCode": "220105", "areaName": "二道区" }, { "areaCode": "220106", "areaName": "绿园区" }, { "areaCode": "220112", "areaName": "双阳区" }, { "areaCode": "220113", "areaName": "九台区" }, { "areaCode": "220122", "areaName": "农安县" }, { "areaCode": "220182", "areaName": "榆树市" }, { "areaCode": "220183", "areaName": "德惠市" } ] }, { "cityCode": "220200", "cityName": "吉林市", "mallAreaList": [ { "areaCode": "220202", "areaName": "昌邑区" }, { "areaCode": "220203", "areaName": "龙潭区" }, { "areaCode": "220204", "areaName": "船营区" }, { "areaCode": "220211", "areaName": "丰满区" }, { "areaCode": "220221", "areaName": "永吉县" }, { "areaCode": "220281", "areaName": "蛟河市" }, { "areaCode": "220282", "areaName": "桦甸市" }, { "areaCode": "220283", "areaName": "舒兰市" }, { "areaCode": "220284", "areaName": "磐石市" } ] }, { "cityCode": "220300", "cityName": "四平市", "mallAreaList": [ { "areaCode": "220302", "areaName": "铁西区" }, { "areaCode": "220303", "areaName": "铁东区" }, { "areaCode": "220322", "areaName": "梨树县" }, { "areaCode": "220323", "areaName": "伊通满族自治县" }, { "areaCode": "220381", "areaName": "公主岭市" }, { "areaCode": "220382", "areaName": "双辽市" } ] }, { "cityCode": "220400", "cityName": "辽源市", "mallAreaList": [ { "areaCode": "220402", "areaName": "龙山区" }, { "areaCode": "220403", "areaName": "西安区" }, { "areaCode": "220421", "areaName": "东丰县" }, { "areaCode": "220422", "areaName": "东辽县" } ] }, { "cityCode": "220500", "cityName": "通化市", "mallAreaList": [ { "areaCode": "220502", "areaName": "东昌区" }, { "areaCode": "220503", "areaName": "二道江区" }, { "areaCode": "220521", "areaName": "通化县" }, { "areaCode": "220523", "areaName": "辉南县" }, { "areaCode": "220524", "areaName": "柳河县" }, { "areaCode": "220581", "areaName": "梅河口市" }, { "areaCode": "220582", "areaName": "集安市" } ] }, { "cityCode": "220600", "cityName": "白山市", "mallAreaList": [ { "areaCode": "220602", "areaName": "浑江区" }, { "areaCode": "220605", "areaName": "江源区" }, { "areaCode": "220621", "areaName": "抚松县" }, { "areaCode": "220622", "areaName": "靖宇县" }, { "areaCode": "220623", "areaName": "长白朝鲜族自治县" }, { "areaCode": "220681", "areaName": "临江市" } ] }, { "cityCode": "220700", "cityName": "松原市", "mallAreaList": [ { "areaCode": "220702", "areaName": "宁江区" }, { "areaCode": "220721", "areaName": "前郭尔罗斯蒙古族自治县" }, { "areaCode": "220722", "areaName": "长岭县" }, { "areaCode": "220723", "areaName": "乾安县" }, { "areaCode": "220781", "areaName": "扶余市" } ] }, { "cityCode": "220800", "cityName": "白城市", "mallAreaList": [ { "areaCode": "220802", "areaName": "洮北区" }, { "areaCode": "220821", "areaName": "镇赉县" }, { "areaCode": "220822", "areaName": "通榆县" }, { "areaCode": "220881", "areaName": "洮南市" }, { "areaCode": "220882", "areaName": "大安市" } ] }, { "cityCode": "222400", "cityName": "延边朝鲜族自治州", "mallAreaList": [ { "areaCode": "222401", "areaName": "延吉市" }, { "areaCode": "222402", "areaName": "图们市" }, { "areaCode": "222403", "areaName": "敦化市" }, { "areaCode": "222404", "areaName": "珲春市" }, { "areaCode": "222405", "areaName": "龙井市" }, { "areaCode": "222406", "areaName": "和龙市" }, { "areaCode": "222424", "areaName": "汪清县" }, { "areaCode": "222426", "areaName": "安图县" } ] } ] }, { "provinceCode": "230000", "provinceName": "黑龙江省", "mallCityList": [ { "cityCode": "230100", "cityName": "哈尔滨市", "mallAreaList": [ { "areaCode": "230102", "areaName": "道里区" }, { "areaCode": "230103", "areaName": "南岗区" }, { "areaCode": "230104", "areaName": "道外区" }, { "areaCode": "230108", "areaName": "平房区" }, { "areaCode": "230109", "areaName": "松北区" }, { "areaCode": "230110", "areaName": "香坊区" }, { "areaCode": "230111", "areaName": "呼兰区" }, { "areaCode": "230112", "areaName": "阿城区" }, { "areaCode": "230123", "areaName": "依兰县" }, { "areaCode": "230124", "areaName": "方正县" }, { "areaCode": "230125", "areaName": "宾县" }, { "areaCode": "230126", "areaName": "巴彦县" }, { "areaCode": "230127", "areaName": "木兰县" }, { "areaCode": "230128", "areaName": "通河县" }, { "areaCode": "230129", "areaName": "延寿县" }, { "areaCode": "230182", "areaName": "双城市" }, { "areaCode": "230183", "areaName": "尚志市" }, { "areaCode": "230184", "areaName": "五常市" } ] }, { "cityCode": "230200", "cityName": "齐齐哈尔市", "mallAreaList": [ { "areaCode": "230202", "areaName": "龙沙区" }, { "areaCode": "230203", "areaName": "建华区" }, { "areaCode": "230204", "areaName": "铁锋区" }, { "areaCode": "230205", "areaName": "昂昂溪区" }, { "areaCode": "230206", "areaName": "富拉尔基区" }, { "areaCode": "230207", "areaName": "碾子山区" }, { "areaCode": "230208", "areaName": "梅里斯达斡尔族区" }, { "areaCode": "230221", "areaName": "龙江县" }, { "areaCode": "230223", "areaName": "依安县" }, { "areaCode": "230224", "areaName": "泰来县" }, { "areaCode": "230225", "areaName": "甘南县" }, { "areaCode": "230227", "areaName": "富裕县" }, { "areaCode": "230229", "areaName": "克山县" }, { "areaCode": "230230", "areaName": "克东县" }, { "areaCode": "230231", "areaName": "拜泉县" }, { "areaCode": "230281", "areaName": "讷河市" } ] }, { "cityCode": "230300", "cityName": "鸡西市", "mallAreaList": [ { "areaCode": "230302", "areaName": "鸡冠区" }, { "areaCode": "230303", "areaName": "恒山区" }, { "areaCode": "230304", "areaName": "滴道区" }, { "areaCode": "230305", "areaName": "梨树区" }, { "areaCode": "230306", "areaName": "城子河区" }, { "areaCode": "230307", "areaName": "麻山区" }, { "areaCode": "230321", "areaName": "鸡东县" }, { "areaCode": "230381", "areaName": "虎林市" }, { "areaCode": "230382", "areaName": "密山市" } ] }, { "cityCode": "230400", "cityName": "鹤岗市", "mallAreaList": [ { "areaCode": "230402", "areaName": "向阳区" }, { "areaCode": "230403", "areaName": "工农区" }, { "areaCode": "230404", "areaName": "南山区" }, { "areaCode": "230405", "areaName": "兴安区" }, { "areaCode": "230406", "areaName": "东山区" }, { "areaCode": "230407", "areaName": "兴山区" }, { "areaCode": "230421", "areaName": "萝北县" }, { "areaCode": "230422", "areaName": "绥滨县" } ] }, { "cityCode": "230500", "cityName": "双鸭山市", "mallAreaList": [ { "areaCode": "230502", "areaName": "尖山区" }, { "areaCode": "230503", "areaName": "岭东区" }, { "areaCode": "230505", "areaName": "四方台区" }, { "areaCode": "230506", "areaName": "宝山区" }, { "areaCode": "230521", "areaName": "集贤县" }, { "areaCode": "230522", "areaName": "友谊县" }, { "areaCode": "230523", "areaName": "宝清县" }, { "areaCode": "230524", "areaName": "饶河县" } ] }, { "cityCode": "230600", "cityName": "大庆市", "mallAreaList": [ { "areaCode": "230602", "areaName": "萨尔图区" }, { "areaCode": "230603", "areaName": "龙凤区" }, { "areaCode": "230604", "areaName": "让胡路区" }, { "areaCode": "230605", "areaName": "红岗区" }, { "areaCode": "230606", "areaName": "大同区" }, { "areaCode": "230621", "areaName": "肇州县" }, { "areaCode": "230622", "areaName": "肇源县" }, { "areaCode": "230623", "areaName": "林甸县" }, { "areaCode": "230624", "areaName": "杜尔伯特蒙古族自治县" } ] }, { "cityCode": "230700", "cityName": "伊春市", "mallAreaList": [ { "areaCode": "230702", "areaName": "伊春区" }, { "areaCode": "230703", "areaName": "南岔区" }, { "areaCode": "230704", "areaName": "友好区" }, { "areaCode": "230705", "areaName": "西林区" }, { "areaCode": "230706", "areaName": "翠峦区" }, { "areaCode": "230707", "areaName": "新青区" }, { "areaCode": "230708", "areaName": "美溪区" }, { "areaCode": "230709", "areaName": "金山屯区" }, { "areaCode": "230710", "areaName": "五营区" }, { "areaCode": "230711", "areaName": "乌马河区" }, { "areaCode": "230712", "areaName": "汤旺河区" }, { "areaCode": "230713", "areaName": "带岭区" }, { "areaCode": "230714", "areaName": "乌伊岭区" }, { "areaCode": "230715", "areaName": "红星区" }, { "areaCode": "230716", "areaName": "上甘岭区" }, { "areaCode": "230722", "areaName": "嘉荫县" }, { "areaCode": "230781", "areaName": "铁力市" } ] }, { "cityCode": "230800", "cityName": "佳木斯市", "mallAreaList": [ { "areaCode": "230803", "areaName": "向阳区" }, { "areaCode": "230804", "areaName": "前进区" }, { "areaCode": "230805", "areaName": "东风区" }, { "areaCode": "230811", "areaName": "郊区" }, { "areaCode": "230822", "areaName": "桦南县" }, { "areaCode": "230826", "areaName": "桦川县" }, { "areaCode": "230828", "areaName": "汤原县" }, { "areaCode": "230833", "areaName": "抚远县" }, { "areaCode": "230881", "areaName": "同江市" }, { "areaCode": "230882", "areaName": "富锦市" } ] }, { "cityCode": "230900", "cityName": "七台河市", "mallAreaList": [ { "areaCode": "230902", "areaName": "新兴区" }, { "areaCode": "230903", "areaName": "桃山区" }, { "areaCode": "230904", "areaName": "茄子河区" }, { "areaCode": "230921", "areaName": "勃利县" } ] }, { "cityCode": "231000", "cityName": "牡丹江市", "mallAreaList": [ { "areaCode": "231002", "areaName": "东安区" }, { "areaCode": "231003", "areaName": "阳明区" }, { "areaCode": "231004", "areaName": "爱民区" }, { "areaCode": "231005", "areaName": "西安区" }, { "areaCode": "231024", "areaName": "东宁县" }, { "areaCode": "231025", "areaName": "林口县" }, { "areaCode": "231081", "areaName": "绥芬河市" }, { "areaCode": "231083", "areaName": "海林市" }, { "areaCode": "231084", "areaName": "宁安市" }, { "areaCode": "231085", "areaName": "穆棱市" } ] }, { "cityCode": "231100", "cityName": "黑河市", "mallAreaList": [ { "areaCode": "231102", "areaName": "爱辉区" }, { "areaCode": "231121", "areaName": "嫩江县" }, { "areaCode": "231123", "areaName": "逊克县" }, { "areaCode": "231124", "areaName": "孙吴县" }, { "areaCode": "231181", "areaName": "北安市" }, { "areaCode": "231182", "areaName": "五大连池市" } ] }, { "cityCode": "231200", "cityName": "绥化市", "mallAreaList": [ { "areaCode": "231202", "areaName": "北林区" }, { "areaCode": "231221", "areaName": "望奎县" }, { "areaCode": "231222", "areaName": "兰西县" }, { "areaCode": "231223", "areaName": "青冈县" }, { "areaCode": "231224", "areaName": "庆安县" }, { "areaCode": "231225", "areaName": "明水县" }, { "areaCode": "231226", "areaName": "绥棱县" }, { "areaCode": "231281", "areaName": "安达市" }, { "areaCode": "231282", "areaName": "肇东市" }, { "areaCode": "231283", "areaName": "海伦市" } ] }, { "cityCode": "232700", "cityName": "大兴安岭地区", "mallAreaList": [ { "areaCode": "232721", "areaName": "呼玛县" }, { "areaCode": "232722", "areaName": "塔河县" }, { "areaCode": "232723", "areaName": "漠河县" } ] } ] }, { "provinceCode": "310000", "provinceName": "上海市", "mallCityList": [ { "cityCode": "310100", "cityName": "上海市", "mallAreaList": [ { "areaCode": "310101", "areaName": "黄浦区" }, { "areaCode": "310104", "areaName": "徐汇区" }, { "areaCode": "310105", "areaName": "长宁区" }, { "areaCode": "310106", "areaName": "静安区" }, { "areaCode": "310107", "areaName": "普陀区" }, { "areaCode": "310108", "areaName": "闸北区" }, { "areaCode": "310109", "areaName": "虹口区" }, { "areaCode": "310110", "areaName": "杨浦区" }, { "areaCode": "310112", "areaName": "闵行区" }, { "areaCode": "310113", "areaName": "宝山区" }, { "areaCode": "310114", "areaName": "嘉定区" }, { "areaCode": "310115", "areaName": "浦东新区" }, { "areaCode": "310116", "areaName": "金山区" }, { "areaCode": "310117", "areaName": "松江区" }, { "areaCode": "310118", "areaName": "青浦区" }, { "areaCode": "310120", "areaName": "奉贤区" } ] }, { "cityCode": "310200", "cityName": "上海市辖县", "mallAreaList": [ { "areaCode": "310230", "areaName": "崇明县" } ] } ] }, { "provinceCode": "320000", "provinceName": "江苏省", "mallCityList": [ { "cityCode": "320100", "cityName": "南京市", "mallAreaList": [ { "areaCode": "320102", "areaName": "玄武区" }, { "areaCode": "320104", "areaName": "秦淮区" }, { "areaCode": "320105", "areaName": "建邺区" }, { "areaCode": "320106", "areaName": "鼓楼区" }, { "areaCode": "320111", "areaName": "浦口区" }, { "areaCode": "320113", "areaName": "栖霞区" }, { "areaCode": "320114", "areaName": "雨花台区" }, { "areaCode": "320115", "areaName": "江宁区" }, { "areaCode": "320116", "areaName": "六合区" }, { "areaCode": "320117", "areaName": "溧水区" }, { "areaCode": "320118", "areaName": "高淳区" } ] }, { "cityCode": "320200", "cityName": "无锡市", "mallAreaList": [ { "areaCode": "320202", "areaName": "崇安区" }, { "areaCode": "320203", "areaName": "南长区" }, { "areaCode": "320204", "areaName": "北塘区" }, { "areaCode": "320205", "areaName": "锡山区" }, { "areaCode": "320206", "areaName": "惠山区" }, { "areaCode": "320211", "areaName": "滨湖区" }, { "areaCode": "320281", "areaName": "江阴市" }, { "areaCode": "320282", "areaName": "宜兴市" } ] }, { "cityCode": "320300", "cityName": "徐州市", "mallAreaList": [ { "areaCode": "320302", "areaName": "鼓楼区" }, { "areaCode": "320303", "areaName": "云龙区" }, { "areaCode": "320305", "areaName": "贾汪区" }, { "areaCode": "320311", "areaName": "泉山区" }, { "areaCode": "320312", "areaName": "铜山区" }, { "areaCode": "320321", "areaName": "丰县" }, { "areaCode": "320322", "areaName": "沛县" }, { "areaCode": "320324", "areaName": "睢宁县" }, { "areaCode": "320381", "areaName": "新沂市" }, { "areaCode": "320382", "areaName": "邳州市" } ] }, { "cityCode": "320400", "cityName": "常州市", "mallAreaList": [ { "areaCode": "320402", "areaName": "天宁区" }, { "areaCode": "320404", "areaName": "钟楼区" }, { "areaCode": "320405", "areaName": "戚墅堰区" }, { "areaCode": "320411", "areaName": "新北区" }, { "areaCode": "320412", "areaName": "武进区" }, { "areaCode": "320481", "areaName": "溧阳市" }, { "areaCode": "320482", "areaName": "金坛市" } ] }, { "cityCode": "320500", "cityName": "苏州市", "mallAreaList": [ { "areaCode": "320505", "areaName": "虎丘区" }, { "areaCode": "320506", "areaName": "吴中区" }, { "areaCode": "320507", "areaName": "相城区" }, { "areaCode": "320508", "areaName": "姑苏区" }, { "areaCode": "320509", "areaName": "吴江区" }, { "areaCode": "320581", "areaName": "常熟市" }, { "areaCode": "320582", "areaName": "张家港市" }, { "areaCode": "320583", "areaName": "昆山市" }, { "areaCode": "320585", "areaName": "太仓市" } ] }, { "cityCode": "320600", "cityName": "南通市", "mallAreaList": [ { "areaCode": "320602", "areaName": "崇川区" }, { "areaCode": "320611", "areaName": "港闸区" }, { "areaCode": "320612", "areaName": "通州区" }, { "areaCode": "320621", "areaName": "海安县" }, { "areaCode": "320623", "areaName": "如东县" }, { "areaCode": "320681", "areaName": "启东市" }, { "areaCode": "320682", "areaName": "如皋市" }, { "areaCode": "320684", "areaName": "海门市" } ] }, { "cityCode": "320700", "cityName": "连云港市", "mallAreaList": [ { "areaCode": "320703", "areaName": "连云区" }, { "areaCode": "320705", "areaName": "新浦" }, { "areaCode": "320706", "areaName": "海州区" }, { "areaCode": "320707", "areaName": "赣榆区" }, { "areaCode": "320722", "areaName": "东海县" }, { "areaCode": "320723", "areaName": "灌云县" }, { "areaCode": "320724", "areaName": "灌南县" } ] }, { "cityCode": "320800", "cityName": "淮安市", "mallAreaList": [ { "areaCode": "320802", "areaName": "清河区" }, { "areaCode": "320803", "areaName": "淮安区" }, { "areaCode": "320804", "areaName": "淮阴区" }, { "areaCode": "320811", "areaName": "清浦区" }, { "areaCode": "320826", "areaName": "涟水县" }, { "areaCode": "320829", "areaName": "洪泽县" }, { "areaCode": "320830", "areaName": "盱眙县" }, { "areaCode": "320831", "areaName": "金湖县" } ] }, { "cityCode": "320900", "cityName": "盐城市", "mallAreaList": [ { "areaCode": "320902", "areaName": "亭湖区" }, { "areaCode": "320903", "areaName": "盐都区" }, { "areaCode": "320921", "areaName": "响水县" }, { "areaCode": "320922", "areaName": "滨海县" }, { "areaCode": "320923", "areaName": "阜宁县" }, { "areaCode": "320924", "areaName": "射阳县" }, { "areaCode": "320925", "areaName": "建湖县" }, { "areaCode": "320981", "areaName": "东台市" }, { "areaCode": "320982", "areaName": "大丰市" } ] }, { "cityCode": "321000", "cityName": "扬州市", "mallAreaList": [ { "areaCode": "321002", "areaName": "广陵区" }, { "areaCode": "321003", "areaName": "邗江区" }, { "areaCode": "321012", "areaName": "江都区" }, { "areaCode": "321023", "areaName": "宝应县" }, { "areaCode": "321081", "areaName": "仪征市" }, { "areaCode": "321084", "areaName": "高邮市" } ] }, { "cityCode": "321100", "cityName": "镇江市", "mallAreaList": [ { "areaCode": "321102", "areaName": "京口区" }, { "areaCode": "321111", "areaName": "润州区" }, { "areaCode": "321112", "areaName": "丹徒区" }, { "areaCode": "321181", "areaName": "丹阳市" }, { "areaCode": "321182", "areaName": "扬中市" }, { "areaCode": "321183", "areaName": "句容市" } ] }, { "cityCode": "321200", "cityName": "泰州市", "mallAreaList": [ { "areaCode": "321202", "areaName": "海陵区" }, { "areaCode": "321203", "areaName": "高港区" }, { "areaCode": "321204", "areaName": "姜堰区" }, { "areaCode": "321281", "areaName": "兴化市" }, { "areaCode": "321282", "areaName": "靖江市" }, { "areaCode": "321283", "areaName": "泰兴市" } ] }, { "cityCode": "321300", "cityName": "宿迁市", "mallAreaList": [ { "areaCode": "321302", "areaName": "宿城区" }, { "areaCode": "321311", "areaName": "宿豫区" }, { "areaCode": "321322", "areaName": "沭阳县" }, { "areaCode": "321323", "areaName": "泗阳县" }, { "areaCode": "321324", "areaName": "泗洪县" } ] } ] }, { "provinceCode": "330000", "provinceName": "浙江省", "mallCityList": [ { "cityCode": "330100", "cityName": "杭州市", "mallAreaList": [ { "areaCode": "330102", "areaName": "上城区" }, { "areaCode": "330103", "areaName": "下城区" }, { "areaCode": "330104", "areaName": "江干区" }, { "areaCode": "330105", "areaName": "拱墅区" }, { "areaCode": "330106", "areaName": "西湖区" }, { "areaCode": "330108", "areaName": "滨江区" }, { "areaCode": "330109", "areaName": "萧山区" }, { "areaCode": "330110", "areaName": "余杭区" }, { "areaCode": "330122", "areaName": "桐庐县" }, { "areaCode": "330127", "areaName": "淳安县" }, { "areaCode": "330182", "areaName": "建德市" }, { "areaCode": "330183", "areaName": "富阳市" }, { "areaCode": "330185", "areaName": "临安市" } ] }, { "cityCode": "330200", "cityName": "宁波市", "mallAreaList": [ { "areaCode": "330203", "areaName": "海曙区" }, { "areaCode": "330204", "areaName": "江东区" }, { "areaCode": "330205", "areaName": "江北区" }, { "areaCode": "330206", "areaName": "北仑区" }, { "areaCode": "330211", "areaName": "镇海区" }, { "areaCode": "330212", "areaName": "鄞州区" }, { "areaCode": "330225", "areaName": "象山县" }, { "areaCode": "330226", "areaName": "宁海县" }, { "areaCode": "330281", "areaName": "余姚市" }, { "areaCode": "330282", "areaName": "慈溪市" }, { "areaCode": "330283", "areaName": "奉化市" } ] }, { "cityCode": "330300", "cityName": "温州市", "mallAreaList": [ { "areaCode": "330302", "areaName": "鹿城区" }, { "areaCode": "330303", "areaName": "龙湾区" }, { "areaCode": "330304", "areaName": "瓯海区" }, { "areaCode": "330322", "areaName": "洞头县" }, { "areaCode": "330324", "areaName": "永嘉县" }, { "areaCode": "330326", "areaName": "平阳县" }, { "areaCode": "330327", "areaName": "苍南县" }, { "areaCode": "330328", "areaName": "文成县" }, { "areaCode": "330329", "areaName": "泰顺县" }, { "areaCode": "330381", "areaName": "瑞安市" }, { "areaCode": "330382", "areaName": "乐清市" } ] }, { "cityCode": "330400", "cityName": "嘉兴市", "mallAreaList": [ { "areaCode": "330402", "areaName": "南湖区" }, { "areaCode": "330411", "areaName": "秀洲区" }, { "areaCode": "330421", "areaName": "嘉善县" }, { "areaCode": "330424", "areaName": "海盐县" }, { "areaCode": "330481", "areaName": "海宁市" }, { "areaCode": "330482", "areaName": "平湖市" }, { "areaCode": "330483", "areaName": "桐乡市" } ] }, { "cityCode": "330500", "cityName": "湖州市", "mallAreaList": [ { "areaCode": "330502", "areaName": "吴兴区" }, { "areaCode": "330503", "areaName": "南浔区" }, { "areaCode": "330521", "areaName": "德清县" }, { "areaCode": "330522", "areaName": "长兴县" }, { "areaCode": "330523", "areaName": "安吉县" } ] }, { "cityCode": "330600", "cityName": "绍兴市", "mallAreaList": [ { "areaCode": "330602", "areaName": "越城区" }, { "areaCode": "330603", "areaName": "柯桥区" }, { "areaCode": "330604", "areaName": "上虞区" }, { "areaCode": "330624", "areaName": "新昌县" }, { "areaCode": "330681", "areaName": "诸暨市" }, { "areaCode": "330683", "areaName": "嵊州市" } ] }, { "cityCode": "330700", "cityName": "金华市", "mallAreaList": [ { "areaCode": "330702", "areaName": "婺城区" }, { "areaCode": "330703", "areaName": "金东区" }, { "areaCode": "330723", "areaName": "武义县" }, { "areaCode": "330726", "areaName": "浦江县" }, { "areaCode": "330727", "areaName": "磐安县" }, { "areaCode": "330781", "areaName": "兰溪市" }, { "areaCode": "330782", "areaName": "义乌市" }, { "areaCode": "330783", "areaName": "东阳市" }, { "areaCode": "330784", "areaName": "永康市" } ] }, { "cityCode": "330800", "cityName": "衢州市", "mallAreaList": [ { "areaCode": "330802", "areaName": "柯城区" }, { "areaCode": "330803", "areaName": "衢江区" }, { "areaCode": "330822", "areaName": "常山县" }, { "areaCode": "330824", "areaName": "开化县" }, { "areaCode": "330825", "areaName": "龙游县" }, { "areaCode": "330881", "areaName": "江山市" } ] }, { "cityCode": "330900", "cityName": "舟山市", "mallAreaList": [ { "areaCode": "330902", "areaName": "定海区" }, { "areaCode": "330903", "areaName": "普陀区" }, { "areaCode": "330921", "areaName": "岱山县" }, { "areaCode": "330922", "areaName": "嵊泗县" } ] }, { "cityCode": "331000", "cityName": "台州市", "mallAreaList": [ { "areaCode": "331002", "areaName": "椒江区" }, { "areaCode": "331003", "areaName": "黄岩区" }, { "areaCode": "331004", "areaName": "路桥区" }, { "areaCode": "331021", "areaName": "玉环县" }, { "areaCode": "331022", "areaName": "三门县" }, { "areaCode": "331023", "areaName": "天台县" }, { "areaCode": "331024", "areaName": "仙居县" }, { "areaCode": "331081", "areaName": "温岭市" }, { "areaCode": "331082", "areaName": "临海市" } ] }, { "cityCode": "331100", "cityName": "丽水市", "mallAreaList": [ { "areaCode": "331102", "areaName": "莲都区" }, { "areaCode": "331121", "areaName": "青田县" }, { "areaCode": "331122", "areaName": "缙云县" }, { "areaCode": "331123", "areaName": "遂昌县" }, { "areaCode": "331124", "areaName": "松阳县" }, { "areaCode": "331125", "areaName": "云和县" }, { "areaCode": "331126", "areaName": "庆元县" }, { "areaCode": "331127", "areaName": "景宁畲族自治县" }, { "areaCode": "331181", "areaName": "龙泉市" } ] } ] }, { "provinceCode": "340000", "provinceName": "安徽省", "mallCityList": [ { "cityCode": "340100", "cityName": "合肥市", "mallAreaList": [ { "areaCode": "340102", "areaName": "瑶海区" }, { "areaCode": "340103", "areaName": "庐阳区" }, { "areaCode": "340104", "areaName": "蜀山区" }, { "areaCode": "340111", "areaName": "包河区" }, { "areaCode": "340121", "areaName": "长丰县" }, { "areaCode": "340122", "areaName": "肥东县" }, { "areaCode": "340123", "areaName": "肥西县" }, { "areaCode": "340124", "areaName": "庐江县" }, { "areaCode": "340181", "areaName": "巢湖市" } ] }, { "cityCode": "340200", "cityName": "芜湖市", "mallAreaList": [ { "areaCode": "340202", "areaName": "镜湖区" }, { "areaCode": "340203", "areaName": "弋江区" }, { "areaCode": "340207", "areaName": "鸠江区" }, { "areaCode": "340208", "areaName": "三山区" }, { "areaCode": "340221", "areaName": "芜湖县" }, { "areaCode": "340222", "areaName": "繁昌县" }, { "areaCode": "340223", "areaName": "南陵县" }, { "areaCode": "340225", "areaName": "无为县" } ] }, { "cityCode": "340300", "cityName": "蚌埠市", "mallAreaList": [ { "areaCode": "340302", "areaName": "龙子湖区" }, { "areaCode": "340303", "areaName": "蚌山区" }, { "areaCode": "340304", "areaName": "禹会区" }, { "areaCode": "340311", "areaName": "淮上区" }, { "areaCode": "340321", "areaName": "怀远县" }, { "areaCode": "340322", "areaName": "五河县" }, { "areaCode": "340323", "areaName": "固镇县" } ] }, { "cityCode": "340400", "cityName": "淮南市", "mallAreaList": [ { "areaCode": "340402", "areaName": "大通区" }, { "areaCode": "340403", "areaName": "田家庵区" }, { "areaCode": "340404", "areaName": "谢家集区" }, { "areaCode": "340405", "areaName": "八公山区" }, { "areaCode": "340406", "areaName": "潘集区" }, { "areaCode": "340421", "areaName": "凤台县" } ] }, { "cityCode": "340500", "cityName": "马鞍山市", "mallAreaList": [ { "areaCode": "340503", "areaName": "花山区" }, { "areaCode": "340504", "areaName": "雨山区" }, { "areaCode": "340506", "areaName": "博望区" }, { "areaCode": "340521", "areaName": "当涂县" }, { "areaCode": "340522", "areaName": "含山县" }, { "areaCode": "340523", "areaName": "和县" } ] }, { "cityCode": "340600", "cityName": "淮北市", "mallAreaList": [ { "areaCode": "340602", "areaName": "杜集区" }, { "areaCode": "340603", "areaName": "相山区" }, { "areaCode": "340604", "areaName": "烈山区" }, { "areaCode": "340621", "areaName": "濉溪县" } ] }, { "cityCode": "340700", "cityName": "铜陵市", "mallAreaList": [ { "areaCode": "340702", "areaName": "铜官山区" }, { "areaCode": "340703", "areaName": "狮子山区" }, { "areaCode": "340711", "areaName": "郊区" }, { "areaCode": "340721", "areaName": "铜陵县" } ] }, { "cityCode": "340800", "cityName": "安庆市", "mallAreaList": [ { "areaCode": "340802", "areaName": "迎江区" }, { "areaCode": "340803", "areaName": "大观区" }, { "areaCode": "340811", "areaName": "宜秀区" }, { "areaCode": "340822", "areaName": "怀宁县" }, { "areaCode": "340823", "areaName": "枞阳县" }, { "areaCode": "340824", "areaName": "潜山县" }, { "areaCode": "340825", "areaName": "太湖县" }, { "areaCode": "340826", "areaName": "宿松县" }, { "areaCode": "340827", "areaName": "望江县" }, { "areaCode": "340828", "areaName": "岳西县" }, { "areaCode": "340881", "areaName": "桐城市" } ] }, { "cityCode": "341000", "cityName": "黄山市", "mallAreaList": [ { "areaCode": "341002", "areaName": "屯溪区" }, { "areaCode": "341003", "areaName": "黄山区" }, { "areaCode": "341004", "areaName": "徽州区" }, { "areaCode": "341021", "areaName": "歙县" }, { "areaCode": "341022", "areaName": "休宁县" }, { "areaCode": "341023", "areaName": "黟县" }, { "areaCode": "341024", "areaName": "祁门县" } ] }, { "cityCode": "341100", "cityName": "滁州市", "mallAreaList": [ { "areaCode": "341102", "areaName": "琅琊区" }, { "areaCode": "341103", "areaName": "南谯区" }, { "areaCode": "341122", "areaName": "来安县" }, { "areaCode": "341124", "areaName": "全椒县" }, { "areaCode": "341125", "areaName": "定远县" }, { "areaCode": "341126", "areaName": "凤阳县" }, { "areaCode": "341181", "areaName": "天长市" }, { "areaCode": "341182", "areaName": "明光市" } ] }, { "cityCode": "341200", "cityName": "阜阳市", "mallAreaList": [ { "areaCode": "341202", "areaName": "颍州区" }, { "areaCode": "341203", "areaName": "颍东区" }, { "areaCode": "341204", "areaName": "颍泉区" }, { "areaCode": "341221", "areaName": "临泉县" }, { "areaCode": "341222", "areaName": "太和县" }, { "areaCode": "341225", "areaName": "阜南县" }, { "areaCode": "341226", "areaName": "颍上县" }, { "areaCode": "341282", "areaName": "界首市" } ] }, { "cityCode": "341300", "cityName": "宿州市", "mallAreaList": [ { "areaCode": "341302", "areaName": "埇桥区" }, { "areaCode": "341321", "areaName": "砀山县" }, { "areaCode": "341322", "areaName": "萧县" }, { "areaCode": "341323", "areaName": "灵璧县" }, { "areaCode": "341324", "areaName": "泗县" } ] }, { "cityCode": "341400", "cityName": "巢湖市", "mallAreaList": [ { "areaCode": "341400", "areaName": "巢湖市区" } ] }, { "cityCode": "341500", "cityName": "六安市", "mallAreaList": [ { "areaCode": "341502", "areaName": "金安区" }, { "areaCode": "341503", "areaName": "裕安区" }, { "areaCode": "341521", "areaName": "寿县" }, { "areaCode": "341522", "areaName": "霍邱县" }, { "areaCode": "341523", "areaName": "舒城县" }, { "areaCode": "341524", "areaName": "金寨县" }, { "areaCode": "341525", "areaName": "霍山县" } ] }, { "cityCode": "341600", "cityName": "亳州市", "mallAreaList": [ { "areaCode": "341602", "areaName": "谯城区" }, { "areaCode": "341621", "areaName": "涡阳县" }, { "areaCode": "341622", "areaName": "蒙城县" }, { "areaCode": "341623", "areaName": "利辛县" } ] }, { "cityCode": "341700", "cityName": "池州市", "mallAreaList": [ { "areaCode": "341702", "areaName": "贵池区" }, { "areaCode": "341721", "areaName": "东至县" }, { "areaCode": "341722", "areaName": "石台县" }, { "areaCode": "341723", "areaName": "青阳县" } ] }, { "cityCode": "341800", "cityName": "宣城市", "mallAreaList": [ { "areaCode": "341802", "areaName": "宣州区" }, { "areaCode": "341821", "areaName": "郎溪县" }, { "areaCode": "341822", "areaName": "广德县" }, { "areaCode": "341823", "areaName": "泾县" }, { "areaCode": "341824", "areaName": "绩溪县" }, { "areaCode": "341825", "areaName": "旌德县" }, { "areaCode": "341881", "areaName": "宁国市" } ] } ] }, { "provinceCode": "350000", "provinceName": "福建省", "mallCityList": [ { "cityCode": "350100", "cityName": "福州市", "mallAreaList": [ { "areaCode": "350102", "areaName": "鼓楼区" }, { "areaCode": "350103", "areaName": "台江区" }, { "areaCode": "350104", "areaName": "仓山区" }, { "areaCode": "350105", "areaName": "马尾区" }, { "areaCode": "350111", "areaName": "晋安区" }, { "areaCode": "350121", "areaName": "闽侯县" }, { "areaCode": "350122", "areaName": "连江县" }, { "areaCode": "350123", "areaName": "罗源县" }, { "areaCode": "350124", "areaName": "闽清县" }, { "areaCode": "350125", "areaName": "永泰县" }, { "areaCode": "350128", "areaName": "平潭县" }, { "areaCode": "350181", "areaName": "福清市" }, { "areaCode": "350182", "areaName": "长乐市" } ] }, { "cityCode": "350200", "cityName": "厦门市", "mallAreaList": [ { "areaCode": "350203", "areaName": "思明区" }, { "areaCode": "350205", "areaName": "海沧区" }, { "areaCode": "350206", "areaName": "湖里区" }, { "areaCode": "350211", "areaName": "集美区" }, { "areaCode": "350212", "areaName": "同安区" }, { "areaCode": "350213", "areaName": "翔安区" } ] }, { "cityCode": "350300", "cityName": "莆田市", "mallAreaList": [ { "areaCode": "350302", "areaName": "城厢区" }, { "areaCode": "350303", "areaName": "涵江区" }, { "areaCode": "350304", "areaName": "荔城区" }, { "areaCode": "350305", "areaName": "秀屿区" }, { "areaCode": "350322", "areaName": "仙游县" } ] }, { "cityCode": "350400", "cityName": "三明市", "mallAreaList": [ { "areaCode": "350402", "areaName": "梅列区" }, { "areaCode": "350403", "areaName": "三元区" }, { "areaCode": "350421", "areaName": "明溪县" }, { "areaCode": "350423", "areaName": "清流县" }, { "areaCode": "350424", "areaName": "宁化县" }, { "areaCode": "350425", "areaName": "大田县" }, { "areaCode": "350426", "areaName": "尤溪县" }, { "areaCode": "350427", "areaName": "沙县" }, { "areaCode": "350428", "areaName": "将乐县" }, { "areaCode": "350429", "areaName": "泰宁县" }, { "areaCode": "350430", "areaName": "建宁县" }, { "areaCode": "350481", "areaName": "永安市" } ] }, { "cityCode": "350500", "cityName": "泉州市", "mallAreaList": [ { "areaCode": "350502", "areaName": "鲤城区" }, { "areaCode": "350503", "areaName": "丰泽区" }, { "areaCode": "350504", "areaName": "洛江区" }, { "areaCode": "350505", "areaName": "泉港区" }, { "areaCode": "350521", "areaName": "惠安县" }, { "areaCode": "350524", "areaName": "安溪县" }, { "areaCode": "350525", "areaName": "永春县" }, { "areaCode": "350526", "areaName": "德化县" }, { "areaCode": "350527", "areaName": "金门县" }, { "areaCode": "350581", "areaName": "石狮市" }, { "areaCode": "350582", "areaName": "晋江市" }, { "areaCode": "350583", "areaName": "南安市" } ] }, { "cityCode": "350600", "cityName": "漳州市", "mallAreaList": [ { "areaCode": "350602", "areaName": "芗城区" }, { "areaCode": "350603", "areaName": "龙文区" }, { "areaCode": "350622", "areaName": "云霄县" }, { "areaCode": "350623", "areaName": "漳浦县" }, { "areaCode": "350624", "areaName": "诏安县" }, { "areaCode": "350625", "areaName": "长泰县" }, { "areaCode": "350626", "areaName": "东山县" }, { "areaCode": "350627", "areaName": "南靖县" }, { "areaCode": "350628", "areaName": "平和县" }, { "areaCode": "350629", "areaName": "华安县" }, { "areaCode": "350681", "areaName": "龙海市" } ] }, { "cityCode": "350700", "cityName": "南平市", "mallAreaList": [ { "areaCode": "350702", "areaName": "延平区" }, { "areaCode": "350721", "areaName": "顺昌县" }, { "areaCode": "350722", "areaName": "浦城县" }, { "areaCode": "350723", "areaName": "光泽县" }, { "areaCode": "350724", "areaName": "松溪县" }, { "areaCode": "350725", "areaName": "政和县" }, { "areaCode": "350781", "areaName": "邵武市" }, { "areaCode": "350782", "areaName": "武夷山市" }, { "areaCode": "350783", "areaName": "建瓯市" }, { "areaCode": "350784", "areaName": "建阳市" } ] }, { "cityCode": "350800", "cityName": "龙岩市", "mallAreaList": [ { "areaCode": "350802", "areaName": "新罗区" }, { "areaCode": "350821", "areaName": "长汀县" }, { "areaCode": "350822", "areaName": "永定县" }, { "areaCode": "350823", "areaName": "上杭县" }, { "areaCode": "350824", "areaName": "武平县" }, { "areaCode": "350825", "areaName": "连城县" }, { "areaCode": "350881", "areaName": "漳平市" } ] }, { "cityCode": "350900", "cityName": "宁德市", "mallAreaList": [ { "areaCode": "350902", "areaName": "蕉城区" }, { "areaCode": "350921", "areaName": "霞浦县" }, { "areaCode": "350922", "areaName": "古田县" }, { "areaCode": "350923", "areaName": "屏南县" }, { "areaCode": "350924", "areaName": "寿宁县" }, { "areaCode": "350925", "areaName": "周宁县" }, { "areaCode": "350926", "areaName": "柘荣县" }, { "areaCode": "350981", "areaName": "福安市" }, { "areaCode": "350982", "areaName": "福鼎市" } ] } ] }, { "provinceCode": "360000", "provinceName": "江西省", "mallCityList": [ { "cityCode": "360100", "cityName": "南昌市", "mallAreaList": [ { "areaCode": "360102", "areaName": "东湖区" }, { "areaCode": "360103", "areaName": "西湖区" }, { "areaCode": "360104", "areaName": "青云谱区" }, { "areaCode": "360105", "areaName": "湾里区" }, { "areaCode": "360111", "areaName": "青山湖区" }, { "areaCode": "360121", "areaName": "南昌县" }, { "areaCode": "360122", "areaName": "新建县" }, { "areaCode": "360123", "areaName": "安义县" }, { "areaCode": "360124", "areaName": "进贤县" } ] }, { "cityCode": "360200", "cityName": "景德镇市", "mallAreaList": [ { "areaCode": "360202", "areaName": "昌江区" }, { "areaCode": "360203", "areaName": "珠山区" }, { "areaCode": "360222", "areaName": "浮梁县" }, { "areaCode": "360281", "areaName": "乐平市" } ] }, { "cityCode": "360300", "cityName": "萍乡市", "mallAreaList": [ { "areaCode": "360302", "areaName": "安源区" }, { "areaCode": "360313", "areaName": "湘东区" }, { "areaCode": "360321", "areaName": "莲花县" }, { "areaCode": "360322", "areaName": "上栗县" }, { "areaCode": "360323", "areaName": "芦溪县" } ] }, { "cityCode": "360400", "cityName": "九江市", "mallAreaList": [ { "areaCode": "360402", "areaName": "庐山区" }, { "areaCode": "360403", "areaName": "浔阳区" }, { "areaCode": "360421", "areaName": "九江县" }, { "areaCode": "360423", "areaName": "武宁县" }, { "areaCode": "360424", "areaName": "修水县" }, { "areaCode": "360425", "areaName": "永修县" }, { "areaCode": "360426", "areaName": "德安县" }, { "areaCode": "360427", "areaName": "星子县" }, { "areaCode": "360428", "areaName": "都昌县" }, { "areaCode": "360429", "areaName": "湖口县" }, { "areaCode": "360430", "areaName": "彭泽县" }, { "areaCode": "360481", "areaName": "瑞昌市" }, { "areaCode": "360482", "areaName": "共青城市" } ] }, { "cityCode": "360500", "cityName": "新余市", "mallAreaList": [ { "areaCode": "360502", "areaName": "渝水区" }, { "areaCode": "360521", "areaName": "分宜县" } ] }, { "cityCode": "360600", "cityName": "鹰潭市", "mallAreaList": [ { "areaCode": "360602", "areaName": "月湖区" }, { "areaCode": "360622", "areaName": "余江县" }, { "areaCode": "360681", "areaName": "贵溪市" } ] }, { "cityCode": "360700", "cityName": "赣州市", "mallAreaList": [ { "areaCode": "360702", "areaName": "章贡区" }, { "areaCode": "360703", "areaName": "南康区" }, { "areaCode": "360721", "areaName": "赣县" }, { "areaCode": "360722", "areaName": "信丰县" }, { "areaCode": "360723", "areaName": "大余县" }, { "areaCode": "360724", "areaName": "上犹县" }, { "areaCode": "360725", "areaName": "崇义县" }, { "areaCode": "360726", "areaName": "安远县" }, { "areaCode": "360727", "areaName": "龙南县" }, { "areaCode": "360728", "areaName": "定南县" }, { "areaCode": "360729", "areaName": "全南县" }, { "areaCode": "360730", "areaName": "宁都县" }, { "areaCode": "360731", "areaName": "于都县" }, { "areaCode": "360732", "areaName": "兴国县" }, { "areaCode": "360733", "areaName": "会昌县" }, { "areaCode": "360734", "areaName": "寻乌县" }, { "areaCode": "360735", "areaName": "石城县" }, { "areaCode": "360781", "areaName": "瑞金市" } ] }, { "cityCode": "360800", "cityName": "吉安市", "mallAreaList": [ { "areaCode": "360802", "areaName": "吉州区" }, { "areaCode": "360803", "areaName": "青原区" }, { "areaCode": "360821", "areaName": "吉安县" }, { "areaCode": "360822", "areaName": "吉水县" }, { "areaCode": "360823", "areaName": "峡江县" }, { "areaCode": "360824", "areaName": "新干县" }, { "areaCode": "360825", "areaName": "永丰县" }, { "areaCode": "360826", "areaName": "泰和县" }, { "areaCode": "360827", "areaName": "遂川县" }, { "areaCode": "360828", "areaName": "万安县" }, { "areaCode": "360829", "areaName": "安福县" }, { "areaCode": "360830", "areaName": "永新县" }, { "areaCode": "360881", "areaName": "井冈山市" } ] }, { "cityCode": "360900", "cityName": "宜春市", "mallAreaList": [ { "areaCode": "360902", "areaName": "袁州区" }, { "areaCode": "360921", "areaName": "奉新县" }, { "areaCode": "360922", "areaName": "万载县" }, { "areaCode": "360923", "areaName": "上高县" }, { "areaCode": "360924", "areaName": "宜丰县" }, { "areaCode": "360925", "areaName": "靖安县" }, { "areaCode": "360926", "areaName": "铜鼓县" }, { "areaCode": "360981", "areaName": "丰城市" }, { "areaCode": "360982", "areaName": "樟树市" }, { "areaCode": "360983", "areaName": "高安市" } ] }, { "cityCode": "361000", "cityName": "抚州市", "mallAreaList": [ { "areaCode": "361002", "areaName": "临川区" }, { "areaCode": "361021", "areaName": "南城县" }, { "areaCode": "361022", "areaName": "黎川县" }, { "areaCode": "361023", "areaName": "南丰县" }, { "areaCode": "361024", "areaName": "崇仁县" }, { "areaCode": "361025", "areaName": "乐安县" }, { "areaCode": "361026", "areaName": "宜黄县" }, { "areaCode": "361027", "areaName": "金溪县" }, { "areaCode": "361028", "areaName": "资溪县" }, { "areaCode": "361029", "areaName": "东乡县" }, { "areaCode": "361030", "areaName": "广昌县" } ] }, { "cityCode": "361100", "cityName": "上饶市", "mallAreaList": [ { "areaCode": "361102", "areaName": "信州区" }, { "areaCode": "361121", "areaName": "上饶县" }, { "areaCode": "361122", "areaName": "广丰县" }, { "areaCode": "361123", "areaName": "玉山县" }, { "areaCode": "361124", "areaName": "铅山县" }, { "areaCode": "361125", "areaName": "横峰县" }, { "areaCode": "361126", "areaName": "弋阳县" }, { "areaCode": "361127", "areaName": "余干县" }, { "areaCode": "361128", "areaName": "鄱阳县" }, { "areaCode": "361129", "areaName": "万年县" }, { "areaCode": "361130", "areaName": "婺源县" }, { "areaCode": "361181", "areaName": "德兴市" } ] } ] }, { "provinceCode": "370000", "provinceName": "山东省", "mallCityList": [ { "cityCode": "370100", "cityName": "济南市", "mallAreaList": [ { "areaCode": "370102", "areaName": "历下区" }, { "areaCode": "370103", "areaName": "市中区" }, { "areaCode": "370104", "areaName": "槐荫区" }, { "areaCode": "370105", "areaName": "天桥区" }, { "areaCode": "370112", "areaName": "历城区" }, { "areaCode": "370113", "areaName": "长清区" }, { "areaCode": "370124", "areaName": "平阴县" }, { "areaCode": "370125", "areaName": "济阳县" }, { "areaCode": "370126", "areaName": "商河县" }, { "areaCode": "370181", "areaName": "章丘市" } ] }, { "cityCode": "370200", "cityName": "青岛市", "mallAreaList": [ { "areaCode": "370202", "areaName": "市南区" }, { "areaCode": "370203", "areaName": "市北区" }, { "areaCode": "370211", "areaName": "黄岛区" }, { "areaCode": "370212", "areaName": "崂山区" }, { "areaCode": "370213", "areaName": "李沧区" }, { "areaCode": "370214", "areaName": "城阳区" }, { "areaCode": "370281", "areaName": "胶州市" }, { "areaCode": "370282", "areaName": "即墨市" }, { "areaCode": "370283", "areaName": "平度市" }, { "areaCode": "370285", "areaName": "莱西市" } ] }, { "cityCode": "370300", "cityName": "淄博市", "mallAreaList": [ { "areaCode": "370302", "areaName": "淄川区" }, { "areaCode": "370303", "areaName": "张店区" }, { "areaCode": "370304", "areaName": "博山区" }, { "areaCode": "370305", "areaName": "临淄区" }, { "areaCode": "370306", "areaName": "周村区" }, { "areaCode": "370321", "areaName": "桓台县" }, { "areaCode": "370322", "areaName": "高青县" }, { "areaCode": "370323", "areaName": "沂源县" } ] }, { "cityCode": "370400", "cityName": "枣庄市", "mallAreaList": [ { "areaCode": "370402", "areaName": "市中区" }, { "areaCode": "370403", "areaName": "薛城区" }, { "areaCode": "370404", "areaName": "峄城区" }, { "areaCode": "370405", "areaName": "台儿庄区" }, { "areaCode": "370406", "areaName": "山亭区" }, { "areaCode": "370481", "areaName": "滕州市" } ] }, { "cityCode": "370500", "cityName": "东营市", "mallAreaList": [ { "areaCode": "370502", "areaName": "东营区" }, { "areaCode": "370503", "areaName": "河口区" }, { "areaCode": "370521", "areaName": "垦利县" }, { "areaCode": "370522", "areaName": "利津县" }, { "areaCode": "370523", "areaName": "广饶县" } ] }, { "cityCode": "370600", "cityName": "烟台市", "mallAreaList": [ { "areaCode": "370602", "areaName": "芝罘区" }, { "areaCode": "370611", "areaName": "福山区" }, { "areaCode": "370612", "areaName": "牟平区" }, { "areaCode": "370613", "areaName": "莱山区" }, { "areaCode": "370634", "areaName": "长岛县" }, { "areaCode": "370681", "areaName": "龙口市" }, { "areaCode": "370682", "areaName": "莱阳市" }, { "areaCode": "370683", "areaName": "莱州市" }, { "areaCode": "370684", "areaName": "蓬莱市" }, { "areaCode": "370685", "areaName": "招远市" }, { "areaCode": "370686", "areaName": "栖霞市" }, { "areaCode": "370687", "areaName": "海阳市" } ] }, { "cityCode": "370700", "cityName": "潍坊市", "mallAreaList": [ { "areaCode": "370702", "areaName": "潍城区" }, { "areaCode": "370703", "areaName": "寒亭区" }, { "areaCode": "370704", "areaName": "坊子区" }, { "areaCode": "370705", "areaName": "奎文区" }, { "areaCode": "370724", "areaName": "临朐县" }, { "areaCode": "370725", "areaName": "昌乐县" }, { "areaCode": "370781", "areaName": "青州市" }, { "areaCode": "370782", "areaName": "诸城市" }, { "areaCode": "370783", "areaName": "寿光市" }, { "areaCode": "370784", "areaName": "安丘市" }, { "areaCode": "370785", "areaName": "高密市" }, { "areaCode": "370786", "areaName": "昌邑市" } ] }, { "cityCode": "370800", "cityName": "济宁市", "mallAreaList": [ { "areaCode": "370802", "areaName": "市中区" }, { "areaCode": "370811", "areaName": "任城区" }, { "areaCode": "370812", "areaName": "兖州区" }, { "areaCode": "370826", "areaName": "微山县" }, { "areaCode": "370827", "areaName": "鱼台县" }, { "areaCode": "370828", "areaName": "金乡县" }, { "areaCode": "370829", "areaName": "嘉祥县" }, { "areaCode": "370830", "areaName": "汶上县" }, { "areaCode": "370831", "areaName": "泗水县" }, { "areaCode": "370832", "areaName": "梁山县" }, { "areaCode": "370881", "areaName": "曲阜市" }, { "areaCode": "370883", "areaName": "邹城市" } ] }, { "cityCode": "370900", "cityName": "泰安市", "mallAreaList": [ { "areaCode": "370902", "areaName": "泰山区" }, { "areaCode": "370911", "areaName": "岱岳区" }, { "areaCode": "370921", "areaName": "宁阳县" }, { "areaCode": "370923", "areaName": "东平县" }, { "areaCode": "370982", "areaName": "新泰市" }, { "areaCode": "370983", "areaName": "肥城市" } ] }, { "cityCode": "371000", "cityName": "威海市", "mallAreaList": [ { "areaCode": "371002", "areaName": "环翠区" }, { "areaCode": "371003", "areaName": "文登区" }, { "areaCode": "371082", "areaName": "荣成市" }, { "areaCode": "371083", "areaName": "乳山市" } ] }, { "cityCode": "371100", "cityName": "日照市", "mallAreaList": [ { "areaCode": "371102", "areaName": "东港区" }, { "areaCode": "371103", "areaName": "岚山区" }, { "areaCode": "371121", "areaName": "五莲县" }, { "areaCode": "371122", "areaName": "莒县" } ] }, { "cityCode": "371200", "cityName": "莱芜市", "mallAreaList": [ { "areaCode": "371202", "areaName": "莱城区" }, { "areaCode": "371203", "areaName": "钢城区" } ] }, { "cityCode": "371300", "cityName": "临沂市", "mallAreaList": [ { "areaCode": "371302", "areaName": "兰山区" }, { "areaCode": "371311", "areaName": "罗庄区" }, { "areaCode": "371312", "areaName": "河东区" }, { "areaCode": "371321", "areaName": "沂南县" }, { "areaCode": "371322", "areaName": "郯城县" }, { "areaCode": "371323", "areaName": "沂水县" }, { "areaCode": "371324", "areaName": "兰陵县" }, { "areaCode": "371325", "areaName": "费县" }, { "areaCode": "371326", "areaName": "平邑县" }, { "areaCode": "371327", "areaName": "莒南县" }, { "areaCode": "371328", "areaName": "蒙阴县" }, { "areaCode": "371329", "areaName": "临沭县" } ] }, { "cityCode": "371400", "cityName": "德州市", "mallAreaList": [ { "areaCode": "371402", "areaName": "德城区" }, { "areaCode": "371403", "areaName": "陵城区" }, { "areaCode": "371422", "areaName": "宁津县" }, { "areaCode": "371423", "areaName": "庆云县" }, { "areaCode": "371424", "areaName": "临邑县" }, { "areaCode": "371425", "areaName": "齐河县" }, { "areaCode": "371426", "areaName": "平原县" }, { "areaCode": "371427", "areaName": "夏津县" }, { "areaCode": "371428", "areaName": "武城县" }, { "areaCode": "371481", "areaName": "乐陵市" }, { "areaCode": "371482", "areaName": "禹城市" } ] }, { "cityCode": "371500", "cityName": "聊城市", "mallAreaList": [ { "areaCode": "371502", "areaName": "东昌府区" }, { "areaCode": "371521", "areaName": "阳谷县" }, { "areaCode": "371522", "areaName": "莘县" }, { "areaCode": "371523", "areaName": "茌平县" }, { "areaCode": "371524", "areaName": "东阿县" }, { "areaCode": "371525", "areaName": "冠县" }, { "areaCode": "371526", "areaName": "高唐县" }, { "areaCode": "371581", "areaName": "临清市" } ] }, { "cityCode": "371600", "cityName": "滨州市", "mallAreaList": [ { "areaCode": "371602", "areaName": "滨城区" }, { "areaCode": "371603", "areaName": "沾化区" }, { "areaCode": "371621", "areaName": "惠民县" }, { "areaCode": "371622", "areaName": "阳信县" }, { "areaCode": "371623", "areaName": "无棣县" }, { "areaCode": "371625", "areaName": "博兴县" }, { "areaCode": "371626", "areaName": "邹平县" } ] }, { "cityCode": "371700", "cityName": "菏泽市", "mallAreaList": [ { "areaCode": "371702", "areaName": "牡丹区" }, { "areaCode": "371721", "areaName": "曹县" }, { "areaCode": "371722", "areaName": "单县" }, { "areaCode": "371723", "areaName": "成武县" }, { "areaCode": "371724", "areaName": "巨野县" }, { "areaCode": "371725", "areaName": "郓城县" }, { "areaCode": "371726", "areaName": "鄄城县" }, { "areaCode": "371727", "areaName": "定陶县" }, { "areaCode": "371728", "areaName": "东明县" } ] } ] }, { "provinceCode": "410000", "provinceName": "河南省", "mallCityList": [ { "cityCode": "410100", "cityName": "郑州市", "mallAreaList": [ { "areaCode": "410102", "areaName": "中原区" }, { "areaCode": "410103", "areaName": "二七区" }, { "areaCode": "410104", "areaName": "管城回族区" }, { "areaCode": "410105", "areaName": "金水区" }, { "areaCode": "410106", "areaName": "上街区" }, { "areaCode": "410108", "areaName": "惠济区" }, { "areaCode": "410122", "areaName": "中牟县" }, { "areaCode": "410181", "areaName": "巩义市" }, { "areaCode": "410182", "areaName": "荥阳市" }, { "areaCode": "410183", "areaName": "新密市" }, { "areaCode": "410184", "areaName": "新郑市" }, { "areaCode": "410185", "areaName": "登封市" } ] }, { "cityCode": "410200", "cityName": "开封市", "mallAreaList": [ { "areaCode": "410202", "areaName": "龙亭区" }, { "areaCode": "410203", "areaName": "顺河回族区" }, { "areaCode": "410204", "areaName": "鼓楼区" }, { "areaCode": "410205", "areaName": "禹王台区" }, { "areaCode": "410211", "areaName": "金明区" }, { "areaCode": "410221", "areaName": "杞县" }, { "areaCode": "410222", "areaName": "通许县" }, { "areaCode": "410223", "areaName": "尉氏县" }, { "areaCode": "410224", "areaName": "开封县" }, { "areaCode": "410225", "areaName": "兰考县" } ] }, { "cityCode": "410300", "cityName": "洛阳市", "mallAreaList": [ { "areaCode": "410302", "areaName": "老城区" }, { "areaCode": "410303", "areaName": "西工区" }, { "areaCode": "410304", "areaName": "瀍河回族区" }, { "areaCode": "410305", "areaName": "涧西区" }, { "areaCode": "410306", "areaName": "吉利区" }, { "areaCode": "410311", "areaName": "洛龙区" }, { "areaCode": "410322", "areaName": "孟津县" }, { "areaCode": "410323", "areaName": "新安县" }, { "areaCode": "410324", "areaName": "栾川县" }, { "areaCode": "410325", "areaName": "嵩县" }, { "areaCode": "410326", "areaName": "汝阳县" }, { "areaCode": "410327", "areaName": "宜阳县" }, { "areaCode": "410328", "areaName": "洛宁县" }, { "areaCode": "410329", "areaName": "伊川县" }, { "areaCode": "410381", "areaName": "偃师市" } ] }, { "cityCode": "410400", "cityName": "平顶山市", "mallAreaList": [ { "areaCode": "410402", "areaName": "新华区" }, { "areaCode": "410403", "areaName": "卫东区" }, { "areaCode": "410404", "areaName": "石龙区" }, { "areaCode": "410411", "areaName": "湛河区" }, { "areaCode": "410421", "areaName": "宝丰县" }, { "areaCode": "410422", "areaName": "叶县" }, { "areaCode": "410423", "areaName": "鲁山县" }, { "areaCode": "410425", "areaName": "郏县" }, { "areaCode": "410481", "areaName": "舞钢市" }, { "areaCode": "410482", "areaName": "汝州市" } ] }, { "cityCode": "410500", "cityName": "安阳市", "mallAreaList": [ { "areaCode": "410502", "areaName": "文峰区" }, { "areaCode": "410503", "areaName": "北关区" }, { "areaCode": "410505", "areaName": "殷都区" }, { "areaCode": "410506", "areaName": "龙安区" }, { "areaCode": "410522", "areaName": "安阳县" }, { "areaCode": "410523", "areaName": "汤阴县" }, { "areaCode": "410526", "areaName": "滑县" }, { "areaCode": "410527", "areaName": "内黄县" }, { "areaCode": "410581", "areaName": "林州市" } ] }, { "cityCode": "410600", "cityName": "鹤壁市", "mallAreaList": [ { "areaCode": "410602", "areaName": "鹤山区" }, { "areaCode": "410603", "areaName": "山城区" }, { "areaCode": "410611", "areaName": "淇滨区" }, { "areaCode": "410621", "areaName": "浚县" }, { "areaCode": "410622", "areaName": "淇县" } ] }, { "cityCode": "410700", "cityName": "新乡市", "mallAreaList": [ { "areaCode": "410702", "areaName": "红旗区" }, { "areaCode": "410703", "areaName": "卫滨区" }, { "areaCode": "410704", "areaName": "凤泉区" }, { "areaCode": "410711", "areaName": "牧野区" }, { "areaCode": "410721", "areaName": "新乡县" }, { "areaCode": "410724", "areaName": "获嘉县" }, { "areaCode": "410725", "areaName": "原阳县" }, { "areaCode": "410726", "areaName": "延津县" }, { "areaCode": "410727", "areaName": "封丘县" }, { "areaCode": "410728", "areaName": "长垣县" }, { "areaCode": "410781", "areaName": "卫辉市" }, { "areaCode": "410782", "areaName": "辉县市" } ] }, { "cityCode": "410800", "cityName": "焦作市", "mallAreaList": [ { "areaCode": "410802", "areaName": "解放区" }, { "areaCode": "410803", "areaName": "中站区" }, { "areaCode": "410804", "areaName": "马村区" }, { "areaCode": "410811", "areaName": "山阳区" }, { "areaCode": "410821", "areaName": "修武县" }, { "areaCode": "410822", "areaName": "博爱县" }, { "areaCode": "410823", "areaName": "武陟县" }, { "areaCode": "410825", "areaName": "温县" }, { "areaCode": "410882", "areaName": "沁阳市" }, { "areaCode": "410883", "areaName": "孟州市" } ] }, { "cityCode": "410900", "cityName": "濮阳市", "mallAreaList": [ { "areaCode": "410902", "areaName": "华龙区" }, { "areaCode": "410922", "areaName": "清丰县" }, { "areaCode": "410923", "areaName": "南乐县" }, { "areaCode": "410926", "areaName": "范县" }, { "areaCode": "410927", "areaName": "台前县" }, { "areaCode": "410928", "areaName": "濮阳县" } ] }, { "cityCode": "411000", "cityName": "许昌市", "mallAreaList": [ { "areaCode": "411002", "areaName": "魏都区" }, { "areaCode": "411023", "areaName": "许昌县" }, { "areaCode": "411024", "areaName": "鄢陵县" }, { "areaCode": "411025", "areaName": "襄城县" }, { "areaCode": "411081", "areaName": "禹州市" }, { "areaCode": "411082", "areaName": "长葛市" } ] }, { "cityCode": "411100", "cityName": "漯河市", "mallAreaList": [ { "areaCode": "411102", "areaName": "源汇区" }, { "areaCode": "411103", "areaName": "郾城区" }, { "areaCode": "411104", "areaName": "召陵区" }, { "areaCode": "411121", "areaName": "舞阳县" }, { "areaCode": "411122", "areaName": "临颍县" } ] }, { "cityCode": "411200", "cityName": "三门峡市", "mallAreaList": [ { "areaCode": "411202", "areaName": "湖滨区" }, { "areaCode": "411221", "areaName": "渑池县" }, { "areaCode": "411222", "areaName": "陕县" }, { "areaCode": "411224", "areaName": "卢氏县" }, { "areaCode": "411281", "areaName": "义马市" }, { "areaCode": "411282", "areaName": "灵宝市" } ] }, { "cityCode": "411300", "cityName": "南阳市", "mallAreaList": [ { "areaCode": "411302", "areaName": "宛城区" }, { "areaCode": "411303", "areaName": "卧龙区" }, { "areaCode": "411321", "areaName": "南召县" }, { "areaCode": "411322", "areaName": "方城县" }, { "areaCode": "411323", "areaName": "西峡县" }, { "areaCode": "411324", "areaName": "镇平县" }, { "areaCode": "411325", "areaName": "内乡县" }, { "areaCode": "411326", "areaName": "淅川县" }, { "areaCode": "411327", "areaName": "社旗县" }, { "areaCode": "411328", "areaName": "唐河县" }, { "areaCode": "411329", "areaName": "新野县" }, { "areaCode": "411330", "areaName": "桐柏县" }, { "areaCode": "411381", "areaName": "邓州市" } ] }, { "cityCode": "411400", "cityName": "商丘市", "mallAreaList": [ { "areaCode": "411402", "areaName": "梁园区" }, { "areaCode": "411403", "areaName": "睢阳区" }, { "areaCode": "411421", "areaName": "民权县" }, { "areaCode": "411422", "areaName": "睢县" }, { "areaCode": "411423", "areaName": "宁陵县" }, { "areaCode": "411424", "areaName": "柘城县" }, { "areaCode": "411425", "areaName": "虞城县" }, { "areaCode": "411426", "areaName": "夏邑县" }, { "areaCode": "411481", "areaName": "永城市" } ] }, { "cityCode": "411500", "cityName": "信阳市", "mallAreaList": [ { "areaCode": "411502", "areaName": "浉河区" }, { "areaCode": "411503", "areaName": "平桥区" }, { "areaCode": "411521", "areaName": "罗山县" }, { "areaCode": "411522", "areaName": "光山县" }, { "areaCode": "411523", "areaName": "新县" }, { "areaCode": "411524", "areaName": "商城县" }, { "areaCode": "411525", "areaName": "固始县" }, { "areaCode": "411526", "areaName": "潢川县" }, { "areaCode": "411527", "areaName": "淮滨县" }, { "areaCode": "411528", "areaName": "息县" } ] }, { "cityCode": "411600", "cityName": "周口市", "mallAreaList": [ { "areaCode": "411602", "areaName": "川汇区" }, { "areaCode": "411621", "areaName": "扶沟县" }, { "areaCode": "411622", "areaName": "西华县" }, { "areaCode": "411623", "areaName": "商水县" }, { "areaCode": "411624", "areaName": "沈丘县" }, { "areaCode": "411625", "areaName": "郸城县" }, { "areaCode": "411626", "areaName": "淮阳县" }, { "areaCode": "411627", "areaName": "太康县" }, { "areaCode": "411628", "areaName": "鹿邑县" }, { "areaCode": "411681", "areaName": "项城市" } ] }, { "cityCode": "411700", "cityName": "驻马店市", "mallAreaList": [ { "areaCode": "411702", "areaName": "驿城区" }, { "areaCode": "411721", "areaName": "西平县" }, { "areaCode": "411722", "areaName": "上蔡县" }, { "areaCode": "411723", "areaName": "平舆县" }, { "areaCode": "411724", "areaName": "正阳县" }, { "areaCode": "411725", "areaName": "确山县" }, { "areaCode": "411726", "areaName": "泌阳县" }, { "areaCode": "411727", "areaName": "汝南县" }, { "areaCode": "411728", "areaName": "遂平县" }, { "areaCode": "411729", "areaName": "新蔡县" } ] }, { "cityCode": "419000", "cityName": "河南省直辖县级行政区划", "mallAreaList": [ { "areaCode": "419001", "areaName": "济源市" } ] } ] }, { "provinceCode": "420000", "provinceName": "湖北省", "mallCityList": [ { "cityCode": "420100", "cityName": "武汉市", "mallAreaList": [ { "areaCode": "420102", "areaName": "江岸区" }, { "areaCode": "420103", "areaName": "江汉区" }, { "areaCode": "420104", "areaName": "硚口区" }, { "areaCode": "420105", "areaName": "汉阳区" }, { "areaCode": "420106", "areaName": "武昌区" }, { "areaCode": "420107", "areaName": "青山区" }, { "areaCode": "420111", "areaName": "洪山区" }, { "areaCode": "420112", "areaName": "东西湖区" }, { "areaCode": "420113", "areaName": "汉南区" }, { "areaCode": "420114", "areaName": "蔡甸区" }, { "areaCode": "420115", "areaName": "江夏区" }, { "areaCode": "420116", "areaName": "黄陂区" }, { "areaCode": "420117", "areaName": "新洲区" } ] }, { "cityCode": "420200", "cityName": "黄石市", "mallAreaList": [ { "areaCode": "420202", "areaName": "黄石港区" }, { "areaCode": "420203", "areaName": "西塞山区" }, { "areaCode": "420204", "areaName": "下陆区" }, { "areaCode": "420205", "areaName": "铁山区" }, { "areaCode": "420222", "areaName": "阳新县" }, { "areaCode": "420281", "areaName": "大冶市" } ] }, { "cityCode": "420300", "cityName": "十堰市", "mallAreaList": [ { "areaCode": "420302", "areaName": "茅箭区" }, { "areaCode": "420303", "areaName": "张湾区" }, { "areaCode": "420304", "areaName": "郧阳区" }, { "areaCode": "420322", "areaName": "郧西县" }, { "areaCode": "420323", "areaName": "竹山县" }, { "areaCode": "420324", "areaName": "竹溪县" }, { "areaCode": "420325", "areaName": "房县" }, { "areaCode": "420381", "areaName": "丹江口市" } ] }, { "cityCode": "420500", "cityName": "宜昌市", "mallAreaList": [ { "areaCode": "420502", "areaName": "西陵区" }, { "areaCode": "420503", "areaName": "伍家岗区" }, { "areaCode": "420504", "areaName": "点军区" }, { "areaCode": "420505", "areaName": "猇亭区" }, { "areaCode": "420506", "areaName": "夷陵区" }, { "areaCode": "420525", "areaName": "远安县" }, { "areaCode": "420526", "areaName": "兴山县" }, { "areaCode": "420527", "areaName": "秭归县" }, { "areaCode": "420528", "areaName": "长阳土家族自治县" }, { "areaCode": "420529", "areaName": "五峰土家族自治县" }, { "areaCode": "420581", "areaName": "宜都市" }, { "areaCode": "420582", "areaName": "当阳市" }, { "areaCode": "420583", "areaName": "枝江市" } ] }, { "cityCode": "420600", "cityName": "襄樊市", "mallAreaList": [ { "areaCode": "420602", "areaName": "襄城区" }, { "areaCode": "420606", "areaName": "樊城区" }, { "areaCode": "420607", "areaName": "襄州区" }, { "areaCode": "420624", "areaName": "南漳县" }, { "areaCode": "420625", "areaName": "谷城县" }, { "areaCode": "420626", "areaName": "保康县" }, { "areaCode": "420682", "areaName": "老河口市" }, { "areaCode": "420683", "areaName": "枣阳市" }, { "areaCode": "420684", "areaName": "宜城市" } ] }, { "cityCode": "420700", "cityName": "鄂州市", "mallAreaList": [ { "areaCode": "420702", "areaName": "梁子湖区" }, { "areaCode": "420703", "areaName": "华容区" }, { "areaCode": "420704", "areaName": "鄂城区" } ] }, { "cityCode": "420800", "cityName": "荆门市", "mallAreaList": [ { "areaCode": "420802", "areaName": "东宝区" }, { "areaCode": "420804", "areaName": "掇刀区" }, { "areaCode": "420821", "areaName": "京山县" }, { "areaCode": "420822", "areaName": "沙洋县" }, { "areaCode": "420881", "areaName": "钟祥市" } ] }, { "cityCode": "420900", "cityName": "孝感市", "mallAreaList": [ { "areaCode": "420902", "areaName": "孝南区" }, { "areaCode": "420921", "areaName": "孝昌县" }, { "areaCode": "420922", "areaName": "大悟县" }, { "areaCode": "420923", "areaName": "云梦县" }, { "areaCode": "420981", "areaName": "应城市" }, { "areaCode": "420982", "areaName": "安陆市" }, { "areaCode": "420984", "areaName": "汉川市" } ] }, { "cityCode": "421000", "cityName": "荆州市", "mallAreaList": [ { "areaCode": "421002", "areaName": "沙市区" }, { "areaCode": "421003", "areaName": "荆州区" }, { "areaCode": "421022", "areaName": "公安县" }, { "areaCode": "421023", "areaName": "监利县" }, { "areaCode": "421024", "areaName": "江陵县" }, { "areaCode": "421081", "areaName": "石首市" }, { "areaCode": "421083", "areaName": "洪湖市" }, { "areaCode": "421087", "areaName": "松滋市" } ] }, { "cityCode": "421100", "cityName": "黄冈市", "mallAreaList": [ { "areaCode": "421102", "areaName": "黄州区" }, { "areaCode": "421121", "areaName": "团风县" }, { "areaCode": "421122", "areaName": "红安县" }, { "areaCode": "421123", "areaName": "罗田县" }, { "areaCode": "421124", "areaName": "英山县" }, { "areaCode": "421125", "areaName": "浠水县" }, { "areaCode": "421126", "areaName": "蕲春县" }, { "areaCode": "421127", "areaName": "黄梅县" }, { "areaCode": "421181", "areaName": "麻城市" }, { "areaCode": "421182", "areaName": "武穴市" } ] }, { "cityCode": "421200", "cityName": "咸宁市", "mallAreaList": [ { "areaCode": "421202", "areaName": "咸安区" }, { "areaCode": "421221", "areaName": "嘉鱼县" }, { "areaCode": "421222", "areaName": "通城县" }, { "areaCode": "421223", "areaName": "崇阳县" }, { "areaCode": "421224", "areaName": "通山县" }, { "areaCode": "421281", "areaName": "赤壁市" } ] }, { "cityCode": "421300", "cityName": "随州市", "mallAreaList": [ { "areaCode": "421303", "areaName": "曾都区" }, { "areaCode": "421321", "areaName": "随县" }, { "areaCode": "421381", "areaName": "广水市" } ] }, { "cityCode": "422800", "cityName": "恩施土家族苗族自治州", "mallAreaList": [ { "areaCode": "422801", "areaName": "恩施市" }, { "areaCode": "422802", "areaName": "利川市" }, { "areaCode": "422822", "areaName": "建始县" }, { "areaCode": "422823", "areaName": "巴东县" }, { "areaCode": "422825", "areaName": "宣恩县" }, { "areaCode": "422826", "areaName": "咸丰县" }, { "areaCode": "422827", "areaName": "来凤县" }, { "areaCode": "422828", "areaName": "鹤峰县" } ] }, { "cityCode": "429000", "cityName": "省直辖行政单位", "mallAreaList": [ { "areaCode": "429004", "areaName": "仙桃市" }, { "areaCode": "429005", "areaName": "潜江市" }, { "areaCode": "429006", "areaName": "天门市" }, { "areaCode": "429021", "areaName": "神农架林区" } ] } ] }, { "provinceCode": "430000", "provinceName": "湖南省", "mallCityList": [ { "cityCode": "430100", "cityName": "长沙市", "mallAreaList": [ { "areaCode": "430102", "areaName": "芙蓉区" }, { "areaCode": "430103", "areaName": "天心区" }, { "areaCode": "430104", "areaName": "岳麓区" }, { "areaCode": "430105", "areaName": "开福区" }, { "areaCode": "430111", "areaName": "雨花区" }, { "areaCode": "430112", "areaName": "望城区" }, { "areaCode": "430121", "areaName": "长沙县" }, { "areaCode": "430124", "areaName": "宁乡县" }, { "areaCode": "430181", "areaName": "浏阳市" } ] }, { "cityCode": "430200", "cityName": "株洲市", "mallAreaList": [ { "areaCode": "430202", "areaName": "荷塘区" }, { "areaCode": "430203", "areaName": "芦淞区" }, { "areaCode": "430204", "areaName": "石峰区" }, { "areaCode": "430211", "areaName": "天元区" }, { "areaCode": "430221", "areaName": "株洲县" }, { "areaCode": "430223", "areaName": "攸县" }, { "areaCode": "430224", "areaName": "茶陵县" }, { "areaCode": "430225", "areaName": "炎陵县" }, { "areaCode": "430281", "areaName": "醴陵市" } ] }, { "cityCode": "430300", "cityName": "湘潭市", "mallAreaList": [ { "areaCode": "430302", "areaName": "雨湖区" }, { "areaCode": "430304", "areaName": "岳塘区" }, { "areaCode": "430321", "areaName": "湘潭县" }, { "areaCode": "430381", "areaName": "湘乡市" }, { "areaCode": "430382", "areaName": "韶山市" } ] }, { "cityCode": "430400", "cityName": "衡阳市", "mallAreaList": [ { "areaCode": "430405", "areaName": "珠晖区" }, { "areaCode": "430406", "areaName": "雁峰区" }, { "areaCode": "430407", "areaName": "石鼓区" }, { "areaCode": "430408", "areaName": "蒸湘区" }, { "areaCode": "430412", "areaName": "南岳区" }, { "areaCode": "430421", "areaName": "衡阳县" }, { "areaCode": "430422", "areaName": "衡南县" }, { "areaCode": "430423", "areaName": "衡山县" }, { "areaCode": "430424", "areaName": "衡东县" }, { "areaCode": "430426", "areaName": "祁东县" }, { "areaCode": "430481", "areaName": "耒阳市" }, { "areaCode": "430482", "areaName": "常宁市" } ] }, { "cityCode": "430500", "cityName": "邵阳市", "mallAreaList": [ { "areaCode": "430502", "areaName": "双清区" }, { "areaCode": "430503", "areaName": "大祥区" }, { "areaCode": "430511", "areaName": "北塔区" }, { "areaCode": "430521", "areaName": "邵东县" }, { "areaCode": "430522", "areaName": "新邵县" }, { "areaCode": "430523", "areaName": "邵阳县" }, { "areaCode": "430524", "areaName": "隆回县" }, { "areaCode": "430525", "areaName": "洞口县" }, { "areaCode": "430527", "areaName": "绥宁县" }, { "areaCode": "430528", "areaName": "新宁县" }, { "areaCode": "430529", "areaName": "城步苗族自治县" }, { "areaCode": "430581", "areaName": "武冈市" } ] }, { "cityCode": "430600", "cityName": "岳阳市", "mallAreaList": [ { "areaCode": "430602", "areaName": "岳阳楼区" }, { "areaCode": "430603", "areaName": "云溪区" }, { "areaCode": "430611", "areaName": "君山区" }, { "areaCode": "430621", "areaName": "岳阳县" }, { "areaCode": "430623", "areaName": "华容县" }, { "areaCode": "430624", "areaName": "湘阴县" }, { "areaCode": "430626", "areaName": "平江县" }, { "areaCode": "430681", "areaName": "汨罗市" }, { "areaCode": "430682", "areaName": "临湘市" } ] }, { "cityCode": "430700", "cityName": "常德市", "mallAreaList": [ { "areaCode": "430702", "areaName": "武陵区" }, { "areaCode": "430703", "areaName": "鼎城区" }, { "areaCode": "430721", "areaName": "安乡县" }, { "areaCode": "430722", "areaName": "汉寿县" }, { "areaCode": "430723", "areaName": "澧县" }, { "areaCode": "430724", "areaName": "临澧县" }, { "areaCode": "430725", "areaName": "桃源县" }, { "areaCode": "430726", "areaName": "石门县" }, { "areaCode": "430781", "areaName": "津市市" } ] }, { "cityCode": "430800", "cityName": "张家界市", "mallAreaList": [ { "areaCode": "430802", "areaName": "永定区" }, { "areaCode": "430811", "areaName": "武陵源区" }, { "areaCode": "430821", "areaName": "慈利县" }, { "areaCode": "430822", "areaName": "桑植县" } ] }, { "cityCode": "430900", "cityName": "益阳市", "mallAreaList": [ { "areaCode": "430902", "areaName": "资阳区" }, { "areaCode": "430903", "areaName": "赫山区" }, { "areaCode": "430921", "areaName": "南县" }, { "areaCode": "430922", "areaName": "桃江县" }, { "areaCode": "430923", "areaName": "安化县" }, { "areaCode": "430981", "areaName": "沅江市" } ] }, { "cityCode": "431000", "cityName": "郴州市", "mallAreaList": [ { "areaCode": "431002", "areaName": "北湖区" }, { "areaCode": "431003", "areaName": "苏仙区" }, { "areaCode": "431021", "areaName": "桂阳县" }, { "areaCode": "431022", "areaName": "宜章县" }, { "areaCode": "431023", "areaName": "永兴县" }, { "areaCode": "431024", "areaName": "嘉禾县" }, { "areaCode": "431025", "areaName": "临武县" }, { "areaCode": "431026", "areaName": "汝城县" }, { "areaCode": "431027", "areaName": "桂东县" }, { "areaCode": "431028", "areaName": "安仁县" }, { "areaCode": "431081", "areaName": "资兴市" } ] }, { "cityCode": "431100", "cityName": "永州市", "mallAreaList": [ { "areaCode": "431102", "areaName": "零陵区" }, { "areaCode": "431103", "areaName": "冷水滩区" }, { "areaCode": "431121", "areaName": "祁阳县" }, { "areaCode": "431122", "areaName": "东安县" }, { "areaCode": "431123", "areaName": "双牌县" }, { "areaCode": "431124", "areaName": "道县" }, { "areaCode": "431125", "areaName": "江永县" }, { "areaCode": "431126", "areaName": "宁远县" }, { "areaCode": "431127", "areaName": "蓝山县" }, { "areaCode": "431128", "areaName": "新田县" }, { "areaCode": "431129", "areaName": "江华瑶族自治县" } ] }, { "cityCode": "431200", "cityName": "怀化市", "mallAreaList": [ { "areaCode": "431202", "areaName": "鹤城区" }, { "areaCode": "431221", "areaName": "中方县" }, { "areaCode": "431222", "areaName": "沅陵县" }, { "areaCode": "431223", "areaName": "辰溪县" }, { "areaCode": "431224", "areaName": "溆浦县" }, { "areaCode": "431225", "areaName": "会同县" }, { "areaCode": "431226", "areaName": "麻阳苗族自治县" }, { "areaCode": "431227", "areaName": "新晃侗族自治县" }, { "areaCode": "431228", "areaName": "芷江侗族自治县" }, { "areaCode": "431229", "areaName": "靖州苗族侗族自治县" }, { "areaCode": "431230", "areaName": "通道侗族自治县" }, { "areaCode": "431281", "areaName": "洪江市" } ] }, { "cityCode": "431300", "cityName": "娄底市", "mallAreaList": [ { "areaCode": "431302", "areaName": "娄星区" }, { "areaCode": "431321", "areaName": "双峰县" }, { "areaCode": "431322", "areaName": "新化县" }, { "areaCode": "431381", "areaName": "冷水江市" }, { "areaCode": "431382", "areaName": "涟源市" } ] }, { "cityCode": "433100", "cityName": "湘西土家族苗族自治州", "mallAreaList": [ { "areaCode": "433101", "areaName": "吉首市" }, { "areaCode": "433122", "areaName": "泸溪县" }, { "areaCode": "433123", "areaName": "凤凰县" }, { "areaCode": "433124", "areaName": "花垣县" }, { "areaCode": "433125", "areaName": "保靖县" }, { "areaCode": "433126", "areaName": "古丈县" }, { "areaCode": "433127", "areaName": "永顺县" }, { "areaCode": "433130", "areaName": "龙山县" } ] } ] }, { "provinceCode": "440000", "provinceName": "广东省", "mallCityList": [ { "cityCode": "440100", "cityName": "广州市", "mallAreaList": [ { "areaCode": "440103", "areaName": "荔湾区" }, { "areaCode": "440104", "areaName": "越秀区" }, { "areaCode": "440105", "areaName": "海珠区" }, { "areaCode": "440106", "areaName": "天河区" }, { "areaCode": "440111", "areaName": "白云区" }, { "areaCode": "440112", "areaName": "黄埔区" }, { "areaCode": "440113", "areaName": "番禺区" }, { "areaCode": "440114", "areaName": "花都区" }, { "areaCode": "440115", "areaName": "南沙区" }, { "areaCode": "440116", "areaName": "萝岗区" }, { "areaCode": "440117", "areaName": "从化区" }, { "areaCode": "440118", "areaName": "增城区" } ] }, { "cityCode": "440200", "cityName": "韶关市", "mallAreaList": [ { "areaCode": "440203", "areaName": "武江区" }, { "areaCode": "440204", "areaName": "浈江区" }, { "areaCode": "440205", "areaName": "曲江区" }, { "areaCode": "440222", "areaName": "始兴县" }, { "areaCode": "440224", "areaName": "仁化县" }, { "areaCode": "440229", "areaName": "翁源县" }, { "areaCode": "440232", "areaName": "乳源瑶族自治县" }, { "areaCode": "440233", "areaName": "新丰县" }, { "areaCode": "440281", "areaName": "乐昌市" }, { "areaCode": "440282", "areaName": "南雄市" } ] }, { "cityCode": "440300", "cityName": "深圳市", "mallAreaList": [ { "areaCode": "440303", "areaName": "罗湖区" }, { "areaCode": "440304", "areaName": "福田区" }, { "areaCode": "440305", "areaName": "南山区" }, { "areaCode": "440306", "areaName": "宝安区" }, { "areaCode": "440307", "areaName": "龙岗区" }, { "areaCode": "440308", "areaName": "盐田区" } ] }, { "cityCode": "440400", "cityName": "珠海市", "mallAreaList": [ { "areaCode": "440402", "areaName": "香洲区" }, { "areaCode": "440403", "areaName": "斗门区" }, { "areaCode": "440404", "areaName": "金湾区" } ] }, { "cityCode": "440500", "cityName": "汕头市", "mallAreaList": [ { "areaCode": "440507", "areaName": "龙湖区" }, { "areaCode": "440511", "areaName": "金平区" }, { "areaCode": "440512", "areaName": "濠江区" }, { "areaCode": "440513", "areaName": "潮阳区" }, { "areaCode": "440514", "areaName": "潮南区" }, { "areaCode": "440515", "areaName": "澄海区" }, { "areaCode": "440523", "areaName": "南澳县" } ] }, { "cityCode": "440600", "cityName": "佛山市", "mallAreaList": [ { "areaCode": "440604", "areaName": "禅城区" }, { "areaCode": "440605", "areaName": "南海区" }, { "areaCode": "440606", "areaName": "顺德区" }, { "areaCode": "440607", "areaName": "三水区" }, { "areaCode": "440608", "areaName": "高明区" } ] }, { "cityCode": "440700", "cityName": "江门市", "mallAreaList": [ { "areaCode": "440703", "areaName": "蓬江区" }, { "areaCode": "440704", "areaName": "江海区" }, { "areaCode": "440705", "areaName": "新会区" }, { "areaCode": "440781", "areaName": "台山市" }, { "areaCode": "440783", "areaName": "开平市" }, { "areaCode": "440784", "areaName": "鹤山市" }, { "areaCode": "440785", "areaName": "恩平市" } ] }, { "cityCode": "440800", "cityName": "湛江市", "mallAreaList": [ { "areaCode": "440802", "areaName": "赤坎区" }, { "areaCode": "440803", "areaName": "霞山区" }, { "areaCode": "440804", "areaName": "坡头区" }, { "areaCode": "440811", "areaName": "麻章区" }, { "areaCode": "440823", "areaName": "遂溪县" }, { "areaCode": "440825", "areaName": "徐闻县" }, { "areaCode": "440881", "areaName": "廉江市" }, { "areaCode": "440882", "areaName": "雷州市" }, { "areaCode": "440883", "areaName": "吴川市" } ] }, { "cityCode": "440900", "cityName": "茂名市", "mallAreaList": [ { "areaCode": "440902", "areaName": "茂南区" }, { "areaCode": "440904", "areaName": "电白区" }, { "areaCode": "440981", "areaName": "高州市" }, { "areaCode": "440982", "areaName": "化州市" }, { "areaCode": "440983", "areaName": "信宜市" } ] }, { "cityCode": "441200", "cityName": "肇庆市", "mallAreaList": [ { "areaCode": "441202", "areaName": "端州区" }, { "areaCode": "441203", "areaName": "鼎湖区" }, { "areaCode": "441223", "areaName": "广宁县" }, { "areaCode": "441224", "areaName": "怀集县" }, { "areaCode": "441225", "areaName": "封开县" }, { "areaCode": "441226", "areaName": "德庆县" }, { "areaCode": "441283", "areaName": "高要市" }, { "areaCode": "441284", "areaName": "四会市" } ] }, { "cityCode": "441300", "cityName": "惠州市", "mallAreaList": [ { "areaCode": "441302", "areaName": "惠城区" }, { "areaCode": "441303", "areaName": "惠阳区" }, { "areaCode": "441322", "areaName": "博罗县" }, { "areaCode": "441323", "areaName": "惠东县" }, { "areaCode": "441324", "areaName": "龙门县" } ] }, { "cityCode": "441400", "cityName": "梅州市", "mallAreaList": [ { "areaCode": "441402", "areaName": "梅江区" }, { "areaCode": "441403", "areaName": "梅县区" }, { "areaCode": "441422", "areaName": "大埔县" }, { "areaCode": "441423", "areaName": "丰顺县" }, { "areaCode": "441424", "areaName": "五华县" }, { "areaCode": "441426", "areaName": "平远县" }, { "areaCode": "441427", "areaName": "蕉岭县" }, { "areaCode": "441481", "areaName": "兴宁市" } ] }, { "cityCode": "441500", "cityName": "汕尾市", "mallAreaList": [ { "areaCode": "441502", "areaName": "城区" }, { "areaCode": "441521", "areaName": "海丰县" }, { "areaCode": "441523", "areaName": "陆河县" }, { "areaCode": "441581", "areaName": "陆丰市" } ] }, { "cityCode": "441600", "cityName": "河源市", "mallAreaList": [ { "areaCode": "441602", "areaName": "源城区" }, { "areaCode": "441621", "areaName": "紫金县" }, { "areaCode": "441622", "areaName": "龙川县" }, { "areaCode": "441623", "areaName": "连平县" }, { "areaCode": "441624", "areaName": "和平县" }, { "areaCode": "441625", "areaName": "东源县" } ] }, { "cityCode": "441700", "cityName": "阳江市", "mallAreaList": [ { "areaCode": "441702", "areaName": "江城区" }, { "areaCode": "441721", "areaName": "阳西县" }, { "areaCode": "441723", "areaName": "阳东县" }, { "areaCode": "441781", "areaName": "阳春市" } ] }, { "cityCode": "441800", "cityName": "清远市", "mallAreaList": [ { "areaCode": "441802", "areaName": "清城区" }, { "areaCode": "441803", "areaName": "清新区" }, { "areaCode": "441821", "areaName": "佛冈县" }, { "areaCode": "441823", "areaName": "阳山县" }, { "areaCode": "441825", "areaName": "连山壮族瑶族自治县" }, { "areaCode": "441826", "areaName": "连南瑶族自治县" }, { "areaCode": "441881", "areaName": "英德市" }, { "areaCode": "441882", "areaName": "连州市" } ] }, { "cityCode": "441900", "cityName": "东莞市", "mallAreaList": [ { "areaCode": "441900", "areaName": "东莞市" } ] }, { "cityCode": "442000", "cityName": "中山市", "mallAreaList": [ { "areaCode": "442000", "areaName": "中山市" } ] }, { "cityCode": "445100", "cityName": "潮州市", "mallAreaList": [ { "areaCode": "445102", "areaName": "湘桥区" }, { "areaCode": "445103", "areaName": "潮安区" }, { "areaCode": "445122", "areaName": "饶平县" } ] }, { "cityCode": "445200", "cityName": "揭阳市", "mallAreaList": [ { "areaCode": "445202", "areaName": "榕城区" }, { "areaCode": "445203", "areaName": "揭东区" }, { "areaCode": "445222", "areaName": "揭西县" }, { "areaCode": "445224", "areaName": "惠来县" }, { "areaCode": "445281", "areaName": "普宁市" } ] }, { "cityCode": "445300", "cityName": "云浮市", "mallAreaList": [ { "areaCode": "445302", "areaName": "云城区" }, { "areaCode": "445303", "areaName": "云安区" }, { "areaCode": "445321", "areaName": "新兴县" }, { "areaCode": "445322", "areaName": "郁南县" }, { "areaCode": "445381", "areaName": "罗定市" } ] } ] }, { "provinceCode": "450000", "provinceName": "广西壮族自治区", "mallCityList": [ { "cityCode": "450100", "cityName": "南宁市", "mallAreaList": [ { "areaCode": "450102", "areaName": "兴宁区" }, { "areaCode": "450103", "areaName": "青秀区" }, { "areaCode": "450105", "areaName": "江南区" }, { "areaCode": "450107", "areaName": "西乡塘区" }, { "areaCode": "450108", "areaName": "良庆区" }, { "areaCode": "450109", "areaName": "邕宁区" }, { "areaCode": "450122", "areaName": "武鸣县" }, { "areaCode": "450123", "areaName": "隆安县" }, { "areaCode": "450124", "areaName": "马山县" }, { "areaCode": "450125", "areaName": "上林县" }, { "areaCode": "450126", "areaName": "宾阳县" }, { "areaCode": "450127", "areaName": "横县" } ] }, { "cityCode": "450200", "cityName": "柳州市", "mallAreaList": [ { "areaCode": "450202", "areaName": "城中区" }, { "areaCode": "450203", "areaName": "鱼峰区" }, { "areaCode": "450204", "areaName": "柳南区" }, { "areaCode": "450205", "areaName": "柳北区" }, { "areaCode": "450221", "areaName": "柳江县" }, { "areaCode": "450222", "areaName": "柳城县" }, { "areaCode": "450223", "areaName": "鹿寨县" }, { "areaCode": "450224", "areaName": "融安县" }, { "areaCode": "450225", "areaName": "融水苗族自治县" }, { "areaCode": "450226", "areaName": "三江侗族自治县" } ] }, { "cityCode": "450300", "cityName": "桂林市", "mallAreaList": [ { "areaCode": "450302", "areaName": "秀峰区" }, { "areaCode": "450303", "areaName": "叠彩区" }, { "areaCode": "450304", "areaName": "象山区" }, { "areaCode": "450305", "areaName": "七星区" }, { "areaCode": "450311", "areaName": "雁山区" }, { "areaCode": "450312", "areaName": "临桂区" }, { "areaCode": "450321", "areaName": "阳朔县" }, { "areaCode": "450323", "areaName": "灵川县" }, { "areaCode": "450324", "areaName": "全州县" }, { "areaCode": "450325", "areaName": "兴安县" }, { "areaCode": "450326", "areaName": "永福县" }, { "areaCode": "450327", "areaName": "灌阳县" }, { "areaCode": "450328", "areaName": "龙胜各族自治县" }, { "areaCode": "450329", "areaName": "资源县" }, { "areaCode": "450330", "areaName": "平乐县" }, { "areaCode": "450331", "areaName": "荔浦县" }, { "areaCode": "450332", "areaName": "恭城瑶族自治县" } ] }, { "cityCode": "450400", "cityName": "梧州市", "mallAreaList": [ { "areaCode": "450403", "areaName": "万秀区" }, { "areaCode": "450405", "areaName": "长洲区" }, { "areaCode": "450406", "areaName": "龙圩区" }, { "areaCode": "450421", "areaName": "苍梧县" }, { "areaCode": "450422", "areaName": "藤县" }, { "areaCode": "450423", "areaName": "蒙山县" }, { "areaCode": "450481", "areaName": "岑溪市" } ] }, { "cityCode": "450500", "cityName": "北海市", "mallAreaList": [ { "areaCode": "450502", "areaName": "海城区" }, { "areaCode": "450503", "areaName": "银海区" }, { "areaCode": "450512", "areaName": "铁山港区" }, { "areaCode": "450521", "areaName": "合浦县" } ] }, { "cityCode": "450600", "cityName": "防城港市", "mallAreaList": [ { "areaCode": "450602", "areaName": "港口区" }, { "areaCode": "450603", "areaName": "防城区" }, { "areaCode": "450621", "areaName": "上思县" }, { "areaCode": "450681", "areaName": "东兴市" } ] }, { "cityCode": "450700", "cityName": "钦州市", "mallAreaList": [ { "areaCode": "450702", "areaName": "钦南区" }, { "areaCode": "450703", "areaName": "钦北区" }, { "areaCode": "450721", "areaName": "灵山县" }, { "areaCode": "450722", "areaName": "浦北县" } ] }, { "cityCode": "450800", "cityName": "贵港市", "mallAreaList": [ { "areaCode": "450802", "areaName": "港北区" }, { "areaCode": "450803", "areaName": "港南区" }, { "areaCode": "450804", "areaName": "覃塘区" }, { "areaCode": "450821", "areaName": "平南县" }, { "areaCode": "450881", "areaName": "桂平市" } ] }, { "cityCode": "450900", "cityName": "玉林市", "mallAreaList": [ { "areaCode": "450902", "areaName": "玉州区" }, { "areaCode": "450903", "areaName": "福绵区" }, { "areaCode": "450921", "areaName": "容县" }, { "areaCode": "450922", "areaName": "陆川县" }, { "areaCode": "450923", "areaName": "博白县" }, { "areaCode": "450924", "areaName": "兴业县" }, { "areaCode": "450981", "areaName": "北流市" } ] }, { "cityCode": "451000", "cityName": "百色市", "mallAreaList": [ { "areaCode": "451002", "areaName": "右江区" }, { "areaCode": "451021", "areaName": "田阳县" }, { "areaCode": "451022", "areaName": "田东县" }, { "areaCode": "451023", "areaName": "平果县" }, { "areaCode": "451024", "areaName": "德保县" }, { "areaCode": "451025", "areaName": "靖西县" }, { "areaCode": "451026", "areaName": "那坡县" }, { "areaCode": "451027", "areaName": "凌云县" }, { "areaCode": "451028", "areaName": "乐业县" }, { "areaCode": "451029", "areaName": "田林县" }, { "areaCode": "451030", "areaName": "西林县" }, { "areaCode": "451031", "areaName": "隆林各族自治县" } ] }, { "cityCode": "451100", "cityName": "贺州市", "mallAreaList": [ { "areaCode": "451102", "areaName": "八步区" }, { "areaCode": "451121", "areaName": "昭平县" }, { "areaCode": "451122", "areaName": "钟山县" }, { "areaCode": "451123", "areaName": "富川瑶族自治县" } ] }, { "cityCode": "451200", "cityName": "河池市", "mallAreaList": [ { "areaCode": "451202", "areaName": "金城江区" }, { "areaCode": "451221", "areaName": "南丹县" }, { "areaCode": "451222", "areaName": "天峨县" }, { "areaCode": "451223", "areaName": "凤山县" }, { "areaCode": "451224", "areaName": "东兰县" }, { "areaCode": "451225", "areaName": "罗城仫佬族自治县" }, { "areaCode": "451226", "areaName": "环江毛南族自治县" }, { "areaCode": "451227", "areaName": "巴马瑶族自治县" }, { "areaCode": "451228", "areaName": "都安瑶族自治县" }, { "areaCode": "451229", "areaName": "大化瑶族自治县" }, { "areaCode": "451281", "areaName": "宜州市" } ] }, { "cityCode": "451300", "cityName": "来宾市", "mallAreaList": [ { "areaCode": "451302", "areaName": "兴宾区" }, { "areaCode": "451321", "areaName": "忻城县" }, { "areaCode": "451322", "areaName": "象州县" }, { "areaCode": "451323", "areaName": "武宣县" }, { "areaCode": "451324", "areaName": "金秀瑶族自治县" }, { "areaCode": "451381", "areaName": "合山市" } ] }, { "cityCode": "451400", "cityName": "崇左市", "mallAreaList": [ { "areaCode": "451402", "areaName": "江州区" }, { "areaCode": "451421", "areaName": "扶绥县" }, { "areaCode": "451422", "areaName": "宁明县" }, { "areaCode": "451423", "areaName": "龙州县" }, { "areaCode": "451424", "areaName": "大新县" }, { "areaCode": "451425", "areaName": "天等县" }, { "areaCode": "451481", "areaName": "凭祥市" } ] } ] }, { "provinceCode": "460000", "provinceName": "海南省", "mallCityList": [ { "cityCode": "460100", "cityName": "海口市", "mallAreaList": [ { "areaCode": "460105", "areaName": "秀英区" }, { "areaCode": "460106", "areaName": "龙华区" }, { "areaCode": "460107", "areaName": "琼山区" }, { "areaCode": "460108", "areaName": "美兰区" } ] }, { "cityCode": "460200", "cityName": "三亚市", "mallAreaList": [ { "areaCode": "460202", "areaName": "海棠区" }, { "areaCode": "460203", "areaName": "吉阳区" }, { "areaCode": "460204", "areaName": "天涯区" }, { "areaCode": "460205", "areaName": "崖州区" } ] }, { "cityCode": "469000", "cityName": "省直辖县级行政单位", "mallAreaList": [ { "areaCode": "469001", "areaName": "五指山市" }, { "areaCode": "469002", "areaName": "琼海市" }, { "areaCode": "469003", "areaName": "儋州市" }, { "areaCode": "469005", "areaName": "文昌市" }, { "areaCode": "469006", "areaName": "万宁市" }, { "areaCode": "469007", "areaName": "东方市" }, { "areaCode": "469021", "areaName": "定安县" }, { "areaCode": "469022", "areaName": "屯昌县" }, { "areaCode": "469023", "areaName": "澄迈县" }, { "areaCode": "469024", "areaName": "临高县" }, { "areaCode": "469025", "areaName": "白沙黎族自治县" }, { "areaCode": "469026", "areaName": "昌江黎族自治县" }, { "areaCode": "469027", "areaName": "乐东黎族自治县" }, { "areaCode": "469028", "areaName": "陵水黎族自治县" }, { "areaCode": "469029", "areaName": "保亭黎族苗族自治县" }, { "areaCode": "469030", "areaName": "琼中黎族苗族自治县" } ] } ] }, { "provinceCode": "500000", "provinceName": "重庆市", "mallCityList": [ { "cityCode": "500100", "cityName": "重庆市", "mallAreaList": [ { "areaCode": "500101", "areaName": "万州区" }, { "areaCode": "500102", "areaName": "涪陵区" }, { "areaCode": "500103", "areaName": "渝中区" }, { "areaCode": "500104", "areaName": "大渡口区" }, { "areaCode": "500105", "areaName": "江北区" }, { "areaCode": "500106", "areaName": "沙坪坝区" }, { "areaCode": "500107", "areaName": "九龙坡区" }, { "areaCode": "500108", "areaName": "南岸区" }, { "areaCode": "500109", "areaName": "北碚区" }, { "areaCode": "500110", "areaName": "綦江区" }, { "areaCode": "500111", "areaName": "大足区" }, { "areaCode": "500112", "areaName": "渝北区" }, { "areaCode": "500113", "areaName": "巴南区" }, { "areaCode": "500114", "areaName": "黔江区" }, { "areaCode": "500115", "areaName": "长寿区" }, { "areaCode": "500116", "areaName": "江津区" }, { "areaCode": "500117", "areaName": "合川区" }, { "areaCode": "500118", "areaName": "永川区" }, { "areaCode": "500119", "areaName": "南川区" }, { "areaCode": "500120", "areaName": "璧山区" }, { "areaCode": "500151", "areaName": "铜梁区" } ] }, { "cityCode": "500200", "cityName": "重庆市辖县", "mallAreaList": [ { "areaCode": "500223", "areaName": "潼南县" }, { "areaCode": "500226", "areaName": "荣昌县" }, { "areaCode": "500228", "areaName": "梁平县" }, { "areaCode": "500229", "areaName": "城口县" }, { "areaCode": "500230", "areaName": "丰都县" }, { "areaCode": "500231", "areaName": "垫江县" }, { "areaCode": "500232", "areaName": "武隆县" }, { "areaCode": "500233", "areaName": "忠县" }, { "areaCode": "500234", "areaName": "开县" }, { "areaCode": "500235", "areaName": "云阳县" }, { "areaCode": "500236", "areaName": "奉节县" }, { "areaCode": "500237", "areaName": "巫山县" }, { "areaCode": "500238", "areaName": "巫溪县" }, { "areaCode": "500240", "areaName": "石柱土家族自治县" }, { "areaCode": "500241", "areaName": "秀山土家族苗族自治县" }, { "areaCode": "500242", "areaName": "酉阳土家族苗族自治县" }, { "areaCode": "500243", "areaName": "彭水苗族土家族自治县" } ] } ] }, { "provinceCode": "510000", "provinceName": "四川省", "mallCityList": [ { "cityCode": "510100", "cityName": "成都市", "mallAreaList": [ { "areaCode": "510104", "areaName": "锦江区" }, { "areaCode": "510105", "areaName": "青羊区" }, { "areaCode": "510106", "areaName": "金牛区" }, { "areaCode": "510107", "areaName": "武侯区" }, { "areaCode": "510108", "areaName": "成华区" }, { "areaCode": "510112", "areaName": "龙泉驿区" }, { "areaCode": "510113", "areaName": "青白江区" }, { "areaCode": "510114", "areaName": "新都区" }, { "areaCode": "510115", "areaName": "温江区" }, { "areaCode": "510121", "areaName": "金堂县" }, { "areaCode": "510122", "areaName": "双流县" }, { "areaCode": "510124", "areaName": "郫县" }, { "areaCode": "510129", "areaName": "大邑县" }, { "areaCode": "510131", "areaName": "蒲江县" }, { "areaCode": "510132", "areaName": "新津县" }, { "areaCode": "510181", "areaName": "都江堰市" }, { "areaCode": "510182", "areaName": "彭州市" }, { "areaCode": "510183", "areaName": "邛崃市" }, { "areaCode": "510184", "areaName": "崇州市" } ] }, { "cityCode": "510300", "cityName": "自贡市", "mallAreaList": [ { "areaCode": "510302", "areaName": "自流井区" }, { "areaCode": "510303", "areaName": "贡井区" }, { "areaCode": "510304", "areaName": "大安区" }, { "areaCode": "510311", "areaName": "沿滩区" }, { "areaCode": "510321", "areaName": "荣县" }, { "areaCode": "510322", "areaName": "富顺县" } ] }, { "cityCode": "510400", "cityName": "攀枝花市", "mallAreaList": [ { "areaCode": "510402", "areaName": "东区" }, { "areaCode": "510403", "areaName": "西区" }, { "areaCode": "510411", "areaName": "仁和区" }, { "areaCode": "510421", "areaName": "米易县" }, { "areaCode": "510422", "areaName": "盐边县" } ] }, { "cityCode": "510500", "cityName": "泸州市", "mallAreaList": [ { "areaCode": "510502", "areaName": "江阳区" }, { "areaCode": "510503", "areaName": "纳溪区" }, { "areaCode": "510504", "areaName": "龙马潭区" }, { "areaCode": "510521", "areaName": "泸县" }, { "areaCode": "510522", "areaName": "合江县" }, { "areaCode": "510524", "areaName": "叙永县" }, { "areaCode": "510525", "areaName": "古蔺县" } ] }, { "cityCode": "510600", "cityName": "德阳市", "mallAreaList": [ { "areaCode": "510603", "areaName": "旌阳区" }, { "areaCode": "510623", "areaName": "中江县" }, { "areaCode": "510626", "areaName": "罗江县" }, { "areaCode": "510681", "areaName": "广汉市" }, { "areaCode": "510682", "areaName": "什邡市" }, { "areaCode": "510683", "areaName": "绵竹市" } ] }, { "cityCode": "510700", "cityName": "绵阳市", "mallAreaList": [ { "areaCode": "510703", "areaName": "涪城区" }, { "areaCode": "510704", "areaName": "游仙区" }, { "areaCode": "510722", "areaName": "三台县" }, { "areaCode": "510723", "areaName": "盐亭县" }, { "areaCode": "510724", "areaName": "安县" }, { "areaCode": "510725", "areaName": "梓潼县" }, { "areaCode": "510726", "areaName": "北川羌族自治县" }, { "areaCode": "510727", "areaName": "平武县" }, { "areaCode": "510781", "areaName": "江油市" } ] }, { "cityCode": "510800", "cityName": "广元市", "mallAreaList": [ { "areaCode": "510802", "areaName": "利州区" }, { "areaCode": "510811", "areaName": "昭化区" }, { "areaCode": "510812", "areaName": "朝天区" }, { "areaCode": "510821", "areaName": "旺苍县" }, { "areaCode": "510822", "areaName": "青川县" }, { "areaCode": "510823", "areaName": "剑阁县" }, { "areaCode": "510824", "areaName": "苍溪县" } ] }, { "cityCode": "510900", "cityName": "遂宁市", "mallAreaList": [ { "areaCode": "510903", "areaName": "船山区" }, { "areaCode": "510904", "areaName": "安居区" }, { "areaCode": "510921", "areaName": "蓬溪县" }, { "areaCode": "510922", "areaName": "射洪县" }, { "areaCode": "510923", "areaName": "大英县" } ] }, { "cityCode": "511000", "cityName": "内江市", "mallAreaList": [ { "areaCode": "511002", "areaName": "市中区" }, { "areaCode": "511011", "areaName": "东兴区" }, { "areaCode": "511024", "areaName": "威远县" }, { "areaCode": "511025", "areaName": "资中县" }, { "areaCode": "511028", "areaName": "隆昌县" } ] }, { "cityCode": "511100", "cityName": "乐山市", "mallAreaList": [ { "areaCode": "511102", "areaName": "市中区" }, { "areaCode": "511111", "areaName": "沙湾区" }, { "areaCode": "511112", "areaName": "五通桥区" }, { "areaCode": "511113", "areaName": "金口河区" }, { "areaCode": "511123", "areaName": "犍为县" }, { "areaCode": "511124", "areaName": "井研县" }, { "areaCode": "511126", "areaName": "夹江县" }, { "areaCode": "511129", "areaName": "沐川县" }, { "areaCode": "511132", "areaName": "峨边彝族自治县" }, { "areaCode": "511133", "areaName": "马边彝族自治县" }, { "areaCode": "511181", "areaName": "峨眉山市" } ] }, { "cityCode": "511300", "cityName": "南充市", "mallAreaList": [ { "areaCode": "511302", "areaName": "顺庆区" }, { "areaCode": "511303", "areaName": "高坪区" }, { "areaCode": "511304", "areaName": "嘉陵区" }, { "areaCode": "511321", "areaName": "南部县" }, { "areaCode": "511322", "areaName": "营山县" }, { "areaCode": "511323", "areaName": "蓬安县" }, { "areaCode": "511324", "areaName": "仪陇县" }, { "areaCode": "511325", "areaName": "西充县" }, { "areaCode": "511381", "areaName": "阆中市" } ] }, { "cityCode": "511400", "cityName": "眉山市", "mallAreaList": [ { "areaCode": "511402", "areaName": "东坡区" }, { "areaCode": "511421", "areaName": "仁寿县" }, { "areaCode": "511422", "areaName": "彭山县" }, { "areaCode": "511423", "areaName": "洪雅县" }, { "areaCode": "511424", "areaName": "丹棱县" }, { "areaCode": "511425", "areaName": "青神县" } ] }, { "cityCode": "511500", "cityName": "宜宾市", "mallAreaList": [ { "areaCode": "511502", "areaName": "翠屏区" }, { "areaCode": "511503", "areaName": "南溪区" }, { "areaCode": "511521", "areaName": "宜宾县" }, { "areaCode": "511523", "areaName": "江安县" }, { "areaCode": "511524", "areaName": "长宁县" }, { "areaCode": "511525", "areaName": "高县" }, { "areaCode": "511526", "areaName": "珙县" }, { "areaCode": "511527", "areaName": "筠连县" }, { "areaCode": "511528", "areaName": "兴文县" }, { "areaCode": "511529", "areaName": "屏山县" } ] }, { "cityCode": "511600", "cityName": "广安市", "mallAreaList": [ { "areaCode": "511602", "areaName": "广安区" }, { "areaCode": "511603", "areaName": "前锋区" }, { "areaCode": "511621", "areaName": "岳池县" }, { "areaCode": "511622", "areaName": "武胜县" }, { "areaCode": "511623", "areaName": "邻水县" }, { "areaCode": "511681", "areaName": "华蓥市" } ] }, { "cityCode": "511700", "cityName": "达州市", "mallAreaList": [ { "areaCode": "511702", "areaName": "通川区" }, { "areaCode": "511703", "areaName": "达川区" }, { "areaCode": "511722", "areaName": "宣汉县" }, { "areaCode": "511723", "areaName": "开江县" }, { "areaCode": "511724", "areaName": "大竹县" }, { "areaCode": "511725", "areaName": "渠县" }, { "areaCode": "511781", "areaName": "万源市" } ] }, { "cityCode": "511800", "cityName": "雅安市", "mallAreaList": [ { "areaCode": "511802", "areaName": "雨城区" }, { "areaCode": "511803", "areaName": "名山区" }, { "areaCode": "511822", "areaName": "荥经县" }, { "areaCode": "511823", "areaName": "汉源县" }, { "areaCode": "511824", "areaName": "石棉县" }, { "areaCode": "511825", "areaName": "天全县" }, { "areaCode": "511826", "areaName": "芦山县" }, { "areaCode": "511827", "areaName": "宝兴县" } ] }, { "cityCode": "511900", "cityName": "巴中市", "mallAreaList": [ { "areaCode": "511902", "areaName": "巴州区" }, { "areaCode": "511903", "areaName": "恩阳区" }, { "areaCode": "511921", "areaName": "通江县" }, { "areaCode": "511922", "areaName": "南江县" }, { "areaCode": "511923", "areaName": "平昌县" } ] }, { "cityCode": "512000", "cityName": "资阳市", "mallAreaList": [ { "areaCode": "512002", "areaName": "雁江区" }, { "areaCode": "512021", "areaName": "安岳县" }, { "areaCode": "512022", "areaName": "乐至县" }, { "areaCode": "512081", "areaName": "简阳市" } ] }, { "cityCode": "513200", "cityName": "阿坝藏族羌族自治州", "mallAreaList": [ { "areaCode": "513221", "areaName": "汶川县" }, { "areaCode": "513222", "areaName": "理县" }, { "areaCode": "513223", "areaName": "茂县" }, { "areaCode": "513224", "areaName": "松潘县" }, { "areaCode": "513225", "areaName": "九寨沟县" }, { "areaCode": "513226", "areaName": "金川县" }, { "areaCode": "513227", "areaName": "小金县" }, { "areaCode": "513228", "areaName": "黑水县" }, { "areaCode": "513229", "areaName": "马尔康县" }, { "areaCode": "513230", "areaName": "壤塘县" }, { "areaCode": "513231", "areaName": "阿坝县" }, { "areaCode": "513232", "areaName": "若尔盖县" }, { "areaCode": "513233", "areaName": "红原县" } ] }, { "cityCode": "513300", "cityName": "甘孜藏族自治州", "mallAreaList": [ { "areaCode": "513321", "areaName": "康定县" }, { "areaCode": "513322", "areaName": "泸定县" }, { "areaCode": "513323", "areaName": "丹巴县" }, { "areaCode": "513324", "areaName": "九龙县" }, { "areaCode": "513325", "areaName": "雅江县" }, { "areaCode": "513326", "areaName": "道孚县" }, { "areaCode": "513327", "areaName": "炉霍县" }, { "areaCode": "513328", "areaName": "甘孜县" }, { "areaCode": "513329", "areaName": "新龙县" }, { "areaCode": "513330", "areaName": "德格县" }, { "areaCode": "513331", "areaName": "白玉县" }, { "areaCode": "513332", "areaName": "石渠县" }, { "areaCode": "513333", "areaName": "色达县" }, { "areaCode": "513334", "areaName": "理塘县" }, { "areaCode": "513335", "areaName": "巴塘县" }, { "areaCode": "513336", "areaName": "乡城县" }, { "areaCode": "513337", "areaName": "稻城县" }, { "areaCode": "513338", "areaName": "得荣县" } ] }, { "cityCode": "513400", "cityName": "凉山彝族自治州", "mallAreaList": [ { "areaCode": "513401", "areaName": "西昌市" }, { "areaCode": "513422", "areaName": "木里藏族自治县" }, { "areaCode": "513423", "areaName": "盐源县" }, { "areaCode": "513424", "areaName": "德昌县" }, { "areaCode": "513425", "areaName": "会理县" }, { "areaCode": "513426", "areaName": "会东县" }, { "areaCode": "513427", "areaName": "宁南县" }, { "areaCode": "513428", "areaName": "普格县" }, { "areaCode": "513429", "areaName": "布拖县" }, { "areaCode": "513430", "areaName": "金阳县" }, { "areaCode": "513431", "areaName": "昭觉县" }, { "areaCode": "513432", "areaName": "喜德县" }, { "areaCode": "513433", "areaName": "冕宁县" }, { "areaCode": "513434", "areaName": "越西县" }, { "areaCode": "513435", "areaName": "甘洛县" }, { "areaCode": "513436", "areaName": "美姑县" }, { "areaCode": "513437", "areaName": "雷波县" } ] } ] }, { "provinceCode": "520000", "provinceName": "贵州省", "mallCityList": [ { "cityCode": "520100", "cityName": "贵阳市", "mallAreaList": [ { "areaCode": "520102", "areaName": "南明区" }, { "areaCode": "520103", "areaName": "云岩区" }, { "areaCode": "520111", "areaName": "花溪区" }, { "areaCode": "520112", "areaName": "乌当区" }, { "areaCode": "520113", "areaName": "白云区" }, { "areaCode": "520115", "areaName": "观山湖区" }, { "areaCode": "520121", "areaName": "开阳县" }, { "areaCode": "520122", "areaName": "息烽县" }, { "areaCode": "520123", "areaName": "修文县" }, { "areaCode": "520181", "areaName": "清镇市" } ] }, { "cityCode": "520200", "cityName": "六盘水市", "mallAreaList": [ { "areaCode": "520201", "areaName": "钟山区" }, { "areaCode": "520203", "areaName": "六枝特区" }, { "areaCode": "520221", "areaName": "水城县" }, { "areaCode": "520222", "areaName": "盘县" } ] }, { "cityCode": "520300", "cityName": "遵义市", "mallAreaList": [ { "areaCode": "520302", "areaName": "红花岗区" }, { "areaCode": "520303", "areaName": "汇川区" }, { "areaCode": "520321", "areaName": "遵义县" }, { "areaCode": "520322", "areaName": "桐梓县" }, { "areaCode": "520323", "areaName": "绥阳县" }, { "areaCode": "520324", "areaName": "正安县" }, { "areaCode": "520325", "areaName": "道真仡佬族苗族自治县" }, { "areaCode": "520326", "areaName": "务川仡佬族苗族自治县" }, { "areaCode": "520327", "areaName": "凤冈县" }, { "areaCode": "520328", "areaName": "湄潭县" }, { "areaCode": "520329", "areaName": "余庆县" }, { "areaCode": "520330", "areaName": "习水县" }, { "areaCode": "520381", "areaName": "赤水市" }, { "areaCode": "520382", "areaName": "仁怀市" } ] }, { "cityCode": "520400", "cityName": "安顺市", "mallAreaList": [ { "areaCode": "520402", "areaName": "西秀区" }, { "areaCode": "520421", "areaName": "平坝县" }, { "areaCode": "520422", "areaName": "普定县" }, { "areaCode": "520423", "areaName": "镇宁布依族苗族自治县" }, { "areaCode": "520424", "areaName": "关岭布依族苗族自治县" }, { "areaCode": "520425", "areaName": "紫云苗族布依族自治县" } ] }, { "cityCode": "522200", "cityName": "铜仁地区", "mallAreaList": [ { "areaCode": "520602", "areaName": "碧江区" }, { "areaCode": "520603", "areaName": "万山区" }, { "areaCode": "520621", "areaName": "江口县" }, { "areaCode": "520622", "areaName": "玉屏侗族自治县" }, { "areaCode": "520623", "areaName": "石阡县" }, { "areaCode": "520624", "areaName": "思南县" }, { "areaCode": "520625", "areaName": "印江土家族苗族自治县" }, { "areaCode": "520626", "areaName": "德江县" }, { "areaCode": "520627", "areaName": "沿河土家族自治县" }, { "areaCode": "520628", "areaName": "松桃苗族自治县" }, { "areaCode": "522200", "areaName": "铜仁地区" } ] }, { "cityCode": "522300", "cityName": "黔西南布依族苗族自治州", "mallAreaList": [ { "areaCode": "522301", "areaName": "兴义市" }, { "areaCode": "522322", "areaName": "兴仁县" }, { "areaCode": "522323", "areaName": "普安县" }, { "areaCode": "522324", "areaName": "晴隆县" }, { "areaCode": "522325", "areaName": "贞丰县" }, { "areaCode": "522326", "areaName": "望谟县" }, { "areaCode": "522327", "areaName": "册亨县" }, { "areaCode": "522328", "areaName": "安龙县" } ] }, { "cityCode": "522400", "cityName": "毕节地区", "mallAreaList": [ { "areaCode": "520502", "areaName": "七星关区" }, { "areaCode": "520521", "areaName": "大方县" }, { "areaCode": "520522", "areaName": "黔西县" }, { "areaCode": "520523", "areaName": "金沙县" }, { "areaCode": "520524", "areaName": "织金县" }, { "areaCode": "520525", "areaName": "纳雍县" }, { "areaCode": "520526", "areaName": "威宁彝族回族苗族自治县" }, { "areaCode": "520527", "areaName": "赫章县" }, { "areaCode": "522400", "areaName": "毕节地区" } ] }, { "cityCode": "522600", "cityName": "黔东南苗族侗族自治州", "mallAreaList": [ { "areaCode": "522601", "areaName": "凯里市" }, { "areaCode": "522622", "areaName": "黄平县" }, { "areaCode": "522623", "areaName": "施秉县" }, { "areaCode": "522624", "areaName": "三穗县" }, { "areaCode": "522625", "areaName": "镇远县" }, { "areaCode": "522626", "areaName": "岑巩县" }, { "areaCode": "522627", "areaName": "天柱县" }, { "areaCode": "522628", "areaName": "锦屏县" }, { "areaCode": "522629", "areaName": "剑河县" }, { "areaCode": "522630", "areaName": "台江县" }, { "areaCode": "522631", "areaName": "黎平县" }, { "areaCode": "522632", "areaName": "榕江县" }, { "areaCode": "522633", "areaName": "从江县" }, { "areaCode": "522634", "areaName": "雷山县" }, { "areaCode": "522635", "areaName": "麻江县" }, { "areaCode": "522636", "areaName": "丹寨县" } ] }, { "cityCode": "522700", "cityName": "黔南布依族苗族自治州", "mallAreaList": [ { "areaCode": "522701", "areaName": "都匀市" }, { "areaCode": "522702", "areaName": "福泉市" }, { "areaCode": "522722", "areaName": "荔波县" }, { "areaCode": "522723", "areaName": "贵定县" }, { "areaCode": "522725", "areaName": "瓮安县" }, { "areaCode": "522726", "areaName": "独山县" }, { "areaCode": "522727", "areaName": "平塘县" }, { "areaCode": "522728", "areaName": "罗甸县" }, { "areaCode": "522729", "areaName": "长顺县" }, { "areaCode": "522730", "areaName": "龙里县" }, { "areaCode": "522731", "areaName": "惠水县" }, { "areaCode": "522732", "areaName": "三都水族自治县" } ] } ] }, { "provinceCode": "530000", "provinceName": "云南省", "mallCityList": [ { "cityCode": "530100", "cityName": "昆明市", "mallAreaList": [ { "areaCode": "530102", "areaName": "五华区" }, { "areaCode": "530103", "areaName": "盘龙区" }, { "areaCode": "530111", "areaName": "官渡区" }, { "areaCode": "530112", "areaName": "西山区" }, { "areaCode": "530113", "areaName": "东川区" }, { "areaCode": "530114", "areaName": "呈贡区" }, { "areaCode": "530122", "areaName": "晋宁县" }, { "areaCode": "530124", "areaName": "富民县" }, { "areaCode": "530125", "areaName": "宜良县" }, { "areaCode": "530126", "areaName": "石林彝族自治县" }, { "areaCode": "530127", "areaName": "嵩明县" }, { "areaCode": "530128", "areaName": "禄劝彝族苗族自治县" }, { "areaCode": "530129", "areaName": "寻甸回族彝族自治县" }, { "areaCode": "530181", "areaName": "安宁市" } ] }, { "cityCode": "530300", "cityName": "曲靖市", "mallAreaList": [ { "areaCode": "530302", "areaName": "麒麟区" }, { "areaCode": "530321", "areaName": "马龙县" }, { "areaCode": "530322", "areaName": "陆良县" }, { "areaCode": "530323", "areaName": "师宗县" }, { "areaCode": "530324", "areaName": "罗平县" }, { "areaCode": "530325", "areaName": "富源县" }, { "areaCode": "530326", "areaName": "会泽县" }, { "areaCode": "530328", "areaName": "沾益县" }, { "areaCode": "530381", "areaName": "宣威市" } ] }, { "cityCode": "530400", "cityName": "玉溪市", "mallAreaList": [ { "areaCode": "530402", "areaName": "红塔区" }, { "areaCode": "530421", "areaName": "江川县" }, { "areaCode": "530422", "areaName": "澄江县" }, { "areaCode": "530423", "areaName": "通海县" }, { "areaCode": "530424", "areaName": "华宁县" }, { "areaCode": "530425", "areaName": "易门县" }, { "areaCode": "530426", "areaName": "峨山彝族自治县" }, { "areaCode": "530427", "areaName": "新平彝族傣族自治县" }, { "areaCode": "530428", "areaName": "元江哈尼族彝族傣族自治县" } ] }, { "cityCode": "530500", "cityName": "保山市", "mallAreaList": [ { "areaCode": "530502", "areaName": "隆阳区" }, { "areaCode": "530521", "areaName": "施甸县" }, { "areaCode": "530522", "areaName": "腾冲县" }, { "areaCode": "530523", "areaName": "龙陵县" }, { "areaCode": "530524", "areaName": "昌宁县" } ] }, { "cityCode": "530600", "cityName": "昭通市", "mallAreaList": [ { "areaCode": "530602", "areaName": "昭阳区" }, { "areaCode": "530621", "areaName": "鲁甸县" }, { "areaCode": "530622", "areaName": "巧家县" }, { "areaCode": "530623", "areaName": "盐津县" }, { "areaCode": "530624", "areaName": "大关县" }, { "areaCode": "530625", "areaName": "永善县" }, { "areaCode": "530626", "areaName": "绥江县" }, { "areaCode": "530627", "areaName": "镇雄县" }, { "areaCode": "530628", "areaName": "彝良县" }, { "areaCode": "530629", "areaName": "威信县" }, { "areaCode": "530630", "areaName": "水富县" } ] }, { "cityCode": "530700", "cityName": "丽江市", "mallAreaList": [ { "areaCode": "530702", "areaName": "古城区" }, { "areaCode": "530721", "areaName": "玉龙纳西族自治县" }, { "areaCode": "530722", "areaName": "永胜县" }, { "areaCode": "530723", "areaName": "华坪县" }, { "areaCode": "530724", "areaName": "宁蒗彝族自治县" } ] }, { "cityCode": "530800", "cityName": "思茅市", "mallAreaList": [ { "areaCode": "530802", "areaName": "思茅区" }, { "areaCode": "530821", "areaName": "宁洱哈尼族彝族自治县" }, { "areaCode": "530822", "areaName": "墨江哈尼族自治县" }, { "areaCode": "530823", "areaName": "景东彝族自治县" }, { "areaCode": "530824", "areaName": "景谷傣族彝族自治县" }, { "areaCode": "530825", "areaName": "镇沅彝族哈尼族拉祜族自治县" }, { "areaCode": "530826", "areaName": "江城哈尼族彝族自治县" }, { "areaCode": "530827", "areaName": "孟连傣族拉祜族佤族自治县" }, { "areaCode": "530828", "areaName": "澜沧拉祜族自治县" }, { "areaCode": "530829", "areaName": "西盟佤族自治县" } ] }, { "cityCode": "530900", "cityName": "临沧市", "mallAreaList": [ { "areaCode": "530902", "areaName": "临翔区" }, { "areaCode": "530921", "areaName": "凤庆县" }, { "areaCode": "530922", "areaName": "云县" }, { "areaCode": "530923", "areaName": "永德县" }, { "areaCode": "530924", "areaName": "镇康县" }, { "areaCode": "530925", "areaName": "双江拉祜族佤族布朗族傣族自治县" }, { "areaCode": "530926", "areaName": "耿马傣族佤族自治县" }, { "areaCode": "530927", "areaName": "沧源佤族自治县" } ] }, { "cityCode": "532300", "cityName": "楚雄彝族自治州", "mallAreaList": [ { "areaCode": "532301", "areaName": "楚雄市" }, { "areaCode": "532322", "areaName": "双柏县" }, { "areaCode": "532323", "areaName": "牟定县" }, { "areaCode": "532324", "areaName": "南华县" }, { "areaCode": "532325", "areaName": "姚安县" }, { "areaCode": "532326", "areaName": "大姚县" }, { "areaCode": "532327", "areaName": "永仁县" }, { "areaCode": "532328", "areaName": "元谋县" }, { "areaCode": "532329", "areaName": "武定县" }, { "areaCode": "532331", "areaName": "禄丰县" } ] }, { "cityCode": "532500", "cityName": "红河哈尼族彝族自治州", "mallAreaList": [ { "areaCode": "532501", "areaName": "个旧市" }, { "areaCode": "532502", "areaName": "开远市" }, { "areaCode": "532503", "areaName": "蒙自市" }, { "areaCode": "532504", "areaName": "弥勒市" }, { "areaCode": "532523", "areaName": "屏边苗族自治县" }, { "areaCode": "532524", "areaName": "建水县" }, { "areaCode": "532525", "areaName": "石屏县" }, { "areaCode": "532527", "areaName": "泸西县" }, { "areaCode": "532528", "areaName": "元阳县" }, { "areaCode": "532529", "areaName": "红河县" }, { "areaCode": "532530", "areaName": "金平苗族瑶族傣族自治县" }, { "areaCode": "532531", "areaName": "绿春县" }, { "areaCode": "532532", "areaName": "河口瑶族自治县" } ] }, { "cityCode": "532600", "cityName": "文山壮族苗族自治州", "mallAreaList": [ { "areaCode": "532601", "areaName": "文山市" }, { "areaCode": "532622", "areaName": "砚山县" }, { "areaCode": "532623", "areaName": "西畴县" }, { "areaCode": "532624", "areaName": "麻栗坡县" }, { "areaCode": "532625", "areaName": "马关县" }, { "areaCode": "532626", "areaName": "丘北县" }, { "areaCode": "532627", "areaName": "广南县" }, { "areaCode": "532628", "areaName": "富宁县" } ] }, { "cityCode": "532800", "cityName": "西双版纳傣族自治州", "mallAreaList": [ { "areaCode": "532801", "areaName": "景洪市" }, { "areaCode": "532822", "areaName": "勐海县" }, { "areaCode": "532823", "areaName": "勐腊县" } ] }, { "cityCode": "532900", "cityName": "大理白族自治州", "mallAreaList": [ { "areaCode": "532901", "areaName": "大理市" }, { "areaCode": "532922", "areaName": "漾濞彝族自治县" }, { "areaCode": "532923", "areaName": "祥云县" }, { "areaCode": "532924", "areaName": "宾川县" }, { "areaCode": "532925", "areaName": "弥渡县" }, { "areaCode": "532926", "areaName": "南涧彝族自治县" }, { "areaCode": "532927", "areaName": "巍山彝族回族自治县" }, { "areaCode": "532928", "areaName": "永平县" }, { "areaCode": "532929", "areaName": "云龙县" }, { "areaCode": "532930", "areaName": "洱源县" }, { "areaCode": "532931", "areaName": "剑川县" }, { "areaCode": "532932", "areaName": "鹤庆县" } ] }, { "cityCode": "533100", "cityName": "德宏傣族景颇族自治州", "mallAreaList": [ { "areaCode": "533102", "areaName": "瑞丽市" }, { "areaCode": "533103", "areaName": "芒市" }, { "areaCode": "533122", "areaName": "梁河县" }, { "areaCode": "533123", "areaName": "盈江县" }, { "areaCode": "533124", "areaName": "陇川县" } ] }, { "cityCode": "533300", "cityName": "怒江傈僳族自治州", "mallAreaList": [ { "areaCode": "533321", "areaName": "泸水县" }, { "areaCode": "533323", "areaName": "福贡县" }, { "areaCode": "533324", "areaName": "贡山独龙族怒族自治县" }, { "areaCode": "533325", "areaName": "兰坪白族普米族自治县" } ] }, { "cityCode": "533400", "cityName": "迪庆藏族自治州", "mallAreaList": [ { "areaCode": "533421", "areaName": "香格里拉县" }, { "areaCode": "533422", "areaName": "德钦县" }, { "areaCode": "533423", "areaName": "维西傈僳族自治县" } ] } ] }, { "provinceCode": "540000", "provinceName": "西藏自治区", "mallCityList": [ { "cityCode": "540100", "cityName": "拉萨市", "mallAreaList": [ { "areaCode": "540102", "areaName": "城关区" }, { "areaCode": "540121", "areaName": "林周县" }, { "areaCode": "540122", "areaName": "当雄县" }, { "areaCode": "540123", "areaName": "尼木县" }, { "areaCode": "540124", "areaName": "曲水县" }, { "areaCode": "540125", "areaName": "堆龙德庆县" }, { "areaCode": "540126", "areaName": "达孜县" }, { "areaCode": "540127", "areaName": "墨竹工卡县" } ] }, { "cityCode": "542100", "cityName": "昌都地区", "mallAreaList": [ { "areaCode": "542121", "areaName": "昌都县" }, { "areaCode": "542122", "areaName": "江达县" }, { "areaCode": "542123", "areaName": "贡觉县" }, { "areaCode": "542124", "areaName": "类乌齐县" }, { "areaCode": "542125", "areaName": "丁青县" }, { "areaCode": "542126", "areaName": "察雅县" }, { "areaCode": "542127", "areaName": "八宿县" }, { "areaCode": "542128", "areaName": "左贡县" }, { "areaCode": "542129", "areaName": "芒康县" }, { "areaCode": "542132", "areaName": "洛隆县" }, { "areaCode": "542133", "areaName": "边坝县" } ] }, { "cityCode": "542200", "cityName": "山南地区", "mallAreaList": [ { "areaCode": "542221", "areaName": "乃东县" }, { "areaCode": "542222", "areaName": "扎囊县" }, { "areaCode": "542223", "areaName": "贡嘎县" }, { "areaCode": "542224", "areaName": "桑日县" }, { "areaCode": "542225", "areaName": "琼结县" }, { "areaCode": "542226", "areaName": "曲松县" }, { "areaCode": "542227", "areaName": "措美县" }, { "areaCode": "542228", "areaName": "洛扎县" }, { "areaCode": "542229", "areaName": "加查县" }, { "areaCode": "542231", "areaName": "隆子县" }, { "areaCode": "542232", "areaName": "错那县" }, { "areaCode": "542233", "areaName": "浪卡子县" } ] }, { "cityCode": "542300", "cityName": "日喀则地区", "mallAreaList": [ { "areaCode": "540202", "areaName": "桑珠孜区" }, { "areaCode": "540221", "areaName": "南木林县" }, { "areaCode": "540222", "areaName": "江孜县" }, { "areaCode": "540223", "areaName": "定日县" }, { "areaCode": "540224", "areaName": "萨迦县" }, { "areaCode": "540225", "areaName": "拉孜县" }, { "areaCode": "540226", "areaName": "昂仁县" }, { "areaCode": "540227", "areaName": "谢通门县" }, { "areaCode": "540228", "areaName": "白朗县" }, { "areaCode": "540229", "areaName": "仁布县" }, { "areaCode": "540230", "areaName": "康马县" }, { "areaCode": "540231", "areaName": "定结县" }, { "areaCode": "540232", "areaName": "仲巴县" }, { "areaCode": "540233", "areaName": "亚东县" }, { "areaCode": "540234", "areaName": "吉隆县" }, { "areaCode": "540235", "areaName": "聂拉木县" }, { "areaCode": "540236", "areaName": "萨嘎县" }, { "areaCode": "540237", "areaName": "岗巴县" }, { "areaCode": "542300", "areaName": "日喀则地区" } ] }, { "cityCode": "542400", "cityName": "那曲地区", "mallAreaList": [ { "areaCode": "542421", "areaName": "那曲县" }, { "areaCode": "542422", "areaName": "嘉黎县" }, { "areaCode": "542423", "areaName": "比如县" }, { "areaCode": "542424", "areaName": "聂荣县" }, { "areaCode": "542425", "areaName": "安多县" }, { "areaCode": "542426", "areaName": "申扎县" }, { "areaCode": "542427", "areaName": "索县" }, { "areaCode": "542428", "areaName": "班戈县" }, { "areaCode": "542429", "areaName": "巴青县" }, { "areaCode": "542430", "areaName": "尼玛县" }, { "areaCode": "542431", "areaName": "双湖县" } ] }, { "cityCode": "542500", "cityName": "阿里地区", "mallAreaList": [ { "areaCode": "542521", "areaName": "普兰县" }, { "areaCode": "542522", "areaName": "札达县" }, { "areaCode": "542523", "areaName": "噶尔县" }, { "areaCode": "542524", "areaName": "日土县" }, { "areaCode": "542525", "areaName": "革吉县" }, { "areaCode": "542526", "areaName": "改则县" }, { "areaCode": "542527", "areaName": "措勤县" } ] }, { "cityCode": "542600", "cityName": "林芝地区", "mallAreaList": [ { "areaCode": "542621", "areaName": "林芝县" }, { "areaCode": "542622", "areaName": "工布江达县" }, { "areaCode": "542623", "areaName": "米林县" }, { "areaCode": "542624", "areaName": "墨脱县" }, { "areaCode": "542625", "areaName": "波密县" }, { "areaCode": "542626", "areaName": "察隅县" }, { "areaCode": "542627", "areaName": "朗县" } ] } ] }, { "provinceCode": "610000", "provinceName": "陕西省", "mallCityList": [ { "cityCode": "610100", "cityName": "西安市", "mallAreaList": [ { "areaCode": "610102", "areaName": "新城区" }, { "areaCode": "610103", "areaName": "碑林区" }, { "areaCode": "610104", "areaName": "莲湖区" }, { "areaCode": "610111", "areaName": "灞桥区" }, { "areaCode": "610112", "areaName": "未央区" }, { "areaCode": "610113", "areaName": "雁塔区" }, { "areaCode": "610114", "areaName": "阎良区" }, { "areaCode": "610115", "areaName": "临潼区" }, { "areaCode": "610116", "areaName": "长安区" }, { "areaCode": "610122", "areaName": "蓝田县" }, { "areaCode": "610124", "areaName": "周至县" }, { "areaCode": "610125", "areaName": "户县" }, { "areaCode": "610126", "areaName": "高陵县" } ] }, { "cityCode": "610200", "cityName": "铜川市", "mallAreaList": [ { "areaCode": "610202", "areaName": "王益区" }, { "areaCode": "610203", "areaName": "印台区" }, { "areaCode": "610204", "areaName": "耀州区" }, { "areaCode": "610222", "areaName": "宜君县" } ] }, { "cityCode": "610300", "cityName": "宝鸡市", "mallAreaList": [ { "areaCode": "610302", "areaName": "渭滨区" }, { "areaCode": "610303", "areaName": "金台区" }, { "areaCode": "610304", "areaName": "陈仓区" }, { "areaCode": "610322", "areaName": "凤翔县" }, { "areaCode": "610323", "areaName": "岐山县" }, { "areaCode": "610324", "areaName": "扶风县" }, { "areaCode": "610326", "areaName": "眉县" }, { "areaCode": "610327", "areaName": "陇县" }, { "areaCode": "610328", "areaName": "千阳县" }, { "areaCode": "610329", "areaName": "麟游县" }, { "areaCode": "610330", "areaName": "凤县" }, { "areaCode": "610331", "areaName": "太白县" } ] }, { "cityCode": "610400", "cityName": "咸阳市", "mallAreaList": [ { "areaCode": "610402", "areaName": "秦都区" }, { "areaCode": "610403", "areaName": "杨陵区" }, { "areaCode": "610404", "areaName": "渭城区" }, { "areaCode": "610422", "areaName": "三原县" }, { "areaCode": "610423", "areaName": "泾阳县" }, { "areaCode": "610424", "areaName": "乾县" }, { "areaCode": "610425", "areaName": "礼泉县" }, { "areaCode": "610426", "areaName": "永寿县" }, { "areaCode": "610427", "areaName": "彬县" }, { "areaCode": "610428", "areaName": "长武县" }, { "areaCode": "610429", "areaName": "旬邑县" }, { "areaCode": "610430", "areaName": "淳化县" }, { "areaCode": "610431", "areaName": "武功县" }, { "areaCode": "610481", "areaName": "兴平市" } ] }, { "cityCode": "610500", "cityName": "渭南市", "mallAreaList": [ { "areaCode": "610502", "areaName": "临渭区" }, { "areaCode": "610521", "areaName": "华县" }, { "areaCode": "610522", "areaName": "潼关县" }, { "areaCode": "610523", "areaName": "大荔县" }, { "areaCode": "610524", "areaName": "合阳县" }, { "areaCode": "610525", "areaName": "澄城县" }, { "areaCode": "610526", "areaName": "蒲城县" }, { "areaCode": "610527", "areaName": "白水县" }, { "areaCode": "610528", "areaName": "富平县" }, { "areaCode": "610581", "areaName": "韩城市" }, { "areaCode": "610582", "areaName": "华阴市" } ] }, { "cityCode": "610600", "cityName": "延安市", "mallAreaList": [ { "areaCode": "610602", "areaName": "宝塔区" }, { "areaCode": "610621", "areaName": "延长县" }, { "areaCode": "610622", "areaName": "延川县" }, { "areaCode": "610623", "areaName": "子长县" }, { "areaCode": "610624", "areaName": "安塞县" }, { "areaCode": "610625", "areaName": "志丹县" }, { "areaCode": "610626", "areaName": "吴起县" }, { "areaCode": "610627", "areaName": "甘泉县" }, { "areaCode": "610628", "areaName": "富县" }, { "areaCode": "610629", "areaName": "洛川县" }, { "areaCode": "610630", "areaName": "宜川县" }, { "areaCode": "610631", "areaName": "黄龙县" }, { "areaCode": "610632", "areaName": "黄陵县" } ] }, { "cityCode": "610700", "cityName": "汉中市", "mallAreaList": [ { "areaCode": "610702", "areaName": "汉台区" }, { "areaCode": "610721", "areaName": "南郑县" }, { "areaCode": "610722", "areaName": "城固县" }, { "areaCode": "610723", "areaName": "洋县" }, { "areaCode": "610724", "areaName": "西乡县" }, { "areaCode": "610725", "areaName": "勉县" }, { "areaCode": "610726", "areaName": "宁强县" }, { "areaCode": "610727", "areaName": "略阳县" }, { "areaCode": "610728", "areaName": "镇巴县" }, { "areaCode": "610729", "areaName": "留坝县" }, { "areaCode": "610730", "areaName": "佛坪县" } ] }, { "cityCode": "610800", "cityName": "榆林市", "mallAreaList": [ { "areaCode": "610802", "areaName": "榆阳区" }, { "areaCode": "610821", "areaName": "神木县" }, { "areaCode": "610822", "areaName": "府谷县" }, { "areaCode": "610823", "areaName": "横山县" }, { "areaCode": "610824", "areaName": "靖边县" }, { "areaCode": "610825", "areaName": "定边县" }, { "areaCode": "610826", "areaName": "绥德县" }, { "areaCode": "610827", "areaName": "米脂县" }, { "areaCode": "610828", "areaName": "佳县" }, { "areaCode": "610829", "areaName": "吴堡县" }, { "areaCode": "610830", "areaName": "清涧县" }, { "areaCode": "610831", "areaName": "子洲县" } ] }, { "cityCode": "610900", "cityName": "安康市", "mallAreaList": [ { "areaCode": "610902", "areaName": "汉滨区" }, { "areaCode": "610921", "areaName": "汉阴县" }, { "areaCode": "610922", "areaName": "石泉县" }, { "areaCode": "610923", "areaName": "宁陕县" }, { "areaCode": "610924", "areaName": "紫阳县" }, { "areaCode": "610925", "areaName": "岚皋县" }, { "areaCode": "610926", "areaName": "平利县" }, { "areaCode": "610927", "areaName": "镇坪县" }, { "areaCode": "610928", "areaName": "旬阳县" }, { "areaCode": "610929", "areaName": "白河县" } ] }, { "cityCode": "611000", "cityName": "商洛市", "mallAreaList": [ { "areaCode": "611002", "areaName": "商州区" }, { "areaCode": "611021", "areaName": "洛南县" }, { "areaCode": "611022", "areaName": "丹凤县" }, { "areaCode": "611023", "areaName": "商南县" }, { "areaCode": "611024", "areaName": "山阳县" }, { "areaCode": "611025", "areaName": "镇安县" }, { "areaCode": "611026", "areaName": "柞水县" } ] } ] }, { "provinceCode": "620000", "provinceName": "甘肃省", "mallCityList": [ { "cityCode": "620100", "cityName": "兰州市", "mallAreaList": [ { "areaCode": "620102", "areaName": "城关区" }, { "areaCode": "620103", "areaName": "七里河区" }, { "areaCode": "620104", "areaName": "西固区" }, { "areaCode": "620105", "areaName": "安宁区" }, { "areaCode": "620111", "areaName": "红古区" }, { "areaCode": "620121", "areaName": "永登县" }, { "areaCode": "620122", "areaName": "皋兰县" }, { "areaCode": "620123", "areaName": "榆中县" } ] }, { "cityCode": "620200", "cityName": "嘉峪关市", "mallAreaList": [ { "areaCode": "620201", "areaName": "嘉峪关市辖区" } ] }, { "cityCode": "620300", "cityName": "金昌市", "mallAreaList": [ { "areaCode": "620302", "areaName": "金川区" }, { "areaCode": "620321", "areaName": "永昌县" } ] }, { "cityCode": "620400", "cityName": "白银市", "mallAreaList": [ { "areaCode": "620402", "areaName": "白银区" }, { "areaCode": "620403", "areaName": "平川区" }, { "areaCode": "620421", "areaName": "靖远县" }, { "areaCode": "620422", "areaName": "会宁县" }, { "areaCode": "620423", "areaName": "景泰县" } ] }, { "cityCode": "620500", "cityName": "天水市", "mallAreaList": [ { "areaCode": "620502", "areaName": "秦州区" }, { "areaCode": "620503", "areaName": "麦积区" }, { "areaCode": "620521", "areaName": "清水县" }, { "areaCode": "620522", "areaName": "秦安县" }, { "areaCode": "620523", "areaName": "甘谷县" }, { "areaCode": "620524", "areaName": "武山县" }, { "areaCode": "620525", "areaName": "张家川回族自治县" } ] }, { "cityCode": "620600", "cityName": "武威市", "mallAreaList": [ { "areaCode": "620602", "areaName": "凉州区" }, { "areaCode": "620621", "areaName": "民勤县" }, { "areaCode": "620622", "areaName": "古浪县" }, { "areaCode": "620623", "areaName": "天祝藏族自治县" } ] }, { "cityCode": "620700", "cityName": "张掖市", "mallAreaList": [ { "areaCode": "620702", "areaName": "甘州区" }, { "areaCode": "620721", "areaName": "肃南裕固族自治县" }, { "areaCode": "620722", "areaName": "民乐县" }, { "areaCode": "620723", "areaName": "临泽县" }, { "areaCode": "620724", "areaName": "高台县" }, { "areaCode": "620725", "areaName": "山丹县" } ] }, { "cityCode": "620800", "cityName": "平凉市", "mallAreaList": [ { "areaCode": "620802", "areaName": "崆峒区" }, { "areaCode": "620821", "areaName": "泾川县" }, { "areaCode": "620822", "areaName": "灵台县" }, { "areaCode": "620823", "areaName": "崇信县" }, { "areaCode": "620824", "areaName": "华亭县" }, { "areaCode": "620825", "areaName": "庄浪县" }, { "areaCode": "620826", "areaName": "静宁县" } ] }, { "cityCode": "620900", "cityName": "酒泉市", "mallAreaList": [ { "areaCode": "620902", "areaName": "肃州区" }, { "areaCode": "620921", "areaName": "金塔县" }, { "areaCode": "620922", "areaName": "瓜州县" }, { "areaCode": "620923", "areaName": "肃北蒙古族自治县" }, { "areaCode": "620924", "areaName": "阿克塞哈萨克族自治县" }, { "areaCode": "620981", "areaName": "玉门市" }, { "areaCode": "620982", "areaName": "敦煌市" } ] }, { "cityCode": "621000", "cityName": "庆阳市", "mallAreaList": [ { "areaCode": "621002", "areaName": "西峰区" }, { "areaCode": "621021", "areaName": "庆城县" }, { "areaCode": "621022", "areaName": "环县" }, { "areaCode": "621023", "areaName": "华池县" }, { "areaCode": "621024", "areaName": "合水县" }, { "areaCode": "621025", "areaName": "正宁县" }, { "areaCode": "621026", "areaName": "宁县" }, { "areaCode": "621027", "areaName": "镇原县" } ] }, { "cityCode": "621100", "cityName": "定西市", "mallAreaList": [ { "areaCode": "621102", "areaName": "安定区" }, { "areaCode": "621121", "areaName": "通渭县" }, { "areaCode": "621122", "areaName": "陇西县" }, { "areaCode": "621123", "areaName": "渭源县" }, { "areaCode": "621124", "areaName": "临洮县" }, { "areaCode": "621125", "areaName": "漳县" }, { "areaCode": "621126", "areaName": "岷县" } ] }, { "cityCode": "621200", "cityName": "陇南市", "mallAreaList": [ { "areaCode": "621202", "areaName": "武都区" }, { "areaCode": "621221", "areaName": "成县" }, { "areaCode": "621222", "areaName": "文县" }, { "areaCode": "621223", "areaName": "宕昌县" }, { "areaCode": "621224", "areaName": "康县" }, { "areaCode": "621225", "areaName": "西和县" }, { "areaCode": "621226", "areaName": "礼县" }, { "areaCode": "621227", "areaName": "徽县" }, { "areaCode": "621228", "areaName": "两当县" } ] }, { "cityCode": "622900", "cityName": "临夏回族自治州", "mallAreaList": [ { "areaCode": "622901", "areaName": "临夏市" }, { "areaCode": "622921", "areaName": "临夏县" }, { "areaCode": "622922", "areaName": "康乐县" }, { "areaCode": "622923", "areaName": "永靖县" }, { "areaCode": "622924", "areaName": "广河县" }, { "areaCode": "622925", "areaName": "和政县" }, { "areaCode": "622926", "areaName": "东乡族自治县" }, { "areaCode": "622927", "areaName": "积石山保安族东乡族撒拉族自治县" } ] }, { "cityCode": "623000", "cityName": "甘南藏族自治州", "mallAreaList": [ { "areaCode": "623001", "areaName": "合作市" }, { "areaCode": "623021", "areaName": "临潭县" }, { "areaCode": "623022", "areaName": "卓尼县" }, { "areaCode": "623023", "areaName": "舟曲县" }, { "areaCode": "623024", "areaName": "迭部县" }, { "areaCode": "623025", "areaName": "玛曲县" }, { "areaCode": "623026", "areaName": "碌曲县" }, { "areaCode": "623027", "areaName": "夏河县" } ] } ] }, { "provinceCode": "630000", "provinceName": "青海省", "mallCityList": [ { "cityCode": "630100", "cityName": "西宁市", "mallAreaList": [ { "areaCode": "630102", "areaName": "城东区" }, { "areaCode": "630103", "areaName": "城中区" }, { "areaCode": "630104", "areaName": "城西区" }, { "areaCode": "630105", "areaName": "城北区" }, { "areaCode": "630121", "areaName": "大通回族土族自治县" }, { "areaCode": "630122", "areaName": "湟中县" }, { "areaCode": "630123", "areaName": "湟源县" } ] }, { "cityCode": "632100", "cityName": "海东地区", "mallAreaList": [ { "areaCode": "632100", "areaName": "海东地区" }, { "areaCode": "632121", "areaName": "平安县" }, { "areaCode": "632122", "areaName": "民和回族土族自治县" }, { "areaCode": "632123", "areaName": "乐都县" }, { "areaCode": "632126", "areaName": "互助土族自治县" }, { "areaCode": "632127", "areaName": "化隆回族自治县" }, { "areaCode": "632128", "areaName": "循化撒拉族自治县" } ] }, { "cityCode": "632200", "cityName": "海北藏族自治州", "mallAreaList": [ { "areaCode": "632221", "areaName": "门源回族自治县" }, { "areaCode": "632222", "areaName": "祁连县" }, { "areaCode": "632223", "areaName": "海晏县" }, { "areaCode": "632224", "areaName": "刚察县" } ] }, { "cityCode": "632300", "cityName": "黄南藏族自治州", "mallAreaList": [ { "areaCode": "632321", "areaName": "同仁县" }, { "areaCode": "632322", "areaName": "尖扎县" }, { "areaCode": "632323", "areaName": "泽库县" }, { "areaCode": "632324", "areaName": "河南蒙古族自治县" } ] }, { "cityCode": "632500", "cityName": "海南藏族自治州", "mallAreaList": [ { "areaCode": "632521", "areaName": "共和县" }, { "areaCode": "632522", "areaName": "同德县" }, { "areaCode": "632523", "areaName": "贵德县" }, { "areaCode": "632524", "areaName": "兴海县" }, { "areaCode": "632525", "areaName": "贵南县" } ] }, { "cityCode": "632600", "cityName": "果洛藏族自治州", "mallAreaList": [ { "areaCode": "632621", "areaName": "玛沁县" }, { "areaCode": "632622", "areaName": "班玛县" }, { "areaCode": "632623", "areaName": "甘德县" }, { "areaCode": "632624", "areaName": "达日县" }, { "areaCode": "632625", "areaName": "久治县" }, { "areaCode": "632626", "areaName": "玛多县" } ] }, { "cityCode": "632700", "cityName": "玉树藏族自治州", "mallAreaList": [ { "areaCode": "632701", "areaName": "玉树市" }, { "areaCode": "632722", "areaName": "杂多县" }, { "areaCode": "632723", "areaName": "称多县" }, { "areaCode": "632724", "areaName": "治多县" }, { "areaCode": "632725", "areaName": "囊谦县" }, { "areaCode": "632726", "areaName": "曲麻莱县" } ] }, { "cityCode": "632800", "cityName": "海西蒙古族藏族自治州", "mallAreaList": [ { "areaCode": "632801", "areaName": "格尔木市" }, { "areaCode": "632802", "areaName": "德令哈市" }, { "areaCode": "632821", "areaName": "乌兰县" }, { "areaCode": "632822", "areaName": "都兰县" }, { "areaCode": "632823", "areaName": "天峻县" } ] } ] }, { "provinceCode": "640000", "provinceName": "宁夏回族自治区", "mallCityList": [ { "cityCode": "640100", "cityName": "银川市", "mallAreaList": [ { "areaCode": "640104", "areaName": "兴庆区" }, { "areaCode": "640105", "areaName": "西夏区" }, { "areaCode": "640106", "areaName": "金凤区" }, { "areaCode": "640121", "areaName": "永宁县" }, { "areaCode": "640122", "areaName": "贺兰县" }, { "areaCode": "640181", "areaName": "灵武市" } ] }, { "cityCode": "640200", "cityName": "石嘴山市", "mallAreaList": [ { "areaCode": "640202", "areaName": "大武口区" }, { "areaCode": "640205", "areaName": "惠农区" }, { "areaCode": "640221", "areaName": "平罗县" } ] }, { "cityCode": "640300", "cityName": "吴忠市", "mallAreaList": [ { "areaCode": "640302", "areaName": "利通区" }, { "areaCode": "640303", "areaName": "红寺堡区" }, { "areaCode": "640323", "areaName": "盐池县" }, { "areaCode": "640324", "areaName": "同心县" }, { "areaCode": "640381", "areaName": "青铜峡市" } ] }, { "cityCode": "640400", "cityName": "固原市", "mallAreaList": [ { "areaCode": "640402", "areaName": "原州区" }, { "areaCode": "640422", "areaName": "西吉县" }, { "areaCode": "640423", "areaName": "隆德县" }, { "areaCode": "640424", "areaName": "泾源县" }, { "areaCode": "640425", "areaName": "彭阳县" } ] }, { "cityCode": "640500", "cityName": "中卫市", "mallAreaList": [ { "areaCode": "640502", "areaName": "沙坡头区" }, { "areaCode": "640521", "areaName": "中宁县" }, { "areaCode": "640522", "areaName": "海原县" } ] } ] }, { "provinceCode": "650000", "provinceName": "新疆维吾尔自治区", "mallCityList": [ { "cityCode": "650100", "cityName": "乌鲁木齐市", "mallAreaList": [ { "areaCode": "650102", "areaName": "天山区" }, { "areaCode": "650103", "areaName": "沙依巴克区" }, { "areaCode": "650104", "areaName": "新市区" }, { "areaCode": "650105", "areaName": "水磨沟区" }, { "areaCode": "650106", "areaName": "头屯河区" }, { "areaCode": "650107", "areaName": "达坂城区" }, { "areaCode": "650109", "areaName": "米东区" }, { "areaCode": "650121", "areaName": "乌鲁木齐县" } ] }, { "cityCode": "650200", "cityName": "克拉玛依市", "mallAreaList": [ { "areaCode": "650202", "areaName": "独山子区" }, { "areaCode": "650203", "areaName": "克拉玛依区" }, { "areaCode": "650204", "areaName": "白碱滩区" }, { "areaCode": "650205", "areaName": "乌尔禾区" } ] }, { "cityCode": "652100", "cityName": "吐鲁番地区", "mallAreaList": [ { "areaCode": "652101", "areaName": "吐鲁番市" }, { "areaCode": "652122", "areaName": "鄯善县" }, { "areaCode": "652123", "areaName": "托克逊县" } ] }, { "cityCode": "652200", "cityName": "哈密地区", "mallAreaList": [ { "areaCode": "652201", "areaName": "哈密市" }, { "areaCode": "652222", "areaName": "巴里坤哈萨克自治县" }, { "areaCode": "652223", "areaName": "伊吾县" } ] }, { "cityCode": "652300", "cityName": "昌吉回族自治州", "mallAreaList": [ { "areaCode": "652301", "areaName": "昌吉市" }, { "areaCode": "652302", "areaName": "阜康市" }, { "areaCode": "652323", "areaName": "呼图壁县" }, { "areaCode": "652324", "areaName": "玛纳斯县" }, { "areaCode": "652325", "areaName": "奇台县" }, { "areaCode": "652327", "areaName": "吉木萨尔县" }, { "areaCode": "652328", "areaName": "木垒哈萨克自治县" } ] }, { "cityCode": "652700", "cityName": "博尔塔拉蒙古自治州", "mallAreaList": [ { "areaCode": "652701", "areaName": "博乐市" }, { "areaCode": "652702", "areaName": "阿拉山口市" }, { "areaCode": "652722", "areaName": "精河县" }, { "areaCode": "652723", "areaName": "温泉县" } ] }, { "cityCode": "652800", "cityName": "巴音郭楞蒙古自治州", "mallAreaList": [ { "areaCode": "652801", "areaName": "库尔勒市" }, { "areaCode": "652822", "areaName": "轮台县" }, { "areaCode": "652823", "areaName": "尉犁县" }, { "areaCode": "652824", "areaName": "若羌县" }, { "areaCode": "652825", "areaName": "且末县" }, { "areaCode": "652826", "areaName": "焉耆回族自治县" }, { "areaCode": "652827", "areaName": "和静县" }, { "areaCode": "652828", "areaName": "和硕县" }, { "areaCode": "652829", "areaName": "博湖县" } ] }, { "cityCode": "652900", "cityName": "阿克苏地区", "mallAreaList": [ { "areaCode": "652901", "areaName": "阿克苏市" }, { "areaCode": "652922", "areaName": "温宿县" }, { "areaCode": "652923", "areaName": "库车县" }, { "areaCode": "652924", "areaName": "沙雅县" }, { "areaCode": "652925", "areaName": "新和县" }, { "areaCode": "652926", "areaName": "拜城县" }, { "areaCode": "652927", "areaName": "乌什县" }, { "areaCode": "652928", "areaName": "阿瓦提县" }, { "areaCode": "652929", "areaName": "柯坪县" } ] }, { "cityCode": "653000", "cityName": "克孜勒苏柯尔克孜自治州", "mallAreaList": [ { "areaCode": "653001", "areaName": "阿图什市" }, { "areaCode": "653022", "areaName": "阿克陶县" }, { "areaCode": "653023", "areaName": "阿合奇县" }, { "areaCode": "653024", "areaName": "乌恰县" } ] }, { "cityCode": "653100", "cityName": "喀什地区", "mallAreaList": [ { "areaCode": "653101", "areaName": "喀什市" }, { "areaCode": "653121", "areaName": "疏附县" }, { "areaCode": "653122", "areaName": "疏勒县" }, { "areaCode": "653123", "areaName": "英吉沙县" }, { "areaCode": "653124", "areaName": "泽普县" }, { "areaCode": "653125", "areaName": "莎车县" }, { "areaCode": "653126", "areaName": "叶城县" }, { "areaCode": "653127", "areaName": "麦盖提县" }, { "areaCode": "653128", "areaName": "岳普湖县" }, { "areaCode": "653129", "areaName": "伽师县" }, { "areaCode": "653130", "areaName": "巴楚县" }, { "areaCode": "653131", "areaName": "塔什库尔干塔吉克自治县" } ] }, { "cityCode": "653200", "cityName": "和田地区", "mallAreaList": [ { "areaCode": "653201", "areaName": "和田市" }, { "areaCode": "653221", "areaName": "和田县" }, { "areaCode": "653222", "areaName": "墨玉县" }, { "areaCode": "653223", "areaName": "皮山县" }, { "areaCode": "653224", "areaName": "洛浦县" }, { "areaCode": "653225", "areaName": "策勒县" }, { "areaCode": "653226", "areaName": "于田县" }, { "areaCode": "653227", "areaName": "民丰县" } ] }, { "cityCode": "654000", "cityName": "伊犁哈萨克自治州", "mallAreaList": [ { "areaCode": "654002", "areaName": "伊宁市" }, { "areaCode": "654003", "areaName": "奎屯市" }, { "areaCode": "654021", "areaName": "伊宁县" }, { "areaCode": "654022", "areaName": "察布查尔锡伯自治县" }, { "areaCode": "654023", "areaName": "霍城县" }, { "areaCode": "654024", "areaName": "巩留县" }, { "areaCode": "654025", "areaName": "新源县" }, { "areaCode": "654026", "areaName": "昭苏县" }, { "areaCode": "654027", "areaName": "特克斯县" }, { "areaCode": "654028", "areaName": "尼勒克县" } ] }, { "cityCode": "654200", "cityName": "塔城地区", "mallAreaList": [ { "areaCode": "654201", "areaName": "塔城市" }, { "areaCode": "654202", "areaName": "乌苏市" }, { "areaCode": "654221", "areaName": "额敏县" }, { "areaCode": "654223", "areaName": "沙湾县" }, { "areaCode": "654224", "areaName": "托里县" }, { "areaCode": "654225", "areaName": "裕民县" }, { "areaCode": "654226", "areaName": "和布克赛尔蒙古自治县" } ] }, { "cityCode": "654300", "cityName": "阿勒泰地区", "mallAreaList": [ { "areaCode": "654301", "areaName": "阿勒泰市" }, { "areaCode": "654321", "areaName": "布尔津县" }, { "areaCode": "654322", "areaName": "富蕴县" }, { "areaCode": "654323", "areaName": "福海县" }, { "areaCode": "654324", "areaName": "哈巴河县" }, { "areaCode": "654325", "areaName": "青河县" }, { "areaCode": "654326", "areaName": "吉木乃县" } ] }, { "cityCode": "659000", "cityName": "省直辖行政单位", "mallAreaList": [ { "areaCode": "659001", "areaName": "石河子市" }, { "areaCode": "659002", "areaName": "阿拉尔市" }, { "areaCode": "659003", "areaName": "图木舒克市" } ] } ] }, { "provinceCode": "710000", "provinceName": "台湾省", "mallCityList": [] }, { "provinceCode": "810000", "provinceName": "香港特别行政区", "mallCityList": [] }, { "provinceCode": "820000", "provinceName": "澳门特别行政区", "mallCityList": [] } ];
import { useEffect } from "react"; import { Link, Redirect } from "react-router-dom"; import { FaGithub } from "react-icons/fa"; import { VscLoading } from "react-icons/vsc"; import Cookies from "js-cookie"; import jwt_decode from "jwt-decode"; import { githubClientID } from "./../../utils/constants"; import "./index.css"; export default function Login(props) { const { authState, setAuthState } = props; useEffect(() => { // After requesting Github access, Github redirects back to your app with a code parameter const url = window.location.href; const hasCode = url.includes("?code="); // If Github API returns the code parameter if (hasCode) { const newUrl = url.split("?code="); window.history.pushState({}, null, newUrl[0]); setAuthState({ ...authState, inProgress: true }); const requestData = { code: newUrl[1], }; const proxy_url = `/api/login`; // Use code parameter and other parameters to make POST request to proxy_server fetch(proxy_url, { method: "POST", body: JSON.stringify(requestData), headers: { "Content-Type": "application/json", }, }) .then((response) => response.json()) .then((data) => { Cookies.set("rc_token", data.data.rc_token, { sameSite: "None", secure: true, }); Cookies.set("rc_uid", data.data.rc_uid, { sameSite: "None", secure: true, }); Cookies.set("rc4git_token", data.data.rc4git_token, { sameSite: "None", secure: true, }); Cookies.set("gh_login_token", data.data.gh_login_token); setAuthState({ user: jwt_decode(data.data.rc4git_token), isLoggedIn: true, inProgress: false, }); }) .catch((error) => { setAuthState({ user: {}, isLoggedIn: false, inProgress: false, }); }); } }); if (props.authState.isLoggedIn) { return <Redirect to="/" />; } return ( <div className="login-screen"> <header className="login-header"> <Link to="/"> <img className="login-logo" src="/logo.svg" alt="RC-logo"></img> </Link> </header> <div className={ authState.inProgress ? "login-card cursor-disabled" : "login-card" } > {authState.inProgress ? ( <div className="login-button login-button-github"> <FaGithub /> <VscLoading /> </div> ) : ( <a className="login-button login-button-github" href={`https://github.com/login/oauth/authorize?client_id=${githubClientID}`} > <FaGithub /> Login with github </a> )} </div> <div className="login-terms"> <div className="powered-by"> {"Powered by "}{" "} <a href="https://rocket.chat" target="_blank" rel="noreferrer"> Open Source Chat Platform Rocket.Chat </a> . </div> </div> </div> ); }
import _ from 'lodash' import shortid from 'shortid' const orderBucketSize = 200 function generateOrderBuckets({ orders }) { const buckets = [] const bucketCount = Math.trunc(orders.length / orderBucketSize) + 1 for(let i = 0; i < bucketCount; ++i) { // test const bucketContents = orders.slice(i * orderBucketSize, (i + 1) * orderBucketSize) const price = _.meanBy(bucketContents, order => order.price) const size = _.sumBy(bucketContents, order => order.size) buckets.push({ price, size, orders: bucketContents, _key: shortid.generate() }) } return buckets } export default class OrderBookViewModel { constructor({ orderBook }) { this.descendingAskBuckets = generateOrderBuckets({ orders: orderBook.descendingAsks }) this.descendingBidBuckets = generateOrderBuckets({ orders: orderBook.descendingBids }) if(orderBook.descendingAsks.length > 0 && orderBook.descendingBids.length > 0) { this.midpointPrice = _.mean([orderBook.descendingAsks[orderBook.descendingAsks.length - 1].price, orderBook.descendingBids[0].price]) } else { this.midpointPrice = 0 } } }
/* global describe, it */ 'use strict'; var chai = require('chai'); var expect = chai.expect; var extract = require('../src/keywords').extract; describe('keywords', function() { it('can extract and reverse keywords', function() { expect( extract(['ONE', 'TWO']) ).to.deep.equal(['ONE', 'TWO']); }); it('reverses the nature of things', function() { expect( extract(['LOVE', 'TWO']) ).to.deep.equal(['HATE', 'TWO']); }); it('ignores number starting things', function() { expect( extract(['1FOREVER', 'TWO']) ).to.deep.equal(['TWO']); }); it('ignores banned words', function() { expect( extract(['ONE', 'ABILITY']) ).to.deep.equal(['ONE']); }); it('returns some greetings if nothing else is given', function() { expect( extract() ).to.include('HI'); }); });
webpackJsonpjwplayer([4],{17:function(e,t,i){var n,r;n=[i(8)],r=function(e){function t(e){e||i()}function i(){throw new Error("Invalid DFXP file")}var n=e.seconds;return function(r){t(r);var a=[],s=r.getElementsByTagName("p");t(s),s.length||(s=r.getElementsByTagName("tt:p"),s.length||(s=r.getElementsByTagName("tts:p")));for(var o=0;o<s.length;o++){var c=s[o],u=c.innerHTML||c.textContent||c.text||"",d=e.trim(u).replace(/>\s+</g,"><").replace(/tts?:/g,"");if(d){var l=c.getAttribute("begin"),h=c.getAttribute("dur"),f=c.getAttribute("end"),g={begin:n(l),text:d};f?g.end=n(f):h&&(g.end=g.begin+n(h)),a.push(g)}}return a.length||i(),a}}.apply(t,n),!(void 0!==r&&(e.exports=r))},18:function(e,t,i){var n,r;n=[i(1),i(21),i(2),i(14),i(19),i(17)],r=function(e,t,n,r,a,s){function o(e){if(this._currentTextTrackIndex=-1,e){if(this._textTracks||w.call(this),e.length){var t=0,i=e.length;for(t;t<i;t++){var n=e[t];if(n._id||("captions"===n.kind||"metadata"===n.kind?n._id="native"+n.kind:n._id=m.call(this,n),n.inuse=!0),n.inuse&&!this._tracksById[n._id])if("metadata"===n.kind)n.mode="showing",n.oncuechange=D.bind(this),this._tracksById[n._id]=n;else if(x(n.kind)){var r,a=n.mode;if(n.mode="hidden",!n.cues.length&&n.embedded)continue;if(n.mode=a,this._cuesByTrackId[n._id]&&!this._cuesByTrackId[n._id].loaded){for(var s=this._cuesByTrackId[n._id].cues;r=s.pop();)n.addCue(r);n.mode=a,this._cuesByTrackId[n._id].loaded=!0}I.call(this,n)}}}this._renderNatively&&this.addTracksListener(this.video.textTracks,"change",p.bind(this)),this._textTracks.length&&this.trigger("subtitlesTracks",{tracks:this._textTracks})}}function c(e){this._renderNatively=b(this.getName().name),!this.isSDK&&e&&(C.call(this,e)||(this._renderNatively&&(T.call(this),S.call(this)),this.itemTracks=e,y.call(this,e)))}function u(){return this._currentTextTrackIndex}function d(t){this._textTracks&&(0===t&&e.each(this._textTracks,function(e){e.mode="disabled"}),this._currentTextTrackIndex!==t-1&&(T.call(this),this._currentTextTrackIndex=t-1,this._renderNatively&&(this._textTracks[this._currentTextTrackIndex]&&(this._textTracks[this._currentTextTrackIndex].mode="showing"),this.trigger("subtitlesTrackChanged",{currentTrack:this._currentTextTrackIndex+1,tracks:this._textTracks}))))}function l(e){if(e.text&&e.begin&&e.end){var t=e.trackid.toString(),i=this._tracksById&&this._tracksById[t];i||(this._renderNatively=b(this.getName().name),i={kind:"captions",_id:t,data:[]},y.call(this,[i]),this.trigger("subtitlesTracks",{tracks:this._textTracks}));var n;e.useDTS&&(i.source||(i.source=e.source||"mpegts")),n=e.begin+"_"+e.text;var r=this._metaCuesByTextTime[n];if(!r){r={begin:e.begin,end:e.end,text:e.text},this._metaCuesByTextTime[n]=r;var a=N([r])[0];i.data.push(a)}}}function h(e){var t="native"+e.type,i=this._tracksById[t],n="captions"===e.type?"Unknown CC":"ID3 Metadata";if(!i){this._renderNatively=b(this.getName().name);var r={kind:e.type,_id:t,label:n,embedded:!0};i=E.call(this,r),this.setTextTracks(this.video.textTracks)}i.addCue(e.cue)}function f(e){var t=this._tracksById[e.name];if(t){t.source=e.source;for(var i=e.captions||[],n=[],r=!1,a=0;a<i.length;a++){var s=i[a],o=e.name+"_"+s.begin+"_"+s.end;this._metaCuesByTextTime[o]||(this._metaCuesByTextTime[o]=s,n.push(s),r=!0)}r&&n.sort(function(e,t){return e.begin-t.begin});var c=N(n);Array.prototype.push.apply(t.data,c)}}function g(e,t,i){e&&(i=i.bind(this),e.addEventListener?e.addEventListener(t,i):e["on"+t]=i)}function k(e,t,i){e&&(e.removeEventListener?e.removeEventListener(t,i):e["on"+t]=null)}function v(){this._textTracks=null,this._tracksById=null,this._cuesByTrackId=null,this._metaCuesByTextTime=null,this._unknownCount=0,this._activeCuePosition=null,this._renderNatively&&_.call(this,this.video.textTracks),this._renderNatively=!1}function T(){this._textTracks&&this._textTracks[this._currentTextTrackIndex]&&(this._textTracks[this._currentTextTrackIndex].mode="disabled")}function p(){var t=this.video.textTracks,i=e.filter(t,function(e){return(e.inuse||!e._id)&&x(e.kind)});(!this._textTracks||i.length>this._textTracks.length)&&this.setTextTracks.call(this,t);var n=-1,r=0;for(r;r<this._textTracks.length;r++)if("showing"===this._textTracks[r].mode){n=r;break}n!==this._currentTextTrackIndex&&this.setSubtitlesTrack.call(this,n+1)}function y(e){if(e){this._textTracks||w.call(this),this._renderNatively=b(this.getName().name);for(var t=0;t<e.length;t++){var i=e[t];if(!i.kind||x(i.kind)){var n=E.call(this,i);I.call(this,n),i.file&&L.call(this,i,n)}}!this._renderNatively&&this._textTracks&&this._textTracks.length&&this.trigger("subtitlesTracks",{tracks:this._textTracks})}}function m(e){var t,i=e.kind||"cc";return t=e["default"]||e.defaulttrack?"default":e._id||e.name||e.file||e.label||i+this._textTracks.length}function _(t){t.length&&e.each(t,function(e){for(e.mode="hidden";e.cues.length;)e.removeCue(e.cues[0]);e.mode="disabled",e.inuse=!1})}function b(e){return e.indexOf("flash")===-1&&(n.isChrome()||n.isIOS()||n.isSafari())}function x(e){return"subtitles"===e||"captions"===e}function w(){this._textTracks=[],this._tracksById={},this._metaCuesByTextTime={},this._cuesByTrackId={},this._unknownCount=0,this._renderNatively=!1}function E(t){var i,n=A.call(this,t);if(this._renderNatively){var r=this.video.textTracks;i=e.findWhere(r,{label:n}),i?(i.kind=t.kind,i.label=n,i.language=t.language||""):i=this.video.addTextTrack(t.kind,n,t.language||""),i["default"]=t["default"],i.mode="disabled",i.inuse=!0}else i=t,i.data=i.data||[];return i._id||(i._id=m.call(this,t)),i}function A(e){var t=e.label||e.name||e.language;return t||(t="Unknown CC",this._unknownCount++,this._unknownCount>1&&(t+=" ["+this._unknownCount+"]")),t}function I(e){this._textTracks.push(e),this._tracksById[e._id]=e}function L(e,t){n.ajax(e.file,function(e){P.call(this,e,t)}.bind(this),R)}function C(e){var t=this._textTracks,i=!0;return this._renderNatively&&t&&t.length&&(i=t[0].inuse),e===this.itemTracks&&t&&t.length>=e.length&&i}function S(){if(this._textTracks){var t=e.filter(this._textTracks,function(e){return e.embedded||"subs"===e.groupid});w.call(this),e.each(t,function(e){this._tracksById[e._id]=e}),this._textTracks=t}}function M(e,t){if(this._renderNatively){var i=this._tracksById[e._id];if(!i)return this._cuesByTrackId||(this._cuesByTrackId={}),void(this._cuesByTrackId[e._id]={cues:t,loaded:!1});if(this._cuesByTrackId[e._id]&&this._cuesByTrackId[e._id].loaded)return;var n;for(this._cuesByTrackId[e._id]={cues:t,loaded:!0};n=t.pop();)i.addCue(n)}else e.data=t}function N(t){var i=window.VTTCue,n=e.map(t,function(e){return new i(e.begin,e.end,e.text)});return n}function B(e,t){i.e(11,function(require){var n=i(13),r=new n(window);r.oncue=function(e){this._renderNatively?t.addCue(e):(t.data=t.data||[],t.data.push(e))}.bind(this),r.onparsingerror=function(e){R(e)},r.onflush=function(){},r.parse(e),r.flush()}.bind(this))}function D(i){var n=i.currentTarget.activeCues;if(n&&n.length){var r=n[n.length-1].startTime;if(this._activeCuePosition!==r){var a=[];if(e.each(n,function(e){e.startTime<r||(e.data||e.value?a.push(e):e.text&&this.trigger("meta",{metadataTime:r,metadata:JSON.parse(e.text)}))},this),a.length){var s=t.parseID3(a);this.trigger("meta",{metadataTime:r,metadata:s})}this._activeCuePosition=r}}}function P(e,t){var i,o=e.responseXML?e.responseXML.firstChild:null;if(o)for("xml"===r.localName(o)&&(o=o.nextSibling);o.nodeType===o.COMMENT_NODE;)o=o.nextSibling;try{i=o&&"tt"===r.localName(o)?n.tryCatch(function(){var i=s(e.responseXML),n=N(i);M.call(this,t,n)}.bind(this)):n.tryCatch(function(){var i=e.responseText;if(i.indexOf("WEBVTT")>=0)B.call(this,e.responseText,t);else{var n=a(e.responseText),r=N(n);M.call(this,t,r)}}.bind(this))}catch(c){i instanceof n.Error&&R(i.message+": "+t.file)}}function R(e){n.log("CAPTIONS("+e+")")}var O={_textTracks:null,_tracksById:null,_cuesByTrackId:null,_metaCuesByTextTime:null,_currentTextTrackIndex:-1,_unknownCount:0,_renderNatively:!1,_activeCuePosition:null,addTracksListener:g,clearTracks:v,disableTextTrack:T,getSubtitlesTrack:u,removeTracksListener:k,addTextTracks:y,setTextTracks:o,setupSideloadedTracks:c,setSubtitlesTrack:d,textTrackChangeHandler:p,addCuesToTrack:f,addCaptionsCue:l,addVTTCue:h};return O}.apply(t,n),!(void 0!==r&&(e.exports=r))},88:function(e,t,i){var n,r;n=[i(176),i(74)],r=function(e,t){function i(e){var i,a=window.WebKitMediaKeys,s=e.target,o=e.initData;if(!s.webkitKeys){if(!a.isTypeSupported||!a.isTypeSupported("com.apple.fps.1_0","video/mp4"))throw a.isTypeSupported?"Key System not supported":"WebKitMediaKeys.isTypeSupported is not supported";s.webkitSetMediaKeys(new a("com.apple.fps.1_0"))}if(!s.webkitKeys)throw"Could not create MediaKeys";i=s.__drm,t.ajax(i.fairplay.keyUrl,function(e){var t=new Uint8Array(e.response),r=u(o);o=d(o,r,t),n(s,o,r,i.fairplay.url)},r,{responseType:"arraybuffer"})}function n(e,t,i,n){if(k=e.webkitKeys.createSession("video/mp4",t),!k)throw"Could not create key session";k.contentId=i,k.__spcUrl=n,h(k,"webkitkeymessage",a),l(k,"webkitkeymessage",a),h(k,"webkitkeyadded",c),l(k,"webkitkeyadded",c),h(k,"webkitkeyerror",o),l(k,"webkitkeyerror",o)}function r(){console.warn("Failed to retrieve the server certificate.")}function a(e){var t=e.target,i=e.message,n=new Blob([i],{type:"application/octet-binary"}),r=new XMLHttpRequest;r.session=t,r.open("POST",t.__spcUrl+"?p1="+Date.now(),!0),r.setRequestHeader("Content-type","application/octet-stream"),r.responseType="blob",r.addEventListener("load",s,!1),r.send(n)}function s(e){var t=e.target,i=t.response,n=new FileReader;200===t.status&&(n.addEventListener("loadend",function(){var e=new Uint8Array(n.result);t.session.update(e)}),n.readAsArrayBuffer(i))}function o(){console.error("A decryption key error was encountered")}function c(){console.info("Decryption key was added to session.")}function u(e){var t,i=g(e),n=i.split("://",1),r=n[0].slice(-3);return n=i.split(";",2),t=n.length>1?n[1]:"","skd"===r.toLowerCase()?t:""}function d(e,t,i){var n,r,a,s,o,c;return"string"==typeof t&&(t=f(t)),n=0,r=new ArrayBuffer(e.byteLength+4+t.byteLength+4+i.byteLength),a=new DataView(r),s=new Uint8Array(r,n,e.byteLength),s.set(e),n+=e.byteLength,a.setUint32(n,t.byteLength,!0),n+=4,o=new Uint16Array(r,n,t.length),o.set(t),n+=o.byteLength,a.setUint32(n,i.byteLength,!0),n+=4,c=new Uint8Array(r,n,i.byteLength),c.set(i),new Uint8Array(r,0,r.byteLength)}function l(e,t,i){e.addEventListener(t,i,!1)}function h(e,t,i){e&&e.removeEventListener(t,i)}function f(e){for(var t=new ArrayBuffer(2*e.length),i=new Uint16Array(t),n=0,r=e.length;n<r;n++)i[n]=e.charCodeAt(n);return i}function g(e){var t=new Uint16Array(e.buffer);return String.fromCharCode.apply(null,t)}var k,v=function(t,n){e.call(this,t,n);var r=this.init,s=this.load,u=this.destroy;this.init=function(e){this.setupItem(e),r.call(this,e)},this.load=function(e){this.setupItem(e),s.call(this,e)},this.setupItem=function(e){var t=e.sources[0].drm;t&&(this.video.__drm=this.drm=t,h(this.video,"webkitneedkey",i),l(this.video,"webkitneedkey",i))},this.destroy=function(e){h(this.video,"webkitneedkey",i),h(k,"webkitkeymessage",a),h(k,"webkitkeyadded",c),h(k,"webkitkeyerror",o),u.call(this,e)}};return v.getName=e.getName,v}.apply(t,n),!(void 0!==r&&(e.exports=r))},176:function(e,t,i){var n,r;n=[i(29),i(2),i(76),i(1),i(4),i(5),i(20),i(3),i(18)],r=function(e,t,i,n,r,a,s,o,c){function u(e,i){t.foreach(e,function(e,t){i.addEventListener(e,t,!1)})}function d(e,i){t.foreach(e,function(e,t){i.removeEventListener(e,t,!1)})}function l(e){if("hls"===e.type)if(e.androidhls!==!1){var i=t.isAndroidNative;if(i(2)||i(3)||i("4.0"))return!1;if(t.isAndroid())return!0}else if(t.isAndroid())return!1;return null}function h(h,x){function w(){xe&&(oe(Pe.audioTracks),Te.setTextTracks(Pe.textTracks),Pe.setAttribute("jw-loaded","data"))}function E(){xe&&Pe.setAttribute("jw-loaded","started")}function A(e){Te.trigger("click",e)}function I(){xe&&!Ee&&(D(B()),M(ee(),ge,fe))}function L(){xe&&M(ee(),ge,fe)}function C(){f(_e),ye=!0,xe&&(Te.state===a.STALLED?Te.setState(a.PLAYING):Te.state===a.PLAYING&&(_e=setTimeout($,g)),Ee&&Pe.duration===1/0&&0===Pe.currentTime||(D(B()),N(Pe.currentTime),M(ee(),ge,fe),Te.state===a.PLAYING&&(Te.trigger(r.JWPLAYER_MEDIA_TIME,{position:ge,duration:fe}),S())))}function S(){var e=Be.level;if(e.width!==Pe.videoWidth||e.height!==Pe.videoHeight){if(e.width=Pe.videoWidth,e.height=Pe.videoHeight,le(),!e.width||!e.height)return;Be.reason=Be.reason||"auto",Be.mode="hls"===ve[we].type?"auto":"manual",Be.bitrate=0,e.index=we,e.label=ve[we].label,Te.trigger("visualQuality",Be),Be.reason=""}}function M(e,t,i){e===be&&i===fe||(be=e,Te.trigger(r.JWPLAYER_MEDIA_BUFFER,{bufferPercent:100*e,position:t,duration:i}))}function N(e){fe<0&&(e=-(X()-e)),ge=e}function B(){var e=Pe.duration,t=X();if(e===1/0&&t){var i=t-Pe.seekable.start(0);i!==1/0&&i>120&&(e=-i)}return e}function D(e){fe=e,me&&e&&e!==1/0&&Te.seek(me)}function P(){var e=B();Ee&&e===1/0&&(e=0),Te.trigger(r.JWPLAYER_MEDIA_META,{duration:e,height:Pe.videoHeight,width:Pe.videoWidth}),D(e)}function R(){xe&&(ye=!0,Ee||le(),F())}function O(){xe&&(Pe.muted&&(Pe.muted=!1,Pe.muted=!0),Pe.setAttribute("jw-loaded","meta"),P())}function F(){ke||(ke=!0,Te.trigger(r.JWPLAYER_MEDIA_BUFFER_FULL))}function W(){Te.setState(a.PLAYING),Pe.hasAttribute("jw-played")||Pe.setAttribute("jw-played",""),Te.trigger(r.JWPLAYER_PROVIDER_FIRST_FRAME,{})}function j(){Te.state!==a.COMPLETE&&Pe.currentTime!==Pe.duration&&Te.setState(a.PAUSED)}function U(){Ee||Pe.paused||Pe.ended||Te.state!==a.LOADING&&Te.state!==a.ERROR&&(Te.seeking||Te.setState(a.STALLED))}function Y(){xe&&(t.log("Error playing media: %o %s",Pe.error,Pe.src),Te.trigger(r.JWPLAYER_MEDIA_ERROR,{message:"Error loading media: File could not be played"}))}function H(e){var i;return"array"===t.typeOf(e)&&e.length>0&&(i=n.map(e,function(e,t){return{label:e.label||t}})),i}function J(e){ve=e,we=K(e);var t=H(e);t&&Te.trigger(r.JWPLAYER_MEDIA_LEVELS,{levels:t,currentQuality:we})}function K(e){var t=Math.max(0,we),i=x.qualityLabel;if(e)for(var n=0;n<e.length;n++)if(e[n]["default"]&&(t=n),i&&e[n].label===i)return n;return Be.reason="initial choice",Be.level={},t}function G(e,i){me=0,f(_e);var n=document.createElement("source");n.src=ve[we].file;var r=Pe.src!==n.src,s=Pe.getAttribute("jw-loaded"),o=Pe.hasAttribute("jw-played");r||"none"===s||"started"===s?(fe=i,V(ve[we]),Te.setupSideloadedTracks(Ne),Pe.load()):(0===e&&Pe.currentTime>0&&(me=-1,Te.seek(e)),Pe.play()),ge=Pe.currentTime,T&&!o&&(F(),Pe.paused||Te.state===a.PLAYING||Te.setState(a.LOADING)),t.isIOS()&&Te.getFullScreen()&&(Pe.controls=!0),e>0&&Te.seek(e)}function V(e){Ce=null,Se=-1,Me=-1,Be.reason||(Be.reason="initial choice",Be.level={}),ye=!1,ke=!1,Ee=l(e),e.preload&&e.preload!==Pe.getAttribute("preload")&&Pe.setAttribute("preload",e.preload);var t=document.createElement("source");t.src=e.file;var i=Pe.src!==t.src;i&&(Pe.setAttribute("jw-loaded","none"),Pe.src=e.file)}function Q(){Pe&&(Te.disableTextTrack(),Pe.removeAttribute("crossorigin"),Pe.removeAttribute("preload"),Pe.removeAttribute("src"),Pe.removeAttribute("jw-loaded"),Pe.removeAttribute("jw-played"),i.emptyElement(Pe),we=-1,Ne=null,Te.clearTracks(),!v&&"load"in Pe&&Pe.load())}function q(){for(var e=Pe.seekable?Pe.seekable.length:0,t=1/0;e--;)t=Math.min(t,Pe.seekable.start(e));return t}function X(){for(var e=Pe.seekable?Pe.seekable.length:0,t=0;e--;)t=Math.max(t,Pe.seekable.end(e));return t}function z(){Te.seeking=!1,Te.trigger(r.JWPLAYER_MEDIA_SEEKED)}function Z(){Te.trigger("volume",{volume:Math.round(100*Pe.volume)}),Te.trigger("mute",{mute:Pe.muted})}function $(){Pe.currentTime===ge&&U()}function ee(){var e=Pe.buffered,i=Pe.duration;return!e||0===e.length||i<=0||i===1/0?0:t.between(e.end(e.length-1)/i,0,1)}function te(){if(xe&&Te.state!==a.IDLE&&Te.state!==a.COMPLETE){if(f(_e),we=-1,Ie=!0,Te.trigger(r.JWPLAYER_MEDIA_BEFORECOMPLETE),!xe)return;ie()}}function ie(){f(_e),Te.setState(a.COMPLETE),Ie=!1,Te.trigger(r.JWPLAYER_MEDIA_COMPLETE)}function ne(e){Le=!0,se(e),t.isIOS()&&(Pe.controls=!1)}function re(){for(var e=-1,t=0;t<Pe.audioTracks.length;t++)if(Pe.audioTracks[t].enabled){e=t;break}ce(e)}function ae(e){Le=!1,se(e),t.isIOS()&&(Pe.controls=!1)}function se(e){Te.trigger("fullscreenchange",{target:e.target,jwstate:Le})}function oe(e){if(Ce=null,e){if(e.length){for(var t=0;t<e.length;t++)if(e[t].enabled){Se=t;break}Se===-1&&(Se=0,e[Se].enabled=!0),Ce=n.map(e,function(e){var t={name:e.label||e.language,language:e.language};return t})}Te.addTracksListener(e,"change",re),Ce&&Te.trigger("audioTracks",{currentTrack:Se,tracks:Ce})}}function ce(e){Pe&&Pe.audioTracks&&Ce&&e>-1&&e<Pe.audioTracks.length&&e!==Se&&(Pe.audioTracks[Se].enabled=!1,Se=e,Pe.audioTracks[Se].enabled=!0,Te.trigger("audioTrackChanged",{currentTrack:Se,tracks:Ce}))}function ue(){return Ce||[]}function de(){return Se}function le(){if("hls"===ve[0].type){var e="video";0===Pe.videoHeight&&(e="audio"),Te.trigger("mediaType",{mediaType:e})}}this.state=a.IDLE,this.seeking=!1,n.extend(this,o,c),this.trigger=function(e,t){if(xe)return o.trigger.call(this,e,t)},this.setState=function(e){if(xe)return s.setState.call(this,e)};var he,fe,ge,ke,ve,Te=this,pe={click:A,durationchange:I,ended:te,error:Y,loadstart:E,loadeddata:w,loadedmetadata:O,canplay:R,playing:W,progress:L,pause:j,seeked:z,timeupdate:C,volumechange:Z,webkitbeginfullscreen:ne,webkitendfullscreen:ae},ye=!1,me=0,_e=-1,be=-1,xe=!0,we=-1,Ee=null,Ae=!!x.sdkplatform,Ie=!1,Le=!1,Ce=null,Se=-1,Me=-1,Ne=null,Be={level:{}},De=document.getElementById(h),Pe=De?De.querySelector("video"):void 0;Pe=Pe||document.createElement("video"),Pe.className="jw-video jw-reset",this.isSDK=Ae,this.itemTracks=Ne,this.video=Pe,n.isObject(x.cast)&&x.cast.appid&&Pe.setAttribute("disableRemotePlayback",""),u(pe,Pe),m||(Pe.controls=!0,Pe.controls=!1),Pe.setAttribute("x-webkit-airplay","allow"),Pe.setAttribute("webkit-playsinline",""),this.stop=function(){f(_e),xe&&(Q(),t.isIETrident()&&Pe.pause(),this.setState(a.IDLE))},this.destroy=function(){d(pe,Pe),this.removeTracksListener(Pe.audioTracks,"change",re),this.removeTracksListener(Pe.textTracks,"change",Te.textTrackChangeHandler),this.remove(),this.off()},this.init=function(e){xe&&(Ne=null,ve=e.sources,we=K(e.sources),e.sources.length&&"hls"!==e.sources[0].type&&this.sendMediaType(e.sources),ge=e.starttime||0,fe=e.duration||0,Be.reason="",V(ve[we]),this.setupSideloadedTracks(e.tracks),Ne=this.itemTracks)},this.load=function(e){xe&&(J(e.sources),e.sources.length&&"hls"!==e.sources[0].type&&this.sendMediaType(e.sources),T&&!Pe.hasAttribute("jw-played")||Te.setState(a.LOADING),G(e.starttime||0,e.duration||0))},this.play=function(){return Te.seeking?(Te.setState(a.LOADING),void Te.once(r.JWPLAYER_MEDIA_SEEKED,Te.play)):void Pe.play()},this.pause=function(){f(_e),Pe.pause(),this.setState(a.PAUSED)},this.seek=function(e){if(xe)if(e<0&&(e+=q()+X()),0===me&&this.trigger(r.JWPLAYER_MEDIA_SEEK,{position:Pe.currentTime,offset:e}),ye||(ye=!!X()),ye){me=0;try{Te.seeking=!0,Pe.currentTime=e}catch(t){Te.seeking=!1,me=e}}else me=e,p&&Pe.paused&&Pe.play()},this.volume=function(e){e=t.between(e/100,0,1),Pe.volume=e},this.mute=function(e){Pe.muted=!!e},this.checkComplete=function(){return Ie},this.detachMedia=function(){return f(_e),this.disableTextTrack(),xe=!1,Pe},this.attachMedia=function(){xe=!0,ye=!1,this.seeking=!1,Pe.loop=!1,Ie&&ie()},this.setContainer=function(e){he=e,e.appendChild(Pe)},this.getContainer=function(){return he},this.remove=function(){Q(),f(_e),he===Pe.parentNode&&he.removeChild(Pe)},this.setVisibility=function(t){t=!!t,t||y?e.style(he,{visibility:"visible",opacity:1}):e.style(he,{visibility:"",opacity:0})},this.resize=function(t,i,n){if(!(t&&i&&Pe.videoWidth&&Pe.videoHeight))return!1;var r={objectFit:"",width:"",height:""};if("uniform"===n){var a=t/i,s=Pe.videoWidth/Pe.videoHeight;Math.abs(a-s)<.09&&(r.objectFit="fill",n="exactfit")}var o=k||y||m||_;if(o){var c=-Math.floor(Pe.videoWidth/2+1),u=-Math.floor(Pe.videoHeight/2+1),d=Math.ceil(100*t/Pe.videoWidth)/100,l=Math.ceil(100*i/Pe.videoHeight)/100;"none"===n?d=l=1:"fill"===n?d=l=Math.max(d,l):"uniform"===n&&(d=l=Math.min(d,l)),r.width=Pe.videoWidth,r.height=Pe.videoHeight,r.top=r.left="50%",r.margin=0,e.transform(Pe,"translate("+c+"px, "+u+"px) scale("+d.toFixed(2)+", "+l.toFixed(2)+")")}return e.style(Pe,r),!1},this.setFullscreen=function(e){if(e=!!e){var i=t.tryCatch(function(){var e=Pe.webkitEnterFullscreen||Pe.webkitEnterFullScreen;e&&e.apply(Pe)});return!(i instanceof t.Error)&&Te.getFullScreen()}var n=Pe.webkitExitFullscreen||Pe.webkitExitFullScreen;return n&&n.apply(Pe),e},Te.getFullScreen=function(){return Le||!!Pe.fullscreenchange},this.setCurrentQuality=function(e){if(we!==e&&e>=0&&ve&&ve.length>e){we=e,Be.reason="api",Be.level={},this.trigger(r.JWPLAYER_MEDIA_LEVEL_CHANGED,{currentQuality:e,levels:H(ve)}),x.qualityLabel=ve[e].label;var t=Pe.currentTime||0,i=Pe.duration||0;i<=0&&(i=fe),Te.setState(a.LOADING),G(t,i)}},this.getCurrentQuality=function(){return we},this.getQualityLevels=function(){return H(ve)},this.getName=function(){return{name:b}},this.setCurrentAudioTrack=ce,this.getAudioTracks=ue,this.getCurrentAudioTrack=de}var f=window.clearTimeout,g=256,k=t.isIE(),v=t.isMSIE(),T=t.isMobile(),p=t.isFF(),y=t.isAndroidNative(),m=t.isIOS(7),_=t.isIOS(8),b="html5",x=function(){};return x.prototype=s,h.prototype=new x,h.getName=function(){return{name:"html5"}},h}.apply(t,n),!(void 0!==r&&(e.exports=r))}});
const MB = 1024 * 1024 const defaultOptions = { limit: 1, onStart () {}, onProgress () {}, onPartComplete () {}, onSuccess () {}, onError (err) { throw err } } function remove (arr, el) { const i = arr.indexOf(el) if (i !== -1) arr.splice(i, 1) } class MultipartUploader { constructor (file, options) { this.options = { ...defaultOptions, ...options } this.file = file this.key = this.options.key || null this.uploadId = this.options.uploadId || null this.parts = this.options.parts || [] // Do `this.createdPromise.then(OP)` to execute an operation `OP` _only_ if the // upload was created already. That also ensures that the sequencing is right // (so the `OP` definitely happens if the upload is created). // // This mostly exists to make `_abortUpload` work well: only sending the abort request if // the upload was already created, and if the createMultipartUpload request is still in flight, // aborting it immediately after it finishes. this.createdPromise = Promise.reject() // eslint-disable-line prefer-promise-reject-errors this.isPaused = false this.chunks = null this.chunkState = null this.uploading = [] this._initChunks() this.createdPromise.catch(() => {}) // silence uncaught rejection warning } _initChunks () { const chunks = [] const chunkSize = Math.max(Math.ceil(this.file.size / 10000), 5 * MB) for (let i = 0; i < this.file.size; i += chunkSize) { const end = Math.min(this.file.size, i + chunkSize) chunks.push(this.file.slice(i, end)) } this.chunks = chunks this.chunkState = chunks.map(() => ({ uploaded: 0, busy: false, done: false })) } _createUpload () { this.createdPromise = Promise.resolve().then(() => this.options.createMultipartUpload() ) return this.createdPromise.then((result) => { const valid = typeof result === 'object' && result && typeof result.uploadId === 'string' && typeof result.key === 'string' if (!valid) { throw new TypeError('AwsS3/Multipart: Got incorrect result from `createMultipartUpload()`, expected an object `{ uploadId, key }`.') } this.key = result.key this.uploadId = result.uploadId this.options.onStart(result) this._uploadParts() }).catch((err) => { this._onError(err) }) } _resumeUpload () { return Promise.resolve().then(() => this.options.listParts({ uploadId: this.uploadId, key: this.key }) ).then((parts) => { parts.forEach((part) => { const i = part.PartNumber - 1 this.chunkState[i] = { uploaded: part.Size, etag: part.ETag, done: true } // Only add if we did not yet know about this part. if (!this.parts.some((p) => p.PartNumber === part.PartNumber)) { this.parts.push({ PartNumber: part.PartNumber, ETag: part.ETag }) } }) this._uploadParts() }).catch((err) => { this._onError(err) }) } _uploadParts () { if (this.isPaused) return const need = this.options.limit - this.uploading.length if (need === 0) return // All parts are uploaded. if (this.chunkState.every((state) => state.done)) { this._completeUpload() return } const candidates = [] for (let i = 0; i < this.chunkState.length; i++) { const state = this.chunkState[i] if (state.done || state.busy) continue candidates.push(i) if (candidates.length >= need) { break } } candidates.forEach((index) => { this._uploadPart(index) }) } _uploadPart (index) { const body = this.chunks[index] this.chunkState[index].busy = true return Promise.resolve().then(() => this.options.prepareUploadPart({ key: this.key, uploadId: this.uploadId, body, number: index + 1 }) ).then((result) => { const valid = typeof result === 'object' && result && typeof result.url === 'string' if (!valid) { throw new TypeError('AwsS3/Multipart: Got incorrect result from `prepareUploadPart()`, expected an object `{ url }`.') } return result }).then(({ url }) => { this._uploadPartBytes(index, url) }, (err) => { this._onError(err) }) } _onPartProgress (index, sent, total) { this.chunkState[index].uploaded = sent const totalUploaded = this.chunkState.reduce((n, c) => n + c.uploaded, 0) this.options.onProgress(totalUploaded, this.file.size) } _onPartComplete (index, etag) { this.chunkState[index].etag = etag this.chunkState[index].done = true const part = { PartNumber: index + 1, ETag: etag } this.parts.push(part) this.options.onPartComplete(part) this._uploadParts() } _uploadPartBytes (index, url) { const body = this.chunks[index] const xhr = new XMLHttpRequest() xhr.open('PUT', url, true) xhr.responseType = 'text' this.uploading.push(xhr) xhr.upload.addEventListener('progress', (ev) => { if (!ev.lengthComputable) return this._onPartProgress(index, ev.loaded, ev.total) }) xhr.addEventListener('abort', (ev) => { remove(this.uploading, ev.target) this.chunkState[index].busy = false }) xhr.addEventListener('load', (ev) => { remove(this.uploading, ev.target) this.chunkState[index].busy = false if (ev.target.status < 200 || ev.target.status >= 300) { this._onError(new Error('Non 2xx')) return } this._onPartProgress(index, body.size, body.size) // NOTE This must be allowed by CORS. const etag = ev.target.getResponseHeader('ETag') if (etag === null) { this._onError(new Error('AwsS3/Multipart: Could not read the ETag header. This likely means CORS is not configured correctly on the S3 Bucket. Seee https://uppy.io/docs/aws-s3-multipart#S3-Bucket-Configuration for instructions.')) return } this._onPartComplete(index, etag) }) xhr.addEventListener('error', (ev) => { remove(this.uploading, ev.target) this.chunkState[index].busy = false const error = new Error('Unknown error') error.source = ev.target this._onError(error) }) xhr.send(body) } _completeUpload () { // Parts may not have completed uploading in sorted order, if limit > 1. this.parts.sort((a, b) => a.PartNumber - b.PartNumber) return Promise.resolve().then(() => this.options.completeMultipartUpload({ key: this.key, uploadId: this.uploadId, parts: this.parts }) ).then((result) => { this.options.onSuccess(result) }, (err) => { this._onError(err) }) } _abortUpload () { this.uploading.slice().forEach(xhr => { xhr.abort() }) this.createdPromise.then(() => { this.options.abortMultipartUpload({ key: this.key, uploadId: this.uploadId }) }, () => { // if the creation failed we do not need to abort }) this.uploading = [] } _onError (err) { this.options.onError(err) } start () { this.isPaused = false if (this.uploadId) { this._resumeUpload() } else { this._createUpload() } } pause () { const inProgress = this.uploading.slice() inProgress.forEach((xhr) => { xhr.abort() }) this.isPaused = true } abort (opts = {}) { const really = opts.really || false if (!really) return this.pause() this._abortUpload() } } module.exports = MultipartUploader
/*! * vuelidate-provider v1.4.0 * (c) 2020 Denis * Released under the MIT License. */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).VuelidateProvider={})}(this,(function(t){"use strict"; /*! * isobject <https://github.com/jonschlinkert/isobject> * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */function e(t){return null!=t&&"object"==typeof t&&!1===Array.isArray(t)} /*! * get-value <https://github.com/jonschlinkert/get-value> * * Copyright (c) 2014-2018, Jon Schlinkert. * Released under the MIT License. */function r(t,e,r){return"function"==typeof r.join?r.join(t):t[0]+e+t[1]}function a(t,e,r){return"function"!=typeof r.isValid||r.isValid(t,e)}function i(t){return e(t)||Array.isArray(t)||"function"==typeof t}var o={name:"VuelidateProvider",props:{validator:{type:Object,required:!0}},methods:{getValidatorByPath:function(t){return t?function(t,o,n){if(e(n)||(n={default:n}),!i(t))return void 0!==n.default?n.default:t;"number"==typeof o&&(o=String(o));var u=Array.isArray(o),d="string"==typeof o,l=n.separator||".",f=n.joinChar||("string"==typeof l?l:".");if(!d&&!u)return t;if(d&&o in t)return a(o,t,n)?t[o]:n.default;var s=u?o:function(t,e,r){return"function"==typeof r.split?r.split(t):t.split(e)}(o,l,n),h=s.length,p=0;do{var c=s[p];for("number"==typeof c&&(c=String(c));c&&"\\"===c.slice(-1);)c=r([c.slice(0,-1),s[++p]||""],f,n);if(c in t){if(!a(c,t,n))return n.default;t=t[c]}else{for(var y=!1,P=p+1;P<h;)if(y=(c=r([c,s[P++]],f,n))in t){if(!a(c,t,n))return n.default;t=t[c],p=P-1;break}if(!y)return n.default}}while(++p<h&&i(t));return p===h?t:n.default}(this.validator,t):this.validator}},render:function(t){return t("div",this.$slots.default)},provide:function(){return{getValidatorByPath:this.getValidatorByPath}}};function n(t,e){return t.$scopedSlots.default?t.$scopedSlots.default(e):t.$slots.default||[]}var u={name:"VuelidateProxy",inject:{getParentValidatorByPath:{from:"getValidatorByPath"},getParentValidatorProxyPath:{from:"getValidatorProxyPath",default:function(){return function(){}}}},props:{path:{type:String,required:!0},slim:{type:Boolean,default:!1},tag:{type:String,default:"div"}},computed:{slotProps:function(){return{fullPath:this.fullProxyPath}},fullProxyPath:function(){var t=this.getParentValidatorProxyPath();return t?t+"."+this.path:this.path}},methods:{getValidatorByPath:function(t){var e=t?this.path+"."+t:this.path;return this.getParentValidatorByPath(e)}},provide:function(){var t=this;return{getValidatorByPath:this.getValidatorByPath,getValidatorProxyPath:function(){return t.fullProxyPath}}},render:function(t){var e=n(this,this.slotProps);return this.slim&&e.length<=1?e[0]:t(this.tag,{on:this.$listeners},e)}},d={name:"VuelidateInjector",inject:{getValidatorByPath:{},getValidatorProxyPath:{default:function(){return function(){return""}}}},props:{path:{type:String,default:""}},computed:{fieldProps:function(){return{validator:this.validatorByPath,validatorPath:this.validatorPath}},validatorByPath:function(){return this.getValidatorByPath(this.path)},validatorPath:function(){var t=this.getValidatorProxyPath();return t?t+"."+this.path:this.path}},render:function(){if(!this.validatorByPath)throw new Error("[Vuelidate-provider]: validator by path '"+this.validatorPath+"' doesn't exists");return n(this,this.fieldProps)}},l={name:"VuelidateIter",components:{VuelidateProxy:u},props:{path:{type:String,default:""},tag:{type:String,default:"div"},proxyProps:{type:Object,default:function(){return{}}}},inject:{getValidatorByPath:{from:"getValidatorByPath"}},computed:{validator:function(){return this.getValidatorByPath(this.path)}},render:function(t){var e=this;return t(this.tag,Object.values(this.validator.$each.$iter).map((function(r,a){return t(u,{props:Object.assign({},e.proxyProps,{path:e.path+".$each."+a}),scopedSlots:e.$scopedSlots,slot:e.$slots.default})})))}};t.VuelidateInjector=d,t.VuelidateIter=l,t.VuelidateProvider=o,t.VuelidateProxy=u,t.default=function(t,e){void 0===e&&(e={VuelidateInjector:d,VuelidateProxy:u,VuelidateProvider:o,VuelidateIter:l}),Object.keys(e).forEach((function(r){t.component(r,e[r])}))},Object.defineProperty(t,"__esModule",{value:!0})}));