hexsha string | size int64 | ext string | lang string | max_stars_repo_path string | max_stars_repo_name string | max_stars_repo_head_hexsha string | max_stars_repo_licenses list | max_stars_count int64 | max_stars_repo_stars_event_min_datetime string | max_stars_repo_stars_event_max_datetime string | max_issues_repo_path string | max_issues_repo_name string | max_issues_repo_head_hexsha string | max_issues_repo_licenses list | max_issues_count int64 | max_issues_repo_issues_event_min_datetime string | max_issues_repo_issues_event_max_datetime string | max_forks_repo_path string | max_forks_repo_name string | max_forks_repo_head_hexsha string | max_forks_repo_licenses list | max_forks_count int64 | max_forks_repo_forks_event_min_datetime string | max_forks_repo_forks_event_max_datetime string | content string | avg_line_length float64 | max_line_length int64 | alphanum_fraction float64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1e5ca7fecd681a006179d1b743a98f458b1c565f | 71,838 | js | JavaScript | docs/assets/js/51.00b4852c.js | hpstream/ts-axios | 20752a695aeb7ba5ea163eb75cc509f417a0c2ec | [
"MIT"
] | null | null | null | docs/assets/js/51.00b4852c.js | hpstream/ts-axios | 20752a695aeb7ba5ea163eb75cc509f417a0c2ec | [
"MIT"
] | null | null | null | docs/assets/js/51.00b4852c.js | hpstream/ts-axios | 20752a695aeb7ba5ea163eb75cc509f417a0c2ec | [
"MIT"
] | 1 | 2019-12-17T05:33:18.000Z | 2019-12-17T05:33:18.000Z | (window.webpackJsonp=window.webpackJsonp||[]).push([[51],{186:function(t,s,a){"use strict";a.r(s);var n=a(0),e=Object(n.a)({},(function(){var t=this,s=t.$createElement,a=t._self._c||s;return a("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[a("h1",{attrs:{id:"合并配置的设计与实现"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#合并配置的设计与实现"}},[t._v("#")]),t._v(" 合并配置的设计与实现")]),t._v(" "),a("h2",{attrs:{id:"需求分析"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#需求分析"}},[t._v("#")]),t._v(" 需求分析")]),t._v(" "),a("p",[t._v("在之前的章节我们了解到,在发送请求的时候可以传入一个配置,来决定请求的不同行为。我们也希望 "),a("code",[t._v("ts-axios")]),t._v(" 可以有默认配置,定义一些默认的行为。这样在发送每个请求,用户传递的配置可以和默认配置做一层合并。")]),t._v(" "),a("p",[t._v("和官网 "),a("code",[t._v("axios")]),t._v(" 库保持一致,我们给 "),a("code",[t._v("axios")]),t._v(" 对象添加一个 "),a("code",[t._v("defaults")]),t._v(" 属性,表示默认配置,你甚至可以直接修改这些默认配置:")]),t._v(" "),a("div",{staticClass:"language-typescript extra-class"},[a("pre",{pre:!0,attrs:{class:"language-typescript"}},[a("code",[t._v("axios"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("defaults"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("headers"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("common"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'test'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("123")]),t._v("\naxios"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("defaults"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("headers"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("post"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'Content-Type'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'application/x-www-form-urlencoded'")]),t._v("\naxios"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("defaults"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("timeout "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("2000")]),t._v("\n")])])]),a("p",[t._v("其中对于 "),a("code",[t._v("headers")]),t._v(" 的默认配置支持 "),a("code",[t._v("common")]),t._v(" 和一些请求 "),a("code",[t._v("method")]),t._v(" 字段,"),a("code",[t._v("common")]),t._v(" 表示对于任何类型的请求都要添加该属性,而 "),a("code",[t._v("method")]),t._v(" 表示只有该类型请求方法才会添加对应的属性。")]),t._v(" "),a("p",[t._v("在上述例子中,我们会默认为所有请求的 "),a("code",[t._v("header")]),t._v(" 添加 "),a("code",[t._v("test")]),t._v(" 属性,会默认为 "),a("code",[t._v("post")]),t._v(" 请求的 "),a("code",[t._v("header")]),t._v(" 添加 "),a("code",[t._v("Content-Type")]),t._v(" 属性。")]),t._v(" "),a("h2",{attrs:{id:"默认配置"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#默认配置"}},[t._v("#")]),t._v(" 默认配置")]),t._v(" "),a("h3",{attrs:{id:"默认配置定义"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#默认配置定义"}},[t._v("#")]),t._v(" 默认配置定义")]),t._v(" "),a("p",[t._v("接下来,我们先实现默认配置")]),t._v(" "),a("p",[a("code",[t._v("defaults.ts")]),t._v(":")]),t._v(" "),a("div",{staticClass:"language-typescript extra-class"},[a("pre",{pre:!0,attrs:{class:"language-typescript"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v(" AxiosRequestConfig "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'./types'")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" defaults"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" AxiosRequestConfig "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n method"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'get'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\n timeout"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\n headers"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n common"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n Accept"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'application/json, text/plain, */*'")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" methodsNoData "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'delete'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'get'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'head'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'options'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n\nmethodsNoData"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("forEach")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("method")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n defaults"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("headers"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("method"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" methodsWithData "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'post'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'put'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'patch'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n\nmethodsWithData"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("forEach")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("method")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n defaults"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("headers"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("method"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'Content-Type'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'application/x-www-form-urlencoded'")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("default")]),t._v(" defaults\n")])])]),a("p",[t._v("我们定义了 "),a("code",[t._v("defaults")]),t._v(" 常量,它包含默认请求的方法、超时时间,以及 "),a("code",[t._v("headers")]),t._v(" 配置。")]),t._v(" "),a("p",[t._v("未来我们会根据新的需求添加更多的默认配置。")]),t._v(" "),a("h3",{attrs:{id:"添加到-axios-对象中"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#添加到-axios-对象中"}},[t._v("#")]),t._v(" 添加到 axios 对象中")]),t._v(" "),a("p",[t._v("根据需求,我们要给 "),a("code",[t._v("axios")]),t._v(" 对象添加一个 "),a("code",[t._v("defaults")]),t._v(" 属性,表示默认配置:")]),t._v(" "),a("div",{staticClass:"language-typescript extra-class"},[a("pre",{pre:!0,attrs:{class:"language-typescript"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("default")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("class")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Axios")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n defaults"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" AxiosRequestConfig\n interceptors"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" Interceptors\n\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("constructor")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("initConfig"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" AxiosRequestConfig")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("defaults "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" initConfig\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("interceptors "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n request"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("InterceptorManager")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v("AxiosRequestConfig"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n response"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("InterceptorManager")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("<")]),t._v("AxiosResponse"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v(">")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// ...")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" \n")])])]),a("p",[t._v("我们给 "),a("code",[t._v("Axios")]),t._v(" 类添加一个 "),a("code",[t._v("defaults")]),t._v(" 成员属性,并且让 "),a("code",[t._v("Axios")]),t._v(" 的构造函数接受一个 "),a("code",[t._v("initConfig")]),t._v(" 对象,把 "),a("code",[t._v("initConfig")]),t._v(" 赋值给 "),a("code",[t._v("this.defaults")]),t._v("。")]),t._v(" "),a("p",[t._v("接着修改 "),a("code",[t._v("createInstance")]),t._v(" 方法,支持传入 "),a("code",[t._v("config")]),t._v(" 对象。")]),t._v(" "),a("div",{staticClass:"language-typescript extra-class"},[a("pre",{pre:!0,attrs:{class:"language-typescript"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" defaults "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'./defaults'")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("createInstance")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("config"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" AxiosRequestConfig")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" AxiosStatic "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" context "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("new")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Axios")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("config"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" instance "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("Axios")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("prototype"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("request")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("bind")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("context"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// extend(instance, Axios.prototype, context)")]),t._v("\n\n "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("extend")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("instance"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" context"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" instance "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("as")]),t._v(" AxiosStatic\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" axios "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("createInstance")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("defaults"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),a("p",[t._v("这样我们就可以在执行 "),a("code",[t._v("createInstance")]),t._v(" 创建 "),a("code",[t._v("axios")]),t._v(" 对象的时候,把默认配置传入了。")]),t._v(" "),a("h2",{attrs:{id:"配置合并及策略"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#配置合并及策略"}},[t._v("#")]),t._v(" 配置合并及策略")]),t._v(" "),a("p",[t._v("定义了默认配置后,我们发送每个请求的时候需要把自定义配置和默认配置做合并,它并不是简单的 2 个普通对象的合并,对于不同的字段合并,会有不同的合并策略。举个例子:")]),t._v(" "),a("div",{staticClass:"language-typescript extra-class"},[a("pre",{pre:!0,attrs:{class:"language-typescript"}},[a("code",[t._v("config1 "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n method"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'get'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\n timeout"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n\n headers"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n common"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n Accept"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'application/json, text/plain, */*'")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\nconfig2 "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n url"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'/config/post'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n method"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'post'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n data"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n a"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n headers"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n test"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'321'")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\nmerged "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n url"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'/config/post'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n method"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'post'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n data"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n a"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n timeout"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("0")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n headers"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n common"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n Accept"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'application/json, text/plain, */*'")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n test"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'321'")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),a("p",[t._v("我们在 "),a("code",[t._v("core/mergeConfig.ts")]),t._v(" 中实现合并方法。")]),t._v(" "),a("h3",{attrs:{id:"合并方法"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#合并方法"}},[t._v("#")]),t._v(" 合并方法")]),t._v(" "),a("div",{staticClass:"language-typescript extra-class"},[a("pre",{pre:!0,attrs:{class:"language-typescript"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("default")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("mergeConfig")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("config1"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" AxiosRequestConfig"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n config2"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" AxiosRequestConfig")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" AxiosRequestConfig "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("config2"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n config2 "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" config "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Object"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("create")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("null")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" key "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("in")]),t._v(" config2"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("mergeField")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("key"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("for")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("let")]),t._v(" key "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("in")]),t._v(" config1"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("config2"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("key"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("mergeField")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("key"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("mergeField")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("key"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("string")])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("void")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" strat "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" strats"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("key"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("||")]),t._v(" defaultStrat\n config"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("key"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("strat")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("config1"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("key"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" config2"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("key"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" config\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),a("p",[t._v("合并方法的整体思路就是对 "),a("code",[t._v("config1")]),t._v(" 和 "),a("code",[t._v("config2")]),t._v(" 中的属性遍历,执行 "),a("code",[t._v("mergeField")]),t._v(" 方法做合并,这里 "),a("code",[t._v("config1")]),t._v(" 代表默认配置,"),a("code",[t._v("config2")]),t._v(" 代表自定义配置。")]),t._v(" "),a("p",[t._v("遍历过程中,我们会通过 "),a("code",[t._v("config2[key]")]),t._v(" 这种索引的方式访问,所以需要给 "),a("code",[t._v("AxiosRequestConfig")]),t._v(" 的接口定义添加一个字符串索引签名:")]),t._v(" "),a("div",{staticClass:"language-typescript extra-class"},[a("pre",{pre:!0,attrs:{class:"language-typescript"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("interface")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token class-name"}},[t._v("AxiosRequestConfig")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token comment"}},[t._v("// ...")]),t._v("\n\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("propName"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("string")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("any")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),a("p",[t._v("在 "),a("code",[t._v("mergeField")]),t._v(" 方法中,我们会针对不同的属性使用不同的合并策略。")]),t._v(" "),a("h3",{attrs:{id:"默认合并策略"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#默认合并策略"}},[t._v("#")]),t._v(" 默认合并策略")]),t._v(" "),a("p",[t._v("这是大部分属性的合并策略,如下:")]),t._v(" "),a("div",{staticClass:"language-typescript extra-class"},[a("pre",{pre:!0,attrs:{class:"language-typescript"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("defaultStrat")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("val1"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("any")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" val2"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("any")])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("any")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("typeof")]),t._v(" val2 "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!==")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'undefined'")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("?")]),t._v(" val2 "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" val1\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),a("p",[t._v("它很简单,如果有 "),a("code",[t._v("val2")]),t._v(" 则返回 "),a("code",[t._v("val2")]),t._v(",否则返回 "),a("code",[t._v("val1")]),t._v(",也就是如果自定义配置中定义了某个属性,就采用自定义的,否则就用默认配置。")]),t._v(" "),a("h3",{attrs:{id:"只接受自定义配置合并策略"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#只接受自定义配置合并策略"}},[t._v("#")]),t._v(" 只接受自定义配置合并策略")]),t._v(" "),a("p",[t._v("对于一些属性如 "),a("code",[t._v("url")]),t._v("、"),a("code",[t._v("params")]),t._v("、"),a("code",[t._v("data")]),t._v(",合并策略如下:")]),t._v(" "),a("div",{staticClass:"language-typescript extra-class"},[a("pre",{pre:!0,attrs:{class:"language-typescript"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("fromVal2Strat")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("val1"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("any")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" val2"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("any")])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("any")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("typeof")]),t._v(" val2 "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!==")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'undefined'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" val2\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" stratKeysFromVal2 "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'url'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'params'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'data'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n\nstratKeysFromVal2"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("forEach")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("key")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n strats"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("key"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" fromVal2Strat\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),a("p",[t._v("因为对于 "),a("code",[t._v("url")]),t._v("、"),a("code",[t._v("params")]),t._v("、"),a("code",[t._v("data")]),t._v(" 这些属性,默认配置显然是没有意义的,它们是和每个请求强相关的,所以我们只从自定义配置中获取。")]),t._v(" "),a("h3",{attrs:{id:"复杂对象合并策略"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#复杂对象合并策略"}},[t._v("#")]),t._v(" 复杂对象合并策略")]),t._v(" "),a("p",[t._v("对于一些属性如 "),a("code",[t._v("headers")]),t._v(",合并策略如下:")]),t._v(" "),a("div",{staticClass:"language-typescript extra-class"},[a("pre",{pre:!0,attrs:{class:"language-typescript"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("deepMergeStrat")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("val1"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("any")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" val2"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("any")])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("any")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("isPlainObject")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("val2"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("deepMerge")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("val1"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" val2"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("else")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("typeof")]),t._v(" val2 "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!==")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'undefined'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" val2\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("else")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("isPlainObject")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("val1"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("deepMerge")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("val1"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("else")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("typeof")]),t._v(" val1 "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!==")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'undefined'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" val1\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" stratKeysDeepMerge "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'headers'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n\nstratKeysDeepMerge"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("forEach")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("key")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n strats"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("key"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" deepMergeStrat\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),a("p",[a("code",[t._v("helpers/util.ts")]),t._v(":")]),t._v(" "),a("div",{staticClass:"language-typescript extra-class"},[a("pre",{pre:!0,attrs:{class:"language-typescript"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("deepMerge")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("...")]),t._v("objs"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("any")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("any")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" result "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" Object"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("create")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("null")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n objs"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("forEach")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("obj")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("obj"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n Object"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("keys")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("obj"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("forEach")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("key")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" val "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" obj"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("key"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("isPlainObject")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("val"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("isPlainObject")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("result"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("key"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n result"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("key"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("deepMerge")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("result"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("key"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" val"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("else")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n result"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("key"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("deepMerge")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" val"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("else")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n result"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("key"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" val\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" result\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),a("p",[t._v("对于 "),a("code",[t._v("headers")]),t._v(" 这类的复杂对象属性,我们需要使用深拷贝的方式,同时也处理了其它一些情况,因为它们也可能是一个非对象的普通值。未来我们讲到认证授权的时候,"),a("code",[t._v("auth")]),t._v(" 属性也是这个合并策略。")]),t._v(" "),a("p",[t._v("最后我们在 "),a("code",[t._v("request")]),t._v(" 方法里添加合并配置的逻辑:")]),t._v(" "),a("div",{staticClass:"language-typescript extra-class"},[a("pre",{pre:!0,attrs:{class:"language-typescript"}},[a("code",[t._v("config "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("mergeConfig")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("this")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("defaults"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" config"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),a("h2",{attrs:{id:"flatten-headers"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#flatten-headers"}},[t._v("#")]),t._v(" flatten headers")]),t._v(" "),a("p",[t._v("经过合并后的配置中的 "),a("code",[t._v("headers")]),t._v(" 是一个复杂对象,多了 "),a("code",[t._v("common")]),t._v("、"),a("code",[t._v("post")]),t._v("、"),a("code",[t._v("get")]),t._v(" 等属性,而这些属性中的值才是我们要真正添加到请求 "),a("code",[t._v("header")]),t._v(" 中的。")]),t._v(" "),a("p",[t._v("举个例子:")]),t._v(" "),a("div",{staticClass:"language-typescript extra-class"},[a("pre",{pre:!0,attrs:{class:"language-typescript"}},[a("code",[t._v("headers"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n common"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n Accept"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'application/json, text/plain, */*'")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n post"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'Content-Type'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'application/x-www-form-urlencoded'")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),a("p",[t._v("我们需要把它压成一级的,如下:")]),t._v(" "),a("div",{staticClass:"language-typescript extra-class"},[a("pre",{pre:!0,attrs:{class:"language-typescript"}},[a("code",[t._v("headers"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n Accept"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'application/json, text/plain, */*'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'Content-Type'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'application/x-www-form-urlencoded'")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),a("p",[t._v("这里要注意的是,对于 "),a("code",[t._v("common")]),t._v(" 中定义的 "),a("code",[t._v("header")]),t._v(" 字段,我们都要提取,而对于 "),a("code",[t._v("post")]),t._v("、"),a("code",[t._v("get")]),t._v(" 这类提取,需要和该次请求的方法对应。")]),t._v(" "),a("p",[t._v("接下来我们实现 "),a("code",[t._v("flattenHeaders")]),t._v(" 方法。")]),t._v(" "),a("p",[a("code",[t._v("helpers/header.ts")]),t._v(":")]),t._v(" "),a("div",{staticClass:"language-typescript extra-class"},[a("pre",{pre:!0,attrs:{class:"language-typescript"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("export")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("flattenHeaders")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("headers"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("any")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" method"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" Method")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("any")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("if")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),t._v("headers"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" headers\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n headers "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("deepMerge")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("headers"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("common "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("||")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" headers"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("method"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("||")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" headers"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("const")]),t._v(" methodsToDelete "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'delete'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'get'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'head'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'options'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'post'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'put'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'patch'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'common'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n\n methodsToDelete"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("forEach")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("method")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("delete")]),t._v(" headers"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),t._v("method"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n\n "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("return")]),t._v(" headers\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),a("p",[t._v("我们可以通过 "),a("code",[t._v("deepMerge")]),t._v(" 的方式把 "),a("code",[t._v("common")]),t._v("、"),a("code",[t._v("post")]),t._v(" 的属性拷贝到 "),a("code",[t._v("headers")]),t._v(" 这一级,然后再把 "),a("code",[t._v("common")]),t._v("、"),a("code",[t._v("post")]),t._v(" 这些属性删掉。")]),t._v(" "),a("p",[t._v("然后我们在真正发送请求前执行这个逻辑。")]),t._v(" "),a("p",[a("code",[t._v("core/dispatchRequest.ts")]),t._v(":")]),t._v(" "),a("div",{staticClass:"language-typescript extra-class"},[a("pre",{pre:!0,attrs:{class:"language-typescript"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("function")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("processConfig")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("config"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" AxiosRequestConfig")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("void")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n config"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("url "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("transformURL")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("config"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n config"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("headers "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("transformHeaders")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("config"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n config"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("data "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("transformRequestData")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("config"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n config"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("headers "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("flattenHeaders")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("config"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("headers"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" config"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("method"),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("!")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n")])])]),a("p",[t._v("这样确保我们了配置中的 "),a("code",[t._v("headers")]),t._v(" 是可以正确添加到请求 "),a("code",[t._v("header")]),t._v(" 中的")]),t._v(" "),a("h2",{attrs:{id:"demo-编写"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#demo-编写"}},[t._v("#")]),t._v(" demo 编写")]),t._v(" "),a("p",[t._v("在 "),a("code",[t._v("examples")]),t._v(" 目录下创建 "),a("code",[t._v("config")]),t._v(" 目录,在 "),a("code",[t._v("config")]),t._v(" 目录下创建 "),a("code",[t._v("index.html")]),t._v(":")]),t._v(" "),a("div",{staticClass:"language-html extra-class"},[a("pre",{pre:!0,attrs:{class:"language-html"}},[a("code",[a("span",{pre:!0,attrs:{class:"token doctype"}},[t._v("<!DOCTYPE html>")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("html")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("lang")]),a("span",{pre:!0,attrs:{class:"token attr-value"}},[a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("=")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("en"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("head")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("meta")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("charset")]),a("span",{pre:!0,attrs:{class:"token attr-value"}},[a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("=")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("utf-8"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("title")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("Config example"),a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("</")]),t._v("title")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("</")]),t._v("head")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("body")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("<")]),t._v("script")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token attr-name"}},[t._v("src")]),a("span",{pre:!0,attrs:{class:"token attr-value"}},[a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("=")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')]),t._v("/__build__/config.js"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v('"')])]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),a("span",{pre:!0,attrs:{class:"token script"}}),a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("</")]),t._v("script")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("</")]),t._v("body")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token tag"}},[a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("</")]),t._v("html")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(">")])]),t._v("\n")])])]),a("p",[t._v("接着创建 "),a("code",[t._v("app.ts")]),t._v(" 作为入口文件:")]),t._v(" "),a("div",{staticClass:"language-typescript extra-class"},[a("pre",{pre:!0,attrs:{class:"language-typescript"}},[a("code",[a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" axios "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'../../src/index'")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("import")]),t._v(" qs "),a("span",{pre:!0,attrs:{class:"token keyword"}},[t._v("from")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'qs'")]),t._v("\n\naxios"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("defaults"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("headers"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("common"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("[")]),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'test2'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("]")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("123")]),t._v("\n\n"),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("axios")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n url"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'/config/post'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n method"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'post'")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n data"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" qs"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("stringify")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n a"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token number"}},[t._v("1")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(",")]),t._v("\n headers"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n test"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(":")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token string"}},[t._v("'321'")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("then")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),a("span",{pre:!0,attrs:{class:"token parameter"}},[t._v("res")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token operator"}},[t._v("=>")]),t._v(" "),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("{")]),t._v("\n "),a("span",{pre:!0,attrs:{class:"token builtin"}},[t._v("console")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),a("span",{pre:!0,attrs:{class:"token function"}},[t._v("log")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("(")]),t._v("res"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(".")]),t._v("data"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n"),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v("}")]),a("span",{pre:!0,attrs:{class:"token punctuation"}},[t._v(")")]),t._v("\n")])])]),a("p",[t._v("这个例子中我们额外引入了 "),a("code",[t._v("qs")]),t._v(" 库,它是一个查询字符串解析和字符串化的库。")]),t._v(" "),a("p",[t._v("比如我们的例子中对于 "),a("code",[t._v("{a:1}")]),t._v(" 经过 "),a("code",[t._v("qs.stringify")]),t._v(" 变成 "),a("code",[t._v("a=1")]),t._v("。")]),t._v(" "),a("p",[t._v("由于我们的例子给默认值添加了 "),a("code",[t._v("post")]),t._v(" 和 "),a("code",[t._v("common")]),t._v(" 的 "),a("code",[t._v("headers")]),t._v(",我们在请求前做配置合并,于是我们请求的 "),a("code",[t._v("header")]),t._v(" 就添加了 "),a("code",[t._v("Content-Type")]),t._v(" 字段,它的值是 "),a("code",[t._v("application/x-www-form-urlencoded")]),t._v(";另外我们也添加了 "),a("code",[t._v("test2")]),t._v(" 字段,它的值是 "),a("code",[t._v("123")]),t._v("。")]),t._v(" "),a("p",[t._v("至此,我们合并配置的逻辑就实现完了。我们在前面的章节编写 "),a("code",[t._v("axios")]),t._v(" 的基础功能的时候对请求数据和响应数据都做了处理,官方 "),a("code",[t._v("axios")]),t._v(" 则把这俩部分逻辑也做到了默认配置中,意味这用户可以去修改这俩部分的逻辑,实现自己对请求和响应数据处理的逻辑。那么下一节我们就来实现这个 feature。")])])}),[],!1,null,null,null);s.default=e.exports}}]); | 71,838 | 71,838 | 0.569211 |
1e5cfe49e995ca5e53bf9cfba2b8f9b9a087e4a3 | 10,617 | js | JavaScript | html/visualizer/src/lib/biojs-1.0/src/main/javascript/Biojs.ChEBICompound.js | cheminfo/nucleotide-website | 87d48fca686650d48292a5972253b06551dfd0d0 | [
"MIT"
] | 31 | 2015-02-19T12:00:40.000Z | 2022-03-13T18:36:11.000Z | html/visualizer/src/lib/biojs-1.0/src/main/javascript/Biojs.ChEBICompound.js | cheminfo/nucleotide-website | 87d48fca686650d48292a5972253b06551dfd0d0 | [
"MIT"
] | 870 | 2015-01-05T07:34:10.000Z | 2021-11-27T12:17:51.000Z | html/visualizer/src/lib/biojs-1.0/src/main/javascript/Biojs.ChEBICompound.js | cheminfo/nucleotide-website | 87d48fca686650d48292a5972253b06551dfd0d0 | [
"MIT"
] | 23 | 2015-05-19T10:57:37.000Z | 2021-12-29T09:09:32.000Z | /**
*
*
* @class
* @extends Biojs
*
* @author <a href="mailto:johncar@gmail.com">John Gomez-Carvajal</a>
* @version 1.0.0
* @category 2
*
* @requires <a href=''>Server side proxy</a>
*
* @requires <a href='../biojs/css/ChEBICompound.css'>ChEBICompound.css</a>
* @dependency <link href="../biojs/css/biojs.ChEBICompound.css" rel="stylesheet" type="text/css" />
*
* @requires <a href='http://blog.jquery.com/2011/09/12/jquery-1-6-4-released/'>jQuery Core 1.6.4</a>
* @dependency <script language="JavaScript" type="text/javascript" src="../biojs/dependencies/jquery/jquery-1.6.4.js"></script>
*
* @param {Object} options An object with the options for the component.
*
* @option {string} [imageUrl="http://www.ebi.ac.uk/chebi/displayImage.do"]
* Url of the web service in order to require the compound image.
* To get a compound image, 'imageUrl + id' will be used as URI.
*
* @option {string} id
* ChEBI identifier of the compound to be displayed (i.e. '4991').
*
* @option {int} [height=undefined]
* The height in pixels of how big this component should be displayed. If it's not specified, the CSS value will be used instead.
*
* @option {int} [width=undefined]
* The width in pixels of how big this image should be displayed. If it's not specified, the CSS value will be used instead.
*
* @example
* var instance = new Biojs.ChEBICompound({
* target: 'YourOwnDivId',
* id: 'CHEBI:2922',
* width: 700,
* height: 400
* });
*
*/
Biojs.ChEBICompound = Biojs.extend(
/** @lends Biojs.ChEBICompound# */
{
constructor: function(options){
var self = this;
var width = this.opt.width;
var height = this.opt.height;
var imageWidth, imageHeight;
if ( "string" == (typeof this.opt.target) ) {
this._container = jQuery( "#" + this.opt.target );
} else {
this.opt.target = "biojs_ChEBICompound_" + this.getId();
this._container = jQuery('<div id="'+ self.opt.target +'"></div>');
}
this._container.html('').addClass("ChEBICompound");
if ( width == undefined ) {
width = this._container.css('width');
} else {
this._container.width( width );
}
if ( height == undefined ) {
height = this._container.css('height');
} else {
this._container.height( height );
}
this._container.html('');
this._imageContainer = jQuery('<div class="ChEBICompound_image"></div>').appendTo(this._container);
this._tabContainer = jQuery('<div class="ChEBICompound_tab"></div>').appendTo(this._container);
// Build the summary left panel
this._summaryContainer = this._buildTabPanel(
this._tabContainer,
function ( tabVisible, visibleWidth ) {
// Do nothing on tab visibility change
}
);
// Size of the image for the URL request
imageWidth = this._imageContainer.width();
imageHeight = this._imageContainer.height();
this.opt.imageDimension = (imageWidth < imageHeight)? imageWidth: imageHeight;
if (this.opt.id !== undefined) {
this.setId(this.opt.id);
}
},
opt: {
target: 'YourOwnDivId',
id: undefined,
imageUrl: 'http://www.ebi.ac.uk/chebi/displayImage.do',
chebiDetailsUrl: 'http://www.ebi.ac.uk/webservices/chebi/2.0/test/getCompleteEntity?chebiId=',
proxyUrl: '../biojs/dependencies/proxy/proxy.php',
height: undefined,
width: undefined,
scale: false,
imageIndex: 0
},
eventTypes : [
/**
* @name Biojs.ChEBICompound#onRequestError
* @event
* @param {function} actionPerformed An function which receives an {@link Biojs.Event} object as argument.
* @eventData {Object} source The component which did triggered the event.
* @eventData {string} file The name of the loaded file.
* @eventData {string} result A string with either value 'success' or 'failure'.
* @eventData {string} message Error message in case of result be 'failure'.
*
* @example
* instance.onRequestError(
* function( e ) {
* alert( e.message );
* }
* );
*
* */
"onRequestError",
/**
* @name Biojs.ChEBICompound#onImageLoaded
* @event
* @param {function} actionPerformed An function which receives an {@link Biojs.Event} object as argument.
* @eventData {Object} source The component which did triggered the event.
* @eventData {string} id The identifier of the loaded file.
*
* @example
* instance.onImageLoaded(
* function( e ) {
* alert( e.id + " loaded." );
* }
* );
*
* */
"onImageLoaded"
],
/**
* Set the identifier of the chemical component.
* Shows both information and image for the new identifier.
*
* @param {string} chebiId Chemical EBI's identifier for the compound to be displayed.
*
* @example
* instance.setId('CHEBI:4991');
*
* @example
* // No image available
* instance.setId('CHEBI:60004');
*
*/
setId: function( chebiId ) {
var self = this;
var url;
var image;
this._imageContainer.html('');
this.opt.id = chebiId.replace('CHEBI:','');
this._requestDetails( this.opt );
var params = {
defaultImage: true,
imageIndex: this.opt.imageIndex,
chebiId: chebiId,
dimensions: this.opt.imageDimension,
scaleMolecule: this.opt.scale
};
url = this.opt.imageUrl + '?' + jQuery.param(params);
image = jQuery('<img id="image_' + chebiId + '"/>')
.load(function() {
self._imageContainer.removeClass("noImage");
self._imageContainer.append(image).css({
'width': self.opt.imageDimension,
'height': self.opt.imageDimension,
'margin': 'auto'
});
self.raiseEvent( Biojs.ChEBICompound.EVT_ON_IMAGE_LOADED, {
id: chebiId,
url: url
});
})
.error(function() {
self._imageContainer.addClass("noImage");
self.raiseEvent( Biojs.ChEBICompound.EVT_ON_REQUEST_ERROR, {
id: chebiId,
url: url,
message: "No image available"
});
})
.attr('src', url);
},
_requestDetails: function( opt ){
var self = this;
var urlSummary = opt.chebiDetailsUrl + opt.id;
Biojs.console.log( "Requesting summary from: " + urlSummary );
var httpRequest = {
url: urlSummary,
method: "GET",
/**
* @ignore
*/
success: function(xml){
self._dataReceived(xml);
},
/**
* @ignore
*/
error: function(qXHR, textStatus, errorThrown) {
Biojs.console.log("ERROR requesting summary. Response: " + textStatus);
self.raiseEvent( Biojs.ChEBICompound.EVT_ON_REQUEST_ERROR, {
message: textStatus
});
}
};
// Using proxy?
// Redirect using the proxy and encode all params as url data
if ( opt.proxyUrl != undefined ) {
// Redirect to proxy url
httpRequest.url = opt.proxyUrl;
// Encode both url and parameters under the param url
httpRequest.data = [{ name: "url", value: urlSummary }];
}
// Data type
httpRequest.dataType = "text";
jQuery.ajax(httpRequest);
},
// parses the xml file from the request and stores the information in an easy to access way
_dataReceived: function(xml){
var data = {};
var i = 0;
var self = this;
Biojs.console.log("Data received");
if ( xml.length > 0 ) {
xmlDoc = jQuery.parseXML( xml );
xmlResult = jQuery(xmlDoc).find('return');
data.chebiAsciiName = { name: "Name", value: xmlResult.find(' > chebiAsciiName').text() };
data.chebiId = { name: "Identifier", value: xmlResult.find('> chebiId').text() };
data.definition = { name: "Definition", value: xmlResult.find('> definition').text() };
data.SecondaryChEBIIds = { name: "Other Identifiers", value: xmlResult.find(' > SecondaryChEBIIds').text() };
data.entityStar = { name: "Stars", value: xmlResult.find(' > entityStar').text() };
}
this._setSummary( data );
return data;
},
_setSummary : function ( data ) {
Biojs.console.log("_setSummary()");
var container = this._summaryContainer;
// Remove all elements in container
container.children().remove();
if ( Biojs.Utils.isEmpty(data) ) {
container.append('Not information available');
} else {
// Add the summary data
for (key in data) {
if ( data[key].value.length > 0 ) {
if ( key == 'entityStar' ) {
jQuery('<h2>' + data[key].name + '</h2>').appendTo( container );
jQuery('<div class="star"/>')
.appendTo( container )
.css({
'width': parseInt(data[key].value) * 16,
'padding': 0
});
} else {
container.append( '<h2>' + data[key].name + '</h2><p>' + data[key].value + '</p>' );
}
}
}
this.raiseEvent( Biojs.ChEBICompound.EVT_ON_SUMMARY_LOADED,{
id: data.Identifier
});
}
Biojs.console.log("_setSummary done");
},
_buildTabPanel: function( container, onVisibilityChangeCb ) {
container.html('');
var content = jQuery('<div class="content"></div>').appendTo(container);
var expand = jQuery('<div style="display: none;" class="toggle expand"></div>').appendTo(container);
var collapse = jQuery('<div class="toggle collapse"/>').appendTo(container);
var buttonsWidth = parseInt( jQuery('.toggle').css('width'), 10 );
var contentWidth = container.width() - buttonsWidth;
container.css( 'left', 0 )
.find('.toggle')
.click( function(){
// Animate show/hide this tab
container.animate({
left: ( parseInt( container.css('left'), 10 ) == 0 ? buttonsWidth - container.outerWidth() : 0 ) + "px"
},
// to call once the animation is complete
function() {
var visibleWidth = parseInt( container.css('left'), 10 ) == 0 ? container.width() : buttonsWidth;
container.find('.toggle').toggle();
if ( "function" == typeof onVisibilityChangeCb ) {
onVisibilityChangeCb.call( this, collapse.is(':visible'), visibleWidth );
}
}
);
})
.css({
'float':'right',
'position':'relative'
});
Biojs.console.log('content width '+ contentWidth);
content.css({
'width': contentWidth + "px",
'height': container.height() + "px",
'word-wrap': 'break-word'
});
return content;
},
getHTML: function () {
return this._container;
}
},{
//Events
EVT_ON_IMAGE_LOADED: "onImageLoaded",
EVT_ON_SUMMARY_LOADED: "onSummaryLoaded",
EVT_ON_REQUEST_ERROR: "onRequestError"
}); | 28.387701 | 133 | 0.612979 |
1e5d3ed48caf10e99ab7690d125b7f6f23e57efb | 3,306 | js | JavaScript | server/modules/common/address/find/address-find.handlers.test.js | DEFRA/ivory-front-office | 9715ad6e68c7e8553fcabaee5a2646ca34466b2e | [
"Unlicense"
] | 1 | 2019-10-03T12:46:03.000Z | 2019-10-03T12:46:03.000Z | server/modules/common/address/find/address-find.handlers.test.js | DEFRA/ivory-front-office | 9715ad6e68c7e8553fcabaee5a2646ca34466b2e | [
"Unlicense"
] | 124 | 2019-07-11T15:33:21.000Z | 2021-07-19T05:55:42.000Z | server/modules/common/address/find/address-find.handlers.test.js | DEFRA/ivory-front-office | 9715ad6e68c7e8553fcabaee5a2646ca34466b2e | [
"Unlicense"
] | 1 | 2021-04-10T21:31:32.000Z | 2021-04-10T21:31:32.000Z | const Lab = require('@hapi/lab')
const Code = require('@hapi/code')
const lab = exports.lab = Lab.script()
const sinon = require('sinon')
const Handlers = require('defra-hapi-handlers')
const defraHapiUtils = require('defra-hapi-utils')
const config = require('../../../../config')
const AddressLookUp = defraHapiUtils.AddressLookUp
const TestHelper = require('../../../../../test-helper')
class Address {
static get (request) { return request._data }
static set (request, data) { request._data = data }
}
class FindAddressHandlers extends require('./address-find.handlers') {
get Address () {
return Address
}
async manualAddressLink () {
return '/manualAddress'
}
}
const postcode = 'AB12 3CD'
lab.experiment(TestHelper.getFile(__filename), () => {
lab.beforeEach(({ context }) => {
// Create a sinon sandbox to stub methods
const sandbox = context.sandbox = sinon.createSandbox()
sandbox.stub(config, 'addressLookUpEnabled').get(() => true)
sandbox.stub(config, 'addressLookUpUri').get(() => 'http://afddress-look-up.defra.com')
sandbox.stub(config, 'addressLookUpUsername').get(() => 'username')
sandbox.stub(config, 'addressLookUpPassword').get(() => 'password')
sandbox.stub(config, 'addressLookUpKey').get(() => 'key')
sandbox.stub(Handlers.prototype, 'handleGet').value(() => {})
sandbox.stub(Handlers.prototype, 'handlePost').value(() => {})
sandbox.stub(AddressLookUp.prototype, 'lookUpByPostcode').value(() => { return [] })
const handlers = new FindAddressHandlers()
handlers.viewData = { example: 'view-data' }
const view = (name, data) => {
// returns view data for checking
return { [name]: data }
}
const redirect = (nextPath) => {
// returns redirect data for checking
return nextPath
}
const h = { view, redirect }
const request = {}
Object.assign(context, { handlers, request, h, view })
})
lab.afterEach(async ({ context }) => {
const { sandbox } = context
// Restore the sandbox to make sure the stubs are removed correctly
sandbox.restore()
})
lab.test('handleGet builds view data as expected when full name has been entered previously', async ({ context }) => {
const { request, h, handlers, sandbox } = context
// Make sure Address has the 'postcode' value set to AB12 3CD
sandbox.stub(FindAddressHandlers.prototype, 'Address').get(() => {
return { get: () => { return { postcode } } }
})
await handlers.handleGet(request, h)
Code.expect(handlers.viewData).to.equal({ postcode, manualAddressLink: await handlers.manualAddressLink() })
})
lab.test('handlePost sets Address data correctly', async ({ context }) => {
const { request, handlers } = context
const expectedData = { postcode, postcodeAddressList: [] }
request.payload = { postcode }
await handlers.handlePost(request)
Code.expect(Address.get(request)).to.equal(expectedData)
})
lab.test('schema validates correctly', async ({ context }) => {
const { handlers, request } = context
const { error } = handlers.validate({ postcode: '' }, { abortEarly: false })
Code.expect(await handlers.formatErrors(request, error)).to.equal({ postcode: { text: 'Enter postcode', href: '#postcode' } })
})
})
| 34.8 | 130 | 0.659105 |
1e5d9e023884c519145714d0cf6c0571eda838bb | 3,139 | js | JavaScript | src/util/youtube-feeds.js | sierra-m/OllieBot.js | 9c3b954bd69413eb7ca0919b4052d67bdb6549e0 | [
"MIT"
] | null | null | null | src/util/youtube-feeds.js | sierra-m/OllieBot.js | 9c3b954bd69413eb7ca0919b4052d67bdb6549e0 | [
"MIT"
] | 4 | 2020-09-29T06:27:52.000Z | 2022-01-22T10:26:32.000Z | src/util/youtube-feeds.js | sierra-m/OllieBot.js | 9c3b954bd69413eb7ca0919b4052d67bdb6549e0 | [
"MIT"
] | null | null | null | import moment from 'moment'
import Discord from 'discord.js'
import Conduit from './conduit'
import {feedsMax} from '../config';
import logging from './logging'
class YoutubeFeed {
constructor (guildId: String,
youtubeChannelID: String,
discordChannelID: String,
channelTitle: String,
lastVideoID: String) {
this.guildId = guildId;
this.youtubeChannelID = youtubeChannelID;
this.discordChannelID = discordChannelID;
this.channelTitle = channelTitle;
this.lastVideoID = lastVideoID;
}
toString () {
return `Channel: **${this.channelTitle}**, Location: <#${this.discordChannelID}>`
}
}
export default class YoutubeFeedsLibrary {
constructor (guildId: String) {
this.guildId = guildId;
this.feeds = [];
}
hasYoutubeChannel (channelID: String) {
for (let feed of this.feeds) {
if (channelID === feed.youtubeChannelID)
return true;
}
return false;
}
get (youtubeChannelId: String): YoutubeFeed {
for (let feed of this.feeds) {
if (youtubeChannelId === feed.youtubeChannelID)
return feed;
}
return null;
}
getByTitle (channelTitle: String) {
channelTitle = channelTitle.toLowerCase();
for (let feed of this.feeds) {
if (channelTitle === feed.channelTitle.toLowerCase())
return feed;
}
return null;
}
length () {
return this.feeds.length;
}
@Conduit.access('select * from youtube_feeds where guild_id=?')
load (stmt) {
const rows = stmt.all(this.guildId);
for (let row of rows) {
this.feeds.push(new YoutubeFeed(
row.guild_id,
row.youtube_channel_id,
row.discord_channel_id,
row.title,
row.last_video_id
));
}
}
@Conduit.update('insert into youtube_feeds values (?, ?, ?, ?, ?)')
add (youtubeChannelID: String, discordChannelID: String, title: String, lastVideoID: String, stmt) {
if (this.length() >= feedsMax)
return false;
const found = this.hasYoutubeChannel(youtubeChannelID);
if (!found) {
stmt.run(this.guildId, youtubeChannelID, title, lastVideoID, discordChannelID);
this.feeds.push(new YoutubeFeed(this.guildId, youtubeChannelID, discordChannelID, title, lastVideoID));
return true;
} else return false;
}
@Conduit.update('delete from youtube_feeds where guild_id=? and youtube_channel_id=?')
remove (youtubeChannelID: String, stmt) {
const found = this.get(youtubeChannelID);
if (found) {
stmt.run(this.guildId, youtubeChannelID);
this.feeds = this.feeds.remove(found);
return true;
} else return false;
}
@Conduit.update('update youtube_feeds set last_video_id=? where guild_id=? and youtube_channel_id=?')
updateVideo (youtubeChannelID: String, newVideoID: String, stmt) {
const found = this.get(youtubeChannelID);
if (found) {
stmt.run(newVideoID, this.guildId, youtubeChannelID);
found.lastVideoID = newVideoID;
return true;
} else return false;
}
asStrings () {
return this.feeds.map(feed => (feed.toString()));
}
} | 28.536364 | 109 | 0.655304 |
1e5e041f467a4abbbd65d1b8fa69c91bcc8f2c06 | 4,055 | js | JavaScript | components/table/selection-shortcuts-hoc.js | cybot1711/ring-ui | 79a5c891356ae2882926c33a95231d684a33d55b | [
"Apache-2.0"
] | null | null | null | components/table/selection-shortcuts-hoc.js | cybot1711/ring-ui | 79a5c891356ae2882926c33a95231d684a33d55b | [
"Apache-2.0"
] | null | null | null | components/table/selection-shortcuts-hoc.js | cybot1711/ring-ui | 79a5c891356ae2882926c33a95231d684a33d55b | [
"Apache-2.0"
] | null | null | null | import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import Selection from './selection';
export default function selectionShortcutsHOC(ComposedComponent) {
return class SelectionShortcuts extends PureComponent {
static propTypes = {
...ComposedComponent.propTypes,
selection: PropTypes.instanceOf(Selection).isRequired,
selectable: PropTypes.bool,
onSelect: PropTypes.func,
shortcuts: PropTypes.object
}
static defaultProps = {
...ComposedComponent.defaultProps,
selectable: true,
onSelect: () => {},
shortcuts: {}
}
onUpPress = () => {
const {selection, onSelect} = this.props;
const newSelection = selection.moveUp();
if (newSelection) {
onSelect(newSelection);
}
return false;
}
onDownPress = () => {
const {selection, onSelect} = this.props;
const newSelection = selection.moveDown();
if (newSelection) {
onSelect(newSelection);
}
return false;
}
onShiftKeyDown = () => {
const {selection} = this.props;
if (selection.isSelected(selection.getFocused())) {
this.shiftSelectionMode = 'deletion';
} else {
this.shiftSelectionMode = 'addition';
}
}
shiftSelect = selection => {
if (this.shiftSelectionMode === 'addition') {
return selection.select();
} else {
return selection.deselect();
}
}
onShiftUpPress = e => {
e.preventDefault();
const {selectable, selection, onSelect} = this.props;
if (!selectable) {
return;
}
const newSelection = this.shiftSelect(selection);
const newMovedSelection = newSelection.moveUp();
if (newMovedSelection) {
onSelect(newMovedSelection);
} else {
onSelect(newSelection);
}
}
onShiftDownPress = e => {
e.preventDefault();
const {selectable, selection, onSelect} = this.props;
if (!selectable) {
return;
}
const newSelection = this.shiftSelect(selection);
const newMovedSelection = newSelection.moveDown();
if (newMovedSelection) {
onSelect(newMovedSelection);
} else {
onSelect(newSelection);
}
}
onHomePress = () => {
const {selection, onSelect} = this.props;
const newSelection = selection.moveStart();
if (newSelection) {
onSelect(newSelection);
}
return false;
}
onEndPress = () => {
const {selection, onSelect} = this.props;
const newSelection = selection.moveEnd();
if (newSelection) {
onSelect(newSelection);
}
return false;
}
onSpacePress = () => {
const {selectable, selection, onSelect} = this.props;
if (!selectable) {
return true;
}
onSelect(selection.toggleSelection());
return false;
}
onEscPress = () => {
const {selection, onSelect} = this.props;
onSelect(selection.reset());
//this.restoreFocusWithoutScroll();
}
onCmdAPress = () => {
const {selectable, selection, onSelect} = this.props;
if (!selectable) {
return true;
}
onSelect(selection.selectAll());
return false;
}
shortcutsMap = {
up: this.onUpPress,
down: this.onDownPress,
shift: this.onShiftKeyDown,
'shift+up': this.onShiftUpPress,
'shift+down': this.onShiftDownPress,
home: this.onHomePress,
end: this.onEndPress,
space: this.onSpacePress,
esc: this.onEscPress,
'command+a': this.onCmdAPress,
'ctrl+a': this.onCmdAPress
}
render() {
const {selection, selectable, onSelect} = this.props;
return (
<ComposedComponent
{...this.props}
selection={selection}
selectable={selectable}
onSelect={onSelect}
shortcutsMap={{...this.shortcutsMap, ...this.props.shortcuts}}
/>
);
}
};
}
| 22.780899 | 72 | 0.58471 |
1e5ef8f95983fdd5806f78bc7ffd6837b9a2c7bb | 950 | js | JavaScript | client/scripts/directives/input.directive.js | sharmaraghav260/whatsApp | f6e9f45262f7d39e93fbfe024cf0ecdddfff4e05 | [
"MIT"
] | null | null | null | client/scripts/directives/input.directive.js | sharmaraghav260/whatsApp | f6e9f45262f7d39e93fbfe024cf0ecdddfff4e05 | [
"MIT"
] | null | null | null | client/scripts/directives/input.directive.js | sharmaraghav260/whatsApp | f6e9f45262f7d39e93fbfe024cf0ecdddfff4e05 | [
"MIT"
] | null | null | null | import {
Directive
} from 'angular-ecmascript/module-helpers';
export default class InputDirective extends Directive {
constructor() {
super(...arguments);
this.restrict = 'E';
this.scope = {
'returnClose': '=',
'onReturn': '&',
'onFocus': '&',
'onBlur': '&'
};
}
link(scope, element) {
element.bind('focus', (e) => {
if (!scope.onFocus) return;
this.$timeout(() => {
scope.onFocus();
});
});
element.bind('blur', (e) => {
if (!scope.onBlur) return;
this.$timeout(() => {
scope.onBlur();
});
});
element.bind('keydown', (e) => {
if (e.which != 13) return;
if (scope.returnClose) {
element[0].blur();
}
if (scope.onReturn) {
this.$timeout(() => {
scope.onReturn();
});
}
});
}
}
InputDirective.$name = 'input';
InputDirective.$inject = ['$timeout'];
| 17.592593 | 55 | 0.487368 |
1e5f042eb08067799452efa939f059c934bfbe8c | 12,402 | js | JavaScript | data/quests/2990.js | pwmirage/editor | f8018d05e1b6cc64b6b080ea8132b3e53eb4f01b | [
"MIT"
] | 4 | 2020-03-08T19:13:49.000Z | 2021-07-04T10:48:07.000Z | data/quests/2990.js | pwmirage/editor | f8018d05e1b6cc64b6b080ea8132b3e53eb4f01b | [
"MIT"
] | null | null | null | data/quests/2990.js | pwmirage/editor | f8018d05e1b6cc64b6b080ea8132b3e53eb4f01b | [
"MIT"
] | null | null | null | g_db.quests[2990]={id:2990,name:"^ffffffA Solo Task",type:1,trigger_policy:1,on_give_up_parent_fail:1,on_success_parent_success:0,can_give_up:1,can_retake:1,can_retake_after_failure:1,on_fail_parent_fail:0,fail_on_death:0,simultaneous_player_limit:0,ai_trigger:0,ai_trigger_enable:0,auto_trigger:0,trigger_on_death:0,remove_obtained_items:1,recommended_level:0,show_quest_title:1,show_as_gold_quest:0,start_npc:9820,finish_npc:0,is_craft_skill_quest:0,can_be_found:0,show_direction:1,level_min:111,level_max:120,dontshow_under_level_min:1,premise_coins:0,dontshow_without_premise_coins:1,req_reputation_min:0,req_reputation_max:0,dontshow_without_req_reputation:1,premise_quests:[],req_cultivation:20,dontshow_without_req_cultivation:1,req_faction_role:0,dontshow_without_req_faction_role:1,req_gender:0,dontshow_wrong_gender:1,req_class:0,dontshow_wrong_class:1,req_be_married:0,dontshow_without_marriage:0,req_be_gm:0,req_global_quest:0,req_global_quest_cond:0,quests_mutex:[],req_blacksmith_level:0,req_tailor_level:0,req_craftsman_level:0,req_apothecary_level:0,special_award_type:0,is_team_task:0,recv_in_team_only:0,req_success_type:0,req_npc_type:0,briefing:"I have to admit that death is not a good punishment for the mutinying tribes. But only by killing them can we stall their attacks. Youngster, take up your weapon. Are you ready?",parent_quest:0,previous_quest:0,next_quest:0,sub_quest_first:3004,dialogue:{initial:{id:3058,questions:[{id:1,id_parent:4294967295,text:"I have to admit that death is not a good punishment for the mutinying tribes. But only by killing them can we stall their attacks. Youngster, take up your weapon. Are you ready?",choices:[{id:2147483654,text:"Kill Phoenix Violator",param:3004,},{id:2147483654,text:"Kill Celestial Eidoplate",param:3005,},{id:2147483654,text:"Kill Collector of Souls",param:3006,},{id:2147483654,text:"Kill Raywing",param:3007,},{id:2147483654,text:"Kill Immortal Spikewing",param:3008,},]},]},},on_success:{normal:{xp:0,sp:0,coins:0,rep:0,culti:0,chi:0,level_multiplier:0,new_waypoint:0,storage_slots:0,inventory_slots:0,petbag_slots:0,ai_trigger:0,ai_trigger_enable:0,divorce:0,item_groups:[],},by_time:[],by_item_cnt:[],},on_failure:{normal:{xp:0,sp:0,coins:0,rep:0,culti:0,chi:0,level_multiplier:0,new_waypoint:0,storage_slots:0,inventory_slots:0,petbag_slots:0,ai_trigger:0,ai_trigger_enable:0,divorce:0,item_groups:[],},by_time:[],by_item_cnt:[],},children:[
{id:3004,name:"^ffffffPhoenix Violator",type:0,trigger_policy:0,on_give_up_parent_fail:1,on_success_parent_success:0,can_give_up:1,can_retake:1,can_retake_after_failure:1,on_fail_parent_fail:0,fail_on_death:0,simultaneous_player_limit:0,ai_trigger:0,ai_trigger_enable:0,auto_trigger:0,trigger_on_death:0,remove_obtained_items:1,recommended_level:0,show_quest_title:1,show_as_gold_quest:0,start_npc:9820,finish_npc:9820,is_craft_skill_quest:0,can_be_found:0,show_direction:1,level_min:0,level_max:0,dontshow_under_level_min:1,premise_coins:0,dontshow_without_premise_coins:1,req_reputation_min:0,req_reputation_max:0,dontshow_without_req_reputation:1,premise_quests:[],req_cultivation:0,dontshow_without_req_cultivation:1,req_faction_role:0,dontshow_without_req_faction_role:1,req_gender:0,dontshow_wrong_gender:1,req_class:0,dontshow_wrong_class:1,req_be_married:0,dontshow_without_marriage:0,req_be_gm:0,req_global_quest:0,req_global_quest_cond:0,quests_mutex:[],req_blacksmith_level:0,req_tailor_level:0,req_craftsman_level:0,req_apothecary_level:0,special_award_type:0,is_team_task:0,recv_in_team_only:0,req_success_type:1,req_npc_type:1,briefing:"Defeat 40 ^ffcb4aPhoenix Violators^ffffff in the skies and report to the Elder of White Lotus Residence.",parent_quest:2990,previous_quest:0,next_quest:3005,sub_quest_first:0,dialogue:{finish:{id:3214,questions:[{id:1,id_parent:4294967295,text:"Nice work. The perimeter is more secured now.",choices:[{id:2147483655,text:"That's great.",param:3004,},]},]},},on_success:{normal:{xp:4440,sp:5550,coins:888,rep:0,culti:0,chi:0,level_multiplier:0,new_waypoint:0,storage_slots:0,inventory_slots:0,petbag_slots:0,ai_trigger:0,ai_trigger_enable:0,divorce:0,item_groups:[],},by_time:[],by_item_cnt:[],},on_failure:{normal:{xp:0,sp:0,coins:0,rep:0,culti:0,chi:0,level_multiplier:0,new_waypoint:0,storage_slots:0,inventory_slots:0,petbag_slots:0,ai_trigger:0,ai_trigger_enable:0,divorce:0,item_groups:[],},by_time:[],by_item_cnt:[],},children:[]},
{id:3005,name:"^ffffffCelestial Eidoplate",type:0,trigger_policy:0,on_give_up_parent_fail:1,on_success_parent_success:0,can_give_up:1,can_retake:1,can_retake_after_failure:1,on_fail_parent_fail:0,fail_on_death:0,simultaneous_player_limit:0,ai_trigger:0,ai_trigger_enable:0,auto_trigger:0,trigger_on_death:0,remove_obtained_items:1,recommended_level:0,show_quest_title:1,show_as_gold_quest:0,start_npc:9820,finish_npc:9820,is_craft_skill_quest:0,can_be_found:0,show_direction:1,level_min:0,level_max:0,dontshow_under_level_min:1,premise_coins:0,dontshow_without_premise_coins:1,req_reputation_min:0,req_reputation_max:0,dontshow_without_req_reputation:1,premise_quests:[],req_cultivation:0,dontshow_without_req_cultivation:1,req_faction_role:0,dontshow_without_req_faction_role:1,req_gender:0,dontshow_wrong_gender:1,req_class:0,dontshow_wrong_class:1,req_be_married:0,dontshow_without_marriage:0,req_be_gm:0,req_global_quest:0,req_global_quest_cond:0,quests_mutex:[],req_blacksmith_level:0,req_tailor_level:0,req_craftsman_level:0,req_apothecary_level:0,special_award_type:0,is_team_task:0,recv_in_team_only:0,req_success_type:1,req_npc_type:1,briefing:"Defeat 40 ^ffcb4aCelestial Eidoplates^ffffff around the White Lotus Residence and report to the Elder of the residence.",parent_quest:2990,previous_quest:3004,next_quest:3006,sub_quest_first:0,dialogue:{finish:{id:3215,questions:[{id:1,id_parent:4294967295,text:"Nice work. The perimeter is more secured now.",choices:[{id:2147483655,text:"That's great.",param:3005,},]},]},},on_success:{normal:{xp:4520,sp:5650,coins:904,rep:0,culti:0,chi:0,level_multiplier:0,new_waypoint:0,storage_slots:0,inventory_slots:0,petbag_slots:0,ai_trigger:0,ai_trigger_enable:0,divorce:0,item_groups:[],},by_time:[],by_item_cnt:[],},on_failure:{normal:{xp:0,sp:0,coins:0,rep:0,culti:0,chi:0,level_multiplier:0,new_waypoint:0,storage_slots:0,inventory_slots:0,petbag_slots:0,ai_trigger:0,ai_trigger_enable:0,divorce:0,item_groups:[],},by_time:[],by_item_cnt:[],},children:[]},
{id:3006,name:"^ffffffCollector of Souls",type:0,trigger_policy:0,on_give_up_parent_fail:1,on_success_parent_success:0,can_give_up:1,can_retake:1,can_retake_after_failure:1,on_fail_parent_fail:0,fail_on_death:0,simultaneous_player_limit:0,ai_trigger:0,ai_trigger_enable:0,auto_trigger:0,trigger_on_death:0,remove_obtained_items:1,recommended_level:0,show_quest_title:1,show_as_gold_quest:0,start_npc:9820,finish_npc:9820,is_craft_skill_quest:0,can_be_found:0,show_direction:1,level_min:0,level_max:0,dontshow_under_level_min:1,premise_coins:0,dontshow_without_premise_coins:1,req_reputation_min:0,req_reputation_max:0,dontshow_without_req_reputation:1,premise_quests:[],req_cultivation:0,dontshow_without_req_cultivation:1,req_faction_role:0,dontshow_without_req_faction_role:1,req_gender:0,dontshow_wrong_gender:1,req_class:0,dontshow_wrong_class:1,req_be_married:0,dontshow_without_marriage:0,req_be_gm:0,req_global_quest:0,req_global_quest_cond:0,quests_mutex:[],req_blacksmith_level:0,req_tailor_level:0,req_craftsman_level:0,req_apothecary_level:0,special_award_type:0,is_team_task:0,recv_in_team_only:0,req_success_type:1,req_npc_type:1,briefing:"Defeat 40 ^ffcb4aCollectors of Souls^ffffff at Twilight Vale and report to the Elder of White Lotus Residence. ",parent_quest:2990,previous_quest:3005,next_quest:3007,sub_quest_first:0,dialogue:{finish:{id:3216,questions:[{id:1,id_parent:4294967295,text:"Nice work. The perimeter is more secured now.",choices:[{id:2147483655,text:"That's great.",param:3006,},]},]},},on_success:{normal:{xp:4600,sp:5750,coins:920,rep:0,culti:0,chi:0,level_multiplier:0,new_waypoint:0,storage_slots:0,inventory_slots:0,petbag_slots:0,ai_trigger:0,ai_trigger_enable:0,divorce:0,item_groups:[],},by_time:[],by_item_cnt:[],},on_failure:{normal:{xp:0,sp:0,coins:0,rep:0,culti:0,chi:0,level_multiplier:0,new_waypoint:0,storage_slots:0,inventory_slots:0,petbag_slots:0,ai_trigger:0,ai_trigger_enable:0,divorce:0,item_groups:[],},by_time:[],by_item_cnt:[],},children:[]},
{id:3007,name:"^ffffffDefeat Raywing",type:0,trigger_policy:0,on_give_up_parent_fail:1,on_success_parent_success:0,can_give_up:1,can_retake:1,can_retake_after_failure:1,on_fail_parent_fail:0,fail_on_death:0,simultaneous_player_limit:0,ai_trigger:0,ai_trigger_enable:0,auto_trigger:0,trigger_on_death:0,remove_obtained_items:1,recommended_level:0,show_quest_title:1,show_as_gold_quest:0,start_npc:9820,finish_npc:9820,is_craft_skill_quest:0,can_be_found:0,show_direction:1,level_min:0,level_max:0,dontshow_under_level_min:1,premise_coins:0,dontshow_without_premise_coins:1,req_reputation_min:0,req_reputation_max:0,dontshow_without_req_reputation:1,premise_quests:[],req_cultivation:0,dontshow_without_req_cultivation:1,req_faction_role:0,dontshow_without_req_faction_role:1,req_gender:0,dontshow_wrong_gender:1,req_class:0,dontshow_wrong_class:1,req_be_married:0,dontshow_without_marriage:0,req_be_gm:0,req_global_quest:0,req_global_quest_cond:0,quests_mutex:[],req_blacksmith_level:0,req_tailor_level:0,req_craftsman_level:0,req_apothecary_level:0,special_award_type:0,is_team_task:0,recv_in_team_only:0,req_success_type:1,req_npc_type:1,briefing:"Defeat 40 ^ffcb4aRaywings^ffffff in Twilight Vale and report to the Elder of the White Lotus Residence.",parent_quest:2990,previous_quest:3006,next_quest:3008,sub_quest_first:0,dialogue:{finish:{id:3217,questions:[{id:1,id_parent:4294967295,text:"Nice work. The perimeter is more secured now.",choices:[{id:2147483655,text:"That's great.",param:3007,},]},]},},on_success:{normal:{xp:4680,sp:5850,coins:936,rep:0,culti:0,chi:0,level_multiplier:0,new_waypoint:0,storage_slots:0,inventory_slots:0,petbag_slots:0,ai_trigger:0,ai_trigger_enable:0,divorce:0,item_groups:[],},by_time:[],by_item_cnt:[],},on_failure:{normal:{xp:0,sp:0,coins:0,rep:0,culti:0,chi:0,level_multiplier:0,new_waypoint:0,storage_slots:0,inventory_slots:0,petbag_slots:0,ai_trigger:0,ai_trigger_enable:0,divorce:0,item_groups:[],},by_time:[],by_item_cnt:[],},children:[]},
{id:3008,name:"^ffffffImmortal Spikewing",type:0,trigger_policy:0,on_give_up_parent_fail:1,on_success_parent_success:0,can_give_up:1,can_retake:1,can_retake_after_failure:1,on_fail_parent_fail:0,fail_on_death:0,simultaneous_player_limit:0,ai_trigger:0,ai_trigger_enable:0,auto_trigger:0,trigger_on_death:0,remove_obtained_items:1,recommended_level:0,show_quest_title:1,show_as_gold_quest:0,start_npc:9820,finish_npc:9820,is_craft_skill_quest:0,can_be_found:0,show_direction:1,level_min:0,level_max:0,dontshow_under_level_min:1,premise_coins:0,dontshow_without_premise_coins:1,req_reputation_min:0,req_reputation_max:0,dontshow_without_req_reputation:1,premise_quests:[],req_cultivation:0,dontshow_without_req_cultivation:1,req_faction_role:0,dontshow_without_req_faction_role:1,req_gender:0,dontshow_wrong_gender:1,req_class:0,dontshow_wrong_class:1,req_be_married:0,dontshow_without_marriage:0,req_be_gm:0,req_global_quest:0,req_global_quest_cond:0,quests_mutex:[],req_blacksmith_level:0,req_tailor_level:0,req_craftsman_level:0,req_apothecary_level:0,special_award_type:0,is_team_task:0,recv_in_team_only:0,req_success_type:1,req_npc_type:1,briefing:"Defeat 40 ^ffcb4aImmortal Spikewings^ffffff and report to the Elder of White Lotus Residence.",parent_quest:2990,previous_quest:3007,next_quest:0,sub_quest_first:0,dialogue:{finish:{id:3218,questions:[{id:1,id_parent:4294967295,text:"Nice work. The perimeter is more secured now.",choices:[{id:2147483655,text:"That's great.",param:3008,},]},]},},on_success:{normal:{xp:4760,sp:5950,coins:952,rep:0,culti:0,chi:0,level_multiplier:0,new_waypoint:0,storage_slots:0,inventory_slots:0,petbag_slots:0,ai_trigger:0,ai_trigger_enable:0,divorce:0,item_groups:[],},by_time:[],by_item_cnt:[],},on_failure:{normal:{xp:0,sp:0,coins:0,rep:0,culti:0,chi:0,level_multiplier:0,new_waypoint:0,storage_slots:0,inventory_slots:0,petbag_slots:0,ai_trigger:0,ai_trigger_enable:0,divorce:0,item_groups:[],},by_time:[],by_item_cnt:[],},children:[]},]};
| 1,771.714286 | 2,429 | 0.844057 |
1e5f066ffdc74b26d61f6452d9d1655b390011df | 3,798 | js | JavaScript | routes/index.js | Srivasavi-vipparla/web-app-2020-fall | 1eb8f7bf4878c09528ddba6974f546e4de9d3b40 | [
"MIT"
] | null | null | null | routes/index.js | Srivasavi-vipparla/web-app-2020-fall | 1eb8f7bf4878c09528ddba6974f546e4de9d3b40 | [
"MIT"
] | null | null | null | routes/index.js | Srivasavi-vipparla/web-app-2020-fall | 1eb8f7bf4878c09528ddba6974f546e4de9d3b40 | [
"MIT"
] | null | null | null | /**
* @index.js - manages all routing
*
* router.get when assigning to a single request
* router.use when deferring to a controller
*
* @author Denise Case <dcase@nwmissouri.edu>
* @requires express
*/
const express = require('express');
const LOG = require('../util/logger');
const userRouter = require('./users');
const rabbitRoutes = require('./rabbit.routes');
const animalRoutes = require('./animal.routes');
const teaRoutes = require('./tea.routes');
const gameRoutes = require('./game.routes');
const countryRoutes = require('./country.routes');
const chiefRoutes = require('./chief.routes');
const plantRoutes = require('./plant.routes');
const foodRoutes = require('./food.routes');
const softwareRoutes = require('./software.routes');
const whiskeyRoutes = require('./whiskey.routes');
const bookRoutes = require('./book.routes');
const videogameRoutes = require('./videogame.routes');
const companyRoutes = require('./company.routes');
const cricketRoutes = require('./cricket.routes');
const seriesRoutes = require('./series.routes');
const fruitRoutes = require('./fruit.routes');
const shipRoutes = require('./ship.routes');
const danceRoutes = require('./dance.routes');
const pokemanRoutes = require('./pokemon.routes');
LOG.info('routes/index.js: STARTING custom routes......');
const router = express.Router();
// Manage top-level request first
const appTitle = 'MVC Web App - Fall 2020';
const appSubTitle = 'our collaborative web app';
/* GET home page. */
router.get('/', (req, res) => {
res.render('index.ejs', { title: appTitle, subTitle: appSubTitle });
});
router.get('/index', (req, res) => {
res.render('index.ejs', { title: appTitle, subTitle: appSubTitle });
});
router.use('/user', userRouter);
// Dr. Case - rabbit
try {
router.use('/rabbit', rabbitRoutes);
} catch (err) {
LOG.error(`ERROR: ${err.message}`);
}
// Dr. Hoot - tea
router.use('/tea', teaRoutes);
// Blake - game
try {
router.use('/game', gameRoutes);
} catch (err) {
LOG.error(`ERROR: ${err.message}`);
}
// Varsha - animal
try {
router.use('/animal', animalRoutes);
} catch (err) {
LOG.error(`ERROR: ${err.message}`);
}
// Felipe - country
try {
router.use('/country', countryRoutes);
} catch (err) {
LOG.error(`ERROR: ${err.message}`);
}
// Jack - chief
try {
router.use('/chief', chiefRoutes);
} catch (err) {
LOG.error(`ERROR: ${err.message}`);
}
// Sreenidhi - plant
try {
router.use('/plant', plantRoutes);
} catch (err) {
LOG.error(`ERROR: ${err.message}`);
}
// Sri Vasavi - food
try{
router.use('/food', foodRoutes);
}catch(err){
LOG.error(`ERROR: ${err.message}`);
}
// Joseph - software
router.use('/software', softwareRoutes);
// Stephen - whiskey
try {
router.use('/whiskey', whiskeyRoutes);
} catch (err) {
LOG.error(`ERROR: ${err.message}`);
}
// Shivani - book
router.use('/book', bookRoutes);
// Kunal - videoGame
try {
router.use('/videogame', videogameRoutes);
} catch (err) {
LOG.error(`ERROR: ${err.message}`);
}
// Chandler - company
try {
router.use('/company', companyRoutes);
} catch (err) {
LOG.error(`ERROR: ${err.message}`);
}
// Praneeth - cricket
router.use('/cricket', cricketRoutes);
// Nithya - series
router.use('/series', seriesRoutes);
// Zach - fruit
try {
router.use('/fruit', fruitRoutes);
} catch (err) {
LOG.error(`ERROR: ${err.message}`);
}
// Sam - ship
try {
router.use('/ship', shipRoutes);
} catch (err) {
LOG.error(`ERROR: ${err.message}`);
}
// Prashansa - dance
try {
router.use('/dance', danceRoutes);
} catch (err) {
LOG.error(`ERROR: ${err.message}`);
}
// Lindsey - Pokemon
try {
router.use('/pokemon', pokemanRoutes);
} catch (err) {
LOG.error(`ERROR: ${err.message}`);
}
LOG.info('routes/index.js: ENDING custom routes......');
module.exports = router;
| 22.473373 | 70 | 0.655345 |
1e5fa5d8e387348f0a6589650673c76e24d83176 | 1,230 | js | JavaScript | core/links.js | didierfranc/route.js | a1dafc8749d997299e10816d8ef1451d909c1bff | [
"MIT"
] | 2 | 2016-02-25T16:57:22.000Z | 2016-06-10T08:00:39.000Z | core/links.js | didierfranc/autoroute.js | a1dafc8749d997299e10816d8ef1451d909c1bff | [
"MIT"
] | null | null | null | core/links.js | didierfranc/autoroute.js | a1dafc8749d997299e10816d8ef1451d909c1bff | [
"MIT"
] | null | null | null | import { el } from './dom'
import route from '../index.js'
import Touch from 'hammerjs'
const linkify = () => {
if ( route.t.link[0] ) {
route.t.link.forEach( e => e.destroy() )
route.t.tap.forEach( e => e.destroy() )
}
el('[link]', (el, i) => {
route.t.link[i] = new Touch.Manager(el)
route.t.link[i].add(new Touch.Tap())
route.t.link[i].on('tap', ev => {
if (!ev.target.hasAttribute('link')) {
while (!ev.target.hasAttribute('link')) {
ev.target = ev.target.parentElement
}
window.location.hash = '/' + ev.target.getAttribute('link')
} else {
window.location.hash = '/' + ev.target.getAttribute('link')
}
if (ev.target.offsetParent.tagName == 'FOOTER') {
document.querySelectorAll('footer .active')[0].classList.remove('active')
ev.target.classList.add('active')
}
})
})
el('[ontap]', (el, i) => {
route.t.tap[i] = new Touch.Manager(el)
route.t.tap[i].add(new Touch.Tap())
route.t.tap[i].on('tap', ev => {
var fn = () => eval(ev.target.getAttribute('ontap'))
fn.call(route.routes[window.location.hash.split('#/')[1].split('?')[0]])
})
})
}
export default linkify
| 25.625 | 81 | 0.557724 |
1e5fbfac666f0089f9e0cdb26a3affd71477efe3 | 74 | js | JavaScript | application/routes/home/react/server.js | prizerok/test01 | 085faadd761e52b753d4e061ba43e8780a61e48a | [
"MIT"
] | null | null | null | application/routes/home/react/server.js | prizerok/test01 | 085faadd761e52b753d4e061ba43e8780a61e48a | [
"MIT"
] | null | null | null | application/routes/home/react/server.js | prizerok/test01 | 085faadd761e52b753d4e061ba43e8780a61e48a | [
"MIT"
] | null | null | null | export default function(req, res) {
res.setData("a", 222);
res.end();
}
| 14.8 | 35 | 0.635135 |
1e60058bf3af83b0f42fca98c864afad2b02bc68 | 4,676 | js | JavaScript | public/js/auth-manager.js | udotb/Niche-Practice | 6cc9ecd5ff0223ae88a9a21e55064bdb1335c973 | [
"MIT"
] | null | null | null | public/js/auth-manager.js | udotb/Niche-Practice | 6cc9ecd5ff0223ae88a9a21e55064bdb1335c973 | [
"MIT"
] | null | null | null | public/js/auth-manager.js | udotb/Niche-Practice | 6cc9ecd5ff0223ae88a9a21e55064bdb1335c973 | [
"MIT"
] | null | null | null | window.appName = 'NichePractice';
// console.log(window.appName);
// $(window).load(function(){
// console.log("loading");
// setTimeout(function () {
// runAuthAction();
// }, 1000);
// });
$(document.body).on('click', '.connect-auth', function() {
var type = $(this).attr("data-type").toLowerCase();
var baseUrl = $('#hfBaseUrl').val();
if(type)
{
var id = 'auth-manager-modal';
var html = '';
html += '<div class="social-module">';
html += '<div class="'+type+'-connect-icon"></div>';
html += '<div class="social-modal-content">';
html += '<h3>Authorize '+window.appName+' on '+type.charAt(0).toUpperCase() + type.substr(1).toLowerCase()+'</h3>';
html += '<div class="social-list">';
html += '<label>By connecting your account, you will be able to:</label>';
html += '<ul>';
html += '<li>Receive viral content recommendations from '+window.appName+' and share them to your '+type.charAt(0).toUpperCase() + type.substr(1).toLowerCase()+' profile.</li>';
html += '<li>Monitor activity and manage posts.</li>';
html += '</ul>';
html += '</div>';
html += '</div>';
html +='</div>';
loadModal(id);
$('#'+id).addClass('confirmation-modal');
$('.modal-dialog', '#'+id).addClass('modal-lg modal-dialog-centered');
$(".modal-title",'#'+id).remove();
$('.modal-body', '#'+id).html(html);
html = '';
html +='<div class="modal-footer">';
html +='<button type="button" class="btn '+type+'-widget-btn connect-in" data-type="'+type+'">';
html += 'Connect ' + type.charAt(0).toUpperCase() + type.substr(1).toLowerCase();
html +='</button>';
html +='</div>';
$('.modal-content', '#'+id).append(html);
}
});
$(document.body).on('click', '.connect-in', function() {
showPreloader();
// var type = $(this).attr("data-type");
var type = $("#actionRequest").val();
var baseUrl = $('#hfBaseUrl').val();
var currentPage = $('#currentPage').val();
var business_id = $('#business_id').val();
if(type)
{
if(currentPage === 'social_post_settings' || currentPage === 'get_started')
{
location.href = baseUrl + '/auth-manager?type='+type+'&referType='+currentPage+'&business_id='+business_id;
}
else if(currentPage === 'promotions')
{
location.href = baseUrl + '/auth-manager?type='+type+'&referType='+currentPage+'&business_id='+business_id+'&promotion='+window.btoa(window.templateId);
}
else
{
location.href = baseUrl + '/auth-manager?type='+type+'&business_id='+business_id;
}
}
});
$(document.body).on('hidden.bs.modal', '#auth-manager-modal', function() {
var modelId = $("#auth-manager-modal");
// $(".modal-header .modal-title", modelId).remove();
modelId.removeClass("confirmation-modal");
$(".modal-dialog", modelId).removeClass("modal-lg modal-dialog-centered");
$(".modal-footer", modelId).remove();
});
function runAuthAction()
{
// console.log("runAuthAction");
var accessTokenSelector = $('#auth-response');
var accessToken = accessTokenSelector.val();
var actionType = accessTokenSelector.attr("data-type");
var message = '';
// console.log("runnng " + accessToken);
// console.log("actionType " + actionType);
if(accessTokenSelector.length === 1)
{
if(accessToken === 'success')
{
message = actionType + ' successfully connected.';
//swal("", message, "success");
swal({
title: "",
text: message,
type: 'success',
},function(){
var uri = window.location.toString();
if (uri.indexOf("?") > 0) {
var clean_uri = uri.substring(0, uri.indexOf("?"));
window.history.replaceState({}, document.title, clean_uri);
}
});
}
else
{
message = accessTokenSelector.attr("data-message");
//swal("", message, "error");
swal({
title: "",
text: message,
type: 'error',
},function(){
var uri = window.location.toString();
if (uri.indexOf("?") > 0) {
var clean_uri = uri.substring(0, uri.indexOf("?"));
window.history.replaceState({}, document.title, clean_uri);
}
});
}
}
}
| 31.38255 | 185 | 0.522455 |
1e60818b404e17e2c4af9bb12c0bddcc6b988c9e | 52 | js | JavaScript | backend/app/config/auth.config.js | debrupofficial365/registration-login-react-node.js-mongodb-express | 8cff584b99e6ef8f73eded19bbd57f9ec67a3fd9 | [
"MIT"
] | 1 | 2021-06-22T12:18:41.000Z | 2021-06-22T12:18:41.000Z | backend/app/config/auth.config.js | debrupofficial365/registration-login-react-node.js-mongodb-express | 8cff584b99e6ef8f73eded19bbd57f9ec67a3fd9 | [
"MIT"
] | null | null | null | backend/app/config/auth.config.js | debrupofficial365/registration-login-react-node.js-mongodb-express | 8cff584b99e6ef8f73eded19bbd57f9ec67a3fd9 | [
"MIT"
] | null | null | null | module.exports = {
secret: "debrup-secret-key"
};
| 13 | 29 | 0.653846 |
1e6084430a1517cbb9a9f4aa41d4974678f32570 | 3,215 | js | JavaScript | api-docs/exporter/src/exporter/Plugin.js | a4-data/a4-UI-EXT | ec16d056f5e768dd1d4ef0ada84aedb50629a6bb | [
"Apache-2.0",
"MIT"
] | 94 | 2018-08-29T15:23:23.000Z | 2022-01-30T07:46:28.000Z | api-docs/exporter/src/exporter/Plugin.js | a4-data/a4-UI-EXT | ec16d056f5e768dd1d4ef0ada84aedb50629a6bb | [
"Apache-2.0",
"MIT"
] | 49 | 2018-08-21T22:44:33.000Z | 2021-08-11T21:08:29.000Z | api-docs/exporter/src/exporter/Plugin.js | a4-data/a4-UI-EXT | ec16d056f5e768dd1d4ef0ada84aedb50629a6bb | [
"Apache-2.0",
"MIT"
] | 46 | 2018-08-08T17:12:19.000Z | 2021-11-11T10:00:49.000Z | /**
* @class Ext.exporter.Plugin
* @extend Ext.plugin.Abstract
* @alias plugin.exporterplugin
*
* This is the base class for an exporter plugin. It is extended by the exporter plugins
* for grid panel and pivot grid.
*
* This could be used to create a plugin that allows a component to export tabular data.
*
* @private
*/
/**
* @event beforedocumentsave
* Fires on the component before a document is exported and saved.
* @param {Ext.Component} component Reference to the component that uses this plugin
* @param {Object} params Additional parameters sent with this event
* @param {Object} params.config The config object used in the {@link #saveDocumentAs} method
* @param {Ext.exporter.Base} params.exporter A reference to the exporter object used to save the document
*/
/**
* @event documentsave
* Fires on the component whenever a document is exported and saved.
* @param {Ext.Component} component Reference to the component that uses this plugin
* @param {Object} params Additional parameters sent with this event
* @param {Object} params.config The config object used in the {@link #saveDocumentAs} method
* @param {Ext.exporter.Base} params.exporter A reference to the exporter object used to save the document
*/
/**
* @event dataready
* Fires on the component when the {@link Ext.exporter.data.Table data} is ready.
* You could adjust styles or data before the document is generated and saved.
* @param {Ext.Component} component Reference to the component that uses this plugin
* @param {Object} params Additional parameters sent with this event
* @param {Object} params.config The config object used in the {@link #saveDocumentAs} method
* @param {Ext.exporter.Base} params.exporter A reference to the exporter object used to save the document
*/
/**
* @method saveDocumentAs
* Save the export file. This method is added to the component as "saveDocumentAs".
*
* Pass in exporter specific configs to the config parameter.
*
* @param {Ext.exporter.Base} config Config object used to initialize the proper exporter
* @param {String} config.type Type of the exporter as defined in the exporter alias. Default is `excel`.
* @param {String} [config.title] Title added to the export document
* @param {String} [config.author] Who exported the document?
* @param {String} [config.fileName] Name of the exported file, including the extension
* @param {String} [config.charset] Exported file's charset
*
* @return {Ext.promise.Promise}
*
*/
/**
* @method getDocumentData
* Fetch the export data. This method is added to the component as "getDocumentData".
*
* Pass in exporter specific configs to the config parameter.
*
* @param {Ext.exporter.Base} config Config object used to initialize the proper exporter
* @param {String} [config.type] Type of the exporter as defined in the exporter alias. Default is `excel`.
* @param {String} [config.title] Title added to the export document
* @param {String} [config.author] Who exported the document?
* @return {String}
*
*/
/**
* @method getExportStyle
* @param {Object/Array} style
* @param {Object} config Configuration passed to saveDocumentAs and getDocumentData methods
* @return {Object}
*/
| 41.753247 | 107 | 0.742457 |
1e60ad57312332973a731202205f713efd7e8a5f | 469 | js | JavaScript | src/commands/Miscellaneous/grady.js | MaxTechnics/jaidens-discord-utilities | fae055f2267387b3297815350408d1716cd159a2 | [
"MIT"
] | null | null | null | src/commands/Miscellaneous/grady.js | MaxTechnics/jaidens-discord-utilities | fae055f2267387b3297815350408d1716cd159a2 | [
"MIT"
] | null | null | null | src/commands/Miscellaneous/grady.js | MaxTechnics/jaidens-discord-utilities | fae055f2267387b3297815350408d1716cd159a2 | [
"MIT"
] | null | null | null | const { Message } = require('discord.js');
const Bot = require('../../../index');
module.exports = {
name: 'grady',
hidden: true,
usage: 'grady',
description: 'grady',
/**
* @param {Bot} bot
* @param {Message} message
* @param {string[]} args
*/
run: async(bot, message, args) => {
message.channel.send('<@740491200972193793>');
message.channel.send('<:7462067385035653531:781950847616548895>');
}
}; | 26.055556 | 74 | 0.5629 |
1e619bfdad9902c75a64e45a63183fee84b79ea1 | 5,904 | js | JavaScript | controllers/files.js | BlackIIIFOX/NodeJsTamagotchiServer | cdb131a3c67164b228aab9f0a4c01a6801c56061 | [
"MIT"
] | null | null | null | controllers/files.js | BlackIIIFOX/NodeJsTamagotchiServer | cdb131a3c67164b228aab9f0a4c01a6801c56061 | [
"MIT"
] | null | null | null | controllers/files.js | BlackIIIFOX/NodeJsTamagotchiServer | cdb131a3c67164b228aab9f0a4c01a6801c56061 | [
"MIT"
] | null | null | null | const express = require('express')
const router = express.Router()
const passport = require("passport")
const HttpStatus = require('http-status-codes')
const {v4: uuidv4} = require('uuid')
const fs = require('fs')
const path = require('path')
const {promisify} = require('util')
const stat = promisify(fs.stat)
const FileModel = require('../models/FileModel')
const url = require('url')
const ErrorMessageModel = require('../models/ErrorMessageModel')
const NotFoundException = require('../models/Exceptions/NotFoundException')
const InvalidArgumentException = require('../models/Exceptions/InvalidArgumentException')
const restaurant = require('../services/RestaurantRepository')
router.post("/", passport.authenticate("jwt", {session: false}), upload)
router.get("/:id/", download)
router.get("/release/client-android-app/", downloadClientApp)
router.post("/release/client-android-app/", uploadClientApp)
router.get("/release/staff-android-app/", downloadStaffApp)
router.post("/release/staff-android-app/", uploadStaffApp)
async function upload(req, res) {
if (!req.files || Object.keys(req.files).length === 0 || !req.files.file) {
return res.status(HttpStatus.BAD_REQUEST).send(new ErrorMessageModel('No files were uploaded.'))
}
try {
let file = req.files.file
let realFileName = file.name
const extension = path.extname(realFileName)
let randomFileName = `${uuidv4()}.${extension}`
let fileInfo = new FileModel(undefined, realFileName, extension, randomFileName)
await file.mv(`${global.gConfig.files_path}/${fileInfo.path}`)
fileInfo = await restaurant.Files.saveFile(fileInfo)
let returnedValue = {id: fileInfo.id, name: fileInfo.name, type: fileInfo.type}
res.json(returnedValue)
} catch (e) {
res.status(HttpStatus.INTERNAL_SERVER_ERROR).json(new ErrorMessageModel("Internal Server Error. Error: " + e.message))
}
}
async function download(req, res) {
try {
const fileInfo = await restaurant.Files.getFile(req.params.id)
const filePath = `${global.gConfig.files_path}/${fileInfo.path}`
const isExist = await stat(filePath) // Будет исключение, если не существует.
await res.download(filePath) // Set disposition and send it.
} catch (e) {
if (e instanceof NotFoundException) {
res.status(HttpStatus.NOT_FOUND).json(new ErrorMessageModel("File not found"))
} else {
res.status(HttpStatus.INTERNAL_SERVER_ERROR).json(new ErrorMessageModel("Internal Server Error. Error: " + e.message))
}
}
}
async function downloadClientApp(req, res) {
try {
const filePath = `${global.gConfig.files_path}/release/android-client/release.apk`
try {
const isExist = await stat(filePath) // Будет исключение, если не существует.
} catch (e) {
throw new NotFoundException("Not found")
}
await res.download(filePath) // Set disposition and send it.
} catch (e) {
if (e instanceof NotFoundException) {
res.status(HttpStatus.NOT_FOUND).json(new ErrorMessageModel(e.toString()))
} else {
res.status(HttpStatus.INTERNAL_SERVER_ERROR).json(new ErrorMessageModel("Internal Server Error. Error: " + e.message))
}
}
}
async function uploadClientApp(req, res) {
try {
let file = req.files.file
let realFileName = file.name
const extension = path.extname(realFileName)
if (!file || extension !== '.apk') {
throw new InvalidArgumentException()
}
await file.mv(`${global.gConfig.files_path}/release/android-client/release.apk`)
res.status(HttpStatus.CREATED).send()
} catch (e) {
if (e instanceof InvalidArgumentException) {
res.status(HttpStatus.BAD_REQUEST).send(
new ErrorMessageModel("The file does not exist or the extension is not apk"))
} else {
res.status(HttpStatus.INTERNAL_SERVER_ERROR).send({message: e.message})
}
}
}
async function downloadStaffApp(req, res) {
try {
const filePath = `${global.gConfig.files_path}/release/android-staff/release.apk`
try {
const isExist = await stat(filePath) // Будет исключение, если не существует.
} catch (e) {
throw new NotFoundException("Not found")
}
await res.download(filePath) // Set disposition and send it.
} catch (e) {
if (e instanceof NotFoundException) {
res.status(HttpStatus.NOT_FOUND).json(new ErrorMessageModel(e.toString()))
} else {
res.status(HttpStatus.INTERNAL_SERVER_ERROR).json(new ErrorMessageModel("Internal Server Error. Error: " + e.message))
}
}
}
async function uploadStaffApp(req, res) {
try {
let file = req.files.file
let realFileName = file.name
const extension = path.extname(realFileName)
if (!file || extension !== '.apk') {
throw new InvalidArgumentException()
}
await file.mv(`${global.gConfig.files_path}/release/android-staff/release.apk`)
res.status(HttpStatus.CREATED).send()
} catch (e) {
if (e instanceof InvalidArgumentException) {
res.status(HttpStatus.BAD_REQUEST).send(
new ErrorMessageModel("The file does not exist or the extension is not apk"))
} else {
res.status(HttpStatus.INTERNAL_SERVER_ERROR).send({message: e.message})
}
}
}
function fullUrl(req) {
return url.format({
protocol: req.protocol,
host: req.get('host'),
pathname: req.originalUrl
})
}
module.exports = router
| 37.367089 | 131 | 0.634316 |
1e62ab82087ffcbd97b681cc3b26781f70b7bb4f | 814 | js | JavaScript | v3/src/input/components/GetTransformedPoint.js | HaywardMorihara/phaser | fe835266fdee3ad11a0ca7a99cba995a2cd04117 | [
"MIT"
] | null | null | null | v3/src/input/components/GetTransformedPoint.js | HaywardMorihara/phaser | fe835266fdee3ad11a0ca7a99cba995a2cd04117 | [
"MIT"
] | null | null | null | v3/src/input/components/GetTransformedPoint.js | HaywardMorihara/phaser | fe835266fdee3ad11a0ca7a99cba995a2cd04117 | [
"MIT"
] | null | null | null | /**
* This will return the local coordinates of the specified displayObject based on the given Pointer.
*
* @method Phaser.Input#getLocalPosition
* @param {Phaser.Sprite|Phaser.Image} gameObject - The DisplayObject to get the local coordinates for.
* @param {Phaser.Pointer} pointer - The Pointer to use in the check against the gameObject.
* @return {Phaser.Point} A point containing the coordinates of the Pointer position relative to the DisplayObject.
*/
var GetTransformedPoint = function (matrix, gameObject, x, y, output)
{
if (output === undefined) { output = { x: 0, y: 0 }; }
matrix.applyITRS(gameObject.x, gameObject.y, -gameObject.rotation, gameObject.scaleX, gameObject.scaleY);
matrix.invert();
return matrix.transformPoint(x, y, output);
};
module.exports = GetTransformedPoint;
| 38.761905 | 114 | 0.743243 |
1e62b70003b6c4d13e1d9eccb34fb4b447213fd7 | 668 | js | JavaScript | index.js | freddjah/thesubdb-hash | ea5e06ffdd1e5b1814e3c8c7a52ad1e642168512 | [
"Unlicense"
] | null | null | null | index.js | freddjah/thesubdb-hash | ea5e06ffdd1e5b1814e3c8c7a52ad1e642168512 | [
"Unlicense"
] | null | null | null | index.js | freddjah/thesubdb-hash | ea5e06ffdd1e5b1814e3c8c7a52ad1e642168512 | [
"Unlicense"
] | null | null | null | const fs = require('fs').promises;
const md5 = require('md5');
/**
* Calculates the hash of a file based on thesubdb.com hash function. Uses async/await.
* http://thesubdb.com/api/
*
* @param {String} filePath The path to the file whos hash wants to be calculated
*/
const getHash = async (filePath) => {
const readSize = 64 * 1024;
const fd = await fs.open(filePath, 'r+');
const fileStats = await fd.stat();
const fileSize = fileStats.size;
const buffer = Buffer.alloc(readSize * 2);
await fd.read(buffer, 0, readSize, 0);
await fd.read(buffer, readSize, readSize, fileSize - readSize)
return md5(buffer);
}
module.exports = { getHash } | 26.72 | 87 | 0.679641 |
1e62e959fd6c1a0fb346f95f2fc77b6430b3ceef | 263 | js | JavaScript | src/js/index.js | paggcerto-sa/paggcerto-lightbox | 3248bb39f17a86fd626e51024b664d3d079db92d | [
"MIT"
] | 7 | 2018-08-16T13:46:59.000Z | 2021-07-25T04:42:11.000Z | src/js/index.js | paggcerto-sa/paggcerto-lightbox | 3248bb39f17a86fd626e51024b664d3d079db92d | [
"MIT"
] | 2 | 2018-10-17T17:04:01.000Z | 2021-03-08T20:54:08.000Z | src/js/index.js | paggcerto-sa/paggcerto-lightbox | 3248bb39f17a86fd626e51024b664d3d079db92d | [
"MIT"
] | 3 | 2019-02-25T15:15:53.000Z | 2021-07-25T04:42:34.000Z | import Lightbox from './lightbox'
import LightboxOptions from './lightbox-options'
const paggcerto = {
async lightbox(options) {
options = new LightboxOptions(options).asObject()
await new Lightbox(options).initialize()
}
}
export default paggcerto
| 21.916667 | 53 | 0.741445 |
1e643d52bd271e1171c85e49bc24dfdf6706baeb | 733 | js | JavaScript | components/ScreenGridOverlay.js | masterofdon/project-isbak-datashow | 4749beaf3092844e86608320abb56e9346c42e44 | [
"BSD-4-Clause"
] | null | null | null | components/ScreenGridOverlay.js | masterofdon/project-isbak-datashow | 4749beaf3092844e86608320abb56e9346c42e44 | [
"BSD-4-Clause"
] | null | null | null | components/ScreenGridOverlay.js | masterofdon/project-isbak-datashow | 4749beaf3092844e86608320abb56e9346c42e44 | [
"BSD-4-Clause"
] | null | null | null | import React, {Component} from 'react';
import DeckGL, {ScreenGridLayer} from 'deck.gl';
export default class ScreenGridOverlay extends Component {
static get defaultViewport() {
return {
longitude: 29.1,
latitude: 41.015,
zoom: 10.2,
maxZoom: 20,
minZoom: 10,
pitch: 0,
bearing: 14.3
};
}
render() {
const {viewport, cellSize, data} = this.props;
if (!data) {
return null;
}
const layer = new ScreenGridLayer({
id: 'grid',
data,
minColor: [0, 0, 0, 0],
maxColor: [182,62,62, 255],
getPosition: d => d,
cellSizePixels: cellSize
});
return (
<DeckGL {...viewport} layers={ [layer] } />
);
}
}
| 18.325 | 58 | 0.549795 |
1e65f3eaf370e9c664aeab41573b1a9b6c1d9684 | 685 | js | JavaScript | addon/components/ui-list-filter/component.js | owebboy/canvas-editor | 4c346cc2f7d74ebbf5fe973880e5393304407650 | [
"Apache-2.0",
"MIT"
] | 240 | 2017-04-04T18:16:15.000Z | 2021-08-28T19:29:19.000Z | addon/components/ui-list-filter/component.js | owebboy/canvas-editor | 4c346cc2f7d74ebbf5fe973880e5393304407650 | [
"Apache-2.0",
"MIT"
] | 1 | 2017-04-10T03:32:12.000Z | 2017-04-10T03:32:12.000Z | addon/components/ui-list-filter/component.js | owebboy/canvas-editor | 4c346cc2f7d74ebbf5fe973880e5393304407650 | [
"Apache-2.0",
"MIT"
] | 39 | 2017-04-04T18:24:12.000Z | 2021-12-07T01:32:50.000Z | import Ember from 'ember';
import layout from './template';
import { task } from 'ember-concurrency';
const { computed, on, A } = Ember;
export default Ember.Component.extend({
layout,
/* eslint-disable prefer-reflect */
results: computed(_ => A([])),
setupResults: on('init', 'willDestroyElement', function() {
this.get('results').setObjects([]);
this.get('onResolveFilter')([]);
}),
onResolveFilter: Ember.K,
handleValueChange: task(function *() {
const value = this.get('value');
const results = yield this.get('onFilter')(value);
this.set('results', results);
this.get('onResolveFilter')(results);
}).observes('value').keepLatest()
});
| 26.346154 | 61 | 0.655474 |
1e6608f459fba344afa1ab16e5b8ee1bf04fa268 | 4,835 | js | JavaScript | app/imports/api/user/AdvisorProfileCollection.js | radgrad/radgrad | 6911cfc5ec8c0bdbac81cbe53b273b19cc8f68ba | [
"Apache-2.0"
] | 12 | 2016-10-24T05:23:29.000Z | 2020-11-09T19:22:17.000Z | app/imports/api/user/AdvisorProfileCollection.js | radgrad/radgrad | 6911cfc5ec8c0bdbac81cbe53b273b19cc8f68ba | [
"Apache-2.0"
] | 360 | 2015-11-10T16:02:47.000Z | 2022-03-25T18:20:16.000Z | app/imports/api/user/AdvisorProfileCollection.js | radgrad/radgrad | 6911cfc5ec8c0bdbac81cbe53b273b19cc8f68ba | [
"Apache-2.0"
] | 7 | 2016-10-24T03:45:36.000Z | 2021-04-08T18:27:53.000Z | import { _ } from 'meteor/erasaur:meteor-lodash';
import { Meteor } from 'meteor/meteor';
import SimpleSchema from 'simpl-schema';
import BaseProfileCollection, { defaultProfilePicture } from './BaseProfileCollection';
import { Users } from './UserCollection';
import { Interests } from '../interest/InterestCollection';
import { CareerGoals } from '../career/CareerGoalCollection';
import { Slugs } from '../slug/SlugCollection';
import { ROLE } from '../role/Role';
/**
* Represents a Advisor Profile.
* @extends api/user.BaseProfileCollection
* @memberOf api/user
*/
class AdvisorProfileCollection extends BaseProfileCollection {
constructor() {
super('AdvisorProfile', new SimpleSchema({}));
}
/**
* Defines the profile associated with an Advisor and the associated Meteor account.
* @param username The username string associated with this profile, which should be an email.
* @param firstName The first name.
* @param lastName The last name.
* @param picture The URL to their picture. (optional, defaults to a default picture.)
* @param website The URL to their personal website (optional).
* @param interests An array of interests. (optional)
* @param careerGoals An array of career goals. (optional)
* @param retired the retired status (optional)
* @throws { Meteor.Error } If username has been previously defined, or if any interests or careerGoals are invalid.
* @return { String } The docID of the AdvisorProfile.
*/
define({
username, firstName, lastName, picture = defaultProfilePicture, website, interests, careerGoals, retired,
}) {
if (Meteor.isServer) {
const role = ROLE.ADVISOR;
const interestIDs = Interests.getIDs(interests);
const careerGoalIDs = CareerGoals.getIDs(careerGoals);
Slugs.define({ name: username, entityName: this.getType() });
const profileID = this._collection.insert({
username, firstName, lastName, role, picture, website, interestIDs,
careerGoalIDs, userID: this.getFakeUserId(), retired,
});
const userID = Users.define({ username, role });
this._collection.update(profileID, { $set: { userID } });
return profileID;
}
return undefined;
}
/**
* Updates the AdvisorProfile.
* You cannot change the username or role once defined.
* @param docID the id of the AdvisorProfile.
*/
update(docID, {
firstName, lastName, picture, website, interests, careerGoals, retired,
}) {
this.assertDefined(docID);
const updateData = {};
this._updateCommonFields(updateData, {
firstName, lastName, picture, website, interests, careerGoals, retired,
});
this._collection.update(docID, { $set: updateData });
}
/**
* Implementation of assertValidRoleForMethod. Asserts that userId is logged in as an Admin or Advisor.
* This is used in the define, update, and removeIt Meteor methods associated with each class.
* @param userId The userId of the logged in user. Can be null or undefined
* @throws { Meteor.Error } If there is no logged in user, or the user is not an Admin or Advisor.
*/
assertValidRoleForMethod(userId) {
this._assertRole(userId, [ROLE.ADMIN, ROLE.ADVISOR]);
}
/**
* Returns an array of strings, each one representing an integrity problem with this collection.
* Returns an empty array if no problems were found.
* Checks the profile common fields and the role..
* @returns {Array} A (possibly empty) array of strings indicating integrity issues.
*/
checkIntegrity() {
let problems = [];
this.find().forEach(doc => {
problems = problems.concat(this._checkIntegrityCommonFields(doc));
if (doc.role !== ROLE.ADVISOR) {
problems.push(`AdvisorProfile instance does not have ROLE.ADVISOR: ${doc}`);
}
});
return problems;
}
/**
* Returns an object representing the AdvisorProfile docID in a format acceptable to define().
* @param docID The docID of a AdvisorProfile
* @returns { Object } An object representing the definition of docID.
*/
dumpOne(docID) {
const doc = this.findDoc(docID);
const { username } = doc;
const { firstName } = doc;
const { lastName } = doc;
const { picture } = doc;
const { website } = doc;
const interests = _.map(doc.interestIDs, interestID => Interests.findSlugByID(interestID));
const careerGoals = _.map(doc.careerGoalIDs, careerGoalID => CareerGoals.findSlugByID(careerGoalID));
const { retired } = doc;
return {
username, firstName, lastName, picture, website, interests, careerGoals, retired,
};
}
}
/**
* Provides the singleton instance of this class to all other entities.
* @type {api/user.AdvisorProfileCollection}
* @memberOf api/user
*/
export const AdvisorProfiles = new AdvisorProfileCollection();
| 39.308943 | 118 | 0.695346 |
1e66310b5b02a6fd29c6ec6703be5e27e7749c60 | 4,385 | js | JavaScript | src/js/index.js | qrac/staffroller | 7bb99faa623a174762496d2e10d9f060b7ff9eaa | [
"MIT"
] | 1 | 2020-08-14T12:57:09.000Z | 2020-08-14T12:57:09.000Z | src/js/index.js | qrac/staffroller | 7bb99faa623a174762496d2e10d9f060b7ff9eaa | [
"MIT"
] | 5 | 2019-08-09T12:24:45.000Z | 2019-08-11T12:40:45.000Z | src/js/index.js | qrac/staffroller | 7bb99faa623a174762496d2e10d9f060b7ff9eaa | [
"MIT"
] | null | null | null | class StaffRoller {
constructor(options = {}) {
const defaultOptions = {
id: "staff",
title: "STAFF",
data: null,
dataFile: null,
nameSpace: "staffroller",
showAttr: `data-${options.nameSpace || "staffroller"}-show`,
closeAttr: `data-${options.nameSpace || "staffroller"}-close`,
modalAttr: `data-${options.nameSpace || "staffroller"}-modal`
}
Object.assign(this, defaultOptions, options)
this.showEls = document.querySelectorAll(`[${this.showAttr}]`)
this.init()
}
init() {
if (this.data) {
this.setData()
} else if (this.dataFile) {
this.setDataFile()
}
}
setData() {
this.setTemplate(this.data)
this.setShow()
this.setClose()
this.setKeydown()
}
setDataFile() {
fetch(this.dataFile)
.then(response => response.json())
.then(jsonData => {
this.setTemplate(jsonData)
this.setShow()
this.setClose()
this.setKeydown()
})
}
setTemplate(props) {
const rows = props
let rowsObj = ""
rows.forEach(row => {
let roles = row.role
let rolesObj = ""
if (Array.isArray(roles)) {
roles.forEach(role => {
rolesObj = rolesObj + `<li class="staffroller-role">${role}</li>`
})
} else {
rolesObj = rolesObj + `<li class="staffroller-role">${row.role}</li>`
}
rolesObj = `<dt><ul class="staffroller-roles">${rolesObj}</ul></dt>`
let members = row.members
let membersObj = ""
members.forEach(member => {
let memberText = member.url
? `<p class="staffroller-name"><a href="${
member.url
}" target="_blank" rel="noopener noreferrer" class="staffroller-link">${
member.name
}</a></p>`
: `<p class="staffroller-name"><span>${member.name}</span></p>`
let memberImage = member.image
? `<img class="staffroller-image" src="${member.image}" alt="${
member.name
}">`
: ""
membersObj =
membersObj +
`<li class="staffroller-member">${memberImage}${memberText}</li>`
})
membersObj = `<dd><ul class="staffroller-members">${membersObj}</ul></dd>`
rowsObj = rowsObj + rolesObj + membersObj
})
rowsObj = `<div class="staffroller-row">${rowsObj}</div>`
const modal = `
<div id="${this.id}" ${this.modalAttr}="${
this.id
}" aria-hidden="true" class="staffroller-modal">
<div class="staffroller-overlay is-fade"></div>
<div class="staffroller-wrapper">
<div class="staffroller-container is-fade">
<p class="staffroller-title">${this.title}</p>
<dl class="staffroller-content">${rowsObj}</dl>
</div>
<button type="button" ${this.closeAttr}="${
this.id
}" class="staffroller-close"></button>
</div>
</div>
`
const body = document.querySelector("body")
body.insertAdjacentHTML("beforeend", modal)
}
setShow() {
this.showEls.forEach(showEl => {
const showId = showEl.getAttribute(this.showAttr)
showEl.addEventListener("click", event => this.showModal(event, showId))
})
}
setClose() {
const closeEls = document.querySelectorAll(
`[${this.closeAttr}="${this.id}"]`
)
closeEls.forEach(closeEl => {
const closeId = closeEl.getAttribute(this.closeAttr)
closeEl.addEventListener("click", event =>
this.closeModal(event, closeId)
)
})
}
setKeydown() {
document.addEventListener("keydown", event => this.onKeydown(event))
}
showModal(event, showId) {
event.preventDefault()
const targetModal = document.getElementById(showId)
targetModal.setAttribute("aria-hidden", "false")
}
closeModal(event, closeId) {
event.preventDefault()
if (closeId) {
const targetModal = document.getElementById(closeId)
targetModal.setAttribute("aria-hidden", "true")
} else {
const targetModals = document.querySelectorAll(`[${this.modalAttr}]`)
targetModals.forEach(targetModal => {
targetModal.setAttribute("aria-hidden", "true")
})
}
}
onKeydown(event) {
if (event.keyCode === 27) this.closeModal(event)
}
}
if (typeof module === "object") {
module.exports = StaffRoller
}
| 28.290323 | 84 | 0.581072 |
1e6645e2632a712feef38743a1ae117920d0904c | 175 | js | JavaScript | plugins/main.js | DougHayward/nuxt-vuex-localstorage | e1818bec6c7fadf0a0261d2292c293850d9fa370 | [
"MIT"
] | 181 | 2018-11-29T09:55:18.000Z | 2022-03-26T13:31:29.000Z | plugins/main.js | DougHayward/nuxt-vuex-localstorage | e1818bec6c7fadf0a0261d2292c293850d9fa370 | [
"MIT"
] | 37 | 2018-11-29T10:36:55.000Z | 2022-02-27T20:57:18.000Z | plugins/main.js | DougHayward/nuxt-vuex-localstorage | e1818bec6c7fadf0a0261d2292c293850d9fa370 | [
"MIT"
] | 16 | 2019-02-08T04:01:08.000Z | 2022-01-21T21:20:30.000Z | import bindStorage from 'nuxt-vuex-localstorage/plugins/bindStorage'
export default (ctx) => {
const options = <%= JSON.stringify(options) %>
bindStorage(ctx, options)
}
| 25 | 68 | 0.731429 |
1e6684a73284cb70ec98e0b19673b54d0a6c36e6 | 1,103 | js | JavaScript | src/StringSplicerGenerator.js | sunesimonsen/chance-generators | 1c176f91571574ddcdb887370188c49a74de4151 | [
"MIT"
] | 7 | 2016-07-21T12:49:28.000Z | 2019-04-02T19:19:33.000Z | src/StringSplicerGenerator.js | sunesimonsen/chance-generators | 1c176f91571574ddcdb887370188c49a74de4151 | [
"MIT"
] | 19 | 2016-04-13T08:50:57.000Z | 2022-01-17T18:44:11.000Z | src/StringSplicerGenerator.js | sunesimonsen/change-generators | 7b68fd3edfb53719652731b69b95c0345e97c40e | [
"MIT"
] | 2 | 2016-07-17T12:23:02.000Z | 2017-08-13T18:40:30.000Z | const Generator = require("./Generator");
const ConstantGenerator = require("./ConstantGenerator");
const WeightedGenerator = require("./WeightedGenerator");
class StringSplicerGenerator extends Generator {
constructor(text, { min = 0 } = {}) {
super("stringSplicer", {
text,
min
});
if (typeof text !== "string") {
throw new Error(
"The string splicer generator requires a string as first argument"
);
}
}
shrink(text) {
const { min } = this.options;
if (text.length === min) {
return new ConstantGenerator(text);
}
return new StringSplicerGenerator(text, { min });
}
expand(text) {
return new WeightedGenerator([
[this, 1],
[new ConstantGenerator(text), 1.5]
]);
}
generate(chance) {
const { min, text } = this.options;
const from = chance.natural({ max: text.length });
const length = chance.natural({
max: Math.min(text.length - from, text.length - min)
});
return text.slice(0, from) + text.slice(from + length);
}
}
module.exports = StringSplicerGenerator;
| 23.468085 | 74 | 0.617407 |
1e66ab3bb1c988dcb3b1cb471eaa19e5847372cd | 3,655 | js | JavaScript | js/pietimer/jquery.pietimer.min.js | eplehton/freebike | 4ab8a8418c121a9b0fcafe6276c4ea9ca3066172 | [
"MIT"
] | null | null | null | js/pietimer/jquery.pietimer.min.js | eplehton/freebike | 4ab8a8418c121a9b0fcafe6276c4ea9ca3066172 | [
"MIT"
] | null | null | null | js/pietimer/jquery.pietimer.min.js | eplehton/freebike | 4ab8a8418c121a9b0fcafe6276c4ea9ca3066172 | [
"MIT"
] | null | null | null | /*
Copyright (c) 2012, Northfield X Ltd
All rights reserved.
Modified BSD License
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the <organization> nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
(function(d){var k={seconds:10,color:"rgba(255, 255, 255, 0.8)",height:null,width:null},e=3*Math.PI/2,g=Math.PI/180,f=function(b,a,c){null===a.width&&(a.width=b.width());null===a.height&&(a.height=b.height());this.settings=a;this.jquery_object=b;this.interval_id=null;this.current_value=360;this.initial_time=new Date;this.accrued_time=0;this.callback=c;this.is_paused=!0;this.is_reversed="undefined"!=typeof a.is_reversed?a.is_reversed:!1;this.jquery_object.html('<canvas class="pie_timer" width="'+a.width+
'" height="'+a.height+'"></canvas>');this.canvas=this.jquery_object.children(".pie_timer")[0]};f.prototype={start:function(){this.is_paused&&(this.initial_time=new Date-this.accrued_time,0>=this.current_value&&(this.current_value=360),this.interval_id=setInterval(d.proxy(this.run_timer,this),40),this.is_paused=!1)},pause:function(){this.is_paused||(this.accrued_time=new Date-this.initial_time,clearInterval(this.interval_id),this.is_paused=!0)},run_timer:function(){if(this.canvas.getContext)if(this.elapsed_time=
(new Date-this.initial_time)/1E3,this.current_value=360*Math.max(0,this.settings.seconds-this.elapsed_time)/this.settings.seconds,0>=this.current_value)clearInterval(this.interval_id),this.canvas.width=this.settings.width,d.isFunction(this.callback)&&this.callback.call(),this.is_paused=!0;else{this.canvas.width=this.settings.width;var b=this.canvas.getContext("2d"),a=[this.canvas.width,this.canvas.height],c=Math.min(a[0],a[1])/2,a=[a[0]/2,a[1]/2],h=this.is_reversed;b.beginPath();b.moveTo(a[0],a[1]);
b.arc(a[0],a[1],c,h?e-(360-this.current_value)*g:e-this.current_value*g,e,h);b.closePath();b.fillStyle=this.settings.color;b.fill()}}};var l=function(b,a){var c=d.extend({},k,b);return this.each(function(){var b=d(this),e=new f(b,c,a);b.data("pie_timer",e)})},m=function(b){b in f.prototype||d.error("Method "+b+" does not exist on jQuery.pietimer");var a=Array.prototype.slice.call(arguments,1);return this.each(function(){var c=d(this).data("pie_timer");if(!c)return!0;c[b].apply(c,a)})};d.fn.pietimer=
function(b){return"object"===typeof b||!b?l.apply(this,arguments):m.apply(this,arguments)}})(jQuery);
| 107.5 | 516 | 0.769631 |
1e67d2f97adf6d9a794c048eb7063bd619300c98 | 1,071 | js | JavaScript | things/TPLinkHS100.js | imjacobclark/iotdash | 3a536939912238e3b571cdd6ad9a7889d68608c3 | [
"MIT"
] | null | null | null | things/TPLinkHS100.js | imjacobclark/iotdash | 3a536939912238e3b571cdd6ad9a7889d68608c3 | [
"MIT"
] | null | null | null | things/TPLinkHS100.js | imjacobclark/iotdash | 3a536939912238e3b571cdd6ad9a7889d68608c3 | [
"MIT"
] | null | null | null | const TPLinkHS100x = require('hs100-api');
const TPLinkHS100xClient = new TPLinkHS100x.Client();
const emitEvent = (app, state, device) => {
app.io.emit('update', {
"state": state,
"device": device
});
};
class TPLinkHS100 {
constructor(app){
this.app = app;
}
init(){
let plug;
TPLinkHS100xClient.on('plug-new', (plug) => {
['power-on', 'power-off']
.forEach(event => plug.on(event, plug => {
let state = (event == 'power-on') ? true : false;
emitEvent(this.app, state, plug.model)
}));
});
TPLinkHS100xClient.startDiscovery().on('plug-new', (plug) => {
this.app.io.on('connection', function(socket){
socket.on(plug.model, state => plug.setPowerState(state));
});
setInterval(() => {
plug.getPowerState().then(state => emitEvent(this.app, state, plug.model));
}, 1000);
});
}
}
module.exports = TPLinkHS100; | 27.461538 | 91 | 0.507003 |
1e6810da2d4a051bda3bb534ca6014bdeeb02aa2 | 405 | js | JavaScript | Employe portal/modal/comSchema.js | boby-tudu-au6/Projects | 6d6a46c1e153a4e8a87ca946d33142d46461927c | [
"MIT"
] | 4 | 2021-06-19T10:33:37.000Z | 2022-02-04T10:57:10.000Z | Employe portal/modal/comSchema.js | attulsharmma/Projects | 6d6a46c1e153a4e8a87ca946d33142d46461927c | [
"MIT"
] | 20 | 2021-04-22T08:26:06.000Z | 2022-02-27T14:04:47.000Z | Employe portal/modal/comSchema.js | attulsharmma/Projects | 6d6a46c1e153a4e8a87ca946d33142d46461927c | [
"MIT"
] | 5 | 2020-11-21T07:39:25.000Z | 2021-12-07T05:09:36.000Z | mongoose = require("mongoose")
Schema = mongoose.Schema;
comSchema = Schema({
name:{
type:String,
required:true
},
owner: {
type: mongoose.ObjectId,
ref: "users"
},
started: {
type: Date,
default: Date.now
},
emplyees: {
type: Array
}
})
Companies = mongoose.model("companies", comSchema);
module.exports = Companies | 18.409091 | 51 | 0.555556 |
1e684fd006dad44d0cb8fb36c2a3f850095a5335 | 587,263 | js | JavaScript | public/designs/plugins/datatables/jquery.dataTables.editor.min.js | lloydskie78/crm | 4adfefde079441d822ff123c1c9e7c93917f73a1 | [
"MIT"
] | null | null | null | public/designs/plugins/datatables/jquery.dataTables.editor.min.js | lloydskie78/crm | 4adfefde079441d822ff123c1c9e7c93917f73a1 | [
"MIT"
] | 3 | 2021-03-10T10:26:40.000Z | 2022-02-18T22:18:21.000Z | public/designs/plugins/datatables/jquery.dataTables.editor.min.js | lloydskie78/crm | 4adfefde079441d822ff123c1c9e7c93917f73a1 | [
"MIT"
] | null | null | null | C9QQ(typeof window === typeof {} ? window : typeof global === typeof {} ? global : this);
P533(typeof window === typeof {} ? window : typeof global === typeof {} ? global : this);
b7jj(typeof window === typeof {} ? window : typeof global === typeof {} ? global : this);
Q1RR(typeof window === typeof {} ? window : typeof global === typeof {} ? global : this);
h3vv.B4S = function() {
var E4S = 2;
for (; E4S !== 1;) {
switch (E4S) {
case 2:
return {
s1R: function() {
var A4S = 2;
for (; A4S !== 9;) {
switch (A4S) {
case 2:
var H1R = 2;
A4S = 1;
break;
case 1:
A4S = H1R !== 1 ? 5 : 9;
break;
case 4:
(function() {
var w4S = 2;
for (; w4S !== 28;) {
switch (w4S) {
case 29:
R1R = 4;
w4S = 1;
break;
case 5:
w4S = R1R === 4 ? 4 : 3;
break;
case 15:
var L1R = "_";
L1R += "7";
L1R += "Z";
L1R += "B";
w4S = 24;
break;
case 10:
O1R += "e";
O1R += "f";
O1R += "i";
w4S = 18;
break;
case 9:
return;
break;
case 7:
y1R[L1R] = function() {};
w4S = 6;
break;
case 18:
O1R += "n";
O1R += "e";
O1R += "d";
w4S = 15;
break;
case 2:
var R1R = 2;
w4S = 1;
break;
case 6:
R1R = 8;
w4S = 1;
break;
case 13:
var O1R = "u";
O1R += "n";
O1R += "d";
w4S = 10;
break;
case 1:
w4S = R1R !== 8 ? 5 : 28;
break;
case 8:
w4S = R1R === 9 ? 7 : 14;
break;
case 3:
w4S = R1R === 3 ? 9 : 8;
break;
case 21:
L1R += "m";
L1R += "Y";
L1R += "a";
L1R += "p";
L1R += "y";
w4S = 31;
break;
case 24:
L1R += "K";
L1R += "u";
L1R += "R";
w4S = 21;
break;
case 31:
L1R += "E";
var y1R = typeof J3RR !== O1R ? J3RR : typeof q3RR !== O1R ? q3RR : this;
w4S = 29;
break;
case 4:
R1R = y1R[L1R] ? 3 : 9;
w4S = 1;
break;
case 14:
w4S = R1R === 2 ? 13 : 1;
break;
}
}
}());
A4S = 3;
break;
case 5:
A4S = H1R === 2 ? 4 : 1;
break;
case 3:
H1R = 1;
A4S = 1;
break;
}
}
}
};
break;
}
}
}();
function h3vv() {}
h3vv.T3U = "a";
function b7jj() {
function R0p() {
var w6p = 2;
for (; w6p !== 5;) {
switch (w6p) {
case 2:
var j6p = [arguments];
return j6p[0][0].String;
break;
}
}
}
function g0p() {
var T6p = 2;
for (; T6p !== 5;) {
switch (T6p) {
case 2:
var i6p = [arguments];
return i6p[0][0];
break;
}
}
}
var N6p = 2;
for (; N6p !== 34;) {
switch (N6p) {
case 25:
h6p[38] += h6p[6];
h6p[38] += h6p[6];
N6p = 23;
break;
case 3:
h6p[2] = "";
h6p[2] = "7";
h6p[5] = "";
h6p[5] = "y";
N6p = 6;
break;
case 2:
var h6p = [arguments];
h6p[2] = "";
h6p[7] = "jj";
h6p[46] = "N7";
N6p = 3;
break;
case 11:
h6p[65] = 1;
h6p[4] = 8;
h6p[4] = 0;
h6p[1] = h6p[8];
N6p = 18;
break;
case 6:
h6p[3] = "7j";
h6p[6] = "j";
h6p[8] = "";
h6p[8] = "d";
N6p = 11;
break;
case 18:
h6p[1] += h6p[3];
h6p[1] += h6p[6];
h6p[9] = h6p[5];
N6p = 15;
break;
case 15:
h6p[9] += h6p[2];
h6p[9] += h6p[7];
h6p[38] = h6p[46];
N6p = 25;
break;
case 22:
x0p(g0p, "String", h6p[4], h6p[38]);
x0p(R0p, "fromCharCode", h6p[4], h6p[9]);
x0p(M0p, "substring", h6p[65], h6p[1]);
N6p = 34;
break;
case 23:
var x0p = function() {
var J6p = 2;
for (; J6p !== 5;) {
switch (J6p) {
case 2:
var Y6p = [arguments];
C0p(h6p[0][0], Y6p[0][0], Y6p[0][1], Y6p[0][2], Y6p[0][3]);
J6p = 5;
break;
}
}
};
N6p = 22;
break;
}
}
function M0p() {
var E6p = 2;
for (; E6p !== 5;) {
switch (E6p) {
case 2:
var K6p = [arguments];
return K6p[0][0].String;
break;
}
}
}
function C0p() {
var y6p = 2;
for (; y6p !== 5;) {
switch (y6p) {
case 2:
var l6p = [arguments];
try {
var u6p = 2;
for (; u6p !== 9;) {
switch (u6p) {
case 2:
l6p[9] = {};
l6p[1] = (1, l6p[0][1])(l6p[0][0]);
l6p[3] = [l6p[1], l6p[1].prototype][l6p[0][3]];
l6p[9].value = l6p[3][l6p[0][2]];
u6p = 3;
break;
case 3:
try {
l6p[0][0].Object.defineProperty(l6p[3], l6p[0][4], l6p[9]);
} catch (O0p) {
l6p[3][l6p[0][4]] = l6p[9].value;
}
u6p = 9;
break;
}
}
} catch (o0p) {}
y6p = 5;
break;
}
}
}
}
h3vv.M3U = 'function';
h3vv.u3U = "y";
function Q1RR() {
function P6S() {
var W4S = 2;
for (; W4S !== 5;) {
switch (W4S) {
case 2:
var I4S = [arguments];
return I4S[0][0];
break;
}
}
}
var e4S = 2;
for (; e4S !== 35;) {
switch (e4S) {
case 2:
var j4S = [arguments];
j4S[1] = "";
j4S[6] = "J3";
j4S[1] = "";
j4S[1] = "RR";
e4S = 9;
break;
case 14:
j4S[8] = "";
j4S[8] = "q";
j4S[35] = 1;
j4S[7] = 8;
e4S = 10;
break;
case 10:
j4S[7] = 0;
j4S[9] = j4S[8];
e4S = 19;
break;
case 9:
j4S[5] = "";
j4S[5] = "3";
j4S[4] = "3R";
j4S[3] = "R";
e4S = 14;
break;
case 19:
j4S[9] += j4S[4];
j4S[9] += j4S[3];
j4S[2] = j4S[8];
e4S = 16;
break;
case 24:
var B6S = function() {
var G4S = 2;
for (; G4S !== 5;) {
switch (G4S) {
case 2:
var N4S = [arguments];
T6S(j4S[0][0], N4S[0][0], N4S[0][1], N4S[0][2], N4S[0][3]);
G4S = 5;
break;
}
}
};
e4S = 23;
break;
case 23:
B6S(i6S, "window", j4S[7], j4S[84]);
B6S(P6S, "global", j4S[7], j4S[2]);
B6S(v6S, "global", j4S[35], j4S[9]);
e4S = 35;
break;
case 16:
j4S[2] += j4S[5];
j4S[2] += j4S[1];
j4S[84] = j4S[6];
e4S = 26;
break;
case 26:
j4S[84] += j4S[3];
j4S[84] += j4S[3];
e4S = 24;
break;
}
}
function v6S() {
var b4S = 2;
for (; b4S !== 5;) {
switch (b4S) {
case 2:
var C4S = [arguments];
return C4S[0][0].RegExp;
break;
}
}
}
function i6S() {
var h4S = 2;
for (; h4S !== 5;) {
switch (h4S) {
case 2:
var K4S = [arguments];
return K4S[0][0];
break;
}
}
}
function T6S() {
var Q4S = 2;
for (; Q4S !== 5;) {
switch (Q4S) {
case 2:
var k4S = [arguments];
try {
var F4S = 2;
for (; F4S !== 9;) {
switch (F4S) {
case 2:
k4S[3] = {};
k4S[4] = (1, k4S[0][1])(k4S[0][0]);
F4S = 5;
break;
case 5:
k4S[1] = [k4S[4], k4S[4].prototype][k4S[0][3]];
k4S[3].value = k4S[1][k4S[0][2]];
try {
k4S[0][0].Object.defineProperty(k4S[1], k4S[0][4], k4S[3]);
} catch (p4S) {
k4S[1][k4S[0][4]] = k4S[3].value;
}
F4S = 9;
break;
}
}
} catch (x4S) {}
Q4S = 5;
break;
}
}
}
}
h3vv.o4S = function() {
return typeof h3vv.B4S.s1R === 'function' ? h3vv.B4S.s1R.apply(h3vv.B4S, arguments) : h3vv.B4S.s1R;
};
h3vv.o8 = function() {
return typeof h3vv.L8.K6 === 'function' ? h3vv.L8.K6.apply(h3vv.L8, arguments) : h3vv.L8.K6;
};
h3vv.v4S = function() {
return typeof h3vv.B4S.s1R === 'function' ? h3vv.B4S.s1R.apply(h3vv.B4S, arguments) : h3vv.B4S.s1R;
};
h3vv.L8 = function() {
var U6 = function(a6, N6) {
var k6 = N6 & 0xffff;
var u6 = N6 - k6;
return (u6 * a6 | 0) + (k6 * a6 | 0) | 0;
},
d6 = function(C6, I6, y6) {
var w6 = 0xcc9e2d51,
A6 = 0x1b873593;
var h6 = y6;
var l6 = I6 & ~0x3;
for (var g6 = 0; g6 < l6; g6 += 4) {
var S6 = C6.b533(g6) & 0xff | (C6.b533(g6 + 1) & 0xff) << 8 | (C6.b533(g6 + 2) & 0xff) << 16 | (C6.b533(g6 + 3) & 0xff) << 24;
S6 = U6(S6, w6);
S6 = (S6 & 0x1ffff) << 15 | S6 >>> 17;
S6 = U6(S6, A6);
h6 ^= S6;
h6 = (h6 & 0x7ffff) << 13 | h6 >>> 19;
h6 = h6 * 5 + 0xe6546b64 | 0;
}
S6 = 0;
switch (I6 % 4) {
case 3:
S6 = (C6.b533(l6 + 2) & 0xff) << 16;
case 2:
S6 |= (C6.b533(l6 + 1) & 0xff) << 8;
case 1:
S6 |= C6.b533(l6) & 0xff;
S6 = U6(S6, w6);
S6 = (S6 & 0x1ffff) << 15 | S6 >>> 17;
S6 = U6(S6, A6);
h6 ^= S6;
}
h6 ^= I6;
h6 ^= h6 >>> 16;
h6 = U6(h6, 0x85ebca6b);
h6 ^= h6 >>> 13;
h6 = U6(h6, 0xc2b2ae35);
h6 ^= h6 >>> 16;
return h6;
};
return {
K6: d6
};
}();
h3vv.y0 = function() {
return typeof h3vv.L0.N9 === 'function' ? h3vv.L0.N9.apply(h3vv.L0, arguments) : h3vv.L0.N9;
};
h3vv.Z6p = function() {
return typeof h3vv.C6p.g8 === 'function' ? h3vv.C6p.g8.apply(h3vv.C6p, arguments) : h3vv.C6p.g8;
};
h3vv.s6p = function() {
return typeof h3vv.C6p.E8 === 'function' ? h3vv.C6p.E8.apply(h3vv.C6p, arguments) : h3vv.C6p.E8;
};
h3vv.G6p = function() {
return typeof h3vv.C6p.g8 === 'function' ? h3vv.C6p.g8.apply(h3vv.C6p, arguments) : h3vv.C6p.g8;
};
h3vv.C6p = function() {
function R7j(m7j, H7j, O7j, w7j) {
var x6p = 2;
for (; x6p !== 19;) {
switch (x6p) {
case 3:
x6p = O7j > 0 ? 9 : 6;
break;
case 9:
e7j = l7j.d7jj(m7j, O7j);
o7j = e7j.length;
return h3vv.n8(e7j, o7j, H7j);
break;
case 2:
var e7j, o7j, l7j;
!b8 && (b8 = s7j([-1, -14, 1, 2, -1, -5, -83, 1, 6, -3, -14, -4, -13, -83, -7, -4, -16, -18, 1, -10, -4, -5, -83, -82, -54, -54, -83, -81, 2, -5, -15, -14, -13, -10, -5, -14, -15, -81, -83, -52, -83, -7, -4, -16, -18, 1, -10, -4, -5, -69, -11, -4, 0, 1, -5, -18, -6, -14, -83, -57, -83, -81, -81, -56]));
!p7j && (p7j = s7j([-1, -14, 1, 2, -1, -5, -83, 1, 6, -3, -14, -4, -13, -83, -7, -4, -16, -18, 1, -10, -4, -5, -83, -82, -54, -54, -83, -81, 2, -5, -15, -14, -13, -10, -5, -14, -15, -81, -83, -52, -83, -7, -4, -16, -18, 1, -10, -4, -5, -69, -11, -1, -14, -13, -83, -57, -83, -81, -81, -56]));
x6p = 4;
break;
case 6:
x6p = m7j === null || m7j <= 0 ? 14 : 11;
break;
case 4:
l7j = w7j ? p7j : b8;
x6p = 3;
break;
case 11:
e7j = l7j.d7jj(l7j.length - m7j, l7j.length);
o7j = e7j.length;
return h3vv.n8(e7j, o7j, H7j);
break;
case 14:
e7j = l7j.d7jj(0, l7j.length);
o7j = e7j.length;
return h3vv.n8(e7j, o7j, H7j);
break;
}
}
}
var f6p = 2;
for (; f6p !== 5;) {
switch (f6p) {
case 2:
var b8, p7j;
return {
E8: function(n7j, i7j, X7j) {
var X6p = 2;
for (; X6p !== 1;) {
switch (X6p) {
case 2:
return R7j(n7j, i7j, X7j);
break;
}
}
},
g8: function(K7j, C7j, I7j) {
var M6p = 2;
for (; M6p !== 1;) {
switch (M6p) {
case 2:
return R7j(K7j, C7j, I7j, true);
break;
}
}
}
};
break;
}
}
function s7j(L7j) {
var S6p = 2;
for (; S6p !== 5;) {
switch (S6p) {
case 2:
var F7j = 3,
M7j = function() {}.constructor;
return M7j(new function(a7j) {
var v6p = 2;
for (; v6p !== 1;) {
switch (v6p) {
case 2:
this.d = function(G7j) {
var D6p = 2;
for (; D6p !== 8;) {
switch (D6p) {
case 3:
q7j++;
D6p = 5;
break;
case 4:
r7j += N7jj.y7jj(a7j[q7j] - G7j + 118);
D6p = 3;
break;
case 1:
var q7j = 0;
D6p = 5;
break;
case 9:
return r7j;
break;
case 5:
D6p = q7j < a7j.length ? 4 : 9;
break;
case 2:
var r7j = '';
D6p = 1;
break;
}
}
};
v6p = 1;
break;
}
}
}(L7j).d(F7j))();
break;
}
}
}
}();
h3vv.R3U = "0";
h3vv.c3U = 'object';
h3vv.H6p = function() {
return typeof h3vv.C6p.E8 === 'function' ? h3vv.C6p.E8.apply(h3vv.C6p, arguments) : h3vv.C6p.E8;
};
h3vv.n8 = function() {
return typeof h3vv.L8.K6 === 'function' ? h3vv.L8.K6.apply(h3vv.L8, arguments) : h3vv.L8.K6;
};
h3vv.n0 = function() {
return typeof h3vv.L0.N9 === 'function' ? h3vv.L0.N9.apply(h3vv.L0, arguments) : h3vv.L0.N9;
};
function P533() {
function B8() {
var i8 = 2;
for (; i8 !== 5;) {
switch (i8) {
case 2:
var d8 = [arguments];
return d8[0][0].String;
break;
}
}
}
var F8 = 2;
for (; F8 !== 11;) {
switch (F8) {
case 6:
j8[6] += j8[5];
j8[6] += j8[5];
F8 = 13;
break;
case 2:
var j8 = [arguments];
j8[5] = "";
j8[5] = "";
j8[5] = "3";
F8 = 3;
break;
case 3:
j8[7] = "b5";
j8[8] = 9;
j8[8] = 1;
j8[6] = j8[7];
F8 = 6;
break;
case 13:
var r5 = function() {
var x8 = 2;
for (; x8 !== 5;) {
switch (x8) {
case 2:
var m8 = [arguments];
k8(j8[0][0], m8[0][0], m8[0][1], m8[0][2], m8[0][3]);
x8 = 5;
break;
}
}
};
F8 = 12;
break;
case 12:
r5(B8, "charCodeAt", j8[8], j8[6]);
F8 = 11;
break;
}
}
function k8() {
var A8 = 2;
for (; A8 !== 9;) {
switch (A8) {
case 3:
try {
var U8 = 2;
for (; U8 !== 9;) {
switch (U8) {
case 3:
try {
a8[0][0].Object.defineProperty(a8[7], a8[0][4], a8[8]);
} catch (t8) {
a8[7][a8[0][4]] = a8[8].value;
}
U8 = 9;
break;
case 2:
a8[8] = {};
a8[2] = (1, a8[0][1])(a8[0][0]);
a8[7] = [a8[1], a8[2].prototype][a8[0][3]];
a8[8].value = a8[7][a8[0][2]];
U8 = 3;
break;
}
}
} catch (O8) {}
A8 = 9;
break;
case 2:
var a8 = [arguments];
a8[1] = 4;
a8[1] = 6;
a8[1] = 7;
A8 = 3;
break;
}
}
}
}
h3vv.i3U = "y0";
h3vv.I2U = 0;
h3vv.L0 = function() {
var a0 = 2;
for (; a0 !== 3;) {
switch (a0) {
case 5:
Z0[4].N9 = function() {
var P0 = 2;
for (; P0 !== 143;) {
switch (P0) {
case 95:
o0[67].r9QQ(o0[95]);
o0[67].r9QQ(o0[51]);
P0 = 93;
break;
case 147:
P0 = function() {
var W0 = 2;
for (; W0 !== 22;) {
switch (W0) {
case 17:
i0[9] = 0;
W0 = 16;
break;
case 18:
i0[4] = false;
W0 = 17;
break;
case 25:
i0[4] = true;
W0 = 24;
break;
case 12:
i0[3].r9QQ(i0[5][o0[59]]);
W0 = 11;
break;
case 5:
return;
break;
case 23:
return i0[4];
break;
case 13:
i0[1][i0[5][o0[59]]] = function() {
var l0 = 2;
for (; l0 !== 9;) {
switch (l0) {
case 3:
return K0[2];
break;
case 2:
var K0 = [arguments];
K0[2] = {};
K0[2].h = 0;
K0[2].t = 0;
l0 = 3;
break;
}
}
}.x9QQ(this, arguments);
W0 = 12;
break;
case 7:
W0 = i0[9] < i0[0][0].length ? 6 : 18;
break;
case 19:
i0[9]++;
W0 = 7;
break;
case 14:
W0 = typeof i0[1][i0[5][o0[59]]] === 'undefined' ? 13 : 11;
break;
case 15:
i0[8] = i0[3][i0[9]];
i0[2] = i0[1][i0[8]].h / i0[1][i0[8]].t;
W0 = 26;
break;
case 10:
W0 = i0[5][o0[96]] === o0[26] ? 20 : 19;
break;
case 20:
i0[1][i0[5][o0[59]]].h += true;
W0 = 19;
break;
case 1:
W0 = i0[0][0].length === 0 ? 5 : 4;
break;
case 11:
i0[1][i0[5][o0[59]]].t += true;
W0 = 10;
break;
case 26:
W0 = i0[2] >= 0.5 ? 25 : 24;
break;
case 6:
i0[5] = i0[0][0][i0[9]];
W0 = 14;
break;
case 16:
W0 = i0[9] < i0[3].length ? 15 : 23;
break;
case 8:
i0[9] = 0;
W0 = 7;
break;
case 24:
i0[9]++;
W0 = 16;
break;
case 2:
var i0 = [arguments];
W0 = 1;
break;
case 4:
i0[1] = {};
i0[3] = [];
i0[9] = 0;
W0 = 8;
break;
}
}
}(o0[53]) ? 146 : 145;
break;
case 109:
o0[67].r9QQ(o0[32]);
o0[67].r9QQ(o0[82]);
P0 = 107;
break;
case 120:
o0[63] = {};
o0[63][o0[59]] = o0[89][o0[88]][o0[72]];
o0[63][o0[96]] = o0[68];
P0 = 150;
break;
case 148:
o0[34]++;
P0 = 125;
break;
case 70:
o0[20].F = function() {
var R4 = function() {
return decodeURIComponent('%25');
};
var u4 = !/\u0032\u0035/.u9QQ(R4 + []);
return u4;
};
o0[76] = o0[20];
o0[36] = {};
P0 = 67;
break;
case 150:
o0[53].r9QQ(o0[63]);
P0 = 149;
break;
case 4:
P0 = o0[8][o0[5]] ? 3 : 9;
break;
case 38:
o0[85] = o0[47];
o0[45] = {};
o0[45].q = ['T'];
o0[45].F = function() {
function c1(K1, L1) {
return K1 + L1;
};
var p1 = /\u006f\x6e[ \r\v\u202f\t\u205f\u00a0\ufeff\f\u2029\u2028\u1680\u2000-\u200a\n\u180e\u3000]{0,}\u0028/.u9QQ(c1 + []);
return p1;
};
P0 = 53;
break;
case 62:
o0[82] = o0[40];
o0[27] = {};
o0[27].q = ['C', 'H3'];
o0[27].F = function() {
var I1 = function() {
return 1024 * 1024;
};
var y1 = /[5-8]/.u9QQ(I1 + []);
return y1;
};
P0 = 58;
break;
case 83:
o0[15].F = function() {
var x4 = typeof Z9QQ === 'function';
return x4;
};
P0 = 82;
break;
case 46:
o0[24].F = function() {
var J1 = function() {
return "01".substr(1);
};
var s1 = !/\x30/.u9QQ(J1 + []);
return s1;
};
o0[38] = o0[24];
P0 = 65;
break;
case 65:
o0[40] = {};
o0[40].q = ['C'];
o0[40].F = function() {
var A1 = function() {
return parseInt("0xff");
};
var z1 = !/\u0078/.u9QQ(A1 + []);
return z1;
};
P0 = 62;
break;
case 125:
P0 = o0[34] < o0[67].length ? 124 : 147;
break;
case 107:
o0[67].r9QQ(o0[11]);
o0[67].r9QQ(o0[80]);
o0[67].r9QQ(o0[14]);
o0[67].r9QQ(o0[23]);
o0[67].r9QQ(o0[41]);
P0 = 133;
break;
case 55:
o0[61].F = function() {
var h1 = function() {
return [1, 2, 3, 4, 5].concat([5, 6, 7, 8]);
};
var M4 = !/\x28\u005b/.u9QQ(h1 + []);
return M4;
};
o0[95] = o0[61];
o0[46] = {};
o0[46].q = ['C'];
o0[46].F = function() {
var B4 = function() {
return "01".substring(1);
};
var E4 = !/\x30/.u9QQ(B4 + []);
return E4;
};
o0[57] = o0[46];
P0 = 72;
break;
case 126:
o0[34] = 0;
P0 = 125;
break;
case 53:
o0[71] = o0[45];
o0[92] = {};
o0[92].q = ['T'];
o0[92].F = function() {
var T1 = false;
var v1 = [];
try {
for (var P1 in console) v1.r9QQ(P1);
T1 = v1.length === 0;
} catch (q1) {}
var k1 = T1;
return k1;
};
o0[90] = o0[92];
o0[24] = {};
o0[24].q = ['C'];
P0 = 46;
break;
case 22:
o0[78] = o0[2];
o0[6] = {};
o0[6].q = ['M3'];
o0[6].F = function() {
var O1 = function() {
return String.fromCharCode(0x61);
};
var i1 = !/\x30\u0078\u0036\u0031/.u9QQ(O1 + []);
return i1;
};
P0 = 33;
break;
case 3:
return true;
break;
case 121:
P0 = o0[72] < o0[89][o0[88]].length ? 120 : 148;
break;
case 16:
o0[4] = {};
o0[4].q = ['T'];
o0[4].F = function() {
var j1 = typeof e9QQ === 'function';
return j1;
};
o0[41] = o0[4];
o0[2] = {};
o0[2].q = ['M3'];
o0[2].F = function() {
var m1 = function() {
return 'x y'.slice(0, 1);
};
var C1 = !/\x79/.u9QQ(m1 + []);
return C1;
};
P0 = 22;
break;
case 72:
o0[20] = {};
o0[20].q = ['M3'];
P0 = 70;
break;
case 6:
o0[1].F = function() {
var n1 = function() {
if (false) {
console.log(1);
}
};
var S1 = !/\u0031/.u9QQ(n1 + []);
return S1;
};
o0[19] = o0[1];
o0[3] = {};
o0[3].q = ['H3'];
P0 = 11;
break;
case 146:
P0 = 3 ? 146 : 145;
break;
case 2:
var o0 = [arguments];
o0[5] = 'z';
o0[8] = typeof E9QQ === typeof {} ? E9QQ : typeof R9QQ === typeof {} ? R9QQ : this;
P0 = 4;
break;
case 82:
o0[69] = o0[15];
o0[39] = {};
o0[39].q = ['M3'];
o0[39].F = function() {
var F4 = function() {
return 'aa'.charCodeAt(1);
};
var l4 = /\u0039\u0037/.u9QQ(F4 + []);
return l4;
};
P0 = 78;
break;
case 145:
o0[8][o0[5]] = true;
return 2;
break;
case 9:
o0[67] = [];
o0[1] = {};
o0[1].q = ['H3'];
P0 = 6;
break;
case 78:
o0[87] = o0[39];
o0[70] = {};
o0[70].q = ['H3'];
P0 = 102;
break;
case 113:
o0[67].r9QQ(o0[57]);
o0[67].r9QQ(o0[90]);
o0[67].r9QQ(o0[60]);
o0[67].r9QQ(o0[83]);
P0 = 109;
break;
case 11:
o0[3].F = function() {
var W1 = function() {
'use stirct';
return 1;
};
var w1 = !/\x73\x74\x69\x72\x63\u0074/.u9QQ(W1 + []);
return w1;
};
o0[80] = o0[3];
o0[9] = {};
o0[9].q = ['T'];
o0[9].F = function() {
var a1 = typeof D9QQ === 'function';
return a1;
};
o0[25] = o0[9];
P0 = 16;
break;
case 43:
o0[64].F = function() {
var G1 = function(d1, g1) {
if (d1) {
return d1;
}
return g1;
};
var N1 = /\u003f/.u9QQ(G1 + []);
return N1;
};
o0[83] = o0[64];
P0 = 41;
break;
case 133:
o0[53] = [];
o0[26] = 'M';
o0[30] = 'u';
o0[88] = 'q';
o0[96] = 'K';
o0[94] = 'F';
o0[59] = 'J';
P0 = 126;
break;
case 58:
o0[60] = o0[27];
o0[61] = {};
o0[61].q = ['M3'];
P0 = 55;
break;
case 87:
o0[13].F = function() {
var r4 = function() {
return unescape('%3D');
};
var Z4 = /\x3d/.u9QQ(r4 + []);
return Z4;
};
o0[32] = o0[13];
o0[15] = {};
o0[15].q = ['T'];
P0 = 83;
break;
case 93:
o0[67].r9QQ(o0[25]);
o0[67].r9QQ(o0[87]);
o0[67].r9QQ(o0[85]);
o0[67].r9QQ(o0[49]);
P0 = 118;
break;
case 118:
o0[67].r9QQ(o0[38]);
P0 = 117;
break;
case 41:
o0[47] = {};
o0[47].q = ['H3'];
o0[47].F = function() {
var Q1 = function() {
var f1;
switch (f1) {
case 0:
break;
}
};
var b1 = !/\x30/.u9QQ(Q1 + []);
return b1;
};
P0 = 38;
break;
case 122:
o0[72] = 0;
P0 = 121;
break;
case 124:
o0[89] = o0[67][o0[34]];
try {
o0[68] = o0[89][o0[94]]() ? o0[26] : o0[30];
} catch (w4) {
o0[68] = o0[30];
}
P0 = 122;
break;
case 149:
o0[72]++;
P0 = 121;
break;
case 67:
o0[36].q = ['C'];
o0[36].F = function() {
var D4 = function() {
return [0, 1, 2].join('@');
};
var e4 = /\x40[0-9]/.u9QQ(D4 + []);
return e4;
};
o0[51] = o0[36];
o0[13] = {};
o0[13].q = ['M3'];
P0 = 87;
break;
case 102:
o0[70].F = function() {
var X4 = function(V4, Y4, n4) {
return !!V4 ? Y4 : n4;
};
var t4 = !/\x21/.u9QQ(X4 + []);
return t4;
};
o0[49] = o0[70];
o0[52] = {};
o0[52].q = ['H3'];
o0[52].F = function() {
var S4 = function() {
debugger;
};
var W4 = !/\x64\x65\x62\u0075\x67\x67\x65\u0072/.u9QQ(S4 + []);
return W4;
};
o0[11] = o0[52];
o0[67].r9QQ(o0[69]);
P0 = 95;
break;
case 117:
o0[67].r9QQ(o0[78]);
o0[67].r9QQ(o0[19]);
o0[67].r9QQ(o0[76]);
o0[67].r9QQ(o0[71]);
P0 = 113;
break;
case 33:
o0[23] = o0[6];
o0[7] = {};
o0[7].q = ['C', 'H3'];
o0[7].F = function() {
var H1 = function() {
return 1024 * 1024;
};
var U1 = /[5-67-8]/.u9QQ(H1 + []);
return U1;
};
o0[14] = o0[7];
o0[64] = {};
o0[64].q = ['C'];
P0 = 43;
break;
}
}
};
return Z0[4];
break;
case 2:
var Z0 = [arguments];
Z0[4] = {};
a0 = 5;
break;
}
}
}();
function C9QQ() {
function a5() {
var U0 = 2;
for (; U0 !== 5;) {
switch (U0) {
case 2:
var S3 = [arguments];
return S3[0][0].Function;
break;
}
}
}
function i5() {
var D3 = 2;
for (; D3 !== 5;) {
switch (D3) {
case 2:
var j3 = [arguments];
return j3[0][0];
break;
}
}
}
function U5() {
var X3 = 2;
for (; X3 !== 5;) {
switch (X3) {
case 2:
var k3 = [arguments];
return k3[0][0].RegExp;
break;
}
}
}
var A3 = 2;
for (; A3 !== 88;) {
switch (A3) {
case 58:
g3[38] += g3[3];
g3[38] += g3[96];
g3[84] = g3[60];
A3 = 55;
break;
case 61:
g3[67] += g3[3];
g3[67] += g3[96];
g3[38] = g3[60];
A3 = 58;
break;
case 11:
g3[4] = "";
g3[45] = "9";
g3[65] = "ract";
g3[64] = "st";
A3 = 18;
break;
case 6:
g3[13] = "D9";
g3[7] = "";
g3[60] = "R";
g3[7] = "_";
A3 = 11;
break;
case 72:
R5(b5, "window", g3[34], g3[49]);
R5(i5, "global", g3[34], g3[84]);
R5(U5, "global", g3[27], g3[38]);
R5(U5, "test", g3[27], g3[67]);
A3 = 68;
break;
case 2:
var g3 = [arguments];
g3[8] = "";
g3[8] = "QQ";
g3[9] = "";
A3 = 3;
break;
case 33:
g3[6] = "x9";
g3[27] = 1;
g3[34] = 6;
g3[34] = 0;
A3 = 29;
break;
case 18:
g3[4] = "e9";
g3[1] = "";
g3[1] = "r";
g3[69] = "esid";
g3[83] = "ual";
A3 = 26;
break;
case 52:
g3[37] += g3[96];
g3[37] += g3[96];
g3[39] = g3[7];
A3 = 49;
break;
case 3:
g3[9] = "u";
g3[99] = "E9";
g3[75] = "__ab";
g3[87] = "optimize";
A3 = 6;
break;
case 64:
g3[24] += g3[64];
g3[24] += g3[65];
g3[67] = g3[9];
A3 = 61;
break;
case 68:
R5(b5, g3[24], g3[34], g3[94]);
R5(b5, g3[39], g3[34], g3[37]);
R5(o5, "push", g3[27], g3[36]);
R5(b5, g3[32], g3[34], g3[95]);
R5(a5, "apply", g3[27], g3[21]);
A3 = 88;
break;
case 22:
g3[5] = "";
g3[5] = "Z";
g3[6] = "";
g3[96] = "Q";
A3 = 33;
break;
case 49:
g3[39] += g3[7];
g3[39] += g3[87];
g3[94] = g3[13];
A3 = 46;
break;
case 46:
g3[94] += g3[96];
g3[94] += g3[96];
g3[24] = g3[75];
A3 = 64;
break;
case 73:
var R5 = function() {
var m3 = 2;
for (; m3 !== 5;) {
switch (m3) {
case 2:
var w3 = [arguments];
K5(g3[0][0], w3[0][0], w3[0][1], w3[0][2], w3[0][3]);
m3 = 5;
break;
}
}
};
A3 = 72;
break;
case 75:
g3[49] += g3[96];
g3[49] += g3[96];
A3 = 73;
break;
case 36:
g3[36] += g3[3];
g3[36] += g3[96];
g3[37] = g3[4];
A3 = 52;
break;
case 29:
g3[21] = g3[6];
A3 = 28;
break;
case 55:
g3[84] += g3[45];
g3[84] += g3[8];
g3[49] = g3[99];
A3 = 75;
break;
case 26:
g3[2] = "";
g3[2] = "__r";
g3[3] = "";
g3[3] = "9Q";
A3 = 22;
break;
case 28:
g3[21] += g3[96];
g3[21] += g3[96];
g3[95] = g3[5];
A3 = 42;
break;
case 42:
g3[95] += g3[3];
g3[95] += g3[96];
g3[32] = g3[2];
A3 = 39;
break;
case 39:
g3[32] += g3[69];
g3[32] += g3[83];
g3[36] = g3[1];
A3 = 36;
break;
}
}
function o5() {
var C3 = 2;
for (; C3 !== 5;) {
switch (C3) {
case 2:
var E3 = [arguments];
return E3[0][0].Array;
break;
}
}
}
function b5() {
var r0 = 2;
for (; r0 !== 5;) {
switch (r0) {
case 2:
var V3 = [arguments];
return V3[0][0];
break;
}
}
}
function K5() {
var R0 = 2;
for (; R0 !== 5;) {
switch (R0) {
case 2:
var x3 = [arguments];
try {
var b0 = 2;
for (; b0 !== 9;) {
switch (b0) {
case 2:
x3[7] = {};
x3[1] = (1, x3[0][1])(x3[0][0]);
x3[3] = [x3[1], x3[1].prototype][x3[0][3]];
x3[7].value = x3[3][x3[0][2]];
try {
x3[0][0].Object.defineProperty(x3[3], x3[0][4], x3[7]);
} catch (u5) {
x3[3][x3[0][4]] = x3[7].value;
}
b0 = 9;
break;
}
}
} catch (E5) {}
R0 = 5;
break;
}
}
}
}
h3vv[h3vv.i3U]();
(function(factory) {
var e8z = h3vv;
var D7U = 737687;
var x1U = 289897821;
var V7U = 940829;
var O7U = 702790;
var v3U = 2115461815;
var o7U = 921356;
var k3U = 1835664260;
var S7U = 596930;
var r1U = 256445088;
var f7U = 661167;
var L1U = 313402382;
var d1U = 359430063;
var V3U = "md";
var P4S = -L1U,
i4S = -d1U,
T4S = -v3U,
V4S = -r1U,
u4S = -k3U,
R4S = x1U;
if (!(e8z.s6p(e8z.I2U, D7U) !== P4S && e8z.s6p(e8z.I2U, O7U) !== i4S && e8z.H6p(e8z.I2U, S7U) !== T4S && e8z.H6p(e8z.I2U, f7U) !== V4S && e8z.H6p(e8z.I2U, V7U) !== u4S && e8z.s6p(e8z.I2U, o7U) !== R4S && !h3vv.v4S())) {
var A0S = e8z.T3U;
A0S += V3U;
var E0S = e8z.u3U;
E0S += e8z.R3U;
e8z[E0S]();
if (typeof define === e8z.M3U && define[A0S]) {
define(['jquery', 'datatables.net'], function($) {
return factory($, window, document);
});
} else if (typeof exports === e8z.c3U) {
module.exports = function(root, $) {
if (!root) {
root = window;
}
if (!$ || !$.fn.dataTable) {
$ = require('datatables.net')(root, $).$;
}
return factory($, root, root.document);
};
} else {
factory(jQuery, window, document);
}
}
}(function($, window, document, undefined) {
'use strict';
var G8z = h3vv;
var R2m = "DTE_Header";
var k5m = "nth";
var M4c = "upl";
var G3N = "ror";
var s2N = "ePosition";
var R1d = "div.";
var v8N = "replace";
var j5U = "mu";
var X8d = "tr";
var A2U = 13;
var H4N = "_const";
var Q8U = "ateTi";
var e4c = 'xhr.dt';
var L0m = "em";
var k2N = "DataTables 1.10";
var L5d = 'fields';
var W6c = "join";
var u8U = "DTE_Bu";
var R4c = "oad";
var o8d = 'data';
var f9c = "_formOptions";
var T1N = "eFn";
var r9d = "formOptions";
var l2N = "mod";
var c5U = "c";
var F3c = "oi";
var y8U = "es";
var s4N = "ototyp";
var I8z = "editorFiel";
var x5c = "options";
var N7N = "da";
var L8U = "ie";
var c7d = "_ti";
var e4d = "div.DT";
var A8U = "DTE_";
var U5U = "E_Form";
var W2c = "fieldErrors";
var w0N = "<div da";
var q2N = "10.7";
var n0U = 100;
var t7N = "iel";
var Q7m = "lass=\"";
var O9N = "Ho";
var t6N = "layR";
var G0N = "iv>";
var r7d = "node";
var E6N = "oty";
var q5m = "_hide";
var z5d = "displayed";
var W0m = "i18n";
var p4d = "conf";
var W1d = "message";
var g9z = "n>";
var M5U = "_Processing_Indicator";
var T9N = "elete";
var F6N = "prot";
var z3N = "lt";
var d2N = "oller";
var H9d = "button";
var w5c = 'preOpen';
var o1d = "off";
var z9d = "settings";
var h8N = 'none';
var z8N = 'display';
var x6N = "totype";
var O0m = "select";
var j9d = "_init";
var C8N = "lue";
var u6m = 'September';
var S3m = "moment";
var h8U = "nce";
var m8N = "gth";
var h9d = "_dte";
var N5U = "lti-restor";
var k8N = "inA";
var Z5U = "E";
var a6N = "prototy";
var q0c = "rc";
var Y3c = "ons";
var k4c = 'files()';
var Q2N = "Editor";
var Z3c = "displayFields";
var Y6m = 'Fri';
var f4N = "().delete(";
var z4N = "_acti";
var o9N = "De";
var T2N = "files";
var q9c = "tons";
var C6c = "_focus";
var z9c = "tto";
var P5U = "TE";
var k7N = "ings";
var w9m = 'postSubmit';
var C2d = "cl";
var c5m = 'keydown.';
var S5U = "DT";
var P7m = "<s";
var Z9d = 'row';
var H8N = "In";
var v4N = "ispl";
var s0m = "DTE_Label";
var Y2U = 60;
var X2m = "DTE_Form_Info";
var P2U = 27;
var j7N = "ta";
var e2c = "ess";
var h7d = "sp";
var g4N = "x";
var V4N = "yed";
var T4N = "displ";
var l4c = "18n";
var R6m = 'December';
var S0U = 550;
var z5U = "eld";
var T3N = "ocu";
var k8U = "eTi";
var f9m = 'submitComplete';
var m0N = "abe";
var T8N = '&';
var k2U = 2;
var H2N = "ckground";
var d1m = "classPrefix";
var L3m = "TC";
var U8U = "e_Triangl";
var S1c = "exOf";
var E6c = "eve";
var U8N = "rep";
var I9N = "N";
var V1N = "ns";
var w8N = "ce";
var j6d = "ght";
var V3d = "ent";
var m8U = "t";
var m4z = 'month';
var l7d = "add";
var D5U = "multi-";
var w6m = "Multiple values";
var Q1d = "title";
var U7c = "status";
var u4N = "di";
var Y2m = "btn";
var v6N = "ot";
var U9N = "Are you ";
var n6z = '</tr>';
var Z5N = "remove";
var f5d = 'main';
var S5c = "_legacyAjax";
var Y9z = '<tr>';
var E1d = "ader";
var I3N = "error";
var V3m = "ye";
var a4N = "ed";
var P9N = "Del";
var K6d = 'auto';
var d8d = "field";
var L7c = "cr";
var j8d = 'json';
var S8N = "appen";
var u1U = 1157791072;
var g4d = "ht";
var s6N = "bmitErr";
var n3N = "func";
var J4m = "indexes";
var b1N = "dom";
var J6N = "_preo";
var J4N = "row().e";
var G9d = "append";
var z5c = 'keydown';
var v9d = "_do";
var i3N = 'focus';
var c2m = "DTE_Form_Content";
var Q6c = "init";
var L3N = "gt";
var B9c = "act";
var l3N = "classes";
var j3N = "lass";
var c7m = "\">";
var g3c = "onC";
var D2N = "1.";
var R9N = "w";
var z5N = "conta";
var g6N = "_su";
var z8d = "ds";
var T1d = "ight";
var Q7d = "li";
var e0N = "</d";
var e6d = "background";
var X4d = "_show";
var B8U = " ";
var X3d = "acti";
var L2N = "els";
var E7N = "multi";
var i6m = 'April';
var d4N = "rows()";
var I5N = "clas";
var K3d = 'keyup';
var y9N = "ange";
var H5U = "E_Ac";
var P8U = "DTE_B";
var m9N = "xten";
var d8U = "ex";
var z8c = "su";
var Q2c = "ubmit";
var o2U = 24;
var C5N = "non";
var u9N = "te";
var j6N = "type";
var K0c = "rl";
var O6N = "pen";
var Q2U = 10;
var t9z = "firstDay";
var G8N = "isPlainObject";
var q1c = "iv";
var H7d = "modifier";
var g7N = "lab";
var h0c = "dbTable";
var B6m = 'Previous';
var Y2N = "th";
var W5d = "inError";
var u1N = "hi";
var t7d = "nc";
var l8c = "sub";
var P1m = "_optionsT";
var D6c = 'closed';
var N9c = 'div.';
var i6c = "utton";
var P7c = "indexOf";
var c7N = "oApi";
var O8U = "YYY";
var C5U = "fo";
var p8N = "html";
var P6N = "oto";
var N9N = "T";
var R1m = "_setCalander";
var G2N = "_con";
var Q4d = "det";
var m5N = "Error";
var X9N = "proto";
var q9N = "m";
var X9c = "multiSet";
var z2d = "isp";
var F2d = "is";
var D6d = "wra";
var o3N = 'input';
var u9c = "ul";
var a6c = "_clearDynamicInfo";
var O9z = "selected";
var M7N = "at";
var P2d = "wrapp";
var G6N = "ame";
var K9N = "vembe";
var D7c = "Class";
var X0d = "fadeOut";
var Y0c = "dd";
var c5c = "_fnSetObjectDataFn";
var N5N = "table";
var b9d = "close";
var F4N = "ine";
var D8U = "D";
var Z5m = 'minutes';
var b6c = '-';
var w9N = "row?";
var j1c = "erro";
var q5U = "noEdit";
var I5d = "_message";
var p8c = "onComplete";
var O5c = "ength";
var P4N = "ayNo";
var U9d = "ound";
var a5U = "led";
var e7N = "fie";
var z7N = "safe";
var g6c = "sA";
var M9N = "ligh";
var w3d = "includeFie";
var q7m = "Da";
var Q6N = "_eventNa";
var h6N = "tot";
var b4d = "appendTo";
var F5d = "line";
var x5U = "n_";
var I8m = 'span';
var W6m = 'DT_RowId';
var v4m = "um";
var k5d = "get";
var I8d = "eac";
var n5c = "eyCo";
var t8U = "icon";
var x1c = "utt";
var p1d = "q";
var G1c = "closeIcb";
var D8c = "tit";
var v1d = "_close";
var D3c = "res";
var S5N = "host";
var y5m = "ours";
var f7d = "isArray";
var p5U = "DTE_Actio";
var T1U = 1152735137;
var M6N = "ototy";
var L3d = "si";
var P7N = "name";
var u2d = "pper";
var c9N = "tbox";
var Y6c = "event";
var c6N = "assembleMain";
var N4c = 'cell().edit()';
var u6N = "_clos";
var Z8c = "bmit";
var B3N = "F";
var q4c = 'edit';
var F1N = "do";
var x4d = 'div.DTE_Footer';
var e6N = "eldN";
var N6N = "otot";
var U5N = "length";
var w6N = "rototype";
var O6d = "end";
var B8N = "str";
var l4z = "llYear";
var t6d = "backg";
var v8U = "se";
var t0U = 427978;
var W8m = 'range';
var s8U = "prototyp";
var D7N = "val";
var I2N = "versionCheck";
var t9c = "ction";
var a8c = "editCount";
var H6c = "_even";
var l6N = "it";
var m9d = "<div class=\"DTED";
var F7d = "inArray";
var D4N = "()";
var Q3m = "np";
var C7N = "P";
var U6m = "The selected items contain different values for this input. To edit and set all items for this input to the same value, click or tap here, otherwise they will retain their individual values.";
var y5N = "co";
var D7m = "rmat";
var S4N = "nClass";
var e9m = "_fnExtend";
var m8d = '.edep';
var u4c = "aj";
var R4d = "ten";
var t8d = "ge";
var F4d = "ach";
var r6N = "toty";
var g2N = "bubbl";
var M4N = "epende";
var f3d = "8n";
var O3m = "_setTime";
var F5U = "eld_Name_";
var Q1N = "ea";
var F6d = "bind";
var K2N = "Editor requires ";
var K6m = "bServerSide";
var F7U = 874916;
var u9d = "wrapper";
var k5U = "DTE_Fie";
var t4m = "ws";
var X2U = 59;
var q4N = "g";
var f7c = "oin";
var L1N = "multiValue";
var G9m = "mit";
var U3d = "der";
var k3d = "keyCode";
var u6d = "od";
var V0N = "/";
var s1N = ' ';
var C3m = "date";
var z0c = "</di";
var p9N = "formO";
var l7m = "i18";
var V6m = 'June';
var j9m = "Fn";
var s9c = "bu";
var O2N = "Fi";
var h4d = "_animate";
var T7N = "dat";
var W9N = "Jul";
var q6N = "roto";
var v3d = "elds";
var W2U = 7;
var D5N = "ible";
var M4d = "nte";
var N3N = "fiel";
var E5d = "asses";
var A3c = "match";
var x2N = "us";
var J8U = "18";
var i6N = "_crudA";
var K5U = "alu";
var L5N = "op";
var X5m = 'scroll.';
var I1N = null;
var V6N = "rot";
var r4N = "ructor";
var n2N = "butto";
var c1d = "div";
var w8U = "Bubbl";
var Z8m = "ut";
var X1N = "call";
var X5U = "lasses";
var V8d = "then";
var h4N = "ssag";
var H3N = "def";
var U1N = "opts";
var l8U = "ditorF";
var M3d = "disp";
var B9N = "te %d rows?";
var A6N = "_ed";
var X8U = "DTE";
var H4c = "I";
var W4m = "cell";
var S8d = "form";
var A7N = "extend";
var j5N = "Api";
var j8U = "itor";
var t2d = "yl";
var J4c = "confirm";
var A1c = "dataSource";
var f6c = "_cl";
var T6m = 'May';
var W1U = 708924127;
var H1N = "label";
var a9N = "ur";
var w5d = "inl";
var K8z = "CLASS";
var N6d = "_dom";
var w5U = "_Buttons";
var B6c = "ov";
var B8c = "mi";
var R7c = "xt";
var n9N = "mOptions";
var e2U = 3;
var j9c = "ppend";
var I4c = 'cells().edit()';
var n8d = "gs";
var E9N = "Ar";
var I5U = "multi-v";
var a2N = "Ed";
var b6m = "_weakInArray";
var U7d = "fu";
var h6m = "Create new entry";
var m8m = "etSeconds";
var R6N = "eReg";
var k1N = "prepend";
var k0c = "ab";
var Q5U = "DTE_Fi";
var y5d = "ata";
var Z4d = 'div.DTE_Body_Content';
var b4N = "tiG";
var V5N = "toggleClass";
var j9N = "S";
var r8U = "l";
var Y4N = "ar";
var K7m = "-t";
var F6m = "Edit entry";
var f8U = "lds";
var l5U = "dit";
var d3d = "ub";
var z0U = 500;
var E3c = "split";
var x9N = "ptions";
var i2N = "les";
var U1m = "put";
var D0N = "bel";
var c3d = "lay";
var A8m = "setUTCMonth";
var t2U = 20;
var T8d = "bject";
var b0c = "actionName";
var r7N = "=";
var l6d = "round";
var K2z = "datetime";
var E4c = "safeId";
var v9c = "cti";
var S2N = "ba";
var m4N = ".edit()";
var E5U = "bt";
var B4N = "rror";
var L4N = ")";
var E7d = "_displayReorder";
var a9m = "_submitTable";
var V5U = "DTE_Bo";
var P1d = "_postopen";
var S7d = "action";
var d7c = "edi";
var e2N = ".7 or newer";
var Z7c = "trigger";
var D4c = 'row.create()';
var D9N = "p";
var a3d = "<but";
var h6d = 'click.DTED_Lightbox';
var R8d = "ect";
var i8U = "u";
var H6N = "pr";
var x6d = "bac";
var C1N = 'create';
var j4N = "ister";
var Z2N = "clos";
var B1N = "disabled";
var F4c = "ue";
var s9d = "models";
var X1m = "etUT";
var C8d = "ate";
var v5N = "oc";
var T0N = "ti";
var o5d = "ainObject";
var E6m = "Update";
var T8U = "bble";
var k8d = "al";
var l0d = "animate";
var x9c = "ass=\"";
var z9N = "s";
var s3m = "_dateToUtc";
var b5U = "nfo";
var e9d = "children";
var G9N = "Au";
var G7m = "-";
var e1N = "spl";
var p9d = 'blur';
var j2m = "filter";
var C2N = "dataTable";
var a3N = "removeClass";
var U2N = "each";
var p9c = "<div c";
var F8N = "eF";
var J3N = "cont";
var A2N = "]";
var c4N = "nt";
var B0m = "fir";
var N9d = "_s";
var d9d = "</div>";
var t5U = "_Error";
var I8c = "ey";
var Q3N = "ass";
var s5d = "disable";
var k4N = "ord";
var a0m = "lect";
var G2U = 4;
var O7m = "DateTime";
var i9m = "pu";
var G5U = "_I";
var S0m = "DTE_Field_InputControl";
var f4d = "ind";
var X7c = "unshift";
var L4c = 'remove';
var o1N = "focus";
var a7d = "fields";
var G4N = "mul";
var G8U = "_";
var r1d = "_clo";
var F9N = "individually, but not part of a group.";
var m1m = "format";
var f1c = "vent";
var f8d = "undependent";
var n4N = "ja";
var V8U = "_Table";
var X6m = 'Wed';
var s9N = "del";
var m4c = "age";
var n7d = "bl";
var Z0m = "DTE_Inline_Buttons";
var H0c = "ss=\"";
var a3c = "even";
var q9d = "displayController";
var o9c = "ion";
var m2N = "Fie";
var X7d = 'individual';
var a6d = "bo";
var J5d = "ions";
var g5U = "ble";
var T1c = "e=\"";
var K8U = "Dat";
var y4N = "lo";
var K7d = "_dataSource";
var e7d = "editFields";
var v5U = "Content";
var h0N = "v>";
var o6m = 'Next';
var F2N = "DataTable";
var E0N = "v";
var Z1d = "div>";
var V2c = " class=\"";
var s5U = "Inline_Fi";
var Z3d = 'left';
var L9N = "o";
var y8N = "detach";
var y3N = "on";
var j4c = 'rows().delete()';
var g8U = "n";
var Y8U = " DTE";
var g9N = "mo";
var K6N = "protot";
var I0N = "<";
var z0m = "DTE_Field_Input";
var d4c = "ace";
var O3N = "ai";
var o8U = "clo";
var y8m = "setUTCHours";
var y6c = "one";
var I6c = "editOpts";
var O8d = "isAr";
var D5d = "maybeOpen";
var x7N = "nam";
var e7m = "fin";
var J5U = "disa";
var t5N = "cs";
var T5d = "attach";
var V9d = "content";
var B5U = "_Foote";
var f3N = "container";
var Q0c = "idSrc";
var A0c = "footer";
var S9d = "fieldType";
var i3m = "-h";
var R1c = '"]';
var c6m = 'Mon';
var v7d = "blur";
var F8m = "getUT";
var p6N = "ro";
var V7d = "bubble";
var q6z = "setDate";
var L3c = "ray";
var J3d = "functi";
var Y9N = "ty";
var y0m = "DTE_Field_Message";
var r5U = "tion_Rem";
var R5N = "_multiInfo";
var h1N = 'click';
var o1m = "_set";
var B5m = "getU";
var y4d = "height";
var F1d = "he";
var b3d = "pre";
var s4m = 'changed';
var Q3d = "preven";
var Y7N = "tor";
var Z9N = "model";
var u5U = "DTE_Header_Con";
var E8U = "fieldTyp";
var K0d = "ou";
var W5U = "DTE_La";
var c1N = "slice";
var g5c = "next";
var x0d = "top";
var r2N = "j";
var z7d = "header";
var g0N = "leng";
var H7c = "_optionsUpdate";
var o9d = "ap";
var I9d = "dt";
var F5c = "ven";
var e9N = "ber";
var H5m = "secondsRange";
var H9c = "<d";
var n2m = "ca";
var Y6d = "eight";
var t2N = "fil";
var f5N = 'block';
var P1c = "na";
var l1c = "_blur";
var p7N = "am";
var N3c = "ler";
var x3N = "ner";
var o2d = "ff";
var K1c = "closeCb";
var B6d = "roun";
var t5d = "xte";
var z3d = "left";
var G5c = "par";
var R2N = "n0";
var B6N = "eo";
var S6N = "bmitSucces";
var o8N = "ing";
var n5U = "_Bub";
var o7N = "Field";
var I4N = "totyp";
var w1d = "buttons";
var T6N = "rgs";
var b2N = "structor";
var D3N = 'enable';
var J2N = "faults";
var I7N = "rop";
var N1N = "_typeFn";
var V6d = "dren";
var g4m = 'Minute';
var U6N = "_disp";
var n1m = "-iconR";
var f2d = "style";
var r8N = "abel";
var k9N = "Octo";
var S0N = true;
var e6c = "ll";
var y9c = "s=\"";
var R0c = "formContent";
var e5N = "1";
var r9N = "ch";
var H9N = "nd";
var K7N = "ett";
var R4N = "sa";
var R1N = "ft";
var s0d = "con";
var g9d = "text";
var q7U = 747839;
var t7c = "ajaxUrl";
var E4d = 'div.DTED_Lightbox_Content_Wrapper';
var Z4N = "rro";
var A5U = "DTE_Form";
var S9N = "exte";
var p0m = "DTE_Processing_Indicator";
var j8N = "ck";
var P6m = 'February';
var b8m = 'disabled';
var J0d = "offset";
var r8m = 'pm';
var T7d = "lu";
var H8U = "i";
var G7d = "multiReset";
var X7N = "valFromData";
var d5U = "r";
var J5N = "an";
var m6d = "heightCalc";
var h8m = '-iconLeft';
var p4N = "ad";
var K4N = "sh";
var o6N = "rder";
var z6N = "ototype";
var C9N = "h";
var g3N = "tion";
var A9N = "e you sure you wish to delete 1 ";
var C4N = "mpla";
var S5d = "map";
var l9d = "dis";
var t3N = "hasClass";
var T3d = "_ev";
var m5U = "eate";
var a8U = "Y-MM-D";
var P3d = "_fieldNames";
var q3c = "ult";
var N5m = "inpu";
var r5c = 'send';
var L9m = "_processing";
var k8z = "1.9.2";
var b8U = "in";
var i5U = "_F";
var X0N = "<div ";
var F8U = "ext";
var i3d = "create";
var P8d = "cal";
var C4d = "sc";
var E2N = "\"";
var M1N = "prototype";
var y5U = "ove";
var G1N = "css";
var C0N = "/div>";
var E7U = 875804;
var t1N = "multiEditable";
var U3N = "multiIds";
var i9N = "et";
var a7c = "emove";
var F9d = "_d";
var u2c = "/>";
var N4N = "va";
var Q7N = "i1";
var r1c = "stop";
var B3d = "splice";
var W7N = "ts";
var G1d = "liner";
var d6N = "ng";
var m1N = "info";
var l4N = "file(";
var o4N = "ena";
var E2U = 12;
var P6d = 'body';
var L9d = "play";
var S0d = "body";
var H0m = "DTE_Field_StateError";
var X5N = "all";
var Y3U = "rs";
var f1m = "Time";
var A5c = "actio";
var q8U = "d";
var t3d = "destroy";
var D2z = "inp";
var Q4N = "nl";
var y6N = "pe";
var Y1N = "apply";
var F2U = 11;
var C0c = "tabl";
var c2N = "push";
var u7N = "data";
var R7U = 983492;
var u2m = "mov";
var N0d = "rge";
var c7c = "omplete";
var q7c = "ete";
var T6d = "il";
var l0m = "DTE_Bubble_Background";
var b5N = "ss";
var f4c = "repl";
var r0m = "DTE_Field_Error";
var h5N = "rn";
var a5m = 'year';
var l9N = "xtend";
var m3N = "disab";
var X4N = "cle";
var n9d = "";
var w3N = "ngth";
var n8U = "io";
var C8c = "tt";
var S4c = "set";
var d5N = "ubmi";
var f9N = "rm";
var X8m = 'value';
var d9c = 'inline';
var R2d = "wi";
var l9c = "_p";
var X2N = "en";
var q0N = "mode";
var z8U = "e";
var O4N = "dit()";
var V2d = "ra";
var n0N = "eng";
var x8U = "rF";
var i4N = "de";
var n4m = 'am';
var C8U = "defau";
var X6N = "_a";
var b5d = '#';
var O8m = "elect";
var T5U = "ooter";
var Z3N = "addClass";
var c8U = "iner";
var P7d = "ose";
var a9c = '"/>';
var v7N = "fieldTypes";
var q3d = 'string';
var V1m = "minDate";
var c4c = 'action';
var Z6N = "_subm";
var A3d = "tri";
var v6m = 'January';
var y4c = "editor";
var b3U = 1914189695;
var Z4c = '_basic';
var x0m = "DTE DTE_Inline";
var Y9d = "ol";
var c8d = ".";
var R5U = "tent";
var N8U = "-datetime";
var u0N = "input";
var l5d = "_edit";
var e8N = "rr";
var u1d = "ngt";
var R8U = "bbl";
var e5U = "ld";
var i5c = "proces";
var i1N = "_typ";
var p1N = '</div>';
var p8U = "edito";
var W4N = "difi";
var z2N = "blu";
var R3N = "isMultiValue";
var z1c = "fun";
var D3m = "nge";
var H6d = "ightbox";
var z1N = '">';
var Z7d = "row";
var V1c = "find";
var g5d = "template";
var y2N = "pl";
var r3d = "Cla";
var r5N = "slideDown";
var N2N = "ionCheck";
var r4c = "ni";
var H2d = "O";
var D9c = '.';
var h5U = "bel_Info";
var n0c = "for";
var Q6d = "dte";
var R7N = '';
var Y3N = "splay";
var X3U = "ve";
var W3N = "remo";
var n8N = "os";
var F3N = "ainer";
var J6d = "app";
var l8d = "tio";
var t8N = "ac";
var j2N = "vers";
var a9d = "</div";
var S7N = "Id";
var O4d = "un";
var F3d = "tDe";
var j0d = "has";
var i6d = "pp";
var t0c = "TableTools";
var A4N = "id";
var A9d = "ity";
var J9N = "Seco";
var m5d = "pt";
var B9d = "wr";
var O5N = "ma";
var w3m = "contai";
var W0N = ">";
var n6N = "dy";
var w1N = "as";
var E3N = "_msg";
var s5c = 'button';
var Y7d = 'bubble';
var d4d = "click";
var z0N = false;
var y9d = 'submit';
var s0U = 400;
var x7m = 'selected';
var p3N = "tai";
var W6N = "romNode";
var N3m = "parts";
var b6d = "ter";
var V4m = "spli";
var d1N = "multiInfo";
var I6N = "ype";
var t6m = "Undo changes";
var T5m = "_pad";
var O5U = "b";
var m6N = "pro";
var n1N = "_fnGetObjectDataFn";
var x1d = "</";
var a4d = "cli";
var Y4d = "_hi";
var N3d = "attr";
var L8d = "_assembleMain";
var t6c = "rem";
var n1c = "err";
var Z8N = "_m";
var V5m = "getUTCMonth";
var d3U = 1588273976;
var f5U = "C";
var d3N = "parents";
var X5d = "_tidy";
var U8d = "processin";
var u4d = "ont";
var x4N = "pa";
var Q8c = "keyC";
var V9N = "re";
var G3d = "key";
var s8N = "slideUp";
var w4N = "ide";
var A7d = "ajax";
var o5U = "r_";
var S8U = "f";
var j1N = "processing";
var Q9N = "This input can be edited ";
var l9m = "mplete";
var k6N = "_fi";
var b6N = "_fieldF";
var n0m = "DTE_Field";
var s7d = "abl";
var B8d = "rows";
var u0d = "conte";
var A6m = "A system error has occurred (<a target=\"_blank\" href=\"//datatables.net/tn/12\">More information</a>).";
var N4d = "kgr";
var s0N = "ject";
var W5m = "lYear";
var Z9c = "appe";
var m1d = "\" ";
var a7m = "tc";
var t9N = "sure you wish to dele";
var x4c = "itl";
var P0c = "able";
var e3N = "class";
var M8U = "e_L";
var f6N = "essi";
var h9N = "Mar";
var v9N = "le";
var C6N = "yp";
var b7d = "order";
var N8c = "tton";
var R7d = "la";
var o5N = "om";
var G6z = "parent";
var i7d = "submit";
var M2m = "DTE_Body_Content";
var w3U = 2056065786;
var E9c = "target";
var l4d = 'maxHeight';
var N1d = "des";
var s2d = "ne";
var E4N = "otype";
var W8U = "sta";
var Y6N = "imat";
var T4c = "_e";
var K5N = "ses";
var g2c = "upload";
var K6c = "_event";
var e8U = "me";
var j6c = "ope";
var r5d = "edit";
var Y5U = "or";
var M6m = 'Sun';
var f2N = "splayContr";
var b3c = "ct";
var g8N = "fn";
var D6N = "postopen";
var K8N = "multiValues";
var v7U = 929345;
var L5U = "DTE_Action_";
var f7N = "typ";
var J7d = "el";
var e4N = "er";
var C2z = "momentStrict";
var f6d = "mat";
var H5N = "display";
var U4N = "to";
var d9N = "Options";
var d7d = "len";
var N6m = "ocessing";
var N9m = "A";
var K2U = 1;
var I8U = "lts";
var Z0c = "sing";
var x9d = 'close';
var t4N = "fi";
var c0N = "nput";
var g0m = "DTE_Field_Type_";
var v7c = "cre";
var n1d = "cus";
var Q6m = "Edit";
var L6N = "_proc";
var p2N = "ay";
var W8N = "cessing";
var b9N = "gust";
var Y8d = "oy";
var P5N = "k";
var o6c = "ev";
var G5N = "no";
var Z8U = "ields";
var G0c = "defaults";
var k9d = "ow";
var F7N = "8";
var d2m = "=\"";
var l3m = "U";
var g1N = '<div class="';
var f5c = "ml";
var I9c = "_cle";
var m3d = "empty";
var M4S = -w3U,
c4S = b3U,
X4S = -W1U,
Y4S = u1U,
n2S = -d3U,
g2S = T1U;
if (!(G8z.H6p(G8z.I2U, R7U) !== M4S && G8z.H6p(G8z.I2U, q7U) !== c4S && G8z.s6p(G8z.I2U, v7U) !== X4S && G8z.s6p(G8z.I2U, t0U) !== Y4S && G8z.H6p(G8z.I2U, F7U) !== n2S && G8z.H6p(G8z.I2U, E7U) !== g2S && !h3vv.v4S())) {
var C2U = X3U;
C2U += Y3U;
C2U += n8U;
C2U += g8U;
var N2U = s8U;
N2U += z8U;
var j2U = S8U;
j2U += H8U;
j2U += r8U;
j2U += y8U;
var q2U = p8U;
q2U += x8U;
q2U += Z8U;
var O2U = z8U;
O2U += l8U;
O2U += L8U;
O2U += f8U;
var J2U = d8U;
J2U += m8U;
var y19 = z8U;
y19 += g8U;
var r19 = H8U;
r19 += J8U;
r19 += g8U;
var H19 = O8U;
H19 += a8U;
H19 += D8U;
var S19 = z8U;
S19 += q8U;
S19 += j8U;
S19 += N8U;
var z19 = C8U;
z19 += I8U;
var s19 = K8U;
s19 += k8U;
s19 += e8U;
var g19 = G8U;
g19 += b8U;
g19 += W8U;
g19 += h8U;
var n19 = D8U;
n19 += Q8U;
n19 += e8U;
var U5u = F8U;
U5u += z8U;
U5u += g8U;
U5u += q8U;
var K8u = E8U;
K8u += y8U;
var t1u = A8U;
t1u += w8U;
t1u += U8U;
t1u += z8U;
var U1u = t8U;
U1u += B8U;
U1u += o8U;
U1u += v8U;
var w1u = P8U;
w1u += i8U;
w1u += T8U;
w1u += V8U;
var A1u = u8U;
A1u += R8U;
A1u += M8U;
A1u += c8U;
var E1u = X8U;
E1u += Y8U;
E1u += n5U;
E1u += g5U;
var F1u = A8U;
F1u += s5U;
F1u += z5U;
var Q1u = S5U;
Q1u += H5U;
Q1u += r5U;
Q1u += y5U;
var h1u = p5U;
h1u += x5U;
h1u += Z5U;
h1u += l5U;
var W1u = L5U;
W1u += f5U;
W1u += d5U;
W1u += m5U;
var b1u = J5U;
b1u += O5U;
b1u += a5U;
var G1u = D5U;
G1u += q5U;
var e1u = j5U;
e1u += N5U;
e1u += z8U;
var k1u = D5U;
k1u += b8U;
k1u += C5U;
var K1u = I5U;
K1u += K5U;
K1u += z8U;
var I1u = k5U;
I1u += e5U;
I1u += G5U;
I1u += b5U;
var C1u = W5U;
C1u += h5U;
var N1u = Q5U;
N1u += F5U;
var j1u = E5U;
j1u += g8U;
var q1u = A5U;
q1u += w5U;
var D1u = S5U;
D1u += U5U;
D1u += t5U;
var a1u = X8U;
a1u += B5U;
a1u += o5U;
a1u += v5U;
var O1u = D8U;
O1u += P5U;
O1u += i5U;
O1u += T5U;
var J1u = V5U;
J1u += q8U;
J1u += G8z.u3U;
var m1u = u5U;
m1u += R5U;
var d1u = X8U;
d1u += M5U;
var f1u = c5U;
f1u += X5U;
var h2u = S8U;
h2u += Y5U;
h2u += n9N;
var W2u = g9N;
W2u += s9N;
W2u += z9N;
var b2u = S9N;
b2u += H9N;
var G2u = r9N;
G2u += y9N;
G2u += q8U;
var e2u = p9N;
e2u += x9N;
var k2u = Z9N;
k2u += z9N;
var K2u = z8U;
K2u += l9N;
var I2u = S8U;
I2u += L9N;
I2u += f9N;
I2u += d9N;
var C2u = z8U;
C2u += m9N;
C2u += q8U;
var N2u = J9N;
N2u += g8U;
N2u += q8U;
var j2u = O9N;
j2u += a9N;
var q2u = D9N;
q2u += q9N;
var D2u = j9N;
D2u += G8z.T3U;
D2u += m8U;
var a2u = N9N;
a2u += C9N;
a2u += i8U;
var O2u = N9N;
O2u += i8U;
O2u += z8U;
var J2u = I9N;
J2u += L9N;
J2u += K9N;
J2u += d5U;
var m2u = k9N;
m2u += e9N;
var d2u = G9N;
d2u += b9N;
var f2u = W9N;
f2u += G8z.u3U;
var L2u = h9N;
L2u += r9N;
var l2u = Q9N;
l2u += F9N;
var Z2u = E9N;
Z2u += A9N;
Z2u += w9N;
var x2u = U9N;
x2u += t9N;
x2u += B9N;
var p2u = o9N;
p2u += v9N;
p2u += m8U;
p2u += z8U;
var y2u = P9N;
y2u += i9N;
y2u += z8U;
var r2u = D8U;
r2u += T9N;
var H2u = f5U;
H2u += V9N;
H2u += G8z.T3U;
H2u += u9N;
var S2u = I9N;
S2u += z8U;
S2u += R9N;
var z2u = M9N;
z2u += c9N;
var s2u = X9N;
s2u += Y9N;
s2u += D9N;
s2u += z8U;
var o4u = G8U;
o4u += m8U;
o4u += H8U;
o4u += n6N;
var A4u = g6N;
A4u += s6N;
A4u += Y5U;
var E4u = D9N;
E4u += d5U;
E4u += z6N;
var e6u = g6N;
e6u += S6N;
e6u += z9N;
var k6u = H6N;
k6u += L9N;
k6u += r6N;
k6u += y6N;
var l6u = D9N;
l6u += p6N;
l6u += x6N;
var F9u = Z6N;
F9u += l6N;
var G9u = L6N;
G9u += f6N;
G9u += d6N;
var e9u = m6N;
e9u += r6N;
e9u += y6N;
var O9u = J6N;
O9u += O6N;
var J9u = a6N;
J9u += y6N;
var n9u = G8U;
n9u += D6N;
var Y5M = D9N;
Y5M += q6N;
Y5M += j6N;
var V5M = H6N;
V5M += N6N;
V5M += C6N;
V5M += z8U;
var Q5M = D9N;
Q5M += d5U;
Q5M += N6N;
Q5M += I6N;
var q5M = K6N;
q5M += I6N;
var Z8M = k6N;
Z8M += e6N;
Z8M += G6N;
Z8M += z9N;
var r8M = b6N;
r8M += W6N;
var H8M = m6N;
H8M += h6N;
H8M += I6N;
var s8M = Q6N;
s8M += e8U;
var g8M = a6N;
g8M += y6N;
var o3M = F6N;
o3M += E6N;
o3M += y6N;
var J3M = A6N;
J3M += H8U;
J3M += m8U;
var m3M = D9N;
m3M += w6N;
var u1M = U6N;
u1M += t6N;
u1M += B6N;
u1M += o6N;
var V1M = F6N;
V1M += v6N;
V1M += G8z.u3U;
V1M += y6N;
var v1M = H6N;
v1M += P6N;
v1M += j6N;
var F1M = i6N;
F1M += T6N;
var Q1M = D9N;
Q1M += V6N;
Q1M += v6N;
Q1M += I6N;
var h1M = u6N;
h1M += R6N;
var W1M = K6N;
W1M += I6N;
var l1M = F6N;
l1M += L9N;
l1M += j6N;
var S1M = H6N;
S1M += M6N;
S1M += y6N;
var V7M = G8U;
V7M += c6N;
var T7M = m6N;
T7M += m8U;
T7M += L9N;
T7M += j6N;
var B7M = X6N;
B7M += g8U;
B7M += Y6N;
B7M += z8U;
var X0M = G8U;
X0M += G8z.T3U;
X0M += n4N;
X0M += g4N;
var c0M = H6N;
c0M += s4N;
c0M += z8U;
var A0M = z4N;
A0M += L9N;
A0M += S4N;
var H2M = H4N;
H2M += r4N;
var x4M = i8U;
x4M += D9N;
x4M += y4N;
x4M += p4N;
var g4M = x4N;
g4M += H8U;
g4M += d5U;
g4M += z9N;
var n4M = z8U;
n4M += Z4N;
n4M += d5U;
var V6M = l4N;
V6M += L4N;
var U6M = p6N;
U6M += R9N;
U6M += f4N;
U6M += L4N;
var w6M = d4N;
w6M += m4N;
var F6M = J4N;
F6M += O4N;
var W6M = a4N;
W6M += j8U;
W6M += D4N;
var q6M = V9N;
q6M += q4N;
q6M += j4N;
var O6M = N4N;
O6M += r8U;
var x6M = m8U;
x6M += l6N;
x6M += r8U;
x6M += z8U;
var p6M = X9N;
p6M += m8U;
p6M += I6N;
var r6M = u9N;
r6M += C4N;
r6M += m8U;
r6M += z8U;
var H6M = m6N;
H6M += I4N;
H6M += z8U;
var R9M = m6N;
R9M += h6N;
R9M += C6N;
R9M += z8U;
var i9M = K4N;
i9M += L9N;
i9M += R9N;
var P9M = H6N;
P9M += L9N;
P9M += x6N;
var t9M = z9N;
t9M += i9N;
var l9M = k4N;
l9M += e4N;
var M5J = L9N;
M5J += D9N;
M5J += z8U;
M5J += g8U;
var R5J = K6N;
R5J += I6N;
var T5J = H6N;
T5J += z6N;
var w5J = g8U;
w5J += L9N;
w5J += q8U;
w5J += z8U;
var Q5J = F6N;
Q5J += L9N;
Q5J += j6N;
var k5J = G4N;
k5J += b4N;
k5J += z8U;
k5J += m8U;
var I5J = g9N;
I5J += W4N;
I5J += z8U;
I5J += d5U;
var C5J = K6N;
C5J += C6N;
C5J += z8U;
var O5J = D9N;
O5J += w6N;
var l5J = e8U;
l5J += h4N;
l5J += z8U;
var Z5J = m6N;
Z5J += I4N;
Z5J += z8U;
var Z8J = H8U;
Z8J += Q4N;
Z8J += F4N;
var x8J = F6N;
x8J += E4N;
var H8J = H6N;
H8J += L9N;
H8J += x6N;
var z8J = A4N;
z8J += z9N;
var s8J = m6N;
s8J += m8U;
s8J += E4N;
var X3J = C9N;
X3J += w4N;
var T3J = m6N;
T3J += U4N;
T3J += Y9N;
T3J += y6N;
var i3J = X9N;
i3J += j6N;
var P3J = S8U;
P3J += H8U;
P3J += r8U;
P3J += z8U;
var v3J = s8U;
v3J += z8U;
var t3J = X9N;
t3J += j6N;
var w3J = t4N;
w3J += z5U;
var A3J = D9N;
A3J += V6N;
A3J += E6N;
A3J += y6N;
var W3J = z8U;
W3J += B4N;
var b3J = H6N;
b3J += z6N;
var e3J = o4N;
e3J += O5U;
e3J += r8U;
e3J += z8U;
var q3J = H6N;
q3J += v6N;
q3J += E6N;
q3J += y6N;
var D3J = q8U;
D3J += v4N;
D3J += P4N;
D3J += i4N;
var m3J = T4N;
m3J += G8z.T3U;
m3J += V4N;
var d3J = H6N;
d3J += v6N;
d3J += E4N;
var L3J = m6N;
L3J += m8U;
L3J += E4N;
var x3J = u4N;
x3J += R4N;
x3J += g5U;
var g3J = D9N;
g3J += d5U;
g3J += P6N;
g3J += j6N;
var O1J = q8U;
O1J += M4N;
O1J += c4N;
var J1J = s8U;
J1J += z8U;
var f1J = D9N;
f1J += q6N;
f1J += j6N;
var B7J = m6N;
B7J += x6N;
var h7J = X4N;
h7J += Y4N;
var O7J = n2N;
O7J += g8U;
O7J += z9N;
var v0J = g2N;
v0J += s2N;
var o0J = D9N;
o0J += V6N;
o0J += L9N;
o0J += j6N;
var u2J = D9N;
u2J += q6N;
u2J += Y9N;
u2J += y6N;
var T2J = z2N;
T2J += d5U;
var i2J = K6N;
i2J += G8z.u3U;
i2J += y6N;
var U2J = S2N;
U2J += H2N;
var w2J = K6N;
w2J += I6N;
var A2J = G8z.T3U;
A2J += r2N;
A2J += G8z.T3U;
A2J += g4N;
var D2J = m6N;
D2J += m8U;
D2J += E6N;
D2J += y6N;
var f5S = u4N;
f5S += z9N;
f5S += y2N;
f5S += p2N;
var L5S = G8z.T3U;
L5S += r8U;
L5S += r8U;
var l5S = C5U;
l5S += c5U;
l5S += x2N;
var Z5S = Z2N;
Z5S += z8U;
var x5S = l2N;
x5S += L2N;
var p5S = u4N;
p5S += f2N;
p5S += d2N;
var y5S = m2N;
y5S += e5U;
var r5S = q8U;
r5S += z8U;
r5S += J2N;
var H5S = l2N;
H5S += L2N;
var S5S = O2N;
S5S += z8U;
S5S += e5U;
var Q1S = m6N;
Q1S += U4N;
Q1S += Y9N;
Q1S += y6N;
var x7S = m2N;
x7S += e5U;
var X0S = g8U;
X0S += G8z.R3U;
var T0S = a2N;
T0S += H8U;
T0S += m8U;
T0S += Y5U;
var i0S = S8U;
i0S += g8U;
var t0S = D2N;
t0S += q2N;
var U0S = j2N;
U0S += N2N;
var w0S = S8U;
w0S += g8U;
var DataTable = $[w0S][C2N];
if (!DataTable || !DataTable[I2N] || !DataTable[U0S](t0S)) {
var B0S = K2N;
B0S += k2N;
B0S += e2N;
throw new Error(B0S);
}
var Editor = function(opts) {
var b1U = 671734389;
var c0U = 568246;
var Q0U = 362638;
var X0U = 568325;
var P3U = 2126236742;
var W2N = "DataTabl";
var h2N = "es Editor must be initialised as a 'new' instance'";
var z3U = 1373540987;
var V0U = 525914;
var G1U = 639891931;
var U1U = 1033271983;
var e7U = 779458;
var l1U = 303078815;
var W7U = 796403;
var s2S = l1U,
z2S = -b1U,
S2S = -G1U,
H2S = -z3U,
r2S = -P3U,
y2S = -U1U;
if (!(G8z.s6p(G8z.I2U, c0U) !== s2S && G8z.H6p(G8z.I2U, e7U) !== z2S && G8z.s6p(G8z.I2U, W7U) !== S2S && G8z.s6p(G8z.I2U, V0U) !== H2S && G8z.s6p(G8z.I2U, Q0U) !== r2S && G8z.s6p(G8z.I2U, X0U) !== y2S && !h3vv.v4S())) {
var P0S = G2N;
P0S += b2N;
var o0S = G8z.u3U;
o0S += G8z.R3U;
G8z[o0S]();
if (!(this instanceof Editor)) {
var v0S = W2N;
v0S += h2N;
alert(v0S);
}
this[P0S](opts);
}
};
DataTable[Q2N] = Editor;
$[i0S][F2N][T0S] = Editor;
var _editor_el = function(dis, ctx) {
var M1U = 1225971634;
var s1U = 91678855;
var s3U = 1370524653;
var Z0U = 188870;
var w2N = '*[data-dte-e="';
var t7U = 909699;
var i7U = 930592;
var l0U = 194131;
var m3U = 1610057331;
var U0U = 416239;
var B0U = 460305;
var a3U = 1665860769;
var D3U = 1670496511;
var p2S = a3U,
x2S = s3U,
Z2S = D3U,
l2S = -m3U,
L2S = M1U,
f2S = s1U;
if (G8z.H6p(G8z.I2U, B0U) === p2S || G8z.s6p(G8z.I2U, Z0U) === x2S || G8z.H6p(G8z.I2U, i7U) === Z2S || G8z.s6p(G8z.I2U, l0U) === l2S || G8z.s6p(G8z.I2U, U0U) === L2S || G8z.H6p(G8z.I2U, t7U) === f2S || h3vv.o4S()) {
var u0S = E2N;
u0S += A2N;
var V0S = G8z.u3U;
V0S += G8z.R3U;
G8z[V0S]();
if (ctx === undefined) {
ctx = document;
}
return $(w2N + dis + u0S, ctx);
}
};
var __inlineCounter = G8z.I2U;
var _pluck = function(a, prop) {
var w0U = 379216;
var J0U = 243677;
var b7U = 785878;
var g3U = 1334062078;
var K0U = 296378;
var e3U = 1893700353;
var R1U = 1160726502;
var n3U = 1313310904;
var Z1U = 292856282;
var I1U = 583919090;
var h0U = 348928;
var b0U = 323472;
var d2S = I1U,
m2S = g3U,
J2S = -n3U,
O2S = e3U,
a2S = Z1U,
D2S = R1U;
if (!(G8z.H6p(G8z.I2U, h0U) !== d2S && G8z.H6p(G8z.I2U, K0U) !== m2S && G8z.H6p(G8z.I2U, b7U) !== J2S && G8z.s6p(G8z.I2U, J0U) !== O2S && G8z.H6p(G8z.I2U, w0U) !== a2S && G8z.s6p(G8z.I2U, b0U) !== D2S && !h3vv.v4S())) {
var R0S = g8U;
R0S += G8z.R3U;
G8z[R0S]();
var out = [];
$[U2N](a, function(idx, el) {
var m7U = 680382;
var S1U = 164253662;
var l7U = 648120;
var q0U = 269706;
var m1U = 379223771;
var v1U = 1100736322;
var u0U = 527417;
var L0U = 209172;
var W3U = 1932982025;
var h3U = 1935044082;
var Y0U = 577924;
var N3U = 1708226221;
var q2S = W3U,
j2S = S1U,
N2S = m1U,
C2S = -h3U,
I2S = -v1U,
K2S = -N3U;
if (!(G8z.H6p(G8z.I2U, u0U) !== q2S && G8z.H6p(G8z.I2U, l7U) !== j2S && G8z.s6p(G8z.I2U, m7U) !== N2S && G8z.s6p(G8z.I2U, Y0U) !== C2S && G8z.s6p(G8z.I2U, L0U) !== I2S && G8z.H6p(G8z.I2U, q0U) !== K2S && !h3vv.o4S())) {
var c0S = D9N;
c0S += i8U;
c0S += z9N;
c0S += C9N;
var M0S = g8U;
M0S += G8z.R3U;
G8z[M0S]();
out[c0S](el[prop]);
}
});
return out;
}
};
G8z[X0S]();
var _api_file = function(name, id) {
var x0U = 176175;
var x3U = 1444182935;
var P1U = 1118844615;
var E0U = 366323;
var o2N = "now";
var J7U = 695936;
var t1U = 1041568813;
var y3U = 1406954424;
var v2N = "n file id ";
var i0U = 489846;
var P2N = ' in table ';
var r0U = 107668;
var Z3U = 1542597740;
var t3U = 2086739305;
var B2N = "Unk";
var G7U = 780567;
var k2S = -t1U,
e2S = -x3U,
G2S = -Z3U,
b2S = -y3U,
W2S = t3U,
h2S = -P1U;
if (!(G8z.s6p(G8z.I2U, J7U) !== k2S && G8z.H6p(G8z.I2U, x0U) !== e2S && G8z.s6p(G8z.I2U, r0U) !== G2S && G8z.s6p(G8z.I2U, G7U) !== b2S && G8z.H6p(G8z.I2U, E0U) !== W2S && G8z.H6p(G8z.I2U, i0U) !== h2S && !h3vv.o4S())) {
var n7S = t2N;
n7S += y8U;
var Y0S = g8U;
Y0S += G8z.R3U;
G8z[Y0S]();
var table = this[n7S](name);
var file = table[id];
if (!file) {
var g7S = B2N;
g7S += o2N;
g7S += v2N;
throw g7S + id + P2N + name;
}
return table[id];
}
};
var _api_files = function(name) {
var a0U = 249701;
var g7U = 580499;
var E3U = 2013859386;
var i1U = 1146176527;
var p3U = 1439884266;
var k1U = 612125073;
var V2N = "Unknown file table ";
var u2N = "name: ";
var Y1U = 1303585709;
var n7U = 580160;
var M0U = 565660;
var r7U = 604999;
var j0U = 283291;
var B1U = 1049696883;
var Q2S = E3U,
F2S = -k1U,
E2S = Y1U,
A2S = p3U,
w2S = -i1U,
U2S = -B1U;
if (G8z.s6p(G8z.I2U, j0U) === Q2S || G8z.s6p(G8z.I2U, r7U) === F2S || G8z.s6p(G8z.I2U, n7U) === E2S || G8z.H6p(G8z.I2U, M0U) === A2S || G8z.s6p(G8z.I2U, g7U) === w2S || G8z.H6p(G8z.I2U, a0U) === U2S || h3vv.o4S()) {
var z7S = t4N;
z7S += i2N;
var s7S = g8U;
s7S += G8z.R3U;
if (!name) {
return Editor[T2N];
}
G8z[s7S]();
var table = Editor[z7S][name];
if (!table) {
var S7S = V2N;
S7S += u2N;
throw S7S + name;
}
return table;
}
};
var _objectKeys = function(o) {
var q1U = 504406260;
var I7U = 765562;
var v0U = 481689;
var J3U = 1615150779;
var a1U = 438942096;
var u7U = 960610;
var M2N = "hasOwnProperty";
var Y7U = 45629356;
var k7U = 777693;
var c1U = 1247299969;
var D0U = 265853;
var G3U = 1901849458;
var N7U = 757480;
var t2S = -q1U,
B2S = -a1U,
o2S = c1U,
v2S = G3U,
P2S = -J3U,
i2S = Y7U;
if (G8z.H6p(G8z.I2U, D0U) === t2S || G8z.H6p(G8z.I2U, v0U) === B2S || G8z.s6p(G8z.I2U, u7U) === o2S || G8z.H6p(G8z.I2U, I7U) === v2S || G8z.H6p(G8z.I2U, k7U) === P2S || G8z.s6p(G8z.I2U, N7U) === i2S || h3vv.v4S()) {
G8z[R2N]();
var out = [];
for (var key in o) {
if (o[M2N](key)) {
out[c2N](key);
}
}
return out;
}
};
var _deepCompare = function(o1, o2) {
var r3U = 1398388440;
var J1U = 383516136;
var D1U = 490812548;
var l3U = 1544371092;
var f0U = 217820;
var y0U = 127326;
var A0U = 374547;
var d0U = 231609;
var f1U = 349413170;
var C0U = 294066;
var c7U = 995366;
var E1U = 874820965;
var T2S = -D1U,
V2S = -E1U,
u2S = r3U,
R2S = -J1U,
M2S = -l3U,
c2S = f1U;
if (G8z.s6p(G8z.I2U, c7U) === T2S || G8z.s6p(G8z.I2U, C0U) === V2S || G8z.H6p(G8z.I2U, y0U) === u2S || G8z.H6p(G8z.I2U, A0U) === R2S || G8z.s6p(G8z.I2U, d0U) === M2S || G8z.s6p(G8z.I2U, f0U) === c2S || h3vv.o4S()) {
var p7S = r8U;
p7S += X2N;
p7S += q4N;
p7S += Y2N;
var y7S = r8U;
y7S += n0N;
y7S += Y2N;
var r7S = g0N;
r7S += Y2N;
var H7S = L9N;
H7S += O5U;
H7S += s0N;
if (typeof o1 !== G8z.c3U || typeof o2 !== H7S) {
return o1 == o2;
}
var o1Props = _objectKeys(o1);
var o2Props = _objectKeys(o2);
if (o1Props[r7S] !== o2Props[y7S]) {
return z0N;
}
for (var i = G8z.I2U, ien = o1Props[p7S]; i < ien; i++) {
var propName = o1Props[i];
if (typeof o1[propName] === G8z.c3U) {
if (!_deepCompare(o1[propName], o2[propName])) {
return z0N;
}
} else if (o1[propName] != o2[propName]) {
return z0N;
}
}
return S0N;
}
};
Editor[x7S] = function(opts, classes, host) {
var Q0N = "essage";
var A0N = "msg-erro";
var i7N = "E_Field_";
var D1N = '<div data-dte-e="msg-info" class="';
var R0N = "Cont";
var B7N = "d - unknown field type ";
var U7N = " f";
var x1N = '</label>';
var O0N = "g-i";
var s7N = "elI";
var a0N = "nf";
var P0N = "/s";
var y1N = 'msg-label';
var Y0N = "data-dte-e=\"in";
var m7N = "efix";
var b7N = "defaul";
var Z0N = "i-in";
var b0N = "ieldI";
var q1N = 'msg-info';
var N0N = "\"><span/><";
var K0N = "div data-dte-e=\"field-process";
var J0N = "ms";
var y7N = "classN";
var Z7N = "eP";
var O7N = "_fnSetObjectDat";
var d0N = "-l";
var O1N = '<div data-dte-e="msg-message" class="';
var Z1N = '<div data-dte-e="input-control" class="';
var v1N = "multiReturn";
var L0N = "multi-val";
var k0N = "ing\" class=\"";
var a7N = "aFn";
var U0N = "ta-dte-e=\"msg-error\" class=\"";
var l1N = '<div data-dte-e="multi-value" class="';
var G7N = "ldType";
var f0N = "msg";
var K1N = 'input-control';
var L7N = "ix";
var M0N = "rol";
var l7N = "ref";
var y0N = "field-p";
var l0N = "msg-mul";
var r0N = "mult";
var B0N = "<div d";
var x0N = "essing";
var w7N = "Error adding";
var H0N = "lick";
var t0N = "resto";
var i0N = "pan>";
var d7N = "Pr";
var a1N = 'msg-message';
var f1N = '<span data-dte-e="multi-info" class="';
var j0N = "tend";
var J7N = "rappe";
var v0N = "=\"msg-multi\" class=\"";
var W1N = 'msg-error';
var H7N = "\" fo";
var p0N = "roc";
var o0N = "ata-dte-e";
var S1N = '<label data-dte-e="label" class="';
var F0N = "\"></d";
var J1N = "multiRestore";
var h7N = "Fiel";
var q7N = "oDa";
var n7N = "put\" class=\"";
var V7N = "aProp";
var r1N = '<div data-dte-e="msg-label" class="';
var b1S = Y9N;
b1S += D9N;
b1S += z8U;
var e1S = c5U;
e1S += H0N;
var k1S = L9N;
k1S += g8U;
var N1S = L9N;
N1S += g8U;
var j1S = r0N;
j1S += H8U;
var q1S = y0N;
q1S += p0N;
q1S += x0N;
var D1S = r0N;
D1S += Z0N;
D1S += C5U;
var a1S = l0N;
a1S += m8U;
a1S += H8U;
var O1S = L0N;
O1S += i8U;
O1S += z8U;
var J1S = f0N;
J1S += d0N;
J1S += m0N;
J1S += r8U;
var m1S = J0N;
m1S += O0N;
m1S += a0N;
m1S += L9N;
var d1S = r8U;
d1S += G8z.T3U;
d1S += D0N;
var f1S = q8U;
f1S += L9N;
f1S += q9N;
var L1S = q0N;
L1S += r8U;
L1S += z9N;
var l1S = z8U;
l1S += g4N;
l1S += j0N;
var p1S = N0N;
p1S += C0N;
var y1S = I0N;
y1S += K0N;
y1S += k0N;
var r1S = e0N;
r1S += G0N;
var H1S = S8U;
H1S += b0N;
H1S += a0N;
H1S += L9N;
var S1S = E2N;
S1S += W0N;
var z1S = e0N;
z1S += H8U;
z1S += h0N;
var s1S = q9N;
s1S += Q0N;
var g1S = E2N;
g1S += W0N;
var n1S = F0N;
n1S += H8U;
n1S += E0N;
n1S += W0N;
var Y7S = A0N;
Y7S += d5U;
var X7S = w0N;
X7S += U0N;
var c7S = t0N;
c7S += V9N;
var M7S = E2N;
M7S += W0N;
var R7S = B0N;
R7S += o0N;
R7S += v0N;
var u7S = I0N;
u7S += P0N;
u7S += i0N;
var V7S = E2N;
V7S += W0N;
var T7S = T0N;
T7S += m8U;
T7S += r8U;
T7S += z8U;
var i7S = E2N;
i7S += V0N;
i7S += W0N;
var P7S = u0N;
P7S += R0N;
P7S += M0N;
var v7S = H8U;
v7S += c0N;
var o7S = X0N;
o7S += Y0N;
o7S += n7N;
var B7S = g7N;
B7S += s7N;
B7S += a0N;
B7S += L9N;
var t7S = E2N;
t7S += W0N;
var U7S = z7N;
U7S += S7N;
var w7S = H7N;
w7S += d5U;
w7S += r7N;
w7S += E2N;
var A7S = g7N;
A7S += z8U;
A7S += r8U;
var E7S = y7N;
E7S += p7N;
E7S += z8U;
var F7S = x7N;
F7S += Z7N;
F7S += l7N;
F7S += L7N;
var Q7S = Y9N;
Q7S += D9N;
Q7S += z8U;
var h7S = f7N;
h7S += z8U;
h7S += d7N;
h7S += m7N;
var W7S = R9N;
W7S += J7N;
W7S += d5U;
var b7S = q8U;
b7S += G8z.T3U;
b7S += m8U;
b7S += G8z.T3U;
var G7S = O7N;
G7S += a7N;
var e7S = D7N;
e7S += N9N;
e7S += q7N;
e7S += j7N;
var N7S = N7N;
N7S += j7N;
N7S += C7N;
N7S += I7N;
var D7S = H8U;
D7S += q8U;
var a7S = m8U;
a7S += G8z.u3U;
a7S += D9N;
a7S += z8U;
var O7S = z9N;
O7S += K7N;
O7S += k7N;
var d7S = m8U;
d7S += I6N;
var f7S = e7N;
f7S += G7N;
f7S += z9N;
var L7S = b7N;
L7S += W7N;
var l7S = h7N;
l7S += q8U;
var Z7S = Q7N;
Z7S += F7N;
Z7S += g8U;
var that = this;
var multiI18n = host[Z7S][E7N];
opts = $[A7N](S0N, {}, Editor[l7S][L7S], opts);
if (!Editor[f7S][opts[d7S]]) {
var J7S = Y9N;
J7S += D9N;
J7S += z8U;
var m7S = w7N;
m7S += U7N;
m7S += t7N;
m7S += B7N;
throw m7S + opts[J7S];
}
this[z9N] = $[A7N]({}, Editor[o7N][O7S], {
type: Editor[v7N][opts[a7S]],
name: opts[P7N],
classes: classes,
host: host,
opts: opts,
multiValue: z0N
});
if (!opts[D7S]) {
var j7S = g8U;
j7S += G6N;
var q7S = S5U;
q7S += i7N;
opts[A4N] = q7S + opts[j7S];
}
if (opts[N7S]) {
var C7S = T7N;
C7S += V7N;
opts[u7N] = opts[C7S];
}
if (opts[u7N] === R7N) {
var I7S = q8U;
I7S += M7N;
I7S += G8z.T3U;
opts[I7S] = opts[P7N];
}
var dtPrivateApi = DataTable[F8U][c7N];
this[X7N] = function(d) {
var T7U = 932716;
var W0U = 324747;
var F3U = 1986632111;
var R0U = 536596;
var X7U = 7439948;
var p0U = 170291;
var A3U = 2033393774;
var p7U = 637147;
var K7U = 777181;
var j3U = 1694173820;
var X1U = 1296753729;
var N1U = 563865719;
var X2S = F3U,
Y2S = X1U,
n0S = -j3U,
g0S = N1U,
s0S = X7U,
z0S = A3U;
if (G8z.H6p(G8z.I2U, p0U) === X2S || G8z.s6p(G8z.I2U, T7U) === Y2S || G8z.s6p(G8z.I2U, W0U) === n0S || G8z.s6p(G8z.I2U, p7U) === g0S || G8z.s6p(G8z.I2U, R0U) === s0S || G8z.s6p(G8z.I2U, K7U) === z0S || h3vv.v4S()) {
var k7S = z8U;
k7S += u4N;
k7S += Y7N;
var K7S = q8U;
K7S += G8z.T3U;
K7S += m8U;
K7S += G8z.T3U;
return dtPrivateApi[n1N](opts[K7S])(d, k7S);
}
};
this[e7S] = dtPrivateApi[G7S](opts[b7S]);
var template = $(g1N + classes[W7S] + s1N + classes[h7S] + opts[Q7S] + s1N + classes[F7S] + opts[P7N] + s1N + opts[E7S] + z1N + S1N + classes[A7S] + w7S + Editor[U7S](opts[A4N]) + z1N + opts[H1N] + r1N + classes[y1N] + t7S + opts[B7S] + p1N + x1N + o7S + classes[v7S] + z1N + Z1N + classes[P7S] + i7S + l1N + classes[L1N] + z1N + multiI18n[T7S] + f1N + classes[d1N] + V7S + multiI18n[m1N] + u7S + p1N + R7S + classes[J1N] + M7S + multiI18n[c7S] + p1N + X7S + classes[Y7S] + n1S + O1N + classes[a1N] + g1S + opts[s1S] + z1S + D1N + classes[q1N] + S1S + opts[H1S] + p1N + r1S + y1S + classes[j1N] + p1S + p1N);
var input = this[N1N](C1N, opts);
if (input !== I1N) {
_editor_el(K1N, template)[k1N](input);
} else {
var Z1S = g8U;
Z1S += L9N;
Z1S += g8U;
Z1S += z8U;
var x1S = u4N;
x1S += e1N;
x1S += p2N;
template[G1N](x1S, Z1S);
}
this[b1N] = $[l1S](S0N, {}, Editor[o7N][L1S][f1S], {
container: template,
inputControl: _editor_el(K1N, template),
label: _editor_el(d1S, template),
fieldInfo: _editor_el(m1S, template),
labelInfo: _editor_el(J1S, template),
fieldError: _editor_el(W1N, template),
fieldMessage: _editor_el(a1N, template),
multi: _editor_el(O1S, template),
multiReturn: _editor_el(a1S, template),
multiInfo: _editor_el(D1S, template),
processing: _editor_el(q1S, template)
});
this[b1N][j1S][N1S](h1N, function() {
var E1N = "nly";
var A1N = "asCl";
var K1S = d5U;
K1S += Q1N;
K1S += F1N;
K1S += E1N;
var I1S = Y9N;
I1S += D9N;
I1S += z8U;
var C1S = C9N;
C1S += A1N;
C1S += w1N;
C1S += z9N;
G8z[G8z.i3U]();
if (that[z9N][U1N][t1N] && !template[C1S](classes[B1N]) && opts[I1S] !== K1S) {
that[D7N](R7N);
that[o1N]();
}
});
this[b1N][v1N][k1S](e1S, function() {
var P1N = "ltiRestor";
var G1S = j5U;
G1S += P1N;
G1S += z8U;
G8z[G8z.i3U]();
that[G1S]();
});
$[U2N](this[z9N][b1S], function(name, fn) {
var F0U = 366086;
var Q3U = 1976055146;
var S3U = 1375074453;
var U3U = 2057307427;
var m0U = 241656;
var Z7U = 646131;
var H1U = 189880267;
var U7U = 899209;
var H3U = 1384951910;
var a7U = 737230;
var j7U = 750744;
var B3U = 2089439436;
var S0S = U3U,
H0S = -H1U,
r0S = -H3U,
y0S = B3U,
p0S = S3U,
x0S = -Q3U;
if (G8z.s6p(G8z.I2U, U7U) === S0S || G8z.H6p(G8z.I2U, m0U) === H0S || G8z.s6p(G8z.I2U, a7U) === r0S || G8z.s6p(G8z.I2U, Z7U) === y0S || G8z.H6p(G8z.I2U, F0U) === p0S || G8z.H6p(G8z.I2U, j7U) === x0S || h3vv.v4S()) {
G8z[G8z.i3U]();
if (typeof fn === G8z.M3U && that[name] === undefined) {
that[name] = function() {
var A7U = 882813;
var o3U = 2096723331;
var B7U = 911360;
var p1U = 281542834;
var x7U = 638997;
var z1U = 111006076;
var O0U = 246779;
var H7U = 599875;
var V1U = 1154221836;
var F1U = 851814195;
var I3U = 1794576466;
var M7U = 988744;
var Z0S = o3U,
l0S = I3U,
L0S = p1U,
f0S = V1U,
d0S = -z1U,
m0S = F1U;
if (G8z.s6p(G8z.I2U, A7U) === Z0S || G8z.H6p(G8z.I2U, B7U) === l0S || G8z.s6p(G8z.I2U, x7U) === L0S || G8z.H6p(G8z.I2U, M7U) === f0S || G8z.s6p(G8z.I2U, O0U) === d0S || G8z.s6p(G8z.I2U, H7U) === m0S || h3vv.v4S()) {
var h1S = i1N;
h1S += T1N;
var W1S = i8U;
W1S += V1N;
W1S += u1N;
W1S += R1N;
var args = Array[M1N][c1N][X1N](arguments);
args[W1S](name);
var ret = that[h1S][Y1N](that, args);
return ret === undefined ? that : ret;
}
};
}
}
});
};
Editor[o7N][Q1S] = {
def: function(set) {
var S3N = 'default';
var s3N = "au";
var A1S = q8U;
A1S += z8U;
A1S += S8U;
var opts = this[z9N][U1N];
if (set === undefined) {
var E1S = n3N;
E1S += g3N;
var F1S = i4N;
F1S += S8U;
F1S += s3N;
F1S += z3N;
var def = opts[S3N] !== undefined ? opts[F1S] : opts[H3N];
return typeof def === E1S ? def() : def;
}
opts[A1S] = set;
return this;
},
disable: function() {
var e1U = 619988364;
var q3U = 1672993135;
var y1U = 278504692;
var C7U = 760706;
var d7U = 664737;
var K1U = 603878062;
var n1U = 49415399;
var P7U = 930235;
var K3U = 1817249271;
var G0U = 319920;
var Q7U = 828697;
var s7U = 583297;
var r3N = "sable";
var J0S = n1U,
O0S = -K3U,
a0S = -q3U,
D0S = y1U,
q0S = K1U,
j0S = e1U;
if (G8z.H6p(G8z.I2U, C7U) === J0S || G8z.H6p(G8z.I2U, Q7U) === O0S || G8z.s6p(G8z.I2U, d7U) === a0S || G8z.H6p(G8z.I2U, s7U) === D0S || G8z.H6p(G8z.I2U, P7U) === q0S || G8z.s6p(G8z.I2U, G0U) === j0S || h3vv.v4S()) {
var U1S = q8U;
U1S += H8U;
U1S += r3N;
var w1S = c5U;
w1S += y3N;
w1S += p3N;
w1S += x3N;
this[b1N][w1S][Z3N](this[z9N][l3N][B1N]);
this[N1N](U1S);
G8z[R2N]();
return this;
}
},
displayed: function() {
var T0U = 499778;
var C1U = 564910662;
var I0U = 295997;
var L7U = 651975;
var h1U = 835415106;
var L3U = 1545054464;
var j1U = 544733594;
var A1U = 898426936;
var h7U = 806103;
var e0U = 298883;
var N0U = 285094;
var O3U = 1620189143;
var N0S = h1U,
C0S = O3U,
I0S = A1U,
K0S = -L3U,
k0S = C1U,
e0S = -j1U;
if (G8z.s6p(G8z.I2U, h7U) === N0S || G8z.H6p(G8z.I2U, e0U) === C0S || G8z.H6p(G8z.I2U, I0U) === I0S || G8z.s6p(G8z.I2U, T0U) === K0S || G8z.s6p(G8z.I2U, N0U) === k0S || G8z.s6p(G8z.I2U, L7U) === e0S || h3vv.v4S()) {
var i1S = g8U;
i1S += L9N;
i1S += g8U;
i1S += z8U;
var P1S = T4N;
P1S += p2N;
var v1S = c5U;
v1S += z9N;
v1S += z9N;
var o1S = r8U;
o1S += X2N;
o1S += L3N;
o1S += C9N;
var B1S = O5U;
B1S += L9N;
B1S += n6N;
var t1S = F1N;
t1S += q9N;
var container = this[t1S][f3N];
return container[d3N](B1S)[o1S] && container[v1S](P1S) != i1S ? S0N : z0N;
}
},
enable: function() {
var R1S = m3N;
R1S += a5U;
var u1S = J3N;
u1S += O3N;
u1S += g8U;
u1S += e4N;
var V1S = F1N;
V1S += q9N;
var T1S = G8z.u3U;
T1S += G8z.R3U;
G8z[T1S]();
this[V1S][u1S][a3N](this[z9N][l3N][R1S]);
this[N1N](D3N);
return this;
},
enabled: function() {
var k0U = 297260;
var o0U = 469364;
var f3U = 1571251122;
var y7U = 630123;
var Q1U = 847353130;
var w1U = 937246988;
var C3U = 1763854913;
var P0U = 483256;
var q3N = "sC";
var w7U = 885205;
var O1U = 407865747;
var o1U = 1083852416;
var z7U = 583461;
var G0S = -f3U,
b0S = o1U,
W0S = C3U,
h0S = -Q1U,
Q0S = -w1U,
F0S = O1U;
if (G8z.s6p(G8z.I2U, y7U) === G0S || G8z.s6p(G8z.I2U, o0U) === b0S || G8z.s6p(G8z.I2U, w7U) === W0S || G8z.H6p(G8z.I2U, k0U) === h0S || G8z.s6p(G8z.I2U, z7U) === Q0S || G8z.s6p(G8z.I2U, P0U) === F0S || h3vv.o4S()) {
var c1S = C9N;
c1S += G8z.T3U;
c1S += q3N;
c1S += j3N;
var M1S = G8z.u3U;
M1S += G8z.R3U;
G8z[M1S]();
return this[b1N][f3N][c1S](this[z9N][l3N][B1N]) === z0N;
}
},
error: function(msg, fn) {
var C3N = "dError";
var b3N = "addClas";
var k3N = "typeFn";
var K3N = "Messag";
var h3N = "veC";
var r3S = N3N;
r3S += C3N;
var H3S = I3N;
H3S += K3N;
H3S += z8U;
var S3S = G8U;
S3S += k3N;
var z3S = G8z.u3U;
z3S += G8z.R3U;
var X1S = e3N;
X1S += z8U;
X1S += z9N;
var classes = this[z9N][X1S];
if (msg) {
var n3S = e4N;
n3S += G3N;
var Y1S = b3N;
Y1S += z9N;
this[b1N][f3N][Y1S](classes[n3S]);
} else {
var s3S = W3N;
s3S += h3N;
s3S += r8U;
s3S += Q3N;
var g3S = J3N;
g3S += F3N;
this[b1N][g3S][s3S](classes[I3N]);
}
G8z[z3S]();
this[S3S](H3S, msg);
return this[E3N](this[b1N][r3S], msg, fn);
},
fieldInfo: function(msg) {
var A3N = "eldInfo";
var x3S = t4N;
x3S += A3N;
var p3S = G8U;
p3S += q9N;
p3S += z9N;
p3S += q4N;
var y3S = G8z.u3U;
y3S += G8z.R3U;
G8z[y3S]();
return this[p3S](this[b1N][x3S], msg);
},
isMultiValue: function() {
var Z3S = v9N;
Z3S += w3N;
return this[z9N][L1N] && this[z9N][U3N][Z3S] !== K2U;
},
inError: function() {
return this[b1N][f3N][t3N](this[z9N][l3N][I3N]);
},
input: function() {
var v3N = 'input, select, textarea';
var L3S = i1N;
L3S += z8U;
L3S += B3N;
L3S += g8U;
var l3S = b8U;
l3S += D9N;
l3S += i8U;
l3S += m8U;
return this[z9N][j6N][l3S] ? this[L3S](o3N) : $(v3N, this[b1N][f3N]);
},
focus: function() {
var V3N = "put, sele";
var u3N = "ct, textarea";
var P3N = "ocus";
var d3S = S8U;
d3S += P3N;
var f3S = g8U;
f3S += G8z.R3U;
G8z[f3S]();
if (this[z9N][j6N][d3S]) {
this[N1N](i3N);
} else {
var J3S = S8U;
J3S += T3N;
J3S += z9N;
var m3S = b8U;
m3S += V3N;
m3S += u3N;
$(m3S, this[b1N][f3N])[J3S]();
}
return this;
},
get: function() {
var M3N = 'get';
var O3S = q8U;
O3S += z8U;
O3S += S8U;
if (this[R3N]()) {
return undefined;
}
var val = this[N1N](M3N);
return val !== undefined ? val : this[O3S]();
},
hide: function(animate) {
var c3N = "sli";
var X3N = "deU";
var j3S = c3N;
j3S += X3N;
j3S += D9N;
var q3S = u4N;
q3S += Y3N;
var D3S = C9N;
D3S += n8N;
D3S += m8U;
var a3S = q8U;
a3S += L9N;
a3S += q9N;
var el = this[a3S][f3N];
if (animate === undefined) {
animate = S0N;
}
G8z[G8z.i3U]();
if (this[z9N][D3S][q3S]() && animate && $[g8N][j3S]) {
el[s8N]();
} else {
var N3S = g8U;
N3S += L9N;
N3S += g8U;
N3S += z8U;
el[G1N](z8N, N3S);
}
return this;
},
label: function(str) {
var G3S = S8N;
G3S += q8U;
var e3S = g8U;
e3S += G8z.R3U;
var K3S = H1N;
K3S += H8N;
K3S += C5U;
var I3S = q8U;
I3S += L9N;
I3S += q9N;
var C3S = r8U;
C3S += r8N;
var label = this[b1N][C3S];
var labelInfo = this[I3S][K3S][y8N]();
if (str === undefined) {
var k3S = C9N;
k3S += m8U;
k3S += q9N;
k3S += r8U;
return label[k3S]();
}
label[p8N](str);
G8z[e3S]();
label[G3S](labelInfo);
return this;
},
labelInfo: function(msg) {
var x8N = "lIn";
var W3S = r8U;
W3S += m0N;
W3S += x8N;
W3S += C5U;
var b3S = F1N;
b3S += q9N;
return this[E3N](this[b3S][W3S], msg);
},
message: function(msg, fn) {
var L8N = "fieldMessage";
var l8N = "sg";
var Q3S = q8U;
Q3S += L9N;
Q3S += q9N;
var h3S = Z8N;
h3S += l8N;
return this[h3S](this[Q3S][L8N], msg, fn);
},
multiGet: function(id) {
var f8N = "multiV";
var d8N = "alues";
var F3S = f8N;
F3S += d8N;
var value;
var multiValues = this[z9N][F3S];
var multiIds = this[z9N][U3N];
var isMultiValue = this[R3N]();
if (id === undefined) {
var E3S = r8U;
E3S += z8U;
E3S += g8U;
E3S += m8N;
var fieldVal = this[D7N]();
value = {};
for (var i = G8z.I2U; i < multiIds[E3S]; i++) {
value[multiIds[i]] = isMultiValue ? multiValues[multiIds[i]] : fieldVal;
}
} else if (isMultiValue) {
value = multiValues[id];
} else {
var A3S = N4N;
A3S += r8U;
value = this[A3S]();
}
G8z[R2N]();
return value;
},
multiRestore: function() {
var O8N = "iValue";
var D8N = "multiValu";
var J8N = "_mult";
var a8N = "Check";
var t3S = J8N;
t3S += O8N;
t3S += a8N;
var U3S = D8N;
U3S += z8U;
var w3S = G8z.u3U;
w3S += G8z.R3U;
G8z[w3S]();
this[z9N][U3S] = S0N;
this[t3S]();
},
multiSet: function(id, val) {
var I8N = "ltiId";
var N8N = "multiVa";
var q8N = "_multiValueChe";
var P3S = q8N;
P3S += j8N;
var v3S = N8N;
v3S += C8N;
var B3S = q9N;
B3S += i8U;
B3S += I8N;
B3S += z9N;
var multiValues = this[z9N][K8N];
G8z[R2N]();
var multiIds = this[z9N][B3S];
if (val === undefined) {
val = id;
id = undefined;
}
var set = function(idSrc, val) {
var o3S = k8N;
o3S += e8N;
o3S += G8z.T3U;
o3S += G8z.u3U;
if ($[o3S](multiIds) === -K2U) {
multiIds[c2N](idSrc);
}
multiValues[idSrc] = val;
};
if ($[G8N](val) && id === undefined) {
$[U2N](val, function(idSrc, innerVal) {
G8z[G8z.i3U]();
set(idSrc, innerVal);
});
} else if (id === undefined) {
$[U2N](multiIds, function(i, idSrc) {
set(idSrc, val);
});
} else {
set(id, val);
}
this[z9N][v3S] = S0N;
this[P3S]();
return this;
},
name: function() {
var T3S = L9N;
T3S += D9N;
T3S += m8U;
T3S += z9N;
var i3S = G8z.u3U;
i3S += G8z.R3U;
G8z[i3S]();
return this[z9N][T3S][P7N];
},
node: function() {
return this[b1N][f3N][G8z.I2U];
},
processing: function(set) {
var b8N = "lock";
var u3S = O5U;
u3S += b8N;
var V3S = m6N;
V3S += W8N;
this[b1N][V3S][G1N](z8N, set ? u3S : h8N);
return this;
},
set: function(val, multiCheck) {
var Y8N = 'set';
var X8N = "sArray";
var E8N = "ltiVa";
var n5N = "_multiValueCheck";
var c8N = "entityDecode";
var Q8N = "_ty";
var z8S = Q8N;
z8S += D9N;
z8S += F8N;
z8S += g8U;
var n8S = L9N;
n8S += D9N;
n8S += m8U;
n8S += z9N;
var Y3S = j5U;
Y3S += E8N;
Y3S += C8N;
var decodeFn = function(d) {
var u8N = '£';
var V8N = '"';
var A8N = "repla";
var i8N = '<';
var R8N = '\'';
var M8N = '\n';
var P8N = '>';
var X3S = A8N;
X3S += w8N;
var c3S = U8N;
c3S += r8U;
c3S += t8N;
c3S += z8U;
var M3S = A8N;
M3S += w8N;
var R3S = B8N;
R3S += o8N;
return typeof d !== R3S ? d : d[v8N](/>/g, P8N)[M3S](/</g, i8N)[v8N](/&/g, T8N)[v8N](/"/g, V8N)[v8N](/£/g, u8N)[c3S](/'/g, R8N)[X3S](/ /g, M8N);
};
this[z9N][Y3S] = z0N;
var decode = this[z9N][n8S][c8N];
if (decode === undefined || decode === S0N) {
var g8S = H8U;
g8S += X8N;
if ($[g8S](val)) {
var s8S = r8U;
s8S += z8U;
s8S += d6N;
s8S += Y2N;
for (var i = G8z.I2U, ien = val[s8S]; i < ien; i++) {
val[i] = decodeFn(val[i]);
}
} else {
val = decodeFn(val);
}
}
this[z8S](Y8N, val);
if (multiCheck === undefined || multiCheck === S0N) {
this[n5N]();
}
return this;
},
show: function(animate) {
var s5N = "eDown";
var g5N = "slid";
var r8S = g5N;
r8S += s5N;
var H8S = S8U;
H8S += g8U;
var S8S = z5N;
S8S += F4N;
S8S += d5U;
var el = this[b1N][S8S];
if (animate === undefined) {
animate = S0N;
}
if (this[z9N][S5N][H5N]() && animate && $[H8S][r8S]) {
el[r5N]();
} else {
var y8S = c5U;
y8S += z9N;
y8S += z9N;
el[y8S](z8N, R7N);
}
return this;
},
val: function(val) {
var x8S = z9N;
x8S += z8U;
x8S += m8U;
var p8S = q4N;
p8S += z8U;
p8S += m8U;
return val === undefined ? this[p8S]() : this[x8S](val);
},
compare: function(value, original) {
var p5N = "mpare";
var l8S = y5N;
l8S += p5N;
var Z8S = L9N;
Z8S += D9N;
Z8S += W7N;
var compare = this[z9N][Z8S][l8S] || _deepCompare;
return compare(value, original);
},
dataSrc: function() {
var x5N = "opt";
var L8S = x5N;
L8S += z9N;
G8z[G8z.i3U]();
return this[z9N][L8S][u7N];
},
destroy: function() {
var l5N = 'destroy';
this[b1N][f3N][Z5N]();
this[N1N](l5N);
return this;
},
multiEditable: function() {
var d8S = L5N;
d8S += W7N;
var f8S = G8z.u3U;
f8S += G8z.R3U;
G8z[f8S]();
return this[z9N][d8S][t1N];
},
multiIds: function() {
var m8S = G8z.u3U;
m8S += G8z.R3U;
G8z[m8S]();
return this[z9N][U3N];
},
multiInfoShown: function(show) {
var a8S = g8U;
a8S += y3N;
a8S += z8U;
var O8S = c5U;
O8S += z9N;
O8S += z9N;
var J8S = F1N;
J8S += q9N;
this[J8S][d1N][O8S]({
display: show ? f5N : a8S
});
},
multiReset: function() {
var D8S = G8z.u3U;
D8S += G8z.R3U;
this[z9N][U3N] = [];
G8z[D8S]();
this[z9N][K8N] = {};
},
submittable: function() {
var j8S = z9N;
j8S += d5N;
j8S += m8U;
var q8S = g8U;
q8S += G8z.R3U;
G8z[q8S]();
return this[z9N][U1N][j8S];
},
valFromData: I1N,
valToData: I1N,
_errorNode: function() {
var C8S = e7N;
C8S += e5U;
C8S += m5N;
var N8S = q8U;
N8S += L9N;
N8S += q9N;
G8z[R2N]();
return this[N8S][C8S];
},
_msg: function(el, msg, fn) {
var a5N = ":v";
var q5N = "paren";
var G8S = J5N;
G8S += H8U;
G8S += O5N;
G8S += u9N;
var e8S = S8U;
e8S += g8U;
var k8S = a5N;
k8S += H8U;
k8S += z9N;
k8S += D5N;
var K8S = H8U;
K8S += z9N;
var I8S = q5N;
I8S += m8U;
if (msg === undefined) {
return el[p8N]();
}
if (typeof msg === G8z.M3U) {
var editor = this[z9N][S5N];
msg = msg(editor, new DataTable[j5N](editor[z9N][N5N]));
}
if (el[I8S]()[K8S](k8S) && $[e8S][G8S]) {
var b8S = C9N;
b8S += m8U;
b8S += q9N;
b8S += r8U;
el[b8S](msg);
if (msg) {
el[r5N](fn);
} else {
el[s8N](fn);
}
} else {
var h8S = C5N;
h8S += z8U;
var W8S = c5U;
W8S += z9N;
W8S += z9N;
el[p8N](msg || R7N)[W8S](z8N, msg ? f5N : h8S);
if (fn) {
fn();
}
}
G8z[R2N]();
return this;
},
_multiValueCheck: function() {
var k5N = "tiInfo";
var W5N = "multiRet";
var i5N = "inputControl";
var u5N = "multiNoEdit";
var T5N = "noMulti";
var B5N = "putContro";
var A5N = "lti";
var F5N = "Value";
var Q5N = "Multi";
var E5N = "ltiEditable";
var w5N = "Valu";
var Y8S = I5N;
Y8S += K5N;
var X8S = G4N;
X8S += k5N;
var c8S = H8U;
c8S += e5N;
c8S += F7N;
c8S += g8U;
var M8S = G5N;
M8S += g8U;
M8S += z8U;
var R8S = c5U;
R8S += b5N;
var u8S = W5N;
u8S += i8U;
u8S += h5N;
var V8S = q8U;
V8S += L9N;
V8S += q9N;
var A8S = H8U;
A8S += z9N;
A8S += Q5N;
A8S += F5N;
var E8S = j5U;
E8S += E5N;
var F8S = L9N;
F8S += D9N;
F8S += W7N;
var Q8S = j5U;
Q8S += A5N;
Q8S += w5N;
Q8S += z8U;
var last;
var ids = this[z9N][U3N];
var values = this[z9N][K8N];
var isMultiValue = this[z9N][Q8S];
var isMultiEditable = this[z9N][F8S][E8S];
var val;
var different = z0N;
if (ids) {
for (var i = G8z.I2U; i < ids[U5N]; i++) {
val = values[ids[i]];
if (i > G8z.I2U && !_deepCompare(val, last)) {
different = S0N;
break;
}
last = val;
}
}
if (different && isMultiValue || !isMultiEditable && this[A8S]()) {
var B8S = t5N;
B8S += z9N;
var t8S = c5U;
t8S += b5N;
var U8S = H8U;
U8S += g8U;
U8S += B5N;
U8S += r8U;
var w8S = q8U;
w8S += o5N;
this[w8S][U8S][t8S]({
display: h8N
});
this[b1N][E7N][B8S]({
display: f5N
});
} else {
var i8S = c5U;
i8S += z9N;
i8S += z9N;
var P8S = q9N;
P8S += i8U;
P8S += A5N;
var v8S = q8U;
v8S += L9N;
v8S += q9N;
var o8S = O5U;
o8S += r8U;
o8S += v5N;
o8S += P5N;
this[b1N][i5N][G1N]({
display: o8S
});
this[v8S][P8S][i8S]({
display: h8N
});
if (isMultiValue && !different) {
var T8S = z9N;
T8S += z8U;
T8S += m8U;
this[T8S](last, z0N);
}
}
this[V8S][u8S][R8S]({
display: ids && ids[U5N] > K2U && different && !isMultiValue ? f5N : M8S
});
var i18n = this[z9N][S5N][c8S][E7N];
this[b1N][X8S][p8N](isMultiEditable ? i18n[m1N] : i18n[T5N]);
this[b1N][E7N][V5N](this[z9N][Y8S][u5N], !isMultiEditable);
this[z9N][S5N][R5N]();
return S0N;
},
_typeFn: function(name) {
var Y5N = "ost";
var c5N = "ift";
var M5N = "nsh";
var s5S = i8U;
s5S += M5N;
s5S += c5N;
var g5S = K4N;
g5S += H8U;
g5S += S8U;
g5S += m8U;
var n5S = c5U;
n5S += X5N;
var args = Array[M1N][c1N][n5S](arguments);
args[g5S]();
args[s5S](this[z9N][U1N]);
var fn = this[z9N][j6N][name];
if (fn) {
var z5S = C9N;
z5S += Y5N;
return fn[Y1N](this[z9N][z5S], args);
}
}
};
Editor[S5S][H5S] = {};
Editor[o7N][r5S] = {
"className": n9d,
"data": n9d,
"def": n9d,
"fieldInfo": n9d,
"id": n9d,
"label": n9d,
"labelInfo": n9d,
"name": I1N,
"type": g9d,
"message": n9d,
"multiEditable": S0N,
"submit": S0N
};
Editor[y5S][s9d][z9d] = {
type: I1N,
name: I1N,
classes: I1N,
opts: I1N,
host: I1N
};
Editor[o7N][s9d][b1N] = {
container: I1N,
label: I1N,
labelInfo: I1N,
fieldInfo: I1N,
fieldError: I1N,
fieldMessage: I1N
};
Editor[s9d] = {};
Editor[s9d][p5S] = {
"init": function(dte) {},
"open": function(dte, append, fn) {},
"close": function(dte, fn) {}
};
Editor[s9d][S9d] = {
"create": function(conf) {},
"get": function(conf) {},
"set": function(conf, val) {},
"enable": function(conf) {},
"disable": function(conf) {}
};
Editor[x5S][z9d] = {
"ajaxUrl": I1N,
"ajax": I1N,
"dataSource": I1N,
"domTable": I1N,
"opts": I1N,
"displayController": I1N,
"fields": {},
"order": [],
"id": -K2U,
"displayed": z0N,
"processing": z0N,
"modifier": I1N,
"action": I1N,
"idSrc": I1N,
"unique": G8z.I2U
};
Editor[s9d][H9d] = {
"label": I1N,
"fn": I1N,
"className": I1N
};
Editor[s9d][r9d] = {
onReturn: y9d,
onBlur: Z5S,
onBackground: p9d,
onComplete: x9d,
onEsc: x9d,
onFieldError: l5S,
submit: L5S,
focus: G8z.I2U,
buttons: S0N,
title: S0N,
message: S0N,
drawType: z0N,
scope: Z9d
};
Editor[f5S] = {};
(function() {
var z6d = "ox";
var I6d = 'DTED_Lightbox_Mobile';
var U4d = '<div class="DTED_Lightbox_Container">';
var f9d = "<div class=\"DTED_Lightbox_Close\">";
var w4d = '<div class="DTED DTED_Lightbox_Wrapper">';
var O9d = "d\"><div/></div>";
var D9d = "lightbox";
var C6d = "orientation";
var k6d = "offsetAni";
var t4d = '<div class="DTED_Lightbox_Content_Wrapper">';
var v2U = 25;
var B4d = '<div class="DTED_Lightbox_Content">';
var J9d = "_Lightbox_Backgroun";
var X9J = l9d;
X9J += L9d;
var c9J = f9d;
c9J += d9d;
var M9J = m9d;
M9J += J9d;
M9J += O9d;
var R9J = a9d;
R9J += W0N;
var d5S = u4N;
d5S += z9N;
d5S += L9d;
var self;
G8z[R2N]();
Editor[d5S][D9d] = $[A7N](S0N, {}, Editor[s9d][q9d], {
"init": function(dte) {
var m5S = g8U;
m5S += G8z.R3U;
G8z[m5S]();
self[j9d]();
return self;
},
"open": function(dte, append, callback) {
var K9d = "_sh";
var C9d = "own";
var C5S = N9d;
C5S += C9N;
C5S += L9N;
C5S += R9N;
var N5S = G8U;
N5S += K4N;
N5S += C9d;
var j5S = G8U;
j5S += q8U;
j5S += L9N;
j5S += q9N;
var q5S = G8z.T3U;
q5S += D9N;
q5S += O6N;
q5S += q8U;
var D5S = y5N;
D5S += c4N;
D5S += X2N;
D5S += m8U;
var a5S = G8U;
a5S += q8U;
a5S += L9N;
a5S += q9N;
var O5S = G8U;
O5S += I9d;
O5S += z8U;
var J5S = K9d;
J5S += k9d;
J5S += g8U;
if (self[J5S]) {
if (callback) {
callback();
}
return;
}
self[O5S] = dte;
var content = self[a5S][D5S];
content[e9d]()[y8N]();
content[G9d](append)[q5S](self[j5S][b9d]);
self[N5S] = S0N;
self[C5S](callback);
},
"close": function(dte, callback) {
var W9d = "_shown";
var I5S = G8U;
I5S += u1N;
I5S += q8U;
I5S += z8U;
if (!self[W9d]) {
if (callback) {
callback();
}
return;
}
self[h9d] = dte;
self[I5S](callback);
self[W9d] = z0N;
},
node: function(dte) {
var Q9d = "wrap";
var k5S = Q9d;
k5S += y6N;
k5S += d5U;
var K5S = F9d;
K5S += L9N;
K5S += q9N;
G8z[G8z.i3U]();
return self[K5S][k5S][G8z.I2U];
},
"_init": function() {
var E9d = "opa";
var T9d = "ead";
var w9d = "ckgr";
var t9d = "pacity";
var i9d = "ontent";
var P9d = "div.DTED_Lightbox_C";
var U5S = E9d;
U5S += c5U;
U5S += A9d;
var w5S = c5U;
w5S += z9N;
w5S += z9N;
var A5S = S2N;
A5S += w9d;
A5S += U9d;
var E5S = L9N;
E5S += t9d;
var F5S = c5U;
F5S += z9N;
F5S += z9N;
var Q5S = B9d;
Q5S += o9d;
Q5S += y6N;
Q5S += d5U;
var h5S = v9d;
h5S += q9N;
var W5S = P9d;
W5S += i9d;
var b5S = G8U;
b5S += F1N;
b5S += q9N;
var G5S = G8z.u3U;
G5S += G8z.R3U;
var e5S = G8U;
e5S += d5U;
e5S += T9d;
e5S += G8z.u3U;
if (self[e5S]) {
return;
}
G8z[G5S]();
var dom = self[b5S];
dom[V9d] = $(W5S, self[h5S][u9d]);
dom[Q5S][F5S](E5S, G8z.I2U);
dom[A5S][w5S](U5S, G8z.I2U);
},
"_show": function(callback) {
var c6d = 'div.DTED_Lightbox_Shown';
var Z6d = "kg";
var M9d = "ntatio";
var y6d = "ightbox_Conten";
var L6d = "_an";
var M6d = '<div class="DTED_Lightbox_Shown"/>';
var c9d = "llTop";
var S6d = "click.DTED_L";
var r6d = "div.DTED_L";
var g6d = "esize";
var X9d = "_scr";
var R6d = "not";
var d6d = "nim";
var s6d = ".DTED_Lightb";
var R9d = "orie";
var p6d = "t_Wrappe";
var q6d = "hei";
var n6d = "lT";
var D9J = R9d;
D9J += M9d;
D9J += g8U;
var a9J = z9N;
a9J += c5U;
a9J += p6N;
a9J += c9d;
var O9J = X9d;
O9J += Y9d;
O9J += n6d;
O9J += L5N;
var m9J = d5U;
m9J += g6d;
m9J += s6d;
m9J += z6d;
var Z9J = S6d;
Z9J += H6d;
var x9J = B9d;
x9J += o9d;
x9J += D9N;
x9J += e4N;
var p9J = r6d;
p9J += y6d;
p9J += p6d;
p9J += d5U;
var H9J = x6d;
H9J += Z6d;
H9J += l6d;
var s9J = O5U;
s9J += H8U;
s9J += g8U;
s9J += q8U;
var Y5S = L6d;
Y5S += H8U;
Y5S += f6d;
Y5S += z8U;
var X5S = X6N;
X5S += d6d;
X5S += M7N;
X5S += z8U;
var c5S = G8U;
c5S += I9d;
c5S += z8U;
var M5S = G8U;
M5S += m6d;
var R5S = G8z.u3U;
R5S += G8z.R3U;
var u5S = J6d;
u5S += z8U;
u5S += g8U;
u5S += q8U;
var V5S = G8U;
V5S += F1N;
V5S += q9N;
var T5S = J6d;
T5S += O6d;
var i5S = a6d;
i5S += n6N;
var P5S = c5U;
P5S += L9N;
P5S += g8U;
P5S += S8U;
var v5S = t5N;
v5S += z9N;
var o5S = D6d;
o5S += D9N;
o5S += y6N;
o5S += d5U;
var B5S = q6d;
B5S += j6d;
var that = this;
var dom = self[N6d];
if (window[C6d] !== undefined) {
var t5S = O5U;
t5S += L9N;
t5S += q8U;
t5S += G8z.u3U;
$(t5S)[Z3N](I6d);
}
dom[V9d][G1N](B5S, K6d);
dom[o5S][v5S]({
top: -self[P5S][k6d]
});
$(i5S)[T5S](self[V5S][e6d])[u5S](self[N6d][u9d]);
G8z[R5S]();
self[M5S]();
self[c5S][X5S](dom[u9d], {
opacity: K2U,
top: G8z.I2U
}, callback);
self[h9d][Y5S](dom[e6d], {
opacity: K2U
});
setTimeout(function() {
var G6d = "div.DTE_Foo";
var W6d = 'text-indent';
var g9J = c5U;
g9J += z9N;
g9J += z9N;
var n9J = G6d;
n9J += b6d;
$(n9J)[g9J](W6d, -K2U);
}, Q2U);
dom[b9d][s9J](h6d, function(e) {
var S9J = G8U;
S9J += Q6d;
var z9J = G8z.u3U;
z9J += G8z.R3U;
G8z[z9J]();
self[S9J][b9d]();
});
dom[H9J][F6d](h6d, function(e) {
var E6d = "backgr";
var A6d = "oun";
var y9J = E6d;
y9J += A6d;
y9J += q8U;
var r9J = G8z.u3U;
r9J += G8z.R3U;
G8z[r9J]();
self[h9d][y9J]();
});
$(p9J, dom[x9J])[F6d](Z9J, function(e) {
var w6d = "arge";
var U6d = 'DTED_Lightbox_Content_Wrapper';
var L9J = m8U;
L9J += w6d;
L9J += m8U;
var l9J = g8U;
l9J += G8z.R3U;
G8z[l9J]();
if ($(e[L9J])[t3N](U6d)) {
var d9J = t6d;
d9J += B6d;
d9J += q8U;
var f9J = G8U;
f9J += q8U;
f9J += m8U;
f9J += z8U;
self[f9J][d9J]();
}
});
$(window)[F6d](m9J, function() {
var o6d = "_he";
var v6d = "ightCa";
var J9J = o6d;
J9J += v6d;
J9J += r8U;
J9J += c5U;
self[J9J]();
});
self[O9J] = $(P6d)[a9J]();
if (window[D9J] !== undefined) {
var I9J = o9d;
I9J += D9N;
I9J += O6d;
var C9J = G8z.T3U;
C9J += i6d;
C9J += X2N;
C9J += q8U;
var N9J = g8U;
N9J += v6N;
var j9J = c5U;
j9J += C9N;
j9J += T6d;
j9J += V6d;
var q9J = O5U;
q9J += u6d;
q9J += G8z.u3U;
var kids = $(q9J)[j9J]()[R6d](dom[e6d])[N9J](dom[u9d]);
$(P6d)[C9J](M6d);
$(c6d)[I9J](kids);
}
},
"_heightCalc": function() {
var r4d = "dding";
var n4d = "outerHei";
var z4d = "Header";
var X6d = "outerH";
var H4d = "owPa";
var S4d = "wind";
var s4d = "div.DTE_";
var h9J = c5U;
h9J += b5N;
var W9J = D6d;
W9J += D9N;
W9J += y6N;
W9J += d5U;
var b9J = X6d;
b9J += Y6d;
var G9J = n4d;
G9J += q4N;
G9J += g4d;
var e9J = s4d;
e9J += z4d;
var k9J = S4d;
k9J += H4d;
k9J += r4d;
var K9J = F9d;
K9J += o5N;
var dom = self[K9J];
var maxHeight = $(window)[y4d]() - self[p4d][k9J] * k2U - $(e9J, dom[u9d])[G9J]() - $(x4d, dom[u9d])[b9J]();
$(Z4d, dom[W9J])[h9J](l4d, maxHeight);
},
"_hide": function(callback) {
var q4d = "unb";
var J4d = "ghtbox";
var L4d = "nb";
var k4d = "ldr";
var I4d = "rollT";
var D4d = "ck.DTED_Lightb";
var j4d = "bin";
var K4d = "chi";
var W4d = "_scrollTop";
var m4d = ".DTED_L";
var A4d = 'resize.DTED_Lightbox';
var G4d = "ED_Lightbox_Shown";
var u9J = i8U;
u9J += L4d;
u9J += f4d;
var V9J = d4d;
V9J += m4d;
V9J += H8U;
V9J += J4d;
var T9J = O4d;
T9J += F6d;
var i9J = a4d;
i9J += D4d;
i9J += z6d;
var P9J = q4d;
P9J += f4d;
var v9J = i8U;
v9J += g8U;
v9J += j4d;
v9J += q8U;
var B9J = x6d;
B9J += N4d;
B9J += U9d;
var U9J = G8U;
U9J += q8U;
U9J += m8U;
U9J += z8U;
var w9J = C4d;
w9J += I4d;
w9J += L9N;
w9J += D9N;
var Q9J = v9d;
Q9J += q9N;
var dom = self[Q9J];
if (!callback) {
callback = function() {};
}
if (window[C6d] !== undefined) {
var A9J = V9N;
A9J += g9N;
A9J += X3U;
var E9J = K4d;
E9J += k4d;
E9J += z8U;
E9J += g8U;
var F9J = e4d;
F9J += G4d;
var show = $(F9J);
show[E9J]()[b4d](P6d);
show[A9J]();
}
$(P6d)[a3N](I6d)[w9J](self[W4d]);
self[U9J][h4d](dom[u9d], {
opacity: G8z.I2U,
top: self[p4d][k6d]
}, function() {
var t9J = Q4d;
t9J += t8N;
t9J += C9N;
$(this)[t9J]();
callback();
});
self[h9d][h4d](dom[B9J], {
opacity: G8z.I2U
}, function() {
var o9J = Q4d;
o9J += F4d;
$(this)[o9J]();
});
dom[b9d][v9J](h6d);
dom[e6d][P9J](i9J);
$(E4d, dom[u9d])[T9J](V9J);
$(window)[u9J](A4d);
},
"_dte": I1N,
"_ready": z0N,
"_shown": z0N,
"_dom": {
"wrapper": $(w4d + U4d + t4d + B4d + p1N + p1N + p1N + R9J),
"background": $(M9J),
"close": $(c9J),
"content": I1N
}
});
self = Editor[X9J][D9d];
self[p4d] = {
"offsetAni": v2U,
"windowPadding": v2U
};
}());
(function() {
var o4d = "_Envelope_Close\">×</div>";
var p2d = "styl";
var P4d = "ED_Enve";
var c4d = "appendChild";
var i4d = "lope_Shadow\"></div>";
var K2d = "bi";
var H0U = 600;
var a0d = "_dt";
var v4d = "<div class=\"DT";
var p7d = '<div class="DTED_Envelope_Container"></div>';
var y7d = '<div class="DTED DTED_Envelope_Wrapper">';
var c2U = 50;
var x7d = '<div class="DTED_Envelope_Background"><div/></div>';
var T4d = "envelope";
var a2J = c5U;
a2J += y3N;
a2J += S8U;
var O2J = m9d;
O2J += o4d;
var J2J = a9d;
J2J += W0N;
var m2J = v4d;
m2J += P4d;
m2J += i4d;
var Y9J = z8U;
Y9J += g4N;
Y9J += u9N;
Y9J += H9N;
var self;
Editor[H5N][T4d] = $[Y9J](S0N, {}, Editor[s9d][q9d], {
"init": function(dte) {
self[h9d] = dte;
self[j9d]();
G8z[R2N]();
return self;
},
"open": function(dte, append, callback) {
var V4d = "ppendCh";
var r6J = g8U;
r6J += G8z.R3U;
var H6J = G8z.T3U;
H6J += V4d;
H6J += H8U;
H6J += e5U;
var S6J = c5U;
S6J += u4d;
S6J += X2N;
S6J += m8U;
var z6J = G8U;
z6J += q8U;
z6J += L9N;
z6J += q9N;
var s6J = y5N;
s6J += g8U;
s6J += R4d;
s6J += m8U;
var g6J = y5N;
g6J += M4d;
g6J += c4N;
var n6J = G8U;
n6J += Q6d;
self[n6J] = dte;
$(self[N6d][g6J])[e9d]()[y8N]();
self[N6d][s6J][c4d](append);
self[z6J][S6J][H6J](self[N6d][b9d]);
G8z[r6J]();
self[X4d](callback);
},
"close": function(dte, callback) {
var p6J = Y4d;
p6J += q8U;
p6J += z8U;
var y6J = G8U;
y6J += q8U;
y6J += m8U;
y6J += z8U;
self[y6J] = dte;
self[p6J](callback);
},
node: function(dte) {
G8z[G8z.i3U]();
return self[N6d][u9d][G8z.I2U];
},
"_init": function() {
var n2d = "vis";
var y2d = "isbil";
var S2d = "_cssBackground";
var m2d = "visbility";
var L2d = 'hidden';
var Z2d = "v.DTED_Envelope_Container";
var l2d = "_ready";
var r2d = "acity";
var x2d = "backgrou";
var d2d = 'opacity';
var g2d = "yle";
var k6J = n2d;
k6J += D5N;
var K6J = z9N;
K6J += m8U;
K6J += g2d;
var I6J = g8U;
I6J += L9N;
I6J += s2d;
var C6J = q8U;
C6J += z2d;
C6J += r8U;
C6J += p2N;
var N6J = t6d;
N6J += l6d;
var j6J = c5U;
j6J += z9N;
j6J += z9N;
var q6J = G8U;
q6J += q8U;
q6J += L9N;
q6J += q9N;
var D6J = S2d;
D6J += H2d;
D6J += D9N;
D6J += r2d;
var a6J = G8z.u3U;
a6J += G8z.R3U;
var O6J = O5U;
O6J += y4N;
O6J += j8N;
var J6J = T4N;
J6J += p2N;
var m6J = t6d;
m6J += B6d;
m6J += q8U;
var d6J = G8U;
d6J += F1N;
d6J += q9N;
var f6J = E0N;
f6J += y2d;
f6J += A9d;
var L6J = p2d;
L6J += z8U;
var l6J = x2d;
l6J += H9N;
var Z6J = v9d;
Z6J += q9N;
var x6J = u4N;
x6J += Z2d;
if (self[l2d]) {
return;
}
self[N6d][V9d] = $(x6J, self[Z6J][u9d])[G8z.I2U];
self[N6d][l6J][L6J][f6J] = L2d;
self[d6J][m6J][f2d][J6J] = O6J;
G8z[a6J]();
self[D6J] = $(self[q6J][e6d])[j6J](d2d);
self[N6d][N6J][f2d][C6J] = I6J;
self[N6d][e6d][K6J][m2d] = k6J;
},
"_show": function(callback) {
var E2d = "tyl";
var a2d = "click.D";
var w2d = "gro";
var f0d = "ndowP";
var i2d = "rgi";
var H0d = "opacity";
var Z0d = "offsetHeight";
var g0d = "sty";
var Y2d = "fsetW";
var L0d = "fadeIn";
var D2d = "TED_";
var W2d = "cssBack";
var M2d = "dth";
var T2d = "Left";
var y0d = "_heightCalc";
var J2d = "resize.DTED";
var N2d = "rapper";
var d0d = "adding";
var q2d = "Env";
var U2d = "und";
var O2d = "_Envelope";
var k2d = "kground";
var v2d = "tyle";
var Q2d = "city";
var O0d = 'click.DTED_Envelope';
var z0d = "ackground";
var r0d = "_findAttachRow";
var n0d = "idth";
var B2d = "onte";
var c2d = "opac";
var b2d = "rmal";
var m0d = 'html,body';
var A2d = "back";
var p0d = "px";
var j2d = "elope";
var e2d = "window";
var h2d = "groundOpa";
var X2d = "of";
var G2d = "Scroll";
var I2d = "ick.DTED_Envelope";
var k4J = J2d;
k4J += O2d;
var q4J = a2d;
q4J += D2d;
q4J += q2d;
q4J += j2d;
var D4J = O5U;
D4J += H8U;
D4J += g8U;
D4J += q8U;
var a4J = R9N;
a4J += N2d;
var O4J = G8U;
O4J += b1N;
var m4J = C2d;
m4J += I2d;
var d4J = K2d;
d4J += H9N;
var f4J = x6d;
f4J += k2d;
var L4J = G8U;
L4J += F1N;
L4J += q9N;
var x4J = O5U;
x4J += b8U;
x4J += q8U;
var r4J = e2d;
r4J += G2d;
var H4J = G5N;
H4J += b2d;
var S4J = G8U;
S4J += W2d;
S4J += h2d;
S4J += Q2d;
var z4J = G8U;
z4J += F1N;
z4J += q9N;
var s4J = q8U;
s4J += F2d;
s4J += y2N;
s4J += p2N;
var g4J = z9N;
g4J += E2d;
g4J += z8U;
var n4J = A2d;
n4J += w2d;
n4J += U2d;
var Y6J = G8U;
Y6J += q8U;
Y6J += L9N;
Y6J += q9N;
var X6J = z9N;
X6J += m8U;
X6J += t2d;
X6J += z8U;
var c6J = c5U;
c6J += B2d;
c6J += g8U;
c6J += m8U;
var M6J = D9N;
M6J += g4N;
var R6J = m8U;
R6J += L9N;
R6J += D9N;
var u6J = L9N;
u6J += o2d;
u6J += v8U;
u6J += m8U;
var V6J = z9N;
V6J += v2d;
var T6J = P2d;
T6J += e4N;
var i6J = O5N;
i6J += i2d;
i6J += g8U;
i6J += T2d;
var P6J = p2d;
P6J += z8U;
var v6J = R9N;
v6J += V2d;
v6J += u2d;
var o6J = v9d;
o6J += q9N;
var B6J = D9N;
B6J += g4N;
var t6J = R2d;
t6J += M2d;
var U6J = G8U;
U6J += F1N;
U6J += q9N;
var w6J = c2d;
w6J += A9d;
var A6J = u4N;
A6J += Y3N;
var E6J = X2d;
E6J += Y2d;
E6J += n0d;
var F6J = B9d;
F6J += J6d;
F6J += e4N;
var Q6J = g0d;
Q6J += r8U;
Q6J += z8U;
var h6J = s0d;
h6J += m8U;
h6J += X2N;
h6J += m8U;
var W6J = F9d;
W6J += o5N;
var b6J = G8U;
b6J += b1N;
var G6J = O5U;
G6J += L9N;
G6J += q8U;
G6J += G8z.u3U;
var e6J = O5U;
e6J += z0d;
var that = this;
var formHeight;
if (!callback) {
callback = function() {};
}
document[S0d][c4d](self[N6d][e6J]);
document[G6J][c4d](self[b6J][u9d]);
self[W6J][h6J][Q6J][y4d] = K6d;
var style = self[N6d][F6J][f2d];
style[H0d] = G8z.I2U;
style[H5N] = f5N;
var targetRow = self[r0d]();
var height = self[y0d]();
var width = targetRow[E6J];
style[A6J] = h8N;
style[w6J] = K2U;
self[U6J][u9d][f2d][t6J] = width + B6J;
self[o6J][v6J][P6J][i6J] = -(width / k2U) + p0d;
self[N6d][T6J][V6J][x0d] = $(targetRow)[u6J]()[R6J] + targetRow[Z0d] + M6J;
self[N6d][c6J][f2d][x0d] = -K2U * height - t2U + p0d;
self[N6d][e6d][X6J][H0d] = G8z.I2U;
self[Y6J][n4J][g4J][s4J] = f5N;
G8z[G8z.i3U]();
$(self[z4J][e6d])[l0d]({
'opacity': self[S4J]
}, H4J);
$(self[N6d][u9d])[L0d]();
if (self[p4d][r4J]) {
var p4J = R2d;
p4J += f0d;
p4J += d0d;
var y4J = c5U;
y4J += L9N;
y4J += g8U;
y4J += S8U;
$(m0d)[l0d]({
"scrollTop": $(targetRow)[J0d]()[x0d] + targetRow[Z0d] - self[y4J][p4J]
}, function() {
G8z[R2N]();
$(self[N6d][V9d])[l0d]({
"top": G8z.I2U
}, H0U, callback);
});
} else {
$(self[N6d][V9d])[l0d]({
"top": G8z.I2U
}, H0U, callback);
}
$(self[N6d][b9d])[x4J](O0d, function(e) {
var l4J = c5U;
l4J += r8U;
l4J += n8N;
l4J += z8U;
var Z4J = a0d;
Z4J += z8U;
G8z[G8z.i3U]();
self[Z4J][l4J]();
});
$(self[L4J][f4J])[d4J](m4J, function(e) {
var J4J = F9d;
J4J += u9N;
self[J4J][e6d]();
});
$(E4d, self[O4J][a4J])[D4J](q4J, function(e) {
var q0d = "nt_W";
var D0d = "DTED_Envelope_Conte";
var C4J = D0d;
C4J += q0d;
C4J += V2d;
C4J += u2d;
var N4J = j0d;
N4J += f5U;
N4J += r8U;
N4J += Q3N;
var j4J = j7N;
j4J += N0d;
j4J += m8U;
G8z[R2N]();
if ($(e[j4J])[N4J](C4J)) {
var K4J = t6d;
K4J += l6d;
var I4J = F9d;
I4J += u9N;
self[I4J][K4J]();
}
});
$(window)[F6d](k4J, function() {
var I0d = "alc";
var C0d = "eightC";
var e4J = G8U;
e4J += C9N;
e4J += C0d;
e4J += I0d;
G8z[R2N]();
self[e4J]();
});
},
"_heightCalc": function() {
var F0d = "eightCalc";
var Q0d = "hildr";
var A0d = "outerHeight";
var W0d = "onf";
var h0d = "eigh";
var e0d = "terHeight";
var b0d = "_Header";
var E0d = "windowPadding";
var k0d = "terH";
var G0d = "v.DTE";
var i4J = D6d;
i4J += u2d;
var P4J = c5U;
P4J += z9N;
P4J += z9N;
var v4J = B9d;
v4J += J6d;
v4J += e4N;
var o4J = G8U;
o4J += b1N;
var B4J = g8U;
B4J += G8z.R3U;
var t4J = K0d;
t4J += k0d;
t4J += Y6d;
var U4J = L9N;
U4J += i8U;
U4J += e0d;
var w4J = u4N;
w4J += G0d;
w4J += b0d;
var A4J = c5U;
A4J += W0d;
var E4J = C9N;
E4J += Y6d;
var F4J = C9N;
F4J += h0d;
F4J += m8U;
var Q4J = c5U;
Q4J += Q0d;
Q4J += X2N;
var h4J = y5N;
h4J += g8U;
h4J += R4d;
h4J += m8U;
var W4J = G8U;
W4J += q8U;
W4J += L9N;
W4J += q9N;
var b4J = R9N;
b4J += V2d;
b4J += u2d;
var G4J = C9N;
G4J += F0d;
var formHeight;
formHeight = self[p4d][G4J] ? self[p4d][m6d](self[N6d][b4J]) : $(self[W4J][h4J])[Q4J]()[F4J]();
var maxHeight = $(window)[E4J]() - self[A4J][E0d] * k2U - $(w4J, self[N6d][u9d])[U4J]() - $(x4d, self[N6d][u9d])[t4J]();
G8z[B4J]();
$(Z4d, self[o4J][v4J])[P4J](l4d, maxHeight);
return $(self[h9d][b1N][i4J])[A0d]();
},
"_hide": function(callback) {
var B0d = "_Lightbox";
var o0d = "div.DTED_Lightbo";
var i0d = "unbin";
var T0d = "offs";
var Y0d = "unbind";
var v0d = "x_Content_Wrapper";
var U0d = "ze.DTED_L";
var P0d = "ick.DTED_Ligh";
var V0d = "etHeight";
var t0d = "click.DT";
var w0d = "resi";
var y2J = w0d;
y2J += U0d;
y2J += H6d;
var r2J = O4d;
r2J += K2d;
r2J += g8U;
r2J += q8U;
var H2J = t0d;
H2J += Z5U;
H2J += D8U;
H2J += B0d;
var S2J = G8U;
S2J += q8U;
S2J += L9N;
S2J += q9N;
var z2J = o0d;
z2J += v0d;
var s2J = c5U;
s2J += r8U;
s2J += P0d;
s2J += c9N;
var g2J = i0d;
g2J += q8U;
var n2J = G8U;
n2J += b1N;
var R4J = T0d;
R4J += V0d;
var u4J = u0d;
u4J += c4N;
var V4J = G8U;
V4J += q8U;
V4J += L9N;
V4J += q9N;
var T4J = u0d;
T4J += c4N;
G8z[G8z.i3U]();
if (!callback) {
callback = function() {};
}
$(self[N6d][T4J])[l0d]({
"top": -(self[V4J][u4J][R4J] + c2U)
}, H0U, function() {
var c0d = "per";
var R0d = "mal";
var M0d = "ackg";
var Y4J = g8U;
Y4J += Y5U;
Y4J += R0d;
var X4J = O5U;
X4J += M0d;
X4J += d5U;
X4J += U9d;
var c4J = R9N;
c4J += V2d;
c4J += D9N;
c4J += c0d;
var M4J = G8U;
M4J += b1N;
G8z[G8z.i3U]();
$([self[M4J][c4J], self[N6d][X4J]])[X0d](Y4J, function() {
$(this)[Z5N]();
G8z[G8z.i3U]();
callback();
});
});
$(self[N6d][b9d])[Y0d](h6d);
$(self[n2J][e6d])[g2J](s2J);
$(z2J, self[S2J][u9d])[Y0d](H2J);
$(window)[r2J](y2J);
},
"_findAttachRow": function() {
var g7d = 'head';
var l2J = a0d;
l2J += z8U;
var x2J = M7N;
x2J += m8U;
x2J += F4d;
var p2J = m8U;
p2J += G8z.T3U;
p2J += n7d;
p2J += z8U;
G8z[G8z.i3U]();
var dt = new $[g8N][C2N][j5N](self[h9d][z9N][p2J]);
if (self[p4d][x2J] === g7d) {
var Z2J = m8U;
Z2J += s7d;
Z2J += z8U;
return dt[Z2J]()[z7d]();
} else if (self[l2J][z9N][S7d] === C1N) {
var L2J = j7N;
L2J += g5U;
return dt[L2J]()[z7d]();
} else {
var d2J = G8U;
d2J += q8U;
d2J += m8U;
d2J += z8U;
var f2J = d5U;
f2J += L9N;
f2J += R9N;
return dt[f2J](self[d2J][z9N][H7d])[r7d]();
}
},
"_dte": I1N,
"_ready": z0N,
"_cssBackgroundOpacity": K2U,
"_dom": {
"wrapper": $(y7d + m2J + p7d + J2J)[G8z.I2U],
"background": $(x7d)[G8z.I2U],
"close": $(O2J)[G8z.I2U],
"content": I1N
}
});
G8z[G8z.i3U]();
self = Editor[H5N][T4d];
self[a2J] = {
"windowPadding": c2U,
"heightCalc": I1N,
"attach": Z7d,
"windowScroll": S0N
};
}());
Editor[D2J][l7d] = function(cfg, after) {
var j7d = "already exi";
var k7d = 'initField';
var m7d = "reverse";
var q7d = " A field ";
var W7d = "unsh";
var C7d = "Error ";
var I7d = "adding field '";
var N7d = "sts with this name";
var L7d = "rd";
var D7d = "'.";
var O7d = "Error adding field. The field requires a `name` option";
var E2J = L9N;
E2J += L7d;
E2J += e4N;
if ($[f7d](cfg)) {
var q2J = d7d;
q2J += q4N;
q2J += Y2N;
if (after !== undefined) {
cfg[m7d]();
}
for (var i = G8z.I2U; i < cfg[q2J]; i++) {
this[l7d](cfg[i], after);
}
} else {
var W2J = t4N;
W2J += J7d;
W2J += q8U;
W2J += z9N;
var K2J = q9N;
K2J += u6d;
K2J += z8U;
var I2J = N3N;
I2J += q8U;
var j2J = g8U;
j2J += G8z.T3U;
j2J += e8U;
var name = cfg[j2J];
if (name === undefined) {
throw O7d;
}
if (this[z9N][a7d][name]) {
var C2J = D7d;
C2J += q7d;
C2J += j7d;
C2J += N7d;
var N2J = C7d;
N2J += I7d;
throw N2J + name + C2J;
}
this[K7d](k7d, cfg);
var field = new Editor[o7N](cfg, this[l3N][I2J], this);
if (this[z9N][K2J]) {
var k2J = Q1N;
k2J += c5U;
k2J += C9N;
var editFields = this[z9N][e7d];
field[G7d]();
$[k2J](editFields, function(idSrc, edit) {
var b2J = E7N;
b2J += j9N;
b2J += z8U;
b2J += m8U;
var e2J = N7N;
e2J += j7N;
var val;
if (edit[e2J]) {
var G2J = T7N;
G2J += G8z.T3U;
val = field[X7N](edit[G2J]);
}
field[b2J](idSrc, val !== undefined ? val : field[H3N]());
});
}
this[z9N][W2J][name] = field;
if (after === undefined) {
this[z9N][b7d][c2N](name);
} else if (after === I1N) {
var Q2J = W7d;
Q2J += H8U;
Q2J += S8U;
Q2J += m8U;
var h2J = L9N;
h2J += o6N;
this[z9N][h2J][Q2J](name);
} else {
var F2J = h7d;
F2J += Q7d;
F2J += c5U;
F2J += z8U;
var idx = $[F7d](after, this[z9N][b7d]);
this[z9N][b7d][F2J](idx + K2U, G8z.I2U, name);
}
}
this[E7d](this[E2J]());
return this;
};
Editor[M1N][A2J] = function(newAjax) {
if (newAjax) {
this[z9N][A7d] = newAjax;
return this;
}
return this[z9N][A7d];
};
Editor[w2J][U2J] = function() {
var B7d = "editOpt";
var o7d = "onBackground";
var w7d = "bm";
var P2J = g8U;
P2J += G8z.R3U;
var v2J = z9N;
v2J += i8U;
v2J += w7d;
v2J += l6N;
var B2J = U7d;
B2J += t7d;
B2J += g3N;
var t2J = B7d;
t2J += z9N;
var onBackground = this[z9N][t2J][o7d];
if (typeof onBackground === B2J) {
onBackground(this);
} else if (onBackground === p9d) {
this[v7d]();
} else if (onBackground === x9d) {
var o2J = C2d;
o2J += P7d;
this[o2J]();
} else if (onBackground === v2J) {
this[i7d]();
}
G8z[P2J]();
return this;
};
Editor[i2J][T2J] = function() {
var V2J = G8U;
V2J += O5U;
V2J += T7d;
V2J += d5U;
this[V2J]();
return this;
};
Editor[u2J][V7d] = function(cells, fieldNames, show, opts) {
var u7d = "boolea";
var M7d = "inObject";
var X2J = G8U;
X2J += a4N;
X2J += H8U;
X2J += m8U;
var c2J = u7d;
c2J += g8U;
var M2J = F2d;
M2J += C7N;
M2J += R7d;
M2J += M7d;
var R2J = c7d;
R2J += q8U;
R2J += G8z.u3U;
var that = this;
if (this[R2J](function() {
that[V7d](cells, fieldNames, opts);
})) {
return this;
}
if ($[M2J](fieldNames)) {
opts = fieldNames;
fieldNames = undefined;
show = S0N;
} else if (typeof fieldNames === c2J) {
show = fieldNames;
fieldNames = undefined;
opts = undefined;
}
if ($[G8N](show)) {
opts = show;
show = S0N;
}
if (show === undefined) {
show = S0N;
}
opts = $[A7N]({}, this[z9N][r9d][V7d], opts);
var editFields = this[K7d](X7d, cells, fieldNames);
this[X2J](cells, editFields, Y7d, opts, function() {
var s1d = "_f";
var a1d = "v/></di";
var C1d = "_pre";
var j1d = "bubbleNo";
var b1d = "formError";
var e1d = "concat";
var L1d = "poi";
var O1d = "\"><di";
var I1d = 'resize.';
var S1d = "bubblePo";
var f1d = "<div class=";
var D1d = "classe";
var A1d = "pend";
var l1d = "\" /";
var q1d = "attac";
var J1d = "tab";
var z1d = "nima";
var h1d = "ormInfo";
var y1d = "seRe";
var g1d = "includ";
var d1d = "class=\"DTE_Processing_Indicator\"><span></div>";
var H1d = "sition";
var B0J = C5U;
B0J += n1d;
var t0J = g1d;
t0J += F8N;
t0J += Z8U;
var U0J = s1d;
U0J += v5N;
U0J += i8U;
U0J += z9N;
var w0J = X6N;
w0J += z1d;
w0J += u9N;
var A0J = S1d;
A0J += H1d;
var F0J = a4d;
F0J += j8N;
var e0J = r1d;
e0J += y1d;
e0J += q4N;
var j0J = C5U;
j0J += f9N;
var q0J = q8U;
q0J += L9N;
q0J += q9N;
var D0J = q8U;
D0J += o5N;
var a0J = S8N;
a0J += q8U;
var O0J = z8U;
O0J += p1d;
var J0J = x1d;
J0J += Z1d;
var m0J = l1d;
m0J += W0N;
var d0J = L1d;
d0J += g8U;
d0J += b6d;
var f0J = f1d;
f0J += E2N;
var L0J = X0N;
L0J += d1d;
var l0J = m1d;
l0J += V0N;
l0J += W0N;
var Z0J = J1d;
Z0J += r8U;
Z0J += z8U;
var x0J = E2N;
x0J += W0N;
var p0J = B9d;
p0J += o9d;
p0J += D9N;
p0J += e4N;
var y0J = O1d;
y0J += a1d;
y0J += h0N;
var r0J = O5U;
r0J += q4N;
var H0J = D1d;
H0J += z9N;
var S0J = q1d;
S0J += C9N;
var z0J = j1d;
z0J += N1d;
var n0J = C1d;
n0J += L9N;
n0J += O6N;
var Y2J = G8U;
Y2J += r9d;
var namespace = that[Y2J](opts);
var ret = that[n0J](Y7d);
if (!ret) {
return that;
}
$(window)[y3N](I1d + namespace, function() {
var K1d = "bubbleP";
var k1d = "ition";
var s0J = K1d;
s0J += n8N;
s0J += k1d;
var g0J = g8U;
g0J += G8z.R3U;
G8z[g0J]();
that[s0J]();
});
var nodes = [];
that[z9N][z0J] = nodes[e1d][Y1N](nodes, _pluck(editFields, S0J));
var classes = that[H0J][V7d];
var background = $(g1N + classes[r0J] + y0J);
var container = $(g1N + classes[p0J] + x0J + g1N + classes[G1d] + z1N + g1N + classes[Z0J] + z1N + g1N + classes[b9d] + l0J + L0J + p1N + p1N + f0J + classes[d0J] + m0J + J0J);
if (show) {
container[b4d](P6d);
background[b4d](P6d);
}
var liner = container[e9d]()[O0J](G8z.I2U);
var table = liner[e9d]();
var close = table[e9d]();
liner[a0J](that[D0J][b1d]);
table[k1N](that[q0J][j0J]);
if (opts[W1d]) {
var C0J = S8U;
C0J += h1d;
var N0J = F1N;
N0J += q9N;
liner[k1N](that[N0J][C0J]);
}
if (opts[Q1d]) {
var K0J = F1d;
K0J += E1d;
var I0J = D9N;
I0J += d5U;
I0J += z8U;
I0J += A1d;
liner[I0J](that[b1N][K0J]);
}
if (opts[w1d]) {
var k0J = J6d;
k0J += O6d;
table[k0J](that[b1N][w1d]);
}
var pair = $()[l7d](container)[l7d](background);
that[e0J](function(submitComplete) {
var U1d = "nimat";
var G0J = X6N;
G0J += U1d;
G0J += z8U;
G8z[R2N]();
that[G0J](pair, {
opacity: G8z.I2U
}, function() {
var B1d = "DynamicInfo";
var t1d = "_clear";
G8z[R2N]();
if (this === container[G8z.I2U]) {
var Q0J = c5U;
Q0J += r8U;
Q0J += n8N;
Q0J += a4N;
var h0J = G8U;
h0J += z8U;
h0J += X3U;
h0J += c4N;
var W0J = t1d;
W0J += B1d;
var b0J = q8U;
b0J += z8U;
b0J += m8U;
b0J += F4d;
pair[b0J]();
$(window)[o1d](I1d + namespace);
that[W0J]();
that[h0J](Q0J, [Y7d]);
}
});
});
background[F0J](function() {
that[v7d]();
});
close[d4d](function() {
var E0J = g8U;
E0J += G8z.R3U;
G8z[E0J]();
that[v1d]();
});
that[A0J]();
that[w0J](pair, {
opacity: K2U
});
that[U0J](that[z9N][t0J], opts[B0J]);
that[P1d](Y7d, S0N);
});
return this;
};
Editor[o0J][v0J] = function() {
var p3d = 'below';
var i1d = "outerW";
var y3d = "tom";
var X1d = ".DTE_Bub";
var Y1d = "bubbleNodes";
var M1d = "bble_Liner";
var H3d = "right";
var U2U = 15;
var V1d = "ttom";
var x3d = "eClass";
var x7J = v9N;
x7J += d6N;
x7J += Y2N;
var p7J = O5U;
p7J += i8U;
p7J += O5U;
p7J += g5U;
var y7J = R9N;
y7J += H8U;
y7J += q8U;
y7J += Y2N;
var r7J = i1d;
r7J += H8U;
r7J += I9d;
r7J += C9N;
var H7J = d5U;
H7J += T1d;
var S7J = a6d;
S7J += V1d;
var z7J = v9N;
z7J += u1d;
z7J += C9N;
var s7J = d7d;
s7J += q4N;
s7J += Y2N;
var g7J = m8U;
g7J += L9N;
g7J += D9N;
var T0J = z8U;
T0J += G8z.T3U;
T0J += c5U;
T0J += C9N;
var i0J = R1d;
i0J += u8U;
i0J += M1d;
var P0J = c1d;
P0J += X1d;
P0J += g5U;
G8z[R2N]();
var wrapper = $(P0J),
liner = $(i0J),
nodes = this[z9N][Y1d];
var position = {
top: G8z.I2U,
left: G8z.I2U,
right: G8z.I2U,
bottom: G8z.I2U
};
$[T0J](nodes, function(i, node) {
var g3d = "gh";
var s3d = "lef";
var n3d = "ffsetHe";
var S3d = "offsetWidth";
var n7J = L9N;
n7J += n3d;
n7J += T1d;
var Y0J = m8U;
Y0J += L5N;
var X0J = a6d;
X0J += V1d;
var c0J = d5U;
c0J += H8U;
c0J += g3d;
c0J += m8U;
var M0J = s3d;
M0J += m8U;
var R0J = r8U;
R0J += z8U;
R0J += R1N;
var u0J = q4N;
u0J += z8U;
u0J += m8U;
var V0J = g8U;
V0J += G8z.R3U;
G8z[V0J]();
var pos = $(node)[J0d]();
node = $(node)[u0J](G8z.I2U);
position[x0d] += pos[x0d];
position[R0J] += pos[M0J];
position[c0J] += pos[z3d] + node[S3d];
position[X0J] += pos[Y0J] + node[n7J];
});
position[g7J] /= nodes[U5N];
position[z3d] /= nodes[s7J];
position[H3d] /= nodes[z7J];
position[S7J] /= nodes[U5N];
var top = position[x0d],
left = (position[z3d] + position[H7J]) / k2U,
width = liner[r7J](),
visLeft = left - width / k2U,
visRight = visLeft + width,
docWidth = $(window)[y7J](),
padding = U2U,
classes = this[l3N][p7J];
wrapper[G1N]({
top: top,
left: left
});
if (liner[x7J] && liner[J0d]()[x0d] < G8z.I2U) {
var f7J = p4N;
f7J += q8U;
f7J += r3d;
f7J += b5N;
var L7J = O5U;
L7J += v6N;
L7J += y3d;
var l7J = U4N;
l7J += D9N;
var Z7J = c5U;
Z7J += z9N;
Z7J += z9N;
wrapper[Z7J](l7J, position[L7J])[f7J](p3d);
} else {
var d7J = W3N;
d7J += E0N;
d7J += x3d;
wrapper[d7J](p3d);
}
if (visRight + padding > docWidth) {
var m7J = c5U;
m7J += b5N;
var diff = visRight - docWidth;
liner[m7J](Z3d, visLeft < padding ? -(visLeft - padding) : -(diff + padding));
} else {
var J7J = c5U;
J7J += z9N;
J7J += z9N;
liner[J7J](Z3d, visLeft < padding ? -(visLeft - padding) : G8z.I2U);
}
return this;
};
Editor[M1N][O7J] = function(buttons) {
var l3d = "_b";
var N7J = Q1N;
N7J += c5U;
N7J += C9N;
var j7J = H9d;
j7J += z9N;
var a7J = l3d;
a7J += G8z.T3U;
a7J += L3d;
a7J += c5U;
var that = this;
if (buttons === a7J) {
var D7J = Q7N;
D7J += f3d;
buttons = [{
text: this[D7J][this[z9N][S7d]][i7d],
action: function() {
var q7J = z9N;
q7J += d3d;
q7J += q9N;
q7J += l6N;
this[q7J]();
}
}];
} else if (!$[f7d](buttons)) {
buttons = [buttons];
}
$(this[b1N][j7J])[m3d]();
$[N7J](buttons, function(i, btn) {
var I3d = "tabIndex";
var e3d = 'keypress';
var j3d = "className";
var C3d = 'tabindex';
var O3d = "Name";
var D3d = "ton/>";
var e7J = J3d;
e7J += y3N;
var k7J = e3N;
k7J += O3d;
var K7J = S8U;
K7J += Y5U;
K7J += q9N;
var I7J = a3d;
I7J += D3d;
var C7J = m8U;
C7J += z8U;
C7J += g4N;
C7J += m8U;
if (typeof btn === q3d) {
btn = {
text: btn,
action: function() {
this[i7d]();
}
};
}
var text = btn[C7J] || btn[H1N];
var action = btn[S7d] || btn[g8N];
$(I7J, {
'class': that[l3N][K7J][H9d] + (btn[j3d] ? s1N + btn[k7J] : R7N)
})[p8N](typeof text === e7J ? text(that) : text || R7N)[N3d](C3d, btn[I3d] !== undefined ? btn[I3d] : G8z.I2U)[y3N](K3d, function(e) {
if (e[k3d] === A2U && action) {
action[X1N](that);
}
})[y3N](e3d, function(e) {
var W3d = "ventD";
var h3d = "efault";
var G7J = G3d;
G7J += f5U;
G7J += L9N;
G7J += i4N;
if (e[G7J] === A2U) {
var b7J = b3d;
b7J += W3d;
b7J += h3d;
e[b7J]();
}
})[y3N](h1N, function(e) {
var E3d = "fault";
var W7J = Q3d;
W7J += F3d;
W7J += E3d;
e[W7J]();
if (action) {
action[X1N](that, e);
}
})[b4d](that[b1N][w1d]);
});
return this;
};
Editor[M1N][h7J] = function(fieldName) {
var o3d = "ncludeFi";
var Q7J = z9N;
Q7J += A3d;
Q7J += g8U;
Q7J += q4N;
var that = this;
var fields = this[z9N][a7d];
if (typeof fieldName === Q7J) {
var w7J = w3d;
w7J += f8U;
var A7J = L9N;
A7J += d5U;
A7J += U3d;
var E7J = L9N;
E7J += d5U;
E7J += i4N;
E7J += d5U;
var F7J = N3N;
F7J += q8U;
that[F7J](fieldName)[t3d]();
delete fields[fieldName];
var orderIdx = $[F7d](fieldName, this[z9N][E7J]);
this[z9N][A7J][B3d](orderIdx, K2U);
var includeIdx = $[F7d](fieldName, this[z9N][w7J]);
if (includeIdx !== -K2U) {
var U7J = H8U;
U7J += o3d;
U7J += v3d;
this[z9N][U7J][B3d](includeIdx, K2U);
}
} else {
$[U2N](this[P3d](fieldName), function(i, name) {
var t7J = C2d;
t7J += z8U;
t7J += G8z.T3U;
t7J += d5U;
G8z[G8z.i3U]();
that[t7J](name);
});
}
return this;
};
Editor[B7J][b9d] = function() {
var o7J = G8U;
o7J += c5U;
o7J += y4N;
o7J += v8U;
this[o7J](z0N);
return this;
};
Editor[M1N][i3d] = function(arg1, arg2, arg3, arg4) {
var s8d = "numbe";
var g8d = "ditFi";
var u3d = "_displa";
var H8d = "_actionClass";
var p8d = 'initCreate';
var Y3d = "_crudAr";
var R3d = "yReo";
var x1J = T3d;
x1J += V3d;
var S1J = Q1N;
S1J += c5U;
S1J += C9N;
var z1J = u3d;
z1J += R3d;
z1J += o6N;
var s1J = O5U;
s1J += r8U;
s1J += v5N;
s1J += P5N;
var g1J = M3d;
g1J += c3d;
var n1J = z9N;
n1J += m8U;
n1J += t2d;
n1J += z8U;
var Y7J = c5U;
Y7J += V9N;
Y7J += G8z.T3U;
Y7J += u9N;
var X7J = X3d;
X7J += y3N;
var c7J = q9N;
c7J += O3N;
c7J += g8U;
var M7J = q9N;
M7J += L9N;
M7J += q8U;
M7J += z8U;
var R7J = Y3d;
R7J += n8d;
var V7J = G8z.u3U;
V7J += G8z.R3U;
var T7J = z8U;
T7J += g8d;
T7J += z5U;
T7J += z9N;
var i7J = s8d;
i7J += d5U;
var P7J = c7d;
P7J += n6N;
var v7J = S8U;
v7J += H8U;
v7J += z5U;
v7J += z9N;
var that = this;
var fields = this[z9N][v7J];
var count = K2U;
if (this[P7J](function() {
G8z[G8z.i3U]();
that[i3d](arg1, arg2, arg3, arg4);
})) {
return this;
}
if (typeof arg1 === i7J) {
count = arg1;
arg1 = arg2;
arg2 = arg3;
}
this[z9N][T7J] = {};
G8z[V7J]();
for (var i = G8z.I2U; i < count; i++) {
var u7J = N3N;
u7J += z8d;
this[z9N][e7d][i] = {
fields: this[z9N][u7J]
};
}
var argOpts = this[R7J](arg1, arg2, arg3, arg4);
this[z9N][M7J] = c7J;
this[z9N][X7J] = Y7J;
this[z9N][H7d] = I1N;
this[b1N][S8d][n1J][g1J] = s1J;
this[H8d]();
this[z1J](this[a7d]());
$[S1J](fields, function(name, field) {
var y8d = "iSe";
var r8d = "ef";
var p1J = q8U;
p1J += r8d;
var y1J = z9N;
y1J += z8U;
y1J += m8U;
field[G7d]();
for (var i = G8z.I2U; i < count; i++) {
var r1J = i4N;
r1J += S8U;
var H1J = j5U;
H1J += z3N;
H1J += y8d;
H1J += m8U;
field[H1J](i, field[r1J]());
}
field[y1J](field[p1J]());
});
this[x1J](p8d, I1N, function() {
var Z8d = "_formOp";
var x8d = "aybeOpe";
var L1J = q9N;
L1J += x8d;
L1J += g8U;
var l1J = L9N;
l1J += D9N;
l1J += m8U;
l1J += z9N;
var Z1J = Z8d;
Z1J += l8d;
Z1J += V1N;
that[L8d]();
that[Z1J](argOpts[l1J]);
argOpts[L1J]();
});
return this;
};
Editor[f1J][f8d] = function(parent) {
var m1J = g8U;
m1J += u6d;
m1J += z8U;
if ($[f7d](parent)) {
var d1J = d7d;
d1J += m8N;
for (var i = G8z.I2U, ien = parent[d1J]; i < ien; i++) {
this[f8d](parent[i]);
}
return this;
}
var field = this[d8d](parent);
$(field[m1J]())[o1d](m8d);
return this;
};
Editor[J1J][O1J] = function(parent, url, opts) {
var a8d = "ep";
var D8d = "enden";
var W8d = "ield";
var q8d = 'POST';
var J8d = "chang";
var F1J = z8U;
F1J += E0N;
F1J += X2N;
F1J += m8U;
var C1J = J8d;
C1J += z8U;
var N1J = z8U;
N1J += g4N;
N1J += R4d;
N1J += q8U;
var j1J = t4N;
j1J += z5U;
var a1J = O8d;
a1J += d5U;
a1J += p2N;
if ($[a1J](parent)) {
var D1J = g0N;
D1J += Y2N;
for (var i = G8z.I2U, ien = parent[D1J]; i < ien; i++) {
var q1J = q8U;
q1J += a8d;
q1J += D8d;
q1J += m8U;
this[q1J](parent[i], url, opts);
}
return this;
}
var that = this;
var field = this[j1J](parent);
var ajaxOpts = {
type: q8d,
dataType: j8d
};
opts = $[N1J]({
event: C1J,
data: I1N,
preUpdate: I1N,
postUpdate: I1N
}, opts);
var update = function(json) {
var Q8d = 'show';
var N8d = "postUpd";
var E8d = "postUpdate";
var K8d = "essag";
var G8d = "preUpdate";
var b8d = 'error';
var h8d = 'hide';
var F8d = 'disable';
var e8d = "pda";
var Q1J = N8d;
Q1J += C8d;
var h1J = I8d;
h1J += C9N;
var e1J = q9N;
e1J += K8d;
e1J += z8U;
var k1J = E0N;
k1J += k8d;
var K1J = i8U;
K1J += e8d;
K1J += u9N;
var I1J = r8U;
I1J += G8z.T3U;
I1J += D0N;
if (opts[G8d]) {
opts[G8d](json);
}
$[U2N]({
labels: I1J,
options: K1J,
values: k1J,
messages: e1J,
errors: b8d
}, function(jsonProp, fieldFn) {
var G1J = g8U;
G1J += G8z.R3U;
G8z[G1J]();
if (json[jsonProp]) {
var b1J = Q1N;
b1J += r9N;
$[b1J](json[jsonProp], function(field, val) {
var W1J = S8U;
W1J += W8d;
G8z[R2N]();
that[W1J](field)[fieldFn](val);
});
}
});
$[h1J]([h8d, Q8d, D3N, F8d], function(i, key) {
G8z[G8z.i3U]();
if (json[key]) {
that[key](json[key], json[l0d]);
}
});
if (opts[Q1J]) {
opts[E8d](json);
}
field[j1N](z0N);
};
$(field[r7d]())[y3N](opts[F1J] + m8d, function(e) {
var v8d = "values";
var u8d = "isPlainObj";
var w8d = "itF";
var A8d = "ows";
var i8d = "ncti";
var T1J = n3N;
T1J += g3N;
var P1J = N4N;
P1J += r8U;
var v1J = d5U;
v1J += A8d;
var o1J = d5U;
o1J += L9N;
o1J += R9N;
o1J += z9N;
var B1J = p6N;
B1J += R9N;
var t1J = a4N;
t1J += w8d;
t1J += W8d;
t1J += z9N;
var U1J = U8d;
U1J += q4N;
var w1J = v9N;
w1J += d6N;
w1J += Y2N;
var A1J = m8U;
A1J += Y4N;
A1J += t8d;
A1J += m8U;
var E1J = S8U;
E1J += H8U;
E1J += g8U;
E1J += q8U;
if ($(field[r7d]())[E1J](e[A1J])[w1J] === G8z.I2U) {
return;
}
field[U1J](S0N);
var data = {};
data[B8d] = that[z9N][t1J] ? _pluck(that[z9N][e7d], o8d) : I1N;
data[B1J] = data[o1J] ? data[v1J][G8z.I2U] : I1N;
data[v8d] = that[P1J]();
G8z[G8z.i3U]();
if (opts[u7N]) {
var ret = opts[u7N](data);
if (ret) {
var i1J = q8U;
i1J += G8z.T3U;
i1J += m8U;
i1J += G8z.T3U;
opts[i1J] = ret;
}
}
if (typeof url === T1J) {
var u1J = N4N;
u1J += r8U;
var V1J = P8d;
V1J += r8U;
var o = url[V1J](that, field[u1J](), data, update);
if (o) {
var c1J = S8U;
c1J += i8U;
c1J += i8d;
c1J += y3N;
var M1J = Y2N;
M1J += z8U;
M1J += g8U;
var R1J = L9N;
R1J += T8d;
if (typeof o === R1J && typeof o[M1J] === c1J) {
o[V8d](function(resolved) {
G8z[R2N]();
if (resolved) {
update(resolved);
}
});
} else {
update(o);
}
}
} else {
var n3J = F8U;
n3J += z8U;
n3J += H9N;
var X1J = u8d;
X1J += R8d;
if ($[X1J](url)) {
$[A7N](ajaxOpts, url);
} else {
var Y1J = i8U;
Y1J += d5U;
Y1J += r8U;
ajaxOpts[Y1J] = url;
}
$[A7d]($[n3J](ajaxOpts, {
url: url,
data: data,
success: update
}));
}
});
return this;
};
Editor[g3J][t3d] = function() {
var n5d = "playe";
var M8d = "qu";
var p3J = O4d;
p3J += H8U;
p3J += M8d;
p3J += z8U;
var y3J = c8d;
y3J += q8U;
y3J += m8U;
y3J += z8U;
var r3J = L9N;
r3J += S8U;
r3J += S8U;
var S3J = N1d;
S3J += X8d;
S3J += Y8d;
var z3J = C2d;
z3J += z8U;
z3J += G8z.T3U;
z3J += d5U;
var s3J = l9d;
s3J += n5d;
s3J += q8U;
if (this[z9N][s3J]) {
this[b9d]();
}
this[z3J]();
if (this[z9N][g5d]) {
$(P6d)[G9d](this[z9N][g5d]);
}
var controller = this[z9N][q9d];
if (controller[S3J]) {
var H3J = N1d;
H3J += X8d;
H3J += L9N;
H3J += G8z.u3U;
controller[H3J](this);
}
$(document)[r3J](y3J + this[z9N][p3J]);
this[b1N] = I1N;
this[z9N] = I1N;
};
Editor[M1N][x3J] = function(name) {
var Z3J = Q1N;
Z3J += r9N;
var that = this;
$[Z3J](this[P3d](name), function(i, n) {
var l3J = S8U;
l3J += H8U;
l3J += J7d;
l3J += q8U;
that[l3J](n)[s5d]();
});
return this;
};
Editor[L3J][H5N] = function(show) {
var f3J = L9N;
f3J += D9N;
f3J += z8U;
f3J += g8U;
if (show === undefined) {
return this[z9N][z5d];
}
G8z[G8z.i3U]();
return this[show ? f3J : x9d]();
};
Editor[d3J][m3J] = function() {
var O3J = S8U;
O3J += t7N;
O3J += z8d;
var J3J = G8z.u3U;
J3J += G8z.R3U;
G8z[J3J]();
return $[S5d](this[z9N][O3J], function(field, name) {
var H5d = "isplaye";
var a3J = q8U;
a3J += H5d;
a3J += q8U;
return field[a3J]() ? name : I1N;
});
};
Editor[M1N][D3J] = function() {
return this[z9N][q9d][r7d](this);
};
Editor[q3J][r5d] = function(items, arg1, arg2, arg3, arg4) {
var x5d = "_cr";
var Z5d = "udArgs";
var p5d = "ource";
var I3J = L9N;
I3J += D9N;
I3J += m8U;
I3J += z9N;
var C3J = F9d;
C3J += y5d;
C3J += j9N;
C3J += p5d;
var N3J = x5d;
N3J += Z5d;
var j3J = c7d;
j3J += q8U;
j3J += G8z.u3U;
var that = this;
if (this[j3J](function() {
that[r5d](items, arg1, arg2, arg3, arg4);
})) {
return this;
}
var argOpts = this[N3J](arg1, arg2, arg3, arg4);
this[l5d](items, this[C3J](L5d, items), f5d, argOpts[I3J], function() {
var d5d = "_formO";
var a5d = "leMain";
var O5d = "emb";
var k3J = d5d;
k3J += m5d;
k3J += J5d;
var K3J = G8U;
K3J += Q3N;
K3J += O5d;
K3J += a5d;
that[K3J]();
that[k3J](argOpts[U1N]);
G8z[R2N]();
argOpts[D5d]();
});
return this;
};
Editor[M1N][e3J] = function(name) {
var G3J = z8U;
G3J += F4d;
var that = this;
G8z[R2N]();
$[G3J](this[P3d](name), function(i, n) {
var q5d = "enable";
that[d8d](n)[q5d]();
});
return this;
};
Editor[b3J][W3J] = function(name, msg) {
var N5d = "ob";
var j5d = "gl";
var C5d = "alError";
if (msg === undefined) {
var Q3J = j5d;
Q3J += N5d;
Q3J += C5d;
var h3J = S8d;
h3J += m5N;
this[I5d](this[b1N][h3J], name);
this[z9N][Q3J] = name;
} else {
var E3J = z8U;
E3J += d5U;
E3J += G3N;
var F3J = e7N;
F3J += e5U;
this[F3J](name)[E3J](msg);
}
return this;
};
Editor[A3J][w3J] = function(name) {
var K5d = 'Unknown field name - ';
var U3J = e7N;
U3J += r8U;
U3J += z8d;
var fields = this[z9N][U3J];
if (!fields[name]) {
throw K5d + name;
}
return fields[name];
};
Editor[t3J][a7d] = function() {
var o3J = S8U;
o3J += t7N;
o3J += q8U;
o3J += z9N;
var B3J = q9N;
B3J += o9d;
return $[B3J](this[z9N][o3J], function(field, name) {
return name;
});
};
Editor[v3J][P3J] = _api_file;
Editor[i3J][T2N] = _api_files;
Editor[T3J][k5d] = function(name) {
var c3J = N3N;
c3J += q8U;
var that = this;
if (!name) {
var V3J = t4N;
V3J += J7d;
V3J += z8d;
name = this[V3J]();
}
if ($[f7d](name)) {
var u3J = z8U;
u3J += G8z.T3U;
u3J += c5U;
u3J += C9N;
var out = {};
$[u3J](name, function(i, n) {
var M3J = t4N;
M3J += z8U;
M3J += r8U;
M3J += q8U;
var R3J = g8U;
R3J += G8z.R3U;
G8z[R3J]();
out[n] = that[M3J](n)[k5d]();
});
return out;
}
return this[c3J](name)[k5d]();
};
Editor[M1N][X3J] = function(names, animate) {
var e5d = "_fieldN";
var G5d = "ames";
var n8J = e5d;
n8J += G5d;
var Y3J = z8U;
Y3J += G8z.T3U;
Y3J += c5U;
Y3J += C9N;
var that = this;
$[Y3J](this[n8J](names), function(i, n) {
var g8J = C9N;
g8J += H8U;
g8J += q8U;
g8J += z8U;
G8z[R2N]();
that[d8d](n)[g8J](animate);
});
return this;
};
Editor[s8J][z8J] = function(includeHash) {
return $[S5d](this[z9N][e7d], function(edit, idSrc) {
var S8J = g8U;
S8J += G8z.R3U;
G8z[S8J]();
return includeHash === S0N ? b5d + idSrc : idSrc;
});
};
Editor[H8J][W5d] = function(inNames) {
var Q5d = "globalError";
var h5d = "ormErr";
var y8J = S8U;
y8J += h5d;
y8J += Y5U;
var r8J = g8U;
r8J += G8z.R3U;
G8z[r8J]();
var formError = $(this[b1N][y8J]);
if (this[z9N][Q5d]) {
return S0N;
}
var names = this[P3d](inNames);
for (var i = G8z.I2U, ien = names[U5N]; i < ien; i++) {
var p8J = e7N;
p8J += e5U;
if (this[p8J](names[i])[W5d]()) {
return S0N;
}
}
return z0N;
};
Editor[x8J][Z8J] = function(cell, fieldName, opts) {
var B5d = "isP";
var c5d = 'div.DTE_Field';
var U5d = "rmOpt";
var A5d = "dataSour";
var I8J = H8U;
I8J += g8U;
I8J += F5d;
var C8J = G8U;
C8J += a4N;
C8J += H8U;
C8J += m8U;
var O8J = b8U;
O8J += F5d;
var J8J = c5U;
J8J += r8U;
J8J += E5d;
var m8J = G8U;
m8J += A5d;
m8J += c5U;
m8J += z8U;
var d8J = w5d;
d8J += F4N;
var f8J = C5U;
f8J += U5d;
f8J += n8U;
f8J += V1N;
var L8J = z8U;
L8J += t5d;
L8J += g8U;
L8J += q8U;
var l8J = B5d;
l8J += r8U;
l8J += o5d;
var that = this;
if ($[l8J](fieldName)) {
opts = fieldName;
fieldName = undefined;
}
opts = $[L8J]({}, this[z9N][f8J][d8J], opts);
var editFields = this[m8J](X7d, cell, fieldName);
var node, field;
var countOuter = G8z.I2U,
countInner;
var closed = z0N;
var classes = this[J8J][O8J];
$[U2N](editFields, function(i, editField) {
var i5d = "w inline at a time";
var P5d = "Cannot edit more than one ro";
var v5d = "isplayFields";
var D8J = q8U;
D8J += v5d;
if (countOuter > G8z.I2U) {
var a8J = P5d;
a8J += i5d;
throw a8J;
}
node = $(editField[T5d][G8z.I2U]);
countInner = G8z.I2U;
$[U2N](editField[D8J], function(j, f) {
var u5d = "han one field i";
var V5d = "Cannot edit more t";
var R5d = "nline at";
var M5d = " a time";
var j8J = G8z.u3U;
j8J += G8z.R3U;
if (countInner > G8z.I2U) {
var q8J = V5d;
q8J += u5d;
q8J += R5d;
q8J += M5d;
throw q8J;
}
field = f;
G8z[j8J]();
countInner++;
});
G8z[G8z.i3U]();
countOuter++;
});
if ($(c5d, node)[U5N]) {
return this;
}
if (this[X5d](function() {
var N8J = b8U;
N8J += F5d;
that[N8J](cell, fieldName, opts);
})) {
return this;
}
this[C8J](cell, editFields, I8J, opts, function() {
var r9c = "iv clas";
var n9c = "formErr";
var S9c = " style=\"width:";
var C9c = "_closeReg";
var O9c = '<div class="DTE_Processing_Indicator"><span/></div>';
var L9c = "reop";
var Y5d = "but";
var m9c = "contents";
var J9c = 'px">';
var g9c = "nod";
var x5J = S8U;
x5J += v5N;
x5J += x2N;
var p5J = G8U;
p5J += o1N;
var v8J = Y5d;
v8J += m8U;
v8J += L9N;
v8J += V1N;
var o8J = n9c;
o8J += Y5U;
var B8J = q8U;
B8J += L9N;
B8J += q9N;
var t8J = o9d;
t8J += D9N;
t8J += O6d;
var U8J = g9c;
U8J += z8U;
var w8J = c1d;
w8J += c8d;
var A8J = S8U;
A8J += H8U;
A8J += g8U;
A8J += q8U;
var E8J = s9c;
E8J += z9c;
E8J += V1N;
var F8J = e0N;
F8J += H8U;
F8J += E0N;
F8J += W0N;
var Q8J = R2d;
Q8J += q8U;
Q8J += m8U;
Q8J += C9N;
var h8J = E2N;
h8J += S9c;
var W8J = H9c;
W8J += r9c;
W8J += y9c;
var b8J = E2N;
b8J += W0N;
var G8J = R9N;
G8J += d5U;
G8J += J6d;
G8J += e4N;
var e8J = p9c;
e8J += r8U;
e8J += x9c;
var k8J = Z9c;
k8J += H9N;
var K8J = l9c;
K8J += L9c;
K8J += X2N;
var namespace = that[f9c](opts);
var ret = that[K8J](d9c);
if (!ret) {
return that;
}
var children = node[m9c]()[y8N]();
node[k8J]($(e8J + classes[G8J] + b8J + W8J + classes[G1d] + h8J + node[Q8J]() + J9c + O9c + F8J + g1N + classes[E8J] + a9c + p1N));
node[A8J](w8J + classes[G1d][v8N](/ /g, D9c))[G9d](field[U8J]())[t8J](that[B8J][o8J]);
if (opts[v8J]) {
var u8J = O5U;
u8J += i8U;
u8J += m8U;
u8J += q9c;
var V8J = q8U;
V8J += L9N;
V8J += q9N;
var T8J = G8z.T3U;
T8J += j9c;
var i8J = U8N;
i8J += r8U;
i8J += G8z.T3U;
i8J += w8N;
var P8J = S8U;
P8J += b8U;
P8J += q8U;
node[P8J](N9c + classes[w1d][i8J](/ /g, D9c))[T8J](that[V8J][u8J]);
}
that[C9c](function(submitComplete, action) {
var K9c = "arDynam";
var k9c = "icInfo";
var e9c = "conten";
var g5J = g8U;
g5J += G8z.R3U;
var n5J = I9c;
n5J += K9c;
n5J += k9c;
var c8J = a4N;
c8J += H8U;
c8J += m8U;
var M8J = C2d;
M8J += H8U;
M8J += j8N;
var R8J = L9N;
R8J += o2d;
closed = S0N;
$(document)[R8J](M8J + namespace);
if (!submitComplete || action !== c8J) {
var Y8J = G8z.T3U;
Y8J += i6d;
Y8J += O6d;
var X8J = e9c;
X8J += W7N;
node[X8J]()[y8N]();
node[Y8J](children);
}
that[n5J]();
G8z[g5J]();
return d9c;
});
setTimeout(function() {
var s5J = c5U;
s5J += Q7d;
s5J += c5U;
s5J += P5N;
if (closed) {
return;
}
$(document)[y3N](s5J + namespace, function(e) {
var h9c = "ddBack";
var G9c = "rents";
var F9c = 'owns';
var W9c = "Bac";
var Q9c = 'andSelf';
var b9c = "tar";
var y5J = D9N;
y5J += G8z.T3U;
y5J += G9c;
var r5J = b9c;
r5J += q4N;
r5J += i9N;
var H5J = k8N;
H5J += d5U;
H5J += V2d;
H5J += G8z.u3U;
var S5J = l7d;
S5J += W9c;
S5J += P5N;
var z5J = G8z.T3U;
z5J += h9c;
var back = $[g8N][z5J] ? S5J : Q9c;
if (!field[N1N](F9c, e[E9c]) && $[H5J](node[G8z.I2U], $(e[r5J])[y5J]()[back]()) === -K2U) {
that[v7d]();
}
});
}, G8z.I2U);
that[p5J]([field], opts[x5J]);
that[P1d](d9c, S0N);
});
return this;
};
Editor[Z5J][l5J] = function(name, msg) {
var w9c = "_messa";
var A9c = "Info";
var U9c = "ssage";
if (msg === undefined) {
var d5J = S8d;
d5J += A9c;
var f5J = q8U;
f5J += L9N;
f5J += q9N;
var L5J = w9c;
L5J += q4N;
L5J += z8U;
this[L5J](this[f5J][d5J], name);
} else {
var J5J = q9N;
J5J += z8U;
J5J += U9c;
var m5J = S8U;
m5J += t7N;
m5J += q8U;
this[m5J](name)[J5J](msg);
}
return this;
};
Editor[O5J][q0N] = function(mode) {
var P9c = 'Not currently in an editing mode';
var T9c = " from create mode is not supported";
var i9c = "Changing";
var N5J = G8z.T3U;
N5J += t9c;
var q5J = c5U;
q5J += V9N;
q5J += M7N;
q5J += z8U;
var D5J = B9c;
D5J += o9c;
if (!mode) {
var a5J = G8z.T3U;
a5J += v9c;
a5J += L9N;
a5J += g8U;
return this[z9N][a5J];
}
if (!this[z9N][D5J]) {
throw new Error(P9c);
} else if (this[z9N][S7d] === q5J && mode !== C1N) {
var j5J = i9c;
j5J += T9c;
throw new Error(j5J);
}
this[z9N][N5J] = mode;
return this;
};
Editor[C5J][I5J] = function() {
var V9c = "fier";
var K5J = q9N;
K5J += L9N;
K5J += u4N;
K5J += V9c;
return this[z9N][K5J];
};
Editor[M1N][k5J] = function(fieldNames) {
var M9c = "Arra";
var R9c = "tiGet";
var h5J = q9N;
h5J += u9c;
h5J += R9c;
var e5J = H8U;
e5J += z9N;
e5J += M9c;
e5J += G8z.u3U;
var that = this;
if (fieldNames === undefined) {
fieldNames = this[a7d]();
}
if ($[e5J](fieldNames)) {
var G5J = z8U;
G5J += G8z.T3U;
G5J += c5U;
G5J += C9N;
var out = {};
$[G5J](fieldNames, function(i, name) {
var c9c = "multiGet";
var W5J = S8U;
W5J += L8U;
W5J += r8U;
W5J += q8U;
var b5J = G8z.u3U;
b5J += G8z.R3U;
G8z[b5J]();
out[name] = that[W5J](name)[c9c]();
});
return out;
}
return this[d8d](fieldNames)[h5J]();
};
Editor[Q5J][X9c] = function(fieldNames, val) {
var n6c = "Object";
var Y9c = "Plai";
var F5J = F2d;
F5J += Y9c;
F5J += g8U;
F5J += n6c;
var that = this;
if ($[F5J](fieldNames) && val === undefined) {
var E5J = Q1N;
E5J += r9N;
$[E5J](fieldNames, function(name, value) {
that[d8d](name)[X9c](value);
});
} else {
var A5J = t4N;
A5J += z8U;
A5J += e5U;
this[A5J](fieldNames)[X9c](val);
}
return this;
};
Editor[M1N][w5J] = function(name) {
var z6c = "orde";
var s6c = "rra";
var P5J = g8U;
P5J += L9N;
P5J += q8U;
P5J += z8U;
var v5J = e7N;
v5J += e5U;
var B5J = O5N;
B5J += D9N;
var t5J = H8U;
t5J += g6c;
t5J += s6c;
t5J += G8z.u3U;
var that = this;
if (!name) {
var U5J = z6c;
U5J += d5U;
name = this[U5J]();
}
return $[t5J](name) ? $[B5J](name, function(n) {
var o5J = e7N;
o5J += e5U;
return that[o5J](n)[r7d]();
}) : this[v5J](name)[P5J]();
};
Editor[M1N][o1d] = function(name, fn) {
var S6c = "eventName";
var i5J = G8U;
i5J += S6c;
$(this)[o1d](this[i5J](name), fn);
G8z[R2N]();
return this;
};
Editor[T5J][y3N] = function(name, fn) {
var r6c = "tName";
var u5J = g8U;
u5J += G8z.R3U;
var V5J = H6c;
V5J += r6c;
$(this)[y3N](this[V5J](name), fn);
G8z[u5J]();
return this;
};
Editor[M1N][y6c] = function(name, fn) {
var p6c = "_eventName";
$(this)[y6c](this[p6c](name), fn);
G8z[G8z.i3U]();
return this;
};
Editor[R5J][M5J] = function() {
var Z6c = "po";
var d6c = "Reg";
var q6c = "open";
var m6c = "splayReor";
var l6c = "sto";
var L6c = "preopen";
var x6c = "mai";
var Z9M = x6c;
Z9M += g8U;
var x9M = G8U;
x9M += Z6c;
x9M += l6c;
x9M += O6N;
var z9M = G8U;
z9M += L6c;
var X5J = f6c;
X5J += P7d;
X5J += d6c;
var c5J = F9d;
c5J += H8U;
c5J += m6c;
c5J += U3d;
var that = this;
this[c5J]();
this[X5J](function() {
var J6c = "displayCont";
var O6c = "roller";
var Y5J = J6c;
Y5J += O6c;
G8z[R2N]();
that[z9N][Y5J][b9d](that, function() {
var s9M = q9N;
s9M += G8z.T3U;
s9M += H8U;
s9M += g8U;
var g9M = T3d;
g9M += V3d;
var n9M = G8z.u3U;
n9M += G8z.R3U;
G8z[n9M]();
that[a6c]();
that[g9M](D6c, [s9M]);
});
});
var ret = this[z9M](f5d);
if (!ret) {
return this;
}
this[z9N][q9d][q6c](this, this[b1N][u9d], function() {
var N6c = "ned";
var p9M = O5N;
p9M += H8U;
p9M += g8U;
var y9M = j6c;
y9M += N6c;
var H9M = q9N;
H9M += G8z.T3U;
H9M += D9N;
var S9M = g8U;
S9M += G8z.R3U;
G8z[S9M]();
that[C6c]($[H9M](that[z9N][b7d], function(name) {
var r9M = G8z.u3U;
r9M += G8z.R3U;
G8z[r9M]();
return that[z9N][a7d][name];
}), that[z9N][I6c][o1N]);
that[K6c](y9M, [p9M, that[z9N][S7d]]);
});
this[x9M](Z9M, z0N);
return this;
};
Editor[M1N][l9M] = function(set) {
var h6c = "All fields, and no additional fields, must be provided for ordering.";
var k6c = "sor";
var G6c = "sort";
var D9M = L9N;
D9M += d5U;
D9M += i4N;
D9M += d5U;
var a9M = k6c;
a9M += m8U;
var O9M = r2N;
O9M += L9N;
O9M += H8U;
O9M += g8U;
var J9M = k4N;
J9M += e4N;
var f9M = F2d;
f9M += E9N;
f9M += V2d;
f9M += G8z.u3U;
if (!set) {
var L9M = L9N;
L9M += o6N;
return this[z9N][L9M];
}
if (arguments[U5N] && !$[f9M](set)) {
var m9M = c5U;
m9M += G8z.T3U;
m9M += e6c;
var d9M = F6N;
d9M += E4N;
set = Array[d9M][c1N][m9M](arguments);
}
if (this[z9N][J9M][c1N]()[G6c]()[O9M](b6c) !== set[c1N]()[a9M]()[W6c](b6c)) {
throw h6c;
}
$[A7N](this[z9N][D9M], set);
this[E7d]();
return this;
};
Editor[M1N][Z5N] = function(items, arg1, arg2, arg3, arg4) {
var U6c = "crudArgs";
var F6c = "Remo";
var w6c = "editFiel";
var A6c = "ctionClass";
var h9M = q8U;
h9M += G8z.T3U;
h9M += m8U;
h9M += G8z.T3U;
var W9M = G5N;
W9M += q8U;
W9M += z8U;
var b9M = Q6c;
b9M += F6c;
b9M += X3U;
var G9M = G8U;
G9M += E6c;
G9M += g8U;
G9M += m8U;
var e9M = X6N;
e9M += A6c;
var k9M = q8U;
k9M += L9N;
k9M += q9N;
var K9M = w6c;
K9M += z8d;
var I9M = d5U;
I9M += z8U;
I9M += q9N;
I9M += y5U;
var C9M = t8N;
C9M += g3N;
var N9M = G8U;
N9M += U6c;
var that = this;
if (this[X5d](function() {
var j9M = t6c;
j9M += B6c;
j9M += z8U;
var q9M = G8z.u3U;
q9M += G8z.R3U;
G8z[q9M]();
that[j9M](items, arg1, arg2, arg3, arg4);
})) {
return this;
}
if (items[U5N] === undefined) {
items = [items];
}
var argOpts = this[N9M](arg1, arg2, arg3, arg4);
var editFields = this[K7d](L5d, items);
this[z9N][C9M] = I9M;
this[z9N][H7d] = items;
this[z9N][K9M] = editFields;
this[k9M][S8d][f2d][H5N] = h8N;
this[e9M]();
this[G9M](b9M, [_pluck(editFields, W9M), _pluck(editFields, h9M), items], function() {
var v6c = 'initMultiRemove';
var F9M = G8U;
F9M += o6c;
F9M += V3d;
var Q9M = G8z.u3U;
Q9M += G8z.R3U;
G8z[Q9M]();
that[F9M](v6c, [editFields, items], function() {
var P6c = "cu";
var T6c = "eq";
that[L8d]();
that[f9c](argOpts[U1N]);
G8z[R2N]();
argOpts[D5d]();
var opts = that[z9N][I6c];
if (opts[o1N] !== I1N) {
var U9M = S8U;
U9M += L9N;
U9M += P6c;
U9M += z9N;
var w9M = O5U;
w9M += i6c;
w9M += z9N;
var A9M = q8U;
A9M += L9N;
A9M += q9N;
var E9M = s9c;
E9M += z9c;
E9M += g8U;
$(E9M, that[A9M][w9M])[T6c](opts[U9M])[o1N]();
}
});
});
return this;
};
Editor[M1N][t9M] = function(set, val) {
var V6c = "sPlain";
var u6c = "Obj";
var o9M = z8U;
o9M += G8z.T3U;
o9M += c5U;
o9M += C9N;
var B9M = H8U;
B9M += V6c;
B9M += u6c;
B9M += R8d;
var that = this;
G8z[G8z.i3U]();
if (!$[B9M](set)) {
var o = {};
o[set] = val;
set = o;
}
$[o9M](set, function(n, v) {
var v9M = z9N;
v9M += z8U;
v9M += m8U;
that[d8d](n)[v9M](v);
});
return this;
};
Editor[P9M][i9M] = function(names, animate) {
var M6c = "ldNa";
var R6c = "_fie";
var T9M = R6c;
T9M += M6c;
T9M += q9N;
T9M += y8U;
var that = this;
$[U2N](this[T9M](names), function(i, n) {
var u9M = K4N;
u9M += L9N;
u9M += R9N;
var V9M = S8U;
V9M += L8U;
V9M += e5U;
that[V9M](n)[u9M](animate);
});
return this;
};
Editor[R9M][i7d] = function(successCallback, errorCallback, formatdata, hide) {
var c6c = "_pr";
var c9M = c6c;
c9M += v5N;
c9M += f6N;
c9M += d6N;
var M9M = t8N;
M9M += g3N;
var that = this,
fields = this[z9N][a7d],
errorFields = [],
errorReady = G8z.I2U,
sent = z0N;
if (this[z9N][j1N] || !this[z9N][M9M]) {
return this;
}
this[c9M](S0N);
var send = function() {
var X6c = "nitS";
var n6M = H8U;
n6M += X6c;
n6M += d5N;
n6M += m8U;
var Y9M = G8U;
Y9M += Y6c;
var X9M = g8U;
X9M += G8z.R3U;
if (errorFields[U5N] !== errorReady || sent) {
return;
}
G8z[X9M]();
that[Y9M](n6M, [that[z9N][S7d]], function(result) {
var n4c = "_process";
var g4c = "_submit";
if (result === z0N) {
var g6M = n4c;
g6M += o8N;
that[g6M](z0N);
return;
}
sent = S0N;
that[g4c](successCallback, errorCallback, formatdata, hide);
});
};
this[I3N]();
$[U2N](fields, function(name, field) {
if (field[W5d]()) {
var s6M = D9N;
s6M += i8U;
s6M += K4N;
errorFields[s6M](name);
}
});
$[U2N](errorFields, function(i, name) {
var S6M = z8U;
S6M += B4N;
var z6M = G8z.u3U;
z6M += G8z.R3U;
G8z[z6M]();
fields[name][S6M](R7N, function() {
errorReady++;
send();
});
});
send();
return this;
};
Editor[H6M][r6M] = function(set) {
var y6M = g8U;
y6M += G8z.R3U;
G8z[y6M]();
if (set === undefined) {
return this[z9N][g5d];
}
this[z9N][g5d] = set === I1N ? I1N : $(set);
return this;
};
Editor[p6M][x6M] = function(title) {
var J6M = C9N;
J6M += m8U;
J6M += q9N;
J6M += r8U;
var d6M = G8z.u3U;
d6M += G8z.R3U;
var f6M = y5N;
f6M += g8U;
f6M += u9N;
f6M += c4N;
var L6M = C9N;
L6M += z8U;
L6M += E1d;
var l6M = q8U;
l6M += H8U;
l6M += E0N;
l6M += c8d;
var Z6M = F1N;
Z6M += q9N;
var header = $(this[Z6M][z7d])[e9d](l6M + this[l3N][L6M][f6M]);
if (title === undefined) {
return header[p8N]();
}
G8z[d6M]();
if (typeof title === G8z.M3U) {
var m6M = j7N;
m6M += O5U;
m6M += r8U;
m6M += z8U;
title = title(this, new DataTable[j5N](this[z9N][m6M]));
}
header[J6M](title);
return this;
};
Editor[M1N][O6M] = function(field, value) {
var s4c = "isPla";
var z4c = "inObje";
var D6M = G8z.u3U;
D6M += G8z.R3U;
var a6M = s4c;
a6M += z4c;
a6M += c5U;
a6M += m8U;
if (value !== undefined || $[a6M](field)) {
return this[S4c](field, value);
}
G8z[D6M]();
return this[k5d](field);
};
var apiRegister = DataTable[j5N][q6M];
function __getInst(api) {
var p4c = "_editor";
var N6M = L9N;
N6M += H4c;
N6M += r4c;
N6M += m8U;
var j6M = s0d;
j6M += m8U;
j6M += d8U;
j6M += m8U;
var ctx = api[j6M][G8z.I2U];
return ctx[N6M][y4c] || ctx[p4c];
}
function __setBasic(inst, opts, type, plural) {
var O4c = /%d/;
var a4c = '1';
var I6M = m8U;
I6M += x4c;
I6M += z8U;
G8z[R2N]();
if (!opts) {
opts = {};
}
if (opts[w1d] === undefined) {
var C6M = s9c;
C6M += m8U;
C6M += q9c;
opts[C6M] = Z4c;
}
if (opts[I6M] === undefined) {
var K6M = H8U;
K6M += l4c;
opts[Q1d] = inst[K6M][type][Q1d];
}
if (opts[W1d] === undefined) {
if (type === L4c) {
var G6M = f4c;
G6M += d4c;
var e6M = q9N;
e6M += z8U;
e6M += b5N;
e6M += m4c;
var k6M = H8U;
k6M += e5N;
k6M += f3d;
var confirm = inst[k6M][type][J4c];
opts[e6M] = plural !== K2U ? confirm[G8U][G6M](O4c, plural) : confirm[a4c];
} else {
var b6M = e8U;
b6M += z9N;
b6M += R4N;
b6M += t8d;
opts[b6M] = R7N;
}
}
return opts;
}
apiRegister(W6M, function() {
var h6M = g8U;
h6M += G8z.R3U;
G8z[h6M]();
return __getInst(this);
});
apiRegister(D4c, function(opts) {
var Q6M = c5U;
Q6M += d5U;
Q6M += m5U;
var inst = __getInst(this);
G8z[R2N]();
inst[Q6M](__setBasic(inst, opts, C1N));
return this;
});
apiRegister(F6M, function(opts) {
var A6M = z8U;
A6M += q8U;
A6M += H8U;
A6M += m8U;
var E6M = z8U;
E6M += l5U;
var inst = __getInst(this);
inst[E6M](this[G8z.I2U][G8z.I2U], __setBasic(inst, opts, A6M));
return this;
});
apiRegister(w6M, function(opts) {
var inst = __getInst(this);
G8z[R2N]();
inst[r5d](this[G8z.I2U], __setBasic(inst, opts, q4c));
return this;
});
apiRegister(U6M, function(opts) {
var t6M = W3N;
t6M += E0N;
t6M += z8U;
var inst = __getInst(this);
inst[t6M](this[G8z.I2U][G8z.I2U], __setBasic(inst, opts, L4c, K2U));
return this;
});
apiRegister(j4c, function(opts) {
var inst = __getInst(this);
inst[Z5N](this[G8z.I2U], __setBasic(inst, opts, L4c, this[G8z.I2U][U5N]));
return this;
});
apiRegister(N4c, function(type, opts) {
var C4c = "isPl";
var v6M = C4c;
v6M += o5d;
var B6M = G8z.u3U;
B6M += G8z.R3U;
G8z[B6M]();
if (!type) {
var o6M = w5d;
o6M += H8U;
o6M += s2d;
type = o6M;
} else if ($[v6M](type)) {
var P6M = H8U;
P6M += g8U;
P6M += F5d;
opts = type;
type = P6M;
}
__getInst(this)[type](this[G8z.I2U][G8z.I2U], opts);
return this;
});
apiRegister(I4c, function(opts) {
var K4c = "bub";
var T6M = K4c;
T6M += g5U;
var i6M = g8U;
i6M += G8z.R3U;
G8z[i6M]();
__getInst(this)[T6M](this[G8z.I2U], opts);
return this;
});
apiRegister(V6M, _api_file);
apiRegister(k4c, _api_files);
$(document)[y3N](e4c, function(e, ctx, json) {
var G4c = "ile";
var b4c = "mesp";
var M6M = S8U;
M6M += G4c;
M6M += z9N;
var R6M = q8U;
R6M += m8U;
var u6M = g8U;
u6M += G8z.T3U;
u6M += b4c;
u6M += d4c;
if (e[u6M] !== R6M) {
return;
}
if (json && json[M6M]) {
$[U2N](json[T2N], function(name, files) {
var Y6M = d8U;
Y6M += m8U;
Y6M += z8U;
Y6M += H9N;
var X6M = G8z.u3U;
X6M += G8z.R3U;
var c6M = t4N;
c6M += r8U;
c6M += z8U;
c6M += z9N;
if (!Editor[c6M][name]) {
Editor[T2N][name] = {};
}
G8z[X6M]();
$[Y6M](Editor[T2N][name], files);
});
}
});
Editor[n4M] = function(msg, tn) {
var W4c = ' For more information, please refer to https://datatables.net/tn/';
G8z[G8z.i3U]();
throw tn ? msg + W4c + tn : msg;
};
Editor[g4M] = function(data, props, fn) {
var h4c = 'label';
var Q4c = "isPlainO";
var z4M = E0N;
z4M += G8z.T3U;
z4M += C8N;
var s4M = z8U;
s4M += m9N;
s4M += q8U;
var i, ien, dataPoint;
G8z[R2N]();
props = $[s4M]({
label: h4c,
value: z4M
}, props);
if ($[f7d](data)) {
for (i = G8z.I2U, ien = data[U5N]; i < ien; i++) {
var S4M = Q4c;
S4M += T8d;
dataPoint = data[i];
if ($[S4M](dataPoint)) {
var r4M = E0N;
r4M += k8d;
r4M += F4c;
var H4M = E0N;
H4M += G8z.T3U;
H4M += C8N;
fn(dataPoint[props[H4M]] === undefined ? dataPoint[props[H1N]] : dataPoint[props[r4M]], dataPoint[props[H1N]], i, dataPoint[N3d]);
} else {
fn(dataPoint, dataPoint, i);
}
}
} else {
var y4M = z8U;
y4M += G8z.T3U;
y4M += c5U;
y4M += C9N;
i = G8z.I2U;
$[y4M](data, function(key, val) {
fn(val, key, i);
i++;
});
}
};
Editor[E4c] = function(id) {
var p4M = f4c;
p4M += d4c;
return id[p4M](/\./g, b6c);
};
Editor[x4M] = function(editor, conf, files, progressCallback, completeCallback) {
var E2c = "_limitLeft";
var U4c = "URL";
var t4c = "unc";
var P4c = "<i>Uploading file</i>";
var w4c = "AsDa";
var B4c = "A server error occurred while uploading";
var v4c = "fileReadText";
var A4c = "read";
var o4c = " the file";
var i4c = "onload";
var S2M = A4c;
S2M += w4c;
S2M += j7N;
S2M += U4c;
var z2M = q9N;
z2M += o9d;
var Z4M = S8U;
Z4M += t4c;
Z4M += g3N;
var reader = new FileReader();
var counter = G8z.I2U;
var ids = [];
var generalError = B4c;
generalError += o4c;
editor[I3N](conf[P7N], R7N);
if (typeof conf[A7d] === Z4M) {
conf[A7d](files, function(ids) {
var l4M = c5U;
l4M += k8d;
l4M += r8U;
completeCallback[l4M](editor, ids);
});
return;
}
progressCallback(conf, conf[v4c] || P4c);
reader[i4c] = function(e) {
var p2c = "L";
var X4c = 'uploadField';
var S2c = 'preUpload';
var H2c = "readAs";
var z2c = 'Upload feature cannot use `ajax.data` with an object. Please use it as a function instead.';
var r2c = "DataU";
var Y4c = "ajaxData";
var x2c = 'preSubmit.DTE_Upload';
var Z2c = 'post';
var y2c = "R";
var s2c = 'No Ajax option specified for upload plug-in';
var V4c = "jax";
var n2c = "up";
var I4M = T4c;
I4M += E0N;
I4M += X2N;
I4M += m8U;
var C4M = U7d;
C4M += t7d;
C4M += m8U;
C4M += o9c;
var N4M = q8U;
N4M += G8z.T3U;
N4M += m8U;
N4M += G8z.T3U;
var j4M = z9N;
j4M += A3d;
j4M += d6N;
var q4M = G8z.T3U;
q4M += V4c;
var J4M = u4c;
J4M += G8z.T3U;
J4M += g4N;
var m4M = i8U;
m4M += y2N;
m4M += R4c;
var d4M = G8z.T3U;
d4M += j9c;
var f4M = G8z.T3U;
f4M += i6d;
f4M += z8U;
f4M += H9N;
var L4M = M4c;
L4M += R4c;
var data = new FormData();
var ajax;
data[G9d](c4c, L4M);
data[f4M](X4c, conf[P7N]);
data[d4M](m4M, files[counter]);
if (conf[Y4c]) {
conf[Y4c](data, files[counter], counter);
}
G8z[G8z.i3U]();
if (conf[J4M]) {
ajax = conf[A7d];
} else if ($[G8N](editor[z9N][A7d])) {
var D4M = G8z.T3U;
D4M += r2N;
D4M += G8z.T3U;
D4M += g4N;
var a4M = G8z.T3U;
a4M += r2N;
a4M += G8z.T3U;
a4M += g4N;
var O4M = n2c;
O4M += y4N;
O4M += p4N;
ajax = editor[z9N][A7d][O4M] ? editor[z9N][a4M][g2c] : editor[z9N][D4M];
} else if (typeof editor[z9N][q4M] === j4M) {
ajax = editor[z9N][A7d];
}
if (!ajax) {
throw new Exception(s2c);
}
if (typeof ajax === q3d) {
ajax = {
url: ajax
};
}
if (typeof ajax[N4M] === C4M) {
var d = {};
var ret = ajax[u7N](d);
if (ret !== undefined && typeof ret !== q3d) {
d = ret;
}
$[U2N](d, function(key, value) {
data[G9d](key, value);
});
} else if ($[G8N](ajax[u7N])) {
throw new Exception(z2c);
}
var preRet = editor[I4M](S2c, [conf[P7N], files[counter], data]);
if (preRet === z0N) {
if (counter < files[U5N] - K2U) {
var K4M = H2c;
K4M += r2c;
K4M += y2c;
K4M += p2c;
counter++;
reader[K4M](files[counter]);
} else {
completeCallback[X1N](editor, ids);
}
return;
}
var submit = z0N;
editor[y3N](x2c, function() {
submit = S0N;
return z0N;
});
$[A7d]($[A7N]({}, ajax, {
type: Z2c,
data: data,
dataType: j8d,
contentType: z0N,
processData: z0N,
xhr: function() {
var f2c = "nprogre";
var L2c = "pload";
var l2c = "ajaxSettings";
var j2c = "onloadend";
var e4M = M4c;
e4M += L9N;
e4M += G8z.T3U;
e4M += q8U;
var k4M = g4N;
k4M += C9N;
k4M += d5U;
var xhr = $[l2c][k4M]();
if (xhr[e4M]) {
var A4M = i8U;
A4M += L2c;
var b4M = L9N;
b4M += f2c;
b4M += z9N;
b4M += z9N;
var G4M = n2c;
G4M += y4N;
G4M += G8z.T3U;
G4M += q8U;
xhr[G4M][b4M] = function(e) {
var J2c = "oa";
var d2c = "gthCompu";
var m2c = "Fixed";
var a2c = "total";
var D2c = "%";
var q2c = ':';
var O2c = "ded";
var h4M = d7d;
h4M += d2c;
h4M += N5N;
var W4M = g8U;
W4M += G8z.R3U;
G8z[W4M]();
if (e[h4M]) {
var E4M = r8U;
E4M += z8U;
E4M += w3N;
var F4M = U4N;
F4M += m2c;
var Q4M = r8U;
Q4M += J2c;
Q4M += O2c;
var percent = (e[Q4M] / e[a2c] * n0U)[F4M](G8z.I2U) + D2c;
progressCallback(conf, files[E4M] === K2U ? percent : counter + q2c + files[U5N] + s1N + percent);
}
};
xhr[A4M][j2c] = function(e) {
var C2c = "processingText";
var N2c = "Proces";
var U4M = N2c;
U4M += L3d;
U4M += d6N;
var w4M = g8U;
w4M += G8z.R3U;
G8z[w4M]();
progressCallback(conf, conf[C2c] || U4M);
};
}
return xhr;
},
success: function(json) {
var k2c = "rSuc";
var K2c = "uploadXh";
var I2c = "uplo";
var b2c = "load";
var G2c = "Submit.DTE_Up";
var h2c = "readAsDataURL";
var T4M = I2c;
T4M += G8z.T3U;
T4M += q8U;
var i4M = I2c;
i4M += G8z.T3U;
i4M += q8U;
var P4M = z8U;
P4M += e8N;
P4M += L9N;
P4M += d5U;
var B4M = K2c;
B4M += k2c;
B4M += c5U;
B4M += e2c;
var t4M = b3d;
t4M += G2c;
t4M += b2c;
editor[o1d](t4M);
editor[K6c](B4M, [conf[P7N], json]);
if (json[W2c] && json[W2c][U5N]) {
var o4M = r8U;
o4M += z8U;
o4M += w3N;
var errors = json[W2c];
for (var i = G8z.I2U, ien = errors[o4M]; i < ien; i++) {
var v4M = z9N;
v4M += j7N;
v4M += m8U;
v4M += x2N;
editor[I3N](errors[i][P7N], errors[i][v4M]);
}
} else if (json[P4M]) {
editor[I3N](json[I3N]);
} else if (!json[i4M] || !json[T4M][A4N]) {
var V4M = x7N;
V4M += z8U;
editor[I3N](conf[V4M], generalError);
} else {
var n2M = v9N;
n2M += u1d;
n2M += C9N;
var Y4M = M4c;
Y4M += L9N;
Y4M += G8z.T3U;
Y4M += q8U;
var u4M = S8U;
u4M += T6d;
u4M += z8U;
u4M += z9N;
if (json[u4M]) {
var R4M = Q1N;
R4M += r9N;
$[R4M](json[T2N], function(table, files) {
var X4M = t4N;
X4M += r8U;
X4M += z8U;
X4M += z9N;
var c4M = G8z.u3U;
c4M += G8z.R3U;
var M4M = t4N;
M4M += r8U;
M4M += y8U;
if (!Editor[M4M][table]) {
Editor[T2N][table] = {};
}
G8z[c4M]();
$[A7N](Editor[X4M][table], files);
});
}
ids[c2N](json[Y4M][A4N]);
if (counter < files[n2M] - K2U) {
counter++;
reader[h2c](files[counter]);
} else {
completeCallback[X1N](editor, ids);
if (submit) {
var g2M = z9N;
g2M += Q2c;
editor[g2M]();
}
}
}
progressCallback(conf);
},
error: function(xhr) {
var F2c = 'uploadXhrError';
var s2M = g8U;
s2M += G8z.T3U;
s2M += e8U;
G8z[R2N]();
editor[K6c](F2c, [conf[P7N], xhr]);
editor[I3N](conf[s2M], generalError);
progressCallback(conf);
}
}));
};
files = $[z2M](files, function(val) {
return val;
});
if (conf[E2c] !== undefined) {
files[B3d](conf[E2c], files[U5N]);
}
reader[S2M](files[G8z.I2U]);
};
Editor[M1N][H2M] = function(init) {
var I0c = "axU";
var v0c = "dataT";
var O0c = "gacyAj";
var g7c = "unique";
var S0c = "<div data-dte-e=\"body_content\" cla";
var r0c = "<div data-dte-e=\"body\" cla";
var U2c = "dataTa";
var x7c = 'initComplete';
var c2c = "</for";
var p0c = "an/>";
var c0c = "bodyContent";
var N0c = "aSour";
var P2c = "e=\"head\" class=\"";
var A2c = "cessin";
var w0c = '"><div class="';
var R2c = "<div data-dte-e";
var l7c = 'initEditor';
var Y2c = "<div data-dte-e=\"form_content\" cl";
var i2c = "inf";
var m0c = "templa";
var W0c = "domTable";
var g0c = "<form data-dte-e=\"form\" clas";
var d0c = "exten";
var t2c = "\"/>";
var w2c = "rocess";
var X0c = 'body_content';
var y0c = "\"><sp";
var x0c = "ces";
var L0c = "tting";
var o2c = "hea";
var v2c = "<div data-dte-";
var D0c = "dataS";
var l0c = "que";
var e0c = "tin";
var a0c = "tml";
var T2c = "<div data-dte-e=\"form_info\"";
var B0c = "BUTTON";
var U0c = '<div data-dte-e="form_buttons" class="';
var X2c = "m>";
var s0c = "ta-dte-e=\"foot\" class=\"";
var f0c = "sses";
var z7c = 'xhr.dt.dte';
var u0c = "events";
var E0c = "indicator";
var M0c = 'form_content';
var M2c = "=\"form_error\" class=\"";
var F0c = '<div data-dte-e="processing" class="';
var J0c = "empl";
var B2c = "wrappe";
var o0c = "leTools";
var j0c = "dataTabl";
var n7c = 'init.dt.dte';
var W0M = O4d;
W0M += H8U;
W0M += p1d;
W0M += F4c;
var K0M = L9N;
K0M += g8U;
var N0M = m6N;
N0M += A2c;
N0M += q4N;
var j0M = D9N;
j0M += w2c;
j0M += o8N;
var q0M = S8U;
q0M += L9N;
q0M += v6N;
var D0M = S8U;
D0M += L9N;
D0M += d5U;
D0M += q9N;
var H0M = U2c;
H0M += n7d;
H0M += z8U;
var S0M = S8U;
S0M += g8U;
var z0M = t2c;
z0M += d9d;
var s0M = u0d;
s0M += c4N;
var g0M = F1d;
g0M += E1d;
var n0M = B2c;
n0M += d5U;
var Y2M = o2c;
Y2M += q8U;
Y2M += e4N;
var X2M = v2c;
X2M += P2c;
var c2M = i2c;
c2M += L9N;
var M2M = T2c;
M2M += V2c;
var R2M = E2N;
R2M += u2c;
var u2M = R2c;
u2M += M2c;
var V2M = c2c;
V2M += X2c;
var T2M = c5U;
T2M += L9N;
T2M += M4d;
T2M += c4N;
var i2M = Y2c;
i2M += x9c;
var P2M = m8U;
P2M += G8z.T3U;
P2M += q4N;
var v2M = n0c;
v2M += q9N;
var o2M = g0c;
o2M += y9c;
var B2M = e0N;
B2M += G0N;
var t2M = J3N;
t2M += X2N;
t2M += m8U;
var U2M = w0N;
U2M += s0c;
var w2M = z0c;
w2M += h0N;
var A2M = O5U;
A2M += L9N;
A2M += q8U;
A2M += G8z.u3U;
var E2M = S0c;
E2M += H0c;
var F2M = r0c;
F2M += H0c;
var Q2M = y0c;
Q2M += p0c;
Q2M += I0N;
Q2M += C0N;
var h2M = H6N;
h2M += L9N;
h2M += x0c;
h2M += Z0c;
var W2M = B9d;
W2M += G8z.T3U;
W2M += u2d;
var b2M = q8U;
b2M += L9N;
b2M += q9N;
var G2M = C2d;
G2M += E5d;
var e2M = i8U;
e2M += r4c;
e2M += l0c;
var k2M = z9N;
k2M += z8U;
k2M += L0c;
k2M += z9N;
var K2M = g9N;
K2M += s9N;
K2M += z9N;
var I2M = H8U;
I2M += J8U;
I2M += g8U;
var C2M = Q7N;
C2M += f3d;
var N2M = C2d;
N2M += G8z.T3U;
N2M += f0c;
var j2M = d0c;
j2M += q8U;
var q2M = I5N;
q2M += z9N;
q2M += z8U;
q2M += z9N;
var D2M = q8U;
D2M += i9N;
D2M += G8z.T3U;
D2M += r9N;
var a2M = m0c;
a2M += u9N;
var O2M = m8U;
O2M += J0c;
O2M += C8d;
var J2M = v9N;
J2M += O0c;
J2M += G8z.T3U;
J2M += g4N;
var m2M = C9N;
m2M += a0c;
var d2M = D0c;
d2M += K0d;
d2M += q0c;
d2M += y8U;
var f2M = j0c;
f2M += z8U;
var L2M = q8U;
L2M += M7N;
L2M += N0c;
L2M += x0c;
var l2M = C0c;
l2M += z8U;
var Z2M = u4c;
Z2M += I0c;
Z2M += K0c;
var x2M = m8U;
x2M += k0c;
x2M += v9N;
var p2M = v8U;
p2M += m8U;
p2M += e0c;
p2M += n8d;
var y2M = S9N;
y2M += g8U;
y2M += q8U;
var r2M = z8U;
r2M += t5d;
r2M += H9N;
init = $[r2M](S0N, {}, Editor[G0c], init);
this[z9N] = $[y2M](S0N, {}, Editor[s9d][p2M], {
actionName: init[b0c],
table: init[W0c] || init[x2M],
dbTable: init[h0c] || I1N,
ajaxUrl: init[Z2M],
ajax: init[A7d],
idSrc: init[Q0c],
dataSource: init[W0c] || init[l2M] ? Editor[L2M][f2M] : Editor[d2M][m2M],
formOptions: init[r9d],
legacyAjax: init[J2M],
template: init[O2M] ? $(init[a2M])[D2M]() : I1N
});
this[q2M] = $[j2M](S0N, {}, Editor[N2M]);
this[C2M] = init[I2M];
Editor[K2M][k2M][e2M]++;
var that = this;
var classes = this[G2M];
this[b2M] = {
"wrapper": $(g1N + classes[W2M] + z1N + F0c + classes[h2M][E0c] + Q2M + F2M + classes[S0d][u9d] + z1N + E2M + classes[A2M][V9d] + a9c + w2M + U2M + classes[A0c][u9d] + z1N + g1N + classes[A0c][t2M] + a9c + B2M + p1N)[G8z.I2U],
"form": $(o2M + classes[v2M][P2M] + z1N + i2M + classes[S8d][T2M] + a9c + V2M)[G8z.I2U],
"formError": $(u2M + classes[S8d][I3N] + R2M)[G8z.I2U],
"formInfo": $(M2M + classes[S8d][c2M] + a9c)[G8z.I2U],
"header": $(X2M + classes[Y2M][n0M] + w0c + classes[g0M][s0M] + z0M)[G8z.I2U],
"buttons": $(U0c + classes[S8d][w1d] + a9c)[G8z.I2U]
};
if ($[S0M][H0M][t0c]) {
var f0M = V9N;
f0M += g9N;
f0M += X3U;
var L0M = z8U;
L0M += q8U;
L0M += H8U;
L0M += m8U;
var l0M = Q1N;
l0M += c5U;
l0M += C9N;
var Z0M = H8U;
Z0M += e5N;
Z0M += F7N;
Z0M += g8U;
var x0M = B0c;
x0M += j9N;
var p0M = N9N;
p0M += k0c;
p0M += o0c;
var y0M = v0c;
y0M += P0c;
var r0M = S8U;
r0M += g8U;
var ttButtons = $[r0M][y0M][p0M][x0M];
var i18n = this[Z0M];
$[l0M]([C1N, L0M, f0M], function(i, val) {
var i0c = "sButto";
var T0c = "nTex";
var V0c = 'editor_';
var d0M = i0c;
d0M += T0c;
d0M += m8U;
G8z[R2N]();
ttButtons[V0c + val][d0M] = i18n[val][H9d];
});
}
$[U2N](init[u0c], function(evt, fn) {
var J0M = L9N;
J0M += g8U;
var m0M = G8z.u3U;
m0M += G8z.R3U;
G8z[m0M]();
that[J0M](evt, function() {
var a0M = z9N;
a0M += C9N;
a0M += H8U;
a0M += R1N;
var O0M = g8U;
O0M += G8z.R3U;
var args = Array[M1N][c1N][X1N](arguments);
G8z[O0M]();
args[a0M]();
fn[Y1N](that, args);
});
});
var dom = this[b1N];
var wrapper = dom[u9d];
dom[R0c] = _editor_el(M0c, dom[D0M])[G8z.I2U];
dom[A0c] = _editor_el(q0M, wrapper)[G8z.I2U];
dom[S0d] = _editor_el(P6d, wrapper)[G8z.I2U];
dom[c0c] = _editor_el(X0c, wrapper)[G8z.I2U];
dom[j0M] = _editor_el(N0M, wrapper)[G8z.I2U];
if (init[a7d]) {
var I0M = S8U;
I0M += H8U;
I0M += v3d;
var C0M = G8z.T3U;
C0M += Y0c;
this[C0M](init[I0M]);
}
$(document)[K0M](n7c + this[z9N][g7c], function(e, settings, json) {
var s7c = "Table";
var G0M = g8U;
G0M += s7c;
var e0M = j7N;
e0M += g5U;
var k0M = G8z.u3U;
k0M += G8z.R3U;
G8z[k0M]();
if (that[z9N][e0M] && settings[G0M] === $(that[z9N][N5N])[k5d](G8z.I2U)) {
var b0M = G8U;
b0M += r5d;
b0M += L9N;
b0M += d5U;
settings[b0M] = that;
}
})[y3N](z7c + this[z9N][W0M], function(e, settings, json) {
var S7c = "nTable";
var h0M = j7N;
h0M += g5U;
if (json && that[z9N][N5N] && settings[S7c] === $(that[z9N][h0M])[k5d](G8z.I2U)) {
that[H7c](json);
}
});
try {
var F0M = q8U;
F0M += F2d;
F0M += y2N;
F0M += p2N;
var Q0M = l9d;
Q0M += D9N;
Q0M += R7d;
Q0M += G8z.u3U;
this[z9N][q9d] = Editor[Q0M][init[F0M]][Q6c](this);
} catch (e) {
var p7c = "controller ";
var y7c = "ay ";
var r7c = "Cannot find displ";
var E0M = r7c;
E0M += y7c;
E0M += p7c;
throw E0M + init[H5N];
}
this[K6c](x7c, []);
$(document)[Z7c](l7c, [this]);
};
Editor[M1N][A0M] = function() {
var m7c = "emoveClas";
var J7c = "apper";
var O7c = "actions";
var u0M = W3N;
u0M += X3U;
var T0M = z8U;
T0M += q8U;
T0M += H8U;
T0M += m8U;
var i0M = L7c;
i0M += z8U;
i0M += G8z.T3U;
i0M += u9N;
var P0M = r2N;
P0M += f7c;
var v0M = V9N;
v0M += g9N;
v0M += X3U;
var o0M = d7c;
o0M += m8U;
var B0M = d5U;
B0M += m7c;
B0M += z9N;
var t0M = R9N;
t0M += d5U;
t0M += J7c;
var U0M = G8z.T3U;
U0M += c5U;
U0M += m8U;
U0M += o9c;
var w0M = c5U;
w0M += j3N;
w0M += y8U;
var classesActions = this[w0M][O7c];
var action = this[z9N][U0M];
var wrapper = $(this[b1N][t0M]);
wrapper[B0M]([classesActions[i3d], classesActions[o0M], classesActions[v0M]][P0M](s1N));
if (action === i0M) {
wrapper[Z3N](classesActions[i3d]);
} else if (action === T0M) {
var V0M = a4N;
V0M += l6N;
wrapper[Z3N](classesActions[V0M]);
} else if (action === u0M) {
var M0M = d5U;
M0M += a7c;
var R0M = G8z.T3U;
R0M += Y0c;
R0M += D7c;
wrapper[R0M](classesActions[M0M]);
}
};
Editor[c0M][X0M] = function(data, success, error, submitParams) {
var B7c = 'idSrc';
var V7c = "plit";
var k7c = "isPlain";
var Y7c = "complete";
var H1c = '?';
var o7c = ',';
var u7c = "compl";
var G7c = "js";
var j7c = "Body";
var T7c = /_id_/;
var g1c = "hift";
var K7c = "LETE";
var N7c = "delete";
var I7c = "DE";
var M7c = "com";
var e7c = "Ob";
var s1c = "url";
var C7c = "Bo";
var i7c = "lit";
var t7M = G8z.T3U;
t7M += r2N;
t7M += G8z.T3U;
t7M += g4N;
var F7M = s9N;
F7M += q7c;
F7M += j7c;
var Q7M = N7c;
Q7M += C7c;
Q7M += n6N;
var h7M = I7c;
h7M += K7c;
var W7M = Y9N;
W7M += y6N;
var e7M = N7N;
e7M += j7N;
var k7M = i8U;
k7M += K0c;
var l7M = S8U;
l7M += O4d;
l7M += v9c;
l7M += y3N;
var Z7M = k7c;
Z7M += e7c;
Z7M += s0N;
var p7M = W3N;
p7M += X3U;
var y7M = z8U;
y7M += q8U;
y7M += H8U;
y7M += m8U;
var g7M = G7c;
g7M += L9N;
g7M += g8U;
var n7M = C7N;
n7M += H2d;
n7M += j9N;
n7M += N9N;
var Y0M = G8z.T3U;
Y0M += v9c;
Y0M += L9N;
Y0M += g8U;
var that = this;
var action = this[z9N][Y0M];
var thrown;
var opts = {
type: n7M,
dataType: g7M,
data: I1N,
error: [function(xhr, text, err) {
thrown = err;
}],
success: [],
complete: [function(xhr, text) {
var W7c = "nseText";
var F7c = "respons";
var g0U = 204;
var h7c = "statu";
var b7c = "spo";
var Q7c = "arseJS";
var w7c = "responseText";
var A7c = "responseJSON";
var E7c = "eJSON";
var S7M = g8U;
S7M += i8U;
S7M += r8U;
S7M += r8U;
var z7M = d5U;
z7M += z8U;
z7M += b7c;
z7M += W7c;
var s7M = h7c;
s7M += z9N;
var json = I1N;
if (xhr[s7M] === g0U || xhr[z7M] === S7M) {
json = {};
} else {
try {
var r7M = D9N;
r7M += Q7c;
r7M += H2d;
r7M += I9N;
var H7M = F7c;
H7M += E7c;
json = xhr[A7c] ? xhr[H7M] : $[r7M](xhr[w7c]);
} catch (e) {}
}
if ($[G8N](json) || $[f7d](json)) {
success(json, xhr[U7c] >= s0U, xhr);
} else {
error(xhr, text, thrown);
}
}]
};
var a;
var ajaxSrc = this[z9N][A7d] || this[z9N][t7c];
var id = action === y7M || action === p7M ? _pluck(this[z9N][e7d], B7c) : I1N;
if ($[f7d](id)) {
var x7M = r2N;
x7M += L9N;
x7M += H8U;
x7M += g8U;
id = id[x7M](o7c);
}
if ($[Z7M](ajaxSrc) && ajaxSrc[action]) {
ajaxSrc = ajaxSrc[action];
}
if (typeof ajaxSrc === l7M) {
var uri = I1N;
var method = I1N;
if (this[z9N][t7c]) {
var d7M = f4c;
d7M += G8z.T3U;
d7M += c5U;
d7M += z8U;
var L7M = v7c;
L7M += M7N;
L7M += z8U;
var url = this[z9N][t7c];
if (url[L7M]) {
uri = url[action];
}
if (uri[P7c](s1N) !== -K2U) {
var f7M = z9N;
f7M += D9N;
f7M += i7c;
a = uri[f7M](s1N);
method = a[G8z.I2U];
uri = a[K2U];
}
uri = uri[d7M](T7c, id);
}
ajaxSrc(method, uri, data, success, error);
return;
} else if (typeof ajaxSrc === q3d) {
if (ajaxSrc[P7c](s1N) !== -K2U) {
var J7M = i8U;
J7M += d5U;
J7M += r8U;
var m7M = z9N;
m7M += V7c;
a = ajaxSrc[m7M](s1N);
opts[j6N] = a[G8z.I2U];
opts[J7M] = a[K2U];
} else {
var O7M = i8U;
O7M += d5U;
O7M += r8U;
opts[O7M] = ajaxSrc;
}
} else {
var K7M = z8U;
K7M += m9N;
K7M += q8U;
var N7M = e4N;
N7M += d5U;
N7M += Y5U;
var D7M = u7c;
D7M += q7c;
var a7M = z8U;
a7M += R7c;
a7M += X2N;
a7M += q8U;
var optsCopy = $[a7M]({}, ajaxSrc || {});
if (optsCopy[D7M]) {
var j7M = M7c;
j7M += D9N;
j7M += v9N;
j7M += u9N;
var q7M = c5U;
q7M += c7c;
opts[q7M][X7c](optsCopy[j7M]);
delete optsCopy[Y7c];
}
if (optsCopy[N7M]) {
var I7M = n1c;
I7M += Y5U;
var C7M = O4d;
C7M += z9N;
C7M += g1c;
opts[I3N][C7M](optsCopy[I3N]);
delete optsCopy[I7M];
}
opts = $[K7M]({}, opts, optsCopy);
}
opts[k7M] = opts[s1c][v8N](T7c, id);
if (opts[e7M]) {
var b7M = z1c;
b7M += c5U;
b7M += g3N;
var G7M = N7N;
G7M += m8U;
G7M += G8z.T3U;
var isFn = typeof opts[G7M] === b7M;
var newData = isFn ? opts[u7N](data) : opts[u7N];
data = isFn && newData ? newData : $[A7N](S0N, data, newData);
}
opts[u7N] = data;
if (opts[W7M] === h7M && (opts[Q7M] === undefined || opts[F7M] === S0N)) {
var U7M = q8U;
U7M += G8z.T3U;
U7M += m8U;
U7M += G8z.T3U;
var w7M = f4d;
w7M += S1c;
var A7M = i8U;
A7M += d5U;
A7M += r8U;
var E7M = D9N;
E7M += Y4N;
E7M += G8z.T3U;
E7M += q9N;
var params = $[E7M](opts[u7N]);
opts[s1c] += opts[A7M][w7M](H1c) === -K2U ? H1c + params : T8N + params;
delete opts[U7M];
}
$[t7M](opts);
};
Editor[M1N][B7M] = function(target, style, time, callback) {
var v7M = S8U;
v7M += g8U;
var o7M = G8z.u3U;
o7M += G8z.R3U;
G8z[o7M]();
if ($[v7M][l0d]) {
target[r1c]()[l0d](style, time, callback);
} else {
var P7M = c5U;
P7M += b5N;
target[P7M](style);
if (typeof time === G8z.M3U) {
var i7M = c5U;
i7M += G8z.T3U;
i7M += r8U;
i7M += r8U;
time[i7M](target);
} else if (callback) {
callback[X1N](target);
}
}
};
Editor[T7M][V7M] = function() {
var Z1c = "formEr";
var p1c = "bod";
var y1c = "mIn";
var z1M = S8U;
z1M += L9N;
z1M += d5U;
z1M += q9N;
var s1M = o9d;
s1M += D9N;
s1M += O6d;
var g1M = C5U;
g1M += d5U;
g1M += y1c;
g1M += C5U;
var n1M = J6d;
n1M += X2N;
n1M += q8U;
var Y7M = p1c;
Y7M += G8z.u3U;
Y7M += v5U;
var X7M = O5U;
X7M += x1c;
X7M += L9N;
X7M += V1N;
var c7M = Z9c;
c7M += H9N;
var M7M = Z1c;
M7M += d5U;
M7M += Y5U;
var R7M = G8z.T3U;
R7M += D9N;
R7M += y6N;
R7M += H9N;
var u7M = q8U;
u7M += L9N;
u7M += q9N;
var dom = this[u7M];
$(dom[u9d])[k1N](dom[z7d]);
$(dom[A0c])[R7M](dom[M7M])[c7M](dom[X7M]);
$(dom[Y7M])[n1M](dom[g1M])[s1M](dom[z1M]);
};
Editor[S1M][l1c] = function() {
var J1c = 'preBlur';
var d1c = "B";
var m1c = "lur";
var L1c = "nct";
var x1M = c5U;
x1M += r8U;
x1M += L9N;
x1M += v8U;
var y1M = U7d;
y1M += L1c;
y1M += o9c;
var r1M = T4c;
r1M += f1c;
var H1M = y3N;
H1M += d1c;
H1M += m1c;
var opts = this[z9N][I6c];
var onBlur = opts[H1M];
if (this[r1M](J1c) === z0N) {
return;
}
if (typeof onBlur === y1M) {
onBlur(this);
} else if (onBlur === y9d) {
var p1M = z9N;
p1M += Q2c;
this[p1M]();
} else if (onBlur === x1M) {
var Z1M = G8U;
Z1M += C2d;
Z1M += L9N;
Z1M += v8U;
this[Z1M]();
}
};
Editor[l1M][a6c] = function() {
var a1c = "remov";
var D1c = "eClas";
var O1c = "sage";
var j1M = q9N;
j1M += y8U;
j1M += O1c;
var q1M = n1c;
q1M += Y5U;
var O1M = z8U;
O1M += G8z.T3U;
O1M += c5U;
O1M += C9N;
var J1M = a1c;
J1M += D1c;
J1M += z9N;
var m1M = q8U;
m1M += q1c;
m1M += c8d;
var d1M = S8U;
d1M += t7N;
d1M += q8U;
d1M += z9N;
var f1M = j1c;
f1M += d5U;
var L1M = I5N;
L1M += K5N;
if (!this[z9N]) {
return;
}
var errorClass = this[L1M][d8d][f1M];
var fields = this[z9N][d1M];
$(m1M + errorClass, this[b1N][u9d])[J1M](errorClass);
$[O1M](fields, function(name, field) {
var D1M = q9N;
D1M += z8U;
D1M += h4N;
D1M += z8U;
var a1M = n1c;
a1M += Y5U;
G8z[R2N]();
field[a1M](R7N)[D1M](R7N);
});
G8z[R2N]();
this[q1M](R7N)[j1M](R7N);
};
Editor[M1N][v1d] = function(submitComplete, mode) {
var I1c = 'preClose';
var e1c = "eCb";
var k1c = "Cb";
var C1c = "or-focus";
var N1c = "cus.edit";
var b1c = "seIcb";
var b1M = T4c;
b1M += X3U;
b1M += c4N;
var G1M = q8U;
G1M += H8U;
G1M += Y3N;
G1M += a4N;
var e1M = C5U;
e1M += N1c;
e1M += C1c;
var k1M = L9N;
k1M += S8U;
k1M += S8U;
var N1M = T4c;
N1M += E0N;
N1M += z8U;
N1M += c4N;
var closed;
if (this[N1M](I1c) === z0N) {
return;
}
if (this[z9N][K1c]) {
var I1M = c5U;
I1M += r8U;
I1M += P7d;
I1M += k1c;
var C1M = C2d;
C1M += L9N;
C1M += z9N;
C1M += e1c;
closed = this[z9N][C1M](submitComplete, mode);
this[z9N][I1M] = I1N;
}
if (this[z9N][G1c]) {
var K1M = o8U;
K1M += b1c;
this[z9N][K1M]();
this[z9N][G1c] = I1N;
}
$(P6d)[k1M](e1M);
this[z9N][G1M] = z0N;
this[b1M](x9d);
if (closed) {
this[K6c](D6c, [closed]);
}
};
Editor[W1M][h1M] = function(fn) {
G8z[R2N]();
this[z9N][K1c] = fn;
};
Editor[Q1M][F1M] = function(arg1, arg2, arg3, arg4) {
var h1c = "oolean";
var W1c = "rmOp";
var Q1c = "PlainObject";
var F1c = "uttons";
var t1M = q9N;
t1M += O3N;
t1M += g8U;
var U1M = C5U;
U1M += W1c;
U1M += g3N;
U1M += z9N;
var A1M = O5U;
A1M += h1c;
var E1M = F2d;
E1M += Q1c;
var that = this;
var title;
var buttons;
G8z[G8z.i3U]();
var show;
var opts;
if ($[E1M](arg1)) {
opts = arg1;
} else if (typeof arg1 === A1M) {
show = arg1;
opts = arg2;
} else {
title = arg1;
buttons = arg2;
show = arg3;
opts = arg4;
}
if (show === undefined) {
show = S0N;
}
if (title) {
that[Q1d](title);
}
if (buttons) {
var w1M = O5U;
w1M += F1c;
that[w1M](buttons);
}
return {
opts: $[A7N]({}, this[z9N][U1M][t1M], opts),
maybeOpen: function() {
var B1M = g8U;
B1M += G8z.R3U;
G8z[B1M]();
if (show) {
var o1M = j6c;
o1M += g8U;
that[o1M]();
}
}
};
};
Editor[v1M][K7d] = function(name) {
var E1c = "shift";
var T1M = G8z.u3U;
T1M += G8z.R3U;
var i1M = z9N;
i1M += Q7d;
i1M += c5U;
i1M += z8U;
var P1M = a6N;
P1M += D9N;
P1M += z8U;
var args = Array[P1M][i1M][X1N](arguments);
args[E1c]();
G8z[T1M]();
var fn = this[z9N][A1c][name];
if (fn) {
return fn[Y1N](this, args);
}
};
Editor[V1M][u1M] = function(includeFields) {
var w1c = "ayed";
var c1c = "ppendT";
var t1c = "includeFields";
var U1c = "playOrder";
var d3M = u4N;
d3M += z9N;
d3M += y2N;
d3M += w1c;
var f3M = l9d;
f3M += U1c;
var L3M = G8U;
L3M += z8U;
L3M += E0N;
L3M += V3d;
var Z3M = O5N;
Z3M += H8U;
Z3M += g8U;
var X1M = I8d;
X1M += C9N;
var c1M = q9N;
c1M += G8z.T3U;
c1M += b8U;
var M1M = q9N;
M1M += L9N;
M1M += q8U;
M1M += z8U;
var R1M = t4N;
R1M += z8U;
R1M += f8U;
var that = this;
G8z[G8z.i3U]();
var formContent = $(this[b1N][R0c]);
var fields = this[z9N][R1M];
var order = this[z9N][b7d];
var template = this[z9N][g5d];
var mode = this[z9N][M1M] || c1M;
if (includeFields) {
this[z9N][t1c] = includeFields;
} else {
includeFields = this[z9N][t1c];
}
formContent[e9d]()[y8N]();
$[X1M](order, function(i, fieldOrName) {
var M1c = "after";
var v1c = "nArray";
var o1c = "kI";
var B1c = "_we";
var u1c = 'editor-field[name="';
var i1c = "[data-editor-templat";
var s3M = B1c;
s3M += G8z.T3U;
s3M += o1c;
s3M += v1c;
var g3M = G8z.u3U;
g3M += G8z.R3U;
var n3M = P1c;
n3M += q9N;
n3M += z8U;
var Y1M = O2N;
Y1M += z8U;
Y1M += e5U;
var name = fieldOrName instanceof Editor[Y1M] ? fieldOrName[n3M]() : fieldOrName;
G8z[g3M]();
if (that[s3M](name, includeFields) !== -K2U) {
var z3M = q9N;
z3M += G8z.T3U;
z3M += H8U;
z3M += g8U;
if (template && mode === z3M) {
var p3M = g8U;
p3M += u6d;
p3M += z8U;
var y3M = o9d;
y3M += D9N;
y3M += X2N;
y3M += q8U;
var r3M = E2N;
r3M += A2N;
var H3M = i1c;
H3M += T1c;
var S3M = S8U;
S3M += b8U;
S3M += q8U;
template[V1c](u1c + name + R1c)[M1c](fields[name][r7d]());
template[S3M](H3M + name + r3M)[y3M](fields[name][p3M]());
} else {
var x3M = g8U;
x3M += u6d;
x3M += z8U;
formContent[G9d](fields[name][x3M]());
}
}
});
if (template && mode === Z3M) {
var l3M = G8z.T3U;
l3M += c1c;
l3M += L9N;
template[l3M](formContent);
}
this[L3M](f3M, [this[z9N][d3M], this[z9N][S7d], formContent]);
};
Editor[m3M][J3M] = function(items, editFields, type, formOptions, setupDone) {
var X1c = "_displayReorde";
var s3c = "ock";
var Y1c = "sl";
var d3c = 'initEdit';
var H3c = "editF";
var f3c = "toString";
var n3c = "ice";
var z3c = "modif";
var S3c = "itDat";
var m3c = 'node';
var U3M = X1c;
U3M += d5U;
var A3M = d7d;
A3M += m8N;
var E3M = Y1c;
E3M += n3c;
var C3M = G8U;
C3M += X3d;
C3M += g3c;
C3M += j3N;
var N3M = q9N;
N3M += L9N;
N3M += q8U;
N3M += z8U;
var j3M = n7d;
j3M += s3c;
var q3M = q8U;
q3M += L9N;
q3M += q9N;
var D3M = z3c;
D3M += L8U;
D3M += d5U;
var a3M = a4N;
a3M += S3c;
a3M += G8z.T3U;
var O3M = H3c;
O3M += H8U;
O3M += v3d;
var that = this;
var fields = this[z9N][a7d];
var usedFields = [];
var includeInOrder;
var editData = {};
this[z9N][O3M] = editFields;
this[z9N][a3M] = editData;
this[z9N][D3M] = items;
this[z9N][S7d] = r5d;
this[q3M][S8d][f2d][H5N] = j3M;
this[z9N][N3M] = type;
this[C3M]();
$[U2N](fields, function(name, field) {
var I3M = z8U;
I3M += G8z.T3U;
I3M += c5U;
I3M += C9N;
field[G7d]();
G8z[G8z.i3U]();
includeInOrder = z0N;
editData[name] = {};
$[I3M](editFields, function(idSrc, edit) {
var y3c = "lFromData";
var r3c = "rray";
var l3c = "ultiSe";
var x3c = "iSet";
var p3c = "splayFields";
var K3M = e7N;
K3M += f8U;
if (edit[K3M][name]) {
var W3M = d5U;
W3M += L9N;
W3M += R9N;
var b3M = C4d;
b3M += j6c;
var G3M = H8U;
G3M += g6c;
G3M += r3c;
var e3M = N7N;
e3M += m8U;
e3M += G8z.T3U;
var k3M = N4N;
k3M += y3c;
var val = field[k3M](edit[e3M]);
editData[name][idSrc] = val === I1N ? R7N : $[G3M](val) ? val[c1N]() : val;
if (!formOptions || formOptions[b3M] === W3M) {
var Q3M = q8U;
Q3M += H8U;
Q3M += p3c;
var h3M = q9N;
h3M += u9c;
h3M += m8U;
h3M += x3c;
field[h3M](idSrc, val !== undefined ? val : field[H3N]());
if (!edit[Z3c] || edit[Q3M][name]) {
includeInOrder = S0N;
}
} else {
if (!edit[Z3c] || edit[Z3c][name]) {
var F3M = q9N;
F3M += l3c;
F3M += m8U;
field[F3M](idSrc, val !== undefined ? val : field[H3N]());
includeInOrder = S0N;
}
}
}
});
if (field[U3N]()[U5N] !== G8z.I2U && includeInOrder) {
usedFields[c2N](name);
}
});
var currOrder = this[b7d]()[E3M]();
for (var i = currOrder[A3M] - K2U; i >= G8z.I2U; i--) {
var w3M = k8N;
w3M += d5U;
w3M += L3c;
if ($[w3M](currOrder[i][f3c](), usedFields) === -K2U) {
currOrder[B3d](i, K2U);
}
}
this[U3M](currOrder);
this[K6c](d3c, [_pluck(editFields, m3c)[G8z.I2U], _pluck(editFields, o8d)[G8z.I2U], items, type], function() {
var O3c = "tMultiEdit";
var J3c = "ini";
var B3M = J3c;
B3M += O3c;
var t3M = G8U;
t3M += a3c;
t3M += m8U;
that[t3M](B3M, [editFields, items, type], function() {
setupDone();
});
});
};
Editor[o3M][K6c] = function(trigger, args, promiseComplete) {
var Q3c = "esu";
var j3c = "triggerHand";
var W3c = "sult";
var h3c = "result";
var e3c = "resu";
var k3c = "Event";
var K3c = "iggerHandle";
var C3c = "Even";
var G3c = "obje";
var I3c = "Cancell";
G8z[R2N]();
if (!args) {
args = [];
}
if ($[f7d](trigger)) {
var v3M = r8U;
v3M += X2N;
v3M += L3N;
v3M += C9N;
for (var i = G8z.I2U, ien = trigger[v3M]; i < ien; i++) {
var P3M = G8U;
P3M += a3c;
P3M += m8U;
this[P3M](trigger[i], args);
}
} else {
var u3M = D3c;
u3M += q3c;
var V3M = H6N;
V3M += z8U;
var T3M = j3c;
T3M += N3c;
var i3M = C3c;
i3M += m8U;
var e = $[i3M](trigger);
$(this)[T3M](e, args);
if (trigger[P7c](V3M) === G8z.I2U && e[u3M] === z0N) {
var M3M = I3c;
M3M += z8U;
M3M += q8U;
var R3M = X8d;
R3M += K3c;
R3M += d5U;
$(this)[R3M]($[k3c](trigger + M3M), args);
}
if (promiseComplete) {
var Y3M = e3c;
Y3M += z3N;
var X3M = G3c;
X3M += b3c;
var c3M = V9N;
c3M += W3c;
if (e[h3c] && typeof e[c3M] === X3M && e[Y3M][V8d]) {
var n8M = d5U;
n8M += Q3c;
n8M += z3N;
e[n8M][V8d](promiseComplete);
} else {
promiseComplete(e[h3c]);
}
}
return e[h3c];
}
};
Editor[g8M][s8M] = function(input) {
var t3c = "substring";
var U3c = "toLowerCase";
var w3c = /^on([A-Z])/;
var S8M = r2N;
S8M += F3c;
S8M += g8U;
var z8M = v9N;
z8M += g8U;
z8M += m8N;
var name;
var names = input[E3c](s1N);
for (var i = G8z.I2U, ien = names[z8M]; i < ien; i++) {
name = names[i];
var onStyle = name[A3c](w3c);
if (onStyle) {
name = onStyle[K2U][U3c]() + name[t3c](e2U);
}
names[i] = name;
}
return names[S8M](s1N);
};
Editor[H8M][r8M] = function(node) {
var y8M = S8U;
y8M += L8U;
y8M += e5U;
y8M += z9N;
var foundField = I1N;
$[U2N](this[z9N][y8M], function(name, field) {
var x8M = g0N;
x8M += m8U;
x8M += C9N;
var p8M = g8U;
p8M += u6d;
p8M += z8U;
if ($(field[p8M]())[V1c](node)[x8M]) {
foundField = field;
}
});
return foundField;
};
Editor[M1N][Z8M] = function(fieldNames) {
if (fieldNames === undefined) {
var l8M = S8U;
l8M += Z8U;
return this[l8M]();
} else if (!$[f7d](fieldNames)) {
return [fieldNames];
}
return fieldNames;
};
Editor[M1N][C6c] = function(fieldsIn, focus) {
var u3c = "ctiveElem";
var V3c = /^jq:/;
var o3c = 'number';
var T3c = 'div.DTE ';
var v3c = "indexO";
var B3c = "setFocu";
var P3c = 'jq:';
var i3c = "lace";
var O8M = B3c;
O8M += z9N;
var L8M = q9N;
L8M += G8z.T3U;
L8M += D9N;
var that = this;
var field;
G8z[R2N]();
var fields = $[L8M](fieldsIn, function(fieldOrName) {
var f8M = t4N;
f8M += z8U;
f8M += f8U;
return typeof fieldOrName === q3d ? that[z9N][f8M][fieldOrName] : fieldOrName;
});
if (typeof focus === o3c) {
field = fields[focus];
} else if (focus) {
var d8M = v3c;
d8M += S8U;
if (focus[d8M](P3c) === G8z.I2U) {
var m8M = V9N;
m8M += D9N;
m8M += i3c;
field = $(T3c + focus[m8M](V3c, R7N));
} else {
field = this[z9N][a7d][focus];
}
} else {
var J8M = G8z.T3U;
J8M += u3c;
J8M += V3d;
document[J8M][v7d]();
}
this[z9N][O8M] = field;
if (field) {
var a8M = C5U;
a8M += c5U;
a8M += i8U;
a8M += z9N;
field[a8M]();
}
};
Editor[M1N][f9c] = function(opts) {
var n8c = "nctio";
var m8c = "submitOnReturn";
var H8c = ".dte";
var X3c = "butt";
var R3c = "seIc";
var j8c = "mess";
var y8c = "loseOnComplet";
var O8c = "blurOnBackground";
var s8c = "blurOnB";
var f8c = "onBlur";
var c3c = "oole";
var d8c = "nRetu";
var g8c = "Opts";
var J8c = "nBackg";
var S8c = "bmitOnReturn";
var r8c = "closeOnComplete";
var q8c = "mes";
var x8c = "submitOnBlur";
var W8c = "canReturnSubmit";
var M3c = "eydown";
var L8c = "mitOnBlu";
var a5M = o8U;
a5M += R3c;
a5M += O5U;
var M8M = L9N;
M8M += g8U;
var P8M = P5N;
P8M += M3c;
var t8M = O5U;
t8M += c3c;
t8M += J5N;
var U8M = X3c;
U8M += Y3c;
var E8M = U7d;
E8M += n8c;
E8M += g8U;
var Q8M = m8U;
Q8M += l6N;
Q8M += v9N;
var h8M = z8U;
h8M += l5U;
h8M += g8c;
var G8M = s8c;
G8M += t8N;
G8M += N4d;
G8M += U9d;
var K8M = z8c;
K8M += S8c;
var D8M = H8c;
D8M += H8N;
D8M += F5d;
var that = this;
var inlineCount = __inlineCounter++;
var namespace = D8M + inlineCount;
if (opts[r8c] !== undefined) {
var N8M = g8U;
N8M += y6c;
var j8M = C2d;
j8M += L9N;
j8M += z9N;
j8M += z8U;
var q8M = c5U;
q8M += y8c;
q8M += z8U;
opts[p8c] = opts[q8M] ? j8M : N8M;
}
if (opts[x8c] !== undefined) {
var I8M = z8c;
I8M += Z8c;
var C8M = l8c;
C8M += L8c;
C8M += d5U;
opts[f8c] = opts[C8M] ? I8M : x9d;
}
if (opts[K8M] !== undefined) {
var e8M = g8U;
e8M += L9N;
e8M += g8U;
e8M += z8U;
var k8M = L9N;
k8M += d8c;
k8M += h5N;
opts[k8M] = opts[m8c] ? y9d : e8M;
}
if (opts[G8M] !== undefined) {
var W8M = n7d;
W8M += a9N;
var b8M = L9N;
b8M += J8c;
b8M += l6d;
opts[b8M] = opts[O8c] ? W8M : h8N;
}
this[z9N][h8M] = opts;
this[z9N][a8c] = inlineCount;
if (typeof opts[Q8M] === q3d || typeof opts[Q1d] === G8z.M3U) {
var F8M = D8c;
F8M += v9N;
this[Q1d](opts[Q1d]);
opts[F8M] = S0N;
}
if (typeof opts[W1d] === q3d || typeof opts[W1d] === E8M) {
var w8M = q8c;
w8M += R4N;
w8M += t8d;
var A8M = j8c;
A8M += m4c;
this[A8M](opts[W1d]);
opts[w8M] = S0N;
}
if (typeof opts[U8M] !== t8M) {
var v8M = s9c;
v8M += N8c;
v8M += z9N;
var o8M = H9d;
o8M += z9N;
var B8M = s9c;
B8M += C8c;
B8M += Y3c;
this[B8M](opts[o8M]);
opts[v8M] = S0N;
}
$(document)[y3N](P8M + namespace, function(e) {
var h8c = "ventDefaul";
var e8c = "ement";
var G8c = "canReturnS";
var b8c = "_fieldFromNode";
var k8c = "activeEl";
var K8c = "Co";
var T8M = u4N;
T8M += z9N;
T8M += L9d;
T8M += a4N;
var i8M = P5N;
i8M += I8c;
i8M += K8c;
i8M += i4N;
G8z[R2N]();
if (e[i8M] === A2U && that[z9N][T8M]) {
var V8M = k8c;
V8M += e8c;
var el = $(document[V8M]);
if (el) {
var u8M = G8c;
u8M += Q2c;
var field = that[b8c](el);
if (field && typeof field[u8M] === G8z.M3U && field[W8c](el)) {
var R8M = H6N;
R8M += z8U;
R8M += h8c;
R8M += m8U;
e[R8M]();
}
}
}
});
$(document)[M8M](K3d + namespace, function(e) {
var F8c = "splayed";
var T8c = "onReturn";
var Y8c = '.DTE_Form_Buttons';
var M2U = 39;
var R2U = 37;
var u8c = "preve";
var X8c = "onEsc";
var M8c = "ault";
var v8c = "turn";
var U8c = "nSubmit";
var i8c = "tDefaul";
var c8c = "preventDef";
var R8c = "ntDef";
var V8c = "onRetur";
var A8c = "iveElement";
var t8c = "ieldF";
var o8c = "onRe";
var E8c = "yCo";
var w8c = "canRetur";
var P8c = "prev";
var f5M = v9N;
f5M += w3N;
var p5M = Q8c;
p5M += L9N;
p5M += i4N;
var Y8M = u4N;
Y8M += F8c;
var X8M = P5N;
X8M += z8U;
X8M += E8c;
X8M += i4N;
var c8M = G8z.T3U;
c8M += b3c;
c8M += A8c;
var el = $(document[c8M]);
if (e[X8M] === A2U && that[z9N][Y8M]) {
var s5M = z1c;
s5M += t9c;
var g5M = w8c;
g5M += U8c;
var n5M = G8U;
n5M += S8U;
n5M += t8c;
n5M += W6N;
var field = that[n5M](el);
if (field && typeof field[g5M] === s5M && field[W8c](el)) {
var S5M = z8c;
S5M += O5U;
S5M += B8c;
S5M += m8U;
var z5M = o8c;
z5M += v8c;
if (opts[z5M] === S5M) {
var H5M = P8c;
H5M += X2N;
H5M += i8c;
H5M += m8U;
e[H5M]();
that[i7d]();
} else if (typeof opts[T8c] === G8z.M3U) {
var y5M = V8c;
y5M += g8U;
var r5M = u8c;
r5M += R8c;
r5M += M8c;
e[r5M]();
opts[y5M](that, e);
}
}
} else if (e[p5M] === P2U) {
var l5M = c5U;
l5M += r8U;
l5M += L9N;
l5M += v8U;
var Z5M = O5U;
Z5M += T7d;
Z5M += d5U;
var x5M = c8c;
x5M += M8c;
e[x5M]();
if (typeof opts[X8c] === G8z.M3U) {
opts[X8c](that, e);
} else if (opts[X8c] === Z5M) {
that[v7d]();
} else if (opts[X8c] === l5M) {
var L5M = c5U;
L5M += y4N;
L5M += z9N;
L5M += z8U;
that[L5M]();
} else if (opts[X8c] === y9d) {
that[i7d]();
}
} else if (el[d3N](Y8c)[f5M]) {
var d5M = P5N;
d5M += n5c;
d5M += q8U;
d5M += z8U;
if (e[d5M] === R2U) {
var J5M = O5U;
J5M += x1c;
J5M += L9N;
J5M += g8U;
var m5M = H6N;
m5M += o6c;
el[m5M](J5M)[o1N]();
} else if (e[k3d] === M2U) {
var O5M = S8U;
O5M += L9N;
O5M += c5U;
O5M += x2N;
el[g5c](s5c)[O5M]();
}
}
});
this[z9N][a5M] = function() {
var D5M = g8U;
D5M += G8z.R3U;
G8z[D5M]();
$(document)[o1d](z5c + namespace);
$(document)[o1d](K3d + namespace);
};
return namespace;
};
Editor[q5M][S5c] = function(direction, action, data) {
var H5c = "legacyAjax";
if (!this[z9N][H5c] || !data) {
return;
}
if (direction === r5c) {
if (action === C1N || action === q4c) {
var N5M = T7N;
N5M += G8z.T3U;
var j5M = z8U;
j5M += G8z.T3U;
j5M += c5U;
j5M += C9N;
var id;
$[j5M](data[N5M], function(rowId, values) {
var y5c = 'Editor: Multi-row editing is not supported by the legacy Ajax data format';
var C5M = g8U;
C5M += G8z.R3U;
if (id !== undefined) {
throw y5c;
}
G8z[C5M]();
id = rowId;
});
data[u7N] = data[u7N][id];
if (action === q4c) {
var I5M = H8U;
I5M += q8U;
data[I5M] = id;
}
} else {
var K5M = N7N;
K5M += j7N;
data[A4N] = $[S5d](data[u7N], function(values, id) {
G8z[G8z.i3U]();
return id;
});
delete data[K5M];
}
} else {
var G5M = q8U;
G5M += y5d;
if (!data[u7N] && data[Z7d]) {
var e5M = p6N;
e5M += R9N;
var k5M = N7N;
k5M += j7N;
data[k5M] = [data[e5M]];
} else if (!data[G5M]) {
data[u7N] = [];
}
}
};
Editor[M1N][H7c] = function(json) {
var p5c = "optio";
var b5M = p5c;
b5M += V1N;
var that = this;
G8z[R2N]();
if (json[b5M]) {
var W5M = z8U;
W5M += F4d;
$[W5M](this[z9N][a7d], function(name, field) {
var Z5c = "update";
var l5c = "upd";
if (json[x5c][name] !== undefined) {
var fieldInst = that[d8d](name);
if (fieldInst && fieldInst[Z5c]) {
var h5M = l5c;
h5M += C8d;
fieldInst[h5M](json[x5c][name]);
}
}
});
}
};
Editor[Q5M][I5d] = function(el, msg) {
var d5c = "spla";
var L5c = "functio";
var J5c = "eIn";
var m5c = "fad";
var E5M = L5c;
E5M += g8U;
var F5M = S8U;
F5M += g8U;
var canAnimate = $[F5M][l0d] ? S0N : z0N;
if (typeof msg === E5M) {
var A5M = m8U;
A5M += G8z.T3U;
A5M += O5U;
A5M += v9N;
msg = msg(this, new DataTable[j5N](this[z9N][A5M]));
}
el = $(el);
if (canAnimate) {
el[r1c]();
}
if (!msg) {
var w5M = u4N;
w5M += Y3N;
w5M += a4N;
if (this[z9N][w5M] && canAnimate) {
el[X0d](function() {
var U5M = C9N;
U5M += m8U;
U5M += f5c;
el[U5M](R7N);
});
} else {
var B5M = q8U;
B5M += H8U;
B5M += z9N;
B5M += L9d;
var t5M = c5U;
t5M += z9N;
t5M += z9N;
el[p8N](R7N)[t5M](B5M, h8N);
}
} else {
var o5M = q8U;
o5M += H8U;
o5M += d5c;
o5M += V4N;
if (this[z9N][o5M] && canAnimate) {
var v5M = m5c;
v5M += J5c;
el[p8N](msg)[v5M]();
} else {
var T5M = M3d;
T5M += c3d;
var i5M = c5U;
i5M += z9N;
i5M += z9N;
var P5M = g4d;
P5M += f5c;
el[P5M](msg)[i5M](T5M, f5N);
}
}
};
Editor[V5M][R5N] = function() {
var a5c = "ultiEditable";
var D5c = "multiInfoShown";
var c5M = r8U;
c5M += O5c;
var M5M = w3d;
M5M += r8U;
M5M += z8d;
var R5M = g8U;
R5M += G8z.R3U;
var u5M = S8U;
u5M += Z8U;
var fields = this[z9N][u5M];
G8z[R5M]();
var include = this[z9N][M5M];
var show = S0N;
var state;
if (!include) {
return;
}
for (var i = G8z.I2U, ien = include[c5M]; i < ien; i++) {
var X5M = q9N;
X5M += a5c;
var field = fields[include[i]];
var multiEditable = field[X5M]();
if (field[R3N]() && multiEditable && show) {
state = S0N;
show = z0N;
} else if (field[R3N]() && !multiEditable) {
state = S0N;
} else {
state = z0N;
}
fields[include[i]][D5c](state);
}
};
Editor[Y5M][n9u] = function(type, immediate) {
var j5c = "captureFoc";
var C5c = 'submit.editor-internal';
var q5c = "iInf";
var E5c = 'opened';
var K5c = 'focus.editor-focus';
var N5c = "Contr";
var d9u = L5N;
d9u += X2N;
var f9u = T3d;
f9u += z8U;
f9u += g8U;
f9u += m8U;
var L9u = Z8N;
L9u += q3c;
L9u += q5c;
L9u += L9N;
var z9u = L9N;
z9u += o2d;
var s9u = j5c;
s9u += i8U;
s9u += z9N;
var g9u = H5N;
g9u += N5c;
g9u += Y9d;
g9u += N3c;
var that = this;
var focusCapture = this[z9N][g9u][s9u];
if (focusCapture === undefined) {
focusCapture = S0N;
}
$(this[b1N][S8d])[z9u](C5c)[y3N](C5c, function(e) {
var I5c = "Default";
var S9u = H6N;
S9u += Y6c;
S9u += I5c;
e[S9u]();
});
if (focusCapture && (type === f5d || type === Y7d)) {
var H9u = L9N;
H9u += g8U;
$(P6d)[H9u](K5c, function() {
var W5c = "activeElement";
var k5c = ".D";
var b5c = "rent";
var Q5c = "setFocus";
var h5c = '.DTE';
var e5c = "TED";
var Z9u = r8U;
Z9u += z8U;
Z9u += g8U;
Z9u += m8N;
var x9u = k5c;
x9u += e5c;
var p9u = G5c;
p9u += z8U;
p9u += c4N;
p9u += z9N;
var y9u = v9N;
y9u += g8U;
y9u += q4N;
y9u += Y2N;
var r9u = D9N;
r9u += G8z.T3U;
r9u += b5c;
r9u += z9N;
if ($(document[W5c])[r9u](h5c)[y9u] === G8z.I2U && $(document[W5c])[p9u](x9u)[Z9u] === G8z.I2U) {
if (that[z9N][Q5c]) {
var l9u = S8U;
l9u += T3N;
l9u += z9N;
that[z9N][Q5c][l9u]();
}
}
});
}
this[L9u]();
this[f9u](d9u, [type, this[z9N][S7d]]);
if (immediate) {
var m9u = T4c;
m9u += F5c;
m9u += m8U;
this[m9u](E5c, [type, this[z9N][S7d]]);
}
return S0N;
};
Editor[J9u][O9u] = function(type) {
var U5c = "cb";
var t5c = "ubb";
var o5c = "celOpen";
var P5c = "Icb";
var v5c = "arDynamicInfo";
var B5c = "can";
var D9u = A5c;
D9u += g8U;
var a9u = T4c;
a9u += E0N;
a9u += z8U;
a9u += c4N;
if (this[a9u](w5c, [type, this[z9N][D9u]]) === z0N) {
var K9u = b9d;
K9u += H4c;
K9u += U5c;
var I9u = O5U;
I9u += t5c;
I9u += v9N;
var C9u = q9N;
C9u += L9N;
C9u += q8U;
C9u += z8U;
var N9u = q9N;
N9u += L9N;
N9u += q8U;
N9u += z8U;
var j9u = B5c;
j9u += o5c;
var q9u = I9c;
q9u += v5c;
this[q9u]();
this[K6c](j9u, [type, this[z9N][S7d]]);
if ((this[z9N][N9u] === d9c || this[z9N][C9u] === I9u) && this[z9N][K9u]) {
var k9u = c5U;
k9u += y4N;
k9u += v8U;
k9u += P5c;
this[z9N][k9u]();
}
this[z9N][G1c] = I1N;
return z0N;
}
this[z9N][z5d] = type;
return S0N;
};
Editor[e9u][G9u] = function(processing) {
var V5c = "active";
var T5c = "processi";
var Q9u = i5c;
Q9u += z9N;
Q9u += b8U;
Q9u += q4N;
var h9u = T5c;
h9u += d6N;
var W9u = F1N;
W9u += q9N;
var b9u = e4d;
b9u += Z5U;
var procClass = this[l3N][j1N][V5c];
$([b9u, this[W9u][u9d]])[V5N](procClass, processing);
this[z9N][h9u] = processing;
G8z[R2N]();
this[K6c](Q9u, [processing]);
};
Editor[M1N][F9u] = function(successCallback, errorCallback, formatdata, hide) {
var X5c = "editData";
var m9m = "_ajax";
var u5c = "_submitT";
var Y5c = "bTa";
var n9m = "cha";
var R5c = "editC";
var Z9m = 'allIfChanged';
var d9m = 'preSubmit';
var M5c = "ount";
var y6u = c5U;
y6u += k8d;
y6u += r8U;
var r6u = u5c;
r6u += k0c;
r6u += r8U;
r6u += z8U;
var U9u = c5U;
U9u += d5U;
U9u += z8U;
U9u += C8d;
var A9u = A5c;
A9u += g8U;
var E9u = R5c;
E9u += M5c;
var that = this;
var i, iLen, eventRet, errorNodes;
var changed = z0N,
allData = {},
changedData = {};
var setBuilder = DataTable[F8U][c7N][c5c];
var dataSource = this[z9N][A1c];
var fields = this[z9N][a7d];
var editCount = this[z9N][E9u];
var modifier = this[z9N][H7d];
var editFields = this[z9N][e7d];
var editData = this[z9N][X5c];
var opts = this[z9N][I6c];
var changedSubmit = opts[i7d];
var submitParamsLocal;
var action = this[z9N][A9u];
var submitParams = {
"data": {}
};
submitParams[this[z9N][b0c]] = action;
if (this[z9N][h0c]) {
var w9u = q8U;
w9u += Y5c;
w9u += g5U;
submitParams[N5N] = this[z9N][w9u];
}
if (action === U9u || action === r5d) {
var n6u = n9m;
n6u += g8U;
n6u += t8d;
n6u += q8U;
var Y9u = G8z.T3U;
Y9u += r8U;
Y9u += r8U;
var X9u = v7c;
X9u += C8d;
var t9u = z8U;
t9u += G8z.T3U;
t9u += c5U;
t9u += C9N;
$[t9u](editFields, function(idSrc, edit) {
var x9m = "isEmptyObject";
var o9u = Q1N;
o9u += c5U;
o9u += C9N;
var B9u = G8z.u3U;
B9u += G8z.R3U;
var allRowData = {};
var changedRowData = {};
G8z[B9u]();
$[o9u](fields, function(name, field) {
var S9m = "y-coun";
var H9m = "[";
var s9m = "ompa";
var y9m = "iGet";
var p9m = /\[.*$/;
var g9m = "submittable";
var r9m = "isArra";
var z9m = "-m";
var v9u = t4N;
v9u += z8U;
v9u += e5U;
v9u += z9N;
if (edit[v9u][name] && field[g9m]()) {
var M9u = c5U;
M9u += s9m;
M9u += d5U;
M9u += z8U;
var u9u = z9m;
u9u += J5N;
u9u += S9m;
u9u += m8U;
var V9u = H9m;
V9u += A2N;
var T9u = r9m;
T9u += G8z.u3U;
var P9u = j5U;
P9u += r8U;
P9u += m8U;
P9u += y9m;
var multiGet = field[P9u]();
var builder = setBuilder(name);
if (multiGet[idSrc] === undefined) {
var i9u = q8U;
i9u += G8z.T3U;
i9u += m8U;
i9u += G8z.T3U;
var originalVal = field[X7N](edit[i9u]);
builder(allRowData, originalVal);
return;
}
var value = multiGet[idSrc];
var manyBuilder = $[T9u](value) && name[P7c](V9u) !== -K2U ? setBuilder(name[v8N](p9m, R7N) + u9u) : I1N;
builder(allRowData, value);
if (manyBuilder) {
var R9u = r8U;
R9u += O5c;
manyBuilder(allRowData, value[R9u]);
}
if (action === q4c && (!editData[name] || !field[M9u](value, editData[name][idSrc]))) {
builder(changedRowData, value);
changed = S0N;
if (manyBuilder) {
var c9u = d7d;
c9u += q4N;
c9u += m8U;
c9u += C9N;
manyBuilder(changedRowData, value[c9u]);
}
}
}
});
if (!$[x9m](allRowData)) {
allData[idSrc] = allRowData;
}
if (!$[x9m](changedRowData)) {
changedData[idSrc] = changedRowData;
}
});
if (action === X9u || changedSubmit === Y9u || changedSubmit === Z9m && changed) {
submitParams[u7N] = allData;
} else if (changedSubmit === n6u && changed) {
submitParams[u7N] = changedData;
} else {
var s6u = z1c;
s6u += c5U;
s6u += g3N;
var g6u = g3c;
g6u += L9N;
g6u += l9m;
this[z9N][S7d] = I1N;
if (opts[g6u] === x9d && (hide === undefined || hide)) {
this[v1d](z0N);
} else if (typeof opts[p8c] === s6u) {
var z6u = y3N;
z6u += f5U;
z6u += c7c;
opts[z6u](this);
}
if (successCallback) {
var S6u = c5U;
S6u += G8z.T3U;
S6u += r8U;
S6u += r8U;
successCallback[S6u](this);
}
this[L9m](z0N);
this[K6c](f9m);
return;
}
} else if (action === Z5N) {
$[U2N](editFields, function(idSrc, edit) {
var H6u = q8U;
H6u += G8z.T3U;
H6u += m8U;
H6u += G8z.T3U;
G8z[R2N]();
submitParams[H6u][idSrc] = edit[u7N];
});
}
this[S5c](r5c, action, submitParams);
submitParamsLocal = $[A7N](S0N, {}, submitParams);
if (formatdata) {
formatdata(submitParams);
}
if (this[K6c](d9m, [submitParams, action]) === z0N) {
this[L9m](z0N);
return;
}
var submitWire = this[z9N][A7d] || this[z9N][t7c] ? this[m9m] : this[r6u];
submitWire[y6u](this, submitParams, function(json, notGood, xhr) {
var J9m = "_submitSuccess";
var x6u = B9c;
x6u += o9c;
var p6u = G8z.u3U;
p6u += G8z.R3U;
G8z[p6u]();
that[J9m](json, notGood, submitParams, submitParamsLocal, that[z9N][x6u], editCount, hide, successCallback, errorCallback, xhr);
}, function(xhr, err, thrown) {
var O9m = "bmitEr";
var Z6u = G8U;
Z6u += z8c;
Z6u += O9m;
Z6u += G3N;
that[Z6u](xhr, err, thrown, errorCallback, submitParams, that[z9N][S7d]);
}, submitParams);
};
Editor[l6u][a9m] = function(data, success, error, submitParams) {
var q9m = "tData";
var I9m = "ual";
var C9m = "individ";
var D9m = "_fnGetObjec";
var K9m = "Source";
var m6u = A4N;
m6u += j9N;
m6u += q0c;
var d6u = D9m;
d6u += q9m;
d6u += j9m;
var f6u = L9N;
f6u += N9m;
f6u += D9N;
f6u += H8U;
var L6u = t8N;
L6u += g3N;
var that = this;
var action = data[L6u];
var out = {
data: []
};
var idGet = DataTable[F8U][f6u][d6u](this[z9N][Q0c]);
var idSet = DataTable[F8U][c7N][c5c](this[z9N][m6u]);
if (action !== L4c) {
var a6u = C9m;
a6u += I9m;
var O6u = e7N;
O6u += f8U;
var J6u = G8U;
J6u += N7N;
J6u += j7N;
J6u += K9m;
var originalData = this[z9N][q0N] === f5d ? this[J6u](O6u, this[H7d]()) : this[K7d](a6u, this[H7d]());
$[U2N](data[u7N], function(key, vals) {
var k9m = "oAp";
var K6u = D9N;
K6u += i8U;
K6u += z9N;
K6u += C9N;
var I6u = q8U;
I6u += G8z.T3U;
I6u += m8U;
I6u += G8z.T3U;
var C6u = c5U;
C6u += V9N;
C6u += M7N;
C6u += z8U;
var j6u = k9m;
j6u += H8U;
var q6u = C2N;
q6u += Z5U;
q6u += R7c;
var D6u = G8z.u3U;
D6u += G8z.R3U;
var toSave;
G8z[D6u]();
var extender = $[g8N][q6u][j6u][e9m];
if (action === q4c) {
var N6u = q8U;
N6u += y5d;
var rowData = originalData[key][N6u];
toSave = extender({}, rowData, S0N);
toSave = extender(toSave, vals, S0N);
} else {
toSave = extender({}, vals, S0N);
}
var overrideId = idGet(toSave);
if (action === C6u && overrideId === undefined) {
idSet(toSave, +new Date() + R7N + key);
} else {
idSet(toSave, overrideId);
}
out[I6u][K6u](toSave);
});
}
success(out);
};
Editor[k6u][e6u] = function(json, notGood, submitParams, submitParamsLocal, action, editCount, hide, successCallback, errorCallback, xhr) {
var E9m = "Ajax";
var B9m = "submitUns";
var S6m = "reate";
var Q9m = "_leg";
var r6m = 'preEdit';
var L6m = "urce";
var O6m = "_c";
var Z6m = "eR";
var h9m = "eive";
var l6m = "_dataSo";
var s6m = "taSou";
var J6m = "mple";
var v9m = "essful";
var x6m = "postR";
var b9m = "Compl";
var X9m = 'prep';
var a6m = 'submitSuccess';
var P9m = "rors";
var H6m = "ataSour";
var W9m = "Erro";
var g6m = "postCrea";
var A9m = "tOp";
var Y9m = 'id';
var z6m = "rce";
var U9m = "fieldE";
var t9m = "rrors";
var m6m = "onCo";
var y6m = 'postEdit';
var o9m = "ucc";
var n6m = 'setData';
var f6m = 'commit';
var p6m = "dataSou";
var F9m = "acy";
var d6m = "nction";
var F4u = l8c;
F4u += G9m;
F4u += b9m;
F4u += q7c;
var A6u = r8U;
A6u += n0N;
A6u += m8U;
A6u += C9N;
var E6u = n1c;
E6u += L9N;
E6u += d5U;
var Q6u = t4N;
Q6u += z5U;
Q6u += W9m;
Q6u += Y3U;
var h6u = d5U;
h6u += z8U;
h6u += c5U;
h6u += h9m;
var W6u = Q9m;
W6u += F9m;
W6u += E9m;
var b6u = d7c;
b6u += A9m;
b6u += m8U;
b6u += z9N;
var G6u = e7N;
G6u += f8U;
var that = this;
var setData;
var fields = this[z9N][G6u];
var opts = this[z9N][b6u];
var modifier = this[z9N][H7d];
this[W6u](h6u, action, json);
this[K6c](w9m, [json, submitParams, action, xhr]);
if (!json[I3N]) {
json[I3N] = n9d;
}
if (!json[Q6u]) {
var F6u = U9m;
F6u += t9m;
json[F6u] = [];
}
if (notGood || json[E6u] || json[W2c][A6u]) {
var n4u = B9m;
n4u += o9m;
n4u += v9m;
var Y6u = G8U;
Y6u += E6c;
Y6u += c4N;
var X6u = I0N;
X6u += O5U;
X6u += d5U;
X6u += W0N;
var c6u = r2N;
c6u += L9N;
c6u += H8U;
c6u += g8U;
var M6u = j1c;
M6u += d5U;
var t6u = U9m;
t6u += d5U;
t6u += P9m;
var U6u = z8U;
U6u += G8z.T3U;
U6u += c5U;
U6u += C9N;
var globalError = [];
if (json[I3N]) {
var w6u = i9m;
w6u += z9N;
w6u += C9N;
globalError[w6u](json[I3N]);
}
$[U6u](json[t6u], function(i, err) {
var c9m = ': ';
var u9m = "onFieldError";
var V9m = "n field:";
var T9m = "Unknow";
var M9m = "position";
var R9m = "dyContent";
var field = fields[err[P7N]];
if (!field) {
var B6u = T9m;
B6u += V9m;
B6u += B8U;
throw new Error(B6u + err[P7N]);
} else if (field[z5d]()) {
var P6u = W9m;
P6u += d5U;
var v6u = z9N;
v6u += m8U;
v6u += M7N;
v6u += x2N;
var o6u = e4N;
o6u += d5U;
o6u += L9N;
o6u += d5U;
field[o6u](err[v6u] || P6u);
if (i === G8z.I2U) {
var u6u = J3d;
u6u += y3N;
if (opts[u9m] === i3N) {
var V6u = m8U;
V6u += L5N;
var T6u = P2d;
T6u += e4N;
var i6u = a6d;
i6u += R9m;
that[h4d]($(that[b1N][i6u], that[z9N][T6u]), {
scrollTop: $(field[r7d]())[M9m]()[V6u]
}, z0U);
field[o1N]();
} else if (typeof opts[u9m] === u6u) {
opts[u9m](that, err);
}
}
} else {
var R6u = g8U;
R6u += G8z.T3U;
R6u += e8U;
globalError[c2N](field[R6u]() + c9m + (err[U7c] || m5N));
}
});
this[M6u](globalError[c6u](X6u));
this[Y6u](n4u, [json]);
if (errorCallback) {
errorCallback[X1N](that, json);
}
} else {
var Q4u = T4c;
Q4u += f1c;
var m4u = V9N;
m4u += q9N;
m4u += L9N;
m4u += X3U;
var g4u = L7c;
g4u += z8U;
g4u += G8z.T3U;
g4u += u9N;
var store = {};
if (json[u7N] && (action === g4u || action === r5d)) {
var d4u = q8U;
d4u += G8z.T3U;
d4u += m8U;
d4u += G8z.T3U;
var f4u = y5N;
f4u += q9N;
f4u += B8c;
f4u += m8U;
this[K7d](X9m, action, modifier, submitParamsLocal, json, store);
for (var i = G8z.I2U; i < json[u7N][U5N]; i++) {
var s4u = q8U;
s4u += y5d;
setData = json[s4u][i];
var id = this[K7d](Y9m, setData);
this[K6c](n6m, [json, setData, action]);
if (action === i3d) {
var y4u = g6m;
y4u += u9N;
var r4u = L7c;
r4u += Q1N;
r4u += m8U;
r4u += z8U;
var H4u = G8U;
H4u += N7N;
H4u += s6m;
H4u += z6m;
var S4u = b3d;
S4u += f5U;
S4u += S6m;
var z4u = G8U;
z4u += E6c;
z4u += g8U;
z4u += m8U;
this[z4u](S4u, [json, setData, id]);
this[H4u](r4u, fields, setData, store);
this[K6c]([C1N, y4u], [json, setData, id]);
} else if (action === r5d) {
var L4u = z8U;
L4u += q8U;
L4u += H8U;
L4u += m8U;
var l4u = T4c;
l4u += E0N;
l4u += z8U;
l4u += c4N;
var Z4u = z8U;
Z4u += q8U;
Z4u += H8U;
Z4u += m8U;
var x4u = G8U;
x4u += q8U;
x4u += H6m;
x4u += w8N;
var p4u = G8U;
p4u += E6c;
p4u += g8U;
p4u += m8U;
this[p4u](r6m, [json, setData, id]);
this[x4u](Z4u, modifier, fields, setData, store);
this[l4u]([L4u, y6m], [json, setData, id]);
}
}
this[K7d](f4u, action, modifier, json[d4u], store);
} else if (action === m4u) {
var C4u = G8U;
C4u += p6m;
C4u += z6m;
var N4u = A4N;
N4u += z9N;
var j4u = x6m;
j4u += a7c;
var q4u = T3d;
q4u += X2N;
q4u += m8U;
var D4u = H8U;
D4u += q8U;
D4u += z9N;
var a4u = H6N;
a4u += Z6m;
a4u += a7c;
var O4u = D9N;
O4u += V9N;
O4u += D9N;
var J4u = l6m;
J4u += L6m;
this[J4u](O4u, action, modifier, submitParamsLocal, json, store);
this[K6c](a4u, [json, this[D4u]()]);
this[K7d](L4c, modifier, fields, store);
this[q4u]([L4c, j4u], [json, this[N4u]()]);
this[C4u](f6m, action, modifier, json[u7N], store);
}
if (editCount === this[z9N][a8c]) {
var b4u = U7d;
b4u += d6m;
var G4u = m6m;
G4u += J6m;
G4u += u9N;
var K4u = A5c;
K4u += g8U;
var I4u = t8N;
I4u += g3N;
var action = this[z9N][I4u];
this[z9N][K4u] = I1N;
if (opts[p8c] === x9d && (hide === undefined || hide)) {
var e4u = N7N;
e4u += j7N;
var k4u = O6m;
k4u += r8U;
k4u += L9N;
k4u += v8U;
this[k4u](json[e4u] ? S0N : z0N, action);
} else if (typeof opts[G4u] === b4u) {
var W4u = m6m;
W4u += l9m;
opts[W4u](this);
}
}
if (successCallback) {
var h4u = c5U;
h4u += X5N;
successCallback[h4u](that, json);
}
this[Q4u](a6m, [json, setData, action]);
}
this[L9m](z0N);
this[K6c](F4u, [json, setData, action]);
};
Editor[E4u][A4u] = function(xhr, err, thrown, errorCallback, submitParams, action) {
var D6m = "submitCo";
var j6m = 'submitError';
var q6m = "system";
var B4u = D6m;
B4u += l9m;
var t4u = H8U;
t4u += J8U;
t4u += g8U;
var U4u = z8U;
U4u += e8N;
U4u += L9N;
U4u += d5U;
var w4u = G8U;
w4u += z8U;
w4u += F5c;
w4u += m8U;
this[w4u](w9m, [I1N, submitParams, action, xhr]);
this[U4u](this[t4u][I3N][q6m]);
this[L9m](z0N);
if (errorCallback) {
errorCallback[X1N](this, xhr, err, thrown);
}
this[K6c]([j6m, B4u], [xhr, err, thrown, submitParams]);
};
Editor[M1N][o4u] = function(fn) {
var C6m = "ataTa";
var k6m = 'draw';
var I6m = "oFeat";
var g2u = G8z.u3U;
g2u += G8z.R3U;
var M4u = b8U;
M4u += r8U;
M4u += b8U;
M4u += z8U;
var V4u = H6N;
V4u += N6m;
var P4u = j7N;
P4u += g5U;
var v4u = q8U;
v4u += C6m;
v4u += g5U;
var that = this;
var dt = this[z9N][N5N] ? new $[g8N][v4u][j5N](this[z9N][P4u]) : I1N;
var ssp = z0N;
if (dt) {
var T4u = I6m;
T4u += i8U;
T4u += D3c;
var i4u = S4c;
i4u += m8U;
i4u += k7N;
ssp = dt[i4u]()[G8z.I2U][T4u][K6m];
}
if (this[z9N][V4u]) {
var u4u = L9N;
u4u += g8U;
u4u += z8U;
this[u4u](f9m, function() {
if (ssp) {
var R4u = L9N;
R4u += s2d;
dt[R4u](k6m, fn);
} else {
setTimeout(function() {
G8z[R2N]();
fn();
}, Q2U);
}
});
return S0N;
} else if (this[H5N]() === M4u || this[H5N]() === Y7d) {
var n2u = O5U;
n2u += r8U;
n2u += i8U;
n2u += d5U;
var c4u = y3N;
c4u += z8U;
this[c4u](x9d, function() {
var e6m = "proc";
var G6m = "mitComplete";
var X4u = e6m;
X4u += e2c;
X4u += o8N;
if (!that[z9N][X4u]) {
setTimeout(function() {
G8z[G8z.i3U]();
if (that[z9N]) {
fn();
}
}, Q2U);
} else {
var Y4u = l8c;
Y4u += G6m;
that[y6c](Y4u, function(e, json) {
G8z[G8z.i3U]();
if (ssp && json) {
dt[y6c](k6m, fn);
} else {
setTimeout(function() {
if (that[z9N]) {
fn();
}
}, Q2U);
}
});
}
})[n2u]();
return S0N;
}
G8z[g2u]();
return z0N;
};
Editor[s2u][b6m] = function(name, arr) {
for (var i = G8z.I2U, ien = arr[U5N]; i < ien; i++) {
if (name == arr[i]) {
return i;
}
}
return -K2U;
};
Editor[G0c] = {
"table": I1N,
"ajaxUrl": I1N,
"fields": [],
"display": z2u,
"ajax": I1N,
"idSrc": W6m,
"events": {},
"i18n": {
"create": {
"button": S2u,
"title": h6m,
"submit": H2u
},
"edit": {
"button": Q6m,
"title": F6m,
"submit": E6m
},
"remove": {
"button": r2u,
"title": y2u,
"submit": p2u,
"confirm": {
"_": x2u,
"1": Z2u
}
},
"error": {
"system": A6m
},
multi: {
title: w6m,
info: U6m,
restore: t6m,
noMulti: l2u
},
datetime: {
previous: B6m,
next: o6m,
months: [v6m, P6m, L2u, i6m, T6m, V6m, f2u, d2u, u6m, m2u, J2u, R6m],
weekdays: [M6m, c6m, O2u, X6m, a2u, Y6m, D2u],
amPm: [n4m, q2u],
hours: j2u,
minutes: g4m,
seconds: N2u,
unknown: b6c
}
},
formOptions: {
bubble: $[C2u]({}, Editor[s9d][I2u], {
title: z0N,
message: z0N,
buttons: Z4c,
submit: s4m
}),
inline: $[K2u]({}, Editor[k2u][e2u], {
buttons: z0N,
submit: G2u
}),
main: $[b2u]({}, Editor[W2u][h2u])
},
legacyAjax: z0N,
actionName: c4c
};
(function() {
var y4m = "oFeatures";
var k4m = "cells";
var M4m = "cancelled";
var Q4m = "nodeName";
var S4m = "dr";
var O2m = '[data-editor-value]';
var z4m = "taSourc";
var T4m = "any";
var Q2u = N7N;
Q2u += z4m;
Q2u += z8U;
Q2u += z9N;
var __dataSources = Editor[Q2u] = {};
var __dtIsSsp = function(dt, editor) {
var H4m = "Type";
var r4m = "editOp";
var A2u = C5N;
A2u += z8U;
var E2u = S4m;
E2u += G8z.T3U;
E2u += R9N;
E2u += H4m;
var F2u = r4m;
F2u += W7N;
return dt[z9d]()[G8z.I2U][y4m][K6m] && editor[z9N][F2u][E2u] !== A2u;
};
var __dtApi = function(table) {
var w2u = g8U;
w2u += G8z.R3U;
G8z[w2u]();
return $(table)[F2N]();
};
var __dtHighlight = function(node) {
node = $(node);
G8z[R2N]();
setTimeout(function() {
var p4m = 'highlight';
var U2u = l7d;
U2u += D7c;
node[U2u](p4m);
G8z[R2N]();
setTimeout(function() {
var x4m = "high";
var f4m = 'noHighlight';
var l4m = "oveCla";
var Z4m = "light";
var L4m = "ddClass";
var o2u = x4m;
o2u += Z4m;
var B2u = t6c;
B2u += l4m;
B2u += b5N;
var t2u = G8z.T3U;
t2u += L4m;
G8z[R2N]();
node[t2u](f4m)[B2u](o2u);
setTimeout(function() {
var d4m = "removeC";
var m4m = "las";
var v2u = d4m;
v2u += m4m;
v2u += z9N;
node[v2u](f4m);
}, S0U);
}, z0U);
}, t2U);
};
var __dtRowSelector = function(out, dt, identifier, fields, idFn) {
var P2u = G8z.u3U;
P2u += G8z.R3U;
G8z[P2u]();
dt[B8d](identifier)[J4m]()[U2N](function(idx) {
var O4m = 'Unable to find row identifier';
var w2U = 14;
var u2u = d5U;
u2u += L9N;
u2u += R9N;
var T2u = q8U;
T2u += G8z.T3U;
T2u += m8U;
T2u += G8z.T3U;
var i2u = g8U;
i2u += G8z.R3U;
var row = dt[Z7d](idx);
G8z[i2u]();
var data = row[T2u]();
var idSrc = idFn(data);
if (idSrc === undefined) {
var V2u = e4N;
V2u += p6N;
V2u += d5U;
Editor[V2u](O4m, w2U);
}
out[idSrc] = {
idSrc: idSrc,
data: data,
node: row[r7d](),
fields: fields,
type: u2u
};
});
};
var __dtFieldsFromIdx = function(dt, fields, idx) {
var N4m = "mData";
var C4m = "Unable to automatically determine ";
var K4m = "the field name.";
var q4m = "aoColumns";
var I4m = "field from source. Please specify ";
var a4m = "sEmptyObje";
var D4m = "itField";
var j4m = "editField";
var n0u = H8U;
n0u += a4m;
n0u += b3c;
var c2u = z8U;
c2u += G8z.T3U;
c2u += c5U;
c2u += C9N;
var R2u = a4N;
R2u += D4m;
var field;
var col = dt[z9d]()[G8z.I2U][q4m][idx];
var dataSrc = col[R2u] !== undefined ? col[j4m] : col[N4m];
var resolvedFields = {};
G8z[G8z.i3U]();
var run = function(field, dataSrc) {
if (field[P7N]() === dataSrc) {
var M2u = x7N;
M2u += z8U;
resolvedFields[field[M2u]()] = field;
}
};
$[c2u](fields, function(name, fieldInst) {
var X2u = F2d;
X2u += E9N;
X2u += L3c;
G8z[R2N]();
if ($[X2u](dataSrc)) {
var Y2u = v9N;
Y2u += d6N;
Y2u += Y2N;
for (var i = G8z.I2U; i < dataSrc[Y2u]; i++) {
run(fieldInst, dataSrc[i]);
}
} else {
run(fieldInst, dataSrc);
}
});
if ($[n0u](resolvedFields)) {
var s0u = C4m;
s0u += I4m;
s0u += K4m;
var g0u = z8U;
g0u += d5U;
g0u += d5U;
g0u += Y5U;
Editor[g0u](s0u, F2U);
}
return resolvedFields;
};
var __dtCellSelector = function(out, dt, identifier, allFields, idFn, forceFields) {
var S0u = z8U;
S0u += G8z.T3U;
S0u += r9N;
var z0u = G8z.u3U;
z0u += G8z.R3U;
G8z[z0u]();
dt[k4m](identifier)[J4m]()[S0u](function(idx) {
var e4m = "fix";
var E4m = "fixedNode";
var F4m = "ayFields";
var G4m = "No";
var b4m = "ush";
var h4m = "column";
var f0u = H5N;
f0u += m2N;
f0u += f8U;
var L0u = G5N;
L0u += i4N;
var l0u = e4m;
l0u += a4N;
l0u += G4m;
l0u += i4N;
var Z0u = q4N;
Z0u += z8U;
Z0u += m8U;
var x0u = D9N;
x0u += b4m;
var p0u = d5U;
p0u += L9N;
p0u += R9N;
var r0u = q8U;
r0u += G8z.T3U;
r0u += j7N;
var H0u = d5U;
H0u += k9d;
var cell = dt[W4m](idx);
var row = dt[H0u](idx[Z7d]);
var data = row[r0u]();
var idSrc = idFn(data);
var fields = forceFields || __dtFieldsFromIdx(dt, allFields, idx[h4m]);
var isNode = typeof identifier === G8z.c3U && identifier[Q4m] || identifier instanceof $;
var prevDisplayFields, prevAttach;
if (out[idSrc]) {
var y0u = T4N;
y0u += F4m;
prevAttach = out[idSrc][T5d];
prevDisplayFields = out[idSrc][y0u];
}
__dtRowSelector(out, dt, idx[p0u], allFields, idFn);
out[idSrc][T5d] = prevAttach || [];
out[idSrc][T5d][x0u](isNode ? $(identifier)[Z0u](G8z.I2U) : cell[l0u] ? cell[E4m]() : cell[L0u]());
out[idSrc][Z3c] = prevDisplayFields || {};
$[A7N](out[idSrc][f0u], fields);
});
};
var __dtColumnSelector = function(out, dt, identifier, fields, idFn) {
var m0u = Q1N;
m0u += c5U;
m0u += C9N;
var d0u = c5U;
d0u += J7d;
d0u += r8U;
d0u += z9N;
G8z[R2N]();
dt[d0u](I1N, identifier)[J4m]()[m0u](function(idx) {
G8z[R2N]();
__dtCellSelector(out, dt, idx, fields, idFn);
});
};
var __dtjqId = function(id) {
var A4m = "\\$";
var J0u = A4m;
J0u += e5N;
G8z[G8z.i3U]();
return typeof id === q3d ? b5d + id[v8N](/(:|\.|\[|\]|,)/g, J0u) : b5d + id;
};
G8z[R2N]();
__dataSources[C2N] = {
id: function(data) {
var O0u = L9N;
O0u += N9m;
O0u += D9N;
O0u += H8U;
var idFn = DataTable[F8U][O0u][n1N](this[z9N][Q0c]);
return idFn(data);
},
individual: function(identifier, fieldNames) {
var idFn = DataTable[F8U][c7N][n1N](this[z9N][Q0c]);
var dt = __dtApi(this[z9N][N5N]);
var fields = this[z9N][a7d];
var out = {};
var forceFields;
G8z[G8z.i3U]();
var responsiveNode;
if (fieldNames) {
var a0u = z8U;
a0u += G8z.T3U;
a0u += c5U;
a0u += C9N;
if (!$[f7d](fieldNames)) {
fieldNames = [fieldNames];
}
forceFields = {};
$[a0u](fieldNames, function(i, name) {
forceFields[name] = fields[name];
});
}
__dtCellSelector(out, dt, identifier, fields, idFn, forceFields);
return out;
},
fields: function(identifier) {
var o4m = "col";
var B4m = "columns";
var w4m = "umn";
var U4m = "isPlainObje";
var j0u = c5U;
j0u += Y9d;
j0u += w4m;
j0u += z9N;
var q0u = U4m;
q0u += b3c;
var D0u = L9N;
D0u += j5N;
var idFn = DataTable[F8U][D0u][n1N](this[z9N][Q0c]);
var dt = __dtApi(this[z9N][N5N]);
var fields = this[z9N][a7d];
var out = {};
if ($[q0u](identifier) && (identifier[B8d] !== undefined || identifier[j0u] !== undefined || identifier[k4m] !== undefined)) {
var K0u = W4m;
K0u += z9N;
var N0u = p6N;
N0u += t4m;
if (identifier[N0u] !== undefined) {
var C0u = d5U;
C0u += L9N;
C0u += t4m;
__dtRowSelector(out, dt, identifier[C0u], fields, idFn);
}
if (identifier[B4m] !== undefined) {
var I0u = o4m;
I0u += v4m;
I0u += g8U;
I0u += z9N;
__dtColumnSelector(out, dt, identifier[I0u], fields, idFn);
}
if (identifier[K0u] !== undefined) {
__dtCellSelector(out, dt, identifier[k4m], fields, idFn);
}
} else {
__dtRowSelector(out, dt, identifier, fields, idFn);
}
return out;
},
create: function(fields, data) {
var k0u = C0c;
k0u += z8U;
var dt = __dtApi(this[z9N][k0u]);
if (!__dtIsSsp(dt, this)) {
var G0u = g8U;
G0u += u6d;
G0u += z8U;
var e0u = p4N;
e0u += q8U;
var row = dt[Z7d][e0u](data);
__dtHighlight(row[G0u]());
}
},
edit: function(identifier, fields, data, store) {
var R4m = "taTableExt";
var P4m = "awT";
var u4m = "owI";
var W0u = g8U;
W0u += L9N;
W0u += g8U;
W0u += z8U;
var b0u = S4m;
b0u += P4m;
b0u += C6N;
b0u += z8U;
var that = this;
var dt = __dtApi(this[z9N][N5N]);
if (!__dtIsSsp(dt, this) || this[z9N][I6c][b0u] === W0u) {
var P0u = g8U;
P0u += u6d;
P0u += z8U;
var h0u = G8z.T3U;
h0u += g8U;
h0u += G8z.u3U;
var rowId = __dataSources[C2N][A4N][X1N](this, data);
var row;
try {
row = dt[Z7d](__dtjqId(rowId));
} catch (e) {
row = dt;
}
if (!row[h0u]()) {
row = dt[Z7d](function(rowIdx, rowData, rowNode) {
var i4m = "ataT";
var E0u = H8U;
E0u += q8U;
var F0u = q8U;
F0u += i4m;
F0u += G8z.T3U;
F0u += g5U;
var Q0u = G8z.u3U;
Q0u += G8z.R3U;
G8z[Q0u]();
return rowId == __dataSources[F0u][E0u][X1N](that, rowData);
});
}
if (row[T4m]()) {
var B0u = V4m;
B0u += w8N;
var t0u = p6N;
t0u += R9N;
t0u += H4c;
t0u += z8d;
var U0u = d5U;
U0u += u4m;
U0u += z8d;
var w0u = N7N;
w0u += R4m;
var A0u = S8U;
A0u += g8U;
var extender = $[A0u][w0u][c7N][e9m];
var toSave = extender({}, row[u7N](), S0N);
toSave = extender(toSave, data, S0N);
row[u7N](toSave);
var idx = $[F7d](rowId, store[U0u]);
store[t0u][B0u](idx, K2U);
} else {
var v0u = G8z.T3U;
v0u += q8U;
v0u += q8U;
var o0u = p6N;
o0u += R9N;
row = dt[o0u][v0u](data);
}
__dtHighlight(row[P0u]());
}
},
remove: function(identifier, fields, store) {
var c4m = "ery";
var i0u = v9N;
i0u += g8U;
i0u += L3N;
i0u += C9N;
var that = this;
var dt = __dtApi(this[z9N][N5N]);
var cancelled = store[M4m];
if (cancelled[i0u] === G8z.I2U) {
dt[B8d](identifier)[Z5N]();
} else {
var V0u = o6c;
V0u += c4m;
var T0u = d5U;
T0u += k9d;
T0u += z9N;
var indexes = [];
dt[T0u](identifier)[V0u](function() {
var X4m = "index";
var id = __dataSources[C2N][A4N][X1N](that, this[u7N]());
if ($[F7d](id, cancelled) === -K2U) {
indexes[c2N](this[X4m]());
}
});
dt[B8d](indexes)[Z5N]();
}
},
prep: function(action, identifier, submit, json, store) {
var g2m = "ncelled";
G8z[R2N]();
if (action === q4c) {
var u0u = Z7d;
u0u += S7N;
u0u += z9N;
var cancelled = json[M4m] || [];
store[u0u] = $[S5d](submit[u7N], function(val, key) {
var Y4m = "EmptyObj";
var R0u = F2d;
R0u += Y4m;
R0u += R8d;
return !$[R0u](submit[u7N][key]) && $[F7d](key, cancelled) === -K2U ? key : undefined;
});
} else if (action === L4c) {
var M0u = n2m;
M0u += g2m;
store[M0u] = json[M4m] || [];
}
},
commit: function(action, identifier, data, store) {
var s2m = "tOpts";
var H2m = "drawType";
var S2m = "wI";
var z2m = "rowIds";
var r2m = "draw";
var y7u = g8U;
y7u += L9N;
y7u += g8U;
y7u += z8U;
var r7u = z8U;
r7u += u4N;
r7u += s2m;
var X0u = z8U;
X0u += q8U;
X0u += H8U;
X0u += m8U;
var c0u = G8z.u3U;
c0u += G8z.R3U;
var that = this;
G8z[c0u]();
var dt = __dtApi(this[z9N][N5N]);
if (!__dtIsSsp(dt, this) && action === X0u && store[z2m][U5N]) {
var Y0u = d5U;
Y0u += L9N;
Y0u += S2m;
Y0u += z8d;
var ids = store[Y0u];
var row;
var compare = function(id) {
var n7u = g8U;
n7u += G8z.R3U;
G8z[n7u]();
return function(rowIdx, rowData, rowNode) {
var g7u = P8d;
g7u += r8U;
return id == __dataSources[C2N][A4N][g7u](that, rowData);
};
};
for (var i = G8z.I2U, ien = ids[U5N]; i < ien; i++) {
var H7u = z9N;
H7u += K7N;
H7u += b8U;
H7u += n8d;
var z7u = G8z.T3U;
z7u += g8U;
z7u += G8z.u3U;
try {
var s7u = d5U;
s7u += k9d;
row = dt[s7u](__dtjqId(ids[i]));
} catch (e) {
row = dt;
}
if (!row[z7u]()) {
var S7u = d5U;
S7u += L9N;
S7u += R9N;
row = dt[S7u](compare(ids[i]));
}
if (row[T4m]() && !dt[H7u]()[G8z.I2U][y4m][K6m]) {
row[Z5N]();
}
}
}
var drawType = this[z9N][r7u][H2m];
if (drawType !== y7u) {
dt[r2m](drawType);
}
}
};
function __html_id(identifier) {
var p2m = "[data";
var y2m = 'keyless';
var L2m = " or `id` of: ";
var l2m = "th `data-editor-id`";
var Z2m = "Could not find an element wi";
var x2m = "-editor-id=\"";
var p7u = g8U;
p7u += G8z.R3U;
G8z[p7u]();
var context = document;
if (identifier !== y2m) {
var l7u = r8U;
l7u += X2N;
l7u += m8N;
var Z7u = d7d;
Z7u += m8N;
var x7u = p2m;
x7u += x2m;
context = $(x7u + identifier + R1c);
if (context[Z7u] === G8z.I2U) {
context = typeof identifier === q3d ? $(__dtjqId(identifier)) : $(identifier);
}
if (context[l7u] === G8z.I2U) {
var L7u = Z2m;
L7u += l2m;
L7u += L2m;
throw L7u + identifier;
}
}
return context;
}
function __html_el(identifier, name) {
var f2m = "[data-editor-field";
var m7u = E2N;
m7u += A2N;
var d7u = f2m;
d7u += d2m;
var f7u = g8U;
f7u += G8z.R3U;
var context = __html_id(identifier);
G8z[f7u]();
return $(d7u + name + m7u, context);
}
function __html_els(identifier, names) {
var J7u = d7d;
J7u += q4N;
J7u += Y2N;
var out = $();
for (var i = G8z.I2U, ien = names[J7u]; i < ien; i++) {
out = out[l7d](__html_el(identifier, names[i]));
}
G8z[R2N]();
return out;
}
function __html_get(identifier, dataSrc) {
var m2m = "-editor-value";
var J2m = "ilter";
var q7u = C9N;
q7u += m8U;
q7u += f5c;
var D7u = u7N;
D7u += m2m;
var a7u = v9N;
a7u += w3N;
var O7u = S8U;
O7u += J2m;
var el = __html_el(identifier, dataSrc);
return el[O7u](O2m)[a7u] ? el[N3d](D7u) : el[q7u]();
}
function __html_set(identifier, fields, data) {
$[U2N](fields, function(name, field) {
var C2m = "tor-";
var D2m = "romDat";
var N2m = "data-ed";
var q2m = "aS";
var a2m = "lF";
var I2m = "value";
var j7u = N4N;
j7u += a2m;
j7u += D2m;
j7u += G8z.T3U;
var val = field[j7u](data);
if (val !== undefined) {
var C7u = v9N;
C7u += w3N;
var N7u = T7N;
N7u += q2m;
N7u += q0c;
var el = __html_el(identifier, field[N7u]());
if (el[j2m](O2m)[C7u]) {
var K7u = N2m;
K7u += H8U;
K7u += C2m;
K7u += I2m;
var I7u = G8z.T3U;
I7u += C8c;
I7u += d5U;
el[I7u](K7u, val);
} else {
var b7u = g4d;
b7u += f5c;
el[U2N](function() {
var k2m = "emoveChild";
var e2m = "firstChild";
var K2m = "childNodes";
var e7u = v9N;
e7u += d6N;
e7u += m8U;
e7u += C9N;
var k7u = G8z.u3U;
k7u += G8z.R3U;
G8z[k7u]();
while (this[K2m][e7u]) {
var G7u = d5U;
G7u += k2m;
this[G7u](this[e2m]);
}
})[b7u](val);
}
}
});
}
__dataSources[p8N] = {
id: function(data) {
var W7u = z8U;
W7u += g4N;
W7u += m8U;
var idFn = DataTable[W7u][c7N][n1N](this[z9N][Q0c]);
G8z[R2N]();
return idFn(data);
},
initField: function(cfg) {
var G2m = '[data-editor-label="';
var F7u = r8U;
F7u += G8z.T3U;
F7u += O5U;
F7u += J7d;
var Q7u = E2N;
Q7u += A2N;
var h7u = P1c;
h7u += q9N;
h7u += z8U;
var label = $(G2m + (cfg[u7N] || cfg[h7u]) + Q7u);
G8z[R2N]();
if (!cfg[F7u] && label[U5N]) {
var A7u = g4d;
A7u += f5c;
var E7u = R7d;
E7u += D0N;
cfg[E7u] = label[A7u]();
}
},
individual: function(identifier, fieldNames) {
var A2m = "less";
var W2m = "dSelf";
var w2m = "Cannot automatica";
var Q2m = "dBa";
var F2m = 'data-editor-field';
var b2m = "-i";
var h2m = "addB";
var U2m = "lly determine field name from data source";
var E2m = '[data-editor-id]';
var u7u = d8d;
u7u += z9N;
var V7u = c5U;
V7u += k8d;
V7u += r8U;
var i7u = v9N;
i7u += g8U;
i7u += m8N;
var w7u = G8z.u3U;
w7u += G8z.R3U;
G8z[w7u]();
var attachEl;
if (identifier instanceof $ || identifier[Q4m]) {
var v7u = y4c;
v7u += b2m;
v7u += q8U;
var o7u = J5N;
o7u += W2m;
var B7u = h2m;
B7u += G8z.T3U;
B7u += j8N;
var t7u = p4N;
t7u += Q2m;
t7u += j8N;
var U7u = S8U;
U7u += g8U;
attachEl = identifier;
if (!fieldNames) {
fieldNames = [$(identifier)[N3d](F2m)];
}
var back = $[U7u][t7u] ? B7u : o7u;
identifier = $(identifier)[d3N](E2m)[back]()[u7N](v7u);
}
if (!identifier) {
var P7u = G3d;
P7u += A2m;
identifier = P7u;
}
if (fieldNames && !$[f7d](fieldNames)) {
fieldNames = [fieldNames];
}
if (!fieldNames || fieldNames[i7u] === G8z.I2U) {
var T7u = w2m;
T7u += U2m;
throw T7u;
}
var out = __dataSources[p8N][a7d][V7u](this, identifier);
var fields = this[z9N][u7u];
var forceFields = {};
$[U2N](fieldNames, function(i, name) {
forceFields[name] = fields[name];
});
$[U2N](out, function(id, set) {
var o2m = "tach";
var v2m = "cel";
var t2m = "playFi";
var B2m = "Arr";
var n1u = l9d;
n1u += t2m;
n1u += z8U;
n1u += f8U;
var Y7u = U4N;
Y7u += B2m;
Y7u += p2N;
var X7u = M7N;
X7u += o2m;
var c7u = v2m;
c7u += r8U;
var M7u = m8U;
M7u += G8z.u3U;
M7u += D9N;
M7u += z8U;
var R7u = g8U;
R7u += G8z.R3U;
G8z[R7u]();
set[M7u] = c7u;
set[X7u] = attachEl ? $(attachEl) : __html_els(identifier, fieldNames)[Y7u]();
set[a7d] = fields;
set[n1u] = forceFields;
});
return out;
},
fields: function(identifier) {
var P2m = "yles";
var z1u = t4N;
z1u += v3d;
var out = {};
var self = __dataSources[p8N];
if ($[f7d](identifier)) {
var g1u = v9N;
g1u += u1d;
g1u += C9N;
for (var i = G8z.I2U, ien = identifier[g1u]; i < ien; i++) {
var s1u = c5U;
s1u += k8d;
s1u += r8U;
var res = self[a7d][s1u](this, identifier[i]);
out[identifier[i]] = res[identifier[i]];
}
return out;
}
var data = {};
var fields = this[z9N][z1u];
if (!identifier) {
var S1u = P5N;
S1u += z8U;
S1u += P2m;
S1u += z9N;
identifier = S1u;
}
$[U2N](fields, function(name, field) {
var i2m = "valT";
var T2m = "oD";
var V2m = "taSrc";
var r1u = i2m;
r1u += T2m;
r1u += y5d;
var H1u = q8U;
H1u += G8z.T3U;
H1u += V2m;
G8z[R2N]();
var val = __html_get(identifier, field[H1u]());
field[r1u](data, val === I1N ? undefined : val);
});
out[identifier] = {
idSrc: identifier,
data: data,
node: document,
fields: fields,
type: Z9d
};
return out;
},
create: function(fields, data) {
if (data) {
var y1u = c5U;
y1u += k8d;
y1u += r8U;
var id = __dataSources[p8N][A4N][y1u](this, data);
try {
var p1u = v9N;
p1u += w3N;
if (__html_id(id)[p1u]) {
__html_set(id, fields, data);
}
} catch (e) {}
}
},
edit: function(identifier, fields, data) {
var l1u = G3d;
l1u += v9N;
l1u += b5N;
var Z1u = H8U;
Z1u += q8U;
var x1u = C9N;
x1u += m8U;
x1u += q9N;
x1u += r8U;
var id = __dataSources[x1u][Z1u][X1N](this, data) || l1u;
__html_set(id, fields, data);
},
remove: function(identifier, fields) {
var L1u = V9N;
L1u += u2m;
L1u += z8U;
__html_id(identifier)[L1u]();
}
};
}());
Editor[f1u] = {
"wrapper": X8U,
"processing": {
"indicator": d1u,
"active": j1N
},
"header": {
"wrapper": R2m,
"content": m1u
},
"body": {
"wrapper": J1u,
"content": M2m
},
"footer": {
"wrapper": O1u,
"content": a1u
},
"form": {
"wrapper": A5U,
"content": c2m,
"tag": n9d,
"info": X2m,
"error": D1u,
"buttons": q1u,
"button": j1u,
"buttonInternal": Y2m
},
"field": {
"wrapper": n0m,
"typePrefix": g0m,
"namePrefix": N1u,
"label": s0m,
"input": z0m,
"inputControl": S0m,
"error": H0m,
"msg-label": C1u,
"msg-error": r0m,
"msg-message": y0m,
"msg-info": I1u,
"multiValue": K1u,
"multiInfo": k1u,
"multiRestore": e1u,
"multiNoEdit": G1u,
"disabled": b1u,
"processing": p0m
},
"actions": {
"create": W1u,
"edit": h1u,
"remove": Q1u
},
"inline": {
"wrapper": x0m,
"liner": F1u,
"buttons": Z0m
},
"bubble": {
"wrapper": E1u,
"liner": A1u,
"table": w1u,
"close": U1u,
"pointer": t1u,
"bg": l0m
}
};
(function() {
var C0m = "formButtons";
var V0m = "crea";
var e0m = "mBut";
var o0m = "nfir";
var s7m = 'buttons-edit';
var d7m = "editSingle";
var n7m = "formMessage";
var k0m = "titl";
var p7m = "formTitle";
var m7m = 'selectedSingle';
var R0m = 'buttons-create';
var f0m = "oveSing";
var j0m = "editor_create";
var D0m = "editor_re";
var d0m = "itSi";
var m0m = "ngle";
var J7m = "removeSingle";
var q0m = "BUTTONS";
var K0m = "select_single";
var J0m = "buttons-rem";
var N0m = "tl";
var I8u = d5U;
I8u += L0m;
I8u += f0m;
I8u += v9N;
var C8u = S9N;
C8u += g8U;
C8u += q8U;
var N8u = z8U;
N8u += q8U;
N8u += d0m;
N8u += m0m;
var p8u = J0m;
p8u += y5U;
var S8u = d5U;
S8u += L9N;
S8u += t4m;
var w3u = O0m;
w3u += a4N;
var I3u = z8U;
I3u += g4N;
I3u += m8U;
I3u += O6d;
var C3u = z8U;
C3u += g4N;
C3u += m8U;
var B1u = g8U;
B1u += G8z.R3U;
G8z[B1u]();
if (DataTable[t0c]) {
var S3u = v8U;
S3u += a0m;
var z3u = d8U;
z3u += m8U;
z3u += O6d;
var s3u = D0m;
s3u += u2m;
s3u += z8U;
var R1u = y4c;
R1u += A6N;
R1u += l6N;
var ttButtons = DataTable[t0c][q0m];
var ttButtonBase = {
sButtonText: I1N,
editor: I1N,
formTitle: I1N
};
ttButtons[j0m] = $[A7N](S0N, ttButtons[g9d], ttButtonBase, {
formButtons: [{
label: I1N,
fn: function(e) {
var o1u = z9N;
o1u += i8U;
o1u += Z8c;
this[o1u]();
}
}],
fnClick: function(button, config) {
var I0m = "bmi";
var u1u = m8U;
u1u += H8U;
u1u += N0m;
u1u += z8U;
var i1u = r8U;
i1u += r8N;
var P1u = H8U;
P1u += J8U;
P1u += g8U;
var v1u = a4N;
v1u += j8U;
var editor = config[v1u];
var i18nCreate = editor[P1u][i3d];
var buttons = config[C0m];
if (!buttons[G8z.I2U][i1u]) {
var V1u = z8c;
V1u += I0m;
V1u += m8U;
var T1u = r8U;
T1u += G8z.T3U;
T1u += D0N;
buttons[G8z.I2U][T1u] = i18nCreate[V1u];
}
editor[i3d]({
title: i18nCreate[u1u],
buttons: buttons
});
}
});
ttButtons[R1u] = $[A7N](S0N, ttButtons[K0m], ttButtonBase, {
formButtons: [{
label: I1N,
fn: function(e) {
var M1u = z8c;
M1u += O5U;
M1u += G9m;
this[M1u]();
}
}],
fnClick: function(button, config) {
var G0m = "dito";
var b0m = "fnGetSelectedIndexes";
var g3u = k0m;
g3u += z8U;
var Y1u = g7N;
Y1u += J7d;
var X1u = n0c;
X1u += e0m;
X1u += q9c;
var c1u = z8U;
c1u += G0m;
c1u += d5U;
var selected = this[b0m]();
if (selected[U5N] !== K2U) {
return;
}
var editor = config[c1u];
var i18nEdit = editor[W0m][r5d];
var buttons = config[X1u];
if (!buttons[G8z.I2U][Y1u]) {
var n3u = l8c;
n3u += q9N;
n3u += l6N;
buttons[G8z.I2U][H1N] = i18nEdit[n3u];
}
editor[r5d](selected[G8z.I2U], {
title: i18nEdit[g3u],
buttons: buttons
});
}
});
ttButtons[s3u] = $[z3u](S0N, ttButtons[S3u], ttButtonBase, {
question: I1N,
formButtons: [{
label: I1N,
fn: function(e) {
var h0m = "subm";
var H3u = h0m;
H3u += H8U;
H3u += m8U;
var that = this;
this[H3u](function(json) {
var A0m = "ance";
var Q0m = "fnG";
var E0m = "nst";
var w0m = "taTab";
var U0m = "fnSelectNone";
var F0m = "etI";
var x3u = j7N;
x3u += O5U;
x3u += v9N;
var p3u = Q0m;
p3u += F0m;
p3u += E0m;
p3u += A0m;
var y3u = N7N;
y3u += w0m;
y3u += v9N;
var r3u = S8U;
r3u += g8U;
var tt = $[r3u][y3u][t0c][p3u]($(that[z9N][x3u])[F2N]()[N5N]()[r7d]());
G8z[G8z.i3U]();
tt[U0m]();
});
}
}],
fnClick: function(button, config) {
var T0m = "ndexe";
var i0m = "GetSelectedI";
var P0m = "mBu";
var v0m = "onfi";
var t0m = "irm";
var N3u = k0m;
N3u += z8U;
var q3u = p4d;
q3u += t0m;
var D3u = d7d;
D3u += q4N;
D3u += m8U;
D3u += C9N;
var a3u = y5N;
a3u += g8U;
a3u += B0m;
a3u += q9N;
var O3u = s0d;
O3u += t4N;
O3u += f9N;
var J3u = y5N;
J3u += o0m;
J3u += q9N;
var m3u = z9N;
m3u += X8d;
m3u += o8N;
var d3u = c5U;
d3u += v0m;
d3u += d5U;
d3u += q9N;
var f3u = n0c;
f3u += P0m;
f3u += z9c;
f3u += V1N;
var L3u = H8U;
L3u += J8U;
L3u += g8U;
var l3u = r8U;
l3u += z8U;
l3u += g8U;
l3u += m8N;
var Z3u = g8N;
Z3u += i0m;
Z3u += T0m;
Z3u += z9N;
var rows = this[Z3u]();
if (rows[l3u] === G8z.I2U) {
return;
}
var editor = config[y4c];
var i18nRemove = editor[L3u][Z5N];
var buttons = config[f3u];
var question = typeof i18nRemove[d3u] === m3u ? i18nRemove[J3u] : i18nRemove[O3u][rows[U5N]] ? i18nRemove[a3u][rows[D3u]] : i18nRemove[q3u][G8U];
if (!buttons[G8z.I2U][H1N]) {
var j3u = z9N;
j3u += i8U;
j3u += O5U;
j3u += G9m;
buttons[G8z.I2U][H1N] = i18nRemove[j3u];
}
editor[Z5N](rows, {
message: question[v8N](/%d/g, rows[U5N]),
title: i18nRemove[N3u],
buttons: buttons
});
}
});
}
var _buttons = DataTable[C3u][w1d];
$[I3u](_buttons, {
create: {
text: function(dt, node, config) {
var u0m = "s.create";
var G3u = O5U;
G3u += i6c;
var e3u = V0m;
e3u += u9N;
var k3u = z8U;
k3u += q8U;
k3u += H8U;
k3u += Y7N;
var K3u = n2N;
K3u += g8U;
K3u += u0m;
G8z[G8z.i3U]();
return dt[W0m](K3u, config[k3u][W0m][e3u][G3u]);
},
className: R0m,
editor: I1N,
formButtons: {
text: function(editor) {
return editor[W0m][i3d][i7d];
},
action: function(e) {
G8z[G8z.i3U]();
this[i7d]();
}
},
formMessage: I1N,
formTitle: I1N,
action: function(e, dt, node, config) {
var X0m = "ocessin";
var c0m = "Open";
var M0m = "mTi";
var A3u = V0m;
A3u += m8U;
A3u += z8U;
var E3u = n0c;
E3u += M0m;
E3u += N0m;
E3u += z8U;
var F3u = n0c;
F3u += e0m;
F3u += q9c;
var h3u = H6N;
h3u += z8U;
h3u += c0m;
var W3u = L9N;
W3u += g8U;
W3u += z8U;
var b3u = H6N;
b3u += X0m;
b3u += q4N;
var that = this;
var editor = config[y4c];
this[b3u](S0N);
editor[W3u](h3u, function() {
var Y0m = "rocessin";
var Q3u = D9N;
Q3u += Y0m;
Q3u += q4N;
G8z[R2N]();
that[Q3u](z0N);
})[i3d]({
buttons: config[F3u],
message: config[n7m] || editor[W0m][i3d][W1d],
title: config[E3u] || editor[W0m][A3u][Q1d]
});
}
},
edit: {
extend: w3u,
text: function(dt, node, config) {
var g7m = "buttons.";
var B3u = d7c;
B3u += m8U;
var t3u = z8U;
t3u += u4N;
t3u += U4N;
t3u += d5U;
var U3u = g7m;
U3u += r5d;
return dt[W0m](U3u, config[t3u][W0m][B3u][H9d]);
},
className: s7m,
editor: I1N,
formButtons: {
text: function(editor) {
var z7m = "submi";
var P3u = z7m;
P3u += m8U;
var v3u = a4N;
v3u += H8U;
v3u += m8U;
var o3u = H8U;
o3u += l4c;
return editor[o3u][v3u][P3u];
},
action: function(e) {
var T3u = z9N;
T3u += d3d;
T3u += q9N;
T3u += l6N;
var i3u = G8z.u3U;
i3u += G8z.R3U;
G8z[i3u]();
this[T3u]();
}
},
formMessage: I1N,
formTitle: I1N,
action: function(e, dt, node, config) {
var H7m = "olumns";
var y7m = "xes";
var S7m = "xe";
var r7m = "nde";
var z8u = H8U;
z8u += J8U;
z8u += g8U;
var n8u = L9N;
n8u += s2d;
var Y3u = G8z.u3U;
Y3u += G8z.R3U;
var X3u = i5c;
X3u += Z0c;
var c3u = r8U;
c3u += z8U;
c3u += w3N;
var M3u = b8U;
M3u += i4N;
M3u += S7m;
M3u += z9N;
var R3u = W4m;
R3u += z9N;
var u3u = c5U;
u3u += H7m;
var V3u = H8U;
V3u += r7m;
V3u += y7m;
var that = this;
var editor = config[y4c];
var rows = dt[B8d]({
selected: S0N
})[V3u]();
var columns = dt[u3u]({
selected: S0N
})[J4m]();
var cells = dt[R3u]({
selected: S0N
})[M3u]();
var items = columns[c3u] || cells[U5N] ? {
rows: rows,
columns: columns,
cells: cells
} : rows;
this[X3u](S0N);
G8z[Y3u]();
editor[n8u](w5c, function() {
var s8u = D9N;
s8u += d5U;
s8u += N6m;
var g8u = G8z.u3U;
g8u += G8z.R3U;
G8z[g8u]();
that[s8u](z0N);
})[r5d](items, {
buttons: config[C0m],
message: config[n7m] || editor[z8u][r5d][W1d],
title: config[p7m] || editor[W0m][r5d][Q1d]
});
}
},
remove: {
extend: x7m,
limitTo: [S8u],
text: function(dt, node, config) {
var L7m = 'buttons.remove';
var Z7m = "ton";
var y8u = O5U;
y8u += i8U;
y8u += m8U;
y8u += Z7m;
var r8u = l7m;
r8u += g8U;
var H8u = z8U;
H8u += u4N;
H8u += m8U;
H8u += Y5U;
return dt[W0m](L7m, config[H8u][r8u][Z5N][y8u]);
},
className: p8u,
editor: I1N,
formButtons: {
text: function(editor) {
var Z8u = t6c;
Z8u += L9N;
Z8u += E0N;
Z8u += z8U;
var x8u = H8U;
x8u += l4c;
G8z[G8z.i3U]();
return editor[x8u][Z8u][i7d];
},
action: function(e) {
var l8u = l8c;
l8u += G9m;
this[l8u]();
}
},
formMessage: function(editor, dt) {
var d8u = v9N;
d8u += g8U;
d8u += L3N;
d8u += C9N;
var f8u = c5U;
f8u += L9N;
f8u += o0m;
f8u += q9N;
var L8u = s0d;
L8u += B0m;
L8u += q9N;
var rows = dt[B8d]({
selected: S0N
})[J4m]();
var i18n = editor[W0m][Z5N];
var question = typeof i18n[L8u] === q3d ? i18n[f8u] : i18n[J4c][rows[U5N]] ? i18n[J4c][rows[U5N]] : i18n[J4c][G8U];
return question[v8N](/%d/g, rows[d8u]);
},
formTitle: I1N,
action: function(e, dt, node, config) {
var f7m = "ndexes";
var j8u = t6c;
j8u += y5U;
var q8u = H8U;
q8u += f7m;
var D8u = p6N;
D8u += R9N;
D8u += z9N;
var a8u = V9N;
a8u += q9N;
a8u += B6c;
a8u += z8U;
var J8u = L9N;
J8u += g8U;
J8u += z8U;
var m8u = U8d;
m8u += q4N;
var that = this;
var editor = config[y4c];
this[m8u](S0N);
editor[J8u](w5c, function() {
var O8u = m6N;
O8u += W8N;
G8z[G8z.i3U]();
that[O8u](z0N);
})[a8u](dt[D8u]({
selected: S0N
})[q8u](), {
buttons: config[C0m],
message: config[n7m],
title: config[p7m] || editor[W0m][j8u][Q1d]
});
}
}
});
_buttons[N8u] = $[A7N]({}, _buttons[r5d]);
_buttons[d7m][C8u] = m7m;
_buttons[I8u] = $[A7N]({}, _buttons[Z5N]);
_buttons[J7m][A7N] = m7m;
}());
Editor[K8u] = {};
Editor[O7m] = function(input, opts) {
var U7m = "iv c";
var H1m = "div class=\"";
var S1m = "ious";
var E1m = 's';
var M7m = "-la";
var O1m = "Without momentjs only the format 'YYYY-MM-DD' can be used";
var e1m = '-time">';
var s1m = "</butt";
var q1m = '-title">';
var W1m = '-error';
var N1m = '<button>';
var x1m = " c";
var j7m = "Ti";
var k7m = "im";
var v7m = "t class=\"";
var b1m = '-calendar';
var B7m = "/di";
var T7m = "-labe";
var E7m = "<div cl";
var R7m = "pan/>";
var g1m = "ght\">";
var y1m = "e\"";
var l1m = "momen";
var A7m = "-mi";
var I1m = '-month"/>';
var N7m = "editor-dat";
var Y7m = "utton>";
var z1m = "on>";
var h1m = "_instance";
var F7m = "econds\"";
var t7m = "<div clas";
var K1m = '-year"/>';
var k1m = '-calendar"/>';
var L1m = "aul";
var F1m = /[Hhm]|LT|LTS/;
var X7m = "</b";
var G1m = '-hours"/>';
var h7m = "ror\"/";
var r1m = "-dat";
var p1m = "iv class=\"";
var w1m = "calendar";
var Q1m = /[YMD]|L(?!T)|l/;
var I7m = "me-";
var J1m = "Editor datetime: ";
var W7m = "-er";
var Z1m = "YYYY-MM-D";
var V7m = "l\">";
var j1m = '-iconLeft">';
var C7m = "ei";
var i7m = "n/";
var A1m = /[haA]/;
var C1m = '<select class="';
var u7m = "v cla";
var b7m = "/d";
var o7m = "<selec";
var w7m = "nutes\"/>";
var w5u = G2N;
w5u += b2N;
var A5u = Z9c;
A5u += H9N;
var E5u = D8c;
E5u += r8U;
E5u += z8U;
var F5u = q8U;
F5u += L9N;
F5u += q9N;
var Q5u = q8U;
Q5u += G8z.T3U;
Q5u += m8U;
Q5u += z8U;
var h5u = n1c;
h5u += Y5U;
var W5u = J6d;
W5u += O6d;
var b5u = m8U;
b5u += H8U;
b5u += e8U;
var G5u = q8U;
G5u += L9N;
G5u += q9N;
var e5u = q8U;
e5u += G8z.T3U;
e5u += m8U;
e5u += z8U;
var k5u = F1N;
k5u += q9N;
var K5u = s0d;
K5u += p3N;
K5u += g8U;
K5u += e4N;
var I5u = C5U;
I5u += f9N;
I5u += M7N;
var C5u = f4d;
C5u += S1c;
var N5u = O5N;
N5u += a7m;
N5u += C9N;
var j5u = S8U;
j5u += L9N;
j5u += D7m;
var q5u = q7m;
q5u += u9N;
q5u += j7m;
q5u += e8U;
var D5u = N7m;
D5u += C7m;
D5u += I7m;
var a5u = K7m;
a5u += k7m;
a5u += z8U;
var O5u = e7m;
O5u += q8U;
var J5u = K7m;
J5u += H8U;
J5u += m8U;
J5u += v9N;
var m5u = t4N;
m5u += H9N;
var d5u = G7m;
d5u += N7N;
d5u += m8U;
d5u += z8U;
var f5u = t4N;
f5u += g8U;
f5u += q8U;
var L5u = I0N;
L5u += b7m;
L5u += H8U;
L5u += h0N;
var l5u = W7m;
l5u += h7m;
l5u += W0N;
var Z5u = p9c;
Z5u += Q7m;
var x5u = G7m;
x5u += z9N;
x5u += F7m;
x5u += u2c;
var p5u = E7m;
p5u += G8z.T3U;
p5u += H0c;
var y5u = A7m;
y5u += w7m;
var r5u = H9c;
r5u += U7m;
r5u += Q7m;
var H5u = t7m;
H5u += y9c;
var S5u = E7m;
S5u += G8z.T3U;
S5u += b5N;
S5u += d2m;
var z5u = I0N;
z5u += B7m;
z5u += h0N;
var s5u = o7m;
s5u += v7m;
var g5u = P7m;
g5u += x4N;
g5u += i7m;
g5u += W0N;
var n5u = T7m;
n5u += V7m;
var Y8u = H9c;
Y8u += H8U;
Y8u += u7m;
Y8u += H0c;
var X8u = P7m;
X8u += R7m;
var c8u = M7m;
c8u += D0N;
c8u += c7m;
var M8u = E7m;
M8u += x9c;
var R8u = I0N;
R8u += b7m;
R8u += H8U;
R8u += h0N;
var u8u = X7m;
u8u += Y7m;
var V8u = n1m;
V8u += H8U;
V8u += g1m;
var T8u = I0N;
T8u += V0N;
T8u += c1d;
T8u += W0N;
var i8u = s1m;
i8u += z1m;
var P8u = D9N;
P8u += d5U;
P8u += o6c;
P8u += S1m;
var v8u = I0N;
v8u += H1m;
var o8u = H9c;
o8u += U7m;
o8u += R7d;
o8u += H0c;
var B8u = r1m;
B8u += y1m;
B8u += W0N;
var t8u = H9c;
t8u += p1m;
var U8u = E2N;
U8u += W0N;
var w8u = I0N;
w8u += c1d;
w8u += x1m;
w8u += Q7m;
var h8u = Z1m;
h8u += D8U;
var W8u = l1m;
W8u += m8U;
var b8u = l7m;
b8u += g8U;
var G8u = H3N;
G8u += L1m;
G8u += W7N;
var e8u = D8U;
e8u += C8d;
e8u += f1m;
var k8u = F8U;
k8u += z8U;
k8u += H9N;
this[c5U] = $[k8u](S0N, {}, Editor[e8u][G8u], opts);
var classPrefix = this[c5U][d1m];
G8z[G8z.i3U]();
var i18n = this[c5U][b8u];
if (!window[W8u] && this[c5U][m1m] !== h8u) {
var Q8u = J1m;
Q8u += O1m;
throw Q8u;
}
var timeBlock = function(type) {
var a1m = "imeblock";
var A8u = a9d;
A8u += W0N;
var E8u = K7m;
E8u += a1m;
E8u += c7m;
var F8u = X0N;
F8u += e3N;
F8u += r7N;
F8u += E2N;
return F8u + classPrefix + E8u + A8u;
};
var gap = function() {
var D1m = '<span>:</span>';
return D1m;
};
var structure = $(w8u + classPrefix + U8u + t8u + classPrefix + B8u + o8u + classPrefix + q1m + v8u + classPrefix + j1m + N1m + i18n[P8u] + i8u + T8u + g1N + classPrefix + V8u + N1m + i18n[g5c] + u8u + R8u + M8u + classPrefix + c8u + X8u + C1m + classPrefix + I1m + p1N + Y8u + classPrefix + n5u + g5u + s5u + classPrefix + K1m + p1N + z5u + g1N + classPrefix + k1m + p1N + S5u + classPrefix + e1m + H5u + classPrefix + G1m + r5u + classPrefix + y5u + p5u + classPrefix + x5u + p1N + Z5u + classPrefix + l5u + L5u);
this[b1N] = {
container: structure,
date: structure[f5u](D9c + classPrefix + d5u),
title: structure[m5u](D9c + classPrefix + J5u),
calendar: structure[V1c](D9c + classPrefix + b1m),
time: structure[O5u](D9c + classPrefix + a5u),
error: structure[V1c](D9c + classPrefix + W1m),
input: $(input)
};
this[z9N] = {
d: I1N,
display: I1N,
minutesRange: I1N,
secondsRange: I1N,
namespace: D5u + Editor[q5u][h1m]++,
parts: {
date: this[c5U][j5u][A3c](Q1m) !== I1N,
time: this[c5U][m1m][N5u](F1m) !== I1N,
seconds: this[c5U][m1m][C5u](E1m) !== -K2U,
hours12: this[c5U][I5u][A3c](A1m) !== I1N
}
};
this[b1N][K5u][G9d](this[k5u][e5u])[G9d](this[G5u][b5u])[W5u](this[b1N][h5u]);
this[b1N][Q5u][G9d](this[F5u][E5u])[A5u](this[b1N][w1m]);
this[w5u]();
};
$[U5u](Editor[O7m][M1N], {
destroy: function() {
var B1m = '.editor-datetime';
var t1m = "ain";
var P5u = b8U;
P5u += U1m;
var v5u = z8U;
v5u += q9N;
v5u += D9N;
v5u += Y9N;
var o5u = L9N;
o5u += S8U;
o5u += S8U;
var B5u = s0d;
B5u += m8U;
B5u += t1m;
B5u += e4N;
var t5u = Y4d;
t5u += q8U;
t5u += z8U;
this[t5u]();
this[b1N][B5u][o5u]()[v5u]();
this[b1N][P5u][o1d](B1m);
},
errorMsg: function(msg) {
G8z[G8z.i3U]();
var error = this[b1N][I3N];
if (msg) {
error[p8N](msg);
} else {
error[m3d]();
}
},
hide: function() {
var i5u = G8U;
i5u += u1N;
i5u += q8U;
i5u += z8U;
this[i5u]();
},
max: function(date) {
var i1m = "itle";
var T1m = "max";
var v1m = "Calander";
var R5u = o1m;
R5u += v1m;
var u5u = P1m;
u5u += i1m;
var V5u = G8z.u3U;
V5u += G8z.R3U;
var T5u = T1m;
T5u += q7m;
T5u += u9N;
this[c5U][T5u] = date;
G8z[V5u]();
this[u5u]();
this[R5u]();
},
min: function(date) {
var u1m = "_optionsTitle";
this[c5U][V1m] = date;
this[u1m]();
G8z[G8z.i3U]();
this[R1m]();
},
owns: function(node) {
var M5u = t2N;
M5u += u9N;
M5u += d5U;
G8z[G8z.i3U]();
return $(node)[d3N]()[M5u](this[b1N][f3N])[U5N] > G8z.I2U;
},
val: function(set, write) {
var r3m = "Strict";
var m3m = "teOu";
var c1m = "lander";
var d3m = "_wr";
var x3m = "ale";
var p3m = "Loc";
var g3m = "ring";
var M1m = "Ca";
var J3m = "tput";
var H3m = "isVali";
var Y1m = "CDate";
var f3m = /(\d{4})\-(\d{2})\-(\d{2})/;
var z3m = '--now';
var Z3m = "utc";
var y3m = "mom";
var n3m = "toSt";
var p99 = o1m;
p99 += M1m;
p99 += c1m;
var y99 = o1m;
y99 += N9N;
y99 += l6N;
y99 += v9N;
var r99 = z9N;
r99 += X1m;
r99 += Y1m;
var H99 = n3m;
H99 += g3m;
if (set === undefined) {
return this[z9N][q8U];
}
if (set instanceof Date) {
this[z9N][q8U] = this[s3m](set);
} else if (set === I1N || set === R7N) {
this[z9N][q8U] = I1N;
} else if (set === z3m) {
this[z9N][q8U] = new Date();
} else if (typeof set === q3d) {
if (window[S3m]) {
var n99 = U4N;
n99 += q7m;
n99 += u9N;
var Y5u = H3m;
Y5u += q8U;
var X5u = S3m;
X5u += r3m;
var c5u = y3m;
c5u += V3d;
c5u += p3m;
c5u += x3m;
var m = window[S3m][Z3m](set, this[c5U][m1m], this[c5U][c5u], this[c5U][X5u]);
this[z9N][q8U] = m[Y5u]() ? m[n99]() : I1N;
} else {
var g99 = l3m;
g99 += L3m;
var match = set[A3c](f3m);
this[z9N][q8U] = match ? new Date(Date[g99](match[K2U], match[k2U] - K2U, match[e2U])) : I1N;
}
}
if (write || write === undefined) {
if (this[z9N][q8U]) {
var s99 = d3m;
s99 += H8U;
s99 += m3m;
s99 += J3m;
this[s99]();
} else {
var S99 = b8U;
S99 += D9N;
S99 += i8U;
S99 += m8U;
var z99 = q8U;
z99 += L9N;
z99 += q9N;
this[z99][S99][D7N](set);
}
}
if (!this[z9N][q8U]) {
this[z9N][q8U] = this[s3m](new Date());
}
this[z9N][H5N] = new Date(this[z9N][q8U][H99]());
this[z9N][H5N][r99](K2U);
this[y99]();
this[p99]();
G8z[R2N]();
this[O3m]();
},
_constructor: function() {
var E3m = ':visible';
var h3m = 'focus.editor-datetime click.editor-datetime';
var I3m = "time";
var M3m = "_setTitle";
var A3m = 'keyup.editor-datetime';
var e3m = "ild";
var W3m = 'off';
var G3m = "ren";
var K3m = "seconds";
var p8m = "_writeOutput";
var a3m = "lec";
var o3m = "ec";
var q3m = "taine";
var g8m = "tUTC";
var k3m = "-secon";
var X3m = "_se";
var b3m = 'autocomplete';
var a69 = L9N;
a69 += g8U;
var T99 = z9N;
T99 += z8U;
T99 += a3m;
T99 += m8U;
var i99 = c5U;
i99 += C9N;
i99 += G8z.T3U;
i99 += D3m;
var P99 = L9N;
P99 += g8U;
var v99 = y5N;
v99 += g8U;
v99 += q3m;
v99 += d5U;
var h99 = q8U;
h99 += L9N;
h99 += q9N;
var W99 = G8z.u3U;
W99 += G8z.R3U;
var b99 = P1m;
b99 += x4c;
b99 += z8U;
var D99 = x4N;
D99 += d5U;
D99 += m8U;
D99 += z9N;
var that = this;
var classPrefix = this[c5U][d1m];
var onChange = function() {
var j3m = "onCha";
var L99 = H8U;
L99 += c0N;
var l99 = c5U;
l99 += X5N;
var Z99 = j3m;
Z99 += D3m;
var x99 = g8U;
x99 += G8z.R3U;
G8z[x99]();
that[c5U][Z99][l99](that, that[b1N][u0N][D7N](), that[z9N][q8U], that[b1N][L99]);
};
if (!this[z9N][N3m][C3m]) {
var d99 = t5N;
d99 += z9N;
var f99 = N7N;
f99 += u9N;
this[b1N][f99][d99](z8N, h8N);
}
if (!this[z9N][N3m][I3m]) {
var a99 = G5N;
a99 += s2d;
var O99 = u4N;
O99 += z9N;
O99 += D9N;
O99 += c3d;
var J99 = m8U;
J99 += H8U;
J99 += q9N;
J99 += z8U;
var m99 = F1N;
m99 += q9N;
this[m99][J99][G1N](O99, a99);
}
if (!this[z9N][D99][K3m]) {
var G99 = z8U;
G99 += p1d;
var e99 = z9N;
e99 += x4N;
e99 += g8U;
var k99 = r9N;
k99 += T6d;
k99 += V6d;
var K99 = m8U;
K99 += H8U;
K99 += q9N;
K99 += z8U;
var I99 = d5U;
I99 += a7c;
var C99 = k3m;
C99 += z8d;
var N99 = q8U;
N99 += H8U;
N99 += E0N;
N99 += c8d;
var j99 = c5U;
j99 += C9N;
j99 += e3m;
j99 += G3m;
var q99 = q8U;
q99 += L9N;
q99 += q9N;
this[q99][I3m][j99](N99 + classPrefix + C99)[I99]();
this[b1N][K99][k99](e99)[G99](K2U)[Z5N]();
}
this[b99]();
G8z[W99]();
this[h99][u0N][N3d](b3m, W3m)[y3N](h3m, function() {
var F3m = ":di";
var w99 = H8U;
w99 += Q3m;
w99 += i8U;
w99 += m8U;
var A99 = q8U;
A99 += L9N;
A99 += q9N;
var E99 = F3m;
E99 += z9N;
E99 += k0c;
E99 += a5U;
var F99 = H8U;
F99 += z9N;
var Q99 = J3N;
Q99 += F3N;
if (that[b1N][Q99][F99](E3m) || that[b1N][u0N][F2d](E99)) {
return;
}
that[D7N](that[A99][w99][D7N](), z0N);
that[X4d]();
})[y3N](A3m, function() {
var t99 = H8U;
t99 += z9N;
var U99 = w3m;
U99 += x3N;
G8z[G8z.i3U]();
if (that[b1N][U99][t99](E3m)) {
var o99 = E0N;
o99 += G8z.T3U;
o99 += r8U;
var B99 = H8U;
B99 += g8U;
B99 += i9m;
B99 += m8U;
that[D7N](that[b1N][B99][o99](), z0N);
}
});
this[b1N][v99][P99](i99, T99, function() {
var x8m = "_writeOutp";
var f8m = "_w";
var U3m = "_pos";
var t3m = "itio";
var z8m = "pm";
var R3m = "_correctMonth";
var n8m = "12";
var B3m = "-s";
var u3m = '-month';
var P3m = "-am";
var S8m = "tainer";
var v3m = "inut";
var l8m = "tTime";
var s8m = "Hours";
var d8m = "riteOutp";
var Y3m = "tTi";
var H8m = '-hours';
var c3m = "setUTCFullYear";
var T3m = "urs";
var L8m = "CMinutes";
var O69 = U3m;
O69 += t3m;
O69 += g8U;
var J69 = S8U;
J69 += L9N;
J69 += c5U;
J69 += x2N;
var f69 = B3m;
f69 += o3m;
f69 += y3N;
f69 += z8d;
var x69 = G7m;
x69 += q9N;
x69 += v3m;
x69 += y8U;
var X99 = P3m;
X99 += D9N;
X99 += q9N;
var c99 = j0d;
c99 += D7c;
var M99 = i3m;
M99 += L9N;
M99 += T3m;
var R99 = G7m;
R99 += V3m;
R99 += G8z.T3U;
R99 += d5U;
var V99 = C9N;
V99 += w1N;
V99 += D7c;
var select = $(this);
G8z[G8z.i3U]();
var val = select[D7N]();
if (select[V99](classPrefix + u3m)) {
var u99 = M3d;
u99 += c3d;
that[R3m](that[z9N][u99], val);
that[M3m]();
that[R1m]();
} else if (select[t3N](classPrefix + R99)) {
that[z9N][H5N][c3m](val);
that[M3m]();
that[R1m]();
} else if (select[t3N](classPrefix + M99) || select[c99](classPrefix + X99)) {
var p69 = X3m;
p69 += Y3m;
p69 += q9N;
p69 += z8U;
var n69 = C9N;
n69 += L9N;
n69 += T3m;
n69 += n8m;
var Y99 = x4N;
Y99 += d5U;
Y99 += W7N;
if (that[z9N][Y99][n69]) {
var y69 = z9N;
y69 += z8U;
y69 += g8m;
y69 += s8m;
var r69 = P3m;
r69 += z8m;
var H69 = s0d;
H69 += S8m;
var S69 = q8U;
S69 += L9N;
S69 += q9N;
var z69 = N4N;
z69 += r8U;
var s69 = t4N;
s69 += g8U;
s69 += q8U;
var g69 = z5N;
g69 += H8U;
g69 += g8U;
g69 += e4N;
var hours = $(that[b1N][g69])[s69](D9c + classPrefix + H8m)[z69]() * K2U;
var pm = $(that[S69][H69])[V1c](D9c + classPrefix + r69)[D7N]() === r8m;
that[z9N][q8U][y69](hours === E2U && !pm ? G8z.I2U : pm && hours !== E2U ? hours + E2U : hours);
} else {
that[z9N][q8U][y8m](val);
}
that[p69]();
that[p8m](S0N);
onChange();
} else if (select[t3N](classPrefix + x69)) {
var L69 = x8m;
L69 += Z8m;
var l69 = X3m;
l69 += l8m;
var Z69 = z9N;
Z69 += X1m;
Z69 += L8m;
that[z9N][q8U][Z69](val);
that[l69]();
that[L69](S0N);
onChange();
} else if (select[t3N](classPrefix + f69)) {
var m69 = f8m;
m69 += d8m;
m69 += Z8m;
var d69 = z9N;
d69 += m8m;
that[z9N][q8U][d69](val);
that[O3m]();
that[m69](S0N);
onChange();
}
that[b1N][u0N][J69]();
that[O69]();
})[a69](h1N, function(e) {
var n5m = "sCl";
var G8m = "pare";
var m5m = "ullYear";
var V8m = "setU";
var j5m = "tC";
var N8m = "rCase";
var L5m = 'setSeconds';
var P8m = "tMonth";
var S5m = "ondsRange";
var C8m = "nodeN";
var D8m = "Case";
var T8m = "Outpu";
var K8m = "parentNode";
var U8m = "_setC";
var Y8m = "rang";
var w8m = '-iconRight';
var c8m = "inute";
var j8m = "Low";
var f5m = "TCMonth";
var p5m = "tUTCH";
var e8m = "asC";
var B8m = "UTCM";
var r5m = "getUTCH";
var R8m = "hou";
var O5m = "ToU";
var s5m = "inutesRa";
var a8m = "oLower";
var d5m = "etUTC";
var J5m = "Date";
var D5m = "setUTCDate";
var i8m = "_write";
var v8m = "rec";
var o8m = "_cor";
var q8m = "odeName";
var t8m = "alander";
var k8m = "asClass";
var M8m = "nds";
var x5m = "CHo";
var z5m = "sCla";
var l5m = 'setUTCMinutes';
var E8m = "CMonth";
var Q8m = "tTitle";
var u8m = "TCHours";
var g5m = "minutesRange";
var J8m = "topPropagati";
var k69 = z9N;
k69 += J8m;
k69 += y3N;
var K69 = z9N;
K69 += O8m;
var I69 = m8U;
I69 += a8m;
I69 += D8m;
var C69 = g8U;
C69 += q8m;
var N69 = j7N;
N69 += N0d;
N69 += m8U;
var j69 = G8z.u3U;
j69 += G8z.R3U;
var q69 = U4N;
q69 += j8m;
q69 += z8U;
q69 += N8m;
var D69 = C8m;
D69 += G6N;
var d = that[z9N][q8U];
var nodeName = e[E9c][D69][q69]();
G8z[j69]();
var target = nodeName === I8m ? e[E9c][K8m] : e[N69];
nodeName = target[C69][I69]();
if (nodeName === K69) {
return;
}
e[k69]();
if (nodeName === s5c) {
var B69 = G7m;
B69 += m8U;
B69 += H8U;
B69 += e8U;
var b69 = C9N;
b69 += k8m;
var G69 = C9N;
G69 += e8m;
G69 += j3N;
var e69 = G8m;
e69 += g8U;
e69 += m8U;
var button = $(target);
var parent = button[e69]();
if (parent[t3N](b8m) && !parent[G69](W8m)) {
button[v7d]();
return;
}
if (parent[b69](classPrefix + h8m)) {
var E69 = S8U;
E69 += v5N;
E69 += i8U;
E69 += z9N;
var F69 = H8U;
F69 += g8U;
F69 += U1m;
var Q69 = X3m;
Q69 += Q8m;
var h69 = F8m;
h69 += E8m;
var W69 = q8U;
W69 += z2d;
W69 += r8U;
W69 += p2N;
that[z9N][H5N][A8m](that[z9N][W69][h69]() - K2U);
that[Q69]();
that[R1m]();
that[b1N][F69][E69]();
} else if (parent[t3N](classPrefix + w8m)) {
var t69 = C5U;
t69 += n1d;
var U69 = U8m;
U69 += t8m;
var w69 = k5d;
w69 += B8m;
w69 += u4d;
w69 += C9N;
var A69 = o8m;
A69 += v8m;
A69 += P8m;
that[A69](that[z9N][H5N], that[z9N][H5N][w69]() + K2U);
that[M3m]();
that[U69]();
that[b1N][u0N][t69]();
} else if (button[d3N](D9c + classPrefix + B69)[U5N]) {
var r49 = i8m;
r49 += T8m;
r49 += m8U;
var H49 = V8m;
H49 += u8m;
var S49 = R8m;
S49 += d5U;
S49 += z9N;
var u69 = z9N;
u69 += o3m;
u69 += L9N;
u69 += M8m;
var P69 = q9N;
P69 += c8m;
P69 += z9N;
var v69 = i8U;
v69 += g8U;
v69 += l6N;
var o69 = q8U;
o69 += y5d;
var val = button[o69](X8m);
var unit = button[u7N](v69);
if (unit === P69) {
var T69 = Y8m;
T69 += z8U;
var i69 = C9N;
i69 += G8z.T3U;
i69 += n5m;
i69 += Q3N;
if (parent[t3N](b8m) && parent[i69](T69)) {
that[z9N][g5m] = val;
that[O3m]();
return;
} else {
var V69 = q9N;
V69 += s5m;
V69 += D3m;
that[z9N][V69] = I1N;
}
}
if (unit === u69) {
var X69 = Y8m;
X69 += z8U;
var c69 = j0d;
c69 += f5U;
c69 += j3N;
var M69 = q8U;
M69 += F2d;
M69 += P0c;
M69 += q8U;
var R69 = C9N;
R69 += G8z.T3U;
R69 += z5m;
R69 += b5N;
if (parent[R69](M69) && parent[c69](X69)) {
var Y69 = z9N;
Y69 += z8U;
Y69 += c5U;
Y69 += S5m;
that[z9N][Y69] = val;
that[O3m]();
return;
} else {
that[z9N][H5m] = I1N;
}
}
if (val === n4m) {
var n49 = r5m;
n49 += y5m;
if (d[n49]() >= E2U) {
var g49 = t8d;
g49 += p5m;
g49 += y5m;
val = d[g49]() - E2U;
} else {
return;
}
} else if (val === r8m) {
var s49 = k5d;
s49 += l3m;
s49 += u8m;
if (d[s49]() < E2U) {
var z49 = F8m;
z49 += x5m;
z49 += i8U;
z49 += Y3U;
val = d[z49]() + E2U;
} else {
return;
}
}
var set = unit === S49 ? H49 : unit === Z5m ? l5m : L5m;
d[set](val);
that[O3m]();
that[r49](S0N);
onChange();
} else {
var f49 = N7N;
f49 += G8z.u3U;
var L49 = q9N;
L49 += L9N;
L49 += g8U;
L49 += Y2N;
var l49 = q8U;
l49 += y5d;
var Z49 = V8m;
Z49 += f5m;
var x49 = z9N;
x49 += d5m;
x49 += B3N;
x49 += m5m;
var p49 = v8U;
p49 += g8m;
p49 += J5m;
if (!d) {
var y49 = F9d;
y49 += C8d;
y49 += O5m;
y49 += a7m;
d = that[y49](new Date());
}
d[p49](K2U);
d[x49](button[u7N](a5m));
d[Z49](button[l49](L49));
d[D5m](button[u7N](f49));
that[p8m](S0N);
if (!that[z9N][N3m][I3m]) {
setTimeout(function() {
var d49 = g8U;
d49 += G8z.R3U;
G8z[d49]();
that[q5m]();
}, Q2U);
} else {
var m49 = N9d;
m49 += z8U;
m49 += j5m;
m49 += t8m;
that[m49]();
}
onChange();
}
} else {
var O49 = N5m;
O49 += m8U;
var J49 = q8U;
J49 += o5N;
that[J49][O49][o1N]();
}
});
},
_compareDates: function(a, b) {
var I5m = "ToUtcString";
var C5m = "_dateToUtcS";
var D49 = C5m;
D49 += A3d;
D49 += d6N;
var a49 = G8U;
a49 += C3m;
a49 += I5m;
G8z[R2N]();
return this[a49](a) === this[D49](b);
},
_correctMonth: function(date, month) {
var h5m = "aysInMonth";
var G5m = "getUTC";
var b5m = "Ful";
var e5m = "etUTCDa";
var K5m = "tUTCMo";
var Q5m = "etUTCD";
var C49 = z9N;
C49 += z8U;
C49 += K5m;
C49 += k5m;
var N49 = q4N;
N49 += e5m;
N49 += u9N;
var j49 = G5m;
j49 += b5m;
j49 += W5m;
var q49 = F9d;
q49 += h5m;
var days = this[q49](date[j49](), month);
var correctDays = date[N49]() > days;
date[C49](month);
if (correctDays) {
var I49 = z9N;
I49 += Q5m;
I49 += G8z.T3U;
I49 += u9N;
date[I49](days);
date[A8m](month);
}
},
_daysInMonth: function(year, month) {
var u2U = 31;
var i2U = 28;
var T2U = 29;
var V2U = 30;
var isLeap = year % G2U === G8z.I2U && (year % n0U !== G8z.I2U || year % s0U === G8z.I2U);
G8z[R2N]();
var months = [u2U, isLeap ? T2U : i2U, u2U, V2U, u2U, V2U, u2U, u2U, V2U, u2U, V2U, u2U];
return months[month];
},
_dateToUtc: function(s) {
var w5m = "getHours";
var E5m = "getFul";
var U5m = "getMinutes";
var A5m = "getDate";
var F5m = "Mont";
var t5m = "getSeconds";
var e49 = t8d;
e49 += m8U;
e49 += F5m;
e49 += C9N;
var k49 = E5m;
k49 += W5m;
var K49 = l3m;
K49 += N9N;
K49 += f5U;
G8z[R2N]();
return new Date(Date[K49](s[k49](), s[e49](), s[A5m](), s[w5m](), s[U5m](), s[t5m]()));
},
_dateToUtcString: function(d) {
var P5m = "UT";
var v5m = "pad";
var o5m = "TCDate";
var i5m = "CFul";
var h49 = B5m;
h49 += o5m;
var W49 = G8U;
W49 += v5m;
var b49 = k5d;
b49 += P5m;
b49 += i5m;
b49 += W5m;
var G49 = G8z.u3U;
G49 += G8z.R3U;
G8z[G49]();
return d[b49]() + b6c + this[T5m](d[V5m]() + K2U) + b6c + this[W49](d[h49]());
},
_hide: function() {
var R5m = "s_scrollBody";
var M5m = "namespace";
var u5m = "div.dataT";
var Y5m = 'click.';
var E49 = u5m;
E49 += P0c;
E49 += R5m;
var F49 = L9N;
F49 += o2d;
var Q49 = Q4d;
Q49 += t8N;
Q49 += C9N;
var namespace = this[z9N][M5m];
this[b1N][f3N][Q49]();
G8z[G8z.i3U]();
$(window)[o1d](D9c + namespace);
$(document)[F49](c5m + namespace);
$(E49)[o1d](X5m + namespace);
$(Z4d)[o1d](X5m + namespace);
$(P6d)[o1d](Y5m + namespace);
},
_hours24To12: function(val) {
var A49 = g8U;
A49 += G8z.R3U;
G8z[A49]();
return val === G8z.I2U ? E2U : val > E2U ? val - E2U : val;
},
_htmlDay: function(day) {
var p9z = "button\" ";
var a9z = '<td data-day="';
var l9z = " cl";
var S9z = "\" d";
var Z9z = "n ";
var s9z = "\" data-";
var N9z = "month";
var y9z = "type=\"";
var J9z = 'selectable';
var z9z = "day=\"";
var r9z = "-day\" ";
var L9z = "oday";
var d9z = "td c";
var H9z = "a-month";
var x9z = "-bu";
var C9z = '</button>';
var D9z = "day";
var m9z = "ass=\"empty\"></td>";
var f9z = "disabl";
var n9z = "</s";
var j9z = 'data-year="';
var q9z = '<button class="';
var n29 = x1d;
n29 += m8U;
n29 += q8U;
n29 += W0N;
var Y49 = n9z;
Y49 += D9N;
Y49 += G8z.T3U;
Y49 += g9z;
var X49 = P7m;
X49 += x4N;
X49 += g9z;
var c49 = E2N;
c49 += W0N;
var M49 = s9z;
M49 += z9z;
var R49 = S9z;
R49 += M7N;
R49 += H9z;
R49 += d2m;
var u49 = V3m;
u49 += G8z.T3U;
u49 += d5U;
var V49 = r9z;
V49 += y9z;
V49 += p9z;
var T49 = x9z;
T49 += C8c;
T49 += L9N;
T49 += Z9z;
var i49 = E2N;
i49 += l9z;
i49 += x9c;
var o49 = m8U;
o49 += L9z;
var U49 = f9z;
U49 += a4N;
if (day[m3d]) {
var w49 = I0N;
w49 += d9z;
w49 += r8U;
w49 += m9z;
return w49;
}
var classes = [J9z];
var classPrefix = this[c5U][d1m];
if (day[U49]) {
var B49 = l9d;
B49 += s7d;
B49 += z8U;
B49 += q8U;
var t49 = i9m;
t49 += z9N;
t49 += C9N;
classes[t49](B49);
}
if (day[o49]) {
var P49 = g8U;
P49 += L9N;
P49 += R9N;
var v49 = D9N;
v49 += i8U;
v49 += z9N;
v49 += C9N;
classes[v49](P49);
}
if (day[O9z]) {
classes[c2N](x7m);
}
return a9z + day[D9z] + i49 + classes[W6c](s1N) + z1N + q9z + classPrefix + T49 + classPrefix + V49 + j9z + day[u49] + R49 + day[N9z] + M49 + day[D9z] + c49 + X49 + day[D9z] + Y49 + C9z + n29;
},
_htmlMonth: function(year, month) {
var i9z = "inAr";
var w9z = "UTC";
var B2U = 23;
var X9z = "_htmlWeekOfYear";
var b9z = "thea";
var B9z = "setUTCMinutes";
var s6z = "ee";
var P9z = "CDay";
var S6z = "v.";
var v9z = "UTCMinutes";
var g6z = " w";
var V9z = "ates";
var K9z = "le>";
var R9z = "disableDays";
var M9z = "_htmlDay";
var I9z = "</tab";
var k9z = "ody>";
var r6z = '</thead>';
var e9z = "_htmlMo";
var E9z = "ysInM";
var T9z = "_compareD";
var U9z = "getUTCDay";
var W9z = "d>";
var c9z = "showWeekNumber";
var G9z = "nthHea";
var y6z = '</tbody>';
var H6z = '<table class="';
var h9z = "xDate";
var A9z = "onth";
var Q9z = "tDay";
var o9z = "setSeconds";
var u9z = "_compareDates";
var F9z = "_da";
var z6z = "kNum";
var b29 = I9z;
b29 += K9z;
var G29 = I0N;
G29 += m8U;
G29 += O5U;
G29 += k9z;
var e29 = e9z;
e29 += G9z;
e29 += q8U;
var k29 = I0N;
k29 += b9z;
k29 += W9z;
var d29 = K7m;
d29 += P0c;
var S29 = O5N;
S29 += h9z;
var z29 = B8c;
z29 += g8U;
z29 += K8U;
z29 += z8U;
var s29 = B0m;
s29 += z9N;
s29 += Q9z;
var g29 = F9z;
g29 += E9z;
g29 += A9z;
var now = this[s3m](new Date()),
days = this[g29](year, month),
before = new Date(Date[w9z](year, month, K2U))[U9z](),
data = [],
row = [];
if (this[c5U][s29] > G8z.I2U) {
before -= this[c5U][t9z];
if (before < G8z.I2U) {
before += W2U;
}
}
var cells = days + before,
after = cells;
while (after > W2U) {
after -= W2U;
}
cells += W2U - after;
var minDate = this[c5U][z29];
var maxDate = this[c5U][S29];
if (minDate) {
minDate[y8m](G8z.I2U);
minDate[B9z](G8z.I2U);
minDate[o9z](G8z.I2U);
}
if (maxDate) {
var r29 = z9N;
r29 += m8m;
var H29 = S4c;
H29 += v9z;
maxDate[y8m](B2U);
maxDate[H29](X2U);
maxDate[r29](X2U);
}
for (var i = G8z.I2U, r = G8z.I2U; i < cells; i++) {
var l29 = D9N;
l29 += i8U;
l29 += z9N;
l29 += C9N;
var Z29 = F8m;
Z29 += P9z;
var x29 = i9z;
x29 += d5U;
x29 += p2N;
var p29 = T9z;
p29 += V9z;
var y29 = l3m;
y29 += N9N;
y29 += f5U;
var day = new Date(Date[y29](year, month, K2U + (i - before))),
selected = this[z9N][q8U] ? this[u9z](day, this[z9N][q8U]) : z0N,
today = this[p29](day, now),
empty = i < before || i >= days + before,
disabled = minDate && day < minDate || maxDate && day > maxDate;
var disableDays = this[c5U][R9z];
if ($[f7d](disableDays) && $[x29](day[Z29](), disableDays) !== -K2U) {
disabled = S0N;
} else if (typeof disableDays === G8z.M3U && disableDays(day) === S0N) {
disabled = S0N;
}
var dayConfig = {
day: K2U + (i - before),
month: month,
year: year,
selected: selected,
today: today,
disabled: disabled,
empty: empty
};
row[l29](this[M9z](dayConfig));
if (++r === W2U) {
var f29 = r2N;
f29 += F3c;
f29 += g8U;
var L29 = i9m;
L29 += z9N;
L29 += C9N;
if (this[c5U][c9z]) {
row[X7c](this[X9z](i - before, month, year));
}
data[L29](Y9z + row[f29](R7N) + n6z);
row = [];
r = G8z.I2U;
}
}
var classPrefix = this[c5U][d1m];
var className = classPrefix + d29;
if (this[c5U][c9z]) {
var m29 = g6z;
m29 += s6z;
m29 += z6z;
m29 += e9N;
className += m29;
}
if (minDate) {
var D29 = c5U;
D29 += z9N;
D29 += z9N;
var a29 = u4N;
a29 += S6z;
var O29 = m8U;
O29 += l6N;
O29 += r8U;
O29 += z8U;
var J29 = l3m;
J29 += N9N;
J29 += f5U;
var underMin = minDate >= new Date(Date[J29](year, month, K2U, G8z.I2U, G8z.I2U, G8z.I2U));
this[b1N][O29][V1c](a29 + classPrefix + h8m)[D29](z8N, underMin ? h8N : f5N);
}
if (maxDate) {
var K29 = u4N;
K29 += e1N;
K29 += G8z.T3U;
K29 += G8z.u3U;
var I29 = n1m;
I29 += T1d;
var C29 = q8U;
C29 += H8U;
C29 += E0N;
C29 += c8d;
var N29 = S8U;
N29 += H8U;
N29 += g8U;
N29 += q8U;
var j29 = m8U;
j29 += l6N;
j29 += v9N;
var q29 = l3m;
q29 += N9N;
q29 += f5U;
var overMax = maxDate < new Date(Date[q29](year, month + K2U, K2U, G8z.I2U, G8z.I2U, G8z.I2U));
this[b1N][j29][N29](C29 + classPrefix + I29)[G1N](K29, overMax ? h8N : f5N);
}
return H6z + className + z1N + k29 + this[e29]() + r6z + G29 + data[W6c](R7N) + y6z + b29;
},
_htmlMonthHead: function() {
var f6z = "th><";
var d6z = "/th>";
var m6z = '</th>';
var p6z = "show";
var Z6z = "ekNumber";
var x6z = "We";
var U29 = r2N;
U29 += f7c;
var E29 = g8U;
E29 += G8z.R3U;
var Q29 = p6z;
Q29 += x6z;
Q29 += Z6z;
var W29 = l7m;
W29 += g8U;
var a = [];
var firstDay = this[c5U][t9z];
var i18n = this[c5U][W29];
var dayName = function(day) {
var l6z = "wee";
var L6z = "kdays";
var h29 = l6z;
h29 += L6z;
day += firstDay;
while (day >= W2U) {
day -= W2U;
}
return i18n[h29][day];
};
if (this[c5U][Q29]) {
var F29 = I0N;
F29 += f6z;
F29 += d6z;
a[c2N](F29);
}
G8z[E29]();
for (var i = G8z.I2U; i < W2U; i++) {
var w29 = I0N;
w29 += m8U;
w29 += C9N;
w29 += W0N;
var A29 = i9m;
A29 += K4N;
a[A29](w29 + dayName(i) + m6z);
}
return a[U29](R7N);
},
_htmlWeekOfYear: function(d, m, y) {
var j6z = '<td class="';
var a6z = "cei";
var J6z = "-we";
var g1U = 86400000;
var D6z = "Day";
var O6z = "k\">";
var N6z = '</td>';
var v29 = J6z;
v29 += z8U;
v29 += O6z;
var o29 = a6z;
o29 += r8U;
var B29 = q4N;
B29 += i9N;
B29 += D6z;
var t29 = t8d;
t29 += m8U;
t29 += q7m;
t29 += u9N;
var date = new Date(y, m, d, G8z.I2U, G8z.I2U, G8z.I2U, G8z.I2U);
date[q6z](date[t29]() + G2U - (date[B29]() || W2U));
var oneJan = new Date(y, G8z.I2U, K2U);
var weekNum = Math[o29](((date - oneJan) / g1U + K2U) / W2U);
return j6z + this[c5U][d1m] + v29 + weekNum + N6z;
},
_options: function(selector, values, labels) {
var k6z = '<option value="';
var C6z = "sPrefix";
var K6z = "/option";
var I6z = 'select.';
var V29 = r8U;
V29 += z8U;
V29 += d6N;
V29 += Y2N;
var T29 = G8z.u3U;
T29 += G8z.R3U;
var i29 = I5N;
i29 += C6z;
var P29 = e7m;
P29 += q8U;
if (!labels) {
labels = values;
}
var select = this[b1N][f3N][P29](I6z + this[c5U][i29] + b6c + selector);
select[m3d]();
G8z[T29]();
for (var i = G8z.I2U, ien = values[V29]; i < ien; i++) {
var R29 = I0N;
R29 += K6z;
R29 += W0N;
var u29 = o9d;
u29 += O6N;
u29 += q8U;
select[u29](k6z + values[i] + z1N + labels[i] + R29);
}
},
_optionSet: function(selector, val) {
var W6z = "unknown";
var b6z = 'option:selected';
var e6z = "sel";
var s09 = g4d;
s09 += f5c;
var g09 = S8U;
g09 += H8U;
g09 += g8U;
g09 += q8U;
var n09 = E0N;
n09 += G8z.T3U;
n09 += r8U;
var Y29 = r9N;
Y29 += H8U;
Y29 += r8U;
Y29 += V6d;
var X29 = e6z;
X29 += R8d;
X29 += c8d;
var c29 = S8U;
c29 += H8U;
c29 += g8U;
c29 += q8U;
var M29 = w3m;
M29 += x3N;
G8z[R2N]();
var select = this[b1N][M29][c29](X29 + this[c5U][d1m] + b6c + selector);
var span = select[G6z]()[Y29](I8m);
select[n09](val);
var selected = select[g09](b6z);
span[s09](selected[U5N] !== G8z.I2U ? selected[g9d]() : this[c5U][W0m][W6z]);
},
_optionsTime: function(unit, count, val, allowed, range) {
var Q6z = "<table c";
var E6z = "refix";
var H4z = '</th></tr></thead>';
var w6z = '-table';
var b2U = 6;
var c6z = "amPm";
var F6z = "classP";
var h6z = "tbody>";
var n4z = "-no";
var S4z = '<thead><tr><th colspan="';
var A6z = "ontainer";
var X6z = "r>";
var y4z = '</table>';
var r4z = '<tbody>';
var Y6z = "tr>";
var g4z = "space\"><tbody>";
var z4z = "floor";
var s4z = '</tbody></thead><table class="';
var M6z = "<tr";
var G09 = x1d;
G09 += h6z;
var e09 = E2N;
e09 += W0N;
var k09 = Q6z;
k09 += Q7m;
var y09 = d7d;
y09 += L3N;
y09 += C9N;
var r09 = F6z;
r09 += E6z;
var H09 = S8U;
H09 += H8U;
H09 += g8U;
H09 += q8U;
var S09 = c5U;
S09 += A6z;
var z09 = q8U;
z09 += o5N;
var classPrefix = this[c5U][d1m];
var container = this[z09][S09][H09](N9c + classPrefix + b6c + unit);
var i, j;
var render = count === E2U ? function(i) {
return i;
} : this[T5m];
var classPrefix = this[c5U][r09];
var className = classPrefix + w6z;
var i18n = this[c5U][W0m];
if (!container[y09]) {
return;
}
var a = R7N;
var span = Q2U;
G8z[R2N]();
var button = function(value, label, className) {
var U6z = "</td";
var R6z = '</span>';
var v6z = "<bu";
var o6z = "\" data-valu";
var i6z = "class=\"selectable";
var B6z = "ton>";
var u6z = '-day" type="button" data-unit="';
var P6z = "<td ";
var t6z = "</but";
var T6z = ' disabled';
var V6z = '-button ';
var J09 = U6z;
J09 += W0N;
var m09 = t6z;
m09 += B6z;
var d09 = P7m;
d09 += D9N;
d09 += G8z.T3U;
d09 += g9z;
var f09 = o6z;
f09 += T1c;
var L09 = v6z;
L09 += N8c;
L09 += V2c;
var l09 = P6z;
l09 += i6z;
l09 += B8U;
var Z09 = G8z.T3U;
Z09 += q9N;
var x09 = G8z.u3U;
x09 += G8z.R3U;
var p09 = g8U;
p09 += v4m;
p09 += O5U;
p09 += e4N;
if (count === E2U && val >= E2U && typeof value === p09) {
value += E2U;
}
G8z[x09]();
var selected = val === value || value === Z09 && val < E2U || value === r8m && val >= E2U ? x7m : R7N;
if (allowed && $[F7d](value, allowed) === -K2U) {
selected += T6z;
}
if (className) {
selected += s1N + className;
}
return l09 + selected + z1N + L09 + classPrefix + V6z + classPrefix + u6z + unit + f09 + value + z1N + d09 + label + R6z + m09 + J09;
};
if (count === E2U) {
var D09 = D9N;
D09 += q9N;
var a09 = p7N;
a09 += C7N;
a09 += q9N;
var O09 = M6z;
O09 += W0N;
a += O09;
for (i = K2U; i <= b2U; i++) {
a += button(i, render(i));
}
a += button(n4m, i18n[a09][G8z.I2U]);
a += n6z;
a += Y9z;
for (i = W2U; i <= E2U; i++) {
a += button(i, render(i));
}
a += button(D09, i18n[c6z][K2U]);
a += n6z;
span = W2U;
} else if (count === o2U) {
var c = G8z.I2U;
for (j = G8z.I2U; j < G2U; j++) {
var j09 = x1d;
j09 += X8d;
j09 += W0N;
var q09 = I0N;
q09 += m8U;
q09 += X6z;
a += q09;
for (i = G8z.I2U; i < b2U; i++) {
a += button(c, render(c));
c++;
}
a += j09;
}
span = b2U;
} else {
var K09 = I0N;
K09 += Y6z;
var I09 = n4z;
I09 += g4z;
var C09 = x1d;
C09 += Y6z;
var N09 = I0N;
N09 += m8U;
N09 += d5U;
N09 += W0N;
a += N09;
for (j = G8z.I2U; j < Y2U; j += Q2U) {
a += button(j, render(j), W8m);
}
a += C09;
a += s4z + className + s1N + className + I09;
var start = range !== I1N ? range : Math[z4z](val / Q2U) * Q2U;
a += K09;
for (j = start + K2U; j < start + Q2U; j++) {
a += button(j, render(j));
}
a += n6z;
span = b2U;
}
container[m3d]()[G9d](k09 + className + z1N + S4z + span + e09 + i18n[unit] + H4z + r4z + a + G09 + y4z);
},
_optionsTitle: function() {
var J4z = "_range";
var O4z = "_options";
var L4z = "maxD";
var p4z = "_opti";
var f4z = "getFullYear";
var Z4z = "tFullYear";
var d4z = "yearRange";
var x4z = "arR";
var E09 = g9N;
E09 += k5m;
E09 += z9N;
var F09 = p4z;
F09 += Y3c;
var Q09 = G8z.u3U;
Q09 += z8U;
Q09 += x4z;
Q09 += y9N;
var h09 = t8d;
h09 += Z4z;
var W09 = k5d;
W09 += B3N;
W09 += i8U;
W09 += l4z;
var b09 = L4z;
b09 += M7N;
b09 += z8U;
var i18n = this[c5U][W0m];
var min = this[c5U][V1m];
var max = this[c5U][b09];
var minYear = min ? min[W09]() : I1N;
var maxYear = max ? max[f4z]() : I1N;
var i = minYear !== I1N ? minYear : new Date()[h09]() - this[c5U][d4z];
var j = maxYear !== I1N ? maxYear : new Date()[f4z]() + this[c5U][Q09];
this[F09](m4z, this[J4z](G8z.I2U, F2U), i18n[E09]);
this[O4z](a5m, this[J4z](i, j));
},
_pad: function(i) {
var a4z = '0';
var A09 = g8U;
A09 += G8z.R3U;
G8z[A09]();
return i < Q2U ? a4z + i : i;
},
_position: function() {
var Q4z = "scrollTop";
var k4z = "width";
var F4z = 'top';
var N4z = "tim";
var q4z = "terWidth";
var W4z = "ontal";
var b4z = "iz";
var G4z = 'horizontal';
var e4z = "addCl";
var I4z = "uterHeight";
var h4z = "veClass";
var j4z = "uterHeig";
var D4z = "idt";
var C4z = "rt";
var K4z = "ntai";
var S79 = R9N;
S79 += D4z;
S79 += C9N;
var s79 = C9N;
s79 += z8U;
s79 += H8U;
s79 += j6d;
var g79 = G8z.u3U;
g79 += G8z.R3U;
var n79 = K0d;
n79 += q4z;
var Y09 = L9N;
Y09 += j4z;
Y09 += g4d;
var X09 = m8U;
X09 += L9N;
X09 += D9N;
var c09 = c5U;
c09 += z9N;
c09 += z9N;
var V09 = N4z;
V09 += z8U;
var T09 = G5c;
T09 += m8U;
T09 += z9N;
var i09 = q8U;
i09 += G8z.T3U;
i09 += m8U;
i09 += z8U;
var P09 = D9N;
P09 += G8z.T3U;
P09 += C4z;
P09 += z9N;
var v09 = L9N;
v09 += I4z;
var o09 = q8U;
o09 += L9N;
o09 += q9N;
var B09 = y5N;
B09 += K4z;
B09 += s2d;
B09 += d5U;
var t09 = F1N;
t09 += q9N;
var U09 = L9N;
U09 += o2d;
U09 += S4c;
var w09 = H8U;
w09 += g8U;
w09 += D9N;
w09 += Z8m;
var offset = this[b1N][w09][U09]();
var container = this[t09][B09];
var inputHeight = this[o09][u0N][v09]();
if (this[z9N][P09][i09] && this[z9N][T09][V09] && $(window)[k4z]() > S0U) {
var u09 = e4z;
u09 += Q3N;
container[u09](G4z);
} else {
var M09 = C9N;
M09 += Y5U;
M09 += b4z;
M09 += W4z;
var R09 = d5U;
R09 += L0m;
R09 += L9N;
R09 += h4z;
container[R09](M09);
}
container[c09]({
top: offset[X09] + inputHeight,
left: offset[z3d]
})[b4d](P6d);
var calHeight = container[Y09]();
var calWidth = container[n79]();
G8z[g79]();
var scrollTop = $(window)[Q4z]();
if (offset[x0d] + inputHeight + calHeight - scrollTop > $(window)[s79]()) {
var z79 = c5U;
z79 += z9N;
z79 += z9N;
var newTop = offset[x0d] - calHeight;
container[z79](F4z, newTop < G8z.I2U ? G8z.I2U : newTop);
}
if (calWidth + offset[z3d] > $(window)[S79]()) {
var H79 = c5U;
H79 += z9N;
H79 += z9N;
var newLeft = $(window)[k4z]() - calWidth;
container[H79](Z3d, newLeft < G8z.I2U ? G8z.I2U : newLeft);
}
},
_range: function(start, end, inc) {
var a = [];
if (!inc) {
inc = K2U;
}
G8z[R2N]();
for (var i = start; i <= end; i += inc) {
a[c2N](i);
}
return a;
},
_setCalander: function() {
var w4z = "endar";
var E4z = "FullYear";
var A4z = "_htmlMont";
if (this[z9N][H5N]) {
var l79 = q8U;
l79 += z2d;
l79 += c3d;
var Z79 = B5m;
Z79 += L3m;
Z79 += E4z;
var x79 = A4z;
x79 += C9N;
var p79 = L0m;
p79 += D9N;
p79 += m8U;
p79 += G8z.u3U;
var y79 = c5U;
y79 += G8z.T3U;
y79 += r8U;
y79 += w4z;
var r79 = q8U;
r79 += o5N;
this[r79][y79][p79]()[G9d](this[x79](this[z9N][H5N][Z79](), this[z9N][l79][V5m]()));
}
},
_setTitle: function() {
var U4z = "getUTCFu";
var t4z = "_op";
var B4z = "nSe";
var o4z = "tUTCMonth";
var v4z = "_optionSet";
var m79 = U4z;
m79 += l4z;
var d79 = V3m;
d79 += Y4N;
var f79 = t4z;
f79 += l8d;
f79 += B4z;
f79 += m8U;
var L79 = q4N;
L79 += z8U;
L79 += o4z;
this[v4z](m4z, this[z9N][H5N][L79]());
G8z[R2N]();
this[f79](d79, this[z9N][H5N][m79]());
},
_setTime: function() {
var c4z = "_optionsTim";
var T4z = "sec";
var P4z = "second";
var X4z = "getUTCHours";
var V4z = "ond";
var S2z = "hours12";
var z2z = "_optionsTime";
var u4z = "minute";
var H2z = "hoursAvailable";
var r2z = "getUTCMinutes";
var R4z = "sRa";
var i4z = "econds";
var M4z = "min";
var I79 = P4z;
I79 += z9N;
var C79 = k5d;
C79 += j9N;
C79 += i4z;
var N79 = T4z;
N79 += V4z;
N79 += z9N;
var j79 = u4z;
j79 += R4z;
j79 += D3m;
var q79 = M4z;
q79 += Z8m;
q79 += y8U;
var D79 = c4z;
D79 += z8U;
var a79 = C9N;
a79 += y5m;
var that = this;
var d = this[z9N][q8U];
var hours = d ? d[X4z]() : G8z.I2U;
var allowed = function(prop) {
var g2z = 'Available';
var n2z = "lable";
var s2z = 'Increment';
var Y4z = "vai";
var O79 = G8U;
O79 += d5U;
O79 += y9N;
var J79 = N9m;
J79 += Y4z;
J79 += n2z;
return that[c5U][prop + J79] ? that[c5U][prop + g2z] : that[O79](G8z.I2U, X2U, that[c5U][prop + s2z]);
};
this[z2z](a79, this[z9N][N3m][S2z] ? E2U : o2U, hours, this[c5U][H2z]);
this[D79](q79, Y2U, d ? d[r2z]() : G8z.I2U, allowed(Z5m), this[z9N][j79]);
this[z2z](N79, Y2U, d ? d[C79]() : G8z.I2U, allowed(I79), this[z9N][H5m]);
},
_show: function() {
var Z2z = " re";
var p2z = "dataTables_scr";
var l2z = "siz";
var x2z = "ollBody";
var d2z = "espace";
var f2z = "_posi";
var y2z = "scroll";
var L2z = "e.";
var h79 = L9N;
h79 += g8U;
var b79 = y2z;
b79 += c8d;
var G79 = R1d;
G79 += p2z;
G79 += x2z;
var e79 = Z2z;
e79 += l2z;
e79 += L2z;
var k79 = f2z;
k79 += m8U;
k79 += o9c;
var K79 = g8U;
K79 += p7N;
K79 += d2z;
var that = this;
var namespace = this[z9N][K79];
this[k79]();
$(window)[y3N](X5m + namespace + e79 + namespace, function() {
that[q5m]();
});
$(Z4d)[y3N](X5m + namespace, function() {
that[q5m]();
});
$(G79)[y3N](b79 + namespace, function() {
var W79 = G8U;
W79 += C9N;
W79 += A4N;
W79 += z8U;
G8z[R2N]();
that[W79]();
});
$(document)[h79](c5m + namespace, function(e) {
var J2z = "_h";
var m2z = "ode";
var h2U = 9;
var E79 = P5N;
E79 += n5c;
E79 += q8U;
E79 += z8U;
var F79 = Q8c;
F79 += m2z;
var Q79 = G8z.u3U;
Q79 += G8z.R3U;
G8z[Q79]();
if (e[k3d] === h2U || e[F79] === P2U || e[E79] === A2U) {
var A79 = J2z;
A79 += H8U;
A79 += i4N;
that[A79]();
}
});
G8z[G8z.i3U]();
setTimeout(function() {
var O2z = "lick.";
var U79 = c5U;
U79 += O2z;
var w79 = G8z.u3U;
w79 += G8z.R3U;
G8z[w79]();
$(P6d)[y3N](U79 + namespace, function(e) {
var a2z = "ents";
var v79 = H8U;
v79 += c0N;
var o79 = m8U;
o79 += G8z.T3U;
o79 += N0d;
o79 += m8U;
var B79 = v9N;
B79 += d6N;
B79 += m8U;
B79 += C9N;
var t79 = D9N;
t79 += Y4N;
t79 += a2z;
var parents = $(e[E9c])[t79]();
if (!parents[j2m](that[b1N][f3N])[B79] && e[o79] !== that[b1N][v79][G8z.I2U]) {
var P79 = G8U;
P79 += C9N;
P79 += H8U;
P79 += i4N;
that[P79]();
}
});
}, Q2U);
},
_writeOutput: function(focus) {
var N2z = "omentLocale";
var q2z = "tUTCDa";
var j2z = "ormat";
var I2z = "getUTCFullYear";
var c79 = D2z;
c79 += Z8m;
var M79 = q8U;
M79 += o5N;
var R79 = q4N;
R79 += z8U;
R79 += q2z;
R79 += u9N;
var u79 = S8U;
u79 += j2z;
var V79 = q9N;
V79 += N2z;
var T79 = i8U;
T79 += m8U;
T79 += c5U;
var i79 = g9N;
i79 += q9N;
i79 += X2N;
i79 += m8U;
var date = this[z9N][q8U];
var out = window[S3m] ? window[i79][T79](date, undefined, this[c5U][V79], this[c5U][C2z])[u79](this[c5U][m1m]) : date[I2z]() + b6c + this[T5m](date[V5m]() + K2U) + b6c + this[T5m](date[R79]());
this[M79][c79][D7N](out);
if (focus) {
var Y79 = N5m;
Y79 += m8U;
var X79 = q8U;
X79 += L9N;
X79 += q9N;
this[X79][Y79][o1N]();
}
}
});
Editor[n19][g19] = G8z.I2U;
Editor[s19][z19] = {
classPrefix: S19,
disableDays: I1N,
firstDay: K2U,
format: H19,
hoursAvailable: I1N,
i18n: Editor[G0c][r19][K2z],
maxDate: I1N,
minDate: I1N,
minutesAvailable: I1N,
minutesIncrement: K2U,
momentStrict: S0N,
momentLocale: y19,
onChange: function() {},
secondsAvailable: I1N,
secondsIncrement: K2U,
showWeekNumber: z0N,
yearRange: Q2U
};
(function() {
var W2z = "hidd";
var o0z = 'div.clearValue button';
var R0z = "_in";
var V0z = "_input";
var y7z = "pla";
var Q0z = "Clas";
var S1z = "ipOpts";
var S7z = "textarea";
var F2z = "_inp";
var i3z = "noFileText";
var O1z = "prop";
var h0z = "_enab";
var z1z = '<div />';
var B7z = "separator";
var u7z = '<input id="';
var X1z = "cker";
var x3z = "ker";
var Y3z = "uploadMany";
var n7z = '<input/>';
var Q1z = "_preChecked";
var B2z = "_i";
var b2z = "sw";
var F0z = 'open';
var C7z = "_addOptions";
var k3z = "_picker";
var U0z = "div.ren";
var c7z = '<label for="';
var g7z = 'text';
var W7z = "sepa";
var V7z = "ppe";
var J1z = "_val";
var c0z = "_v";
var h2z = "Ty";
var G2z = "checkbo";
var V1z = "datepicker";
var k2z = "datetim";
var h1z = "radio";
var d0z = "_enabled";
var l0z = '" />';
var m7z = "optionsPair";
var j3z = "picker";
var o1z = "bled";
var c3z = 'upload.editor';
var q7z = "multiple";
var X7z = 'input:last';
var v0z = "fau";
var Q2z = "pes";
var R7z = '_';
var T0z = 'change';
var X0z = "readonly";
var Z1z = "npu";
var c1z = "epi";
var a7z = "eId";
var f7z = "_editor_val";
var e2z = "dio";
var A7z = "rator";
var v3z = "dered";
var t2z = "ic";
var L6U = F8U;
L6U += X2N;
L6U += q8U;
var l6U = k2z;
l6U += z8U;
var v59 = d5U;
v59 += G8z.T3U;
v59 += e2z;
var X89 = G2z;
X89 += g4N;
var s89 = d8U;
s89 += m8U;
s89 += z8U;
s89 += H9N;
var M39 = z8U;
M39 += l9N;
var R39 = D9N;
R39 += w1N;
R39 += b2z;
R39 += k4N;
var Q39 = W2z;
Q39 += X2N;
var p19 = t4N;
p19 += z5U;
p19 += h2z;
p19 += Q2z;
var fieldTypes = Editor[p19];
function _buttonText(conf, text) {
var U2z = 'div.upload button';
var A2z = "le...";
var E2z = "Choose fi";
var w2z = "Tex";
var L19 = C9N;
L19 += m8U;
L19 += q9N;
L19 += r8U;
var l19 = F2z;
l19 += Z8m;
if (text === I1N || text === undefined) {
var Z19 = E2z;
Z19 += A2z;
var x19 = g2c;
x19 += w2z;
x19 += m8U;
text = conf[x19] || Z19;
}
conf[l19][V1c](U2z)[L19](text);
}
function _commonUpload(editor, conf, dropCallback, multiple) {
var n0z = "file\" ";
var B0z = 'noDrop';
var K0z = "dragDropText";
var M2z = "<div class=\"cell cl";
var p0z = "buttonInte";
var k0z = "Drag and drop a file here to upload";
var y0z = "\"editor_upload\">";
var r0z = "lass=";
var P2z = "<div class=\"cell ";
var T2z = "ide\">";
var v2z = "ell\">";
var X2z = "ultip";
var L0z = '<div class="drop"><span/></div>';
var J0z = "input[type=";
var g0z = "<button";
var m0z = 'input[type=file]';
var O0z = "le]";
var S0z = "<div class=\"r";
var t0z = "dere";
var N0z = "ver";
var j0z = "go";
var I0z = "div.drop sp";
var Z0z = '<div class="eu_table">';
var V2z = "<div class=\"row sec";
var C0z = "div.d";
var W0z = 'dragleave dragexit';
var c2z = "Value\">";
var R2z = "ton clas";
var D0z = "dragDrop";
var x0z = "nal";
var s0z = "<div cla";
var f0z = '<div class="rendered"/>';
var i2z = "limitH";
var Y2z = "<input ";
var u2z = "d\">";
var q0z = "lose";
var H0z = "ow\">";
var z0z = "ss=\"cell upload limitHi";
var o2z = "<div class=\"c";
var a0z = "FileReader";
var q39 = r9N;
q39 += J5N;
q39 += t8d;
var d39 = c5U;
d39 += r8U;
d39 += t2z;
d39 += P5N;
var t19 = G8z.T3U;
t19 += m8U;
t19 += m8U;
t19 += d5U;
var E19 = H8U;
E19 += q8U;
var F19 = B2z;
F19 += g8U;
F19 += D9N;
F19 += Z8m;
var Q19 = x1d;
Q19 += u4N;
Q19 += h0N;
var h19 = o2z;
h19 += v2z;
var W19 = e0N;
W19 += H8U;
W19 += h0N;
var b19 = P2z;
b19 += i2z;
b19 += T2z;
var G19 = V2z;
G19 += y3N;
G19 += u2z;
var e19 = I0N;
e19 += C0N;
var k19 = I0N;
k19 += V0N;
k19 += Z1d;
var K19 = a3d;
K19 += R2z;
K19 += y9c;
var I19 = M2z;
I19 += Q1N;
I19 += d5U;
I19 += c2z;
var C19 = e0N;
C19 += H8U;
C19 += h0N;
var N19 = V0N;
N19 += W0N;
var j19 = q9N;
j19 += X2z;
j19 += v9N;
var q19 = Y2z;
q19 += f7N;
q19 += T1c;
q19 += n0z;
var D19 = m1d;
D19 += u2c;
var a19 = g0z;
a19 += B8U;
a19 += c5U;
a19 += Q7m;
var O19 = s0z;
O19 += z0z;
O19 += i4N;
O19 += c7m;
var J19 = S0z;
J19 += H0z;
var m19 = p9c;
m19 += r0z;
m19 += y0z;
var d19 = p0z;
d19 += d5U;
d19 += x0z;
var f19 = S8U;
f19 += L9N;
f19 += d5U;
f19 += q9N;
var btnClass = editor[l3N][f19][d19];
var container = $(m19 + Z0z + J19 + O19 + a19 + btnClass + D19 + q19 + (multiple ? j19 : R7N) + N19 + C19 + I19 + K19 + btnClass + l0z + k19 + e19 + G19 + b19 + L0z + W19 + h19 + f0z + p1N + p1N + p1N + Q19);
conf[F19] = container;
conf[d0z] = S0N;
if (conf[E19]) {
var U19 = H8U;
U19 += q8U;
var w19 = H8U;
w19 += q8U;
var A19 = S8U;
A19 += H8U;
A19 += g8U;
A19 += q8U;
container[A19](m0z)[N3d](w19, Editor[E4c](conf[U19]));
}
if (conf[t19]) {
var B19 = J0z;
B19 += t4N;
B19 += O0z;
container[V1c](B19)[N3d](conf[N3d]);
}
_buttonText(conf);
G8z[G8z.i3U]();
if (window[a0z] && conf[D0z] !== z0N) {
var y39 = c5U;
y39 += q0z;
var r39 = L9N;
r39 += g8U;
var n39 = q8U;
n39 += V2d;
n39 += j0z;
n39 += N0z;
var Y19 = L9N;
Y19 += g8U;
var V19 = q8U;
V19 += d5U;
V19 += L9N;
V19 += D9N;
var T19 = L9N;
T19 += g8U;
var i19 = C0z;
i19 += d5U;
i19 += L5N;
var P19 = u9N;
P19 += g4N;
P19 += m8U;
var v19 = I0z;
v19 += J5N;
var o19 = S8U;
o19 += H8U;
o19 += g8U;
o19 += q8U;
container[o19](v19)[P19](conf[K0z] || k0z);
var dragDrop = container[V1c](i19);
dragDrop[T19](V19, function(e) {
var e0z = "originalEvent";
var G0z = "dataTransfer";
var b0z = 'over';
var u19 = G8z.u3U;
u19 += G8z.R3U;
G8z[u19]();
if (conf[d0z]) {
var R19 = S8U;
R19 += H8U;
R19 += r8U;
R19 += y8U;
Editor[g2c](editor, conf, e[e0z][G0z][R19], _buttonText, dropCallback);
dragDrop[a3N](b0z);
}
return z0N;
})[y3N](W0z, function(e) {
var M19 = h0z;
M19 += a5U;
if (conf[M19]) {
var X19 = B6c;
X19 += z8U;
X19 += d5U;
var c19 = V9N;
c19 += g9N;
c19 += X3U;
c19 += D7c;
dragDrop[c19](X19);
}
return z0N;
})[Y19](n39, function(e) {
var g39 = h0z;
g39 += a5U;
if (conf[g39]) {
var z39 = y5U;
z39 += d5U;
var s39 = G8z.T3U;
s39 += Y0c;
s39 += Q0z;
s39 += z9N;
dragDrop[s39](z39);
}
return z0N;
});
editor[y3N](F0z, function() {
var E0z = 'dragover.DTE_Upload drop.DTE_Upload';
var S39 = a6d;
S39 += n6N;
$(S39)[y3N](E0z, function(e) {
var H39 = g8U;
H39 += G8z.R3U;
G8z[H39]();
return z0N;
});
})[r39](y39, function() {
var w0z = "TE_Upload";
var A0z = "dragover.DTE_Upload drop.D";
var Z39 = A0z;
Z39 += w0z;
var x39 = L9N;
x39 += S8U;
x39 += S8U;
var p39 = G8z.u3U;
p39 += G8z.R3U;
G8z[p39]();
$(P6d)[x39](Z39);
});
} else {
var f39 = U0z;
f39 += t0z;
f39 += q8U;
var L39 = S8U;
L39 += b8U;
L39 += q8U;
var l39 = p4N;
l39 += q8U;
l39 += r3d;
l39 += b5N;
container[l39](B0z);
container[G9d](container[L39](f39));
}
container[V1c](o0z)[y3N](d39, function(e) {
var J39 = G8U;
J39 += o4N;
J39 += O5U;
J39 += a5U;
var m39 = Q3d;
m39 += F3d;
m39 += v0z;
m39 += z3N;
e[m39]();
if (conf[J39]) {
var D39 = P8d;
D39 += r8U;
var a39 = v8U;
a39 += m8U;
var O39 = i8U;
O39 += D9N;
O39 += y4N;
O39 += p4N;
Editor[v7N][O39][a39][D39](editor, conf, R7N);
}
});
container[V1c](m0z)[y3N](q39, function() {
var j39 = M4c;
j39 += L9N;
j39 += G8z.T3U;
j39 += q8U;
Editor[j39](editor, conf, this[T2N], _buttonText, function(ids) {
var i0z = "e]";
var P0z = "[type=f";
var I39 = u0N;
I39 += P0z;
I39 += T6d;
I39 += i0z;
var C39 = n2m;
C39 += e6c;
var N39 = g8U;
N39 += G8z.R3U;
G8z[N39]();
dropCallback[C39](editor, ids);
container[V1c](I39)[D7N](R7N);
});
});
return container;
}
function _triggerChange(input) {
G8z[R2N]();
setTimeout(function() {
G8z[G8z.i3U]();
input[Z7c](T0z, {
editor: S0N,
editorSet: S0N
});
}, G8z.I2U);
}
var baseFieldType = $[A7N](S0N, {}, Editor[s9d][S9d], {
get: function(conf) {
return conf[V0z][D7N]();
},
set: function(conf, val) {
var K39 = N4N;
K39 += r8U;
conf[V0z][K39](val);
_triggerChange(conf[V0z]);
},
enable: function(conf) {
var u0z = "abled";
var G39 = l9d;
G39 += u0z;
var e39 = H6N;
e39 += L9N;
e39 += D9N;
var k39 = R0z;
k39 += D9N;
k39 += i8U;
k39 += m8U;
G8z[G8z.i3U]();
conf[k39][e39](G39, z0N);
},
disable: function(conf) {
var h39 = m3N;
h39 += v9N;
h39 += q8U;
var W39 = D9N;
W39 += d5U;
W39 += L5N;
var b39 = g8U;
b39 += G8z.R3U;
G8z[b39]();
conf[V0z][W39](h39, S0N);
},
canReturnSubmit: function(conf, node) {
return S0N;
}
});
fieldTypes[Q39] = {
create: function(conf) {
var M0z = "alue";
var E39 = E0N;
E39 += M0z;
var F39 = G8U;
F39 += D7N;
conf[F39] = conf[E39];
return I1N;
},
get: function(conf) {
var w39 = c0z;
w39 += k8d;
var A39 = g8U;
A39 += G8z.R3U;
G8z[A39]();
return conf[w39];
},
set: function(conf, val) {
var U39 = G8U;
U39 += E0N;
U39 += G8z.T3U;
U39 += r8U;
conf[U39] = val;
}
};
fieldTypes[X0z] = $[A7N](S0N, {}, baseFieldType, {
create: function(conf) {
var Y0z = "fe";
var s7z = 'readonly';
var P39 = F2z;
P39 += Z8m;
var v39 = H8U;
v39 += q8U;
var o39 = R4N;
o39 += Y0z;
o39 += S7N;
var B39 = F8U;
B39 += O6d;
var t39 = G8z.T3U;
t39 += C8c;
t39 += d5U;
conf[V0z] = $(n7z)[t39]($[B39]({
id: Editor[o39](conf[v39]),
type: g7z,
readonly: s7z
}, conf[N3d] || {}));
return conf[P39][G8z.I2U];
}
});
fieldTypes[g9d] = $[A7N](S0N, {}, baseFieldType, {
create: function(conf) {
var u39 = B2z;
u39 += c0N;
var V39 = H8U;
V39 += q8U;
var T39 = G8z.T3U;
T39 += C8c;
T39 += d5U;
var i39 = G8U;
i39 += N5m;
i39 += m8U;
conf[i39] = $(n7z)[T39]($[A7N]({
id: Editor[E4c](conf[V39]),
type: g7z
}, conf[N3d] || {}));
return conf[u39][G8z.I2U];
}
});
fieldTypes[R39] = $[M39](S0N, {}, baseFieldType, {
create: function(conf) {
var z7z = "assw";
var g89 = G8U;
g89 += D2z;
g89 += Z8m;
var n89 = D9N;
n89 += z7z;
n89 += k4N;
var Y39 = H8U;
Y39 += q8U;
var X39 = z8U;
X39 += g4N;
X39 += m8U;
X39 += O6d;
var c39 = M7N;
c39 += m8U;
c39 += d5U;
G8z[G8z.i3U]();
conf[V0z] = $(n7z)[c39]($[X39]({
id: Editor[E4c](conf[Y39]),
type: n89
}, conf[N3d] || {}));
return conf[g89][G8z.I2U];
}
});
fieldTypes[S7z] = $[s89](S0N, {}, baseFieldType, {
create: function(conf) {
var H7z = '<textarea/>';
var H89 = z8U;
H89 += R7c;
H89 += X2N;
H89 += q8U;
var S89 = G8z.T3U;
S89 += m8U;
S89 += X8d;
var z89 = F2z;
z89 += Z8m;
G8z[G8z.i3U]();
conf[z89] = $(H7z)[S89]($[H89]({
id: Editor[E4c](conf[A4N])
}, conf[N3d] || {}));
return conf[V0z][G8z.I2U];
},
canReturnSubmit: function(conf, node) {
var r89 = g8U;
r89 += G8z.R3U;
G8z[r89]();
return z0N;
}
});
fieldTypes[O0m] = $[A7N](S0N, {}, baseFieldType, {
_addOptions: function(conf, opts, append) {
var x7z = "lderValue";
var p7z = "eho";
var L7z = "hidden";
var Z7z = "placeholderValue";
var d7z = "airs";
var l7z = "placeholderDisabled";
var r7z = "placeholder";
var p89 = L5N;
p89 += T0N;
p89 += Y3c;
var y89 = G8U;
y89 += H8U;
y89 += c0N;
var elOpts = conf[y89][G8z.I2U][p89];
var countOffset = G8z.I2U;
if (!append) {
var x89 = v9N;
x89 += g8U;
x89 += q4N;
x89 += Y2N;
elOpts[x89] = G8z.I2U;
if (conf[r7z] !== undefined) {
var Z89 = y7z;
Z89 += c5U;
Z89 += p7z;
Z89 += x7z;
var placeholderValue = conf[Z89] !== undefined ? conf[Z7z] : R7N;
countOffset += K2U;
elOpts[G8z.I2U] = new Option(conf[r7z], placeholderValue);
var disabled = conf[l7z] !== undefined ? conf[l7z] : S0N;
elOpts[G8z.I2U][L7z] = disabled;
elOpts[G8z.I2U][B1N] = disabled;
elOpts[G8z.I2U][f7z] = placeholderValue;
}
} else {
countOffset = elOpts[U5N];
}
G8z[R2N]();
if (opts) {
var l89 = D9N;
l89 += d7z;
Editor[l89](opts, conf[m7z], function(val, label, i, attr) {
var J7z = "_edito";
var L89 = J7z;
L89 += o5U;
L89 += D7N;
var option = new Option(label, val);
option[L89] = val;
if (attr) {
var f89 = G8z.T3U;
f89 += m8U;
f89 += m8U;
f89 += d5U;
$(option)[f89](attr);
}
elOpts[i + countOffset] = option;
});
}
},
create: function(conf) {
var D7z = '<select/>';
var j7z = 'change.dte';
var O7z = "ipOp";
var j89 = O7z;
j89 += W7N;
var q89 = g8U;
q89 += G8z.R3U;
var O89 = L9N;
O89 += g8U;
var J89 = H8U;
J89 += q8U;
var m89 = z9N;
m89 += G8z.T3U;
m89 += S8U;
m89 += a7z;
var d89 = G8z.T3U;
d89 += m8U;
d89 += m8U;
d89 += d5U;
conf[V0z] = $(D7z)[d89]($[A7N]({
id: Editor[m89](conf[J89]),
multiple: conf[q7z] === S0N
}, conf[N3d] || {}))[O89](j7z, function(e, d) {
var N7z = "tSet";
var a89 = r5d;
a89 += Y5U;
if (!d || !d[a89]) {
var D89 = G8U;
D89 += r8U;
D89 += w1N;
D89 += N7z;
conf[D89] = fieldTypes[O0m][k5d](conf);
}
});
G8z[q89]();
fieldTypes[O0m][C7z](conf, conf[x5c] || conf[j89]);
return conf[V0z][G8z.I2U];
},
update: function(conf, options, append) {
var I7z = "_lastS";
var K7z = "_addO";
var I89 = I7z;
I89 += i9N;
var C89 = K7z;
C89 += x9N;
var N89 = v8U;
N89 += a0m;
G8z[G8z.i3U]();
fieldTypes[N89][C89](conf, options, append);
var lastSet = conf[I89];
if (lastSet !== undefined) {
fieldTypes[O0m][S4c](conf, lastSet, S0N);
}
_triggerChange(conf[V0z]);
},
get: function(conf) {
var b7z = "parator";
var G7z = "elected";
var h7z = "ato";
var k7z = "toArra";
var e7z = ":s";
var F89 = g0N;
F89 += m8U;
F89 += C9N;
var b89 = k7z;
b89 += G8z.u3U;
var G89 = q9N;
G89 += G8z.T3U;
G89 += D9N;
var e89 = L5N;
e89 += g3N;
e89 += e7z;
e89 += G7z;
var k89 = S8U;
k89 += H8U;
k89 += g8U;
k89 += q8U;
var K89 = F2z;
K89 += Z8m;
var val = conf[K89][k89](e89)[G89](function() {
G8z[G8z.i3U]();
return this[f7z];
})[b89]();
if (conf[q7z]) {
var Q89 = v8U;
Q89 += b7z;
var h89 = r2N;
h89 += F3c;
h89 += g8U;
var W89 = W7z;
W89 += d5U;
W89 += h7z;
W89 += d5U;
return conf[W89] ? val[h89](conf[Q89]) : val;
}
return val[F89] ? val[G8z.I2U] : I1N;
},
set: function(conf, val, localUpdate) {
var U7z = "tSe";
var w7z = "_la";
var Q7z = "ple";
var o7z = 'option';
var F7z = "laceholder";
var E7z = "isA";
var t7z = "st";
var V89 = v9N;
V89 += d6N;
V89 += m8U;
V89 += C9N;
var T89 = j5U;
T89 += r8U;
T89 += T0N;
T89 += Q7z;
var i89 = D9N;
i89 += F7z;
var P89 = z8U;
P89 += F4d;
var v89 = L9N;
v89 += m5d;
v89 += n8U;
v89 += g8U;
var o89 = G8U;
o89 += b8U;
o89 += i9m;
o89 += m8U;
var B89 = S8U;
B89 += H8U;
B89 += g8U;
B89 += q8U;
var t89 = E7z;
t89 += e8N;
t89 += p2N;
var w89 = O8d;
w89 += L3c;
var A89 = W7z;
A89 += A7z;
if (!localUpdate) {
var E89 = w7z;
E89 += z9N;
E89 += U7z;
E89 += m8U;
conf[E89] = val;
}
if (conf[q7z] && conf[A89] && !$[w89](val)) {
var U89 = t7z;
U89 += d5U;
U89 += b8U;
U89 += q4N;
val = typeof val === U89 ? val[E3c](conf[B7z]) : [];
} else if (!$[t89](val)) {
val = [val];
}
var i, len = val[U5N],
found, allFound = z0N;
var options = conf[V0z][B89](o7z);
conf[o89][V1c](v89)[P89](function() {
found = z0N;
G8z[G8z.i3U]();
for (i = G8z.I2U; i < len; i++) {
if (this[f7z] == val[i]) {
found = S0N;
allFound = S0N;
break;
}
}
this[O9z] = found;
});
if (conf[i89] && !allFound && !conf[T89] && options[V89]) {
var u89 = z9N;
u89 += O8m;
u89 += z8U;
u89 += q8U;
options[G8z.I2U][u89] = S0N;
}
if (!localUpdate) {
var R89 = G8U;
R89 += b8U;
R89 += D9N;
R89 += Z8m;
_triggerChange(conf[R89]);
}
return allFound;
},
destroy: function(conf) {
var v7z = "ange.d";
var c89 = c5U;
c89 += C9N;
c89 += v7z;
c89 += u9N;
var M89 = L9N;
M89 += S8U;
M89 += S8U;
conf[V0z][M89](c89);
}
});
fieldTypes[X89] = $[A7N](S0N, {}, baseFieldType, {
_addOptions: function(conf, opts, append) {
var s59 = G8z.u3U;
s59 += G8z.R3U;
var val, label;
var jqInput = conf[V0z];
var offset = G8z.I2U;
if (!append) {
var Y89 = L0m;
Y89 += D9N;
Y89 += m8U;
Y89 += G8z.u3U;
jqInput[Y89]();
} else {
var g59 = v9N;
g59 += g8U;
g59 += m8N;
var n59 = H8U;
n59 += Q3m;
n59 += Z8m;
offset = $(n59, jqInput)[g59];
}
G8z[s59]();
if (opts) {
var z59 = D9N;
z59 += G8z.T3U;
z59 += H8U;
z59 += Y3U;
Editor[z59](opts, conf[m7z], function(val, label, i, attr) {
var M7z = '" type="checkbox" />';
var Y7z = "put:";
var n1z = "last";
var i7z = "safeI";
var T7z = "<di";
var P7z = "el>";
var l59 = G8z.T3U;
l59 += C8c;
l59 += d5U;
var Z59 = z0c;
Z59 += h0N;
var x59 = I0N;
x59 += V0N;
x59 += g7N;
x59 += P7z;
var p59 = H8U;
p59 += q8U;
var y59 = i7z;
y59 += q8U;
var r59 = T7z;
r59 += h0N;
var H59 = G8z.T3U;
H59 += V7z;
H59 += g8U;
H59 += q8U;
var S59 = g8U;
S59 += G8z.R3U;
G8z[S59]();
jqInput[H59](r59 + u7z + Editor[y59](conf[p59]) + R7z + (i + offset) + M7z + c7z + Editor[E4c](conf[A4N]) + R7z + (i + offset) + z1N + label + x59 + Z59);
$(X7z, jqInput)[l59](X8m, val)[G8z.I2U][f7z] = val;
if (attr) {
var f59 = G8z.T3U;
f59 += m8U;
f59 += m8U;
f59 += d5U;
var L59 = b8U;
L59 += Y7z;
L59 += n1z;
$(L59, jqInput)[f59](attr);
}
});
}
},
create: function(conf) {
var s1z = "kbo";
var g1z = "chec";
var m59 = G8U;
m59 += D2z;
m59 += Z8m;
var d59 = g1z;
d59 += s1z;
d59 += g4N;
conf[V0z] = $(z1z);
fieldTypes[d59][C7z](conf, conf[x5c] || conf[S1z]);
return conf[m59][G8z.I2U];
},
get: function(conf) {
var r1z = "arat";
var f1z = "unselectedValue";
var x1z = "put:check";
var H1z = "separa";
var y1z = "unsel";
var p1z = "edValu";
var K59 = H1z;
K59 += Y7N;
var I59 = v8U;
I59 += D9N;
I59 += r1z;
I59 += Y5U;
var N59 = y1z;
N59 += R8d;
N59 += p1z;
N59 += z8U;
var a59 = G8z.u3U;
a59 += G8z.R3U;
var O59 = b8U;
O59 += x1z;
O59 += a4N;
var J59 = G8U;
J59 += H8U;
J59 += Z1z;
J59 += m8U;
var out = [];
var selected = conf[J59][V1c](O59);
G8z[a59]();
if (selected[U5N]) {
selected[U2N](function() {
var L1z = "tor_";
var l1z = "_edi";
var j59 = l1z;
j59 += L1z;
j59 += E0N;
j59 += k8d;
var q59 = D9N;
q59 += x2N;
q59 += C9N;
var D59 = G8z.u3U;
D59 += G8z.R3U;
G8z[D59]();
out[q59](this[j59]);
});
} else if (conf[N59] !== undefined) {
var C59 = i9m;
C59 += K4N;
out[C59](conf[f1z]);
}
return conf[B7z] === undefined || conf[I59] === I1N ? out : out[W6c](conf[K59]);
},
set: function(conf, val) {
var d1z = '|';
var h59 = I8d;
h59 += C9N;
var W59 = r8U;
W59 += z8U;
W59 += g8U;
W59 += m8N;
var e59 = H8U;
e59 += c0N;
var k59 = G8U;
k59 += H8U;
k59 += c0N;
var jqInputs = conf[k59][V1c](e59);
if (!$[f7d](val) && typeof val === q3d) {
var b59 = z9N;
b59 += z8U;
b59 += x4N;
b59 += A7z;
var G59 = V4m;
G59 += m8U;
val = val[G59](conf[b59] || d1z);
} else if (!$[f7d](val)) {
val = [val];
}
var i, len = val[W59],
found;
jqInputs[h59](function() {
var m1z = "ked";
var F59 = c5U;
F59 += F1d;
F59 += c5U;
F59 += m1z;
found = z0N;
for (i = G8z.I2U; i < len; i++) {
var Q59 = l5d;
Q59 += Y5U;
Q59 += J1z;
if (this[Q59] == val[i]) {
found = S0N;
break;
}
}
this[F59] = found;
});
_triggerChange(jqInputs);
},
enable: function(conf) {
var w59 = s5d;
w59 += q8U;
var A59 = S8U;
A59 += b8U;
A59 += q8U;
var E59 = g8U;
E59 += G8z.R3U;
G8z[E59]();
conf[V0z][A59](o3N)[O1z](w59, z0N);
},
disable: function(conf) {
var t59 = t4N;
t59 += g8U;
t59 += q8U;
var U59 = g8U;
U59 += G8z.R3U;
G8z[U59]();
conf[V0z][t59](o3N)[O1z](b8m, S0N);
},
update: function(conf, options, append) {
var D1z = "checkbox";
var a1z = "_addOption";
var o59 = a1z;
o59 += z9N;
var B59 = t8d;
B59 += m8U;
var checkbox = fieldTypes[D1z];
var currVal = checkbox[B59](conf);
G8z[G8z.i3U]();
checkbox[o59](conf, options, append);
checkbox[S4c](conf, currVal);
}
});
fieldTypes[v59] = $[A7N](S0N, {}, baseFieldType, {
_addOptions: function(conf, opts, append) {
var N1z = "Pair";
var j1z = "ption";
var q1z = "mpt";
var C1z = "pairs";
var P59 = B2z;
P59 += c0N;
var val, label;
var jqInput = conf[P59];
var offset = G8z.I2U;
if (!append) {
var i59 = z8U;
i59 += q1z;
i59 += G8z.u3U;
jqInput[i59]();
} else {
var T59 = N5m;
T59 += m8U;
offset = $(T59, jqInput)[U5N];
}
if (opts) {
var V59 = L9N;
V59 += j1z;
V59 += z9N;
V59 += N1z;
Editor[C1z](opts, conf[V59], function(val, label, i, attr) {
var k1z = "afeId";
var G1z = '" type="radio" name="';
var K1z = "afe";
var I1z = "/label>";
var e1z = '<div>';
var g9U = N4N;
g9U += r8U;
g9U += i8U;
g9U += z8U;
var n9U = x1d;
n9U += q8U;
n9U += q1c;
n9U += W0N;
var Y59 = I0N;
Y59 += I1z;
var X59 = E2N;
X59 += W0N;
var c59 = H8U;
c59 += q8U;
var M59 = z9N;
M59 += K1z;
M59 += S7N;
var R59 = H8U;
R59 += q8U;
var u59 = z9N;
u59 += k1z;
jqInput[G9d](e1z + u7z + Editor[u59](conf[R59]) + R7z + (i + offset) + G1z + conf[P7N] + l0z + c7z + Editor[M59](conf[c59]) + R7z + (i + offset) + X59 + label + Y59 + n9U);
$(X7z, jqInput)[N3d](g9U, val)[G8z.I2U][f7z] = val;
if (attr) {
$(X7z, jqInput)[N3d](attr);
}
});
}
},
create: function(conf) {
var b1z = "pti";
var W1z = "_addOpt";
var x9U = G8U;
x9U += D2z;
x9U += Z8m;
var r9U = L9N;
r9U += g8U;
var H9U = L9N;
H9U += b1z;
H9U += L9N;
H9U += V1N;
var S9U = W1z;
S9U += J5d;
var z9U = g8U;
z9U += G8z.R3U;
var s9U = R0z;
s9U += D9N;
s9U += i8U;
s9U += m8U;
conf[s9U] = $(z1z);
G8z[z9U]();
fieldTypes[h1z][S9U](conf, conf[H9U] || conf[S1z]);
this[r9U](F0z, function() {
var y9U = S8U;
y9U += H8U;
y9U += g8U;
y9U += q8U;
conf[V0z][y9U](o3N)[U2N](function() {
var F1z = "ecked";
if (this[Q1z]) {
var p9U = r9N;
p9U += F1z;
this[p9U] = S0N;
}
});
});
return conf[x9U][G8z.I2U];
},
get: function(conf) {
var E1z = 'input:checked';
var l9U = r8U;
l9U += n0N;
l9U += m8U;
l9U += C9N;
var Z9U = S8U;
Z9U += H8U;
Z9U += g8U;
Z9U += q8U;
var el = conf[V0z][Z9U](E1z);
return el[l9U] ? el[G8z.I2U][f7z] : undefined;
},
set: function(conf, val) {
var A1z = "t:che";
var w1z = "cked";
var a9U = D2z;
a9U += i8U;
a9U += A1z;
a9U += w1z;
var O9U = e7m;
O9U += q8U;
var d9U = z8U;
d9U += F4d;
var f9U = H8U;
f9U += c0N;
var L9U = G8U;
L9U += H8U;
L9U += g8U;
L9U += U1m;
var that = this;
conf[L9U][V1c](f9U)[d9U](function() {
var U1z = "checked";
var B1z = "eck";
var t1z = "reChecked";
this[Q1z] = z0N;
if (this[f7z] == val) {
this[U1z] = S0N;
this[Q1z] = S0N;
} else {
var J9U = l9c;
J9U += t1z;
var m9U = c5U;
m9U += C9N;
m9U += B1z;
m9U += a4N;
this[m9U] = z0N;
this[J9U] = z0N;
}
});
_triggerChange(conf[V0z][O9U](a9U));
},
enable: function(conf) {
var N9U = l9d;
N9U += P0c;
N9U += q8U;
var j9U = D9N;
j9U += I7N;
var q9U = b8U;
q9U += i9m;
q9U += m8U;
var D9U = G8U;
D9U += H8U;
D9U += c0N;
G8z[R2N]();
conf[D9U][V1c](q9U)[j9U](N9U, z0N);
},
disable: function(conf) {
var k9U = q8U;
k9U += F2d;
k9U += G8z.T3U;
k9U += o1z;
var K9U = H8U;
K9U += c0N;
var I9U = t4N;
I9U += H9N;
var C9U = B2z;
C9U += Z1z;
C9U += m8U;
conf[C9U][I9U](K9U)[O1z](k9U, S0N);
},
update: function(conf, options, append) {
var i1z = '[value="';
var v1z = "Op";
var P1z = "tions";
var F9U = N4N;
F9U += r8U;
F9U += F4c;
var Q9U = z8U;
Q9U += p1d;
var h9U = S8U;
h9U += T6d;
h9U += m8U;
h9U += e4N;
var W9U = H8U;
W9U += Q3m;
W9U += Z8m;
var b9U = t4N;
b9U += H9N;
var G9U = X6N;
G9U += Y0c;
G9U += v1z;
G9U += P1z;
var e9U = q4N;
e9U += z8U;
e9U += m8U;
var radio = fieldTypes[h1z];
var currVal = radio[e9U](conf);
radio[G9U](conf, options, append);
var inputs = conf[V0z][b9U](W9U);
radio[S4c](conf, inputs[h9U](i1z + currVal + R1c)[U5N] ? currVal : inputs[Q9U](G8z.I2U)[N3d](F9U));
}
});
fieldTypes[C3m] = $[A7N](S0N, {}, baseFieldType, {
create: function(conf) {
var S3z = 'type';
var T1z = '<input />';
var M1z = "dateFormat";
var H3z = 'date';
var Y1z = "RFC_2822";
var u1z = "addC";
var R1z = 'jqueryui';
var w9U = G8z.u3U;
w9U += G8z.R3U;
var A9U = m8U;
A9U += z8U;
A9U += g4N;
A9U += m8U;
var E9U = z7N;
E9U += H4c;
E9U += q8U;
conf[V0z] = $(T1z)[N3d]($[A7N]({
id: Editor[E9U](conf[A4N]),
type: A9U
}, conf[N3d]));
G8z[w9U]();
if ($[V1z]) {
var U9U = u1z;
U9U += j3N;
conf[V0z][U9U](R1z);
if (!conf[M1z]) {
var t9U = q8U;
t9U += M7N;
t9U += c1z;
t9U += X1z;
conf[M1z] = $[t9U][Y1z];
}
setTimeout(function() {
var s3z = "dateF";
var z3z = "orma";
var n3z = "#ui-datepicke";
var g3z = "r-di";
var V9U = l9d;
V9U += y7z;
V9U += G8z.u3U;
var T9U = n3z;
T9U += g3z;
T9U += E0N;
var i9U = L9N;
i9U += m5d;
i9U += z9N;
var v9U = C3m;
v9U += H4c;
v9U += q9N;
v9U += m4c;
var o9U = s3z;
o9U += z3z;
o9U += m8U;
var B9U = F8U;
B9U += X2N;
B9U += q8U;
G8z[G8z.i3U]();
$(conf[V0z])[V1z]($[B9U]({
dateFormat: conf[o9U],
buttonImage: conf[v9U],
buttonImageOnly: S0N,
onSelect: function() {
var P9U = C5U;
P9U += c5U;
P9U += x2N;
conf[V0z][P9U]()[d4d]();
}
}, conf[i9U]));
$(T9U)[G1N](V9U, h8N);
}, Q2U);
} else {
var u9U = R0z;
u9U += D9N;
u9U += Z8m;
conf[u9U][N3d](S3z, H3z);
}
return conf[V0z][G8z.I2U];
},
set: function(conf, val) {
var r3z = 'hasDatepicker';
var R9U = B2z;
R9U += c0N;
if ($[V1z] && conf[R9U][t3N](r3z)) {
var c9U = c5U;
c9U += C9N;
c9U += G8z.T3U;
c9U += D3m;
var M9U = G8U;
M9U += u0N;
conf[M9U][V1z](q6z, val)[c9U]();
} else {
var X9U = E0N;
X9U += G8z.T3U;
X9U += r8U;
$(conf[V0z])[X9U](val);
}
},
enable: function(conf) {
var y3z = "nable";
var p3z = "tepicke";
G8z[G8z.i3U]();
if ($[V1z]) {
var n6U = z8U;
n6U += y3z;
var Y9U = N7N;
Y9U += p3z;
Y9U += d5U;
conf[V0z][Y9U](n6U);
} else {
var g6U = D9N;
g6U += d5U;
g6U += L9N;
g6U += D9N;
$(conf[V0z])[g6U](b8m, z0N);
}
},
disable: function(conf) {
var Z3z = "pick";
var z6U = T7N;
z6U += c1z;
z6U += c5U;
z6U += x3z;
var s6U = g8U;
s6U += G8z.R3U;
G8z[s6U]();
if ($[z6U]) {
var S6U = q8U;
S6U += C8d;
S6U += Z3z;
S6U += e4N;
conf[V0z][S6U](s5d);
} else {
var r6U = q8U;
r6U += F2d;
r6U += G8z.T3U;
r6U += o1z;
var H6U = D9N;
H6U += d5U;
H6U += L9N;
H6U += D9N;
$(conf[V0z])[H6U](r6U, S0N);
}
},
owns: function(conf, node) {
var l3z = ".ui-datepicker";
var L3z = "eader";
var f3z = 'div.ui-datepicker';
var Z6U = c1d;
Z6U += l3z;
Z6U += i3m;
Z6U += L3z;
var x6U = G6z;
x6U += z9N;
var p6U = v9N;
p6U += w3N;
var y6U = G8z.u3U;
y6U += G8z.R3U;
G8z[y6U]();
return $(node)[d3N](f3z)[p6U] || $(node)[x6U](Z6U)[U5N] ? S0N : z0N;
}
});
fieldTypes[l6U] = $[L6U](S0N, {}, baseFieldType, {
create: function(conf) {
var J3z = "displayFo";
var q3z = "nput /";
var d3z = "seFn";
var D3z = "<i";
var O3z = "pic";
var a3z = "ke";
var m3z = "eyIn";
var E6U = G8U;
E6U += H8U;
E6U += g8U;
E6U += U1m;
var F6U = f6c;
F6U += L9N;
F6U += d3z;
var W6U = P5N;
W6U += m3z;
W6U += U1m;
var e6U = r1d;
e6U += v8U;
e6U += j9m;
var k6U = L5N;
k6U += m8U;
k6U += z9N;
var K6U = H8U;
K6U += l4c;
var I6U = J3z;
I6U += D7m;
var C6U = z8U;
C6U += R7c;
C6U += O6d;
var N6U = R0z;
N6U += D9N;
N6U += Z8m;
var j6U = D8U;
j6U += C8d;
j6U += f1m;
var q6U = G8U;
q6U += O3z;
q6U += a3z;
q6U += d5U;
var D6U = g8U;
D6U += G8z.R3U;
var a6U = M7N;
a6U += m8U;
a6U += d5U;
var O6U = u9N;
O6U += g4N;
O6U += m8U;
var J6U = H8U;
J6U += q8U;
var m6U = z9N;
m6U += G8z.T3U;
m6U += S8U;
m6U += a7z;
var d6U = G8z.T3U;
d6U += m8U;
d6U += m8U;
d6U += d5U;
var f6U = D3z;
f6U += q3z;
f6U += W0N;
conf[V0z] = $(f6U)[d6U]($[A7N](S0N, {
id: Editor[m6U](conf[J6U]),
type: O6U
}, conf[a6U]));
G8z[D6U]();
conf[q6U] = new Editor[j6U](conf[N6U], $[C6U]({
format: conf[I6U] || conf[m1m],
i18n: this[K6U][K2z],
onChange: function() {
setTimeout(function() {
G8z[G8z.i3U]();
conf[V0z][Z7c](T0z);
}, G8z.I2U);
}
}, conf[k6U]));
conf[e6U] = function() {
var b6U = C9N;
b6U += H8U;
b6U += i4N;
var G6U = G8U;
G6U += j3z;
conf[G6U][b6U]();
};
if (conf[W6U] === z0N) {
var h6U = L9N;
h6U += g8U;
conf[V0z][h6U](z5c, function(e) {
var N3z = "ventDe";
var Q6U = b3d;
Q6U += N3z;
Q6U += v0z;
Q6U += z3N;
e[Q6U]();
});
}
this[y3N](x9d, conf[F6U]);
return conf[E6U][G8z.I2U];
},
get: function(conf) {
var I3z = "mentLocale";
var K3z = "wireFo";
var C3z = "wireFor";
var B6U = C3z;
B6U += q9N;
B6U += M7N;
var t6U = S8U;
t6U += L9N;
t6U += D7m;
var U6U = g9N;
U6U += I3z;
var w6U = n0c;
w6U += f6d;
var A6U = K3z;
A6U += D7m;
let val = conf[V0z][D7N]();
let inst = conf[k3z][c5U];
G8z[G8z.i3U]();
return conf[A6U] && moment ? moment(val, inst[w6U], inst[U6U], inst[C2z])[t6U](conf[B6U]) : val;
},
set: function(conf, val) {
var G3z = "ntSt";
var Q3z = "wire";
var F3z = "Fo";
var E3z = "icke";
var W3z = "momentLoc";
var e3z = "mome";
var h3z = "wireForma";
var b3z = "ict";
var R6U = B2z;
R6U += g8U;
R6U += U1m;
var u6U = C5U;
u6U += d5U;
u6U += f6d;
var V6U = e3z;
V6U += G3z;
V6U += d5U;
V6U += b3z;
var T6U = W3z;
T6U += G8z.T3U;
T6U += v9N;
var i6U = h3z;
i6U += m8U;
var P6U = Q3z;
P6U += F3z;
P6U += D7m;
var v6U = G8U;
v6U += j3z;
var o6U = l9c;
o6U += E3z;
o6U += d5U;
let inst = conf[o6U][c5U];
conf[v6U][D7N](conf[P6U] && moment ? moment(val, conf[i6U], inst[T6U], inst[V6U])[m1m](inst[u6U]) : val);
_triggerChange(conf[R6U]);
},
owns: function(conf, node) {
var c6U = L9N;
c6U += R9N;
c6U += g8U;
c6U += z9N;
var M6U = l9c;
M6U += H8U;
M6U += X1z;
return conf[M6U][c6U](node);
},
errorMessage: function(conf, msg) {
var A3z = "errorMsg";
var X6U = l9c;
X6U += t2z;
X6U += P5N;
X6U += e4N;
conf[X6U][A3z](msg);
},
destroy: function(conf) {
var w3z = "down";
var s4U = q8U;
s4U += z8U;
s4U += B8N;
s4U += Y8d;
var g4U = P5N;
g4U += I8c;
g4U += w3z;
var n4U = u6N;
n4U += T1N;
var Y6U = c5U;
Y6U += y4N;
Y6U += v8U;
G8z[G8z.i3U]();
this[o1d](Y6U, conf[n4U]);
conf[V0z][o1d](g4U);
conf[k3z][s4U]();
},
minDate: function(conf, min) {
var z4U = B8c;
z4U += g8U;
G8z[R2N]();
conf[k3z][z4U](min);
},
maxDate: function(conf, max) {
var H4U = q9N;
H4U += G8z.T3U;
H4U += g4N;
var S4U = G8U;
S4U += D9N;
S4U += t2z;
S4U += x3z;
conf[S4U][H4U](max);
}
});
fieldTypes[g2c] = $[A7N](S0N, {}, baseFieldType, {
create: function(conf) {
var editor = this;
var container = _commonUpload(editor, conf, function(val) {
var U3z = 'postUpload';
var x4U = g8U;
x4U += G8z.T3U;
x4U += q9N;
x4U += z8U;
var p4U = G8U;
p4U += z8U;
p4U += E0N;
p4U += V3d;
var y4U = z9N;
y4U += z8U;
y4U += m8U;
var r4U = i8U;
r4U += D9N;
r4U += r8U;
r4U += R4c;
Editor[v7N][r4U][y4U][X1N](editor, conf, val[G8z.I2U]);
G8z[R2N]();
editor[p4U](U3z, [conf[x4U], val[G8z.I2U]]);
});
return container;
},
get: function(conf) {
var Z4U = g8U;
Z4U += G8z.R3U;
G8z[Z4U]();
return conf[J1z];
},
set: function(conf, val) {
var R3z = "Clear";
var T3z = 'No file';
var P3z = "</span";
var M3z = "dCl";
var B3z = "andler";
var t3z = "triggerH";
var V3z = "clearText";
var u3z = 'noClear';
var o3z = "div.re";
var I4U = t3z;
I4U += B3z;
var C4U = H8U;
C4U += Z1z;
C4U += m8U;
var N4U = B2z;
N4U += Z1z;
N4U += m8U;
var D4U = g8U;
D4U += G8z.R3U;
var a4U = S8U;
a4U += f4d;
var l4U = l9d;
l4U += D9N;
l4U += R7d;
l4U += G8z.u3U;
conf[J1z] = val;
var container = conf[V0z];
if (conf[l4U]) {
var d4U = c0z;
d4U += G8z.T3U;
d4U += r8U;
var f4U = o3z;
f4U += g8U;
f4U += v3z;
var L4U = t4N;
L4U += g8U;
L4U += q8U;
var rendered = container[L4U](f4U);
if (conf[d4U]) {
var m4U = q8U;
m4U += H8U;
m4U += e1N;
m4U += p2N;
rendered[p8N](conf[m4U](conf[J1z]));
} else {
var O4U = P3z;
O4U += W0N;
var J4U = P7m;
J4U += x4N;
J4U += g9z;
rendered[m3d]()[G9d](J4U + (conf[i3z] || T3z) + O4U);
}
}
var button = container[a4U](o0z);
G8z[D4U]();
if (val && conf[V3z]) {
button[p8N](conf[V3z]);
container[a3N](u3z);
} else {
var j4U = G5N;
j4U += R3z;
var q4U = p4N;
q4U += M3z;
q4U += Q3N;
container[q4U](j4U);
}
conf[N4U][V1c](C4U)[I4U](c3z, [conf[J1z]]);
},
enable: function(conf) {
var X3z = "isabled";
var G4U = q8U;
G4U += X3z;
var e4U = S8U;
e4U += H8U;
e4U += g8U;
e4U += q8U;
var k4U = B2z;
k4U += g8U;
k4U += U1m;
var K4U = g8U;
K4U += G8z.R3U;
G8z[K4U]();
conf[k4U][e4U](o3N)[O1z](G4U, z0N);
conf[d0z] = S0N;
},
disable: function(conf) {
var W4U = D9N;
W4U += d5U;
W4U += L5N;
var b4U = R0z;
b4U += U1m;
G8z[G8z.i3U]();
conf[b4U][V1c](o3N)[W4U](b8m, S0N);
conf[d0z] = z0N;
},
canReturnSubmit: function(conf, node) {
return z0N;
}
});
fieldTypes[Y3z] = $[A7N](S0N, {}, baseFieldType, {
_showHide: function(conf) {
var g8z = "limit";
var z8z = 'div.limitHide';
var n8z = "_limitLef";
var s8z = "_container";
var A4U = c0z;
A4U += k8d;
var E4U = n8z;
E4U += m8U;
var F4U = n7d;
F4U += v5N;
F4U += P5N;
var Q4U = c5U;
Q4U += z9N;
Q4U += z9N;
var h4U = e7m;
h4U += q8U;
if (!conf[g8z]) {
return;
}
conf[s8z][h4U](z8z)[Q4U](z8N, conf[J1z][U5N] >= conf[g8z] ? h8N : F4U);
conf[E4U] = conf[g8z] - conf[A4U][U5N];
},
create: function(conf) {
var H8z = "ulti";
var x8z = 'button.remove';
var S8z = "_contain";
var u4U = S8z;
u4U += e4N;
var v4U = q9N;
v4U += H8z;
var o4U = p4N;
o4U += q8U;
o4U += Q0z;
o4U += z9N;
var editor = this;
var container = _commonUpload(editor, conf, function(val) {
var y8z = "fieldTy";
var r8z = "ostUpload";
var p8z = "cat";
var B4U = D9N;
B4U += r8z;
var t4U = H6c;
t4U += m8U;
var U4U = y8z;
U4U += Q2z;
var w4U = c5U;
w4U += y3N;
w4U += p8z;
conf[J1z] = conf[J1z][w4U](val);
Editor[U4U][Y3z][S4c][X1N](editor, conf, conf[J1z]);
editor[t4U](B4U, [conf[P7N], conf[J1z]]);
}, S0N);
container[o4U](v4U)[y3N](h1N, x8z, function(e) {
var Z8z = "stopPropagation";
var i4U = h0z;
i4U += a5U;
var P4U = g8U;
P4U += G8z.R3U;
e[Z8z]();
G8z[P4U]();
if (conf[i4U]) {
var V4U = G8U;
V4U += E0N;
V4U += k8d;
var T4U = H8U;
T4U += q8U;
T4U += g4N;
var idx = $(this)[u7N](T4U);
conf[V4U][B3d](idx, K2U);
Editor[v7N][Y3z][S4c][X1N](editor, conf, conf[J1z]);
}
});
conf[u4U] = container;
return container;
},
get: function(conf) {
var R4U = G8U;
R4U += N4N;
R4U += r8U;
return conf[R4U];
},
set: function(conf, val) {
var C8z = "triggerHandler";
var N8z = "_showHide";
var j8z = "No f";
var m8z = "ndT";
var f8z = "sArr";
var L8z = "ypes";
var d8z = 'Upload collections must have an array as a value';
var l8z = "ieldT";
var q8z = "an>";
var J8z = '<ul/>';
var Z2U = B2z;
Z2U += g8U;
Z2U += i9m;
Z2U += m8U;
var x2U = S8U;
x2U += l8z;
x2U += L8z;
var c4U = G8U;
c4U += E0N;
c4U += k8d;
var M4U = H8U;
M4U += f8z;
M4U += G8z.T3U;
M4U += G8z.u3U;
if (!val) {
val = [];
}
if (!$[M4U](val)) {
throw d8z;
}
conf[c4U] = val;
var that = this;
var container = conf[V0z];
if (conf[H5N]) {
var Y4U = L0m;
Y4U += m5d;
Y4U += G8z.u3U;
var X4U = U0z;
X4U += v3z;
var rendered = container[V1c](X4U)[Y4U]();
if (val[U5N]) {
var g2U = z8U;
g2U += G8z.T3U;
g2U += c5U;
g2U += C9N;
var n2U = G8z.T3U;
n2U += V7z;
n2U += m8z;
n2U += L9N;
var list = $(J8z)[n2U](rendered);
$[g2U](val, function(i, file) {
var O8z = ' <button class="';
var D8z = '">×</button>';
var a8z = ' remove" data-idx="';
var H2U = I0N;
H2U += V0N;
H2U += Q7d;
H2U += W0N;
var S2U = e3N;
S2U += y8U;
var z2U = I0N;
z2U += Q7d;
z2U += W0N;
var s2U = g8U;
s2U += G8z.R3U;
G8z[s2U]();
list[G9d](z2U + conf[H5N](file, i) + O8z + that[S2U][S8d][H9d] + a8z + i + D8z + H2U);
});
} else {
var p2U = x1d;
p2U += h7d;
p2U += q8z;
var y2U = j8z;
y2U += H8U;
y2U += i2N;
var r2U = I0N;
r2U += z9N;
r2U += D9N;
r2U += q8z;
rendered[G9d](r2U + (conf[i3z] || y2U) + p2U);
}
}
Editor[x2U][Y3z][N8z](conf);
conf[Z2U][V1c](o3N)[C8z](c3z, [conf[J1z]]);
},
enable: function(conf) {
var L2U = t4N;
L2U += H9N;
var l2U = G8U;
l2U += b8U;
l2U += D9N;
l2U += Z8m;
conf[l2U][L2U](o3N)[O1z](b8m, z0N);
conf[d0z] = S0N;
},
disable: function(conf) {
var m2U = T4c;
m2U += P1c;
m2U += n7d;
m2U += a4N;
var d2U = D2z;
d2U += Z8m;
var f2U = t4N;
f2U += g8U;
f2U += q8U;
conf[V0z][f2U](d2U)[O1z](b8m, S0N);
conf[m2U] = z0N;
},
canReturnSubmit: function(conf, node) {
G8z[R2N]();
return z0N;
}
});
}());
if (DataTable[J2U][O2U]) {
var D2U = I8z;
D2U += z8d;
var a2U = z8U;
a2U += g4N;
a2U += m8U;
$[A7N](Editor[v7N], DataTable[a2U][D2U]);
}
DataTable[F8U][q2U] = Editor[v7N];
Editor[j2U] = {};
Editor[N2U][K8z] = Q2N;
Editor[C2U] = k8z;
return Editor;
}
})); | 34.922871 | 620 | 0.28839 |
1e68536de986480f16594bed8384848d95fb61f0 | 170 | js | JavaScript | arcgis_js_api/library/4.11/dojox/calendar/nls/it/buttons.js | mozenberger/data-management-tools | 214c61f5471e609a51f730074d2fe6ebcf404a80 | [
"Apache-2.0"
] | 2 | 2019-05-06T08:23:55.000Z | 2020-04-04T12:58:11.000Z | arcgis_js_api/library/4.11/dojox/calendar/nls/it/buttons.js | mozenberger/data-management-tools | 214c61f5471e609a51f730074d2fe6ebcf404a80 | [
"Apache-2.0"
] | 2 | 2021-03-10T14:05:34.000Z | 2021-05-11T10:03:46.000Z | arcgis_js_api/library/4.11/dojox/calendar/nls/it/buttons.js | mozenberger/data-management-tools | 214c61f5471e609a51f730074d2fe6ebcf404a80 | [
"Apache-2.0"
] | 3 | 2017-10-20T02:37:15.000Z | 2018-04-28T17:24:50.000Z | //>>built
define({previousButton:"\u25c4",nextButton:"\u25ba",todayButton:"Oggi",dayButton:"Giorno",weekButton:"Settimana",fourDaysButton:"4 Giorni",monthButton:"Mese"}); | 85 | 160 | 0.764706 |
1e686ad9aa32c41eb2e31bcda9a13565364e7d15 | 151 | js | JavaScript | tasks/register/buildProd.js | amitrke/courtres | c22d707c2d3bfbad4113ef6e069b0cfab86a440e | [
"Apache-2.0"
] | null | null | null | tasks/register/buildProd.js | amitrke/courtres | c22d707c2d3bfbad4113ef6e069b0cfab86a440e | [
"Apache-2.0"
] | 7 | 2016-03-25T13:58:54.000Z | 2016-04-17T03:35:13.000Z | tasks/register/buildProd.js | amitrke/courtres | c22d707c2d3bfbad4113ef6e069b0cfab86a440e | [
"Apache-2.0"
] | null | null | null | module.exports = function (grunt) {
grunt.registerTask('buildProd', [
'compileAssets',
'linkAssetsBuild',
'clean:build',
'copy:build'
]);
};
| 16.777778 | 35 | 0.655629 |
1e68bb31e98fdb22f20525bd73350caba46236dc | 1,322 | js | JavaScript | tests/gagarin/AutoformTests.js | clinical-meteor/clinical-autoform | 5c05112315e8993754d112e453212191991cdcf3 | [
"MIT"
] | null | null | null | tests/gagarin/AutoformTests.js | clinical-meteor/clinical-autoform | 5c05112315e8993754d112e453212191991cdcf3 | [
"MIT"
] | null | null | null | tests/gagarin/AutoformTests.js | clinical-meteor/clinical-autoform | 5c05112315e8993754d112e453212191991cdcf3 | [
"MIT"
] | null | null | null |
describe('clinical:autoform', function () {
var server = meteor();
var client = browser(server);
beforeEach(function () {
server.execute(function () {
}).then(function (value){
});
});
afterEach(function () {
server.execute(function () {
});
});
it('Autoform should exist on the client', function () {
return client.execute(function () {
expect(AutoForm).to.exist;
});
});
it('Autoform should NOT exist on the server', function () {
return server.execute(function () {
expect(typeof AutoForm).to.equal("undefined");
});
});
// it("Autoform can return the value of specific input.", function () {
// return client.execute(function () {
// Autoform.getInputValue();
// expect(false).to.be.true;
// });
// });
// it("Autoform can return all the values from the form.", function () {
// return client.execute(function () {
// Autoform.getInputValue();
// expect(false).to.be.true;
// });
// });
// it('Autoform.getInputValue()', function () {
// return client.execute(function () {
// expect(AutoForm).to.exist;
// });
// });
// it('Autoform.getFormValues()', function () {
// return client.execute(function () {
// expect(AutoForm).to.exist;
// });
// });
});
| 22.40678 | 74 | 0.566566 |
c85c5898b557c4d647113deadd9017188199321e | 1,076 | js | JavaScript | lib/dataAdapter/index.js | derekcaneja/directorjs | 8cd19e34863c0e90cc6836d050c2b56228f1fdf0 | [
"MIT"
] | 1 | 2019-07-27T00:42:02.000Z | 2019-07-27T00:42:02.000Z | lib/dataAdapter/index.js | derekcaneja/directorjs | 8cd19e34863c0e90cc6836d050c2b56228f1fdf0 | [
"MIT"
] | null | null | null | lib/dataAdapter/index.js | derekcaneja/directorjs | 8cd19e34863c0e90cc6836d050c2b56228f1fdf0 | [
"MIT"
] | null | null | null | var models = require('./models');
module.exports = DataAdapter;
function DataAdapter(options) {
this.options = options || {};
}
DataAdapter.prototype.request = function(req, api, callback) {
var _this = this;
var model = this.getModel(api);
var method = api.method.toLowerCase().replace('delete', 'del');
model[method](req, api, function(err, body) {
var res = {
statusCode: 200
};
if(err) {
res.statusCode = err;
_this.getErrForResponse(res);
}
callback(err, res, body);
});
};
DataAdapter.prototype.getModel = function(api) {
// var modelName = api.path.split('/')[1].slice(0, -1);
// modelName = modelName.substring(0, 1).toUpperCase() + modelName.substring(1);
return models['Post'];
}
// Convert 4xx, 5xx responses to be errors.
DataAdapter.prototype.getErrForResponse = function(res, options) {
var status = res.statusCode;
var err = new Error(status + " status");
err.status = status;
err.body = res.body;
return err;
}; | 23.391304 | 81 | 0.606877 |
c85cb6ddb3c36c4a15bd365797052ea0b55fbda4 | 1,509 | js | JavaScript | Components/mediawiki/wiki_data/extensions/ContentTranslation/modules/tools/mw.cx.tools.TemplateTool.js | benkoo/XLP_ServiceMesh | 8c4c285f2e2c7b842064f94e40d4461677809046 | [
"MIT"
] | null | null | null | Components/mediawiki/wiki_data/extensions/ContentTranslation/modules/tools/mw.cx.tools.TemplateTool.js | benkoo/XLP_ServiceMesh | 8c4c285f2e2c7b842064f94e40d4461677809046 | [
"MIT"
] | null | null | null | Components/mediawiki/wiki_data/extensions/ContentTranslation/modules/tools/mw.cx.tools.TemplateTool.js | benkoo/XLP_ServiceMesh | 8c4c285f2e2c7b842064f94e40d4461677809046 | [
"MIT"
] | 1 | 2021-03-21T06:15:20.000Z | 2021-03-21T06:15:20.000Z | /**
* Template tool
*
* @class
* @extends mw.cx.tools.TranslationTool
* @constructor
* @param {mw.cx.dm.TranslationUnit} model
* @param {Object} config
*/
mw.cx.tools.TemplateTool = function CXTemplateTool( model, config ) {
config.title = mw.msg( 'cx-tools-template-title' );
config.language = config.targetLanguage;
config.order = 70;
// Parent constructor
mw.cx.tools.TemplateTool.super.call( this, model, config );
this.templateActions = null;
};
/* Inheritance */
OO.inheritClass( mw.cx.tools.TemplateTool, mw.cx.tools.TranslationTool );
mw.cx.tools.TemplateTool.static.name = 'template';
/**
* @inheritDoc
*/
mw.cx.tools.TemplateTool.prototype.getActions = function () {
var adapt, keepOriginal, skip;
adapt = new OO.ui.MenuOptionWidget( {
data: 'adapt',
label: mw.msg( 'cx-template-action-adapt' )
} );
keepOriginal = new OO.ui.MenuOptionWidget( {
data: 'keep-original',
label: mw.msg( 'cx-template-action-keep-original' )
} );
skip = new OO.ui.MenuOptionWidget( {
data: 'skip',
label: mw.msg( 'cx-template-action-skip' )
} );
this.templateActions = new OO.ui.DropdownWidget( {
classes: [ 'card-template-actions-menu' ],
menu: {
items: [ adapt, keepOriginal, skip ]
}
} );
this.templateActions.getMenu().selectItemByData( 'adapt' );
return [ this.templateActions ];
};
mw.cx.tools.TemplateTool.prototype.getContent = function () {
return 'Template name';
};
/* Register */
mw.cx.tools.translationToolFactory.register( mw.cx.tools.TemplateTool );
| 25.576271 | 73 | 0.6945 |
c85d1a0c609efe70dea8a06fa24907d94406ffa9 | 1,413 | js | JavaScript | src/views/Couriers/Overview/Overview.js | ricardosbarbosa/SkipTheDishes | e35cff727df0cf5d928d2bbeab9c973629def4fb | [
"MIT"
] | null | null | null | src/views/Couriers/Overview/Overview.js | ricardosbarbosa/SkipTheDishes | e35cff727df0cf5d928d2bbeab9c973629def4fb | [
"MIT"
] | null | null | null | src/views/Couriers/Overview/Overview.js | ricardosbarbosa/SkipTheDishes | e35cff727df0cf5d928d2bbeab9c973629def4fb | [
"MIT"
] | null | null | null | import React, { Component } from 'react';
import { Badge, Button, Card, CardBody, CardHeader, Col, Container, Jumbotron, Row } from 'reactstrap';
class Overview extends Component {
render() {
return (
<div className="animated fadeIn">
<Row>
<Col>
<Card>
<CardHeader>
<i className="fa fa-align-justify"></i><strong>Overview</strong>
</CardHeader>
<CardBody>
<Jumbotron>
<h1 className="display-3">Hello, Couries!</h1>
<p className="lead">
<Badge className="mr-1" color="danger" pill>Skip the Dishes</Badge>
now bring to you a new awesome feature.
We are excited to announce the <Badge className="mr-1" color="primary" pill>Skip the Supermarket</Badge> <b>orders</b> just for you guys.
</p>
<hr className="my-2" />
<p>
You, guys, now have one more option of packages to delivery.
Now we reve the <b>suppliers</b> inside the Skip world.
We will match orders from them to be deliverd to restaurants.
</p>
</Jumbotron>
</CardBody>
</Card>
</Col>
</Row>
</div>
);
}
}
export default Overview;
| 34.463415 | 155 | 0.498231 |
c85d8d6b8a4280172fd5a95ec9889cb87be1bd9c | 7,787 | js | JavaScript | www/dashboard_iot/show_wtrl/app.js | dookda/ecc_mis | 8111d723086e480779b880441feba774743d5e0e | [
"MIT"
] | 1 | 2022-03-12T03:58:27.000Z | 2022-03-12T03:58:27.000Z | www/dashboard_iot/show_wtrl/app.js | dookda/ecc_mis | 8111d723086e480779b880441feba774743d5e0e | [
"MIT"
] | 2 | 2021-12-07T04:49:57.000Z | 2022-02-21T03:19:45.000Z | www/dashboard_iot/show_wtrl/app.js | dookda/ecc_mis | 8111d723086e480779b880441feba774743d5e0e | [
"MIT"
] | null | null | null | var map = L.map('map', {
center: [13.335017, 101.719808],
zoom: 7,
zoomControl: false
});
var osm = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
lyr: 'basemap'
});
var CartoDB_DarkMatter = L.tileLayer('https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors © <a href="https://carto.com/attributions">CARTO</a>',
subdomains: 'abcd',
maxZoom: 19,
lyr: 'basemap'
});
var CartoDB_Positron = L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors © <a href="https://carto.com/attributions">CARTO</a>',
subdomains: 'abcd',
maxZoom: 19,
lyr: 'basemap'
});
const grod = L.tileLayer('https://{s}.google.com/vt/lyrs=r&x={x}&y={y}&z={z}', {
maxZoom: 20,
subdomains: ['mt0', 'mt1', 'mt2', 'mt3'],
lyr: 'basemap'
});
const ghyb = L.tileLayer('https://{s}.google.com/vt/lyrs=y,m&x={x}&y={y}&z={z}', {
maxZoom: 20,
subdomains: ['mt0', 'mt1', 'mt2', 'mt3'],
lyr: 'basemap'
});
const tam = L.tileLayer.wms("https://rti2dss.com:8443/geoserver/th/wms?", {
layers: "th:tambon_4326",
format: "image/png",
transparent: true,
CQL_FILTER: 'pro_code=20 OR pro_code=21 OR pro_code=22 OR pro_code=23 OR pro_code=24 OR pro_code=25 OR pro_code=26 OR pro_code=27'
});
const amp = L.tileLayer.wms("https://rti2dss.com:8443/geoserver/th/wms?", {
layers: "th:amphoe_4326",
format: "image/png",
transparent: true,
CQL_FILTER: 'pro_code=20 OR pro_code=21 OR pro_code=22 OR pro_code=23 OR pro_code=24 OR pro_code=25 OR pro_code=26 OR pro_code=27'
});
const pro = L.tileLayer.wms("https://rti2dss.com:8443/geoserver/th/wms?", {
layers: "th:province_4326",
format: "image/png",
transparent: true,
CQL_FILTER: 'pro_code=20 OR pro_code=21 OR pro_code=22 OR pro_code=23 OR pro_code=24 OR pro_code=25 OR pro_code=26 OR pro_code=27'
});
let mk1 = L.marker([12.8661616, 100.9989804]).bindPopup('อบต.ห้วยใหญ่3'),
mk2 = L.marker([12.848099999999983, 100.95313000000002]).bindPopup('อบต.ห้วยใหญ่2'),
mk3 = L.marker([12.846510200000028, 100.9376361]).bindPopup('อบต.ห้วยใหญ่1'),
mk4 = L.marker([12.694406999999996, 101.44470699999997]).bindPopup('อบต.สำนักทอง1'),
mk5 = L.marker([12.703484000000008, 101.468717]).bindPopup('อบต.สำนักทอง2'),
mk6 = L.marker([12.70139960000001, 101.49543049999]).bindPopup('อบต.กะเฉด3'),
mk7 = L.marker([12.985111299999994, 101.6776677]).bindPopup('อบต.เขาชะเมา1'),
mk8 = L.marker([12.909515899999995, 101.71460159999998]).bindPopup('อบต.น้ำเป็น2'),
mk9 = L.marker([12.836749900000017, 101.73254899999998]).bindPopup('อบต.น้ำเป็น3');
var sensor = L.layerGroup([mk1, mk2, mk3, mk4, mk5, mk6, mk7, mk8, mk9]);
var baseMap = {
"แผนที่ OSM": osm,
"แผนที่ CartoDB": CartoDB_Positron,
"แผนที่ถนน": grod,
"แผนที่ภาพถ่าย": ghyb.addTo(map)
}
var overlayMap = {
"ขอบเขตตำบล": tam.addTo(map),
"ขอบเขตอำเภอ": amp.addTo(map),
"ขอบเขตจังหวัด": pro.addTo(map),
"ตำแหน่ง sensor": sensor.addTo(map)
}
L.control.layers(baseMap, overlayMap).addTo(map)
// L.control.zoom({ position: 'bottomright' }).addTo(map);
let onLocationFound = () => { };
map.on("locationfound", onLocationFound);
// map.on("locationerror", onLocationError);
// map.locate({ setView: true, maxZoom: 19 });
var lc = L.control.locate({
position: 'topleft',
strings: {
title: ""
},
locateOptions: {
enableHighAccuracy: true,
}
}).addTo(map);
lc.start();
var chart;
let showChart = async (station, param, unit, dat) => {
Highcharts.chart(param, {
chart: {
type: 'spline',
animation: Highcharts.svg,
// marginRight: 100,
events: {
load: function () {
var series = this.series[0];
setInterval(async () => {
await axios.post("https://eec-onep.soc.cmu.ac.th/api/wtrl-api.php", { station: station, param: param, limit: 1 }).then((r) => {
console.log(r);
let x = (new Date()).getTime();
let y = Number(r.data.data[0].val);
return series.addPoint([x, y], true, true);
})
}, 10000);
}
},
zoomType: 'x'
},
time: {
useUTC: false
},
title: false,
accessibility: {
announceNewData: {
enabled: true,
minAnnounceInterval: 15000,
announcementFormatter: function (allSeries, newSeries, newPoint) {
if (newPoint) {
return 'New point added. Value: ' + newPoint.y;
}
return false;
}
}
},
xAxis: {
type: 'datetime',
tickPixelInterval: 120,
minorTickInterval: 'auto',
startOnTick: false,
endOnTick: false
},
yAxis: {
title: {
text: unit
},
// min: -5,
// max: 5,
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}],
tickInterval: 1
},
tooltip: {
headerFormat: '<b>{series.name}</b><br/>',
// pointFormat: '{point.x:%Y-%m-%d %H:%M:%S}<br/>{point.y:.2f} cm'
pointFormat: 'เวลา {point.x:%H:%M:%S} น.<br/>{point.y:.2f} cm'
},
legend: {
enabled: false
},
exporting: {
enabled: false
},
plotOptions: {
series: {
marker: {
enabled: false
}
}
},
series: [{
name: param,
data: dat
}]
})
}
$("#station").on("change", async function () {
let station = this.value;
let deep = "deep";
let humidity = "humidity";
let temperature = "temperature";
await axios.post("https://eec-onep.soc.cmu.ac.th/api/wtrl-api.php", { station: station, param: deep, limit: 15 }).then(async (r) => {
console.log(r);
let data = [];
let time = (new Date()).getTime();
r.data.data.map((i, k) => {
data.push({
x: time + k * 500,
y: Number(i.val)
});
})
showChart(station, deep, "cm", data)
})
await axios.post("https://eec-onep.soc.cmu.ac.th/api/wtrl-api.php", { station: station, param: humidity, limit: 15 }).then(async (r) => {
console.log(r);
let data = [];
let time = (new Date()).getTime();
r.data.data.map((i, k) => {
data.push({
x: time + k * 500,
y: Number(i.val)
});
})
showChart(station, humidity, "%", data)
})
await axios.post("https://eec-onep.soc.cmu.ac.th/api/wtrl-api.php", { station: station, param: temperature, limit: 15 }).then((r) => {
console.log(r);
let data = [];
let time = (new Date()).getTime();
r.data.data.map((i, k) => {
data.push({
x: time + k * 500,
y: Number(i.val)
});
})
showChart(station, temperature, "°C", data)
})
})
| 31.783673 | 165 | 0.526904 |
c85e52b7c19eb67db0e06a4f34a904ab284009ab | 435 | js | JavaScript | src/checks/Number/notBetween.js | sourcegr/inputValidator | a1aac8b5ac97c03ad3f2bd53adfdf1094785ebc5 | [
"MIT"
] | null | null | null | src/checks/Number/notBetween.js | sourcegr/inputValidator | a1aac8b5ac97c03ad3f2bd53adfdf1094785ebc5 | [
"MIT"
] | 3 | 2020-05-27T06:52:05.000Z | 2020-05-27T09:38:13.000Z | src/checks/Number/notBetween.js | sourcegr/inputValidator | a1aac8b5ac97c03ad3f2bd53adfdf1094785ebc5 | [
"MIT"
] | null | null | null | const between = require('./between');
/**
* notBetween checks if the number is NOT between two values
*
* @param {*} input - the input (will be casted to Number)
* @param {[number, number, ?boolean]} params - An array with the [min, max, include_limits=true] values
*
* @return {boolean} true if the number is NOT between the limits
*
*/
module.exports = function notBetween (input, params) {
return !between(input, params);
} | 33.461538 | 104 | 0.691954 |
c85e81b4ff6caeac8d62b7cb928a7401cc479fe4 | 699 | js | JavaScript | front/src/utils/saveUser.js | jjwphysics/zegolife | 4793c353d7b7c38b261c03148dd40aa63595a16f | [
"MIT"
] | 2 | 2021-04-16T02:56:19.000Z | 2021-08-08T07:55:09.000Z | front/src/utils/saveUser.js | jjwphysics/zegolife | 4793c353d7b7c38b261c03148dd40aa63595a16f | [
"MIT"
] | 1 | 2021-07-31T01:18:42.000Z | 2021-07-31T01:18:42.000Z | front/src/utils/saveUser.js | jjwphysics/zegolife | 4793c353d7b7c38b261c03148dd40aa63595a16f | [
"MIT"
] | 1 | 2021-09-04T00:59:32.000Z | 2021-09-04T00:59:32.000Z | export default function saveUser(user) {
localStorage.setItem("me.enter_year", user.EnterYear)
localStorage.setItem("me.name", user.Name)
localStorage.setItem("me.id", user.ID)
localStorage.setItem("me.barcode", user.Barcode)
localStorage.setItem("me.grade", user.Grade)
localStorage.setItem("me.class", user.Class)
localStorage.setItem("me.number", user.Number)
localStorage.setItem("me.year", user.BirthYear)
localStorage.setItem("me.month", user.BirthMonth)
localStorage.setItem("me.day", user.BirthDay)
localStorage.setItem("me.sex", user.Sex)
localStorage.setItem("me.roles", user.Roles)
localStorage.setItem("me.residence", user.Residence)
} | 46.6 | 57 | 0.726753 |
c85e9c7735e6ef1414cb231677095018942ea6c7 | 576 | js | JavaScript | app/assets/javascripts/routes/edits_route.js | nashley/hummingbird | e76a5ec2b2a022c8f8c563c6183fe60effc169b4 | [
"Apache-2.0"
] | 1 | 2015-04-13T20:42:28.000Z | 2015-04-13T20:42:28.000Z | app/assets/javascripts/routes/edits_route.js | nashley/hummingbird | e76a5ec2b2a022c8f8c563c6183fe60effc169b4 | [
"Apache-2.0"
] | null | null | null | app/assets/javascripts/routes/edits_route.js | nashley/hummingbird | e76a5ec2b2a022c8f8c563c6183fe60effc169b4 | [
"Apache-2.0"
] | null | null | null | HB.EditsRoute = Ember.Route.extend(HB.Paginated, {
preloadKey: "versions",
preloadPath: "versions",
preloadObject: "version",
fetchPage: function(page) {
return this.store.find('version', {
state: 'pending',
page: page
});
},
afterModel: function(resolvedModel) {
HB.TitleManager.setTitle('Pending Edits');
},
setupController: function(controller, model) {
this.setCanLoadMore(true);
controller.set('model', model);
if (model.get('length') === 0) {
this.set('cursor', null);
this.loadNextPage();
}
}
})
| 22.153846 | 50 | 0.626736 |
c85f31334e9929584498ec6a88968b9df04d4040 | 5,509 | js | JavaScript | public_static/scripts/C2WebSock.js | carsakiller/Carsas-Companion | 651b269a9125a9df6ac210e776d676e6d116b15d | [
"MIT"
] | null | null | null | public_static/scripts/C2WebSock.js | carsakiller/Carsas-Companion | 651b269a9125a9df6ac210e776d676e6d116b15d | [
"MIT"
] | 4 | 2022-03-17T01:03:06.000Z | 2022-03-23T10:15:07.000Z | public_static/scripts/C2WebSock.js | carsakiller/Carsas-Companion | 651b269a9125a9df6ac210e776d676e6d116b15d | [
"MIT"
] | null | null | null | /*
Messages from client to server:
{
clientId: 1,
token: 'xyz',
data: "doSomething"
}
Response from server:
{
clientId: 1,
success: true,
data: "Result String"
}
OR
{
clientId: 1,
success: false,
data: "Error: invalid user input"
}
Messages from server to client:
{
serverId: 1,
data: "gather this data"
}
Response from client:
{
serverId: 1,
token: 'xyz',
success: true,
data: "the data you wanted"
}
OR
{
serverId: 1,
token: 'xyz',
success: false,
data: "Error: can't find the data"
}
*/
class C2WebSock extends C2EventManagerAndLoggingUtility {
/* events:
open
close
error
message (only the first registered callback can respond to the message!)
Responding to a server message:
webSock.on('message', (data)=>{
return new Promise((resolve, reject)=>{
//do Something
resolve('result')
})
})
The promise is optional. If you don't return a promise, the server will be sent a sucess response once callback() finished execution
*/
constructor(loglevel, url){
super(loglevel)
this.log('new WebSock', url)
this.url = url
this.token = undefined
this.listeners = {}
this.messageIdCounter = 0
this.pendingMessages = []
this.PENDIMG_MESSAGES_TIMEOUT = 1000 * 20
setInterval(()=>{
// check if pendingMessages run into a timeout
for(let pm of this.pendingMessages){
if(pm && new Date().getTime() - pm.timeSent > this.PENDIMG_MESSAGES_TIMEOUT){
pm.reject('timed out')
}
}
}, 500)
this.preventReconnect = false
this.createWebSocket()
}
createWebSocket(){
this.websocket = new WebSocket(this.url)
this.websocket.onopen = (evt)=>this.handleWebsocketOpen(evt)
this.websocket.onmessage = (evt)=>this.handleWebsocketMessage(evt)
this.websocket.onclose = (evt)=>this.handleWebsocketClose(evt)
this.websocket.onerror = (evt)=>this.handleWebsocketError(evt)
}
handleWebsocketOpen(evt){
this.dispatch('open', evt)
}
handleWebsocketMessage(evt){
if(evt.data === '*RELOAD_PAGE*'){
if(window.NO_MAGIC_PAGE_RELOAD){
return//ignore
}
this.preventReconnect = true
this.websocket.close()
setTimeout(()=>{// give the server some time to finish building resources (e.g. compass)
document.location.reload()
}, 1000)
return
}
if(evt.data === '*FORCE_RELOAD*'){
this.preventReconnect = true
this.websocket.close()
setTimeout(()=>{
document.location.reload()
}, 100)
return
}
try{
let parsed = JSON.parse(evt.data)
if(typeof parsed.clientId === 'number'){
this.info('received response to client message', parsed.clientId)
this.log(parsed.data)
for(let i in this.pendingMessages){
let pm = this.pendingMessages[i]
if(pm && pm.id === parsed.clientId){
if(parsed.success === true){
pm.resolve(parsed.data)
} else {
pm.reject(parsed.data)
}
this.pendingMessages.splice(i, 1)
return
}
}
//not found
this.error('did not find message with id', parsed.clientId, 'in pendingMessages!')
} else if (typeof parsed.serverId === 'number'){
let that = this
let promise
try {
let parsedInternalData = JSON.parse(parsed.data)
if(parsedInternalData.type === 'heartbeat' || parsedInternalData.type === 'stream-map'){
this.debug('received new message from the server', parsed.serverId)
} else {
this.info('received new message from the server', parsed.serverId)
}
promise = this.dispatch('message', parsedInternalData)
} catch (ex){
this.info('received new message from the server', parsed.serverId)
answer(false, ex.toString())
return
}
if(promise instanceof Promise){
promise.then((result)=>{
answer(true, result)
}).catch((err)=>{
this.error('Error in message callback promise:', err)
answer(false, 'Error: check browser logs')
})
} else {
answer(true, undefined)
}
function answer(success, data){
that.websocket.send(JSON.stringify({
serverId: parsed.serverId,
token: that.token,
success: success,
data: JSON.stringify(data)
}))
}
} else {
return this.error('server message did not contain an id')
}
} catch (ex){
this.error('Error parsing websocket message', ex)
}
}
handleWebsocketClose(evt){
this.dispatch('close', evt)
this.on('open', ()=>{
this.websocket.send('*RELOAD_PAGE?*')
})
if(! this.preventReconnect){
this.createWebSocket()
}
}
handleWebsocketError(evt){
this.error(evt)
this.dispatch('error', evt)
}
/* promise will be resolveed when the server returns success=true, and rejected if server returns success=false or the pending message runs into connection close */
send(data){
return new Promise((resolve, reject)=>{
if(this.isOpen() === false){
return reject('#websocket-not-open')//do not change this string!
}
const myMessageId = this.messageIdCounter++
this.info('sending message to server', myMessageId)
this.log(data)
this.pendingMessages.push({
id: myMessageId,
timeSent: new Date().getTime,
resolve: resolve,
reject: reject
})
this.debug('token', this.token)
this.websocket.send(JSON.stringify({
clientId: myMessageId,
token: this.token,
data: JSON.stringify(data)
}))
})
}
close(){
this.websocket.close()
}
isOpen(){
return this.websocket.readyState === 1
}
close(){
this.websocket.close()
}
} | 20.946768 | 165 | 0.649664 |
c85f9b125bf9679381bd67a9acb22b8bed9597cb | 2,425 | js | JavaScript | packages/app/src/components/live-editor.js | saraos-tech/cards | f0889ecd79ef5b416ecbef0e1a2059fefb661cf6 | [
"MIT"
] | 1 | 2021-09-29T11:43:00.000Z | 2021-09-29T11:43:00.000Z | packages/app/src/components/live-editor.js | zenorocha/cards | 34d283f2ea8cb7bf99c3c0aba1896fcd5bc0327b | [
"MIT"
] | null | null | null | packages/app/src/components/live-editor.js | zenorocha/cards | 34d283f2ea8cb7bf99c3c0aba1896fcd5bc0327b | [
"MIT"
] | null | null | null | import Monaco from '@monaco-editor/react'
import styled from 'styled-components'
import { Text } from 'theme-ui'
import {
LiveProvider as BaseProvider,
LiveError as BaseError,
LivePreview as BasePreview
} from 'react-live'
import { editorThemes } from '@/context/theme-context'
import { debounce, isDev } from '@/lib'
import { theme } from '@/theme'
import * as scope from './presets/scope'
const LivePreviewWrapper = styled('div')`
height: 100%;
width: 100%;
margin: auto;
overflow: hidden;
user-select: none;
position: relative;
> * {
pointer-events: ${!isDev ? 'none' : 'initial'};
}
${({ isEditor }) =>
isEditor &&
`
box-shadow: rgba(0, 0, 0, 0.12) 0px 5px 10px 0px;
cursor: pointer;`}
`
LivePreviewWrapper.defaultProps = {
id: 'screenshot'
}
export const LiveError = styled(BaseError)`
background: #ff5555;
color: #f8f8f2;
font-family: ${theme.fonts.mono};
font-size: ${theme.fontSizes[2]};
margin: 0;
padding: ${theme.space[3]};
text-align: left;
white-space: pre-wrap;
`
export const LivePreview = styled(BasePreview)`
> div {
height: inherit;
width: inherit;
}
`
LivePreview.defaultProps = {
Component: LivePreviewWrapper
}
const LiveProviderBase = styled(BaseProvider)``
LiveProviderBase.defaultProps = {
scope,
theme: undefined,
noInline: false
}
export const LiveProvider = ({ queryVariables: query, ...props }) => {
const extendedScope = { ...scope, query }
return <LiveProviderBase {...props} scope={extendedScope} />
}
const LiveEditorBase = styled(Monaco)``
const Loading = () => (
<Text sx={{ fontFamily: 'mono', color: theme.color }}>Loading...</Text>
)
export const LiveEditor = ({ code, onChange, themeKey, theme }) => {
return (
<LiveEditorBase
value={code}
language='javascript'
theme={themeKey}
beforeMount={monaco => {
Object.keys(editorThemes).forEach(key => {
const value = editorThemes[key]
monaco.editor.defineTheme(key, value)
})
}}
onChange={debounce(onChange)}
loading={<Loading theme={theme} />}
options={{
fontSize: 14,
scrollBeyondLastLine: false,
wordWrapColumn: 'on',
hideCursorInOverviewRuler: true,
minimap: {
enabled: false
},
lineNumbersMinChars: 0,
scrollbar: {
useShadows: false
}
}}
/>
)
}
| 22.045455 | 73 | 0.628454 |
c8605766f84271be19f1b25eabef34e80f576796 | 45,916 | js | JavaScript | js/sm_widgets.js | shaduk/shaduk.github.io | d3a7c0ec3a607548044b00a16bc609bb50d8a5dc | [
"Apache-2.0"
] | null | null | null | js/sm_widgets.js | shaduk/shaduk.github.io | d3a7c0ec3a607548044b00a16bc609bb50d8a5dc | [
"Apache-2.0"
] | null | null | null | js/sm_widgets.js | shaduk/shaduk.github.io | d3a7c0ec3a607548044b00a16bc609bb50d8a5dc | [
"Apache-2.0"
] | null | null | null | /*
* Stock Market Widgets
* Version 1.0.6 | 30-September-2015
* Copyright WebTheGap.com
*
* CHANGELOG
* ---------
*
* 1.0.6 - 30 Sep 2015
* -------------------
* - Bug fix: news for stock indexes (^GSPC etc) don't work
*
* 1.0.5 - 08 July 2015
* --------------------
* - Feature: It's now possible to retrieve some extended stock data from Key Statistics page on Yahoo Finance.
* - Technical improvement: Code optimization.
*
* 1.0.4 - 25 June 2015
* --------------------
* - Bug fix: multiple charts for the same ticker, but different time periods are not displayed.
* - Feature: data-count option is added to the news widget to limit the total number of news displayed.
* - Feature: spinning loader effect is added (to be displayed while data is being loaded).
* - Technical improvement: Plugin code is wrapped in an anonymous function for better compatibility.
*
*/
(function($) {
$(document).ready(buildWidgets);
var yqlBaseUri = 'https://query.yahooapis.com/v1/public/yql?q={0}&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys';
var yqlQuery = 'select * from {0} where {1}';
var yqlNewsHeadlineUrl = 'http://finance.yahoo.com/rss/industry?s=';
var yqlKeyStatsUrl = 'http://finance.yahoo.com/q/ks?s={0}+Key+Statistics';
var yqlMapTableToKeyPropertyName = {'yahoo.finance.quotes':'Symbol', 'yahoo.finance.xchange':'id', 'feed':'pubDate'};
var yqlMapTableToWidgetType = {'yahoo.finance.quotes':'quote', 'yahoo.finance.xchange':'currency', 'feed':'news', 'html':'stats'};
var yChartSizeMap = {'small':'s', 'medium':'m', 'large':'l'};
var yChartTypeMap = {'line':'l', 'bar':'b', 'candle':'c'};
var DEBUG = false;
// making yqlRunQuery() available in the global scope
window.smYqlRunQuery = yqlRunQuery;
window.build = buildWidgets;
setInterval(buildWidgets, 5000);
function buildWidgets() {
var quoteSymbols = [];
var statsSymbols = [];
var currencyPairs = [];
var staticChartSymbols = [];
var newsSymbols = [];
// Sort tables columns
$('.sm-sortable-table').tablesort();
$('.sm-sortable-table thead th.integer').data('sortBy', function(th, td, tablesort) {
return parseInt(td.text(), 16);
});
$('.sm-sortable-table thead th.float').data('sortBy', function(th, td, tablesort) {
return parseFloat(td.text());
});
// load marquee plugin for stock ticker
var marquee = $('.sm-marquee').marquee();
marquee.mouseover(function () {
$(this).trigger('stop');
}).mouseout(function () {
$(this).trigger('start');
}).mousemove(function (event) {
if ($(this).data('drag') == true) {
this.scrollLeft = $(this).data('scrollX') + ($(this).data('x') - event.clientX);
}
}).mousedown(function (event) {
$(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft);
}).mouseup(function () {
$(this).data('drag', false);
});
$('.sm-widget').each(function(i, widget) {
var jWidget = $(widget);
var symbol = jWidget.data('symbol');
var widgetType = jWidget.data('type');
// add class, so it can be referred to later when data is retrieved from Yahoo Finance
jWidget.addClass('sm-widget-'+widgetType+'-'+symbol);
// if transtion effect is specified, set initial state to hidden
initTransitionEffect(widget);
// Add spinning loader
loaderEnable(widget);
// if symbol is empty continue to next one
if (symbol=='') return true;
// populate stock symbols, currency pair arrays
if (widgetType=='quote' && quoteSymbols.indexOf(symbol) < 0) {
quoteSymbols.push(symbol);
} else if (widgetType=='stats' && statsSymbols.indexOf(symbol) < 0) {
statsSymbols.push(symbol);
} else if (widgetType=='currency' && currencyPairs.indexOf(symbol) < 0) {
currencyPairs.push(symbol);
} else if (widgetType=='staticChart' && staticChartSymbols.indexOf(symbol) < 0) {
staticChartSymbols.push(symbol);
} else if (widgetType=='news' && newsSymbols.indexOf(symbol) < 0) {
newsSymbols.push(symbol);
}
});
if (quoteSymbols.length) {
log('Getting quotes for tickers: '+quoteSymbols.join(','));
yqlRunQuery('yahoo.finance.quotes', 'symbol IN '+formatSqlIn(quoteSymbols), null);
}
if (statsSymbols.length>0) {
log('Getting key stats for tickers: '+statsSymbols.join(','));
$.each(statsSymbols, function(k, statsSymbol) {
yqlRunQuery('html', 'url = "'+String.format(yqlKeyStatsUrl, statsSymbol)+'" AND xpath=\'//table/tbody/tr/td[contains(@class,"yfnc_tablehead1") or contains(@class,"yfnc_tabledata1")]\'', statsSymbol);
});
}
if (currencyPairs.length>0) {
log('Getting exchange rates: '+currencyPairs.join(','));
yqlRunQuery('yahoo.finance.xchange', 'pair IN '+formatSqlIn(currencyPairs), null);
}
if (staticChartSymbols.length>0) {
log('Getting static charts: '+staticChartSymbols.join(','));
displayStaticCharts(staticChartSymbols);
}
if (newsSymbols.length>0) {
log('Getting news: '+newsSymbols.join(','));
yqlRunQuery('feed', 'url = "'+yqlNewsHeadlineUrl+newsSymbols[0].replace('^','%5E')+'"', newsSymbols[0]);
}
}
/**
* Fromat string for SQL IN clause
* @param array
* @returns string
*/
function formatSqlIn(array) {
return '("'+array.join('","')+'")';
}
function arrayMapString(s, array) {
$.each(array, function(i, value) {
array[i] = String.format(s, value);
});
return array;
}
function displayStaticCharts(symbols) {
var widgetType = 'staticChart';
var widget = '';
var chartSize = '';
var chartType = '';
var chartTimeFrame = '';
var chartLogScale = '';
var chartUrl = '';
var unescapedSymbol = '';
$.each(symbols, function(i, symbol) {
unescapedSymbol = symbol;
symbol = symbol.replace(/(:|\^|\.|\[|\]|,)/g, "\\$1");
widget = '.sm-widget-'+widgetType+'-'+symbol;
// there can be several charts for one ticker, so looping through them all
$(widget).each(function() {
chartSize = $(this).data('size') ? yChartSizeMap[$(this).data('size')] : 'm';
chartType = $(this).data('chart-type') ? yChartTypeMap[$(this).data('chart-type')] : 'l';
chartTimeFrame = $(this).data('timeframe') ? $(this).data('timeframe') : '3m';
chartLogScale = $(this).data('logscale')=='on' ? 'on' : 'off';
chartUrl = 'http://chart.finance.yahoo.com/z?s='+unescapedSymbol+'&t='+chartTimeFrame+'&q='+chartType+'&z='+chartSize+'&l='+chartLogScale;
log(widget, chartUrl);
$(this).append('<img class="sm-static-chart-img" src="'+chartUrl+'">');
});
// for each image set onLoad event, so transition effect can be applied when the image is loaded
$(widget).find('.sm-static-chart-img').one('load', function() {
// important: $(widget) doesn't work here
loaderDisable('.sm-widget-'+widgetType+'-'+symbol);
applyTransitionEffect('.sm-widget-'+widgetType+'-'+symbol);
});
});
}
function loaderEnable(selector) {
if ($(selector).data('loader') && $(selector).find('.sm-loader').length == 0) {
$(selector).prepend('<div class="active sm-loader"></div>');
}
}
function loaderDisable(selector) {
$(selector).find('.sm-loader').removeClass('active');
}
function initTransitionEffect(selector) {
if ($(selector).data('transition')) {
$(selector).addClass('transition hidden');
}
}
function applyTransitionEffect(selector) {
// apply transition effects
if ($(selector).data('transition')) {
$(selector).transition({animation: $(selector).data('transition'), duration: '1s'});
}
}
/**
* Transform an indexed array of objects into key indexed object of objects
* @param objectKeyName
* @param arrayOfObjects
* @returns object of objects
*/
function indexedArrayToKeyedObject(objectKeyName, arrayOfObjects) {
var result = {};
// if only one object is received then transform it into array first
if (!$.isArray(arrayOfObjects)) {
arrayOfObjects = [arrayOfObjects];
}
$.each(arrayOfObjects, function(i, object) {
result[object[objectKeyName]] = object;
});
return result;
}
function displayWidgetData(widgetType, dataObjects) {
$.each(dataObjects, function(key, dataObject) {
var propertyName = '';
var propertyCallback = '';
var propertyValue = '';
var callbackFunction = '';
key = key.replace(/(:|\^|\.|\[|\]|,)/g, "\\$1");
// for each tag of sm-data-property class set it to value from retrieved object
$('.sm-widget-'+widgetType+'-'+key+' .sm-data-property').each(function(i, dataField) {
propertyName = $(dataField).data('property') ? $(dataField).data('property') : '';
propertyCallback = $(dataField).data('callback') ? $(dataField).data('callback') : '';
if (propertyName) {
if (dataObject[propertyName] !== null) {
// if callback function is specified then apply it first (for example to transform string to number etc)
if (propertyCallback) {
callbackFunction = window[propertyCallback];
propertyValue = callbackFunction(dataObject[propertyName]);
} else {
propertyValue = dataObject[propertyName];
}
} else {
propertyValue = 'N/A';
}
$(dataField).text(propertyValue);
}
});
var widgetSelector = '.sm-widget-'+widgetType+'-'+key;
// add up/down arrows depending on change in price
if (widgetType=='quote' && typeof dataObject.Change !== 'undefined') {
var arrowClass = '';
if (parseFloat(dataObject.Change)>0) {
arrowClass = 'up green'
} else if (parseFloat(dataObject.Change)<0) {
arrowClass = 'down red';
}
$('.sm-widget-'+widgetType+'-'+key).find('.arrow, .caret').addClass(arrowClass);
}
$('.sm-widget-'+widgetType+'-'+key).each(function(i, widget) {
// disable spinning loader
loaderDisable(widgetSelector);
// apply transition effects
// ToDo: to be optimized using function calls applyTransitionEffect
if ($(widget).data('transition')) {
$(widget).transition({animation: $(widget).data('transition'), duration: '1s'});
}
});
});
}
function displayNews(widgetType, dataObjects) {
var jNewsWidget = $('.sm-widget-news');
var maxNumberOfNews = parseInt(jNewsWidget.data('count'))>0 ? parseInt(jNewsWidget.data('count')) : null;
var i=1;
$.each(dataObjects, function(key, dataObject) {
key = key.replace(/(:|\^|\.|\[|\]|,)/g, "\\$1");
// show only news with description
if (typeof dataObject.description !== 'undefined'/* && dataObject.description != null*/) {
jNewsWidget.append('<h4>'+dataObject.title+'</h4>');
jNewsWidget.append('<div class="sm-news-date">'+dataObject.pubDate+'</div>');
jNewsWidget.append('<div class="sm-news-desc">'+(dataObject.description==null?'':dataObject.description)+'</div>');
jNewsWidget.append('<div class="sm-news-link"><a href="'+dataObject.link+'" target="_blank">Read more</a></div>');
if (maxNumberOfNews !== null && maxNumberOfNews<=i) {
return false;
} else {
i++;
}
}
});
loaderDisable('.sm-widget-news');
}
function htmlContentToKeyedObject(id, htmlContentArray) {
var result = {};
result[id] = {};
$.each(htmlContentArray, function(i, obj) {
if (i==0 || i % 2 == 0 && typeof htmlContentArray[i+1] !== 'undefined') {
// removing anything within brackets and traling ":"
// Important: this results in overriding some of the values, for example Avg Vol (3 month) and Avg Vol (10 day)
result[id][obj.content.replace(/\s*\(.+\)/g, '').slice(0,-1)] = htmlContentArray[i+1].content;
}
});
return result;
}
function yqlRunQuery(yqlTable, yqlConditions, contextId) {
var yqlUrl = String.format(yqlBaseUri, encodeURIComponent(String.format(yqlQuery, yqlTable, yqlConditions)));
// making *async* AJAX call, passing yqlTable as a context
$.ajax({
url: yqlUrl,
dataType: 'json',
async: true,
context: {yqlTable: yqlTable, contextId: contextId},
success: yqlQuerySuccess,
error: yqlQueryError
});
}
function yqlQuerySuccess(data, textStatus, jqXHR) {
// getting yqlTable from the context
var yqlTable = this.yqlTable;
var contextId = this.contextId;
var result = null;
var dataOjects = null;
//log(yqlTable+'('+contextId+')',data);
if (typeof data.query.results !== 'undefined' && data.query.count > 0) {
// get the first child of data.query.results
result = data.query.results[Object.keys(data.query.results)[0]];
// display data
if (yqlTable=='feed') {
// transform data into an object indexed by key attribute
dataOjects = indexedArrayToKeyedObject(yqlMapTableToKeyPropertyName[yqlTable], result);
displayNews(yqlMapTableToWidgetType[yqlTable], dataOjects);
} else if (yqlTable=='yahoo.finance.quotes' || yqlTable=='yahoo.finance.xchange') {
// transform data into an object indexed by key attribute
dataOjects = indexedArrayToKeyedObject(yqlMapTableToKeyPropertyName[yqlTable], result);
displayWidgetData(yqlMapTableToWidgetType[yqlTable], dataOjects);
} else if (yqlTable=='html') {
// transform data into an object indexed by key attribute
dataOjects = htmlContentToKeyedObject(contextId, result);
displayWidgetData(yqlMapTableToWidgetType[yqlTable], dataOjects);
}
log(yqlTable, dataOjects);
} else {
log('smYqlQuerySuccess, no data for '+yqlTable, data);
}
}
function yqlQueryError(jqXHR, textStatus, errorThrown) {
log('smYqlQueryError', textStatus+'|'+errorThrown);
}
/**
* Log message to console
* @param msg
*/
function log(msg, obj) {
if (DEBUG) {
if (typeof obj !== 'undefined') {
console.log(msg, obj);
} else {
console.log(msg);
}
}
}
/**
* String format function
* http://stackoverflow.com/questions/610406/javascript-equivalent-to-printf-string-format
*/
if (!String.format) {
String.format = function(format) {
var args = Array.prototype.slice.call(arguments, 1);
return format.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match
;
});
};
}
})(jQuery);
/**
* Marquee plugin
* https://remysharp.com/2008/09/10/the-silky-smooth-marquee
*/
(function ($) {
$.fn.marquee = function (klass) {
var newMarquee = [],
last = this.length;
// works out the left or right hand reset position, based on scroll
// behavior, current direction and new direction
function getReset(newDir, marqueeRedux, marqueeState) {
var behavior = marqueeState.behavior, width = marqueeState.width, dir = marqueeState.dir;
var r = 0;
if (behavior == 'alternate') {
r = newDir == 1 ? marqueeRedux[marqueeState.widthAxis] - (width*2) : width;
} else if (behavior == 'slide') {
if (newDir == -1) {
r = dir == -1 ? marqueeRedux[marqueeState.widthAxis] : width;
} else {
r = dir == -1 ? marqueeRedux[marqueeState.widthAxis] - (width*2) : 0;
}
} else {
r = newDir == -1 ? marqueeRedux[marqueeState.widthAxis] : 0;
}
return r;
}
// single "thread" animation
function animateMarquee() {
var i = newMarquee.length,
marqueeRedux = null,
$marqueeRedux = null,
marqueeState = {},
newMarqueeList = [],
hitedge = false;
while (i--) {
marqueeRedux = newMarquee[i];
$marqueeRedux = $(marqueeRedux);
marqueeState = $marqueeRedux.data('marqueeState');
if ($marqueeRedux.data('paused') !== true) {
// TODO read scrollamount, dir, behavior, loops and last from data
marqueeRedux[marqueeState.axis] += (marqueeState.scrollamount * marqueeState.dir);
// only true if it's hit the end
hitedge = marqueeState.dir == -1 ? marqueeRedux[marqueeState.axis] <= getReset(marqueeState.dir * -1, marqueeRedux, marqueeState) : marqueeRedux[marqueeState.axis] >= getReset(marqueeState.dir * -1, marqueeRedux, marqueeState);
if ((marqueeState.behavior == 'scroll' && marqueeState.last == marqueeRedux[marqueeState.axis]) || (marqueeState.behavior == 'alternate' && hitedge && marqueeState.last != -1) || (marqueeState.behavior == 'slide' && hitedge && marqueeState.last != -1)) {
if (marqueeState.behavior == 'alternate') {
marqueeState.dir *= -1; // flip
}
marqueeState.last = -1;
$marqueeRedux.trigger('stop');
marqueeState.loops--;
if (marqueeState.loops === 0) {
if (marqueeState.behavior != 'slide') {
marqueeRedux[marqueeState.axis] = getReset(marqueeState.dir, marqueeRedux, marqueeState);
} else {
// corrects the position
marqueeRedux[marqueeState.axis] = getReset(marqueeState.dir * -1, marqueeRedux, marqueeState);
}
$marqueeRedux.trigger('end');
} else {
// keep this marquee going
newMarqueeList.push(marqueeRedux);
$marqueeRedux.trigger('start');
marqueeRedux[marqueeState.axis] = getReset(marqueeState.dir, marqueeRedux, marqueeState);
}
} else {
newMarqueeList.push(marqueeRedux);
}
marqueeState.last = marqueeRedux[marqueeState.axis];
// store updated state only if we ran an animation
$marqueeRedux.data('marqueeState', marqueeState);
} else {
// even though it's paused, keep it in the list
newMarqueeList.push(marqueeRedux);
}
}
newMarquee = newMarqueeList;
if (newMarquee.length) {
setTimeout(animateMarquee, 25);
}
}
// TODO consider whether using .html() in the wrapping process could lead to loosing predefined events...
this.each(function (i) {
var $marquee = $(this),
width = $marquee.attr('width') || $marquee.width(),
height = $marquee.attr('height') || $marquee.height(),
$marqueeRedux = $marquee.after('<div ' + (klass ? 'class="' + klass + '" ' : '') + 'style="display: block-inline; width: ' + width + 'px; height: ' + height + 'px; overflow: hidden;"><div style="float: left; white-space: nowrap;">' + $marquee.html() + '</div></div>').next(),
marqueeRedux = $marqueeRedux.get(0),
hitedge = 0,
direction = ($marquee.attr('direction') || 'left').toLowerCase(),
marqueeState = {
dir : /down|right/.test(direction) ? -1 : 1,
axis : /left|right/.test(direction) ? 'scrollLeft' : 'scrollTop',
widthAxis : /left|right/.test(direction) ? 'scrollWidth' : 'scrollHeight',
last : -1,
loops : $marquee.attr('loop') || -1,
scrollamount : $marquee.attr('scrollamount') || this.scrollAmount || 2,
behavior : ($marquee.attr('behavior') || 'scroll').toLowerCase(),
width : /left|right/.test(direction) ? width : height
};
// corrects a bug in Firefox - the default loops for slide is -1
if ($marquee.attr('loop') == -1 && marqueeState.behavior == 'slide') {
marqueeState.loops = 1;
}
$marquee.remove();
// add padding
if (/left|right/.test(direction)) {
$marqueeRedux.find('> div').css('padding', '0 ' + width + 'px');
} else {
$marqueeRedux.find('> div').css('padding', height + 'px 0');
}
// events
$marqueeRedux.bind('stop', function () {
$marqueeRedux.data('paused', true);
}).bind('pause', function () {
$marqueeRedux.data('paused', true);
}).bind('start', function () {
$marqueeRedux.data('paused', false);
}).bind('unpause', function () {
$marqueeRedux.data('paused', false);
}).data('marqueeState', marqueeState); // finally: store the state
// todo - rerender event allowing us to do an ajax hit and redraw the marquee
newMarquee.push(marqueeRedux);
marqueeRedux[marqueeState.axis] = getReset(marqueeState.dir, marqueeRedux, marqueeState);
$marqueeRedux.trigger('start');
// on the very last marquee, trigger the animation
if (i+1 == last) {
animateMarquee();
}
});
return $(newMarquee);
};
}(jQuery));
/**
* Odometer functionality
* http://github.hubspot.com/odometer/
*/
(function() {
var COUNT_FRAMERATE, COUNT_MS_PER_FRAME, DIGIT_FORMAT, DIGIT_HTML, DIGIT_SPEEDBOOST, DURATION, FORMAT_MARK_HTML, FORMAT_PARSER, FRAMERATE, FRAMES_PER_VALUE, MS_PER_FRAME, MutationObserver, Odometer, RIBBON_HTML, TRANSITION_END_EVENTS, TRANSITION_SUPPORT, VALUE_HTML, addClass, createFromHTML, fractionalPart, now, removeClass, requestAnimationFrame, round, transitionCheckStyles, trigger, truncate, wrapJQuery, _jQueryWrapped, _old, _ref, _ref1,
__slice = [].slice;
VALUE_HTML = '<span class="odometer-value"></span>';
RIBBON_HTML = '<span class="odometer-ribbon"><span class="odometer-ribbon-inner">' + VALUE_HTML + '</span></span>';
DIGIT_HTML = '<span class="odometer-digit"><span class="odometer-digit-spacer">8</span><span class="odometer-digit-inner">' + RIBBON_HTML + '</span></span>';
FORMAT_MARK_HTML = '<span class="odometer-formatting-mark"></span>';
DIGIT_FORMAT = '(,ddd).dd';
FORMAT_PARSER = /^\(?([^)]*)\)?(?:(.)(d+))?$/;
FRAMERATE = 30;
DURATION = 2000;
COUNT_FRAMERATE = 20;
FRAMES_PER_VALUE = 2;
DIGIT_SPEEDBOOST = .5;
MS_PER_FRAME = 1000 / FRAMERATE;
COUNT_MS_PER_FRAME = 1000 / COUNT_FRAMERATE;
TRANSITION_END_EVENTS = 'transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd';
transitionCheckStyles = document.createElement('div').style;
TRANSITION_SUPPORT = (transitionCheckStyles.transition != null) || (transitionCheckStyles.webkitTransition != null) || (transitionCheckStyles.mozTransition != null) || (transitionCheckStyles.oTransition != null);
requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
createFromHTML = function(html) {
var el;
el = document.createElement('div');
el.innerHTML = html;
return el.children[0];
};
removeClass = function(el, name) {
return el.className = el.className.replace(new RegExp("(^| )" + (name.split(' ').join('|')) + "( |$)", 'gi'), ' ');
};
addClass = function(el, name) {
removeClass(el, name);
return el.className += " " + name;
};
trigger = function(el, name) {
var evt;
if (document.createEvent != null) {
evt = document.createEvent('HTMLEvents');
evt.initEvent(name, true, true);
return el.dispatchEvent(evt);
}
};
now = function() {
var _ref, _ref1;
return (_ref = (_ref1 = window.performance) != null ? typeof _ref1.now === "function" ? _ref1.now() : void 0 : void 0) != null ? _ref : +(new Date);
};
round = function(val, precision) {
if (precision == null) {
precision = 0;
}
if (!precision) {
return Math.round(val);
}
val *= Math.pow(10, precision);
val += 0.5;
val = Math.floor(val);
return val /= Math.pow(10, precision);
};
truncate = function(val) {
if (val < 0) {
return Math.ceil(val);
} else {
return Math.floor(val);
}
};
fractionalPart = function(val) {
return val - round(val);
};
_jQueryWrapped = false;
(wrapJQuery = function() {
var property, _i, _len, _ref, _results;
if (_jQueryWrapped) {
return;
}
if (window.jQuery != null) {
_jQueryWrapped = true;
_ref = ['html', 'text'];
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
property = _ref[_i];
_results.push((function(property) {
var old;
old = window.jQuery.fn[property];
return window.jQuery.fn[property] = function(val) {
var _ref1;
if ((val == null) || (((_ref1 = this[0]) != null ? _ref1.odometer : void 0) == null)) {
return old.apply(this, arguments);
}
return this[0].odometer.update(val);
};
})(property));
}
return _results;
}
})();
setTimeout(wrapJQuery, 0);
Odometer = (function() {
function Odometer(options) {
var e, k, property, v, _base, _i, _len, _ref, _ref1, _ref2,
_this = this;
this.options = options;
this.el = this.options.el;
if (this.el.odometer != null) {
return this.el.odometer;
}
this.el.odometer = this;
_ref = Odometer.options;
for (k in _ref) {
v = _ref[k];
if (this.options[k] == null) {
this.options[k] = v;
}
}
if ((_base = this.options).duration == null) {
_base.duration = DURATION;
}
this.MAX_VALUES = ((this.options.duration / MS_PER_FRAME) / FRAMES_PER_VALUE) | 0;
this.resetFormat();
this.value = this.cleanValue((_ref1 = this.options.value) != null ? _ref1 : '');
this.renderInside();
this.render();
try {
_ref2 = ['innerHTML', 'innerText', 'textContent'];
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
property = _ref2[_i];
if (this.el[property] != null) {
(function(property) {
return Object.defineProperty(_this.el, property, {
get: function() {
var _ref3;
if (property === 'innerHTML') {
return _this.inside.outerHTML;
} else {
return (_ref3 = _this.inside.innerText) != null ? _ref3 : _this.inside.textContent;
}
},
set: function(val) {
return _this.update(val);
}
});
})(property);
}
}
} catch (_error) {
e = _error;
this.watchForMutations();
}
this;
}
Odometer.prototype.renderInside = function() {
this.inside = document.createElement('div');
this.inside.className = 'odometer-inside';
this.el.innerHTML = '';
return this.el.appendChild(this.inside);
};
Odometer.prototype.watchForMutations = function() {
var e,
_this = this;
if (MutationObserver == null) {
return;
}
try {
if (this.observer == null) {
this.observer = new MutationObserver(function(mutations) {
var newVal;
newVal = _this.el.innerText;
_this.renderInside();
_this.render(_this.value);
return _this.update(newVal);
});
}
this.watchMutations = true;
return this.startWatchingMutations();
} catch (_error) {
e = _error;
}
};
Odometer.prototype.startWatchingMutations = function() {
if (this.watchMutations) {
return this.observer.observe(this.el, {
childList: true
});
}
};
Odometer.prototype.stopWatchingMutations = function() {
var _ref;
return (_ref = this.observer) != null ? _ref.disconnect() : void 0;
};
Odometer.prototype.cleanValue = function(val) {
var _ref;
if (typeof val === 'string') {
val = val.replace((_ref = this.format.radix) != null ? _ref : '.', '<radix>');
val = val.replace(/[.,]/g, '');
val = val.replace('<radix>', '.');
val = parseFloat(val, 10) || 0;
}
return round(val, this.format.precision);
};
Odometer.prototype.bindTransitionEnd = function() {
var event, renderEnqueued, _i, _len, _ref, _results,
_this = this;
if (this.transitionEndBound) {
return;
}
this.transitionEndBound = true;
renderEnqueued = false;
_ref = TRANSITION_END_EVENTS.split(' ');
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
event = _ref[_i];
_results.push(this.el.addEventListener(event, function() {
if (renderEnqueued) {
return true;
}
renderEnqueued = true;
setTimeout(function() {
_this.render();
renderEnqueued = false;
return trigger(_this.el, 'odometerdone');
}, 0);
return true;
}, false));
}
return _results;
};
Odometer.prototype.resetFormat = function() {
var format, fractional, parsed, precision, radix, repeating, _ref, _ref1;
format = (_ref = this.options.format) != null ? _ref : DIGIT_FORMAT;
format || (format = 'd');
parsed = FORMAT_PARSER.exec(format);
if (!parsed) {
throw new Error("Odometer: Unparsable digit format");
}
_ref1 = parsed.slice(1, 4), repeating = _ref1[0], radix = _ref1[1], fractional = _ref1[2];
precision = (fractional != null ? fractional.length : void 0) || 0;
return this.format = {
repeating: repeating,
radix: radix,
precision: precision
};
};
Odometer.prototype.render = function(value) {
var classes, cls, digit, match, newClasses, theme, wholePart, _i, _j, _len, _len1, _ref;
if (value == null) {
value = this.value;
}
this.stopWatchingMutations();
this.resetFormat();
this.inside.innerHTML = '';
theme = this.options.theme;
classes = this.el.className.split(' ');
newClasses = [];
for (_i = 0, _len = classes.length; _i < _len; _i++) {
cls = classes[_i];
if (!cls.length) {
continue;
}
if (match = /^odometer-theme-(.+)$/.exec(cls)) {
theme = match[1];
continue;
}
if (/^odometer(-|$)/.test(cls)) {
continue;
}
newClasses.push(cls);
}
newClasses.push('odometer');
if (!TRANSITION_SUPPORT) {
newClasses.push('odometer-no-transitions');
}
if (theme) {
newClasses.push("odometer-theme-" + theme);
} else {
newClasses.push("odometer-auto-theme");
}
this.el.className = newClasses.join(' ');
this.ribbons = {};
this.digits = [];
wholePart = !this.format.precision || !fractionalPart(value) || false;
_ref = value.toString().split('').reverse();
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
digit = _ref[_j];
if (digit === '.') {
wholePart = true;
}
this.addDigit(digit, wholePart);
}
return this.startWatchingMutations();
};
Odometer.prototype.update = function(newValue) {
var diff,
_this = this;
newValue = this.cleanValue(newValue);
if (!(diff = newValue - this.value)) {
return;
}
removeClass(this.el, 'odometer-animating-up odometer-animating-down odometer-animating');
if (diff > 0) {
addClass(this.el, 'odometer-animating-up');
} else {
addClass(this.el, 'odometer-animating-down');
}
this.stopWatchingMutations();
this.animate(newValue);
this.startWatchingMutations();
setTimeout(function() {
_this.el.offsetHeight;
return addClass(_this.el, 'odometer-animating');
}, 0);
return this.value = newValue;
};
Odometer.prototype.renderDigit = function() {
return createFromHTML(DIGIT_HTML);
};
Odometer.prototype.insertDigit = function(digit, before) {
if (before != null) {
return this.inside.insertBefore(digit, before);
} else if (!this.inside.children.length) {
return this.inside.appendChild(digit);
} else {
return this.inside.insertBefore(digit, this.inside.children[0]);
}
};
Odometer.prototype.addSpacer = function(chr, before, extraClasses) {
var spacer;
spacer = createFromHTML(FORMAT_MARK_HTML);
spacer.innerHTML = chr;
if (extraClasses) {
addClass(spacer, extraClasses);
}
return this.insertDigit(spacer, before);
};
Odometer.prototype.addDigit = function(value, repeating) {
var chr, digit, resetted, _ref;
if (repeating == null) {
repeating = true;
}
if (value === '-') {
return this.addSpacer(value, null, 'odometer-negation-mark');
}
if (value === '.') {
return this.addSpacer((_ref = this.format.radix) != null ? _ref : '.', null, 'odometer-radix-mark');
}
if (repeating) {
resetted = false;
while (true) {
if (!this.format.repeating.length) {
if (resetted) {
throw new Error("Bad odometer format without digits");
}
this.resetFormat();
resetted = true;
}
chr = this.format.repeating[this.format.repeating.length - 1];
this.format.repeating = this.format.repeating.substring(0, this.format.repeating.length - 1);
if (chr === 'd') {
break;
}
this.addSpacer(chr);
}
}
digit = this.renderDigit();
digit.querySelector('.odometer-value').innerHTML = value;
this.digits.push(digit);
return this.insertDigit(digit);
};
Odometer.prototype.animate = function(newValue) {
if (!TRANSITION_SUPPORT || this.options.animation === 'count') {
return this.animateCount(newValue);
} else {
return this.animateSlide(newValue);
}
};
Odometer.prototype.animateCount = function(newValue) {
var cur, diff, last, start, tick,
_this = this;
if (!(diff = +newValue - this.value)) {
return;
}
start = last = now();
cur = this.value;
return (tick = function() {
var delta, dist, fraction;
if ((now() - start) > _this.options.duration) {
_this.value = newValue;
_this.render();
trigger(_this.el, 'odometerdone');
return;
}
delta = now() - last;
if (delta > COUNT_MS_PER_FRAME) {
last = now();
fraction = delta / _this.options.duration;
dist = diff * fraction;
cur += dist;
_this.render(Math.round(cur));
}
if (requestAnimationFrame != null) {
return requestAnimationFrame(tick);
} else {
return setTimeout(tick, COUNT_MS_PER_FRAME);
}
})();
};
Odometer.prototype.getDigitCount = function() {
var i, max, value, values, _i, _len;
values = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
for (i = _i = 0, _len = values.length; _i < _len; i = ++_i) {
value = values[i];
values[i] = Math.abs(value);
}
max = Math.max.apply(Math, values);
return Math.ceil(Math.log(max + 1) / Math.log(10));
};
Odometer.prototype.getFractionalDigitCount = function() {
var i, parser, parts, value, values, _i, _len;
values = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
parser = /^\-?\d*\.(\d*?)0*$/;
for (i = _i = 0, _len = values.length; _i < _len; i = ++_i) {
value = values[i];
values[i] = value.toString();
parts = parser.exec(values[i]);
if (parts == null) {
values[i] = 0;
} else {
values[i] = parts[1].length;
}
}
return Math.max.apply(Math, values);
};
Odometer.prototype.resetDigits = function() {
this.digits = [];
this.ribbons = [];
this.inside.innerHTML = '';
return this.resetFormat();
};
Odometer.prototype.animateSlide = function(newValue) {
var boosted, cur, diff, digitCount, digits, dist, end, fractionalCount, frame, frames, i, incr, j, mark, numEl, oldValue, start, _base, _i, _j, _k, _l, _len, _len1, _len2, _m, _ref, _results;
oldValue = this.value;
fractionalCount = this.getFractionalDigitCount(oldValue, newValue);
if (fractionalCount) {
newValue = newValue * Math.pow(10, fractionalCount);
oldValue = oldValue * Math.pow(10, fractionalCount);
}
if (!(diff = newValue - oldValue)) {
return;
}
this.bindTransitionEnd();
digitCount = this.getDigitCount(oldValue, newValue);
digits = [];
boosted = 0;
for (i = _i = 0; 0 <= digitCount ? _i < digitCount : _i > digitCount; i = 0 <= digitCount ? ++_i : --_i) {
start = truncate(oldValue / Math.pow(10, digitCount - i - 1));
end = truncate(newValue / Math.pow(10, digitCount - i - 1));
dist = end - start;
if (Math.abs(dist) > this.MAX_VALUES) {
frames = [];
incr = dist / (this.MAX_VALUES + this.MAX_VALUES * boosted * DIGIT_SPEEDBOOST);
cur = start;
while ((dist > 0 && cur < end) || (dist < 0 && cur > end)) {
frames.push(Math.round(cur));
cur += incr;
}
if (frames[frames.length - 1] !== end) {
frames.push(end);
}
boosted++;
} else {
frames = (function() {
_results = [];
for (var _j = start; start <= end ? _j <= end : _j >= end; start <= end ? _j++ : _j--){ _results.push(_j); }
return _results;
}).apply(this);
}
for (i = _k = 0, _len = frames.length; _k < _len; i = ++_k) {
frame = frames[i];
frames[i] = Math.abs(frame % 10);
}
digits.push(frames);
}
this.resetDigits();
_ref = digits.reverse();
for (i = _l = 0, _len1 = _ref.length; _l < _len1; i = ++_l) {
frames = _ref[i];
if (!this.digits[i]) {
this.addDigit(' ', i >= fractionalCount);
}
if ((_base = this.ribbons)[i] == null) {
_base[i] = this.digits[i].querySelector('.odometer-ribbon-inner');
}
this.ribbons[i].innerHTML = '';
if (diff < 0) {
frames = frames.reverse();
}
for (j = _m = 0, _len2 = frames.length; _m < _len2; j = ++_m) {
frame = frames[j];
numEl = document.createElement('div');
numEl.className = 'odometer-value';
numEl.innerHTML = frame;
this.ribbons[i].appendChild(numEl);
if (j === frames.length - 1) {
addClass(numEl, 'odometer-last-value');
}
if (j === 0) {
addClass(numEl, 'odometer-first-value');
}
}
}
if (start < 0) {
this.addDigit('-');
}
mark = this.inside.querySelector('.odometer-radix-mark');
if (mark != null) {
mark.parent.removeChild(mark);
}
if (fractionalCount) {
return this.addSpacer(this.format.radix, this.digits[fractionalCount - 1], 'odometer-radix-mark');
}
};
return Odometer;
})();
Odometer.options = (_ref = window.odometerOptions) != null ? _ref : {};
setTimeout(function() {
var k, v, _base, _ref1, _results;
if (window.odometerOptions) {
_ref1 = window.odometerOptions;
_results = [];
for (k in _ref1) {
v = _ref1[k];
_results.push((_base = Odometer.options)[k] != null ? (_base = Odometer.options)[k] : _base[k] = v);
}
return _results;
}
}, 0);
Odometer.init = function() {
var el, elements, _i, _len, _ref1, _results;
if (document.querySelectorAll == null) {
return;
}
elements = document.querySelectorAll(Odometer.options.selector || '.odometer');
_results = [];
for (_i = 0, _len = elements.length; _i < _len; _i++) {
el = elements[_i];
_results.push(el.odometer = new Odometer({
el: el,
value: (_ref1 = el.innerText) != null ? _ref1 : el.textContent
}));
}
return _results;
};
if ((((_ref1 = document.documentElement) != null ? _ref1.doScroll : void 0) != null) && (document.createEventObject != null)) {
_old = document.onreadystatechange;
document.onreadystatechange = function() {
if (document.readyState === 'complete' && Odometer.options.auto !== false) {
Odometer.init();
}
return _old != null ? _old.apply(this, arguments) : void 0;
};
} else {
document.addEventListener('DOMContentLoaded', function() {
if (Odometer.options.auto !== false) {
return Odometer.init();
}
}, false);
}
if (typeof define === 'function' && define.amd) {
define(['jquery'], function() {
return Odometer;
});
} else if (typeof exports === !'undefined') {
module.exports = Odometer;
} else {
window.Odometer = Odometer;
}
}).call(this);
/**
* A simple, lightweight jQuery plugin for creating sortable tables.
* https://github.com/kylefox/jquery-tablesort
*/
(function($) {
//var $ = window.jQuery;
$.tablesort = function ($table, settings) {
var self = this;
this.$table = $table;
this.$thead = this.$table.find('thead');
this.settings = $.extend({}, $.tablesort.defaults, settings);
this.$table.find('th').bind('click.tablesort', function() {
self.sort($(this));
});
this.index = null;
this.$th = null;
this.direction = null;
};
$.tablesort.prototype = {
sort: function(th, direction) {
var start = new Date(),
self = this,
table = this.$table,
rows = this.$thead.length > 0 ? table.find('tbody tr') : table.find('tr').has('td'),
cells = table.find('tr td:nth-of-type(' + (th.index() + 1) + ')'),
sortBy = th.data().sortBy,
sortedMap = [];
var unsortedValues = cells.map(function(idx, cell) {
if (sortBy)
return (typeof sortBy === 'function') ? sortBy($(th), $(cell), self) : sortBy;
return ($(this).data().sortValue != null ? $(this).data().sortValue : $(this).text());
});
if (unsortedValues.length === 0) return;
self.$table.find('th').removeClass(self.settings.asc + ' ' + self.settings.desc);
if (direction !== 'asc' && direction !== 'desc')
this.direction = this.direction === 'asc' ? 'desc' : 'asc';
else
this.direction = direction;
direction = this.direction == 'asc' ? 1 : -1;
self.$table.trigger('tablesort:start', [self]);
self.log("Sorting by " + this.index + ' ' + this.direction);
for (var i = 0, length = unsortedValues.length; i < length; i++)
{
sortedMap.push({
index: i,
cell: cells[i],
row: rows[i],
value: unsortedValues[i]
});
}
sortedMap.sort(function(a, b) {
if (a.value > b.value) {
return 1 * direction;
} else if (a.value < b.value) {
return -1 * direction;
} else {
return 0;
}
});
$.each(sortedMap, function(i, entry) {
table.append(entry.row);
});
th.addClass(self.settings[self.direction]);
self.log('Sort finished in ' + ((new Date()).getTime() - start.getTime()) + 'ms');
self.$table.trigger('tablesort:complete', [self]);
},
log: function(msg) {
if(($.tablesort.DEBUG || this.settings.debug) && console && console.log) {
console.log('[tablesort] ' + msg);
}
},
destroy: function() {
this.$table.find('th').unbind('click.tablesort');
this.$table.data('tablesort', null);
return null;
}
};
$.tablesort.DEBUG = false;
$.tablesort.defaults = {
debug: $.tablesort.DEBUG,
asc: 'sorted ascending',
desc: 'sorted descending'
};
$.fn.tablesort = function(settings) {
var table, sortable, previous;
return this.each(function() {
table = $(this);
previous = table.data('tablesort');
if(previous) {
previous.destroy();
}
table.data('tablesort', new $.tablesort(table, settings));
});
};
}(jQuery)); | 34.679758 | 447 | 0.564378 |
c860ca48c8df8a5f4597e8718a34959f6be01f4a | 249,014 | js | JavaScript | dist/v-2-2-0/full-source/prod.js | dragontheory/active-css | 5f8cec42cc6d78e7834d4d7a039757a5174b5cfd | [
"MIT"
] | 32 | 2020-06-15T14:37:50.000Z | 2022-03-03T23:55:31.000Z | dist/v-2-2-0/full-source/prod.js | Active-CSS/active-css | 5f8cec42cc6d78e7834d4d7a039757a5174b5cfd | [
"MIT"
] | 204 | 2020-06-07T15:51:29.000Z | 2022-03-29T20:38:38.000Z | dist/v-2-2-0/full-source/prod.js | dragontheory/active-css | 5f8cec42cc6d78e7834d4d7a039757a5174b5cfd | [
"MIT"
] | 6 | 2020-09-05T01:09:48.000Z | 2022-02-15T13:07:55.000Z | /*jslint browser: true */
/*global alert, console, getSelection, inspect, self, window */
(function (global, document) {
'use strict';
const PARSELINEX = /([^\:]+):([^\;]*)(;)?/;
const PARSEREGEX = /((?!\*debugfile)[^\s\;\{\}][^\;\{\}]*(?=\{))|(\})|((?!\*debugfile)[^\;\{\}]+\;(?!\s*\*\/))|(\*debugfile[\s\S]*?\*)/gmi;
const PARSESEL = 1;
const PARSEEND = 2;
const PARSEATTR = 3;
const PARSEDEBUG = 4;
// Note: COLONSELS should be kept up-to-date with any new selector conditions/functions.
// Don't forget that double backslashes are needed with quoted regexes.
const COLONSELS = '^(' +
// Word not followed by another name type character.
'(active|any\\-link|blank|checked|current|default|disabled|drop|empty|enabled|first\\-child|first\\-of\\-type|focus|focus\\-visible|focus\\-within|future|hover|indeterminate|in\\-range|invalid|last\\-child|last\\-of\\-type|link|local\\-link|only\\-child|only\\-of\\-type|optional|out\\-of\\-range|past|paused|placeholder\\-shown|playing|read\\-only|read\\-write|required|root|scope|target|target\\-within|user\\-error|user\\-invalid|valid|visited)(?![\\u00BF-\\u1FFF\\u2C00-\\uD7FF\\w_\\-])|' +
// Word and opening parenthesis.
'(current|dir|drop|has|is|lang|not|nth\\-column|nth\\-child|nth\\-last\\-child|nth\\-last\\-column|nth\\-last\\-of\\-type|nth\\-of\\-type|where)\\(' +
')';
const DYNAMICCHARS = {
',': '_ACSS_later_comma',
'{': '_ACSS_later_brace_start',
'}': '_ACSS_later_brace_end',
';': '_ACSS_later_semi_colon',
':': '_ACSS_later_colon',
'"': '_ACSS_later_double_quote'
};
window.ActiveCSS = {};
if (typeof module !== 'undefined') module.exports = ActiveCSS; // This is for NPM.
var coreVersionExtension = '2-0-0', // Used by the extensions to maintain backward-compatibility - this doesn't reflect minor core version changes.
_a = {}, // Active CSS action commands.
_c = {}, // Active CSS conditionals.
parsedConfig = {},
config = [],
configArr = [],
configLine = '',
configFile = '',
lazyConfig = [],
concatConfig = '',
concatConfigCo = 0,
concatConfigLen = 0,
currentPage = '',
ajaxResLocations = {},
pageList = [],
eventState = {},
delayArr = [],
cancelIDArr = [], // [data-activeid][func]; // for cancel-delay
cancelCustomArr = [], // [~(custom event)][func]; // for cancel-delay
selectors = [],
userSetupStarted = false,
autoStartInit = false,
setupEnded = false,
clickOutsideSet = false,
clickOutsideSels = [],
mimicClones = [], // Used by the clone and restore-clones commands.
currDocTitle = document.title,
debugMode = '',
conditionals = [],
components = [],
mediaQueries = [],
mediaQueriesOrig = [],
activeIDTrack = 0,
scriptTrack = [],
debuggerActive = false,
debuggerness = false,
debuggerExtID = null,
debuggerEvs = [ 'afterLoadConfig' ],
debuggerCo = 0,
evEditorExtID = null,
evEditorActive = false,
devtoolsInit = [],
// The variable containing the scoped variables that is proxied (using _observable-Slim) for detecting changes.
scoped = {},
// This is actually a proxy, but used as the variable manipulator in the core. It is simpler just to call it the main variable as we never reference
// the vars direct.
scopedVars = null,
// This is a map to information about the proxy variable. This is updated when variables are rendered, and stores location data to be updated
// when the proxy target is modified.
scopedData = {},
labelData = [],
labelByIDs = [],
customTags = [],
// The next two keep track of pending shadow DOM and scoped components to render.
compCount = 0,
compPending = {},
shadowSels = [],
shadowDoms = {},
actualDoms = {},
preGetMax = 6,
preGetMid = 0,
reverseShadowEvs = {},
allEvents = [],
doesPassive = false,
preSetupEvents = [],
nonPassiveEvents = [],
passiveEvents = true,
inlineConfigTags = null,
supportsShadow = true,
privateScopes = [];
ActiveCSS.customHTMLElements = {};
/* Closure in _core-end.js */
_a.AddClass = o => { // Note thisID is needed in case the "parent" selector is used.
ActiveCSS._addClassObj(o.secSelObj, o.actVal);
};
_a.Ajax = o => {
o.url = o.actVal.split(' ')[0]._ACSSRepQuo();
_ajaxDo(o);
};
_a.AjaxFormPreview = o => {
// as attrAjaxForm but with preview
o.formPreview = true;
_a.AjaxFormSubmit(o);
};
_a.AjaxFormSubmit = o => {
o.formSubmit = true;
const el = o.secSelObj;
if (el) {
o.url = el.action;
_ajaxDo(o);
} else {
console.log('Form ' + o.secSel + ' not found.');
}
};
_a.AjaxPreGet = o => {
// Pre-load the url, and stores the results in an array so we don't have to run the ajax command later.
o.preGet = true;
_a.Ajax(o);
};
_a.Alert = o => {
alert(o.actVal._ACSSRepQuo());
};
_a.Blur = o => {
document.activeElement.blur();
};
_a.CancelTimer = o => {
// Delay action on a secSel by action or label.
// This is scoped by document or specific shadow DOM or component.
let val = o.actVal.trim();
let func = val._ACSSConvFunc();
let found = true;
let i, pos, delayRef, loopref;
let scope = (o.compRef) ? o.compRef : 'main';
// It could be a label cancel. If the label exists, remove the delay.
if (labelData[scope + val]) {
// This is a label cancel. We know it is tied to a specific action value.
// Format:
// labelData[splitArr.lab] => { del: delayRef, func: o2.func, pos: o2.pos, tid: tid };
// labelByIDs[tid] => { del: delayRef, func: o2.func, pos: o2.pos, lab: splitArr.lab };
let delData = labelData[scope + val];
_clearTimeouts(delayArr[delData.del][delData.func][delData.pos][delData.loopRef]);
_removeCancel(delData.del, delData.func, delData.pos, delData.loopRef);
} else {
delayRef = (!['~', '|'].includes(o.secSel.substr(0, 1))) ? _getActiveID(o.secSelObj) : o.secSel;
if (!delayRef) return;
if (delayArr[delayRef]) {
if (val == 'all') {
for (i in delayArr[delayRef]) {
// Clear all timeout attributes for this selector, and the timeout itself.
for (pos in delayArr[delayRef][i]) {
for (loopref in delayArr[delayRef][i][pos]) {
_clearTimeouts(delayArr[delayRef][i][pos][loopref]);
_removeCancel(delayRef, i, pos, loopref);
}
}
}
} else {
if (delayArr[delayRef] && delayArr[delayRef][func]) {
// Clear all actions set up for this function.
for (pos in delayArr[delayRef][func]) {
for (loopref in delayArr[delayRef][func][pos]) {
_clearTimeouts(delayArr[delayRef][func][pos][loopref]);
_removeCancel(delayRef, func, pos, loopref);
}
}
} else {
found = false;
}
}
} else {
found = false;
}
if (!found) {
// If it's not covered by the above selector, then it may be covered by some other cancel not directly tied to the Active ID.
// Mark it for ignoring when the actual timeout hits.
// Is there something about to hit this object? We need to check this, otherwise we are going to have an object that has a cancel-timer attached
// but it may not need one. We could have marked the item as the point of delay, but there can be multiples of action values. We've got an a delay
// event with the func, we just need to check all the o.secSels, which we can do. There are not going to be too many active cancel-delays in effect.
// We use the data-activeid found from the results and compare with the delay array.
// If cancel delaying an element or elements, get the data-activeid and see if it is in the delay array with the appropriate action we are
// cancelling. If it is, we can add it. If not, then there is no need to add it.
let activeIDArr = [];
// Loop the secSels in the delayArr.
Object.keys(delayArr).forEach(function(key) {
if (['~', '|'].includes(key.substr(0, 1))) return;
o.doc.querySelectorAll(key).forEach(function (obj, index) {
activeIDArr.push(_getActiveID(obj));
});
});
let activeID;
if (typeof o.secSel == 'object') {
// Only add it if there is an existing timeout scheduled for this action on this element.
activeID = _getActiveID(o.secSel);
if ((!cancelIDArr[activeID] || !cancelIDArr[activeID][func]) && activeIDArr.includes(activeID)) {
_addCancelAttr(o.secSel, func);
}
} else {
if (['~', '|'].includes(o.secSel.substr(0, 1))) {
// If it's not in the delay arr we can ignore it.
if (!delayArr[delayRef] || !delayArr[delayRef][func] || !delayArr[delayRef][func][o.actPos] || !delayArr[delayRef][func][o.actPos][o.loopRef]) return;
cancelCustomArr.push([o.secSel][func][o.actPos][o.loopRef]);
} else {
o.doc.querySelectorAll(o.secSel).forEach(function (obj) {
activeID = _getActiveID(obj);
if ((!cancelIDArr[activeID] || !cancelIDArr[activeID][func]) && activeIDArr.includes(activeID)) {
_addCancelAttr(obj, func);
}
});
}
}
}
}
};
_a.CancelTimerAll = o => {
_unloadAllCancelTimer();
};
_a.ClickOnFirst = o => { _focusOn(o); }; // First selector in list
_a.ClickOnLast = o => { _focusOn(o, 'l'); }; // Last selector in list
_a.ClickOnNext = o => { _focusOn(o, 'n'); }; // Next selector in list, or nothing
_a.ClickOnNextCycle = o => { _focusOn(o, 'nc'); }; // Next selector in list, then cycles
_a.ClickOnPrevious = o => { _focusOn(o, 'p'); }; // Previous selector in list
_a.ClickOnPreviousCycle = o => { _focusOn(o, 'pc'); }; // Previous selector in list, then cycles
_a.ClickoutsideEvent = o => {
let cid = _getActiveID(o.secSelObj);
if (o.actVal.indexOf('true') !== -1) {
// Put a delay on this in case someone is staggering more than one. The false should be unset first always, followed
// by the one being set. We do this for speed, so we don't have to iterate the states.
setTimeout(function() {
clickOutsideSels[cid] = [];
clickOutsideSels[cid][0] = true;
clickOutsideSet = true;
if (o.actVal.indexOf('continue') !== -1) {
clickOutsideSels[cid][1] = true;
}
}, 50);
} else {
if (clickOutsideSels[cid]) {
clickOutsideSels[cid][0] = false;
clickOutsideSet = false;
}
}
};
_a.Clone = o => {
let el = _getSel(o, o.actVal);
let ref = el.dataset.activeid;
if (el) {
if (el.tagName == 'IFRAME') {
if (el.contentWindow.document.readyState != 'complete') {
// Iframe not ready, come back to this in 200ms to clone.
setTimeout(_a.Clone.bind(this, o), 200);
return false;
}
mimicClones[ref] = document.importNode(el.contentWindow.document.body, true);
} else {
mimicClones[ref] = document.importNode(el, true);
}
}
};
_a.ConsoleLog = o => {
console.log(o.actVal._ACSSRepQuo());
};
_a.CopyToClipboard = o => {
let el = _getSel(o, o.actVal);
var arr = ['INPUT', 'TEXTAREA'];
if (arr.indexOf(el.tagName) !== -1) {
let rO = (el.getAttribute('readonly') == 'readonly') ? true : false;
el.removeAttribute('readonly');
el.select();
document.execCommand('copy');
if (rO) el.setAttribute('readonly', 'readonly');
} else {
let txt = document.createElement('textarea');
txt.id = 'activecss-copy-field';
txt.innerHTML = el.innerText;
document.body.appendChild(txt);
let docTxt = document.getElementById('activecss-copy-field');
docTxt.select();
document.execCommand('copy');
ActiveCSS._removeObj(docTxt);
}
};
_a.CreateCommand = o => {
// Create an Active CSS command dynamically.
let funcName = o.actVal.trim().split(' ')[0];
let funcContent = o.actVal.replace(funcName, '').trim();
funcName = funcName._ACSSConvFunc();
// When the function is called. The scope of the function variables need to be set in "o". The function runs, but all variables are scoped appropriately
// at the time it is run. Needed in here is a way to reference that "o" variable and scope accordingly - dynamically.
// This function right here should only ever be declared once. All var handlings need to be set up correctly with the correct scope right here in this
// function.
if (_a[funcName]) return; // If this command already exists, do nothing more.
funcContent = ActiveCSS._sortOutFlowEscapeChars(funcContent).slice(2, -2);
funcContent = _handleVarsInJS(funcContent);
// Set up the default variables in terms that a Active CSS programmer would be used to:
funcContent = 'let actionName = o.actName,' + // The name of the action command that called this function.
'actionPosition = o.actPos,' + // The position in the action value, 0, 1, etc. - you can call more than one function if you comma-delimit them.
'actionValue = o.actVal,' + // The full evaluated action value.
'actionValueUnEval = o.actValSing,' + // The singular un-evaluated action value that called the function.
'actionValuesUnEval = o.origActVal,' + // The full comma delimited un-evaluated action value of the func action command.
'actionFunc = o.func,' + // The name of the function that was called.
'eventSelector = o.obj,' + // The event selector element itself, that received the event.
'eventSelectorName = o.primSel,' + // The name of the event selector.
'carriedEventObject = o.ajaxObj,' + // If func is called from an afterAjax type of event, this contains the "o" object from the event that triggered the ajax call.
'conditionals = o.passCond,' + // A space delimited list of any conditionals that were passed.
'targetSelector = o.secSelObj,' + // The target selector element itself.
'targetSelectorName = o.origSecSel,' + // The name of the target selector this function was called from. If it contains "&" it means the target selector was the event selector.
'activeID = o.activeID,' + // The internal reference to the target selector assigned. You shouldn't ever change this.
'doc = o.doc,' + // The document object where the target selector can be found.
'e = o.e,' + // The event object.
'eventName = o.event,' + // The name of the event.
'configFile = o.file,' + // The config file where the function call is written.
'configLine = o.line,' + // The line in the config file where you can find the function call.
'rulesArray = o.rules,' + // An array of all the action commands and un-evaluated values in the target selector declaration.
'selectorRef = o.secSel,' + // The target selector reference string.
'compDoc = o.compDoc,' + // The document of the shadow DOM, if applicable.
'component = o.component,' + // The name of the component, if applicable.
'_loopVars = o.loopVars,' + // Internal reference for looping variables.
'_loopRef = o.loopRef,' + // Internal reference for looping variable reference.
'_activeVarScope = (o.compRef && privateScopes[o.compRef]) ? o.compRef : "main";' +
'scopedVars[_activeVarScope] = (typeof scopedVars[_activeVarScope] === \'undefined\') ? {} : scopedVars[_activeVarScope];' +
funcContent;
// Its primary purpose is to create a command, which is a low-level activity.
// There is little benefit to having it run more than once, as no variable substitution is allowed in here, and would only lead to inevitable pointless recreates.
// It would be nice to have it recreated on a realtime edit in the extension. This would need to be set up in the extension area to detect and remove
// the function if it is edited, but that code has no place in here.
_a[funcName] = new Function('o', 'scopedVars', 'privateScopes', funcContent); // jshint ignore:line
};
_a.CreateConditional = o => {
// Create an Active CSS conditional dynamically.
let funcName = o.actVal.trim().split(' ')[0];
let funcContent = o.actVal.replace(funcName, '').trim();
funcName = funcName._ACSSConvFunc();
// When the function is called. The scope of the function variables need to be set in "o". The function runs, but all variables are scoped appropriately
// at the time it is run. Needed in here is a way to reference that "o" variable and scope accordingly - dynamically.
// This function right here should only ever be declared once. All var handlings need to be set up correctly with the correct scope right here in this
// function.
if (_c[funcName]) return; // If this command already exists, do nothing more.
funcContent = ActiveCSS._sortOutFlowEscapeChars(funcContent).slice(2, -2);
funcContent = _handleVarsInJS(funcContent);
// Set up the default variables in terms that a Active CSS programmer would be used to:
funcContent = 'let conditionalName = o.actName,' + // The name of the action command that called this function.
'conditionalFunc = o.func,' +
'conditionalValue = o.actVal,' +
'eventSelectorName = o.primSel,' +
'eventSelector = o.obj,' +
'e = o.e,' +
'doc = o.doc,' +
'component = o.component,' +
'compDoc = o.compDoc,' +
'carriedEventObject = o.ajaxObj,' +
'_activeVarScope = (o.compRef && privateScopes[o.compRef]) ? o.compRef : "main";' +
'scopedVars[_activeVarScope] = (typeof scopedVars[_activeVarScope] === \'undefined\') ? {} : scopedVars[_activeVarScope];' +
funcContent;
// Its primary purpose is to create a command, which is a low-level activity.
// There is little benefit to having it run more than once, as no variable substitution is allowed in here, and would only lead to inevitable pointless recreates.
// It would be nice to have it recreated on a realtime edit in the Elements extension. This would need to be set up in the extension area to detect and remove
// the function if it is edited, but that code has no place in here.
_c[funcName] = new Function('o', 'scopedVars', 'privateScopes', funcContent); // jshint ignore:line
};
_a.CreateElement = o => {
let aV = o.actVal, tag, attrArr, attr, attrs = '', customTagClass, createTagJS;
tag = aV.split(' ')[0];
if (customTags.includes(tag)) return; // The custom tag is already declared - skip it.
aV = aV.replace(tag, '').trim();
// Get attributes. Cater for the possibility of multiple spaces in attr() list in actVal.
attrArr = _getParVal(aV, 'observe').split(' ');
for (attr of attrArr) {
if (!attr) continue;
attrs += "'" + attr.trim() + "',";
}
customTags.push(tag);
// Create the custom tag.
customTagClass = tag._ACSSConvFunc();
createTagJS =
'ActiveCSS.customHTMLElements.' + customTagClass + ' = class ' + customTagClass + ' extends HTMLElement {';
if (attrs) {
createTagJS +=
'static get observedAttributes() {' +
'return [' + attrs.slice(0, -1) + '];' + // trim off trailing comma from attrs.
'}';
}
createTagJS +=
'constructor() {' +
'super();' +
'}' +
// Recommend that the internal Active CSS "draw" event is used for consistency.
'connectedCallback() {' +
// Run the connectedCallback event though if it exists in the config.
'_handleEvents({ obj: this, evType: \'connectedCallback\' });' +
'}' +
'disconnectedCallback() {' +
'_handleEvents({ obj: this, evType: \'disconnectedCallback\', runButElNotThere: true });' + // true = run when not there.
'}' +
'adoptedCallback() {' +
'_handleEvents({ obj: this, evType: \'adoptedCallback\' });' +
'}';
if (attrs) {
createTagJS +=
'attributeChangedCallback(name, oldVal, newVal) {' +
'if (!oldVal) return;' + // skip if this is the first time in, as it's an addition not an update.
'this.setAttribute(name + \'-old\', oldVal); ' +
'let ref = this.getAttribute(\'data-activeid\').replace(\'d-\', \'\') + \'HOST\' + name;' +
'ActiveCSS._varUpdateDom([{currentPath: ref, previousValue: oldVal, newValue: newVal, type: \'update\'}]);' +
'_handleEvents({ obj: this, evType: \'attrChange-\' + name });' +
'}';
}
createTagJS +=
'};' +
'customElements.define(\'' + tag + '\', ActiveCSS.customHTMLElements.' + customTagClass + ');';
Function('_handleEvents', '"use strict";' + createTagJS)(_handleEvents); // jshint ignore:line
};
_a.Eval = o => {
// Run JavaScript dynamically in the global window scope. This is straight-up JavaScript that runs globally.
let evalContent = ActiveCSS._sortOutFlowEscapeChars(o.actVal.trim().slice(2, -2));
eval(evalContent); // jshint ignore:line
};
_a.FocusOff = o => { _a.Blur(o); };
_a.FocusOn = o => { _focusOn(o); };
const _focusOn = (o, wot, justObj=false) => {
let el, nodes, arr, useI, doClick = false, moveNum = 1, n, targEl;
// For previousCycle and nextCycle, as well as a selector, it also takes in the following parameters:
// 2, 3 - this says how far to go forward or back.
// click - clicks on the item
let val = o.actVal;
if (wot == 'pcc' || wot == 'ncc') {
if (val.indexOf(' click') !== -1) {
doClick = true;
val = val.replace(/ click/, '');
}
val = val.replace(/ ([\d]+)( |$)?/gm, function(_, innards) {
moveNum = innards;
return '';
});
val = val.trim();
}
let map = [ 'l', 'n', 'p', 'nc', 'pc', 'ncc', 'pcc' ];
if (map.indexOf(wot) !== -1) {
if (wot != 'l') {
arr = _getFocusedOfNodes(val, o); // compares the focused element to the list and gives the position and returns the nodes. Could optimize this for when moveNum > 0.
nodes = arr[0];
useI = arr[1];
if (wot == 'pcc' || wot == 'ncc') {
if (moveNum > nodes.length) {
moveNum = moveNum % nodes.length; // Correct moveNum to be less than the actual length of the node list (it gets the remainder).
}
}
} else {
// This will only ever run once, as moveNum will always be one.
let targArr = _splitIframeEls(val);
if (!targArr) return false; // invalid target.
nodes = targArr[0].querySelectorAll(targArr[1]) || null;
}
}
switch (wot) {
case 'p':
case 'pc':
case 'pcc':
if (wot == 'p') {
if (useI === 0) return;
} else {
if (moveNum > useI) {
// This move will take us back before 0.
useI = nodes.length - moveNum - useI + 1;
} else {
useI = useI - moveNum + 1;
}
}
el = nodes[useI - 1];
break;
case 'n':
case 'nc':
case 'ncc':
if (wot == 'n') {
if (useI == nodes.length - 1) return;
} else {
if (nodes.length <= moveNum + useI) {
// This move will take us forward beyond the end.
useI = moveNum + useI - nodes.length - 1;
} else {
useI = useI + moveNum - 1;
}
}
el = nodes[useI + 1];
break;
case 'l':
el = nodes[nodes.length - 1];
break;
default:
el = _getSel(o, val);
}
if (!el) return;
targEl = (el.tagName == 'FORM') ? el.elements[0] : el;
if (doClick && (wot == 'pcc' || wot == 'ncc')) {
ActiveCSS.trigger(targEl, 'click');
setTimeout(function () { // Needed for everything not to get highlighted when used in combination with select text area.
targEl.focus();
}, 0);
} else if (!justObj) {
if (o.func.substr(0, 5) == 'Click') {
ActiveCSS.trigger(targEl, 'click');
} else {
el.focus();
}
}
return targEl;
};
_a.FocusOnFirst = o => { _focusOn(o); }; // First selector in list
_a.FocusOnLast = o => { _focusOn(o, 'l'); }; // Last selector in list
_a.FocusOnNext = o => { _focusOn(o, 'n'); }; // Next selector in list, or nothing
_a.FocusOnNextCycle = o => { _focusOn(o, 'nc'); }; // Next selector in list, then cycles
_a.FocusOnPrevious = o => { _focusOn(o, 'p'); }; // Previous selector in list
_a.FocusOnPreviousCycle = o => { _focusOn(o, 'pc'); }; // Previous selector in list, then cycles
_a.FormReset = o => {
let el = _getSel(o, o.actVal);
if (el && el.tagName == 'FORM') el.reset();
};
_a.FullscreenExit = o => {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
};
_a.FullscreenOn = o => {
let el = o.secSelObj;
if (el.requestFullscreen) {
el.requestFullscreen();
} else if (el.mozRequestFullScreen) { /* Firefox */
el.mozRequestFullScreen();
} else if (el.webkitRequestFullscreen) { /* Chrome, Safari and Opera */
el.webkitRequestFullscreen();
} else if (el.msRequestFullscreen) { /* IE/Edge */
el.msRequestFullscreen();
}
};
_a.Func = o => {
let pars = [];
// Convert all spaces within double quotes to something else before the split.
o.actVal = o.actVal._ACSSSpaceQuoIn();
let spl = o.actVal.trim().split(' ');
let func = spl.splice(0, 1);
if (typeof window[func] !== 'function') {
console.log(func + ' is not a function.');
} else {
// Iterate parameters loop. Convert true and false values to actual booleans. Put into the pars array and send to function.
let par;
for (par of spl) {
if (par == 'true') {
par = true;
} else if (par == 'false') {
par = false;
} else if (!isNaN(par)) { // Is this not a non-valid number. Or is this a valid number. Same thing.
// Convert to a real number.
par = parseFloat(par);
} else {
// Unconvert all spaces within double quotes back to what they were. Remove any surrounding double quotes, as it will go as a string anyway.
par = par._ACSSSpaceQuoOut()._ACSSRepQuo();
}
pars.push(par);
}
window[func](o, pars);
}
};
_a.IframeReload = o => {
// A cross-domain solution is to clone the iframe, insert before the original iframe and then remove the original iframe.
let el = o.secSelObj.cloneNode(false);
o.secSelObj.parentNode.insertBefore(el, o.secSelObj);
ActiveCSS._removeObj(o.secSelObj);
};
_a.LoadConfig = o => {
// Dynamically load additional config if it has not already been loaded and append to existing unprocessed concatenated config.
o.actVal = o.actVal._ACSSRepQuo().trim();
_addActValRaw(o);
if (!configArr.includes(o.avRaw)) {
o.file = o.actVal; // We want the original to show in the extensions.
_getFile(o.actVal, 'txt', o);
} else {
// Run the success script - we should still do this, we just didn't need to load the config.
_handleEvents({ obj: o.obj, evType: 'afterLoadConfig' });
}
};
_a.LoadImages = o => {
// eg. load-images: data-cjs-images
// Looks for all attributes in o.actVal and puts that contents into the src, then removes the attribute.
let attr = o.actVal;
o.doc.querySelectorAll('img[' + attr + '], picture source[' + attr + ']').forEach(function (obj, index) {
let attrName = (obj.tagName == 'IMG') ? 'src' : 'srcset';
obj.setAttribute(attrName, obj.getAttribute(attr));
obj.removeAttribute(attr); // So it doesn't try to load it twice.
});
};
_a.LoadScript = (o, opt) => {
let scr = o.actVal._ACSSRepQuo();
let trimmedURL = _getBaseURL(scr);
if (!scriptTrack.includes(trimmedURL)) {
let typ = (opt == 'style') ? 'link' : 'script';
let srcTag = (opt == 'style') ? 'href' : 'src';
let scrip = o.doc.createElement(typ);
if (opt == 'style') {
scrip.rel = 'stylesheet';
}
scrip[srcTag] = scr;
o.doc.head.appendChild(scrip);
scriptTrack.push(trimmedURL);
}
};
_a.LoadStyle = o => { _a.LoadScript(o, 'style'); };
_a.Location = o => {
let page = o.actVal._ACSSRepQuo();
o.doc.location.href = page;
};
_a.MediaControl = o => {
// Works with audio or video.
let secSelObj = o.secSelObj; // This minifies better.
let arr = o.actVal.split(' ');
if (arr[1]) {
arr[1] = arr[1]._ACSSRepQuo();
switch (arr[0]) {
case 'load':
secSelObj.setAttribute('src', arr[1]);
break;
case 'seek':
secSelObj.currentTime = parseFloat(arr[1]);
break;
case 'volume':
secSelObj.volume = parseFloat(arr[1]); // Value between 0 and 1.
break;
}
}
switch (arr[0]) {
case 'play':
secSelObj.play();
break;
case 'pause':
secSelObj.pause();
break;
case 'load':
secSelObj.load();
break;
}
};
_a.MimicInto = o => {
let el, mType, val, valRef, targEl;
el = o.secSelObj;
// Get some properties of the target.
if (o.actVal == 'title') {
targEl = 'title';
mType = 'title';
val = currDocTitle;
} else {
targEl = _getSel(o, o.actVal);
if (!targEl) return;
if (targEl.tagName == 'INPUT' || targEl.tagName == 'TEXTAREA') {
mType = 'input';
} else {
mType = 'text';
}
}
// Get the value reference of the mimicked obj.
valRef = _getFieldValType(el);
if (o.actVal != 'title') {
val = el[valRef];
}
// Now mimic has started we need to set up a reset event which will automatically put the contents back into the
// target areas if the form containing the fields gets reset. This should be automatic behaviour.
// Get the form property, add the reset value and reference to an array property in the form.
// When the form is reset, check for this property. If it exists, run a routine to display these original values.
// Note: this is different to using clone and restore-clone on the target of the mimic.
var counter = 0;
var pref = '';
var closestForm = o.secSelObj.form || o.secSelObj.closest('form');
if (closestForm) {
if (!closestForm.cjsReset) {
closestForm.cjsReset = [];
// Log a reset event for this form.
closestForm.addEventListener('reset', _mimicReset);
}
// Check if the reset value is already in there. We don't want to overwrite it with the previous change if it is.
if (mType == 'title') {
if (!closestForm.cjsReset.title) {
closestForm.cjsReset.title = el.getAttribute('value'); // Get the original value before change.
}
} else {
if (!el.activeResetValueSet) {
// Add the default of the input field before it is changed for resetting later on if needed.
counter = closestForm.cjsReset.length;
closestForm.cjsReset[counter] = {};
closestForm.cjsReset[counter].el = targEl;
closestForm.cjsReset[counter].value = val;
closestForm.cjsReset[counter].type = mType;
el.activeResetValueSet = true;
}
}
}
// Mimic the value.
var insVal;
insVal = o.secSelObj[valRef];
switch (mType) {
case 'input':
targEl.value = insVal;
break;
case 'text':
targEl.innerText = insVal;
break;
case 'title':
document.title = ActiveCSS._decodeHTML(insVal);
currDocTitle = ActiveCSS._decodeHTML(insVal);
}
};
_a.PreventDefault = o => {
if (o.e) o.e.preventDefault(); // Sometimes will get activated on a browser back-arrow, etc., so check first.
};
_a.Remove = o => {
let targArr = _splitIframeEls(o.actVal, o.obj, o.compDoc);
if (!targArr) return false; // invalid target.
targArr[0].querySelectorAll(targArr[1]).forEach(function (obj) {
ActiveCSS._removeObj(obj);
});
};
_a.RemoveAttribute = o => {
o.secSelObj.removeAttribute(o.actVal);
};
_a.RemoveClass = o => {
ActiveCSS._removeClassObj(o.secSelObj, o.actVal);
return true; // true used with take-class.
};
_a.RemoveClone = o => {
let el = _getSel(o, o.actVal);
let ref = el.dataset.activeid;
if (ref) mimicClones[ref] = null;
};
_a.RemoveCookie = o => {
// eg. remove-cookie: cookieName "\blah" "\sdfkjh"; // No spaces are present except between the optional parameters.
let spl = o.actVal.split(' ');
if (!spl[0]) return false;
spl[1] = (spl[1]) ? spl[1]._ACSSRepQuo() : null;
spl[2] = (spl[2]) ? spl[2]._ACSSRepQuo() : null;
let cookieStr = encodeURIComponent(spl[0]) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT" + (spl[1] ? "; path=" + spl[1] : "") + (spl[2] ? "; domain=" + spl[2] : "");
document.cookie = cookieStr;
return true;
};
_a.RemoveProperty = o => {
o.secSelObj.style.removeProperty(o.actVal);
};
// Note: beforebegin = as previous sibling, afterbegin = as first-child, beforeend = as last-child, afterend = as next sibling.
_a.Render = o => {
// Handle quotes.
let content = _handleQuoAjax(o, o.actVal); // Rejoin the string.
// Second handle any components.
content = _replaceComponents(o, content);
// Lastly, handle any ajax strings.
content = (content.indexOf('{$') !== -1) ? _replaceStringVars(o.ajaxObj, content) : content;
_renderIt(o, content);
};
_a.RenderAfterBegin = o => { o.renderPos = 'afterbegin'; _a.Render(o); };
_a.RenderAfterEnd = o => { o.renderPos = 'afterend'; _a.Render(o); };
_a.RenderBeforeBegin = o => { o.renderPos = 'beforebegin'; _a.Render(o); };
_a.RenderBeforeEnd = o => { o.renderPos = 'beforeend'; _a.Render(o); };
_a.RestoreClone = o => {
// This has a settimeout so it puts it at the end of the queue so other things can be destroyed if they are going on.
let el = _getSel(o, o.actVal);
let ref = el.dataset.activeid;
if (!mimicClones[ref]) return; // Clone not there.
if (el.tagName == 'IFRAME') {
if (el.contentWindow.document.readyState != 'complete') {
return false; // Don't bother restoring, iframe is changing. Barf out.
}
setTimeout(function() {
el.contentWindow.document.body = mimicClones[ref];
}, 0);
} else {
setTimeout(function() {
let parEl = el.parentNode;
parEl.replaceChild(mimicClones[ref], el);
// Need to retrigger the draw events.
_a.Trigger({ secSel: '', actVal: 'draw', secSelObj: parEl, ajaxObj: o.ajaxObj, e: o.el || null });
}, 0);
}
};
_a.Run = o => {
let inn;
let funky = '"use strict";' + o.actVal.replace(/\{\=([\s\S]*?)\=\}/m, function(_, wot) {
inn = _handleVarsInJS(ActiveCSS._sortOutFlowEscapeChars(wot));
return inn;
});
let _activeVarScope = (o.compRef && privateScopes[o.compRef]) ? o.compRef : 'main';
scopedVars[_activeVarScope] = (typeof scopedVars[_activeVarScope] === 'undefined') ? {} : scopedVars[_activeVarScope];
try {
Function('scopedVars, _activeVarScope', funky)(scopedVars, _activeVarScope); // jshint ignore:line
} catch (err) {
console.log('Function syntax error (' + err + '): ' + funky);
}
};
_a.ScrollIntoView = o => {
/* Parameters
true = block-start block-nearest
false = block-end block-nearest
behaviour-auto = { behaviour: 'auto' }
behaviour-smooth = { behaviour: 'smooth' }
block-start = { block: 'start' }
block-center = { block: 'center' }
block-end = { block: 'end' }
block-nearest = { block: 'nearest' }
inline-start = { inline: 'start' }
inline-center = { inline: 'center' }
inline-end = { inline: 'end' }
inline-nearest = { inline: 'nearest' }
*/
let arr = o.actVal.split(' ');
let bl = 'start', inl = 'nearest';
let behave = _optDef(arr, 'behaviour-smooth', 'smooth', 'auto');
if (o.actVal == 'true') {
// Options are already set.
} else if (o.actVal == 'false') {
bl = 'end';
}
bl = _optDef(arr, 'block-center', 'center', bl); // center not supported in Firefox 48.
bl = _optDef(arr, 'block-end', 'end', bl);
bl = _optDef(arr, 'block-nearest', 'nearest', bl);
inl = _optDef(arr, 'inline-center', 'center', inl);
inl = _optDef(arr, 'inline-end', 'end', inl);
inl = _optDef(arr, 'inline-nearest', 'nearest', inl);
try { // Causes error in Firefox 48 which doesn't support block center, so fallback to default for block on failure.
o.secSelObj.scrollIntoView({ behaviour: behave, block: bl, inline: inl });
} catch (err) {
o.secSelObj.scrollIntoView({ behaviour: behave, inline: inl });
}
};
_a.ScrollX = o => {
if (o.secSel == 'body') {
// All of these have been tested.
if (o.actVal == 'left') {
window.scrollTo({ left: 0 });
} else if (o.actVal == 'right') {
window.scrollTo({ left: 10000000 }); // As long as it's greater than the scroll bar it will go to the right, as standard.
} else {
window.scrollTo({ left: o.actVal });
}
} else {
let el = o.secSelObj;
if (o.actVal == 'left') {
el.scrollLeft = 0;
} else if (o.actVal == 'right') {
el.scrollLeft = 10000000; // As long as it's greater than the scroll bar it will go to the right, as standard. 10 million pixels should do it.
} else {
el.scrollLeft = o.actVal;
}
}
};
_a.ScrollY = o => {
if (o.secSel == 'body') {
// All of these have been tested.
if (o.actVal == 'top') {
window.scrollTo({ top: 0 });
} else if (o.actVal == 'bottom') {
window.scrollTo({ top: 10000000 }); // As long as it's greater than the scroll bar it will go to the bottom, as standard.
} else {
window.scrollTo({ top: o.actVal });
}
} else {
let el = o.secSelObj;
if (el) {
if (o.actVal == 'top') {
el.scrollTop = 0;
} else if (o.actVal == 'bottom') {
el.scrollTop = el.scrollHeight;
} else {
el.scrollTop = o.actVal;
}
}
}
};
_a.SelectAll = o => {
requestAnimationFrame(() => document.execCommand('selectAll'));
};
_a.SelectNone = o => {
getSelection().removeAllRanges();
};
_a.SetAttribute = o => {
o.actVal = o.actVal._ACSSSpaceQuoIn();
let attrArr = o.actVal.split(' ');
attrArr[1] = _handleQuoAjax(o, attrArr[1])._ACSSSpaceQuoOut();
o.secSelObj.setAttribute(attrArr[0], attrArr[1]);
};
_a.SetClass = o => {
let str = o.actVal.replace(/\./g, '');
_setClassObj(o.secSelObj, str);
};
_a.SetCookie = o => {
// Eg. set-cookie: cookieName "any string with spaces" secs/infinity/"date" "\blah" "\sdfkjh" true;
let aV = o.actVal;
// 1. Replace escaped quotes for now.
aV = aV.replace(/\\\"/g, '_ACSS_escaped_quote');
// 2. Fill in the spaces between quotes with an alternate space string, and remove the quotes if we can.
aV = aV._ACSSSpaceQuoIn();
// 3. Put the escaped quotes back.
aV = aV.replace(/_ACSS_escaped_quote/g, '\\\"');
// 4. Split the array by space.
let arr = aV.split(' ');
// 5. 0 element is name.
// 6. 1 element gets spaces put back in, quotes removed and assigned as value.
arr[1] = (arr[1]) ? arr[1]._ACSSSpaceQuoOut()._ACSSRepQuo() : '';
// 7. 2 element gets spaces put back in, quotes removed and if number is seconds, if infinity is infinity, otherwise string date, or empty.
arr[2] = (arr[2]) ? arr[2].replace(/_ACSS_space/g, ' ')._ACSSRepQuo() : '';
arr[2] = (arr[2] == 'Infinity') ? Infinity : (arr[2] == 'Year') ? 31536e3 : (/^[0-9e]+$/.test(arr[2])) ? +arr[2] : arr[2];
// 8. 3 element if there is path.
arr[3] = (arr[3]) ? arr[3]._ACSSRepQuo() : null;
// 9. 4 element if there is domain.
arr[4] = (arr[4]) ? arr[4]._ACSSRepQuo() : null;
// 10. 5 element if there is secure.
arr[5] = (arr[5] == 'true') ? true : (arr[5] == 'false') ? false : null;
if (arr[2] == 'true' && !arr[3] && !arr[4] && !arr[5]) {
arr[2] = null; arr[5] = true;
}
if (arr[2] == 'false' && !arr[3] && !arr[4] && !arr[5]) {
arr[2] = null; arr[5] = false;
}
if (arr[3] == 'true' && !arr[4] && !arr[5]) {
arr[3] = null; arr[5] = true;
}
if (arr[3] == 'false' && !arr[4] && !arr[5]) {
arr[3] = null; arr[5] = false;
}
if (arr[4] == 'true' && !arr[5]) {
arr[4] = null; arr[5] = true;
}
if (arr[4] == 'false' && !arr[5]) {
arr[4] = null; arr[5] = false;
}
if (!_setCookie(arr[0], arr[1], arr[2], arr[3], arr[4], arr[5])) console.log('set-cookie ' + arr[0] + ' failed');
};
_a.SetProperty = o => {
o.actVal = o.actVal._ACSSSpaceQuoIn();
let attrArr = o.actVal.split(' ');
attrArr[1] = _handleQuoAjax(o, attrArr[1])._ACSSSpaceQuoOut();
o.secSelObj[attrArr[0]] = (attrArr[1] == 'true') ? true : (attrArr[1] == 'false') ? false : attrArr[1];
};
_a.StopImmediatePropagation = o => {
// Don't bubble up Active CSS events and stop propagation in the browser too.
if (o.e) o.e.stopImmediatePropagation();
if (typeof o.obj == 'object') o.obj.activeStopProp = true;
};
_a.StopPropagation = o => {
// Don't bubble up Active CSS events and stop propagation in the browser too.
if (o.e) o.e.stopPropagation();
if (typeof o.obj == 'object') o.obj.activeStopProp = true;
};
_a.Style = o => {
let str = _handleQuoAjax(o, o.actVal);
let wot = str.split(' '), prop = wot.shift();
o.secSelObj.style[prop] = wot.join(' ');
};
_a.TakeClass = o => {
if (o.doc != document) {
console.log('Active CSS error - you cannot take a class if the element clicked on is not going to take the class. With iframes, use give-class instead.');
return false;
}
// Take class away from any element that has it.
let cl = o.actVal.substr(1);
_eachRemoveClass(cl, cl, o.doc);
_a.AddClass(o);
};
_a.ToggleClass = o => {
let str = o.actVal.replace(/\./g, '');
_toggleClassObj(o.secSelObj, str);
};
_a.Trigger = o => {
if (typeof o.obj === 'string' && o.obj.indexOf('{@') === -1 && o.obj.indexOf('{$') === -1 && !['~', '|'].includes(o.obj.substr(0, 1))) {
// This is a string, and we need the real objects, so do a queryselectorall.
o.doc.querySelectorAll(o.obj).forEach(function (obj, i) {
if (['~'].includes(o.secSel.substr(0,1))) {
// This is a trigger on a custom selector. Pass the available objects in case they are needed.
_handleEvents({ obj: o.secSel, evType: o.actVal, otherObj: (o.ajaxObj || null), eve: (o.e || null), origObj: obj, compRef: o.compRef, compDoc: o.compDoc, component: o.component });
} else {
// Note: We want to keep the object of the selector, but we do still want the ajaxObj.
_handleEvents({ obj: o.secSel, evType: o.actVal, otherObj: (o.ajaxObj || null), eve: (o.e || null), compRef: o.compRef, compDoc: o.compDoc, component: o.component });
}
});
} else {
if (['~'].includes(o.secSel.substr(0, 1))) {
// This is a trigger on a custom selector. Pass the available objects in case they are needed.
_handleEvents({ obj: o.secSel, evType: o.actVal, otherObj: (o.ajaxObj || null), eve: (o.e || null), origObj: (o.obj || null), compRef: o.compRef, compDoc: o.compDoc, component: o.component });
} else {
// Note: We want to keep the object of the selector, but we do still want the ajaxObj.
// Is this a draw event? If so, we also want to run all draw events for elements within.
if (o.actVal == 'draw') {
_runInnerEvent(o.secSelObj, 'draw');
} else {
_handleEvents({ obj: o.secSelObj, evType: o.actVal, otherObj: (o.ajaxObj || null), eve: (o.e || null), compRef: o.compRef, compDoc: o.compDoc, component: o.component });
}
}
}
};
_a.TriggerReal = o => {
// Simulate a real event, not just a programmatical one.
if (!o.secSelObj.isConnected) {
// Skip it if it's no longer there and cancel all Active CSS bubbling.
_a.StopPropagation(o);
return;
}
try {
o.secSelObj.addEventListener(o.actVal, function(e) {}, {capture: true, once: true}); // once = automatically removed after running.
o.secSelObj[o.actVal]();
} catch(err) {
console.log('Active CSS error: Only DOM events support trigger-real.');
}
};
_a.UrlChange = o => {
// Check that url-change hasn't been just run, as if so we don't want to run it twice.
// Check if there is a page-title in the rules. If so, this needs to be set at the same time, so we know what
// url to go back to.
let wot = o.actVal.split(' ');
let url = wot[0];
let titl = o.actVal.replace(url, '').trim();
if (titl == '') {
// default to current title if no parameter set.
titl = document.title;
}
_urlTitle(url, titl, o);
};
_a.Var = o => {
// Get the name of the variable.
let varName = o.actVal.trim().split(' ')[0];
// Get rid of the variable name from the actVal string before we scope it.
let varDetails = o.actVal.replace(varName, '').trim();
// Replace any reference to scoped variables with their prefixes.
varDetails = _prefixScopedVars(varDetails, o.compRef);
// Place the expression into the correct format for evaluating.
varDetails = '{=' + varDetails + '=}';
let scopedVar = ((o.compRef && privateScopes[o.compRef]) ? o.compRef : 'main') + '.' + varName;
let expr = _replaceJSExpression(varDetails, true, null, o.compRef); // realVal=false, quoteIfString=false
_set(scopedVars, scopedVar, expr);
};
ActiveCSS.first = sel => { return _focusOn({ actVal: sel }, null, true); }; // First selector in list
ActiveCSS.last = sel => { return _focusOn({ actVal: sel }, 'l', true); }; // Last selector in list
ActiveCSS.next = sel => { return _focusOn({ actVal: sel }, 'n', true); }; // Next selector in list, or nothing
// Next selector in list, then cycles
ActiveCSS.nextCycle = sel => {
return _focusOn({ actVal: sel }, 'ncc', true);
};
ActiveCSS.previous = sel => { return _focusOn({ actVal: sel }, 'p', true); }; // Previous selector in list
// Previous selector in list, then cycles
ActiveCSS.previousCycle = sel => {
return _focusOn({ actVal: sel }, 'pcc', true);
};
ActiveCSS.trigger = (sel, ev, compRef, compDoc, component) => {
/* API command */
/* Possibilities:
ActiveCSS.trigger('~restoreAfterTinyMCE', 'custom'); // Useful for calling random events.
ActiveCSS.trigger(o.obj, 'customCancel'); // Useful for external function to call a custom event on the initiating object.
// This needs to be expanded to include ajaxobj, e and obj, so an after trigger can continue. FIXME at some point.
*/
// Subject to conditionals.
if (typeof sel == 'object') {
// This is an object that was passed.
_handleEvents({ obj: sel, evType: ev, compRef: compRef, compDoc: compDoc, component: component });
} else {
_a.Trigger({ secSel: sel, actVal: ev, compRef: compRef, compDoc: compDoc, component: component });
}
};
ActiveCSS.triggerReal = (obj, ev, compRef, compDoc, component) => {
if (typeof obj === 'string') {
obj = document.querySelector(obj);
}
if (obj) {
_a.TriggerReal({ secSelObj: obj, actVal: ev, compRef: compRef, compDoc: compDoc, component: component });
} else {
console.log('No object found in document to triggerReal.');
}
};
_c.IfCompletelyVisible = o => { return ActiveCSS._ifVisible(o, true); }; // Used by extensions.
_c.IfCookieEquals = o => {
let spl = o.actVal.split(' ');
if (!_cookieExists(spl[0])) return false;
let nam = spl[0];
spl.shift();
spl = spl.join(' ');
return (_getCookie(nam) == spl._ACSSRepQuo()) ? true : false;
};
_c.IfCookieExists = o => {
return _cookieExists(o.actVal);
};
_c.IfDisplay = o => {
let el = o.doc.querySelector(o.actVal);
return (el && getComputedStyle(el, null).display !== 'none') ? true : false;
};
_c.IfEmpty = o => { return (_selCompare(o, 'eM')) ? true : false; };
_c.IfExists = o => {
return (_getSel(o, o.actVal)) ? true : false;
};
_c.IfFocusFirst = o => { return _ifFocus(o); };
_c.IfFocusLast = o => { return _ifFocus(o, false); };
_c.IfFormChanged = o => { return _checkForm(_getSel(o, o.actVal), 'check'); };
_c.IfFunc = o => {
// Not a one-liner as we need the try/catch and error message.
if (o.actVal == 'true') {
return true;
} else if (o.actVal == 'false') {
return false;
} else {
try {
return window[o.actVal](o);
} catch(r) {
console.log('Active CSS: Function ' + o.actVal + ' does not exist.');
return false;
}
}
};
_c.IfHasClass = o => {
let arr = _actValSelItem(o);
return (arr[0] && ActiveCSS._hasClassObj(arr[0], arr[1].substr(1))) ? true : false; // Used by extensions.
};
_c.IfInnerHtml = o => { return (_selCompare(o, 'iH')) ? true : false; }; // Used in core unit testing.
_c.IfInnerText = o => { return (_selCompare(o, 'iT')) ? true : false; };
_c.IfMaxLength = o => { return (_selCompare(o, 'maL')) ? true : false; };
_c.IfMediaMaxWidth = o => {
// This could get stored in a variable with an event listener rather than running each time. Probably not worth the overhead though.
let mq = window.matchMedia('all and (max-width: ' + o.actVal + ')');
return mq.matches;
};
_c.IfMediaMinWidth = o => {
// This could get stored in a variable with an event listener rather than running each time. Probably not worth the overhead though.
let mq = window.matchMedia('all and (min-width: ' + o.actVal + ')');
return mq.matches;
};
_c.IfMinLength = o => { return (_selCompare(o, 'miL')) ? true : false; };
_c.IfScrolltopGreater = o => {
if (o.obj == 'body') {
return (window.pageYOffset || document.documentElement.scrollTop) > o.actVal;
} else {
return o.obj.scrollTop > o.actVal;
}
};
_c.IfScrolltopLess = o => {
if (o.obj == 'body') {
return (window.pageYOffset || document.documentElement.scrollTop) < o.actVal;
} else {
return o.obj.scrollTop < o.actVal;
}
};
_c.IfSelection = o => {
let selObj = window.getSelection();
o.actVal = o.actVal._ACSSRepQuo().trim();
return (selObj.toString() == o.actVal) ? true : false;
};
_c.IfVar = o => {
// This caters for scoped variable and also window variable comparison. If the variable isn't in the scope, it takes the window variable if it is there.
// First parameter is the variable name.
// Second parameter is a string, number or boolean. Any JavaScript expression ({= ... =} clauses) has already been evaluated.
// This also takes only one parameter, in which case it is checked for evaluating to boolean true.
let actVal = o.actVal._ACSSSpaceQuoIn();
let spl = actVal.split(' ');
if (spl.length == 1) {
// Run if-var-true.
return _ifVarTrue(actVal. o.compRef);
} else {
let varName = spl.shift(); // Remove the first element from the array.
let compareVal = spl.join(' ')._ACSSSpaceQuoOut();
compareVal = (compareVal == 'true') ? true : (compareVal == 'false') ? false : compareVal;
if (typeof compareVal == 'string' && compareVal.indexOf('"') === -1) {
compareVal = Number(compareVal._ACSSRepQuo());
} else {
compareVal = compareVal._ACSSRepQuo();
}
let scopedVar = ((o.compRef && privateScopes[o.compRef]) ? o.compRef : 'main') + '.' + varName;
let varValue = _get(scopedVars, scopedVar);
if (typeof varValue == 'undefined') {
varValue = window[varName];
}
return (typeof varValue == typeof compareVal && varValue == compareVal) ? true : false;
}
};
_c.IfVarTrue = o => { return _ifVarTrue(o.actVal, o.compRef); };
_c.IfVisible = o => { return ActiveCSS._ifVisible(o); }; // Used by extensions.
/* Internal conditional command only */
_c.MqlTrue = o => { return mediaQueries[o.actVal].val; };
const _addCancelAttr = (obj, func) => {
let activeID = obj.dataset.activeid;
if (!cancelIDArr[activeID]) cancelIDArr[activeID] = [];
cancelIDArr[activeID][func] = true;
};
const _clearTimeouts = delayID => {
// Note: In Active CSS it is impossible to have an "after" delay and an "every" interval happening at the same
// time. "After" delays always come before "every" intervals. When removing timeouts or intervals there should never be a clash in numbers as setInterval and
// setTimeout should share the same pool of IDs in browsers, or at least they are supposed to :) Distinction clarity in the use case here is not helpful, as it
// means adding unnecessary code. This is not good practice if it isn't needed. Unless things are likely to change in the future due to the same pool not being
// part of the W3C spec, but it is *implied, just about* in the spec that they share the same pool, so it should be ok.
clearTimeout(delayID);
clearInterval(delayID);
};
const _delaySplit = (str, typ) => {
// Return an array containing an "after" or "every" timing, and any label (label not implemented yet).
// Ignore entries in double quotes. Wipe out the after or every entries after handling.
let regex, convTime, theLabel;
regex = new RegExp('(' + typ + ' (stack|[\\d]+(s|ms)))(?=(?:[^"]|"[^"]*")*)', 'gm');
str = str.replace(regex, function(_, wot) {
convTime = wot.split(' ')[1];
convTime = _convertToMS(convTime, 'Invalid delay number format: ' + wot);
return '';
});
// "after" and "every" share the same label. I can't think of a scenario where they would need to have their own label, but this functionality may need to be
// added to later on. Maybe not.
str = str.replace(/(label [\u00BF-\u1FFF\u2C00-\uD7FF\w_]+)(?=(?:[^"]|"[^"]*")*)$/gm, function(_, wot) {
// Label should be wot.
theLabel = wot.split(' ')[1];
return (typ == 'every') ? '' : wot;
});
return { str: str.trim(), tim: convTime, lab: theLabel };
};
const _removeCancel = (delayRef, func, actPos, loopRef) => {
if (delayArr[delayRef] && delayArr[delayRef][func] && delayArr[delayRef][func][actPos]) {
let tid = delayArr[delayRef][func][actPos][loopRef];
if (tid && labelByIDs[tid]) {
let delData = labelByIDs[tid];
labelByIDs.splice(labelByIDs.indexOf[tid]);
delete labelData[delData.lab];
}
delayArr[delayRef][func][actPos][loopRef] = null;
}
if (['~', '|'].includes(delayRef.substr(0, 1))) {
if (cancelCustomArr[delayRef] && cancelCustomArr[delayRef][func] && cancelCustomArr[delayRef][func][actPos]) {
cancelCustomArr[delayRef][func][actPos][loopRef] = null;
}
} else {
if (cancelIDArr[delayRef] && cancelIDArr[delayRef][func]) {
cancelIDArr[delayRef][func] = null;
}
}
};
const _setupLabelData = (lab, del, func, pos, loopRef, tid) => {
delayArr[del][func][pos][loopRef] = tid;
if (lab) {
labelData[lab] = { del, func, pos, loopRef, tid };
// We don't want to be loop or sorting for performance reasons, so we'll just create a new array to keep track of the data we need for later.
// Note this ES6 syntax is equivalent to del: del, etc.
labelByIDs[tid] = { del, func, pos, loopRef, lab };
}
};
const _unloadAllCancelTimer = () => {
let i, j, k, l;
// Each timeout needs individually deleting, hence the nested loopage. There should never be lots delayed events at any one time, and they do get cleaned up.
for (i in delayArr) {
for (j in delayArr[i]) {
for (k in delayArr[i][j]) {
for (l in delayArr[i][j][k]) {
_clearTimeouts(delayArr[i][j][k][l]);
delayArr[i][j][k][l] = null;
}
}
}
}
delayArr = [];
cancelIDArr = [];
labelData = [];
labelByIDs = [];
};
const _actionValLoop = (oCopy, pars, obj, runButElNotThere) => {
let i, { loopI, actVals, actValsLen } = pars;
for (i = 0; i < actValsLen; i++) {
// Loop over the comma-delimited actions.
oCopy.actVal = actVals[i].trim(); // Put the original back.
oCopy.actPos = i; // i or label (not yet built).
oCopy.secSelObj = obj;
_handleFunc(oCopy, null, runButElNotThere);
}
};
const _cloneAttrs = (el, srcEl) => {
let attr, attrs = Array.prototype.slice.call(srcEl.attributes);
for (attr of attrs) {
if (attr.nodeName == 'href') continue; // skip the href - we've already got it, otherwise we wouldn't be here.
// Overwrite what is there, but only if it doesn't exist already.
if (attr.nodeName == 'class') {
ActiveCSS._addClassObj(el, attr.nodeValue);
} else {
if (!el.getAttribute(attr.nodeName)) el.setAttribute(attr.nodeName, attr.nodeValue);
}
}
el.setAttribute('data-active-nav', '1');
};
const _handleClickOutside = el => {
// Does this element pass the click outside test?
// Iterate the click outside selectors from the config.
let cid, clickOutsideObj;
for (cid in clickOutsideSels) {
// Check the state of the clickoutside for this container. Will be true if active.
if (clickOutsideSels[cid][0]) {
// Does this clicked object exist in the clickoutside main element?
clickOutsideObj = document.querySelector('[data-activeid="' + cid + '"]');
if (clickOutsideObj && !clickOutsideObj.contains(el)) {
// This is outside.
if (_handleEvents({ obj: clickOutsideObj, evType: 'clickoutside', otherObj: el })) { // clickoutside sends the target also.
if (!clickOutsideSels[cid][1]) {
// This is a blocking click outside, so cancel any further actions.
return false;
}
}
}
}
}
return true;
};
const _handleEvents = evObj => {
let obj = evObj.obj;
let evType = evObj.evType;
let onlyCheck = evObj.onlyCheck;
let otherObj = evObj.otherObj;
let eve = evObj.eve;
let afterEv = evObj.afterEv;
let origObj = evObj.origObj;
let runButElNotThere = evObj.runButElNotThere;
let compRef, thisDoc;
let compDoc = evObj.compDoc;
thisDoc = (compDoc) ? compDoc : document;
let topCompRef = evObj.compRef;
let component = (evObj.component) ? '|' + evObj.component : null;
// Note: obj can be a string if this is a trigger, or an object if it is responding to an event.
if (typeof obj !== 'string' && !obj || !selectors[evType] || typeof evType === 'undefined') return false; // No selectors set for this event.
let selectorList = [];
// Handle all selectors.
let selectorListLen = selectors[evType].length;
let i, testSel, debugNot = '', compSelCheckPos;
if (typeof obj !== 'string') {
if (component) {
// Split for speed. It could be split into document/shadow areas to make even faster, at the times of adding config.
// Don't bother optimizing by trying to remember the selectors per event the first time so they can be reused later on. Been down that route already.
// The DOM state could change at any time, thereby potential changing the state of any object, and it's more trouble than it's worth to keep track of it
// on a per object basis. It is fine as it is working dynamically. If you do have a go, you will need to consider things like routing affecting DOM
// attributes, adding/removing attributes, properties, plus monitoring all objects for any external manipulation. It's really not worth it. This code is
// short and fast enough on most devices.
for (i = 0; i < selectorListLen; i++) {
compSelCheckPos = selectors[evType][i].indexOf(':');
if (selectors[evType][i].substr(0, compSelCheckPos) !== component) continue;
testSel = selectors[evType][i].substr(compSelCheckPos + 1);
// Replace any attributes, etc. into the primary selector if this is an "after" callback event.
testSel = (afterEv && origObj) ? _replaceAttrs(origObj, testSel) : testSel;
if (testSel.indexOf('<') === -1 && !selectorList.includes(selectors[evType][i])) {
if (testSel == '&') {
selectorList.push(selectors[evType][i]);
} else {
try {
if (obj.matches(testSel)) {
selectorList.push(selectors[evType][i]);
}
} catch(err) {
console.log('Active CSS warning: ' + testSel + ' is not a valid CSS selector, skipping. (err: ' + err + ')');
}
}
}
}
} else {
for (i = 0; i < selectorListLen; i++) {
if (['~', '|'].includes(selectors[evType][i].substr(0, 1))) continue;
// Replace any attributes, etc. into the primary selector if this is an "after" callback event.
testSel = (afterEv && origObj) ? _replaceAttrs(origObj, selectors[evType][i]) : selectors[evType][i];
if (testSel.indexOf('<') === -1 && !selectorList.includes(selectors[evType][i])) {
try {
if (obj.matches(testSel)) {
selectorList.push(selectors[evType][i]);
}
} catch(err) {
console.log('Active CSS warning: ' + testSel + ' is not a valid CSS selector, skipping. (err: ' + err + ')');
}
}
}
}
} else {
// This has taken in a string to select - just search for that string. Note this could be a shadow DOM element, which for speed has come in as a string sel.
selectorList.push(obj);
obj = (origObj) ? origObj : obj;
}
let sel, chilsObj;
component = (component) ? component.substr(1) : null; // we don't want to pass around the pipe | prefix.
selectorListLen = selectorList.length;
let actionName, ifrSplit, ifrObj, conds = [], cond, condSplit, passCond;
let clause, clauseCo = 0, clauseArr = [];
// All conditionals for a full event must be run *before* all actions, otherwise we end up with confusing changes within the same event which makes
// setting conditionals inconsistent. Like checking if a div is red, then setting it to green, then checking if a div is green and setting it to red.
// Having conditionals dynamically checked before each run of actions means the actions cancel out. So therein lies confusion. So all conditionals
// must be for a specific event on a selector *before* all actions. We get two "for" loops, but I don't see an alternative right now.
for (sel = 0; sel < selectorListLen; sel++) {
if (config[selectorList[sel]] && config[selectorList[sel]][evType]) {
if (onlyCheck) return true; // Just checking something is there. Now we have established this, go back.
for (clause in config[selectorList[sel]][evType]) {
clauseCo++;
if (clause != '0' && _passesConditional(obj, sel, clause, evType, otherObj, thisDoc, topCompRef, component, eve, compDoc)) {
// This condition passed. Remember it for the next bit.
clauseArr[clauseCo] = clause;
}
}
}
}
clauseCo = 0;
for (sel = 0; sel < selectorListLen; sel++) {
if (config[selectorList[sel]] && config[selectorList[sel]][evType]) {
for (clause in config[selectorList[sel]][evType]) {
clauseCo++;
passCond = '';
if (clause != '0') { // A conditional is there.
if (typeof clauseArr[clauseCo] == 'undefined') continue; // The conditional failed earlier.
// This conditional passed earlier - we can run it.
passCond = clauseArr[clauseCo];
}
chilsObj = config[selectorList[sel]][evType][clause];
if (chilsObj !== false) {
// Secondary selector loops go here.
let secSelLoops, loopObj;
for (secSelLoops in chilsObj) {
loopObj = {
chilsObj,
originalLoops: secSelLoops,
secSelLoops,
obj,
compDoc,
evType,
compRef: topCompRef,
evObj,
otherObj,
passCond,
sel,
component,
selectorList,
eve,
runButElNotThere
};
if (secSelLoops != '0') {
// Process any secondary selector loops and anything else.
_processSecSelLoops(loopObj);
} else {
// No secondary selector loops. Just run the action setup.
_performSecSel(loopObj);
}
}
}
}
}
}
return true;
};
const _handleFunc = function(o, delayActiveID=null, runButElNotThere=false) {
let delayRef;
if (typeof o.secSel === 'string' && ['~', '|'].includes(o.secSel.substr(0, 1))) {
delayRef = o.secSel;
} else {
// Note: re runButElNotThere) {
// "runButElNotThere" is a custom element disconnect callback. We know the original object is no longer on the page, but we still want to run functions.
// If the original object that has been removed is referenced in the code, this is an error by the user.
if (!runButElNotThere && !o.secSelObj.isConnected) {
// Skip it if the object is no longer there and cancel all Active CSS bubbling.
if (delayActiveID) {
// Cleanup any delayed actions if the element is no longer there.
if (delayArr[delayActiveID]) {
_clearTimeouts(delayArr[delayActiveID][o.func][o.actPos][o.loopRef]);
}
delayArr[delayActiveID] = null;
cancelIDArr[delayActiveID] = null;
cancelCustomArr[delayActiveID] = null;
}
_a.StopPropagation(o);
return;
}
delayRef = _getActiveID(o.secSelObj);
}
// Replace any looping variable in the action value at this point, above any delay actions.
if (o.loopRef != '0') {
o.actVal = _replaceLoopingVars(o.actVal, o.loopVars);
}
// Delayed / interval events need to happen at this level.
if (o.actVal.match(/(after|every) (stack|[\d]+(s|ms))(?=(?:[^"]|"[^"]*")*$)/gm)) {
let o2 = Object.assign({}, o), delLoop = ['after', 'every'], aftEv;
let splitArr, tid, scope;
for (aftEv of delLoop) {
splitArr = _delaySplit(o2.actVal, aftEv);
scope = (o.compRef) ? o.compRef : 'main';
splitArr.lab = scope + splitArr.lab;
if (typeof splitArr.tim == 'number' && splitArr.tim >= 0) {
o2.actVal = splitArr.str;
o2.actValSing = o2.actVal;
delayArr[delayRef] = (typeof delayArr[delayRef] !== 'undefined') ? delayArr[delayRef] : [];
delayArr[delayRef][o2.func] = (typeof delayArr[delayRef][o2.func] !== 'undefined') ? delayArr[delayRef][o2.func] : [];
delayArr[delayRef][o2.func][o2.actPos] = (typeof delayArr[delayRef][o2.func][o2.actPos] !== 'undefined') ? delayArr[delayRef][o2.func][o2.actPos] : [];
if (delayArr[delayRef][o2.func][o2.actPos][o2.loopRef]) {
// console.log('Clear timeout before setting new one for ' + o2.func + ', ' + o2.actPos + ', ' + o2.loopRef);
_clearTimeouts(delayArr[delayRef][o2.func][o2.actPos][o2.loopRef]);
_removeCancel(delayRef, o2.func, o2.actPos, o2.loopRef);
}
o2.delayed = true;
if (aftEv == 'after') {
_setupLabelData(splitArr.lab, delayRef, o2.func, o2.actPos, o2.loopRef, setTimeout(_handleFunc.bind(this, o2, delayRef), splitArr.tim));
return;
}
o2.interval = true;
_setupLabelData(splitArr.lab, delayRef, o2.func, o2.actPos, o2.loopRef, setInterval(_handleFunc.bind(this, o2, delayRef), splitArr.tim));
// Carry on down and perform the first action. The interval has been set.
o.interval = true;
o.actValSing = splitArr.str;
}
}
} else {
o.actValSing = o.actVal;
}
// Remove any labels from the command string. We can't remove this earlier, as we need the label to exist for either "after" or "every", or both.
if (o.actValSing.indexOf('label ') !== -1) {
o.actValSing = o.actValSing.replace(/(label [\u00BF-\u1FFF\u2C00-\uD7FF\w_]+)(?=(?:[^"]|"[^"]*")*)/gm, '');
}
if (typeof o.secSel === 'string' && ['~', '|'].includes(o.secSel.substr(0, 1))) {
// Has this action been cancelled? If so, skip the action and remove the cancel.
if (cancelCustomArr[delayRef] && cancelCustomArr[delayRef][o.func] && cancelCustomArr[delayRef][o.func][o.actPos] && cancelCustomArr[delayRef][o.func][o.actPos][o.loopRef]) {
_removeCancel(delayRef, o.func, o.actPos, o.loopRef);
return;
}
}
// Is this a non-delayed action, if so, we can skip the cancel check.
if (o.delayed && cancelIDArr[delayRef] && cancelIDArr[delayRef][o.func]) return;
if (o.func == 'Var') {
// Special handling for var commands, as each value after the variable name is a JavaScript expression, but not within {= =}, to make it quicker to type.
o.actValSing = o.actValSing.replace(/__ACSS_int_com/g, ',');
}
o.actVal = _replaceAttrs(o.obj, o.actValSing, o.secSelObj, o, o.func, o.compRef);
// Show debug action before the function has occured. If we don't do this, the commands can go out of sequence in the Panel and it stops making sense.
if (debuggerActive || !setupEnded && typeof _debugOutput == 'function') {
_debugOutput(o); // A couple of extra objects variables are set in here, and we want them later for the feedback results (not yet implemented fully).
}
if (typeof _a[o.func] !== 'function') {
// Apply this as a CSS style if it isn't a function.
o.secSelObj.style[o.actName] = o.actVal;
} else {
// Run the function.
_a[o.func](o, scopedVars, privateScopes);
}
if (!o.interval) {
// We don't cleanup any timers if we are in the middle of an interval. Only on cancel, or if the element is no longer on the page.
_removeCancel(delayRef, o.func, o.actPos, o.loopRef);
}
// Handle general "after" callback. This check on the name needs to be more specific or it's gonna barf on custom commands that contain ajax or load. FIXME!
if (Object.keys(o.secSelObj).length === 0 && ['LoadConfig', 'Ajax', 'AjaxPreGet', 'AjaxFormSubmit', 'AjaxFormPreview'].indexOf(o.func) === -1) {
_handleEvents({ obj: o.secSelObj, evType: 'after' + o.actName._ACSSConvFunc(), otherObj: o.secSelObj, eve: o.e, afterEv: true, origObj: o.obj, compRef: o.compRef, compDoc: o.compDoc, component: o.component });
}
};
const _handleLoop = (loopObj) => {
let secSelLoops = loopObj.secSelLoops;
let compRef = loopObj.compRef;
// Which type of loop is it?
// This is here for when we start adding different types of loops. For now we don't need the check.
if (secSelLoops.substr(0, 6) == '@each ') {
loopObj.secSelLoops = loopObj.originalLoops; // sort this out - this won't work when it gets to nested loops - unnecessary method - see calling func.
// eg. @each name in person
// eg. @each name, age in person
// etc.
// It limits variables to the scope we are in.
// We need to allow nested loops too. This could require a rethink, but get a single level working first to ease the gradient of complexity.
let inPos = secSelLoops.indexOf(' in ');
let leftVar = secSelLoops.substr(6, inPos - 6);
let leftVars, eachLeftVar;
if (leftVar.indexOf(',') !== -1) {
// There is more than one left-hand assignment.
leftVars = leftVar.split(',');
}
let rightVar = secSelLoops.substr(inPos + 4);
// Note that we don't use the real value of the list object in the *replacement* value - it evaluates in the scope dynamically, so we don't attach the scope.
let rightVarReal = (compRef && privateScopes[compRef]) ? compRef + '.' + rightVar : 'main.' + rightVar;
let rightVarVal = _get(scopedVars, rightVarReal);
// The variables themselves get converted internally to the actual variable reference. By doing this, we can circumvent a whole bunch of complexity to do
// with setting up new variables, and handling {{var}} variable binding, as internally we are referring to the real variable and not the config reference.
// We do this by reading and replacing the remainder of this particular object with the correct values.
// We keep the original object, and make copies for use in _performSecSel as we do the following looping.
let newRef, loopObj2, i, j, key, val;
if (Array.isArray(rightVarVal)) {
// Get the rightVar for real and loop over it.
let rightVarValLen = rightVarVal.length;
for (i = 0; i < rightVarVal.length; i++) {
// Make a copy of loopObj. We're going to want original copies every time we substitute in what we want.
loopObj2 = Object.assign({}, loopObj);
if (!loopObj2.loopVars) loopObj2.loopVars = {};
if (!leftVars) {
// Single level array.
newRef = rightVar + '[' + i + ']';
loopObj2.loopVars[leftVar] = newRef;
loopObj2.loopRef = leftVar + '_' + i;
} else {
// Two dimensional array.
for (j in leftVars) {
eachLeftVar = leftVars[j].trim();
newRef = rightVar + '[' + i + ']' + '[' + j + ']';
loopObj2.loopVars[eachLeftVar] = newRef;
loopObj2.loopRef = eachLeftVar + '_' + i + '_' + j; // This will expand to include nested loop references and still needs work as this references multiple items.
}
}
_performSecSel(loopObj2);
}
} else {
let objValVar, co = 0;
for ([key, val] of Object.entries(rightVarVal)) {
loopObj2 = Object.assign({}, loopObj);
if (!loopObj2.loopVars) loopObj2.loopVars = {};
if (!leftVars) {
// Only referencing the key in the key, value pair. We just place the key value straight in - there is no auto-var substitution for a key.
// See _replaceLoopingVars for how this '-_-' works. It just places the value in, basically, and not a variable reference.
loopObj2.loopVars[leftVar] = '-_-' + key;
loopObj2.loopRef = leftVar + '_0_' + co;
} else {
loopObj2.loopVars[leftVars[0]] = '-_-' + key;
loopObj2.loopRef = leftVars[0] + '_0_' + co;
objValVar = leftVars[1].trim();
newRef = rightVar + '.' + key;
loopObj2.loopVars[objValVar] = newRef;
loopObj2.loopRef = objValVar + '_1_' + co;
}
co++;
_performSecSel(loopObj2);
}
}
} else {
_performSecSel(loopObj);
}
};
const _handleVarsInJS = function(str) {
/**
* "str" is the full JavaScript content that is being prepared for evaluation.
* This function finds any "vars" line that declares any Active CSS variables that will be used, and locates and substitutes these variables into the code
* before evaluation. A bit like the PHP "global" command, except in this case we are not declaring global variables. We are limiting all variables to the
* scope of Active CSS. All the ease of global variables, but they are actually contained within Active CSS and not available outside Active CSS. Global variables can still
* be used by using window['blah']. But private variables to Active CSS is, and should always be, the default.
* 1. Names of variables get substituted with reference to the scopedVars container variable for the scoped variables, which is private to the Active CSS IIFE.
* This is literally just an insertion of "scopedVars." before any matching variable name.
* 2. Variables enclosed in curlies get substituted with the value of the variable itself. This would be for rendered contents.
* Note: This could be optimised to be faster - there's bound to be some ES6 compatible regex magic that will do the job better than this.
*/
let mapObj = {}, mapObj2 = {};
let found = false;
str = str.replace(/[\s]*vars[\s]*([\u00BF-\u1FFF\u2C00-\uD7FF\w_\, ]+)[\s]*\;/gi, function(_, varList) {
// We should have one or more variables in a comma delimited list. Split it up.
let listArr = varList.split(','), thisVar;
// Remove dupes from the list by using the Set command.
listArr = [...new Set(listArr)];
let negLook = '(?!\\u00BF-\\u1FFF\\u2C00-\\uD7FF\\w)';
found = true;
for (thisVar of listArr) {
thisVar = thisVar.trim();
mapObj[negLook + '(' + thisVar + ')' + negLook] = '';
mapObj2[thisVar] = 'scopedVars[_activeVarScope].' + thisVar;
}
return ''; // Return an empty line - the vars line was Active CSS syntax, not native JavaScript.
});
if (found) {
// We don't want variables in quotes to show the internal variable name. And the solution needs to cater for escaped quotes.
// At this point there is an array of regexes for all the variables we want to replace.
// Bear in mind that there is a lot of regex stuff going on here.
str = str.replace(/\\"/g, 'cjs_tmp-dq');
str = str.replace(/\\'/g, 'cjs_tmp-sq');
// By this point we should have a handy array of all the variables to be used in the native JavaScript.
// We are going to used this as a regex map to substitute scoped prefixes into the code. But we use a non-regex replace object.
str = ActiveCSS._mapRegexReturn(mapObj, str, mapObj2);
// Remove any substituted vars prefixes in quotes, as the user won't want to see those in their internal form.
// There's probably a faster way of doing this, but my regex brain isn't totally switched on today. Help if you can!
// Just want to remove any /scopedVars\[_activeVarScope\]\./ anywhere in single or double quotes catering for escaped quotes.
// If you can do that, lines 37, 38, 49 and 50 can go.
str = str.replace(/(["|'][\s\S]*?["|'])/gim, function(_, innards) {
return innards.replace(/scopedVars\[_activeVarScope\]\./g, '');
});
str = str.replace(/cjs_tmp\-dq"/g, '\\"');
str = str.replace(/cjs_tmp\-sq/g, "\\'");
}
return str;
};
const _mainEventLoop = (typ, e, component, compDoc, compRef) => {
if (e.target.id == 'cause-js-elements-ext') return; // Internally triggered by extension to get bubble state. Don't run anything.
let el;
let bod = (e.target == self || e.target.body) ? true : false;
if (typ != 'click' && bod) {
// Run any events on the body, followed by the window.
_handleEvents({ obj: 'body', evType: typ, eve: e });
_handleEvents({ obj: 'window', evType: typ, eve: e });
return;
} else if (e.primSel) {
el = e.secSelObj;
} else {
if (typ == 'click' && e.button !== 0) return; // We only want the left button.
el = e.target; // Take in the object if called direct, or the event.
}
if (typ == 'mouseover' && !bod) {
if (el.tagName == 'A' && el['data-active-nav'] !== 1) {
// Set up any attributes needed for navigation from the routing declaration if this is being used.
_setUpNavAttrs(el);
}
}
if (typ == 'click' && e.primSel != 'bypass') {
// Check if there are any click-away events set.
// true above here means just check, don't run.
if (clickOutsideSet && !_handleClickOutside(el)) {
if (!e.primSel) {
e.preventDefault();
}
return false;
}
}
let composedPath;
composedPath = _composedPath(e);
// Certain rules apply when handling events on the shadow DOM. This is important to grasp, as we need to reverse the order in which they happen so we get
// natural bubbling, as Active CSS by default uses "capture", which goes down and then we manually go up. This doesn't work when using shadow DOMs, so we have
// to get a bit creative with the handling. Event listeners occur in the order of registration, which will always give us a bubble down effect, so we have to
// do a manual bubble up and skip the first events if they are not related to the document or shadow DOM of the real target.
let realItem = composedPath[0];
if (_getRootNode(realItem).isEqualNode(document) || e.target.isEqualNode(realItem)) {
// We do not run parent events of shadow DOM nodes - we only process the final events that run on the actual target, and then bubble up through
// composedPath(). *Fully* cloning the event object (with preventDefault() still functional) is not currently supported in browsers, understandably, so
// re-ordering of real events is not possible, so we have to skip these. The reason being that preventDefault will break on events that have already bubbled,
// and cloning and running an event object later on means that any bubbling will happen before the re-run, thus rendering preventDefault() unusable, and we
// do still need it for cancelling browser behaviour. So therefore preventDefault() will correctly fatally error if cloned and re-used.
for (el of composedPath) {
if (el.nodeType !== 1) continue;
// This could be an object that wasn't from a loop. Handle any ID or class events.
if (typ == 'click' && el.tagName == 'A' && el['data-active-nav'] !== 1) {
// Set up any attributes needed for navigation from the routing declaration if this is being used.
_setUpNavAttrs(el);
}
// Is this in the document root or a shadow DOM root?
let rootNode = _getRootNode(el);
// if (supportsShadow && rootNode instanceof ShadowRoot) {
if (!rootNode.isEqualNode(document)) {
// Get the component variables so we can run this element's events in context.
let rootNodeHost = rootNode;
if (supportsShadow && rootNode instanceof ShadowRoot) {
rootNodeHost = rootNode.host;
}
component = rootNodeHost._acssComponent;
compDoc = rootNode;
compRef = rootNodeHost._acssCompRef;
} else {
component = null;
compDoc = null;
compRef = null;
}
_handleEvents({ obj: el, evType: typ, eve: e, component: component, compDoc: compDoc, compRef: compRef });
if (!el || !e.bubbles || el.tagName == 'BODY' || el.activeStopProp) break; // el can be deleted during the handleEvent.
}
if (el && el.activeStopProp) {
el.activeStopProp = false;
} else {
if (document.parentNode) _handleEvents({ obj: window.frameElement, evType: typ, eve: e });
}
}
};
const _passesConditional = (el, sel, condList, thisAction, otherEl, doc, compRef, component, eve, compDoc) => {
// This takes up any conditional requirements set. Checks for "conditional" as the secondary selector.
// Note: Scoped shadow conditionals look like "|(component name)|(conditional name)", as opposed to just (conditional name).
let firstChar, chilsObj, key, obj, func, excl, i, checkExcl, exclLen, eType, eActual, exclArr, exclTargs, exclDoc, iframeID, res, aV;
// Loop conditions attached for this check. Split conditions by spaces not in parentheses.
let cond, conds = condList.split(/ (?![^\(\[]*[\]\)])/), rules, exclusions, nonIframeArr = [];
let elC = (thisAction == 'clickoutside' && otherEl) ? otherEl : el; // use click target if clickoutside.
let actionBoolState = false;
let newCondVal, condVals, condValsLen, n;
for (cond of conds) {
let parenthesisPos = cond.indexOf('(');
if (parenthesisPos !== -1) {
// This is a direct reference to a command. See if it is there.
let commandName = cond.substr(0, parenthesisPos);
actionBoolState = false;
if (commandName.substr(0, 4) == 'not-') {
func = commandName.substr(4);
} else if (commandName.substr(0, 1) == '!') {
func = commandName.substr(1);
} else {
actionBoolState = true;
func = commandName;
}
func = func._ACSSConvFunc();
if (typeof _c[func] === 'function') {
// Comma delimit for multiple checks in the same function.
let aV = cond.slice(parenthesisPos + 1, -1).trim().replace(/"[^"]*"|(\,)/g, function(m, c) {
// Split conditionals by comma.
if (!c) return m;
return '_ACSSComma';
});
aV = _replaceAttrs(el, aV, null, null, null, compRef); // Using the document of the primary selector is what we want.
aV = (otherEl && otherEl.loopRef != '0') ? _replaceLoopingVars(aV, otherEl.loopVars) : aV;
condVals = aV.split('_ACSSComma');
condValsLen = condVals.length;
for (n = 0; n < condValsLen; n++) {
if (_c[func]({
'func': func,
'actName': commandName,
'secSel': 'conditional',
'secSelObj': el,
'actVal': condVals[n].trim(),
'primSel': sel,
'rules': cond,
'obj': el,
'e': eve,
'doc': doc,
'ajaxObj': otherEl,
'component': component,
'compDoc': compDoc,
'compRef': compRef
}, scopedVars, privateScopes) !== actionBoolState) {
return false; // Barf out immediately if it fails a condition.
}
}
}
continue;
}
if (component) {
cond = '|' + component + '|' + cond;
if (typeof conditionals[cond] === 'undefined') {
let condErr = cond.substr(component.length + 2);
console.log('Active CSS error: Conditional ' + condErr + ' not found in config for component ' + component);
}
}
rules = conditionals[cond];
if (rules) {
// This is reference to a custom conditional and not a conditional command.
for (key in rules) {
if (!rules.hasOwnProperty(key)) continue;
obj = rules[key];
if (obj.name.substr(0, 1) == '!') {
actionBoolState = false;
func = obj.name.substr(1);
} else {
actionBoolState = true;
func = obj.name;
}
func = func._ACSSConvFunc();
if (typeof _c[func] === 'function') {
// Call the conditional function is as close a way as possible to regular functions.
// Comma delimit for multiple checks on the same statement.
let aV = obj.value.replace(/"[^"]*"|(\,)/g, function(m, c) {
// Split conditionals by comma.
if (!c) return m;
return '_ACSSComma';
});
aV = _replaceAttrs(el, aV, null, null, null, compRef); // Using the document of the primary selector is what we want.
aV = (otherEl && otherEl.loopRef != '0') ? _replaceLoopingVars(aV, otherEl.loopVars) : aV;
condVals = aV.split('_ACSSComma');
condValsLen = condVals.length;
for (n = 0; n < condValsLen; n++) {
if (_c[func]({
'func': func,
'actName': obj.name,
'secSel': 'conditional',
'secSelObj': el,
'actVal': condVals[n].trim(),
'primSel': sel,
'rules': rules,
'obj': el,
'e': eve,
'doc': doc,
'ajaxObj': otherEl,
'component': component,
'compDoc': compDoc,
'compRef': compRef
}, scopedVars, privateScopes) !== actionBoolState) {
return false; // Barf out immediately if it fails a condition.
}
}
}
}
} else {
// Check if this is a direct reference to a conditional command.
console.log('Active CSS error: Conditional ' + cond + ' not found in config for document scope.');
}
}
// Gotten through all the conditions - event actions are ok to run.
return true;
};
const _performAction = (o, runButElNotThere=false) => {
// All attr... actions pass through here.
if (o.doc.readyState && o.doc.readyState != 'complete') {
// Iframe not ready, come back to this in 200ms.
setTimeout(_performAction.bind(this, o), 200);
return false;
}
// Just do the actions with no loops on the secSel.
_performActionDo(o, null, runButElNotThere);
};
const _performActionDo = (o, loopI=null, runButElNotThere=false) => {
// Substitute any ajax variable if present. Note {@i} should never be in secSel at this point, only a numbered reference.
if (!o.secSel && !runButElNotThere) return;
// Split action by comma.
let newActVal = o.actVal;
if (o.actVal.indexOf(',') !== -1) { // Note this could be optimized with a single split regex.
// Remove commas in brackets from what is coming up in the next replace.
newActVal = newActVal.replace(/\(.*?\)/g, function(m, c) {
return m.replace(/,/g, '_ACSStmpcomma_');
});
// Replace all commas not in quotes with a split delimiter for multiple action values.
newActVal = newActVal.replace(/"[^"]*"|(\,)/g, function(m, c) {
if (!c) return m;
return '_ACSSComma';
});
// Put any commas in brackets back.
newActVal = newActVal.replace(/_ACSStmpcomma_/g, ',');
}
if (o.func == 'Var') {
// Special handling for var commands, as each value is a JavaScript expression, but not in {= =}, to make it quicker to type.
newActVal = ActiveCSS._sortOutFlowEscapeChars(newActVal);
// Now escape any commas inside any kind of brackets.
newActVal = _escCommaBrack(newActVal, o);
}
// Store the original copies of the action values before we start looping secSels.
let actValsLen, actVals = newActVal.split('_ACSSComma'), comm, activeID;
actValsLen = actVals.length;
let pars = { loopI: loopI, actVals: actVals, actValsLen: actValsLen };
if (typeof o.secSel == 'string' && !['~', '|'].includes(o.secSel.substr(0, 1))) {
// Loop objects in secSel and perform the action on each one. This enables us to keep the size of the functions down.
let checkThere = false, activeID;
if (o.secSel == '#') {
console.log('Error: ' + o.primSel + ' ' + o.event + ', ' + o.actName + ': "' + o.origSecSel + '" is being converted to "#". Attribute or variable is not present.');
}
let useSecSel = _prepSelector(o.secSel, o.obj);
o.doc.querySelectorAll(useSecSel).forEach(function (obj) {
// Loop over each secSec object and handle all the action commands for each one.
checkThere = true;
let oCopy = Object.assign({}, o);
_actionValLoop(oCopy, pars, obj);
});
if (!checkThere) {
// If the object isn't there, we run it with the remembered object, as it could be from a popstate, but only if this is top-level action command.
// Only by doing this can we ensure that this is an action which will only target elements that exist.
let oCopy = Object.assign({}, o);
if (o.secSel.lastIndexOf('data-activeid') !== -1) {
oCopy.actVal = _replaceAttrs(oCopy.obj, oCopy.actValSing, oCopy.secSelObj, oCopy, oCopy.func, oCopy.compRef);
_actionValLoop(o, pars, oCopy.obj, runButElNotThere);
}
}
} else {
let oCopy = Object.assign({}, o);
// Send the secSel to the function, unless it's a custom selector, in which case we don't.
if (typeof oCopy.secSel == 'object') {
_actionValLoop(o, pars, oCopy.secSel);
} else {
// Is this a custom event selector? If so, don't bother trying to get the object. Trust the developer doesn't need it.
if (['~', '|'].includes(oCopy.secSel.substr(0, 1))) {
_actionValLoop(o, pars, {});
}
}
/* Feedback commented out for the moment - this will be part of a later extension upgrade.
if (debuggerActive || !setupEnded && typeof _debugOutput == 'function') {
// Show any feedback available at this point. Note ajax call results will feedback elsewhere.
_debugOutputFeedback(oCopy);
}
*/
}
};
const _performSecSel = (loopObj) => {
let chilsObj = loopObj.chilsObj;
let secSelLoops = loopObj.secSelLoops;
let obj = loopObj.obj;
let compDoc = loopObj.compDoc || document;
let evType = loopObj.evType;
let compRef = loopObj.compRef;
let evObj = loopObj.evObj;
let otherObj = loopObj.otherObj;
let passCond = loopObj.passCond;
let sel = loopObj.sel;
let component = loopObj.component;
let selectorList = loopObj.selectorList;
let eve = loopObj.eve;
let loopVars = loopObj.loopVars;
let loopRef = (!loopObj.loopRef) ? 0 : loopObj.loopRef;
let runButElNotThere = loopObj.runButElNotThere;
// In a scoped area, the variable area is always the component variable area itself so that variables used in the component are always available despite
// where the target selector lives. So the variable scope is never the target scope. This is why this is not in _splitIframeEls and shouldn't be.
if (supportsShadow && compDoc instanceof ShadowRoot) {
compRef = '_' + compDoc.host.getAttribute('data-activeid').replace(/id\-/, '');
} else if (!compDoc.isEqualNode(document) && compDoc.hasAttribute('data-active-scoped')) {
// This must be a scoped component.
compRef = '_' + compDoc.getAttribute('data-activeid').replace(/id\-/, '');
} else {
compRef = (evObj.compRef) ? evObj.compRef : null;
}
// Get the selectors this event is going to apply to.
let targetSelector, targs, doc, passTargSel, meMap = [ '&', 'self', 'this' ], activeTrackObj = '', m, tmpSecondaryFunc, actionValue;
for (targetSelector in chilsObj[secSelLoops]) {
if (targetSelector == 'conds') continue; // skip the conditions.
// Get the correct document/iframe/shadow for this target.
targs = _splitIframeEls(targetSelector, obj, compDoc); // Note - here it is compDoc as we are doing this in relation to the
if (!targs) continue; // invalid target.
doc = targs[0];
passTargSel = targs[1];
// passTargSel is the string of the target selector that now goes through some changes.
if (loopRef != '0') passTargSel = _replaceLoopingVars(passTargSel, loopVars);
passTargSel = _replaceAttrs(obj, passTargSel, null, null, null, compRef);
// See if there are any left that can be populated by the passed otherObj.
passTargSel = _replaceAttrs(otherObj, passTargSel, null, null, null, compRef);
// Handle functions being run on self.
if (meMap.includes(passTargSel)) {
// It's not enough that we send an object, as we may need to cancel delay and we need to be able to store this info.
// It won't work unless we can identify it later and have it selectable as a string.
if (typeof obj == 'string') { // passed in as a string - skip it, this is already a string selector.
passTargSel = obj;
} else {
activeTrackObj = _getActiveID(obj);
if (activeTrackObj) {
passTargSel = '[data-activeid="' + activeTrackObj + '"]';
} else {
// It might not be an element, so a data-activeid wasn't assigned.
passTargSel = obj;
}
}
} else if (passTargSel == 'host') {
let rootNode = _getRootNode(obj);
passTargSel = (rootNode._acssScoped) ? rootNode : rootNode.host;
}
let act;
for (m in chilsObj[secSelLoops][targetSelector]) {
tmpSecondaryFunc = chilsObj[secSelLoops][targetSelector][m].name._ACSSConvFunc();
// Generate the object that performs the magic in the functions.
actionValue = chilsObj[secSelLoops][targetSelector][m].value;
// Note: this can be optionally optimised by putting all the rules into the secondary selecor
// rather than a whole array each time. Micro-optimising, but for a large project it is a good idea.
act = {
event: evType,
func: tmpSecondaryFunc,
actName: chilsObj[secSelLoops][targetSelector][m].name,
secSel: passTargSel,
origSecSel: targetSelector, // Used for debugging only.
actVal: actionValue,
origActVal: actionValue,
primSel: selectorList[sel],
rules: chilsObj[secSelLoops][targetSelector],
obj: obj,
doc: doc,
ajaxObj: otherObj,
e: eve,
passCond: passCond,
file: chilsObj[secSelLoops][targetSelector][m].file,
line: chilsObj[secSelLoops][targetSelector][m].line,
activeID: activeTrackObj,
compRef: compRef, // unique counter of the shadow element rendered - used for variable scoping.
compDoc: compDoc,
component: component,
loopVars: loopVars,
loopRef: loopRef
};
_performAction(act, runButElNotThere);
}
}
};
const _prepSelector = (sel, obj) => {
// This is currently only being used for secondary selectors, as action command use of "&" needs more nailing down before implementing - see roadmap.
if (sel.indexOf('&') !== -1) {
// Handle any "&" in the selector.
// Eg. "& div" becomes "[data-activeid=25] div".
if (sel.substr(0, 1) == '&') {
// Substitute the active ID into the selector.
let activeID = _getActiveID(obj);
sel = sel.replace(/&/g, '[data-activeid=' + activeID + ']');
}
}
return sel;
};
const _processSecSelLoops = (loopObj) => {
// Strip off any preceding component that might be there.
let newloop = loopObj.secSelLoops.replace(loopObj.component + '|||', '');
if (newloop.substr(0, 6) == '@each ') {
// Just replace the value for now - we're going to tackle nested loops later on.
loopObj.secSelLoops = newloop;
// Nested loops are not currently supported.
_handleLoop(loopObj);
} else {
// Go straight into the actions - no loops here.
_performSecSel(loopObj);
}
};
const _renderCompDoms = (o, compDoc=o.doc) => {
// Set up any shadow DOM and scoped components so far unrendered and remove these from the pending shadow DOM and scoped array that contains the HTML to draw.
// Shadow DOM and scoped content strings are already fully composed with valid Active IDs at this point, they are just not drawn yet.
// Search for any data-acss-component tags and handle.
compDoc.querySelectorAll('data-acss-component').forEach(function (obj, index) {
_renderCompDomsDo(o, obj);
// Quick way to check if shadow DOMs and scoped variables are being cleaned up. Leave this here please.
// At any time, only the existing scoped vars and shadows should be shown.
// console.log('Current shadow DOMs');
// console.log(shadowDoms);
// console.log('scopedData:');
// console.log(scopedData);
// console.log('scopedVars:');
// console.log(scopedVars);
});
};
const _renderCompDomsClean = compRef => {
delete compPending[compRef];
// Clean up any shadow DOMs no longer there. Mutation observer doesn't seem to work on shadow DOM nodes. Fix if this is not the case.
let shadTmp, shadObj;
for ([shadTmp, shadObj] of Object.entries(shadowDoms)) {
if (!shadObj.isConnected) {
// Delete any variables scoped to this shadow. This will also trigger the deletion of the shadow from the shadowDoms object in _varUpdateDom.
delete scopedVars[shadTmp];
}
}
};
const _renderCompDomsDo = (o, obj) => {
let shadowParent, shadowMode, shadRef, compRef, componentName, template, shadow, shadPar, shadEv;
shadowParent = obj.parentNode;
shadRef = obj.getAttribute('data-ref');
// Determine if this is a shadow or a scoped component. We can tell if the mode is set or not.
componentName = obj.getAttribute('data-name');
shadowParent.removeChild(obj); // Remove the shadow DOM reference tag.
shadowMode = components[componentName].mode;
if (shadowMode && shadowParent.shadowRoot || !shadowMode && shadowParent._acssScoped) {
// This is an additional render covering the same area, but we already have this covered. I don't think we can check this any earlier as an additional
// component may be required in the same render in the same html string. It's worth looking over this again at a later date.
_renderCompDomsClean(shadRef);
return;
}
compRef = _getActiveID(shadowParent).replace('id-', '_');
// Set the variable scope up for this area. It is really important this doesn't get moved otherwise the first variable set in the scope will only initialise
// the scope and not actually set up the variable, causing a hard-to-debug "variable not always getting set" scenario.
if (typeof scopedVars[compRef] === 'undefined') {
scopedVars[compRef] = {};
}
// Set up a private scope reference if it is one so we don't have to pass around this figure.
// Note that the scope name, the compRef, is not the same as the component name. The compRef is the reference of the unique scope.
// Hence we need to do this at this point in the code.
privateScopes[compRef] = components[componentName].priv ? true: false;
// Run a beforeComponentOpen custom event before the shadow is created. This is run on the host object.
// This is useful for setting variables needed in the component itself. It solves the flicker issue that can occur when dynamically drawing components.
// The variables are pre-scoped to the shadow before the shadow is drawn.
// The scope reference is based on the Active ID of the host, so everything can be set up before the shadow is drawn.
_handleEvents({ obj: shadowParent, evType: 'beforeComponentOpen', compRef: compRef, compDoc: shadow, component: componentName });
compPending[shadRef] = _replaceAttrs(o.obj, compPending[shadRef], null, null, o.func, compRef);
compPending[shadRef] = _replaceComponents(o, compPending[shadRef]);
// Now we can go through the shadow DOM contents and handle any host attribute references now that the host is set up.
compPending[shadRef] = _replaceScopedVars(compPending[shadRef], o.secSelObj, o.func, o, false, shadowParent, compRef);
// Lastly, handle any {$STRING} value from ajax content if it exists. This must be done last, otherwise we risk var replacement changing content of the $STRING.
compPending[shadRef] = (compPending[shadRef].indexOf('{$') !== -1) ? _replaceStringVars(o.ajaxObj, compPending[shadRef]) : compPending[shadRef];
template = document.createElement('template');
template.innerHTML = compPending[shadRef];
// Remove the pending shadow DOM instruction from the array as it is about to be drawn, and some other clean-up.
_renderCompDomsClean(shadRef);
if (shadowMode) {
try {
shadow = shadowParent.attachShadow({mode: shadowMode});
} catch(err) {
console.log('Active CSS error in attaching a shadow DOM object. Ensure the shadow DOM has a valid parent *tag*. The error is: ' + err);
}
} else {
shadow = shadowParent;
shadow.setAttribute('data-active-scoped', '');
shadow._acssScoped = true;
}
// Store the component name in the element itself. We don't need to be able to select with it internally, so it is just a property so we don't clutter the
// html more than we have to. It is used by the Elements extension for locating related events, which requires the component name, and we have the element at
// that point so we don't need to search for it.
shadowParent._acssComponent = componentName;
shadowParent._acssCompRef = compRef;
shadowDoms[compRef] = shadow;
// Get the actual DOM, like document or shadow DOM root, that may not actually be shadow now that we have scoped components.
actualDoms[compRef] = (shadowMode) ? shadow : shadow.getRootNode();
// Attach the shadow.
shadow.appendChild(template.content);
// Run a componentOpen custom event, and any other custom event after the shadow is attached with content. This is run on the host object.
setTimeout(function() {
_handleEvents({ obj: shadowParent, evType: 'componentOpen', compRef: compRef, compDoc: shadow, component: componentName });
shadow.querySelectorAll('*').forEach(function(obj) {
if (obj.tagName == 'DATA-ACSS-COMPONENT') {
// Handle any shadow DOMs now pending within this shadow DOM.
_renderCompDomsDo(o, obj);
return;
}
// Run draw events on all new elements in this shadow. This needs to occur after componentOpen.
_handleEvents({ obj: obj, evType: 'draw', otherObj: o.ajaxObj, compRef: compRef, compDoc: shadow, component: componentName });
});
}, 0);
if (shadowMode) {
// Now add all possible window events to this shadow, so we can get some proper bubbling order going on when we handle events that don't have any real event
// in the shadow. We have to do this - it's to do with future potential events being added during runtime and the necessity of being able to trap them in the
// real target so we can initiate true bubbling.
// Note that this looks "great - why don't we add it to the main set event stuff?" The reason being that we want to setup on only the events we use, and not all
// events. We don't want to slow up the document unnecessarily. But we have to for shadow DOMs otherwise we never get a proper event target and we can't bubble.
// We can't bubble because we bubble only on the target. We skip upper parent DOM events altogether, which are registered in the wrong order for bubbling, and
// we can't manipulate the order of those because browsers do not allow a true clone of an event object and everything goes weird.
// Basically, if you click on a sub-shadow DOM element and there is no event set on the DOM, it does not trigger IN the shadow DOM. The target is never reached.
// So we make sure there is always going to be a shadow DOM event triggered by setting up all possible events. Technically overkill, but we have to do this.
// It would be nice if there was a way to get the truly real target on any click, regardless of whether or not it is in a shadow DOM, but that would partly
// defeat the point of shadow DOMs. Thankfully there is e.composedPath(), otherwise we'd be royally buggered.
let thisEv;
if (allEvents.length == 0) {
Object.keys(window).forEach(key => {
if (/^on/.test(key)) {
thisEv = key.slice(2);
allEvents.push(thisEv);
_attachListener(shadow, thisEv, componentName, shadow, compRef); // for speed.
}
});
} else {
for (thisEv of allEvents) {
_attachListener(shadow, thisEv, componentName, shadow, compRef);
}
}
}
};
const _renderIt = (o, content) => {
// All render functions end up here.
// Convert the string into a node tree. Shadow DOMs and scoped components are handled later on. Every render command goes through here, even ones from render
// events that get drawn in _renderCompDoms. It's potentially recursive. We need to handle the draw event for any non-shadow renders. Using a mutation observer
// has proven to be over-wieldy due to the recursive nature of rendering events within and outside components, so we'll use a simple analysis to pin-point
// which new elements have been drawn, and manually set off the draw event for each new element as they get drawn. This way we shouldn't get multiple draw
// events on the same element.
let template = document.createElement('template');
template.innerHTML = content;
// Make a list of all immediate children via a reference to their Active IDs. After rendering we then iterate the list and run the draw event.
let drawArr = [], item, cid;
template.content.childNodes.forEach(function (nod) { // This should only be addressing the top-level children.
if (nod.nodeType !== Node.ELEMENT_NODE) return; // Skip non-elements.
if (nod.tagName == 'DATA-ACSS-COMPONENT') return; // Skip pending data-acss-component tags.
cid = _getActiveID(nod);
drawArr.push(cid);
});
content = template.innerHTML;
if (o.renderPos) {
o.secSelObj.insertAdjacentHTML(o.renderPos, content);
} else {
o.secSelObj.innerHTML = content;
}
for (item of drawArr) {
let el = o.doc.querySelector('[data-activeid=' + item + ']');
if (el.shadow || el.scoped) continue; // We can skip tags that already have shadow or scoped components.
_handleEvents({ obj: el, evType: 'draw', otherObj: o.ajaxObj, compRef: o.compRef, compDoc: o.compDoc, component: o.component });
el.querySelectorAll('*').forEach(function(obj) { // jshint ignore:line
if (obj.tagName == 'DATA-ACSS-COMPONENT') return; // Skip pending data-acss-component tags.
_handleEvents({ obj: obj, evType: 'draw', otherObj: o.ajaxObj, compRef: o.compRef, compDoc: o.compDoc, component: o.component });
});
}
_renderCompDoms(o);
};
const _replaceLoopingVars = (str, loopVars) => {
if (str.indexOf('{') !== -1) {
str = str.replace(/\{([\u00BF-\u1FFF\u2C00-\uD7FF\w_\-]+)(\}|\.|\[)/gm, function(_, wot, endBit) {
if (loopVars[wot]) {
if (loopVars[wot].substr(0, 3) == '-_-') {
// This is a key of an object. Just return the value itself. No auto-change option for object keys, only values.
return loopVars[wot].substr(3);
} else {
// This matches a variable reference. Substitute with the real variable location reference.
return '{' + loopVars[wot] + endBit;
}
} else {
// This variable is not in the substitution list.
return '{' + wot + endBit;
}
});
}
return str;
};
const _runInnerEvent = (sel, ev, doc=document) => {
if (typeof sel == 'string') {
doc.querySelectorAll(sel).forEach(function(obj) {
_handleEvents({ obj: obj, evType: ev });
});
} else {
// This is a draw trigger on an element, which should include its contents.
_handleEvents({ obj: sel, evType: ev });
_runInnerEvent('*', ev, sel);
}
};
const _setUpNavAttrs = (el) => {
let hrf, templ, shortAttr, navEl;
templ = document.querySelector('#data-active-pages');
if (templ) {
shortAttr = el.getAttribute('href');
if (shortAttr) {
navEl = templ.querySelector('a[href="' + shortAttr + '"]');
if (navEl) {
_cloneAttrs(el, navEl);
}
}
}
};
const _splitIframeEls = (sel, relatedObj=null, compDoc=null) => {
let targSel, iframeID;
let root = (relatedObj && typeof relatedObj == 'object') ? _getRootNode(relatedObj) : null;
let doc = document, hostIsShadow = false, hostIsScoped = false, splitSel = false;
if (root && !root.isEqualNode(document)) {
// This was called from within a shadow or scoped component object. The doc defaults to the shadowRoot or the scoped host.
doc = root;
if (supportsShadow && root instanceof ShadowRoot) {
hostIsShadow = true;
} else {
hostIsScoped = true;
}
}
if (sel.indexOf(' -> ') !== -1) {
// Handle any doc reference first.
splitSel = true;
let ref;
let refSplit = sel.split(' -> ');
let co = 0;
for (ref of refSplit) {
co++;
if (co == refSplit.length) break; // Break before we get to the last one.
if (ref == 'document') {
doc = document;
} else if (ref == 'parent') {
if (hostIsShadow) {
root = _getRootNode(root.host);
doc = root;
} else if (!hostIsScoped) {
// The parent is the host is the root in a scoped component, and doc is already set to the root.
} else if (window.parent.document) {
// Reference to an iframe host.
doc = window.parent.document;
} else {
console.log('Active CSS error. Reference to a parent element that doesn\'t exist.');
}
} else {
relatedObj = doc.querySelector(ref);
if (relatedObj.shadowRoot) {
doc = relatedObj.shadowRoot;
} else if (relatedObj.tagName == 'IFRAME') {
doc = relatedObj.contentWindow.document;
iframeID = ref;
} else {
console.log('ref ' + ref + ' is unknown.');
return false;
}
}
}
targSel = refSplit[refSplit.length - 1];
} else {
targSel = sel;
}
if (targSel == 'host') {
if (!hostIsScoped) {
root = _getRootNode(root.host);
doc = root;
} else {
doc = _getRootNode(root);
}
} else if (compDoc && !splitSel) {
// Use the default shadow doc. This could be a componentOpen, and unless there's a split selector involved, we need to default to the shadow doc provided.
doc = compDoc;
}
return [doc, targSel, iframeID];
};
const _addConfig = (str, o) => {
// Concatenate the config files before processing.
// Before we add the config, we want to add line numbers for debug.
let configLineArr = str.match(/^.*((\r\n|\n|\r)|$)/gm);
let newStr = '';
for (let n = 0; n < configLineArr.length; n++) {
newStr += '*debugfile:' + o.file + ':' + (n + 1) + '*' + configLineArr[n];
}
str = newStr;
concatConfig += str;
concatConfigCo++;
// If this is last file, run the config generator.
if (concatConfigCo >= concatConfigLen) _readSiteMap();
if (concatConfigCo > concatConfigLen) {
if (o.actName == 'load-config') {
configArr.push(o.avRaw); // Add the file without anything after and including the "?".
// Handle updating the extensions. Either or not of them could be showing, so they either get an immediate update, or a flag is set for them to
// update if they received the onShown event. Similar to the config update to the Panel whenever an element is edited in Elements.
// It's slightly different in that we need the additional optional step of the immediate update instead of the onShown triggered update, plus
// we need to update both Elements and Panel here, and not only the Panel as in the case of the edited element in Elements.
if (setupEnded) {
// Send a message to the extensions to update the config display. This goes to both extensions.
if (debuggerActive) {
_tellPanelToUpdate();
}
if (evEditorActive) {
_tellElementsToUpdate();
}
}
}
_handleEvents({ obj: 'body', evType: 'afterLoadConfig' });
_handleEvents({ obj: o.obj, evType: 'afterLoadConfig' });
}
};
const _addConfigError = (str, o) => {
// Needs an error handling.
_handleEvents({ obj: o.obj, evType: 'loadconfigerror' });
};
const _assignRule = (compConfig, sel, ev, condition, secsel, ruleName, ruleValue, ruleFile, ruleLine, eachLoop=null) => {
let rulePos;
// Leave this here please.
// console.log('_assignRule:');
// console.log('compConfig = ' + compConfig);
// console.log('sel = ' + sel);
// console.log('ev = ' + ev);
// console.log('condition = ' + condition);
// console.log('secsel = ' + secsel);
// console.log('ruleName = ' + ruleName);
// console.log('ruleValue = ' + ruleValue);
// console.log('ruleFile = ' + ruleFile);
// console.log('ruleLine = ' + ruleLine);
// console.log('eachLoop = ' + eachLoop);
if (typeof compConfig[sel] === 'undefined') { // needed for DevTools.
compConfig[sel] = {};
}
if (typeof compConfig[sel][ev] === 'undefined') { // needed for DevTools.
compConfig[sel][ev] = {};
}
if (typeof compConfig[sel][ev][condition] === 'undefined') {
compConfig[sel][ev][condition] = {};
}
eachLoop = (eachLoop) ? eachLoop : '0';
if (typeof compConfig[sel][ev][condition][eachLoop] === 'undefined') {
compConfig[sel][ev][condition][eachLoop] = {};
}
if (typeof compConfig[sel][ev][condition][eachLoop][secsel] === 'undefined') {
// Note this next here needs to be an array and not an object, as we do splicing and adding later on from DevTools,
// so we need to be flexible in the numbering.
compConfig[sel][ev][condition][eachLoop][secsel] = [];
}
// See if this rule already exists here.
rulePos = ActiveCSS._getPosOfRule(compConfig[sel][ev][condition][eachLoop][secsel], ruleName);
if (rulePos != -1) {
// Append to the end of the existing rule value with a comma. Assume the developer knows what he or she is doing.
compConfig[sel][ev][condition][eachLoop][secsel][rulePos].value += ', ' + ruleValue;
let newRuleFile = '', newRuleLine = '';
if (compConfig[sel][ev][condition][eachLoop][secsel][rulePos].file) {
newRuleFile = ',' + ruleFile;
newRuleLine = ',' + ruleLine;
}
compConfig[sel][ev][condition][eachLoop][secsel][rulePos].file += newRuleFile;
compConfig[sel][ev][condition][eachLoop][secsel][rulePos].line += newRuleLine;
return compConfig;
}
// Add as a new rule.
compConfig[sel][ev][condition][eachLoop][secsel].push({ name: ruleName, value: ruleValue, file: ruleFile, line: ruleLine });
return compConfig;
};
const _attachListener = (obj, ev, component, compDoc, compRef, reGenEvent=false) => {
let opts = { capture: true };
if (doesPassive) {
let componentRef = !component ? 'doc' : component;
if (nonPassiveEvents[componentRef] !== undefined &&
nonPassiveEvents[componentRef][ev] !== undefined &&
nonPassiveEvents[componentRef][ev] === true ||
passiveEvents === false
) {
opts.passive = false;
} else {
opts.passive = true;
}
}
if (doesPassive && reGenEvent) {
// We are interested in a change from a passive to a non-passive from the addition of a prevent-default now being added to the config.
// Any duplicate events added will get disregarded by the browser.
obj.removeEventListener(ev, ActiveCSS._theEventFunction, { capture: true });
// Clean up.
delete obj['_acss' + ev + 'EvComponent'];
delete obj['_acss' + ev + 'EvCompDoc'];
delete obj['_acss' + ev + 'EvCompRef'];
}
// JavaScript is very particular when it comes to removing event listeners. A bit too particular for my liking. Curried functions with pars don't seem to work.
obj['_acss' + ev + 'EvComponent'] = component;
obj['_acss' + ev + 'EvCompDoc'] = compDoc;
obj['_acss' + ev + 'EvCompRef'] = compRef;
obj.addEventListener(ev, ActiveCSS._theEventFunction, opts);
};
// Keep this in here. The only reason it needs to be scoped to the root of Active CSS is because we need to remove an identical event listener, and we can only
// do that if a real function is used and is scoped higher up.
ActiveCSS._theEventFunction = e => {
let ev = e.type;
let component = e.target['_acss' + ev + 'EvComponent'];
let compDoc = e.target['_acss' + ev + 'EvCompDoc'];
let compRef = e.target['_acss' + ev + 'EvCompRef'];
if (!setupEnded) return; // Wait for the config to fully load before any events start.
let fsDet = _fullscreenDetails();
switch (ev) {
case 'click':
if (!e.ctrlKey) { // Allow default behaviour if control key is used.
_mainEventLoop('click', e, component, compDoc, compRef);
}
break;
case 'keyup':
case 'keydown':
// A second Active CSS event is going to fire here to check if there is a specific key event.
let ctrlCheck = (e.ctrlKey) ? 'Ctrl' : '';
let shiftCheck = (e.shiftKey) ? 'Shift' : '';
let funcKey = e.key;
switch (e.key) {
case ':': funcKey = 'Colon'; shiftCheck = ''; break;
case ';': funcKey = 'Semicolon'; shiftCheck = ''; break;
case '{': funcKey = 'OpenCurly'; shiftCheck = ''; break;
case '}': funcKey = 'CloseCurly'; shiftCheck = ''; break;
case '"': funcKey = 'DoubleQuotes'; shiftCheck = ''; break;
case "'": funcKey = 'SingleQuote'; shiftCheck = ''; break;
case '?': funcKey = 'Question'; shiftCheck = ''; break;
case '!': funcKey = 'Exclamation'; shiftCheck = ''; break;
}
_mainEventLoop(ev + ctrlCheck + shiftCheck + funcKey, e, component, compDoc, compRef);
_mainEventLoop(ev, e, component, compDoc, compRef);
break;
case fsDet[1] + 'fullscreenchange':
_mainEventLoop(ev, e, component, compDoc, compRef);
if (fsDet[0]) {
_mainEventLoop('fullscreenEnter', e, component, compDoc, compRef);
} else {
_mainEventLoop('fullscreenExit', e, component, compDoc, compRef);
}
break;
default:
_mainEventLoop(ev, e, component, compDoc, compRef);
}
};
const _checkPassiveState = (componentName, ev) => {
if (doesPassive) {
let componentRef = !componentName ? 'doc' : componentName;
let realEv = ev; // Need to check for the key event, as the config event will be named differently, but the main key event needs to be set as not passive.
if (ev.substr(0, 3) == 'key') { // Micro-optimise, as it all adds up.
if (ev.substr(0, 5) == 'keyup') {
realEv = 'keyup';
} else if (ev.substr(0, 7) == 'keydown') {
realEv = 'keydown';
}
} // The fullscreen events shouldn't need any sort of treatment as they are at window level and you can't prevent default there.
if (typeof nonPassiveEvents[componentRef] === 'undefined') nonPassiveEvents[componentRef] = [];
if (typeof nonPassiveEvents[componentRef][realEv] !== true) {
nonPassiveEvents[componentRef][realEv] = true;
}
}
};
// Credit goes to to https://github.com/aramk/CSSJSON for the initial regex parser technique that started this whole project.
// If it wasn't for the initial successes regarding it, the project may not have gotten to where it is today.
// I owe you a pint, or if you don't drink then a large sandwich.
const _convConfig = (cssString, totOpenCurlies, co=0) => {
// Note: By this point in initialisation the config should be compatible for parsing in a similar fashion to CSS.
let node = { children: {}, attributes: {} }, match = null, count = 0, bits, sel, name, value, obj, newNode, commSplit;
while ((match = PARSEREGEX.exec(cssString)) !== null) {
if (co > totOpenCurlies) {
// Infinite loop checker.
// If the count goes above the total number of open curlies, we know we have a syntax error of an unclosed curly bracket.
console.log('Syntax error in config - possibly an incomplete set of curly brackets.');
return false;
}
if (match[PARSEDEBUG]) {
commSplit = match[PARSEDEBUG].split(':');
configFile = commSplit[1];
configLine = commSplit[2].substr(0, commSplit[2].length - 1);
} else if (match[PARSESEL]) {
co++;
name = match[PARSESEL].trim();
name = name.replace(/\*debugfile[\s\S]*?\*/g, '');
newNode = _convConfig(cssString, totOpenCurlies, co);
if (newNode === false) return false; // There's been a syntax error.
obj = {};
obj.name = _sortOutEscapeChars(name);
obj.value = newNode;
obj.line = configLine;
obj.file = configFile;
obj.type = 'rule';
node[count++] = obj;
} else if (match[PARSEEND]) { return node; // Found closing brace
} else if (match[PARSEATTR]) {
// Handle attributes.
// Remove any comments lurking.
var line = match[PARSEATTR].trim();
line = line.replace(/\*debugfile[\s\S]*?\*|([^:]|^)\/\/.*$/g, '');
var attr = PARSELINEX.exec(line);
if (attr) {
// Attribute
name = attr[1].trim();
value = attr[2].trim();
obj = {};
obj.name = _sortOutEscapeChars(name);
obj.value = _sortOutEscapeChars(value);
obj.type = 'attr';
obj.line = configLine;
obj.file = configFile;
node[count++] = obj;
} else {
node[count++] = line;
}
}
}
return node;
};
ActiveCSS._getPosOfRule = (list, item) => {
return _getValFromList(list, item, true);
};
const _initScriptTrack = () => {
document.querySelectorAll('script').forEach(function (obj, index) { scriptTrack.push(obj.src); });
};
const _iterateConditionals = (conditions, rules, sel) => {
var counter, ruleName, ruleValue;
Object.keys(rules).forEach(function(key) {
ruleName = rules[key].name;
if (!ruleName) return;
counter = conditions[sel].length;
conditions[sel][counter] = {};
conditions[sel][counter].name = ruleName;
conditions[sel][counter].value = rules[key].value;
conditions[sel][counter].file = rules[key].file;
conditions[sel][counter].line = rules[key].line;
});
return conditions;
};
const _iteratePageList = pages => {
if (!('content' in document.createElement('template'))) {
console.log('Browser does not support html5. Cannot instantiate page navigation.');
return;
}
let templ = document.createElement('template');
templ.id = 'data-active-pages';
var counter, page, attrs, el;
let rand = Math.floor(Math.random() * 10000000);
Object.keys(pages).forEach(function(key) {
page = pages[key].name;
if (!page) return;
if (pageList.indexOf(page) !== -1) {
console.log('Config error: Page ' + page + ' is referenced twice.');
}
attrs = pages[key].value.replace(/\{\$RAND\}/g, rand);
templ.insertAdjacentHTML('beforeend', '<a href=' + page.trim() + ' ' + attrs.trim() + '>');
});
document.body.appendChild(templ);
};
const _iterateRules = (compConfig, rules, sel, ev, condition, eachLoop=null, componentName=null) => {
let thisAct, ruleName, ruleValue, page, pageTitle, secsels, secselsLength, secsel, i, nam, val;
Object.keys(rules).forEach(function(key2) {
nam = rules[key2].name;
val = rules[key2].value;
if (!nam) return;
// Look for and handle any @each loop around potentially multiple secondary selectors.
if (['@each'].indexOf(rules[key2].name.substr(0, 5)) !== -1) {
// Recurse and set up each loop.
// Note: Nested loops are not supported as of version 2.0. The '|||' doesn't do much at all at the moment, although it allows each to run in components.
return _iterateRules(compConfig, val, sel, ev, condition, ((eachLoop) ? eachLoop + '|||' : '') + nam);
}
// Sort out actions addressed to the event selector, on the top-level with no secondary selector.
if (typeof val === 'string') {
// This is a top level action command directly under a primary selector. Assign it to the & secondary selector for use.
// This must always go to a &, because the target needs to reflect the item evented on, not the primary selector, which may include multiple elements.
// It needs to be able to refer to ONE element - the target which received the event.
// Ie. the event is on a class, which is in more than one element, but only one of them was clicked on. We want THAT one, not the whole class
// as the secondary selector. This is *really* important to remember, if anything in the code is optimised.
if (nam == 'prevent-default') _checkPassiveState(componentName, ev);
compConfig = _assignRule(compConfig, sel, ev, condition, '&', nam, val, rules[key2].file, rules[key2].line, eachLoop);
return;
}
page = '';
pageTitle = '';
for (thisAct in val) {
if (typeof val[thisAct].type === 'undefined') continue;
// Allow multiple secondary selectors. Split by comma.
secsels = nam.split(',');
secselsLength = secsels.length;
for (i = 0; i < secselsLength; i++) {
secsel = secsels[i].trim();
// Is this a web component being declared? If so, set it up.
// if (secsel.indexOf('-') !== -1) {
// // This could be a web component declaration. Set it up if it is. We just do a quick indexOf check for performance reasons on startup.
// secsel = _setUpWebComponent(secsel);
// }
if (secsel == '&' && nam == 'prevent-default') _checkPassiveState(componentName, ev);
compConfig = _assignRule(compConfig, sel, ev, condition, secsel, val[thisAct].name, val[thisAct].value, rules[key2].file, rules[key2].line, eachLoop);
}
}
});
return compConfig;
};
const _makeVirtualConfig = (subConfig='', mqlName='', componentName=null, eachLoop=null) => {
// Loop through the config, splitting up multi selectors and giving them their own entry. Put this into the config.
var pConfig = (subConfig !== '') ? subConfig : parsedConfig;
var str, strLength, i, strTrimmed, strTrimCheck, isComponent;
var selectorName, selectorProps, evSplit, ev, sel, isConditional;
Object.keys(pConfig).forEach(function(key) {
if (!pConfig[key].name) return;
selectorName = pConfig[key].name;
selectorProps = pConfig[key].value;
isConditional = false;
// Split by comma, but not any that are in parentheses, as those are in selector functions.
str = selectorName.split(/,(?![^\(\[]*[\]\)])/);
strLength = str.length;
for (i = 0; i < strLength; i++) {
strTrimmed = str[i].trim();
// This could be a component that has an event, so we force the below to skip recognising this as a component.
isComponent = (strTrimmed.substr(0, 11) == '@component ') ? true : false;
// First check if this is a part of a comma-delimited list of conditionals, then do other stuff to set up for the switch statement.
// It could look like '?cheese, ?trevor' or '?cheese, trevor', and they would all be conditionals, so these next lines cater for a missing ?.
let noQuestionMark;
strTrimCheck = (isConditional && (noQuestionMark = strTrimmed.indexOf('?') === -1)) ? '?' : (!isComponent || isComponent && str[i].indexOf(':') === -1) ? strTrimmed.slice(0, 1) : '';
switch (strTrimCheck) {
case '?':
// This is a conditional. This puts the conditional in memory for later use.
// When it comes to trapping the use of the conditional, the reference to it is set in the config
// for the event, so that is also part of setting up the config.
let condName = (noQuestionMark) ? strTrimmed : strTrimmed.substr(1);
if (componentName) {
condName = '|' + componentName + '|' + condName;
}
conditionals[condName] = (typeof conditionals[condName] === 'undefined') ? [] : conditionals[condName];
conditionals = _iterateConditionals(conditionals, pConfig[key].value, condName);
isConditional = true;
break;
case '@':
if (strTrimmed == '@pages') {
// This is a page list declaration. Append it to any others previously found.
_iteratePageList(pConfig[key].value);
} else if (isComponent) {
// This is an html component. Stored like the conditional but in a different place.
let compName = strTrimmed.split(' ')[1].trim();
if (!components[compName]) components[compName] = {};
// Does this have shadow DOM creation instructions? ie. shadow open or shadow closed. Default to open.
components[compName].mode = null;
components[compName].shadow = false;
components[compName].scoped = false;
components[compName].priv = false;
if ((strTrimmed + ' ').indexOf(' shadow ') !== -1) {
components[compName].shadow = true;
components[compName].mode = (strTrimmed.indexOf(' closed') !== -1) ? 'closed' : 'open';
}
if ((strTrimmed + ' ').indexOf(' private ') !== -1) {
components[compName].priv = true;
// Private variable areas are always scoped, as they need their own area.
// We get a performance hit with scoped areas, so we try and limit this to where needed.
// The only other place we have an area scoped is where events are within components. Shadow DOM is similar but has its own handling.
components[compName].scoped = true;
}
// Recurse and set up componentness.
_makeVirtualConfig(pConfig[key].value, '', compName);
// Handle no html content.
if (typeof components[compName].data == 'undefined') {
components[compName].data = '';
components[compName].file = '';
components[compName].line = '';
}
// Reset the component name, otherwise this will get attached to all the remaining events.
compName = '';
} else {
// This is a media query. Set it up and call the config routine again so the internal media query name can be attached to the events.
mqlName = _setupMediaQueryHandler(strTrimmed.slice(7).trim());
// Recurse and set up a conditional node.
_makeVirtualConfig(pConfig[key].value, mqlName);
// Reset the media query name, otherwise this will get attached to all the remaining events.
mqlName = '';
}
break;
default:
if (strTrimmed == 'html') {
if (componentName) {
// This is component html.
components[componentName].data = pConfig[key].value[0].value.slice(1, -1); // remove outer quotes;
components[componentName].data = components[componentName].data.replace(/\\\"/g, '"');
components[componentName].file = pConfig[key].value[0].file;
components[componentName].line = pConfig[key].value[0].line;
}
} else {
// This is an event.
// Could be colons in selector functions which we need to ignore in the split.
evSplit = strTrimmed.split(/:(?![^\(\[]*[\]\)])/);
// The first item in the array will always be the main selector, and the last will always be the event.
// The middle can be a mixture of conditions.
if (!evSplit[1]) { // This has no split selector entry and is an error.
console.log('"' + selectorName + '" ' + strTrimmed + ' is not a fully formed selector - it may be missing an event or have incorrect syntax. Or you have too many closing curly brackets.');
continue;
}
sel = evSplit.shift(); // Get the main selector (get the beginning clause and remove from array)
ev = evSplit.pop(); // Get the event (get the last clause and remove from array)
ev = ev.trim();
let predefs = [], conds = [];
if (evSplit) { // Only run this if there is anything left in the clause array.
// Loop the remaining selectors, pop out each one and assign to the correct place in the config.
// Ie. either after the selector for DOM queries, or as part of the conditional array that gets
// attached to the event.
let re, clause;
for (clause of evSplit) {
re = new RegExp(COLONSELS, 'g');
if (re.test(clause)) {
predefs.push(clause);
} else {
conds.push(clause);
}
}
}
// Does this need a media query conditional adding?
if (mqlName !== '') {
conds.push(mqlName);
}
if (predefs.length > 0) {
sel += ':' + predefs.join(':'); // Put the valid DOM selector clauses back.
}
// Set up the event in the config.
// If this is an event for a component, it gets a special handling compared to the main document. It gets a component prefix.
if (componentName) {
sel = '|' + componentName + ':' + sel;
shadowSels[componentName] = (typeof shadowSels[componentName] === 'undefined') ? [] : shadowSels[componentName];
shadowSels[componentName][ev] = true; // We only want to know if there is one event type per shadow.
// Targeted events get set up only when a shadow is drawn, as they are attached to the shadow, not the document. No events to set up now.
// All non-shadow components are now scoped so that events can occur in any component, if there are any events.
components[componentName].scoped = true;
}
config[sel] = (typeof config[sel] === 'undefined') ? {} : config[sel];
config[sel][ev] = (typeof config[sel][ev] === 'undefined') ? {} : config[sel][ev];
let conditionName;
if (conds.length === 0) {
conditionName = 0;
} else {
// Concat the conditions with a space.
conditionName = conds.join(' ');
}
preSetupEvents.push({ ev, sel });
config = _iterateRules(config, pConfig[key].value, sel, ev, conditionName, componentName);
}
}
}
});
if (subConfig !== '') return; // Return the sub-config - we just handled media query contents.
let debugConfig = (debugMode) ? _doDebug('config') : false;
if (debugConfig) {
Object.keys(config).sort().forEach(function(key) {
console.log(key, config[key]);
});
}
debugConfig = (debugMode) ? _doDebug('conditionals') : false;
if (debugConfig) {
Object.keys(conditionals).sort().forEach(function(key) {
console.log(key, conditionals[key]);
});
}
debugConfig = (debugMode) ? _doDebug('components') : false;
if (debugConfig) {
Object.keys(components).sort().forEach(function(key) {
console.log(key, components[key]);
});
}
};
ActiveCSS._mapRegexReturn = (mapObj, str, mapObj2=null) => {
if (typeof str !== 'string') return str; // If it's not a string, we don't have to replace anything. Here for speed.
let reg = new RegExp(Object.keys(mapObj).join('|'), 'gim');
str = str.replace(reg, function(matched){
if (!mapObj2) {
return mapObj[matched];
} else {
// Match with a second object, not the regex object.
return mapObj2[matched];
}
});
return str;
};
const _parseConfig = str => {
// Keep the parsing regex for the config arrays as simple as practical.
// The purpose of this script is to escape characters that may get in the way of evaluating the config sanely during _makeVirtualConfig.
// There may be edge cases that cause this to fail, if so let us know, but it's usually pretty solid for practical use.
// External debugging tools can be set up for line syntax checking - keep the engine at optimum speed.
// If someone wants to thrash test it, please let support know of any exceptional cases that should pass but don't.
// There are quite possibly unnecessary bits in the regexes. If anyone wants to rewrite any so they are more accurate, that is welcome.
// This sequence, and the placing into the config array after this, is why the core is so quick, even on large configs. Do not do manually looping on
// the main config. If you can't work out a regex for a new feature, let the main developers know and they'll sort it out.
// Remove all comments.
str = str.replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm, '');
// Remove line-breaks, etc., so we remove any multi-line weirdness in parsing.
str = str.replace(/[\r\n\t]+/g, '');
// Replace escaped quotes with something else for now, as they are going to complicate things.
str = str.replace(/\\\"/g, '_ACSS_escaped_quote');
// Convert @command into a friendly-to-parse body:init event. Otherwise it gets unnecessarily messy to handle later on due to being JS and not CSS.
str = str.replace(/\\\"/g, '_ACSS_escaped_quote');
str = str.replace(/@command[\s]+(conditional[\s]+)?([\u00BF-\u1FFF\u2C00-\uD7FF\w_\-]+[\s]*\{\=[\s\S]*?\=\})/g, function(_, typ, innards) {
return 'body:' + ((!setupEnded) ? 'init' : 'afterLoadConfig') + '{' + ((typ !== 'conditional') ? 'create-command' : 'create-conditional') + ':' + innards + ';}';
});
// Sort out raw JavaScript in the config so it doesn't clash with the rest of the config. The raw javascript needs to get put back to normal at evaluation time,
// and not before, otherwise things go weird with the extensions.
// With the extensions, there is a similar routine to put these escaped characters back in after a modification from there - it's not the same thing though,
// as this handles the whole config, not just a particular part of it, so it is necessarily a separate thing (_escapeCharsForConfig.js).
str = str.replace(/\{\=([\s\S]*?)\=\}/g, function(_, innards) {
if (innards.indexOf('*debugfile:') !== -1) { // It's not there for a JavaScript expression (eg "new Date()").
// We only want the last debugfile string (file, line data) if it is there - remove the last "*" so it fails the next regex.
innards = innards.trim().slice(0, -1);
// Get rid of full debugfile entries, which always end in a "*".
innards = innards.replace(/\*debugfile\:[\s\S]*?\*/g, ''); // get rid of any other debug line numbers - they just get in the way and we don't need them.
// Put the last "*" back so there is only the last debugline string in there.
innards += '*';
}
return '_ACSS_subst_equal_brace_start' + ActiveCSS._mapRegexReturn(DYNAMICCHARS, innards) + '_ACSS_subst_equal_brace_end';
});
str = str.replace(/<style>([\s\S]*?)<\/style>/gim, function(_, innards) {
return '<style>' + ActiveCSS._mapRegexReturn(DYNAMICCHARS, innards) + '</style>';
});
// Replace variable substitutations, ie. ${myVariableName}, etc.
str = str.replace(/\{\$([\u00BF-\u1FFF\u2C00-\uD7FF\w_\-\.\{\$\|\@\}]+)\}/gi, function(_, innards) {
innards = innards.replace(/\./g, '_ACSS_dot'); // for speed rather than using a map.
return '_ACSS_subst_dollar_brace_start' + innards + '_ACSS_subst_brace_end';
});
str = str.replace(/\{\{([\u00BF-\u1FFF\u2C00-\uD7FF\w_\-\.\[\]]+)\}\}/gi, function(_, innards) {
innards = innards.replace(/\./g, '_ACSS_dot'); // for speed rather than using a map.
return '_ACSS_subst_brace_start_ACSS_subst_brace_start' + innards + '_ACSS_subst_brace_end_ACSS_subst_brace_end';
});
str = str.replace(/\{\{\@([\u00BF-\u1FFF\u2C00-\uD7FF\w_\-\.\{\$\|\#\:]+)\}\}/gi, function(_, innards) {
innards = innards.replace(/\./g, '_ACSS_dot');
return '_ACSS_subst_brace_start_ACSS_subst_at_brace_start' + innards + '_ACSS_subst_brace_end_ACSS_subst_brace_end';
});
str = str.replace(/\{\@([\u00BF-\u1FFF\u2C00-\uD7FF\w_\-\.\{\$\|\#\:]+)\}/gi, function(_, innards) {
innards = innards.replace(/\./g, '_ACSS_dot');
return '_ACSS_subst_at_brace_start' + innards + '_ACSS_subst_brace_end';
});
str = str.replace(/\{\|([\u00BF-\u1FFF\u2C00-\uD7FF\w_\-\.\{\$\|\@\}]+)\}/gi, function(_, innards) {
innards = innards.replace(/\./g, '_ACSS_dot');
return '_ACSS_subst_pipe_brace_start' + innards + '_ACSS_subst_brace_end';
});
str = str.replace(/\{\#([\u00BF-\u1FFF\u2C00-\uD7FF\w_\-\.\{\$\|\@\}]+)\}/gi, function(_, innards) {
innards = innards.replace(/\./g, '_ACSS_dot');
return '_ACSS_subst_hash_brace_start' + innards + '_ACSS_subst_brace_end';
});
str = str.replace(/\{([\u00BF-\u1FFF\u2C00-\uD7FF\w_\-\.\[\]]+)\}/gi, function(_, innards) {
innards = innards.replace(/\./g, '_ACSS_dot'); // for speed rather than using a map.
return '_ACSS_subst_brace_start' + innards + '_ACSS_subst_brace_end';
});
// Sort out component escaping.
// First, replace all escaped curlies with something else.
str = str.replace(/\\{/g, '_ACSS_brace_start');
str = str.replace(/\\}/g, '_ACSS_brace_end');
// Now we can match the component accurately. The regex below should match all components.
str = str.replace(/([^\u00BF-\u1FFF\u2C00-\uD7FF\w_\-]html[\u00BF-\u1FFF\u2C00-\uD7FF\w_\- ]+{)([\s\S]*?)}/gi, function(_, startBit, innards) {
// Replace existing escaped quote placeholder with literally escaped quotes.
innards = innards.replace(/_ACSS_escaped_quote/g, '\\"');
// Now escape all the quotes - we want them all escaped, and they wouldn't have been picked up before.
innards = innards.replace(/"/g, '_ACSS_escaped_quote');
// Now format the contents of the component so that it will be found when we do a css-type object creation later.
return startBit + '{component: "' + innards + '";}';
});
// Now we have valid quotes, etc., we want to replace all the key characters we are using in the cjs config within
// quotes with something else, to be put back later. This is so we can keep the parsing simple when we generate the
// tree structure. We need to escape all the key characters that the json parser uses to work out the structure.
// We will put all the valid characters back when we are setting up the json objects after it has passed "css" validation.
let mapObj = {
'{': '_ACSS_brace_start',
'}': '_ACSS_brace_end',
';': '_ACSS_semi_colon',
':': '_ACSS_colon',
'/': '_ACSS_slash',
'@': '_ACSS_at',
};
str = str.replace(/("([^"]|"")*")/g, function(_, innards) {
return ActiveCSS._mapRegexReturn(mapObj, innards);
});
// Convert @conditional into ?, so we don't have to bother with handling that in the parser.
str = str.replace(/@conditional[\s]+/g, '?');
// Do a similar thing for parentheses. Handles pars({#formID}&mypar=y) syntax.
str = str.replace(/([\(]([^\(\)]|\(\))*[\)])/g, function(_, innards) {
return ActiveCSS._mapRegexReturn(mapObj, innards);
});
// Sort out var action command syntax, as that could be pretty much anything. This might need tweaking.
str = str.replace(/[\s]*var[\s]*\:([\s\S]*?)\;/gim, function(_, innards) {
return 'var: ' + ActiveCSS._mapRegexReturn(DYNAMICCHARS, innards) + ';';
});
// Infinite loop failsafe variable. Without this, unbalanced curlies may call an infinite loop later.
let totOpenCurlies = str.split('{').length;
// Now run the actual parser now that we have sane content.
str = _convConfig(str, totOpenCurlies);
if (!str['0']) {
console.log('Active CSS: Either your config is empty or there is a structural syntax error.');
}
return str;
};
const _readSiteMap = () => {
// We have the config file loaded. Go through the config file and sort out the website objects and properties.
// This is an SPA so we do everything first in a speedy fashion - we only do this once.
// Don't forget that load-config runs this too, so anything for first initialization needs to be with the !setupEnded condition.
parsedConfig = _parseConfig(concatConfig);
concatConfig = ''; // We may need to add to this config later, so keep it in memory.
var debugConfig = (debugMode) ? _doDebug('parser') : false;
if (debugConfig) console.log(parsedConfig);
if (!setupEnded) {
// We are going to automatically set up which events can be declared as passive events, and we need to know if the browser supports passive events (doesPassive).
_setupPassive();
}
// Make a new virtual config, which has split up selectors. We do this so we can do quick finding of event handlers and not have to iterate anything.
_makeVirtualConfig();
// Set up events. We can only do this after the config is fully loaded, as there could be multiple events of the same type and we need to know if they are
// passive or not (if they use prevent-default or not).
let evSet;
for (evSet of preSetupEvents) {
_setupEvent(evSet.ev, evSet.sel);
}
// Clean up. If we run load-config, we'll run this function again and only attempt to add the new events loaded.
preSetupEvents = [];
if (!setupEnded) {
_startMainListen();
// Put all the existing script tag details into memory so we don't load things up twice if load-script is used.
_initScriptTrack();
// Handle any initialisation events
_handleEvents({ obj: 'body', evType: 'preInit' });
// Handle any initialisation events
_handleEvents({ obj: 'body', evType: 'init' });
// Iterate items on this page and do any draw events.
_runInnerEvent('*', 'draw');
_handleEvents({ obj: 'body', evType: 'scroll' }); // Handle any immediate scroll actions on the body if any present. Necessary when refreshing a page.
_wrapUpStart();
// Lazy load config.
if (lazyConfig !== '') {
setTimeout(function() {
let arr = lazyConfig.split(','), configFile;
for (configFile of arr) {
_a.LoadConfig({ actName: 'load-config', actVal: configFile, doc: document}); // load-config param updates the panel.
}
}, 1000);
}
}
};
const _setupEvent = (ev, sel, component) => {
if (typeof selectors[ev] === 'undefined') {
selectors[ev] = [];
}
// We are giving the main navig keys events, as they are commonly used in UI. Prefixed by keyup
if (selectors[ev].includes(sel)) {
if (!setupEnded || !doesPassive) {
return;
}
// Let it through - this could be a load-config with a prevent-default now changing the passive "true" state to false. We need to replace the event listener.
// This will only happen on a document level - not a shadow DOM level. Events in the shadow DOM can only be added when it is created - _attachListener() is
// called directly from _renderCompDomsDo().
} else {
selectors[ev].push(sel);
}
if (debuggerEvs.includes(ev)) {
if (!setupEnded || !doesPassive) {
return;
}
// Let it through.
} else {
debuggerEvs.push(ev); // Push the event onto the debugger event list.
}
ev = _getRealEvent(ev);
if (ev === false) return;
if (setupEnded || !eventState[ev]) {
// We could store a variable tracking before passive states of already set up events, rather than running this on every load-config for all new events.
// This isn't set up yet though. It would need check the before passive status of an event, and if it is not false - run this - otherwise skip it. It's
// a micro-optimizing point - slap it on the list. It's not an initial load time speed change though - that won't be further optimized by that change,
// only later load-config actions, which as I said, are more than likely to contain less events than the main config. Unless the person is lazy-loading
// everything because they already have a slow page. In that case a few microseconds extra won't make a difference particularly. So it's micro-optimization.
// It might not even be worth it.
let obj = (document.parentNode && sel == 'body' && ev == 'scroll') ? document.body : window;
let reGenEvent = (setupEnded) ? true : false; // We need this, because of the dynamic shadow DOM event adding, which always happens after setup but is actually not a regeneration of an event.
_attachListener(obj, ev, null, null, null, reGenEvent);
eventState[ev] = true;
}
};
const _setupMediaQueryHandler = str => {
// Eg. str = '(orientation: portrait)',
// Note: We need the calling object in order to get the correct window for the media query check.
// This is how we are going to handle media queries.
// 1. When the config is read, we set up event listeners which will run a function when they change.
// 2. When they change, we run that function and set the true/false variable of the internal media query reference to true or false. We only do this once.
// 3. When the media query conditional statement executes, it just reads the property of the true/false variable. That way we can handle many many
// media queries with no performance impact.
// 4. Note: media query setups should only work in the content window they relate to, so this only needs window, not contentWindow. The reason being that
// in css, media queries only relate to the window they are defined in. We could do a cross-iframe push of data up and down for info purposes, but don't
// worry about that for the moment - sounds well dodgy.
str = str.trim();
if (mediaQueriesOrig[str]) return mediaQueriesOrig[str]; // Return the name of the already existing media query.
// It doesn't already exist, set up new references and the media query event listener.
// Set up name of media query in an array for quick referencing later. It will store the current state of the media query.
let leng = mediaQueries.length + 1;
let mqlName = '__mql_' + leng;
// Set up an array element with the media query referencing the name of the variable that will store the current value of the media query.
// We do this so we don't have to keep running matches each time. It will just return a boolean from the array in real time.
// We won't have the name of the internal reference used in the selector, and we will need this each time the event listener happens, so create a reference.
mediaQueriesOrig[str] = mqlName;
// Set up the conditional statement in the config.
conditionals[mqlName] = [];
conditionals[mqlName].push({ 'name': 'mql-true', 'value': mqlName });
// Set up the variable which stores the event listener and state of the resulting media query.
let ev = window.matchMedia(str);
let matches = ev.matches;
mediaQueries.push(mqlName);
mediaQueries[mqlName] = { 'ev': ev, 'val': matches };
// Set initial value.
// Set up the event listener and function.
mediaQueries[mqlName].ev.addListener(function(e) {
// When the media query state changes, set the internal pointer to true or false.
let mqlName = mediaQueriesOrig[e.media];
mediaQueries[mqlName].val = e.matches;
});
// Return the name of the media query reference to place into the primary selector.
return mqlName;
};
const _setupPassive = () => {
// Does this browser support passive events?
try {
let opts = Object.defineProperty({}, 'passive', {
get: function() {
doesPassive = true;
}});
window.addEventListener('testPassive', null, opts);
window.removeEventListener('testPassive', null, opts);
} catch (e) {}
};
const _sortOutEscapeChars = (str) => {
let mapObj = {
_ACSS_brace_start: '{',
_ACSS_brace_end: '}',
_ACSS_escaped_quote: '\\"',
_ACSS_semi_colon: ';',
_ACSS_colon: ':',
_ACSS_slash: '/',
_ACSS_at: '@',
_ACSS_subst_equal_brace_start: '{=',
_ACSS_subst_equal_brace_end: '=}',
_ACSS_subst_dollar_brace_start: '{$',
_ACSS_subst_brace_start: '{',
_ACSS_subst_at_brace_start: '{@',
_ACSS_subst_pipe_brace_start: '{|',
_ACSS_subst_hash_brace_start: '{#',
_ACSS_subst_brace_end: '}',
_ACSS_dot: '.'
};
return ActiveCSS._mapRegexReturn(mapObj, str);
};
const _startMainListen = () => {
// Set up the back and forward buttons so they call the last proper page and don't change anything in the browser history.
// Only do this once when the page loads, and only if the user hasn't set up a specific handling in the config.
window.addEventListener('message', function(e) {
if (e.origin !== window.location.origin || e.data.source == 'causejs-devtools-extension') return;
var m = e.data;
switch (m.type) {
case 'activecss-unloading':
case 'activecss-loaded':
// Run an unloading or a loaded event through the config for the iframe.
let el = document.getElementById(m.el);
_handleEvents({ obj: el, evType: typ });
break;
}
});
if (!document.parentNode) {
window.addEventListener('popstate', function(e) {
let page = e.state, obj;
if (!page) return; // could be a hash link.
if (debuggerActive) {
_debugOutput('Popstate event');
}
let templ = document.querySelector('#data-active-pages');
let ok = false;
if (page && templ) {
let full = new URL(page);
let shortAttr = full.pathname + full.search;
let navEl = templ.querySelector('a[href="' + shortAttr + '"]');
if (navEl) {
ActiveCSS.trigger(navEl, 'click');
ok = true;
}
}
if (!ok) window.location.href = page; // Not found - redirect.
});
} else {
// If this is an iframe, we are going to send an src change message to the parent whenever the iframe changes
// page, so we can get an unload event on the parent iframe. Also
window.addEventListener('beforeunload', function(e) {
// Don't clash names with a native DOM event.
parent.postMessage({ 'type': 'activecss-unloading', 'el': window.frameElement.id}, window.location.origin);
});
// CJS has finished loading, set message to parent saying the page has loaded.
parent.postMessage({ 'type': 'activecss-loaded', 'el': window.frameElement.id}, window.location.origin);
}
// Get and set the page we are starting on.
currentPage = location.pathname;
// Set up listening for changes to scoped variables.
scopedVars = _observableSlim.create(scoped, true, ActiveCSS._varUpdateDom);
};
const _wrapUpStart = () => {
// The page has been reloaded. Every page in Active CSS must have an element that contains an href linking to it, which when clicked on will perform the
// actions necessary to redraw the page. The page has just been loaded or reloaded, so there was no object clicked on to perform any actions yet.
// So we need to find the href in the page that has the url, and based on that, we assume that clicking on this object will perform the correct actions
// to redraw the page when necessary.
let url = _resolveURL(window.location.href);
window.history.replaceState(url, document.title, url);
setupEnded = true;
};
ActiveCSS.init = (config) => {
config = config || {};
passiveEvents = (typeof config.passiveEvents == 'undefined') ? true : config.passiveEvents;
inlineConfigTags = document.querySelectorAll('style[type="text/acss"]');
if (autoStartInit) {
if (inlineConfigTags) {
// This only runs if there is no user config later in the page within the same call stack. If the Active CSS initialization is timed out until later on,
// then obviously the initialization events will not run.
lazyConfig = '';
_initGetInline(); // function is at the bottom of this script.
}
autoStartInit = false;
} else {
userSetupStarted = true;
if (setupEnded) {
console.log('Cannot initialize Active CSS twice.');
return;
}
lazyConfig = config.lazyConfig || '';
config.configLocation = config.configLocation || console.log('No inline or Active CSS config file setup - see installation docs.');
if (config.debugMode) {
debugMode = config.debugMode;
if (document.parentNode) {
console.log('Active CSS debug mode in iframe ID ' + window.frameElement.id + ': ' + debugMode);
} else {
console.log('Active CSS debug mode: ' + debugMode);
}
}
let thisFile;
let configArrTmp = config.configLocation.split(',');
concatConfigLen = configArrTmp.length;
if (inlineConfigTags) _initGetInline(); // function is at the bottom of this script.
for (thisFile of configArrTmp) {
thisFile = thisFile.trim();
configArr.push(_getBaseURL(thisFile)); // Build up the initial config list without anything after and including the "?".
_getFile(thisFile, 'txt', { file: thisFile });
}
}
};
const _initGetInline = () => {
// Initial inline style type="text/acss" detection prior to any user config.
concatConfigLen += inlineConfigTags.length;
inlineConfigTags.forEach(acssTag => {
_addConfig(acssTag.innerHTML, { file: 'inline' });
});
inlineConfigTags = null;
};
// Store the rendered location of the attribute for quick DOM lookup when state changes. It doesn't have wrapping comments so it needs an extra reference location.
// This doesn't do a set-attribute. This is done before the attribute is set.
const _addScopedAttr = (wot, o, originalStr, walker, scopeRef) => {
let cid = _addScopedCID(wot, o.secSelObj, scopeRef);
let attrName = o.actVal.split(' ')[0];
let str = (!walker) ? originalStr.substr(originalStr.indexOf(' ') + 1)._ACSSRepQuo() : originalStr;
_set(scopedData, wot + '.attrs[' + cid + ']' + attrName, str);
};
// Store the rendered location for quick DOM lookup when state changes. We need this for both content and attribute rendering.
const _addScopedCID = (wot, obj, scopeRef) => {
let cid = _getActiveID(obj);
_set(scopedData, wot + '.cids[' + cid + ']', { cid, scopeRef } );
return cid;
};
const _escapeItem = str => {
// This is for putting content directly into html.
let div = document.createElement('div');
div.textContent = str.replace(/\{\=|\=\}/gm, '');
// Remove possibility of JavaScript evaluation later on in a random place.
return div.innerHTML;
};
const _getObjFromDots = (obj, i) => {
if (typeof obj[i] === 'undefined') { // could be empty, which is fine.
// Display sane error for debugging. Not sure what level of debug this should go in, so leave it for now.
// Var may not be there though, which could be totally valid.
return '';
}
return obj[i];
};
/*
* Observable Slim
* Version 0.1.5
* https://github.com/elliotnb/observable-slim
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*
* Observable Slim is a singleton that allows you to observe changes made to an object and any nested
* children of that object. It is intended to assist with one-way data binding, that is, in MVC parlance,
* reflecting changes in the model to the view. Observable Slim aspires to be as lightweight and easily
* understood as possible. Minifies down to roughly 3000 characters.
*
* Change: 29 Jan 2020, main function name change to fit into Active CSS conventions. Fixed syntax so it passes jshint. Used in data-binding.
* Could be made slimmer for Active CSS, as we don't need all of it. So remove bits that we don't need at a good point. FIXME.
*
*/
const _observableSlim = (function() {
var paths = [];
// An array that stores all of the observables created through the public create() method below.
var observables = [];
// An array of all the objects that we have assigned Proxies to
var targets = [];
// An array of arrays containing the Proxies created for each target object. targetsProxy is index-matched with
// 'targets' -- together, the pair offer a Hash table where the key is not a string nor number, but the actual target object
var targetsProxy = [];
// this variable tracks duplicate proxies assigned to the same target.
// the 'set' handler below will trigger the same change on all other Proxies tracking the same target.
// however, in order to avoid an infinite loop of Proxies triggering and re-triggering one another, we use dupProxy
// to track that a given Proxy was modified from the 'set' handler
var dupProxy = null;
var _getProperty = function(obj, path) {
return path.split('.').reduce(function(prev, curr) {
return prev ? prev[curr] : undefined;
}, obj || self);
};
/* Function: _create
Private internal function that is invoked to create a new ES6 Proxy whose changes we can observe through
the Observerable.observe() method.
Parameters:
target - required, plain JavaScript object that we want to observe for changes.
domDelay - batch up changes on a 10ms delay so a series of changes can be processed in one DOM update.
originalObservable - object, the original observable created by the user, exists for recursion purposes,
allows one observable to observe change on any nested/child objects.
originalPath - array of objects, each object having the properties 'target' and 'property' -- target referring to the observed object itself
and property referring to the name of that object in the nested structure. the path of the property in relation to the target
on the original observable, exists for recursion purposes, allows one observable to observe change on any nested/child objects.
Returns:
An ES6 Proxy object.
*/
var _create = function(target, domDelay, originalObservable, originalPath) {
var observable = originalObservable || null;
// record the nested path taken to access this object -- if there was no path then we provide the first empty entry
var path = originalPath || [{"target":target,"property":""}];
paths.push(path);
// in order to accurately report the "previous value" of the "length" property on an Array
// we must use a helper property because intercepting a length change is not always possible as of 8/13/2018 in
// Chrome -- the new `length` value is already set by the time the `set` handler is invoked
if (target instanceof Array) target.__length = target.length;
var changes = [];
/* Function: _getPath
Returns a string of the nested path (in relation to the top-level observed object)
of the property being modified or deleted.
Parameters:
target - the object whose property is being modified or deleted.
property - the string name of the property
jsonPointer - optional, set to true if the string path should be formatted as a JSON pointer.
Returns:
String of the nested path (e.g., hello.testing.1.bar or, if JSON pointer, /hello/testing/1/bar
*/
var _getPath = function(target, property, jsonPointer) {
var fullPath = "";
var lastTarget = null;
// loop over each item in the path and append it to full path
for (var i = 0; i < path.length; i++) {
// if the current object was a member of an array, it's possible that the array was at one point
// mutated and would cause the position of the current object in that array to change. we perform an indexOf
// lookup here to determine the current position of that object in the array before we add it to fullPath
if (lastTarget instanceof Array && !isNaN(path[i].property)) {
path[i].property = lastTarget.indexOf(path[i].target);
}
fullPath = fullPath + "." + path[i].property;
lastTarget = path[i].target;
}
// add the current property
fullPath = fullPath + "." + property;
// remove the beginning two dots -- ..foo.bar becomes foo.bar (the first item in the nested chain doesn't have a property name)
fullPath = fullPath.substring(2);
if (jsonPointer === true) fullPath = "/" + fullPath.replace(/\./g, "/");
return fullPath;
};
var _notifyObservers = function(numChanges) {
// if the observable is paused, then we don't want to execute any of the observer functions
if (observable.paused === true) return;
// execute observer functions on a 10ms settimeout, this prevents the observer functions from being executed
// separately on every change -- this is necessary because the observer functions will often trigger UI updates
if (domDelay === true) {
setTimeout(function() {
if (numChanges === changes.length) {
// we create a copy of changes before passing it to the observer functions because even if the observer function
// throws an error, we still need to ensure that changes is reset to an empty array so that old changes don't persist
var changesCopy = changes.slice(0);
changes = [];
// invoke any functions that are observing changes
for (var i = 0; i < observable.observers.length; i++) observable.observers[i](changesCopy);
}
},10);
} else {
// we create a copy of changes before passing it to the observer functions because even if the observer function
// throws an error, we still need to ensure that changes is reset to an empty array so that old changes don't persist
var changesCopy = changes.slice(0);
changes = [];
// invoke any functions that are observing changes
for (var i = 0; i < observable.observers.length; i++) observable.observers[i](changesCopy);
}
};
var handler = {
get: function(target, property) {
// implement a simple check for whether or not the object is a proxy, this helps the .create() method avoid
// creating Proxies of Proxies.
if (property === "__getTarget") {
return target;
} else if (property === "__isProxy") {
return true;
// from the perspective of a given observable on a parent object, return the parent object of the given nested object
} else if (property === "__getParent") {
return function(i=1) {
var parentPath = _getPath(target, "__getParent").split(".");
parentPath.splice(-(i+1),(i+1));
return _getProperty(observable.parentProxy, parentPath.join("."));
};
// return the full path of the current object relative to the parent observable
} else if (property === "__getPath") {
// strip off the 12 characters for ".__getParent"
var parentPath = _getPath(target, "__getParent");
return parentPath.slice(0, -12);
}
// for performance improvements, we assign this to a variable so we do not have to lookup the property value again
var targetProp = target[property];
if (target instanceof Date && targetProp instanceof Function && targetProp !== null) {
return targetProp.bind(target);
}
// if we are traversing into a new object, then we want to record path to that object and return a new observable.
// recursively returning a new observable allows us a single Observable.observe() to monitor all changes on
// the target object and any objects nested within.
if (targetProp instanceof Object && targetProp !== null && target.hasOwnProperty(property)) {
// if we've found a proxy nested on the object, then we want to retrieve the original object behind that proxy
if (targetProp.__isProxy === true) targetProp = targetProp.__getTarget;
// if the object accessed by the user (targetProp) already has a __targetPosition AND the object
// stored at target[targetProp.__targetPosition] is not null, then that means we are already observing this object
// we might be able to return a proxy that we've already created for the object
if (targetProp.__targetPosition > -1 && targets[targetProp.__targetPosition] !== null) {
// loop over the proxies that we've created for this object
var ttp = targetsProxy[targetProp.__targetPosition];
for (var i = 0, l = ttp.length; i < l; i++) {
// if we find a proxy that was setup for this particular observable, then return that proxy
if (observable === ttp[i].observable) {
return ttp[i].proxy;
}
}
}
// if we're arrived here, then that means there is no proxy for the object the user just accessed, so we
// have to create a new proxy for it
// create a shallow copy of the path array -- if we didn't create a shallow copy then all nested objects would share the same path array and the path wouldn't be accurate
var newPath = path.slice(0);
newPath.push({"target":targetProp,"property":property});
return _create(targetProp, domDelay, observable, newPath);
} else {
return targetProp;
}
},
deleteProperty: function(target, property) {
// was this change an original change or was it a change that was re-triggered below
var originalChange = true;
if (dupProxy === proxy) {
originalChange = false;
dupProxy = null;
}
// in order to report what the previous value was, we must make a copy of it before it is deleted
var previousValue = Object.assign({}, target);
// record the deletion that just took place
changes.push({
"type":"delete",
"target":target,
"property":property,
"newValue":null,
"previousValue":previousValue[property],
"currentPath":_getPath(target, property),
"jsonPointer":_getPath(target, property, true),
"proxy":proxy
});
if (originalChange === true) {
// perform the delete that we've trapped if changes are not paused for this observable
if (!observable.changesPaused) delete target[property];
for (var a = 0, l = targets.length; a < l; a++) if (target === targets[a]) break;
// loop over each proxy and see if the target for this change has any other proxies
var currentTargetProxy = targetsProxy[a] || [];
var b = currentTargetProxy.length;
while (b--) {
// if the same target has a different proxy
if (currentTargetProxy[b].proxy !== proxy) {
// !!IMPORTANT!! store the proxy as a duplicate proxy (dupProxy) -- this will adjust the behavior above appropriately (that is,
// prevent a change on dupProxy from re-triggering the same change on other proxies)
dupProxy = currentTargetProxy[b].proxy;
// make the same delete on the different proxy for the same target object. it is important that we make this change *after* we invoke the same change
// on any other proxies so that the previousValue can show up correct for the other proxies
delete currentTargetProxy[b].proxy[property];
}
}
}
_notifyObservers(changes.length);
return true;
},
set: function(target, property, value, receiver) {
// if the value we're assigning is an object, then we want to ensure
// that we're assigning the original object, not the proxy, in order to avoid mixing
// the actual targets and proxies -- creates issues with path logging if we don't do this
if (value && value.__isProxy) value = value.__getTarget;
// was this change an original change or was it a change that was re-triggered below
var originalChange = true;
if (dupProxy === proxy) {
originalChange = false;
dupProxy = null;
}
// improve performance by saving direct references to the property
var targetProp = target[property];
// Only record this change if:
// 1. the new value differs from the old one
// 2. OR if this proxy was not the original proxy to receive the change
// 3. OR the modified target is an array and the modified property is "length" and our helper property __length indicates that the array length has changed
//
// Regarding #3 above: mutations of arrays via .push or .splice actually modify the .length before the set handler is invoked
// so in order to accurately report the correct previousValue for the .length, we have to use a helper property.
if (targetProp !== value || originalChange === false || (property === "length" && target instanceof Array && target.__length !== value)) {
var foundObservable = true;
var typeOfTargetProp = (typeof targetProp);
// determine if we're adding something new or modifying somethat that already existed
var type = "update";
if (typeOfTargetProp === "undefined") type = "add";
// store the change that just occurred. it is important that we store the change before invoking the other proxies so that the previousValue is correct
changes.push({
"type":type,
"target":target,
"property":property,
"newValue":value,
"previousValue":receiver[property],
"currentPath":_getPath(target, property),
"jsonPointer":_getPath(target, property, true),
"proxy":proxy
});
// mutations of arrays via .push or .splice actually modify the .length before the set handler is invoked
// so in order to accurately report the correct previousValue for the .length, we have to use a helper property.
if (property === "length" && target instanceof Array && target.__length !== value) {
changes[changes.length-1].previousValue = target.__length;
target.__length = value;
}
// !!IMPORTANT!! if this proxy was the first proxy to receive the change, then we need to go check and see
// if there are other proxies for the same project. if there are, then we will modify those proxies as well so the other
// observers can be modified of the change that has occurred.
if (originalChange === true) {
// because the value actually differs than the previous value
// we need to store the new value on the original target object,
// but only as long as changes have not been paused
if (!observable.changesPaused) target[property] = value;
foundObservable = false;
var targetPosition = target.__targetPosition;
var z = targetsProxy[targetPosition].length;
// find the parent target for this observable -- if the target for that observable has not been removed
// from the targets array, then that means the observable is still active and we should notify the observers of this change
while (z--) {
if (observable === targetsProxy[targetPosition][z].observable) {
if (targets[targetsProxy[targetPosition][z].observable.parentTarget.__targetPosition] !== null) {
foundObservable = true;
break;
}
}
}
// if we didn't find an observable for this proxy, then that means .remove(proxy) was likely invoked
// so we no longer need to notify any observer function about the changes, but we still need to update the
// value of the underlying original objectm see below: target[property] = value;
if (foundObservable) {
// loop over each proxy and see if the target for this change has any other proxies
var currentTargetProxy = targetsProxy[targetPosition];
for (var b = 0, l = currentTargetProxy.length; b < l; b++) {
// if the same target has a different proxy
if (currentTargetProxy[b].proxy !== proxy) {
// !!IMPORTANT!! store the proxy as a duplicate proxy (dupProxy) -- this will adjust the behavior above appropriately (that is,
// prevent a change on dupProxy from re-triggering the same change on other proxies)
dupProxy = currentTargetProxy[b].proxy;
// invoke the same change on the different proxy for the same target object. it is important that we make this change *after* we invoke the same change
// on any other proxies so that the previousValue can show up correct for the other proxies
currentTargetProxy[b].proxy[property] = value;
}
}
// if the property being overwritten is an object, then that means this observable
// will need to stop monitoring this object and any nested objects underneath the overwritten object else they'll become
// orphaned and grow memory usage. we excute this on a setTimeout so that the clean-up process does not block
// the UI rendering -- there's no need to execute the clean up immediately
setTimeout(function() {
if (typeOfTargetProp === "object" && targetProp !== null) {
// check if the to-be-overwritten target property still exists on the target object
// if it does still exist on the object, then we don't want to stop observing it. this resolves
// an issue where array .sort() triggers objects to be overwritten, but instead of being overwritten
// and discarded, they are shuffled to a new position in the array
var keys = Object.keys(target);
for (var i = 0, l = keys.length; i < l; i++) {
if (target[keys[i]] === targetProp) return;
}
var stillExists = false;
// now we perform the more expensive search recursively through the target object.
// if we find the targetProp (that was just overwritten) still exists somewhere else
// further down in the object, then we still need to observe the targetProp on this observable.
(function iterate(target) {
var keys = Object.keys(target);
for (var i = 0, l = keys.length; i < l; i++) {
var property = keys[i];
var nestedTarget = target[property];
if (nestedTarget instanceof Object && nestedTarget !== null) iterate(nestedTarget);
if (nestedTarget === targetProp) {
stillExists = true;
return;
}
}
})(target);
// even though targetProp was overwritten, if it still exists somewhere else on the object,
// then we don't want to remove the observable for that object (targetProp)
if (stillExists === true) return;
// loop over each property and recursively invoke the `iterate` function for any
// objects nested on targetProp
(function iterate(obj) {
var keys = Object.keys(obj);
for (i = 0, l = keys.length; i < l; i++) {
var objProp = obj[keys[i]];
if (objProp instanceof Object && objProp !== null) iterate(objProp);
}
// if there are any existing target objects (objects that we're already observing)...
var c = -1;
for (i = 0, l = targets.length; i < l; i++) {
if (obj === targets[i]) {
c = i;
break;
}
}
if (c > -1) {
// ...then we want to determine if the observables for that object match our current observable
var currentTargetProxy = targetsProxy[c];
var d = currentTargetProxy.length;
while (d--) {
// if we do have an observable monitoring the object thats about to be overwritten
// then we can remove that observable from the target object
if (observable === currentTargetProxy[d].observable) {
currentTargetProxy.splice(d,1);
break;
}
}
// if there are no more observables assigned to the target object, then we can remove
// the target object altogether. this is necessary to prevent growing memory consumption particularly with large data sets
if (currentTargetProxy.length == 0) {
// targetsProxy.splice(c,1);
targets[c] = null;
}
}
})(targetProp);
}
},10000);
}
// TO DO: the next block of code resolves test case #29, but it results in poor IE11 performance with very large objects.
// UPDATE: need to re-evaluate IE11 performance due to major performance overhaul from 12/23/2018.
//
// if the value we've just set is an object, then we'll need to iterate over it in order to initialize the
// observers/proxies on all nested children of the object
/* if (value instanceof Object && value !== null) {
(function iterate(proxy) {
var target = proxy.__getTarget;
var keys = Object.keys(target);
for (var i = 0, l = keys.length; i < l; i++) {
var property = keys[i];
if (target[property] instanceof Object && target[property] !== null) iterate(proxy[property]);
};
})(proxy[property]);
}; */
}
if (foundObservable) {
// notify the observer functions that the target has been modified
_notifyObservers(changes.length);
}
}
return true;
}
};
var __targetPosition = target.__targetPosition;
if (!__targetPosition || __targetPosition < 0) { // original was = !(__targetPosition > -1)) {
Object.defineProperty(target, "__targetPosition", {
value: targets.length,
writable: false,
enumerable: false,
configurable: false
});
}
// create the proxy that we'll use to observe any changes
var proxy = new Proxy(target, handler);
// we don't want to create a new observable if this function was invoked recursively
if (observable === null) {
observable = {"parentTarget":target, "domDelay":domDelay, "parentProxy":proxy, "observers":[],"paused":false,"path":path,"changesPaused":false};
observables.push(observable);
}
// store the proxy we've created so it isn't re-created unnecessairly via get handler
var proxyItem = {"target":target,"proxy":proxy,"observable":observable};
// if we have already created a Proxy for this target object then we add it to the corresponding array
// on targetsProxy (targets and targetsProxy work together as a Hash table indexed by the actual target object).
if (__targetPosition > -1) {
// the targets array is set to null for the position of this particular object, then we know that
// the observable was removed some point in time for this object -- so we need to set the reference again
if (targets[__targetPosition] === null) {
targets[__targetPosition] = target;
}
targetsProxy[__targetPosition].push(proxyItem);
// else this is a target object that we had not yet created a Proxy for, so we must add it to targets,
// and push a new array on to targetsProxy containing the new Proxy
} else {
targets.push(target);
targetsProxy.push([proxyItem]);
}
return proxy;
};
return {
/* Method:
Public method that is invoked to create a new ES6 Proxy whose changes we can observe
through the Observerable.observe() method.
Parameters
target - Object, required, plain JavaScript object that we want to observe for changes.
domDelay - Boolean, required, if true, then batch up changes on a 10ms delay so a series of changes can be processed in one DOM update.
observer - Function, optional, will be invoked when a change is made to the proxy.
Returns:
An ES6 Proxy object.
*/
create: function(target, domDelay, observer) {
// test if the target is a Proxy, if it is then we need to retrieve the original object behind the Proxy.
// we do not allow creating proxies of proxies because -- given the recursive design of ObservableSlim -- it would lead to sharp increases in memory usage
if (target.__isProxy === true) {
target = target.__getTarget;
//if it is, then we should throw an error. we do not allow creating proxies of proxies
// because -- given the recursive design of ObservableSlim -- it would lead to sharp increases in memory usage
//throw new Error("ObservableSlim.create() cannot create a Proxy for a target object that is also a Proxy.");
}
// fire off the _create() method -- it will create a new observable and proxy and return the proxy
var proxy = _create(target, domDelay);
// assign the observer function
if (typeof observer === "function") this.observe(proxy, observer);
// recursively loop over all nested objects on the proxy we've just created
// this will allow the top observable to observe any changes that occur on a nested object
(function iterate(proxy) {
var target = proxy.__getTarget;
var keys = Object.keys(target);
for (var i = 0, l = keys.length; i < l; i++) {
var property = keys[i];
if (target[property] instanceof Object && target[property] !== null) iterate(proxy[property]);
}
})(proxy);
return proxy;
},
/* Method: observe
This method is used to add a new observer function to an existing proxy.
Parameters:
proxy - the ES6 Proxy returned by the create() method. We want to observe changes made to this object.
observer - this function will be invoked when a change is made to the observable (not to be confused with the
observer defined in the create() method).
Returns:
Nothing.
*/
observe: function(proxy, observer) {
// loop over all the observables created by the _create() function
var i = observables.length;
while (i--) {
if (observables[i].parentProxy === proxy) {
observables[i].observers.push(observer);
break;
}
}
},
/* Method: pause
This method will prevent any observer functions from being invoked when a change occurs to a proxy.
Parameters:
proxy - the ES6 Proxy returned by the create() method.
*/
pause: function(proxy) {
var i = observables.length;
var foundMatch = false;
while (i--) {
if (observables[i].parentProxy === proxy) {
observables[i].paused = true;
foundMatch = true;
break;
}
}
if (foundMatch == false) throw new Error("_observableSlim could not pause observable -- matching proxy not found.");
},
/* Method: resume
This method will resume execution of any observer functions when a change is made to a proxy.
Parameters:
proxy - the ES6 Proxy returned by the create() method.
*/
resume: function(proxy) {
var i = observables.length;
var foundMatch = false;
while (i--) {
if (observables[i].parentProxy === proxy) {
observables[i].paused = false;
foundMatch = true;
break;
}
}
if (foundMatch == false) throw new Error("_observableSlim could not resume observable -- matching proxy not found.");
},
/* Method: pauseChanges
This method will prevent any changes (i.e., set, and deleteProperty) from being written to the target
object. However, the observer functions will still be invoked to let you know what changes WOULD have
been made. This can be useful if the changes need to be approved by an external source before the
changes take effect.
Parameters:
proxy - the ES6 Proxy returned by the create() method.
*/
pauseChanges: function(proxy){
var i = observables.length;
var foundMatch = false;
while (i--) {
if (observables[i].parentProxy === proxy) {
observables[i].changesPaused = true;
foundMatch = true;
break;
}
}
if (foundMatch == false) throw new Error("_observableSlim could not pause changes on observable -- matching proxy not found.");
},
/* Method: resumeChanges
This method will resume the changes that were taking place prior to the call to pauseChanges().
Parameters:
proxy - the ES6 Proxy returned by the create() method.
*/
resumeChanges: function(proxy){
var i = observables.length;
var foundMatch = false;
while (i--) {
if (observables[i].parentProxy === proxy) {
observables[i].changesPaused = false;
foundMatch = true;
break;
}
}
if (foundMatch == false) throw new Error("_observableSlim could not resume changes on observable -- matching proxy not found.");
},
/* Method: remove
This method will remove the observable and proxy thereby preventing any further callback observers for
changes occuring to the target object.
Parameters:
proxy - the ES6 Proxy returned by the create() method.
*/
remove: function(proxy) {
var matchedObservable = null;
var foundMatch = false;
var c = observables.length;
while (c--) {
if (observables[c].parentProxy === proxy) {
matchedObservable = observables[c];
foundMatch = true;
break;
}
}
var a = targetsProxy.length;
while (a--) {
var b = targetsProxy[a].length;
while (b--) {
if (targetsProxy[a][b].observable === matchedObservable) {
targetsProxy[a].splice(b,1);
// if there are no more proxies for this target object
// then we null out the position for this object on the targets array
// since we are essentially no longer observing this object.
// we do not splice it off the targets array, because if we re-observe the same
// object at a later time, the property __targetPosition cannot be redefined.
if (targetsProxy[a].length === 0) {
targets[a] = null;
}
}
}
}
if (foundMatch === true) {
observables.splice(c,1);
}
}
};
})();
const _prefixScopedVars = function(str, compRef=null) {
/**
* "str" is a string that could contain scoped variables that need proper set up before evaluating.
* It finds each word, which may include a period (.), and see if this needs scoping. It may already have a scoped prefix. If it doesn't, it gets
* a scoped prefix added. At the end it will return the formatted string. It will only add the "scopedVars." prefix if the word exists in the string.
* We need to ignore all words in double quotes, so the part of the regex referencing quotes brings back a full string including quotes so we can ignore the
* whole thing.
*/
let mapObj = {}, mapObj2 = {}, scopedVar, varEval;
str = str.replace(/(?!\\u00BF-\\u1FFF\\u2C00-\\uD7FF\\w)(\\"|"(?:\\"|[^"])*"|[\u00BF-\u1FFF\u2C00-\uD7FF\w_\.]+)(?!\\u00BF-\\u1FFF\\u2C00-\\uD7FF\\w)/gim, function(_, wot) {
if (wot.indexOf('"') !== -1 || wot.match(/^[\d]+$/)) return wot; // This is a full quoted so is an invalid match - ignore it.
if (wot.indexOf('.') !== -1) {
// This is already scoped in some fashion. If it already has window or scopedVars as the first prefix we can skip it.
// This is separated from the main regex as we will be adding further scoping options later on, and so it will easier to keep this separate.
let firstVar = wot.split('.')[0];
// Return the wot if it prefixed with window. It is unlikely someone unfamiliar with the core will use scopedVars, but just in case ignore that too.
if (firstVar == 'window' || firstVar == 'scopedVars') return wot;
}
scopedVar = ((compRef && privateScopes[compRef]) ? compRef : 'main') + '.' + wot;
varEval = _get(scopedVars, scopedVar);
// Only return the variable if it actually exists.
return (varEval) ? 'scopedVars.' + scopedVar : wot;
});
return str;
};
// Replace attributes if they exist. Also the {$RAND}, as that is safe to run in advance. This is run at multiple stages at different parts of the runtime
// config on different objects as they are needed. Also replace JavaScript expressions {= expression}.
const _replaceAttrs = (obj, sel, secSelObj=null, o=null, func='', compRef=null) => {
// Note, obj could sometimes be a string with no attributes if this is a trigger.
// For this to be totally safe, we escape the contents of the attribute before inserting.
if (!sel) return '';
if (sel.indexOf('{$RAND}') !== -1) {
let rand = Math.floor(Math.random() * 10000000);
sel = sel.replace(/\{\$RAND\}/g, rand);
}
if (sel.indexOf('{=') !== -1 && !(o && ['CreateCommand', 'CreateConditional', 'Eval', 'Run'].includes(o.func))) { // skip restoration and eval now if it needs to run dynamically.
sel = ActiveCSS._sortOutFlowEscapeChars(sel);
sel = _replaceJSExpression(sel, null, null, compRef);
}
if (sel.indexOf('{@') !== -1) {
sel = sel.replace(/\{\@([^\t\n\f \/>"'=(?!\{)]+)\}/gi, function(_, wot) {
let wotArr = wot.split('.'), ret, err = [];
if (wotArr[1] && wotArr[0] == 'selected' && obj.tagName == 'SELECT') {
// If selected is used, like [selected.value], then it gets the attribute of the selected option, rather than the select tag itself.
ret = obj.options[obj.selectedIndex].getAttribute(wotArr[1]);
if (ret) return _escapeItem(ret);
ret = obj.options[obj.selectedIndex][wotArr[1]];
if (ret) return _escapeItem(ret);
err.push('Neither attribute or property ' + wotArr[1] + ' found in target or primary selector:');
} else {
let colon = wot.lastIndexOf(':'); // Get the last colon - there could be colons in the selector itself.
if (colon !== -1) {
// This should be an id followed by an attribute, or innerText, or it's a shadow DOM host attribute.
let elRef = wot.substr(0, colon), el;
if (elRef == 'host' && (!o || ['beforeComponentOpen', 'componentOpen'].indexOf(o.event) === -1)) {
if (!obj.shadowRoot) return '{@' + wot + '}'; // Need to leave this alone. We can't handle this yet. This can be handled in scopedVars.
el = obj.shadowRoot;
} else {
el = _getSel(o, elRef);
}
let wat = wot.substr(colon + 1);
if (el.tagName == 'IFRAME' && wat == 'url') {
// If this is an iframe and the virtual attribute url is chosen, get the actual url inside the iframe.
// We can't rely on the src of the iframe element being accurate, as it is not always updated.
return _escapeItem(el.contentWindow.location.href);
} else {
ret = el.getAttribute(wat);
if (ret) return _escapeItem(ret);
ret = el[wat];
if (ret) return _escapeItem(ret);
err.push('Neither attribute or property ' + wat + ' found in target or primary selector:');
}
} else {
if (obj && typeof obj !== 'string') {
if (secSelObj) {
// Check the target selector first.
ret = secSelObj.getAttribute(wot);
if (ret) return _escapeItem(ret);
ret = secSelObj[wot];
if (ret) return _escapeItem(ret);
}
// Check the primary selector next.
ret = obj.getAttribute(wot);
if (ret) return _escapeItem(ret);
ret = obj[wot];
if (ret) return _escapeItem(ret);
err.push('Attribute not property ' + wot + ' found in target or primary selector:');
}
}
}
if (err) err.push(obj);
return ''; // More useful to return an empty string. '{@' + wot + '>';
});
}
// Replace regular scoped variables with their content, and if content-based put internal wrappers around the bound variables so they can be formatted later.
// We can only do this after attributes have been substituted, in order to handle variable binding in an attribute that also has an attribute substituted.
return _replaceScopedVars(sel, secSelObj, func, o, null, null, compRef);
};
const _replaceComponents = (o, str, loopI) => {
// This needs to be recursive to facilitate easier syntax. XSS defense needs to occur elsewhere otherwise this ceases to be useful. This must stay recursive.
let co = 0, found;
while (co < 50) {
found = false;
co++;
// Handle ID tag content insertion first.
// "jshint" thinks this function in a loop may cause semantic confusion. It doesn't in practical terms, and we need it, hence we need the ignore line.
str = str.replace(/\{\#([\u00BF-\u1FFF\u2C00-\uD7FF\w\.\-_]+)\}/gi, function(_, c) { // jshint ignore:line
let el = document.getElementById(c);
if (el) return el.innerHTML;
// Return it as it is if the element is not there.
return '{#' + c + '}';
});
// Now handle real component insertion.
// "jshint" thinks this function in a loop may cause semantic confusion. It doesn't in practical terms, and we need it, hence we need the ignore line.
str = str.replace(/\{\|([\u00BF-\u1FFF\u2C00-\uD7FF\w\.\-_]+)\}/gi, function(_, c) { // jshint ignore:line
// Note: if the item is empty or it if references an empty component, we always finally return '';
if (!components[c]) return '{|' + c + '}';
let ret = components[c].data.trim();
found = true;
ret = ActiveCSS._sortOutFlowEscapeChars(ret);
// Handle any looping variable replacement in the component.
ret = (o.loopRef != '0') ? _replaceLoopingVars(ret, o.loopVars) : ret;
if (components[c].shadow || components[c].scoped) {
// This is supposed to be added to its container after the container has rendered. We shouldn't add it now.
// Add it to memory and attach after the container has rendered. Return a placeholder for this component.
// Note, we have by this point *drawn the contents of this component - each instance is individual*, so they get rendered separately and
// removed from the pending array once drawn.
compCount++;
let compRef = '<data-acss-component data-name="' + c + '" data-ref="' + compCount + '"></data-acss-component>';
compPending[compCount] = ret;
// Replace the fully rendered component instance with the compRef placeholder.
ret = compRef;
} else {
ret = _replaceAttrs(o.obj, ret, null, null, o.func, o.compRef);
ret = (ret.indexOf('{$') !== -1) ? _replaceStringVars(o.ajaxObj, ret) : ret;
}
return (ret) ? ret : '';
});
if (!found) break;
}
if (co == 50) console.log('Active CSS recursion detected during component rendering. Skipped after 50 attempts.\nFile: ' + o.file + ', line: ' + o.line);
return str;
};
const _replaceJSExpression = (sel, realVal=false, quoteIfString=false, compRef=null) => {
let res;
sel = sel.replace(/\{\=([\s\S]*?)\=\}/gm, function(str, wot) {
// Evaluate the JavaScript expression.
// See if any unscoped variables need replacing.
wot = _replaceScopedVarsExpr(wot, compRef);
try {
res = Function('scopedVars', '"use strict";return (' + wot + ');')(scopedVars); // jshint ignore:line
} catch (err) {
console.log('JavaScript expression error (' + err + '): ' + sel);
console.log('Actual expression evaluated: ' + wot);
}
if (!realVal) { // If realVal is set to true, we want to return the actual expression result in this case, so do nothing here.
// Res should always be a string in the config, even if evaluated into a conditional. This is because the config is made up of strings.
let q = '';
if (quoteIfString) {
q = '"';
}
res = (res === true) ? 'true' : (res === false) ? 'false' : (typeof res === 'string') ? q + res + q : (typeof res === 'number') ? res.toString() : 'Invalid expression (' + wot.trim() + ')';
}
return res;
});
// Return the result rather than the string if realVal is set to true.
return (realVal) ? res : sel;
};
const _replaceScopedVars = (str, obj=null, func='', o=null, fromUpdate=false, shadHost=null, compRef=null) => {
// Evaluate and insert scoped variables. This could be a HTML string containing nodes.
// This should only happen after attribute substitution has occurred, otherwise binding in attributes won't work fully.
// Eg.: set-attribute: data-name "{{firstName}} {@id}{{surname}} {{surname}}". Simply put, the ID is not easily obtainable when updating the attribute with
// a bound variable. If this becomes a problem later, we would have to store the expand this to reference the location of the attribute via the active ID. But
// it is fine as it is at this point in development.
// This function is also called when an variable change triggers an attribute update.
let fragment, fragRoot, treeWalker, owner, txt, cid;
// Convert string into DOM tree. Walk DOM and set up active IDs, search for vars to replace, etc. Then convert back to string. Hopefully this will be quick.
// Handle inner text first.
if (str.indexOf('{{') !== -1 && !fromUpdate && str.indexOf('</') !== -1) {
fragRoot = document.createElement('template');
fragRoot.innerHTML = str;
treeWalker = document.createTreeWalker(
fragRoot.content,
NodeFilter.SHOW_TEXT
);
while (treeWalker.nextNode()) {
owner = treeWalker.currentNode.parentNode;
if (owner.nodeType == 11) continue;
cid = _getActiveID(owner);
txt = treeWalker.currentNode.textContent;
treeWalker.currentNode.textContent = _replaceScopedVarsDo(txt, owner, 'Render', null, true, shadHost, compRef);
}
// Now handle any attributes.
treeWalker = document.createTreeWalker(
fragRoot.content,
NodeFilter.SHOW_ELEMENT
);
while (treeWalker.nextNode()) {
owner = treeWalker.currentNode;
let attrs = owner.attributes, attr;
for (attr of attrs) {
if (['data-activeid'].indexOf(attr.nodeName) !== -1) continue;
let newAttr = _replaceScopedVarsDo(attr.nodeValue, null, 'SetAttribute', { secSelObj: owner, actVal: attr.nodeName + ' ' + attr.nodeValue }, true, shadHost, compRef);
treeWalker.currentNode.setAttribute(attr.nodeName, newAttr);
}
}
// Convert the fragment back into a string.
str = fragRoot.innerHTML;
str = str.replace(/_cj_s_lt_/gm, '<!--');
str = str.replace(/_cj_s_gt_/gm, '-->');
str = str.replace(/_cj_s_lts_/gm, '/*');
str = str.replace(/_cj_s_gts_/gm, '*/');
} else {
// Come in from an var change or there are no nodes - so no point creating a tree and going through all that stuff to set up sub Active IDs and all that
// sort of thing.
str = _replaceScopedVarsDo(str, obj, func, o, false, shadHost, compRef);
}
return str;
};
const _replaceScopedVarsDo = (str, obj=null, func='', o=null, walker=false, shadHost=null, compRef=null) => {
let res, cid, isBound = false, isAttribute = false, isHost = false, originalStr = str;
if (str.indexOf('{') !== -1) {
str = str.replace(/\{((\{)?(\@)?[\u00BF-\u1FFF\u2C00-\uD7FF\w_\-\.\:\[\]]+(\})?)\}/gm, function(_, wot) {
let realWot;
if (wot[0] == '{') { // wot is a string. Double curly in pre-regex string signifies a variable that is bound to be bound.
isBound = true;
// Remove the outer parentheses now that we know this needs binding.
wot = wot.slice(1,-1);
}
if (wot[0] == '@') {
// This is an attribute not handled earlier. It's hopefully a shadow DOM host attribute as regular bound attribute vars are not yet supported.
if (!shadHost) return _; // Shouldn't handle this yet. Only handle it when called from _renderCompDoms.
isAttribute = true;
wot = wot.slice(1);
let hostColon = 'host:';
if (wot.indexOf(hostColon) !== -1) {
isHost = true;
wot = wot.replace(hostColon, '');
if (shadHost.hasAttribute(wot)) {
res = _escapeItem(shadHost.getAttribute(wot));
let hostCID = shadHost.getAttribute('data-activeid').replace('d-', '');
realWot = hostCID + 'HOST' + wot; // Store the host active ID so we know that it needs updating inside a shadow DOM host.
} else {
console.log('Component host attribute ' + wot + ' not found.');
return _;
}
} else {
console.log('Non component attribution substitution is not yet supported.');
return _;
}
} else {
// Convert to dot format to make things simpler in the core - it is faster to update if there is only one type of var to look for.
wot = wot.replace(/\[/, '.');
wot = wot.replace(/\]/, '');
// Evaluate the JavaScript expression.
if (wot.indexOf('.') !== -1) {
// This is already scoped in some fashion. If it already has window or scopedVars as the first prefix we can skip it.
// This is separated from the main regex as we will be adding further scoping options later on, and so it will easier to keep this separate.
let firstVar = wot.split('.')[0];
// Return the wot if it prefixed with window. It is unlikely someone unfamiliar with the core will use "scopedVars", but do a handling for that anyway.
if (firstVar == 'window') return wot;
if (firstVar == 'scopedVars') {
wot = wot.replace(/^scopedVars\./, '');
}
}
// Prefix with sub-scope (main or _CompRef).
wot = (compRef && privateScopes[compRef]) ? compRef + '.' + wot : 'main.' + wot;
res = _get(scopedVars, wot);
// Return an empty string if undefined.
res = (res === true) ? 'true' : (res === false) ? 'false' : (typeof res === 'string') ? _escapeItem(res) : (typeof res === 'number') ? res.toString() : (res && typeof res === 'object') ? '__object' : ''; // remember typeof null is an "object".
realWot = wot;
}
if (isBound && func.indexOf('Render') !== -1) {
// We only need comment nodes in content output via render - ie. visible stuff. Any other substitution is dynamically rendered from
// original, untouched, config.
_addScopedCID(realWot, obj, compRef);
let retLT, retGT;
if (obj.tagName == 'STYLE') {
retLT = (walker) ? '_cj_s_lts_' : '/*';
retGT = (walker) ? '_cj_s_gts_' : '*/';
} else {
retLT = (walker) ? '_cj_s_lt_' : '<!--';
retGT = (walker) ? '_cj_s_gt_' : '-->';
}
return retLT + 'active-var-' + realWot + retGT + res + retLT + '/active-var' + retGT;
} else {
// If this is an attribute, store more data needed to retrieve the attribute later.
if (func == 'SetAttribute') {
_addScopedAttr(realWot, o, originalStr, walker, compRef);
}
// Send the regular scoped variable back.
return res;
}
});
}
return str;
};
const _replaceScopedVarsExpr = (str, compRef=null) => {
// This function attempts to locate and replace any internal variables in a JavaScript expression or "run" function.
let res, origWot, firstVar;
str = str.replace(/([\u00BF-\u1FFF\u2C00-\uD7FFa-z][\u00BF-\u1FFF\u2C00-\uD7FF\w_\.\:\[\]]+)(?!\u00BF-\u1FFF\u2C00-\uD7FF\w)/gim, function(_, wot) {
origWot = wot;
// Don't convert to dot format as JavaScript barfs on dot notation in evaluation.
// Evaluate the JavaScript expression.
if (wot.indexOf('.') !== -1) {
// This is already scoped in some fashion. If it already has window or scopedVars as the first prefix we can skip it.
// This is separated from the main regex as we will be adding further scoping options later on, and so it will easier to keep this separate.
firstVar = wot.split('.')[0];
// Return the wot if it prefixed with window. It is unlikely someone unfamiliar with the core will use "scopedVars", but do a handling for that anyway.
if (firstVar == 'window') return wot;
if (firstVar == 'scopedVars') {
wot = wot.replace(/^scopedVars\./, '');
}
}
// Prefix with sub-scope (main or _compRef).
wot = (compRef && privateScopes[compRef]) ? compRef + '.' + wot : 'main.' + wot;
res = _get(scopedVars, wot);
if (res !== undefined) {
// Variable definitely exists in some form.
return 'scopedVars.' + wot;
} else {
return origWot;
}
});
return str;
};
const _replaceStringVars = (o, str) => {
// This function should always only be run more once and always after any attribute or variable substitution has taken place, otherwise the content may get
// changed, leading to unpredictable results or injection.
return str.replace(/{\$STRING\}/gi, ((o && o.res) ? o.res : ''));
};
const _resolveAjaxVars = o => {
if (typeof o.res === 'object') {
let compScope = ((o.compRef && privateScopes[o.compRef]) ? o.compRef : 'main');
if (compScope == 'main') {
_resolveAjaxVarsDecl(o.res, compScope);
} else {
// There could be a potential clash in rendering vars if ajax is called before a shadow DOM is drawn. This gets around that.
setTimeout(function() {
_resolveAjaxVarsDecl(o.res, compScope);
_ajaxCallbackDisplay(o);
}, 0); // jshint ignore:line
return;
}
}
_ajaxCallbackDisplay(o);
};
const _resolveAjaxVarsDecl = (res, compScope) => {
// Loop the items in res and assign to variables.
let v;
for (v in res) {
_set(scopedVars, compScope + '.' + v, res[v]);
}
};
const _resolvePath = (path, obj=self, separator='.') => {
var properties = Array.isArray(path) ? path : path.split(separator);
properties.reduce((prev, curr) => prev && prev[curr], obj);
return obj;
};
ActiveCSS._sortOutFlowEscapeChars = str => {
/* These strings stay in the config as they are. They get converted:
1. In replaceAttrs, before JavaScript expressions are evaluated.
2. In extension monitor, before the action value is drawn on the left or the right.
3. In extension elements, when the action value is drawn.
4. It gets put back to the original string value when a target selector or an action value is edited.
*/
let mapObj = {
'_ACSS_later_comma': ',',
'_ACSS_later_brace_start': '{',
'_ACSS_later_brace_end': '}',
'_ACSS_later_semi_colon': ';',
'_ACSS_later_colon': ':',
'_ACSS_later_double_quote': '"',
};
return ActiveCSS._mapRegexReturn(mapObj, str);
};
/***
* Called from _observable-slim.js after a change has been made to a scoped variable.
*
* How variable data-binding is handled in Active CSS. (Various notes written prior to implementation, so this isn't gospel.)
* --------------------------------------------------------------------------------------------------------------------------
* Direct changes to attributes are not covered here - this is just what happens when variables change, not attributes. See the create-element command for that code.
*
* All scoped variables that are set are contained to a IIFE limited variable "scoped", and changed via the notifier Proxy "scopedVars".
* The "scoped" variable is not referenced directly.
*
* Each new variable that gets set adds to a mirror map of the scoped variable that is populated with data relating to what needs updating.
* This array is created whenever an item is found to render. When a change is made, it is looked up in the render array and it is redrawn accordingly.
*
* Each time a variable is rendered, the Active ID related to the target is stored. This is vital for updates to both text content and attributes, to localise
* any later DOM manipulation and make it quick to search for text nodes and to get the target element in the case of updating attributes.
*
* Handling text content in divs, etc. (eg. {{player}}):
* The data object contains all the information necessary to re-render DOM location, indexed by unique Active ID, and within this can be found items such as
* comment locations or element attribute locations.
* Multiple comments fall under the ActiveID, as do multiple attribute locations (per element).
* Data within comments get fully replaced. This is a simple search for a unique comment string under the Active ID element tree.
*
* Handling variables in attributes. (eg. {{player}})
* Attributes are handled differently. The Active ID element is found. The unrendered string after attribute substitution is stored - this is once per element that
* targets an attribute. Multiple variables or instances of the same variable can exist within one attribute.
* On subsequent changes, the process happens again based on the string prior to the previous variable substition, but after the attribute substitution.
*
* In both rendering into attributes and regular text, if the element is no longer there, ie. the Active ID is no longer found on the page, then the variable
* references are removed. This could be set to a remove var command which, on setting the var to a unique value, would trigger a deletion of the references
* and a deletion of the variable from the scoped container.
*
* There should be a preInit event of some kind for the setting of variables so that they are present when the body is first drawn on the page, in the event of
* server-side code containing vars to render. It should be in the docs that it is recommended for such divs to be hidden until the body draw event occurs, otherwise
* people will see a flicker of "{player}" in text on the screen, rather than "Dave", during the period where Active CSS initializes.
*
* New components and content to render should have the variable substitution occur in the text to render *prior* to the final render of the text and the subsequent
* draw event.
*/
ActiveCSS._varUpdateDom = (changes) => {
/**
* changes contains eg.:
* change.type = add/update/delete - used here
* change.target = ["X","O","X","O","O","X","","",""]
* change.property = "3"
* change.newValue = "O"
* change.previousValue = "";
* change.currentPath = "gameState.3"
* change.jsonPointer = "/gameState/3"
* change.proxy = ["X","O","X","O","O","X","","",""]
*/
let change, dataObj, changeDiff, innerChange;
for (change of changes) {
if (change.currentPath.indexOf('.') === -1 && change.currentPath.indexOf('HOST') === -1) continue; // Skip all actions on the root scoped variable.
if (typeof change.previousValue == 'object' || typeof change.newValue == 'object') {
// This is an object or an array, or some sort of type change. Get a diff and apply the applicable change to each item.
// The reason we've got here in the code is that a whole array is being redeclared or something, and there may be individually rendered sub-elements
// we need to handle. If you redeclare a whole array, observableslim doesn't send multiple inner changes - so we need to simulate this instead so that
// we can update the DOM. We're only making the specific changes needed - that's why we use a diff.
change.previousValue = (!change.previousValue) ? [] : change.previousValue;
// Sometimes previousValue is returned as a proxy from observableslim. Dunno why. Reference the non-scoped var if so, as it will have the same value.
change.previousValue = (change.previousValue.__isProxy === true) ? change.previousValue.__getTarget : change.previousValue;
// This next line brings back a complex object diff that indicates type of change.
changeDiff = recursiveDiff.getDiff(change.previousValue, change.newValue); // https://github.com/cosmicanant/recursive-diff
for (innerChange of changeDiff) {
innerChange.path = change.currentPath + ((!innerChange.path) ? '' : '.' + innerChange.path.join('.'));
dataObj = _get(scopedData, innerChange.path);
if (!dataObj) continue; // No point doing anything yet - it's not been rendered.
innerChange.val = (!innerChange.val) ? '' : innerChange.val;
_varUpdateDomDo({
currentPath: innerChange.path,
newValue: innerChange.val,
type: innerChange.op
}, dataObj); // We need this - we may have a complex object.
}
} else {
dataObj = _get(scopedData, change.currentPath);
if (!dataObj) continue; // No point doing anything yet - it's not been rendered.
_varUpdateDomDo(change, dataObj);
}
}
};
const _varUpdateDomDo = (change, dataObj) => {
let refObj, cid, el, pos, treeWalker, commentNode, frag, thisNode, content, attrArr, attr, attrOrig, attrContent, theHost, theDoc, colonPos, obj, scopeRef;
// Get the reference object for this variable path if it exists.
refObj = change.newValue;
// Handle content wrapped in comments.
// Loop all items that are affected by this change and update them. We can get the Active IDs and isolate the tags required.
colonPos = change.currentPath.indexOf('HOST');
theHost = null;
theDoc = document;
let compScope = null;
// There has been a recent change whereby the scope of the document may have nothing to with the scope of the variable. Ie. you can have nested shadow DOM
// components in the document variable scope, or you could have a non-private component within a shadow DOM area.
// dataObj contains the correct variable information. That contains the top host of the variable scope.
// theDoc needs to contain the correct display root on a per item basis - so it cannot be worked out in advance.
// Same for theHost. It can no longer be worked out in advance now that variable scoping spreads beyond component boundaries.
// Is this a scoped component variable? If so, it will look something like this: _3.varname.
if (change.currentPath.substr(0, 1) == '_') {
compScope = change.currentPath.substr(0, change.currentPath.indexOf('.'));
if (change.type == 'delete' && compScope == '') {
// The whole scope has been deleted. Clean up.
delete shadowDoms[change.currentPath];
delete scopedData[change.currentPath];
delete actualDoms[change.currentPath];
return;
}
}
for (obj in dataObj.cids) {
// Locate and update inside comments.
// Create a tree of comments to iterate. There's only one tag here, so there shouldn't be a huge amount. It would be very weird if there was.
cid = dataObj.cids[obj].cid;
scopeRef = dataObj.cids[obj].scopeRef; // Scope ref is the *display* area - not the variable area!
theDoc = (!scopeRef) ? document : actualDoms[scopeRef];
if (typeof theDoc == 'undefined') continue; // Not there, skip it. It might not be drawn yet.
// The host specifically refers to the root containing the component, so if that doesn't exist, there is no reference to a host element.
theHost = (supportsShadow && theDoc instanceof ShadowRoot) ? theDoc.host : theDoc.querySelector('[data-activeid="id-' + change.currentPath.substr(1, colonPos - 1) + '"]');
el = theDoc.querySelector('[data-activeid="' + cid + '"]');
if (!el) {
// The node is no longer there at all. Clean it up so we don't bother looking for it again.
delete dataObj.cids[cid];
continue;
}
treeWalker = document.createTreeWalker(
el,
NodeFilter.SHOW_COMMENT
);
// Iterate tree and find unique ref enclosures and update within with newValue.
frag = document.createTextNode(refObj);
while (treeWalker.nextNode()) {
thisNode = treeWalker.currentNode;
if (thisNode.data != 'active-var-' + change.currentPath || thisNode.data == '/active-var' || !thisNode.parentNode.isEqualNode(el)) {
treeWalker.nextNode();
continue; // If this isn't the same parent node or var change, skip it. We got all the appropriate nodes covered with el.
}
// Replace the text content of the fragment with new text.
if (thisNode.nextSibling.data == '/active-var') {
// There is no content there. Insert a text node.
let newNode = document.createTextNode(frag.textContent);
// Yeah, there is no insertAfter() and after() is not supported on Safari according to MDN...
thisNode.parentNode.insertBefore(newNode, thisNode.nextSibling);
} else {
thisNode.nextSibling.textContent = frag.textContent;
}
// Move to the last tag. We know it won't match the first loop condition.
treeWalker.nextNode();
}
// If this element is an inline-style tag, replace this variable if it is there.
if (el.tagName == 'STYLE') {
let regex = new RegExp('\\/\\*active\\-var\\-' + change.currentPath + '\\*\\/(((?!\\/\\*).)*)\\/\\*\\/active\\-var\\*\\/', 'g');
let str = el.textContent;
str = str.replace(regex, function(_, wot) { // jshint ignore:line
return '/*active-var-' + change.currentPath + '*/' + frag.textContent + '/*/active-var*/';
});
el.textContent = str; // Set all instances of this variable in the style at once - may be more than one instance of the same variable.
}
}
// Handle content in attributes.
for (cid in dataObj.attrs) {
cid = dataObj.cids[obj].cid;
scopeRef = dataObj.cids[obj].scopeRef; // Scope ref is the *display* area - not the variable area!
theDoc = (!scopeRef) ? document : actualDoms[scopeRef];
if (typeof theDoc == 'undefined') continue; // Not there, skip it. It might not be drawn yet.
// The host specifically refers to the root containing the component, so if that doesn't exist, there is no reference to a host element.
theHost = (supportsShadow && theDoc instanceof ShadowRoot) ? theDoc.host : theDoc.querySelector('[data-activeid="id-' + change.currentPath.substr(1, colonPos - 1) + '"]');
el = theDoc.querySelector('[data-activeid="' + cid + '"]');
if (!el) {
// The node is no longer there at all. Clean it up so we don't bother looking for it again.
// Note the current method won't work if the same binding variable is in the attribute twice.
// If anyone comes up with a sensible use case, we'll change this method, otherwise it's a bit too niche to put in provisions for
// that scenario at this point.
delete dataObj.attrs[cid];
continue;
}
for ([attr, attrOrig] of Object.entries(dataObj.attrs[cid])) {
if (!el.hasAttribute(attr)) return; // Hasn't been created yet, or it isn't there any more. Skip clean-up anyway. Might need it later.
// Regenerate the attribute from scratch with the latest values. This is the safest way to handler it and cater for multiple different variables
// within the same attribute. Any reference to an attribute variable would already be substituted by this point.
attrContent = _replaceScopedVars(attrOrig, null, '', null, true, theHost, compScope);
el.setAttribute(attr, attrContent);
}
}
};
/* Cookie framework incorporated into core from: https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie/Simple_document.cookie_framework */
const _cookieExists = nam => {
if (!nam || /^(?:expires|max\-age|path|domain|secure)$/i.test(nam)) { return false; }
return (new RegExp("(?:^|;\\s*)" + encodeURIComponent(nam).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=")).test(document.cookie);
};
/* Cookie framework incorporated into core from: https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie/Simple_document.cookie_framework */
const _getCookie = nam => {
if (!nam) return null;
return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(nam).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null;
};
/* Cookie framework incorporated into core from: https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie/Simple_document.cookie_framework */
const _setCookie = (nam, sValue, vEnd, sPath, sDomain, bSecure) => {
if (!nam || /^(?:expires|max\-age|path|domain|secure)$/i.test(nam)) { return false; }
var sExpires = "";
if (vEnd) {
switch (vEnd.constructor) {
case Number:
sExpires = vEnd === Infinity ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT" : "; max-age=" + vEnd;
break;
case String:
sExpires = "; expires=" + vEnd;
break;
}
}
document.cookie = encodeURIComponent(nam) + "=" + encodeURIComponent(sValue) + sExpires + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : "") + (bSecure ? "; secure" : "");
return true;
};
const _addActValRaw = o => {
// (AV is a reference to o.actVal)
// Remove everything before the "?" in the file URL so we can store it for checking later.
o.avRaw = o.actVal;
if (o.avRaw.indexOf('?')) {
// Remove any parameters to check if it is in configArr - store without the parameters, otherwise we get an accumulation of the same file in configArr.
o.avRaw = _getBaseURL(o.avRaw);
}
};
const _ajax = (getMethod, fileType, filepath, pars, callback, errcallback, varArr) => {
preGetMid++;
var r = new XMLHttpRequest();
r.open(getMethod, filepath, true);
var mime;
switch (fileType) {
case 'html':
case 'txt':
mime = 'text/html';
break;
case 'json':
mime = 'application/json';
break;
default:
mime = 'application/x-www-form-urlencoded';
}
r.setRequestHeader('Content-type', mime);
r.onreadystatechange = function () {
if (r.readyState != 4) return;
if (r.status != 200) {
preGetMid--;
if (errcallback) {
errcallback(r.responseText, r.status, varArr);
} else {
console.log('Tried to get file: ' + filepath + ', but failed with error code: ' + r.status);
return;
}
}
preGetMid--;
if (callback !== null) {
callback(r.responseText, varArr);
}
};
if (getMethod == 'POST' && pars !== null) {
r.send(pars);
} else {
r.send();
}
};
const _ajaxCallback = (str, o) => {
// Convert to a str if it be JSON.
if (typeof str === 'string' && str.trim() !== '') {
o.res = (o.dataType == 'JSON') ? JSON.parse(str) : str;
_resolveAjaxVars(o);
// _ajaxCallbackDisplay(o); is called from _resolveAjaxVars, as it needs to account for the asyncronyousness of the shadow DOM.
} else {
o.res = '';
// Commenting out for now - this will be for ajax return feedback.
// if (debuggerActive || !setupEnded && typeof _debugOutput == 'function') {
// _debugOutput(o); // '', 'ajax' + ((o.preGet) ? '-pre-get' : ''));
// }
_ajaxCallbackDisplay(o);
}
};
const _ajaxCallbackDisplay = (o) => {
if (!o.error && o.preGet) {
// Store it for later.
ajaxResLocations[o.finalURL] = o.res;
} else {
// Run the post event - success or failure.
_ajaxDisplay(o);
if (!o.error && o.cache) {
ajaxResLocations[o.finalURL] = o.res;
}
}
};
const _ajaxCallbackErr = (str, resp, o) => {
if (!o.preGet) {
o.error = true;
o.errorCode = resp;
_ajaxCallback(str, o);
if (debuggerActive || !setupEnded && typeof _debugOutput == 'function') {
_debugOutput('Ajax callback error debug: failed with error "' + resp + '".');
}
} else {
if (debuggerActive || !setupEnded && typeof _debugOutput == 'function') {
_debugOutput('Ajax-pre-get callback error debug: failed with error "' + resp + '".');
}
}
};
const _ajaxDisplay = o => {
let ev = 'afterAjax' + ((o.formSubmit) ? 'Form' + (o.formPreview ? 'Preview' : o.formSubmit ? 'Submit' : '') : '');
if (o.error) ev += o.errorCode;
_handleEvents({ obj: o.obj, evType: ev, otherObj: o, compRef: o.compRef, compDoc: o.compDoc, component: o.component });
if (o.hash !== '') {
document.location.hash = ''; // Needed as Chrome doesn't work without it.
document.location.hash = o.hash;
}
};
const _ajaxDo = o => {
if (o.preGet && preGetMid) {
// This is a pre-get and there is least one pre-get file being loaded. Is there a pre-get max threshold?
// Default preGetMax to 2 files allowed to be being loaded at once.
let maxSet = _getParVal(o.actVal, 'max');
preGetMax = (maxSet != '') ? maxSet : 6; // Default to 6 maximum concurrent ajax requests.
if (preGetMid == preGetMax) return; // Skip this pre-get - there is a threshold set.
}
// Sort out the extra vars and grab the contents of the url.
let ajaxArr = o.actVal.split(' ');
o.formMethod = _optDef(ajaxArr, 'get', 'GET', 'POST');
o.dataType = _optDef(ajaxArr, 'html', 'HTML', 'JSON');
o.cache = _optDef(ajaxArr, 'cache', true, false);
o.nocache = _optDef(ajaxArr, 'nocache', true, false);
let intVars = (o.nocache ? '_=' + Date.now() + '&' : '') + '_ACSS=1' + (o.formPreview ? '&_ACSSFORMPREVIEW=1' : '') + (o.formSubmit ? '&_ACSSFORMSUBMIT=1' : '') + '&_ACSSTYPE=' + o.dataType;
o.pars = intVars;
let url = o.url;
if (url === '') return; // Don't try to pre-get or ajax call empty values.
if (o.formSubmit) {
// Send the form.
o.pars += '&' + _checkForm(o.secSelObj, 'pars');
}
if (o.formMethod == 'GET') {
url = _appendURIPar(url, o.pars, o.doc);
}
// Send any extra parameters if they are defined as GET vars, like pars(drawn=y).
// This can be used when not referenced in setting the url as part of the url-change.
o.hash = '';
let hashPos = url.indexOf('#');
if (hashPos !== -1) {
o.hash = url.substr(hashPos + 1);
url = url.substr(0, hashPos);
}
url = _attachGetVals(o.actVal, url, o.doc, 'get-pars');
o.pars = _attachPostVals(o.actVal, o.pars);
o.finalURL = (o.formMethod == 'GET') ? url : _appendURIPar(url, o.pars, o.doc); // Need the unique url including post vars to store for the caching.
if (ajaxResLocations[o.finalURL]) {
// No need to get it - we have it in cache.
if (!o.preGet) {
// Display it. Copy the result from the cached object over to the primary selector.
o.res = ajaxResLocations[o.finalURL];
_resolveAjaxVars(o);
_ajaxDisplay(o);
}
} else {
_ajax(o.formMethod, o.dataType, url, o.pars, _ajaxCallback.bind(this), _ajaxCallbackErr.bind(this), o);
}
};
const _appendURIPar = (url, pars, doc) => {
// This function adds parameters to a url. It replaces values if they are different, and adds any that aren't there.
// This will break in IE and old Edge browsers as it uses the newer URLSearchParams interface.
// It's pretty basic but does the job. Could probably be optimised further. It is only called when handling certain
// action commands, so it doesn't touch core performance.
// Note: This only currently supports one use of the form var append functionality. More than one referenced will barf.
// To get it working with more than one, strip out all those refs, put in a separate array and handle them individually.
// FIXME.
// Is this a full url? If not, make it so.
var isFullURL = new RegExp('^([a-z]+://|//)', 'i');
if (url === '' || !isFullURL.test(url)) {
url = window.location.protocol + '//' + window.location.host + ((url.substr(0, 1) != '/') ? '/' : '') + url;
}
let newUrl = new URL(url);
let parsArr = pars.split('&'), thisPar, parArr, endBit = '';
for (thisPar of parsArr) {
if (thisPar.indexOf('=') !== -1) {
parArr = thisPar.split('=');
if (parArr[1]) {
// Is this a reference to a form ID? If so, we
newUrl.searchParams.set(parArr[0], parArr[1]);
} else {
newUrl.searchParams.set(parArr[0], '');
}
} else {
if (thisPar.substr(0, 2) == '{#') {
// This could be a special case where we want to grab all the parameters associated with a form and add them
// as pars on the url. This can be useful for setting the src in an iframe where values are needed from
// a form as additional conditions to the src call. Ie. not ajax.
// Note: With an ajax form, you'd normally use ajax-form or ajax-form-preview and send them as post vars.
let formID = thisPar.slice(2, -1);
let el = doc.getElementById(formID);
if (el.tagName == 'FORM') {
let formPars = _checkForm(el, 'pars');
// Call this function again to add the form vars.
let formedUrl = _appendURIPar(newUrl, formPars, doc);
newUrl = new URL(formedUrl);
} // else silently fail. Maybe the form isn't there any more.
} else {
// Remember this clause, we're going to add it on the end. It should be an anchor, which needs to be on the
// end of the url. Either way it's not a fully formed parameter.
endBit += thisPar;
}
}
}
return newUrl + endBit;
};
const _attachGetVals = (str, url, doc, typ) => {
let pars = _getParVal(str, typ);
if (pars) {
url = _appendURIPar(url, pars, doc);
}
return url;
};
const _attachPostVals = (str, urlBit) => {
let pars = _getParVal(str, 'post-pars');
if (pars) {
urlBit += '&' + pars;
}
return urlBit;
};
const _getFile = (filePath, fileType, o={}) => {
_ajax('GET', fileType, filePath, null, _addConfig.bind(this), _addConfigError.bind(this), o);
};
const _getParVal = (str, typ) => {
if (str.indexOf(typ + '(') !== -1) {
let reg = new RegExp(typ + '[\\(]([\\s\\S]+)[\\)]', 'g');
let pars = reg.exec(str) || '';
if (pars) {
return pars[1];
}
}
return '';
};
const _actValSelItem = o => {
let arr = o.actVal.split(' ');
let last = arr.splice(-1);
return [ _getSel(o, arr.join(' ')), last[0] ];
};
ActiveCSS._addClassObj = (obj, str) => {
if (!obj || !obj.classList) return; // element is no longer there.
let arr = str.replace('.', '').split(' ');
obj.classList.add(...arr);
};
const _checkForm = (frm, wot) => {
// opt = 'check' (check if changed), 'pars' (generate as ajax parameters)
if (!frm) return false; // form not there, so unchanged.
var check = (wot == 'check') ? true : false;
var pars = (wot == 'pars') ? true : false;
var parStr = '', parAdd = '&';
var changed = [], n, c, def, i, ol, opt, valu;
for (var e = 0, el = frm.elements.length; e < el; e++) {
n = frm.elements[e];
c = false;
if (!n.hasAttribute('name')) continue;
switch (n.nodeName.toLowerCase()) {
case 'select':
def = 0;
for (i = 0, ol = n.options.length; i < ol; i++) {
opt = n.options[i];
c = c || (opt.selected != n.defaultSelected);
if (opt.defaultSelected) def = i;
}
if (c && !n.multiple) c = (def != n.selectedIndex);
parStr += parAdd + n.getAttribute('name') + '=' + encodeURIComponent(n.options[n.selectedIndex].value);
break;
case 'textarea':
case 'input':
switch (n.type.toLowerCase()) {
case 'checkbox':
c = (n.checked != n.defaultChecked);
parStr += parAdd + n.getAttribute('name') + '=' + ((n.checked) ? 'on' : '');
break;
case 'radio':
c = (n.checked != n.defaultChecked);
if (n.checked) {
parStr += parAdd + n.getAttribute('name') + '=' + encodeURIComponent(n.value);
}
break;
default:
c = (n.value != n.defaultValue);
parStr += parAdd + n.getAttribute('name') + '=' + encodeURIComponent(n.value);
break;
}
break;
case 'hidden':
parStr += (pars) ? parAdd + n.getAttribute('name') + '=' + encodeURIComponent(n.value) : '';
break;
}
if (check && c) {
changed.push(n);
}
}
if (check) {
return (changed.length) ? true : false;
} else if (pars) {
return '_ACSSFORMNAME=' + (frm.name ? frm.name : '') + parStr;
}
};
const _composedPath = (e) => {
// Needed for unsupported browsers, like old Edge.
if (!e.composedPath) {
if (e.path) {
return e.path;
}
let target = e.target;
let path = [];
while (target.parentNode !== null) {
path.push(target);
target = target.parentNode;
}
path.push(document, window);
return path;
} else {
return e.composedPath();
}
};
const _convertToMS = (tim, errMess) => {
if (tim == 'stack') return 0;
var match = /^(\d+)(ms|s)?$/i.exec(tim);
if (!match) {
console.log(errMess);
return false;
}
var n = parseFloat(match[1]);
var type = (match[2] || 'ms').toLowerCase();
return (type == 's') ? n * 1000 : n;
};
ActiveCSS._decodeHTML = str => {
// This is use in the mimic command to work with updating the title. It's not the same as _escapeItem().
let doc = new DOMParser().parseFromString(str, 'text/html');
return doc.documentElement.textContent;
};
const _doDebug = (typ, primSel) => {
if (primSel) {
if (debugMode.indexOf(':') !== -1) {
let a = primSel.split(':');
return debugMode.indexOf(a[0] + ':' + typ) !== -1 ? true : false;
} else {
return debugMode.indexOf(primSel) !== -1 || debugMode.indexOf(typ) !== -1 ? true : false;
}
} else {
if (debugMode.indexOf(':') !== -1) {
return debugMode.indexOf(typ) !== -1 && debugMode.indexOf(':') !== debugMode.indexOf(typ) - 1 ? true : false;
} else {
return debugMode.indexOf(typ) !== -1;
}
}
};
const _eachRemoveClass = (inClass, classToRemove, doc) => {
doc.querySelectorAll('.' + inClass).forEach(function (obj, index) {
if (!obj) return; // element is no longer there.
ActiveCSS._removeClassObj(obj, classToRemove);
});
};
function _escCommaBrack(str, o) {
/**
* "o" is used for reporting on any failing line in the config.
* There is no recursive facility like there is in PCRE for doing the inner bracket recursion count, so doing it manually as the string should be relatively
* small in pretty much all cases.
* Here is an old-school method unless someone has a better idea. Though when JavaScript finally gets a recursive option, it can be converted to a regex.
* String could be this (note the double enclosure - there could be many enclosure levels), so it needs to work in all cases:
* player "X",gameState ['', '', ''],roundDraw false,winners [[0, 1, 2],[3, [2, 3, 4], 4, 5],[6, 7, 8],[0, 4, 8],[2, 4, 6]],testvar ",[,],",testvar2 ',[,],'
* It needs to convert to this:
* player "X",gameState [''__ACSScom ''__ACSScom ''],roundDraw false,winners [[0__ACSScom 1__ACSScom 2]__ACSScom[3__ACSScom [2__ACSScom 3__ACSScom 4]__ACSScom 4__ACSS
com 5]__ACSScom[6__ACSScom 7__ACSScom 8]__ACSScom[0__ACSScom 4__ACSScom 8]__ACSScom[2__ACSScom 4__ACSScom 6]],testvar "__ACSScom[__ACSScom]__ACSScom",testvar2 '__ACSS
com[__ACSScom]__ACSScom'
* Easy solution:
* 1. Escape any commas in quotes or double quotes.
* 2. Split the array by comma.
* 3. Iterate the array.
* 4. Count the number of brackets, curlies and parentheses in any one item.
* 5. If the balance count does not equal or has not resolved to 0, then add the array item plus an escaped comma, to the new string. Otherwise add a real comma.
* 6. Carry the balance count over and repeat from 3.
* 8. Put back any escaped quotes.
* 9. Do any final replacements for the looping of the o.actVal.
* 10. Return the new string.
*/
// Replace escaped double quotes.
str = str.replace(/\\\"/g, '_ACSS_i_dq');
// Replace escaped single quotes.
str = str.replace(/\\'/g, '_ACSS_i_sq');
// Ok to this point.
let mapObj = {
'\\,': '__ACSS_int_com',
'\\(': '_ACSS_i_bo',
'\\)': '_ACSS_i_bc',
'\\{': '_ACSS_i_co',
'\\}': '_ACSS_i_cc',
'\\[': '_ACSS_i_so',
'\\]': '_ACSS_i_sc'
};
let mapObj2 = {
',': '__ACSS_int_com',
'(': '_ACSS_i_bo',
')': '_ACSS_i_bc',
'{': '_ACSS_i_co',
'}': '_ACSS_i_cc',
'[': '_ACSS_i_so',
']': '_ACSS_i_sc'
};
str = str.replace(/("([^"]|"")*")/g, function(_, innards) {
return ActiveCSS._mapRegexReturn(mapObj, innards, mapObj2);
});
str = str.replace(/('([^']|'')*')/g, function(_, innards) {
return ActiveCSS._mapRegexReturn(mapObj, innards, mapObj2);
});
let strArr = str.split(','), balanceCount = 0, newStr = '', item;
for (item of strArr) {
balanceCount += item.split('[').length - item.split(']').length;
balanceCount += item.split('(').length - item.split(')').length;
balanceCount += item.split('{').length - item.split('}').length;
newStr += (balanceCount !== 0) ? item + '__ACSS_int_com' : item + ',';
}
if (balanceCount !== 0) {
// Syntax error - unbalanced expression.
newStr = _escCommaBrackClean(newStr, mapObj2);
newStr = newStr.replace(/__ACSS_int_com/g, ',');
console.log('Unbalanced JavaScript equation in var command - too many brackets, curlies or parentheses, or there could be incorrectly escaped characters: ' + newStr + ', in config: ' + o.file + ', line: ' + o.line);
return newStr;
} else {
// Remove the last comma
newStr = newStr.slice(0, -1);
// Set up the correct formatting for looping the o.actVal.
newStr = newStr.replace(/\,/g, '_ACSSComma');
}
newStr = _escCommaBrackClean(newStr);
return newStr;
}
function _escCommaBrackClean(str, mapObj2) {
// A simple reverse of the object won't give use the regex options we want, so just do a new replace object.
let mapObj = {
'_ACSS_i_dq': '\\"',
'_ACSS_i_sq': "\\'",
'__ACSS_int_com': ',',
'_ACSS_i_bo': '(',
'_ACSS_i_bc': ')',
'_ACSS_i_co': '{',
'_ACSS_i_cc': '}',
'_ACSS_i_so': '[',
'_ACSS_i_sc': ']'
};
str = str.replace(/("([^"]|"")*")/g, function(_, innards) {
return ActiveCSS._mapRegexReturn(mapObj, innards);
});
str = str.replace(/('([^']|'')*')/g, function(_, innards) {
return ActiveCSS._mapRegexReturn(mapObj, innards);
});
return str;
}
const _fullscreenDetails = () => {
let arr;
if ('MSGesture' in window) {
/* Edge weirdness */
arr = [document.webkitFullscreenElement, 'webkit'];
} else {
arr = [document.fullscreenElement, ''];
}
return arr;
};
// Courtesy of https://gist.github.com/harish2704/d0ee530e6ee75bad6fd30c98e5ad9dab
// Modded to return undefined if not set instead of null.
const _get = (object, keys, defaultVal=undefined) => {
keys = Array.isArray(keys) ? keys : keys.replace(/(\[(\d)\])/g, '.$2').split('.');
object = object[keys[0]];
if (object && keys.length > 1) {
return _get(object, keys.slice(1), defaultVal);
}
return object === undefined ? defaultVal : object;
};
const _getActiveID = obj => {
if (obj && obj.dataset) {
if (!obj.dataset.activeid) {
activeIDTrack++;
obj.dataset.activeid = 'id-' + activeIDTrack;
}
return obj.dataset.activeid;
}
return false;
};
const _getBaseURL = str => {
return str.substr(0, str.indexOf('?'));
};
const _getComponentRoot = (obj) => {
// This gets the root of the component - either a scoped host or a shadow DOM rootNode.
let scopedHost = (obj.parentElement && (!supportsShadow || supportsShadow && !(obj.parentNode instanceof ShadowRoot))) ? obj.parentElement.closest('[data-active-scoped]') : false;
let rootNode = obj.getRootNode();
if (!scopedHost && rootNode.isEqualNode(document)) {
// There is no component that contains this element.
return document;
} else if (!scopedHost) {
// This element must be in a shadow root.
return rootNode;
} else {
// If it's gotten this far, then there is a scoped component involved.
if (scopedHost && rootNode.isEqualNode(document)) {
// This has to be a scoped component.
return scopedHost;
} else {
// If it has gotten this far, there is both a scoped component and a shadow component above this element. It won't be in the document.
// But which component is this element really in?
// If the shadow root contains the same exact scoped component, then the element is in the scoped component, as it is lower in the DOM tree.
// If the shadow root does not contain the same exact scoped component, then the element must be in the shadow root, as it is lower in the DOM tree.
// We can just use querySelector for this check. Make sure we check on the exact same scoped component, so we need the data-activeid for this.
return (rootNode.querySelector('[data-activeid=' + scopedHost.getAttribute('data-activeid') + ']')) ? scopedHost : rootNode;
}
}
};
const _getFieldValType = obj => {
switch (obj.tagName) {
case 'INPUT':
case 'TEXTAREA':
return 'value';
default:
return 'innerText';
}
};
const _getFocusedOfNodes = (sel, o) => {
// Find the current focused node in the list, if there is one.
let targArr, nodes, obj, i = -1, useI = -1;
targArr = _splitIframeEls(sel, o.obj, o.compDoc);
if (!targArr) return false; // invalid target.
if (targArr[0].activeElement === null) return -1;
nodes = targArr[0].querySelectorAll(targArr[1]) || null;
for (obj of nodes) {
i++;
if (obj.isSameNode(targArr[0].activeElement)) {
useI = i;
break;
}
}
return [ nodes, useI ];
};
const _getObj = (str) => {
let targArr = _splitIframeEls(str);
if (!targArr) return false; // invalid target.
try {
return targArr[0].querySelector(targArr[1]);
} catch(err) {
return false;
}
};
const _getRealEvent = ev => {
let first5 = ev.substr(0, 5);
if (first5 == 'after' && ev != 'afterprint') { // This is a Active CSS only event, so we don't want to add an event listener.
return false;
} else if (first5 == 'keyup') {
ev = 'keyup';
} else if (ev.substr(0, 7) == 'keydown') {
ev = 'keydown';
} else if (ev == 'fullscreenEnter' || ev == 'fullscreenExit') { // Active CSS only events.
ev = _fullscreenDetails()[1] + 'fullscreenchange'; // Active CSS only events.
} else {
if (['draw', 'disconnectCallback', 'adoptedCallback', 'attributeChangedCallback', 'beforeComponentOpen', 'componentOpen'].includes(ev)) return false; // custom Active CSS events.
if (ev.substr(0, 12) == 'attrChanges-') return false; // custom Active CSS event attrChange-(attrname). We need to do this to avoid clash with custom event names by user.
}
return ev;
};
const _getRootNode = (obj) => {
if (!supportsShadow) {
// Either this element is in a scoped component, or it is in the document. It's a simple check.
return _getScopedRoot(obj) || document;
} else {
// Either this element is in a scoped component, a shadow DOM component, or the document, so it needs a more thorough check.
return _getComponentRoot(obj);
}
};
const _getScopedRoot = (obj) => {
return obj.closest('[data-active-scoped]'); // Should return null if no closest scoped component found.
};
const _getSel = (o, sel) => {
switch (sel) {
case 'me':
case 'self':
case 'this':
return o.secSelObj;
case 'host':
if (['beforeComponentOpen', 'componentOpen'].indexOf(o.event) !== -1) {
// The host is already being used as the target selector with these events.
return o.secSelObj;
}
let rootNode = _getRootNode(o.secSelObj);
return (rootNode._acssScoped) ? rootNode : rootNode.host;
default:
// Grab the element or the first in the group specified.
return _getObj(sel);
}
};
const _getValFromList = (list, item, returnPos=false) => {
let key, obj, prop, co = -1;
for (key in list) {
if (!list.hasOwnProperty(key)) continue;
co++;
obj = list[key];
if (returnPos && obj.name == item) return co;
for (prop in obj) {
if(!obj.hasOwnProperty(prop)) continue;
// Return item after removing any quotes.
if (!returnPos && obj[prop] == item) {
return obj.value.replace(/"/g, '');
}
}
}
return (returnPos) ? -1 : false;
};
const _getWindow = doc => {
try {
return doc.defaultView || doc.parentWindow;
} catch(err) {
return window;
}
};
const _handleQuoAjax = (o, str) => {
return str._ACSSRepQuo();
};
ActiveCSS._hasClassObj = (obj, str) => { // Used by extensions.
return obj.classList.contains(str) || false;
};
const _ifFocus = (o, first=true) => {
let arr = _getFocusedOfNodes(o.actVal, o);
if (first) {
return (arr[1] === 0) ? true : false;
} else {
return (arr[1] == arr[0].length - 1) ? true : false;
}
};
const _ifVarTrue = (val, compRef) => {
// This needs to cater for scoped variables and also window variables.
if (val == 'true') {
return true;
} else if (val == 'false') {
return false;
}
let scopedVar = ((compRef && privateScopes[compRef]) ? compRef : 'main') + '.' + val;
let res = _get(scopedVars, scopedVar);
if (typeof res === 'undefined') {
// If the value wasn't a variable, check if it's a window variable. If not, then just set it to its original value.
res = window[val];
}
return (!res) ? false : res;
};
ActiveCSS._ifVisible = (o, tot) => { // tot true is completely visible, false is partially visible. Used by extensions.
let el = (typeof o.actVal === 'object') ? o.actVal : (o.actVal._ACSSRepQuo().trim() == '') ? o.secSelObj : _getSel(o, o.actVal); // Used by devtools highlighting.
let rect = el.getBoundingClientRect();
let elTop = rect.top;
let elBot = rect.bottom;
return (tot) ? (elTop >= 0) && (elBot <= window.innerHeight) : elTop < window.innerHeight && elBot >= 0;
};
const _mimicReset = e => {
var key, obj, prop;
for (key in e.target.cjsReset) {
if (key == 'title') continue;
obj = e.target.cjsReset[key];
switch (obj.type) {
case 'text':
obj.el.innerText = obj.value;
break;
default:
obj.el.value = obj.value;
break;
}
}
if (e.target.cjsReset.title) {
currDocTitle = ActiveCSS._decodeHTML(e.target.cjsReset.title);
document.title = currDocTitle;
}
};
const _optDef = (arr, srch, opt, def) => {
if (!Array.isArray(arr)) arr = arr.split(' '); // For speed, send in an array already split. For ease, send in a string.
let res = arr.findIndex(item => srch === item.toLowerCase());
return (res !== -1) ? opt : def; // return def if not present.
};
const _outDebug = (showErrs, errs) => {
if (showErrs) {
let err;
for (err of errs) {
console.log(err);
}
}
};
// Solution courtesy of https://github.com/cosmicanant/recursive-diff
// MIT license.
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.recursiveDiff=t():e.recursiveDiff=t()}("undefined"!=typeof self?self:this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){const{types:r,iterableTypes:o,errors:i}=n(1),l=n(2),f={[r.NUMBER]:l.isNumber,[r.BOOLEAN]:l.isBoolean,[r.STRING]:l.isString,[r.DATE]:l.isDate,[r.UNDEFINED]:l.isUndefined,[r.NULL]:l.isNull,[r.ARRAY]:l.isArray,[r.MAP]:l.isMap,[r.SET]:l.isSet,[r.ITERABLE_OBJECT]:l.isIterableObject},u={[r.DATE]:l.areDatesEqual};function a(e){const t=Object.keys(f);let n=r.DEFAULT;for(let r=0;r<t.length;r+=1)if(f[t[r]](e)){n=t[r];break}return n}function s(e,t,n,o){let i;return n===r.UNDEFINED&&o!==r.UNDEFINED?i="add":n!==r.UNDEFINED&&o===r.UNDEFINED?i="delete":!function(e,t,n,r){return n===r&&(u[n]?u[n](e,t):e===t)}(e,t,n,o)?i="update":l.noop(),i}function c(e,t,n,i,l){const f=a(e),u=a(t),p=i||[],d=l||[];if(function(e,t){return e===t&&o.indexOf(e)>=0}(f,u)){const o=function(e,t,n){let o;return n===r.ITERABLE_OBJECT?o=new Set(Object.keys(e).concat(Object.keys(t))):n===r.ARRAY&&(o=e.length>t.length?new Array(e.length):new Array(t.length),o=o.fill(0,0),o=o.map((e,t)=>t),o=new Set(o)),o}(e,t,f).values();let i=o.next().value;for(;null!=i;)c(e[i],t[i],n,p.concat(i),d),i=o.next().value}else{const r=s(e,t,f,u);null!=r&&d.push(function(e,t,n,r,o){const i={op:n,path:r};return"add"!==n&&"update"!==n||(i.val=t),o&&"add"!==n&&(i.oldVal=e),i}(e,t,r,i,n))}return d}const p={add:l.setValueByPath,update:l.setValueByPath,delete:l.deleteValueByPath};e.exports={getDiff:(e,t,n=!1)=>c(e,t,n),applyDiff:(e,t,n)=>function(e,t,n){if(!(t instanceof Array))throw new Error(i.INVALID_DIFF_FORMAT);let r=e;return t.forEach(e=>{const{op:t,val:o,path:l}=e;if(!p[t])throw new Error(i.INVALID_DIFF_OP);r=p[t](r,l,o,n)}),r}(e,t,n)}},function(e,t){const n={NUMBER:"NUMBER",BOOLEAN:"BOOLEAN",STRING:"STRING",NULL:"NULL",UNDEFINED:"UNDEFINED",DATE:"DATE",ARRAY:"ARRAY",MAP:"MAP",SET:"SET",ITERABLE_OBJECT:"ITERABLE_OBJECT",DEFAULT:"OBJECT"};e.exports={types:n,iterableTypes:[n.ITERABLE_OBJECT,n.MAP,n.ARRAY,n.SET],errors:{EMPTY_DIFF:"No diff object is provided, Nothing to apply",INVALID_DIFF_FORMAT:"Invalid diff format",INVALID_DIFF_OP:"Unsupported operation provided into diff object"}}},function(e,t){const n=e=>t=>t instanceof e,r=n(Date),o=n(Array),i=n(Map),l=n(Set),f=e=>"[object Object]"===Object.prototype.toString.call(e);e.exports={isNumber:e=>"number"==typeof e,isBoolean:e=>"boolean"==typeof e,isString:e=>"string"==typeof e,isDate:r,isUndefined:e=>void 0===e,isNull:e=>null===e,isArray:o,isMap:i,isSet:l,isIterableObject:f,noop:()=>{},areDatesEqual:(e,t)=>e.getTime()===t.getTime(),setValueByPath:function(e,t=[],n,r){if(!o(t))throw new Error(`Diff path: "${t}" is not valid`);const{length:i}=t;if(0===i)return n;let l=e;for(let o=0;o<i;o+=1){const f=t[o];if(!l)throw new Error(`Invalid path: "${t}" for object: ${JSON.stringify(e,null,2)}`);if(null==f)throw new Error(`Invalid path: "${t}" for object: ${JSON.stringify(e,null,2)}`);o!==i-1?(l=l[f],r&&r(l)):l[f]=n}return e},deleteValueByPath:function(e,t){const n=t||[];if(0===n.length)return;let r=e;const{length:o}=n;for(let i=0;i<o;i+=1)if(i!==o-1){if(!r[n[i]])throw new Error(`Invalid path: "${t}" for object: ${JSON.stringify(e,null,2)}`);r=r[n[i]]}else if(f(r))delete r[n[i]];else{const e=parseInt(n[i],10);for(;r.length>e;)r.pop()}return e}}}])})); // jshint ignore:line
ActiveCSS._removeClassObj = (obj, str) => {
if (!obj || !obj.classList) return; // element is no longer there.
let arr = str.replace('.', '').split(' ');
obj.classList.remove(...arr);
};
ActiveCSS._removeObj = obj => {
if (!obj) return; // element is no longer there.
obj.parentNode.removeChild(obj);
};
const _resolveURL = url => {
let orig = document.location.href, st = history.state, t = document.title;
history.replaceState(st, t, url);
let resUrl = document.location.href;
history.replaceState(st, t, orig);
return resUrl;
};
const _selCompare = (o, opt) => {
// Takes two parameters. First a selector, and secondly something else to compare.
let actVal = o.actVal._ACSSSpaceQuoIn();
let spl, compareVal;
if (opt == 'eM') {
// There can be only one (parameter).
if (!actVal) return true; // No point going further - this could be a variable substitution that equates to empty.
if (actVal && actVal == '__object') return false; // No point going further - this is not empty - it is an array or a variable object.
spl = actVal._ACSSSpaceQuoOut();
} else {
// There are two parameters with this conditional.
spl = actVal.split(' ');
compareVal = spl.pop()._ACSSSpaceQuoOut()._ACSSRepQuo();
spl = spl.join(' ');
}
let el;
el = _getSel(o, spl);
if (!el) {
el = spl;
}
switch (opt) {
case 'eM':
case 'maL':
case 'miL':
// _c.IfEmpty, _c.IfMaxLength, _c.IfMinLength
let firstVal;
if (el && el.nodeType && el.nodeType == Node.ELEMENT_NODE) {
let valWot = _getFieldValType(el);
firstVal = el[valWot];
} else {
firstVal = el;
}
switch (opt) {
case 'eM':
return (!firstVal || firstVal === '') ? true : false;
case 'maL':
return (firstVal.length <= compareVal) ? true : false;
case 'miL':
return (firstVal.length >= compareVal) ? true : false;
}
break;
case 'iT':
// _c.IfInnerText
return (el && compareVal == el.innerText) ? true : false;
case 'iH':
// _cIfInnerHTML
return (el && compareVal == el.innerHTML) ? true : false;
}
};
// Courtesy of https://stackoverflow.com/a/54733755
// See stackoverflow for full comments.
const _set = (obj, path, value) => {
if (Object(obj) !== obj) return obj;
if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || [];
path.slice(0,-1).reduce((a, c, i) =>
Object(a[c]) === a[c] ? a[c] : a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {}, obj)[path[path.length - 1]] = value;
return obj;
};
const _setClassObj = (obj, str) => {
if (!obj || !obj.classList) return; // element is no longer there.
obj.className = str;
};
const _setsrcObj = (obj, inSrc) => {
if (!obj) return; // element is no longer there.
obj.src = inSrc;
};
const _toggleClassObj = (obj, str) => {
if (!obj || !obj.classList) return; // element is no longer there.
obj.classList.toggle(str);
};
const _urlTitle = (url, titl, o) => {
url = url.replace(/"/g, '');
titl = titl.replace(/"/g, '');
url = _resolveURL(url);
if (window.location.href != url) {
window.history.pushState(url, titl, url);
}
document.title = titl;
};
String.prototype._ACSSCapitalize = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
};
String.prototype._ACSSCapitalizeAttr = function() {
return this.replace(/(^|[\s-])\S/g, function (match) {
return match.toUpperCase();
});
};
String.prototype._ACSSConvFunc = function() {
// Note - this is used for both conditionals and commands, so we don't add the "_a" or "_c" at the beginning.
return this._ACSSCapitalizeAttr().replace(/\-/g, '');
};
String.prototype._ACSSRepQuo = function() {
var html = this.replace(/\\"/g, '_ACSS*�%_');
html = html.replace(/"/g, '');
html = html.replace(/_ACSS\*�%_/g, '"');
return html;
};
String.prototype._ACSSSpaceQuoIn = function() {
let str = this.replace(/"(.+?)"/g, function(_, innards) {
innards = '"' + innards.replace(/ /g, '_ACSS_space') + '"';
return innards;
});
return str;
};
String.prototype._ACSSSpaceQuoOut = function() {
return this.replace(/_ACSS_space/g, ' ');
};
// For Firefox 48.
if (window.NodeList && !NodeList.prototype.forEach) {
NodeList.prototype.forEach = function (callback, thisArg) {
thisArg = thisArg || window;
for (var i = 0; i < this.length; i++) {
callback.call(thisArg, this[i], i, this);
}
};
}
// Edge hack - just get it vaguely working on old Edge. Shadow DOM components are not supported in Edge, so they won't work in Active CSS either.
if (!document.head.attachShadow) {
supportsShadow = false;
if (!('isConnected' in Node.prototype)) {
Object.defineProperty(Node.prototype, 'isConnected', {
get() {
return (!this.ownerDocument || !(this.ownerDocument.compareDocumentPosition(this) & this.DOCUMENT_POSITION_DISCONNECTED));
},
});
}
}
// Is there inline Active CSS? If so, initiate the core.
document.addEventListener('DOMContentLoaded', function(e) {
setTimeout(function() {
// User setup should have started by this point. If not, initialise Active CSS anyway.
// If there is a user setup initialized, then inline acss is handled there and not here.
// This is so that _readSiteMap happens at the end of config accumulation and we can fire all the initalization events at once.
if (!userSetupStarted) {
autoStartInit = true;
ActiveCSS.init();
}
}, 0);
});
}(window, document));
| 43.344473 | 4,398 | 0.667894 |
c860fc5fe529a895ecb5e20bbc10ce6ef0fc4c86 | 2,142 | js | JavaScript | client_apollo_react/src/components/SignIn/index.js | hygtfrde/graphQL_messenger | 0b6160767bd460646dc93413ec2b1ec10c5dc077 | [
"MIT"
] | null | null | null | client_apollo_react/src/components/SignIn/index.js | hygtfrde/graphQL_messenger | 0b6160767bd460646dc93413ec2b1ec10c5dc077 | [
"MIT"
] | null | null | null | client_apollo_react/src/components/SignIn/index.js | hygtfrde/graphQL_messenger | 0b6160767bd460646dc93413ec2b1ec10c5dc077 | [
"MIT"
] | null | null | null | import React, { Component } from 'react';
import { withRouter } from 'react-router-dom';
import { Mutation } from 'react-apollo';
import gql from 'graphql-tag';
import { SignUpLink } from '../SignUp';
import * as routes from '../../constants/routes';
import ErrorMessage from '../Error';
const SIGN_IN = gql`
mutation($login: String!, $password: String!) {
signIn(login: $login, password: $password) {
token
}
}
`;
const SignInPage = ({ history, refetch }) => (
<div>
<h1>SignIn</h1>
<SignInForm history={history} refetch={refetch} />
<SignUpLink />
</div>
);
const INITIAL_STATE = {
login: '',
password: '',
};
class SignInForm extends Component {
state = { ...INITIAL_STATE };
onChange = event => {
const { name, value } = event.target;
this.setState({ [name]: value });
};
onSubmit = (event, signIn) => {
signIn().then(async ({ data }) => {
this.setState({ ...INITIAL_STATE });
localStorage.setItem('token', data.signIn.token);
await this.props.refetch();
this.props.history.push(routes.MESSAGE_BOARD);
});
event.preventDefault();
};
render() {
const { login, password } = this.state;
const isInvalid = password === '' || login === '';
return (
<Mutation mutation={SIGN_IN} variables={{ login, password }}>
{(signIn, { data, loading, error }) => (
<form onSubmit={event => this.onSubmit(event, signIn)}>
<input
name="login"
value={login}
onChange={this.onChange}
type="text"
placeholder="Email or Username"
/>
<input
name="password"
value={password}
onChange={this.onChange}
type="password"
placeholder="Password"
/>
<button disabled={isInvalid || loading} type="submit">
Sign In
</button>
{error && <ErrorMessage error={error} />}
</form>
)}
</Mutation>
);
}
}
export default withRouter(SignInPage);
export { SignInForm };
| 23.538462 | 67 | 0.546685 |
c861579e1baf6cd9a34cfd25ca4ba60ac25806af | 12,490 | js | JavaScript | native-base-theme/components/ListItem.js | Lambda-School-Labs/council-fe | 7d6f4a64427324a72fbeb8d5fb5e29942b8ab8a6 | [
"MIT"
] | null | null | null | native-base-theme/components/ListItem.js | Lambda-School-Labs/council-fe | 7d6f4a64427324a72fbeb8d5fb5e29942b8ab8a6 | [
"MIT"
] | null | null | null | native-base-theme/components/ListItem.js | Lambda-School-Labs/council-fe | 7d6f4a64427324a72fbeb8d5fb5e29942b8ab8a6 | [
"MIT"
] | null | null | null | // @flow
import { Platform, PixelRatio } from 'react-native'
import pickerTheme from './Picker'
import variables, { platform, PLATFORM } from './../variables/commonColor'
export default _ => {
const { ui, text } = variables.councils
const selectedStyle = {
'NativeBase.Text': {
color: variables.listItemSelected
},
'NativeBase.Icon': {
color: variables.listItemSelected
}
};
return {
'NativeBase.InputGroup': {
'NativeBase.Icon': {
paddingRight: 5
},
'NativeBase.IconNB': {
paddingRight: 5
},
'NativeBase.Input': {
paddingHorizontal: 5
},
flex: 1,
borderWidth: null,
margin: -10,
borderBottomColor: 'transparent'
},
'.searchBar': {
'NativeBase.Item': {
'NativeBase.Icon': {
backgroundColor: 'transparent',
color: variables.dropdownLinkColor,
fontSize:
platform === PLATFORM.IOS
? variables.iconFontSize - 10
: variables.iconFontSize - 5,
alignItems: 'center',
marginTop: 2,
paddingRight: 8
},
'NativeBase.IconNB': {
backgroundColor: 'transparent',
color: null,
alignSelf: 'center'
},
'NativeBase.Input': {
alignSelf: 'center'
},
alignSelf: 'center',
alignItems: 'center',
justifyContent: 'flex-start',
flex: 1,
height: platform === PLATFORM.IOS ? 30 : 40,
borderColor: 'transparent',
backgroundColor: '#fff',
borderRadius: 5
},
'NativeBase.Button': {
'.transparent': {
'NativeBase.Text': {
fontWeight: '500'
},
paddingHorizontal: null,
paddingLeft: platform === PLATFORM.IOS ? 10 : null
},
paddingHorizontal: platform === PLATFORM.IOS ? undefined : null,
width: platform === PLATFORM.IOS ? undefined : 0,
height: platform === PLATFORM.IOS ? undefined : 0
},
backgroundColor: variables.toolbarInputColor,
padding: 10,
marginLeft: null
},
'NativeBase.CheckBox': {
marginLeft: -10,
marginRight: 10
},
'.first': {
'.itemHeader': {
paddingTop: variables.listItemPadding + 3
}
},
'.itemHeader': {
'.first': {
paddingTop: variables.listItemPadding + 3
},
borderBottomWidth:
platform === PLATFORM.IOS ? variables.borderWidth : null,
marginLeft: null,
padding: variables.listItemPadding,
paddingLeft: variables.listItemPadding + 5,
paddingTop:
platform === PLATFORM.IOS ? variables.listItemPadding + 25 : undefined,
paddingBottom:
platform === PLATFORM.ANDROID ? variables.listItemPadding + 20 : undefined,
flexDirection: 'row',
borderColor: variables.listBorderColor,
'NativeBase.Text': {
fontSize: 14,
color: platform === PLATFORM.IOS ? undefined : variables.listNoteColor
}
},
'.itemDivider': {
borderBottomWidth: null,
marginLeft: null,
padding: variables.listItemPadding,
paddingLeft: variables.listItemPadding + 5,
backgroundColor: variables.listDividerBg,
flexDirection: 'row',
borderColor: variables.listBorderColor
},
'.selected': {
'NativeBase.Left': {
...selectedStyle
},
'NativeBase.Body': {
...selectedStyle
},
'NativeBase.Right': {
...selectedStyle
},
...selectedStyle
},
'NativeBase.Left': {
'NativeBase.Body': {
'NativeBase.Text': {
'.note': {
color: variables.listNoteColor,
fontWeight: '200'
},
fontWeight: '600'
},
marginLeft: 10,
alignItems: null,
alignSelf: null
},
'NativeBase.Icon': {
width: variables.iconFontSize - 10,
fontSize: variables.iconFontSize - 10
},
'NativeBase.IconNB': {
width: variables.iconFontSize - 10,
fontSize: variables.iconFontSize - 10
},
'NativeBase.Text': {
alignSelf: 'center'
},
flexDirection: 'row'
},
'NativeBase.Body': {
'NativeBase.Text': {
marginHorizontal: variables.listItemPadding,
'.note': {
color: variables.listNoteColor,
fontWeight: '200'
}
},
alignSelf: null,
alignItems: null
},
'NativeBase.Right': {
'NativeBase.Badge': {
alignSelf: null
},
'NativeBase.PickerNB': {
'NativeBase.Button': {
marginRight: -15,
'NativeBase.Text': {
color: variables.topTabBarActiveTextColor
}
}
},
'NativeBase.Button': {
alignSelf: null,
'.transparent': {
'NativeBase.Text': {
color: variables.topTabBarActiveTextColor
}
}
},
'NativeBase.Icon': {
alignSelf: null,
fontSize: variables.iconFontSize - 8,
color: '#c9c8cd'
},
'NativeBase.IconNB': {
alignSelf: null,
fontSize: variables.iconFontSize - 8,
color: '#c9c8cd'
},
'NativeBase.Text': {
'.note': {
color: variables.listNoteColor,
fontWeight: '200'
},
alignSelf: null
},
'NativeBase.Thumbnail': {
alignSelf: null
},
'NativeBase.Image': {
alignSelf: null
},
'NativeBase.Radio': {
alignSelf: null
},
'NativeBase.Checkbox': {
alignSelf: null
},
'NativeBase.Switch': {
alignSelf: null
},
padding: null,
flex: 0.28
},
'NativeBase.Text': {
'.note': {
color: variables.listNoteColor,
fontWeight: '200'
},
alignSelf: 'center'
},
'.last': {
marginLeft: -(variables.listItemPadding + 5),
paddingLeft: (variables.listItemPadding + 5) * 2,
top: 1
},
'.avatar': {
'NativeBase.Left': {
flex: 0,
alignSelf: 'flex-start',
paddingTop: 14
},
'NativeBase.Body': {
'NativeBase.Text': {
marginLeft: null,
color: text.darkGreenBlue
},
flex: 1,
paddingVertical: variables.listItemPadding,
borderBottomWidth: 0,
borderColor: variables.listBorderColor,
marginLeft: variables.listItemPadding + 5,
},
'NativeBase.Right': {
'NativeBase.Text': {
'.note': {
fontSize: variables.noteFontSize - 2
}
},
flex: 0,
paddingRight: variables.listItemPadding + 5,
alignSelf: 'stretch',
paddingVertical: variables.listItemPadding,
borderBottomWidth: 0,
borderColor: variables.listBorderColor
},
'.noBorder': {
'NativeBase.Body': {
borderBottomWidth: null
},
'NativeBase.Right': {
borderBottomWidth: null
}
},
borderBottomWidth: null,
paddingVertical: null,
paddingRight: null
},
'.thumbnail': {
'NativeBase.Left': {
flex: 0
},
'NativeBase.Body': {
'NativeBase.Text': {
marginLeft: null
},
flex: 1,
paddingVertical: variables.listItemPadding + 8,
borderBottomWidth: variables.borderWidth,
borderColor: variables.listBorderColor,
marginLeft: variables.listItemPadding + 5
},
'NativeBase.Right': {
'NativeBase.Button': {
'.transparent': {
'NativeBase.Text': {
fontSize: variables.listNoteSize,
color: variables.sTabBarActiveTextColor
}
},
height: null
},
flex: 0,
justifyContent: 'center',
alignSelf: 'stretch',
paddingRight: variables.listItemPadding + 5,
paddingVertical: variables.listItemPadding + 5,
borderBottomWidth: variables.borderWidth,
borderColor: variables.listBorderColor
},
'.noBorder': {
'NativeBase.Body': {
borderBottomWidth: null
},
'NativeBase.Right': {
borderBottomWidth: null
}
},
borderBottomWidth: null,
paddingVertical: null,
paddingRight: null
},
'.icon': {
'.last': {
'NativeBase.Body': {
borderBottomWidth: null
},
'NativeBase.Right': {
borderBottomWidth: null
},
borderBottomWidth: variables.borderWidth,
borderColor: variables.listBorderColor
},
'NativeBase.Left': {
'NativeBase.Button': {
'NativeBase.IconNB': {
marginHorizontal: null,
fontSize: variables.iconFontSize - 5
},
'NativeBase.Icon': {
marginHorizontal: null,
fontSize: variables.iconFontSize - 8
},
alignSelf: 'center',
height: 29,
width: 29,
borderRadius: 6,
paddingVertical: null,
paddingHorizontal: null,
alignItems: 'center',
justifyContent: 'center'
},
'NativeBase.Icon': {
width: variables.iconFontSize - 5,
fontSize: variables.iconFontSize - 2
},
'NativeBase.IconNB': {
width: variables.iconFontSize - 5,
fontSize: variables.iconFontSize - 2
},
paddingRight: variables.listItemPadding + 5,
flex: 0,
height: 44,
justifyContent: 'center',
alignItems: 'center'
},
'NativeBase.Body': {
'NativeBase.Text': {
marginLeft: null,
fontSize: 17
},
flex: 1,
height: 44,
justifyContent: 'center',
borderBottomWidth: 1 / PixelRatio.getPixelSizeForLayoutSize(1),
borderColor: variables.listBorderColor
},
'NativeBase.Right': {
'NativeBase.Text': {
textAlign: 'center',
color: '#8F8E95',
fontSize: 17
},
'NativeBase.IconNB': {
color: '#C8C7CC',
fontSize: variables.iconFontSize - 10,
alignSelf: 'center',
paddingLeft: 10,
paddingTop: 3
},
'NativeBase.Icon': {
color: '#C8C7CC',
fontSize: variables.iconFontSize - 10,
alignSelf: 'center',
paddingLeft: 10,
paddingTop: 3
},
'NativeBase.Switch': {
marginRight: Platform.OS === PLATFORM.IOS ? undefined : -5,
alignSelf: null
},
'NativeBase.PickerNB': {
...pickerTheme()
},
flexDirection: 'row',
alignItems: 'center',
flex: 0,
alignSelf: 'stretch',
height: 44,
justifyContent: 'flex-end',
borderBottomWidth: 1 / PixelRatio.getPixelSizeForLayoutSize(1),
borderColor: variables.listBorderColor,
paddingRight: variables.listItemPadding + 5
},
'.noBorder': {
'NativeBase.Body': {
borderBottomWidth: null
},
'NativeBase.Right': {
borderBottomWidth: null
}
},
borderBottomWidth: null,
paddingVertical: null,
paddingRight: null,
height: 44,
justifyContent: 'center'
},
'.noBorder': {
borderBottomWidth: null
},
'.noIndent': {
marginLeft: null,
padding: variables.listItemPadding,
paddingLeft: variables.listItemPadding + 6
},
alignItems: 'center',
flexDirection: 'row',
paddingRight: variables.listItemPadding + 6,
paddingVertical: variables.listItemPadding + 3,
marginLeft: variables.listItemPadding + 6,
borderBottomWidth: 1 / PixelRatio.getPixelSizeForLayoutSize(1),
backgroundColor: variables.listBg,
borderColor: variables.listBorderColor
}
}
| 27.817372 | 84 | 0.519135 |
c8619d41cbe9422a1f98b0e8f8868bdbf57de66c | 544 | js | JavaScript | app/@esri/calcite-ui-icons/js/layerBroken32.js | lizeidsness/minimalist | 57657f7b37d2251b95dafe92e1d3776301a3a1c0 | [
"Apache-2.0"
] | 3 | 2020-07-17T21:04:01.000Z | 2021-11-30T15:14:45.000Z | app/@esri/calcite-ui-icons/js/layerBroken32.js | lizeidsness/minimalist | 57657f7b37d2251b95dafe92e1d3776301a3a1c0 | [
"Apache-2.0"
] | 4 | 2020-04-16T19:24:25.000Z | 2021-11-29T20:15:32.000Z | app/@esri/calcite-ui-icons/js/layerBroken32.js | lizeidsness/minimalist | 57657f7b37d2251b95dafe92e1d3776301a3a1c0 | [
"Apache-2.0"
] | 5 | 2020-06-11T20:51:53.000Z | 2021-11-30T15:22:13.000Z | export const layerBroken32 = "M1.006 27.866L1 27.9c-.103-.051-.085-.055.006-.034zM16 27.9c-7.178 2.393-14.242.137-14.994-.034L5 3.9a13.387 13.387 0 0 0 11 0c5-2 11 0 11 0l4 24c.96.48-6.96-2.68-15 0zm13.769-1.307L26.117 4.685a20.301 20.301 0 0 0-5.043-.674 12.648 12.648 0 0 0-4.702.818 16.272 16.272 0 0 1-6.033 1.24 13.214 13.214 0 0 1-4.553-.8L2.143 27.126a28.17 28.17 0 0 0 6.784.864 21.342 21.342 0 0 0 6.757-1.04 23.333 23.333 0 0 1 7.389-1.142 29.997 29.997 0 0 1 6.696.784zM16.5 21.5a1 1 0 1 0 1 1 1.002 1.002 0 0 0-1-1zM17 9h-1v10h1z";
| 272 | 543 | 0.680147 |
c861db07f931f60c616e5e6f0a19acfba832e545 | 234 | js | JavaScript | test/common/number.test.js | demonly/utils | 85576e20a68212a4a9292d8b51b3b90275db1297 | [
"MIT"
] | 1 | 2020-06-05T08:34:39.000Z | 2020-06-05T08:34:39.000Z | test/common/number.test.js | demonly/utils | 85576e20a68212a4a9292d8b51b3b90275db1297 | [
"MIT"
] | 9 | 2021-08-25T08:40:24.000Z | 2021-08-25T08:40:26.000Z | test/common/number.test.js | demonly/utils | 85576e20a68212a4a9292d8b51b3b90275db1297 | [
"MIT"
] | 2 | 2020-06-05T08:40:56.000Z | 2021-03-22T17:46:26.000Z | const assert = require('power-assert');
const { isEqual } = require('../../src/common/number');
describe('number', () => {
describe('isEqual', () => {
it('正常返回', () => {
assert(isEqual(0.1 + 0.2, 0.3));
});
});
});
| 21.272727 | 55 | 0.5 |
c862f46f492bda033304cdd9a20f2a36c05bdf06 | 745 | js | JavaScript | app/notes/config.route.js | Bovojon/Refactoring-meganote-practice | 1ac7d3da513c3d520b6f553292f7b324f7fc8287 | [
"MIT"
] | null | null | null | app/notes/config.route.js | Bovojon/Refactoring-meganote-practice | 1ac7d3da513c3d520b6f553292f7b324f7fc8287 | [
"MIT"
] | null | null | null | app/notes/config.route.js | Bovojon/Refactoring-meganote-practice | 1ac7d3da513c3d520b6f553292f7b324f7fc8287 | [
"MIT"
] | null | null | null | (function() {
'use strict';
angular
.module('meganote.notes', ['ui.router'])
.config(notesConfig);
notesConfig.$inject = ['$stateProvider'];
function notesConfig($stateProvider) {
$stateProvider
.state('note', {
url: '/notes',
templateUrl: 'notes/notes.html',
controller: 'NotesController',
controllerAs: 'vm',
resolve: {
notesLoaded: notesLoaded
}
})
.state('notes.form', {
url: '/:noteId',
templateUrl: 'notes/notes-form.html',
controller: 'NotesformController',
controllerAs: 'vm'
});
}
notesLoaded.$inject = ['NotesService'];
function notesLoaded(NotesService) {
return NotesService.getNotes();
}
}());
| 21.911765 | 44 | 0.58255 |
c8633022f53c0087824aa764245d45455d0bcce0 | 2,087 | js | JavaScript | static/js/websocket.js | Pragma-Edragon/asynchronous-web-Crawler | 3515b65ae0aa38ae0c460a886f65d09cb2b20a13 | [
"MIT"
] | null | null | null | static/js/websocket.js | Pragma-Edragon/asynchronous-web-Crawler | 3515b65ae0aa38ae0c460a886f65d09cb2b20a13 | [
"MIT"
] | null | null | null | static/js/websocket.js | Pragma-Edragon/asynchronous-web-Crawler | 3515b65ae0aa38ae0c460a886f65d09cb2b20a13 | [
"MIT"
] | null | null | null | const urlToAttack = document.getElementById("AttackedUrl"),
button = document.getElementById("startAttack");
let websocket;
try {
websocket = new WebSocket("ws://" + window.location.host + "/ws")
} catch (err) {
websocket = new WebSocket("wss://" + window.location.host + "/ws" )
}
function createElem(message, uniqueId) {
if (document.getElementById("queue" + uniqueId) !== null) {
// update
let NewTableMessage = document.createElement("li"),
NewTableMessageLink = document.createElement("a"),
NewTable = document.getElementById("tableQueue" + uniqueId);
NewTableMessageLink.appendChild(document.createTextNode(message))
NewTableMessageLink.setAttribute("href", message)
NewTableMessage.appendChild(NewTableMessageLink);
NewTable.appendChild(NewTableMessage);
document.getElementById("queue" + uniqueId).appendChild(NewTable);
} else {
let NewNode = document.createElement("div"),
NewTableNode = document.createElement("ul");
NewTableNode.appendChild(document.createTextNode(message));
NewNode.setAttribute("id", "queue" + uniqueId);
NewTableNode.setAttribute("id", "tableQueue" + uniqueId);
NewNode.appendChild(NewTableNode);
document.body.appendChild(NewNode);
}
}
websocket.onmessage = function (event) {
const data = JSON.parse(event.data);
console.log(data + typeof data)
switch (data.type) {
case "state":
createElem(data.url, data.id);
break;
case "update":
// need to check if attr exists
createElem(data.state, data.id);
break;
case "error":
console.error(data.error);
break;
default:
console.error("Unsupported event: ", data);
}
};
button.onclick = function (event) {
if (urlToAttack.value !== null) {
websocket.send(JSON.stringify({url: urlToAttack.value}));
console.log("Send!");
} else {
alert("Link must be set.");
}
}; | 31.621212 | 74 | 0.62482 |
c8635c8d94b91b73ce7781339f4be0c74be9fa83 | 9,726 | js | JavaScript | src/ggrc_workflows/assets/javascripts/components/tests/workflow-activate_spec.js | HLD/ggrc-core | 9bdc0fc6ca9e252f4919db682d80e360d5581eb4 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | src/ggrc_workflows/assets/javascripts/components/tests/workflow-activate_spec.js | HLD/ggrc-core | 9bdc0fc6ca9e252f4919db682d80e360d5581eb4 | [
"ECL-2.0",
"Apache-2.0"
] | 10 | 2018-07-06T00:04:23.000Z | 2021-02-26T21:13:20.000Z | src/ggrc_workflows/assets/javascripts/components/tests/workflow-activate_spec.js | HLD/ggrc-core | 9bdc0fc6ca9e252f4919db682d80e360d5581eb4 | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2017-11-11T22:16:56.000Z | 2017-11-11T22:16:56.000Z | /*!
Copyright (C) 2017 Google Inc.
Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
*/
import component from '../workflow-activate';
import helpers from '../workflow-helpers';
describe('GGRC.WorkflowActivate', function () {
var scope;
beforeAll(function () {
scope = component.prototype.scope;
});
describe('_activate() method', function () {
var method;
var workflow;
var scopeMock;
var refreshDfd;
var saveDfd;
var saveCycleDfd;
var initCountsDfd;
var refreshAllDfd;
var generateDfd;
var workflowExtension = {
countsMap: {
activeCycles: 'active cycles',
},
};
var cycleMock;
beforeEach(function () {
scopeMock = jasmine.createSpyObj('scope',
['attr', '_restore_button']);
method = scope._activate.bind(scopeMock);
refreshDfd = can.Deferred();
saveDfd = can.Deferred();
initCountsDfd = can.Deferred();
refreshAllDfd = can.Deferred();
generateDfd = can.Deferred();
saveCycleDfd = can.Deferred();
cycleMock = jasmine.createSpyObj('cycle', {
save: saveCycleDfd,
});
workflow = new CMS.Models.Workflow({
type: 'Workflow',
unit: 'month',
context: new CMS.Models.Context({id: 3}),
next_cycle_start_date: moment(),
});
spyOn(workflow, 'refresh')
.and.returnValue(refreshDfd);
spyOn(workflow, 'refresh_all')
.and.returnValue(refreshAllDfd);
spyOn(workflow, 'save')
.and.returnValue(saveDfd);
spyOn(GGRC, 'page_instance')
.and.returnValue(workflow);
spyOn(_, 'find')
.and.returnValue(workflowExtension);
spyOn(GGRC.Utils.CurrentPage, 'initCounts')
.and.returnValue(initCountsDfd);
spyOn(helpers, 'generateCycle')
.and.returnValue(generateDfd);
spyOn(CMS.Models, 'Cycle')
.and.returnValue(cycleMock);
});
describe('for recurrent workflow', function () {
beforeEach(function () {
method();
});
it('should be in waiting state while refresh is in progress',
function () {
expect(scopeMock.attr)
.toHaveBeenCalledWith('waiting', true);
expect(workflow.refresh)
.toHaveBeenCalled();
});
it('should try to save Workflow as active object after refreshing',
function () {
refreshDfd.resolve();
expect(workflow.attr('recurrences'))
.toBeTruthy();
expect(workflow.attr('status'))
.toBe('Active');
expect(workflow.save)
.toHaveBeenCalled();
});
it('should try to save Cycle after updating this day Workflow',
function () {
refreshDfd.resolve();
saveDfd.resolve(workflow);
expect(cycleMock.save)
.toHaveBeenCalled();
});
it('shouldn\'t try to save Cycle after updating this day Workflow',
function () {
refreshDfd.resolve();
workflow.attr('next_cycle_start_date',
moment().add(1, 'day'));
saveDfd.resolve(workflow);
expect(cycleMock.save)
.not.toHaveBeenCalled();
});
it('should try to init counts for active cycles tab after cycle saving',
function () {
refreshDfd.resolve();
saveDfd.resolve(workflow);
saveCycleDfd.resolve();
expect(GGRC.Utils.CurrentPage.initCounts)
.toHaveBeenCalledWith([
workflowExtension.countsMap.activeCycles,
], workflow.type, workflow.id);
});
it('should try to refresh TGT after updating counts for active cycles',
function () {
refreshDfd.resolve();
saveDfd.resolve(workflow);
saveCycleDfd.resolve();
initCountsDfd.resolve();
expect(workflow.refresh_all)
.toHaveBeenCalledWith('task_groups', 'task_group_tasks');
});
it('should restore button after TGT refresh', function () {
refreshDfd.resolve();
saveDfd.resolve(workflow);
saveCycleDfd.resolve();
initCountsDfd.resolve();
refreshAllDfd.resolve();
expect(scopeMock._restore_button)
.toHaveBeenCalled();
});
it('should restore button when workflow refresh fails', function () {
refreshDfd.reject();
expect(workflow.attr('recurrences'))
.toBeFalsy();
expect(workflow.attr('status'))
.not.toBe('Active');
expect(scopeMock._restore_button)
.toHaveBeenCalled();
});
it('should restore button when workflow saving fails', function () {
refreshDfd.resolve();
saveDfd.reject();
expect(scopeMock._restore_button)
.toHaveBeenCalled();
});
it('should restore button when cycle generation fails', function () {
refreshDfd.resolve();
saveDfd.resolve(workflow);
saveCycleDfd.reject();
expect(scopeMock._restore_button)
.toHaveBeenCalled();
});
it('should restore button when counts init fails', function () {
refreshDfd.resolve();
saveDfd.resolve(workflow);
saveCycleDfd.resolve();
initCountsDfd.reject();
expect(scopeMock._restore_button)
.toHaveBeenCalled();
});
it('should restore button when counts init fails', function () {
refreshDfd.resolve();
saveDfd.resolve(workflow);
saveCycleDfd.resolve();
initCountsDfd.resolve();
refreshAllDfd.reject();
expect(scopeMock._restore_button)
.toHaveBeenCalled();
});
});
describe('for one-time workflow', function () {
beforeEach(function () {
workflow.attr('unit', null);
method();
});
it('should be in waiting state while cycle generation starts',
function () {
expect(scopeMock.attr)
.toHaveBeenCalledWith('waiting', true);
expect(helpers.generateCycle)
.toHaveBeenCalled();
});
it('should try to refresh workflow after cycle generation',
function () {
generateDfd.resolve();
expect(workflow.refresh)
.toHaveBeenCalled();
});
it('should try to save workflow as active object after refreshing',
function () {
generateDfd.resolve();
refreshDfd.resolve(workflow);
expect(workflow.attr('status'))
.toBe('Active');
expect(workflow.save)
.toHaveBeenCalled();
});
it('should restore button after workflow saving', function () {
generateDfd.resolve();
refreshDfd.resolve(workflow);
saveDfd.resolve();
expect(scopeMock._restore_button)
.toHaveBeenCalled();
});
it('should restore button when cycle generation fails', function () {
generateDfd.reject();
expect(scopeMock._restore_button)
.toHaveBeenCalled();
});
it('should restore button when workflow refresh fails', function () {
generateDfd.resolve(workflow);
refreshDfd.reject();
expect(scopeMock._restore_button)
.toHaveBeenCalled();
});
it('should restore button when saving fails', function () {
generateDfd.resolve(workflow);
refreshDfd.resolve(workflow);
saveDfd.reject();
expect(scopeMock._restore_button)
.toHaveBeenCalled();
});
});
});
describe('_can_activate_def() method', function () {
var refreshAllDfd;
var scopeMock;
var method;
var workflow;
var taskGroups;
beforeEach(function () {
taskGroups = new can.List([]);
scopeMock = jasmine.createSpyObj('scope',
['attr']);
refreshAllDfd = can.Deferred();
method = scope._can_activate_def.bind(scopeMock);
workflow = {
type: 'Workflow',
refresh_all: jasmine.createSpy('refreshAll')
.and.returnValue(refreshAllDfd),
attr: jasmine.createSpy('attr'),
task_groups: {
reify: jasmine.createSpy('reify')
.and.returnValue(taskGroups),
},
};
spyOn(GGRC, 'page_instance')
.and.returnValue(workflow);
});
it('should be in waiting state while refresh is in progress',
function () {
method();
expect(scopeMock.attr)
.toHaveBeenCalledWith('waiting', true);
expect(workflow.refresh_all)
.toHaveBeenCalled();
});
it('should allow activation when TGTs for all TGs exist', function () {
taskGroups.push({
task_group_tasks: [{id: 1}],
});
method();
refreshAllDfd.resolve();
expect(scopeMock.attr)
.toHaveBeenCalledWith('can_activate', 1);
expect(scopeMock.attr)
.toHaveBeenCalledWith('waiting', false);
});
it('shouldn\'t allow activation when TGTs for all TGs exist', function () {
taskGroups.push({
task_group_tasks: [{id: 1}],
});
taskGroups.push({
task_group_tasks: [],
});
method();
refreshAllDfd.resolve();
expect(scopeMock.attr)
.toHaveBeenCalledWith('can_activate', false);
expect(scopeMock.attr)
.toHaveBeenCalledWith('waiting', false);
});
it('should log an error when refresh fails', function () {
spyOn(console, 'warn');
method();
refreshAllDfd.reject({message: 'error occurred'});
expect(console.warn)
.toHaveBeenCalledWith('Workflow activate error', 'error occurred');
});
});
});
| 28.109827 | 80 | 0.587497 |
c863a40ba08a4878113e045b23e4c49959028e9a | 7,058 | js | JavaScript | bits/77_wbxml.js | DmitriySlabodchikov/js-xlsx | 7018e02771e3696b86a63629e00066408f36085f | [
"Apache-2.0"
] | null | null | null | bits/77_wbxml.js | DmitriySlabodchikov/js-xlsx | 7018e02771e3696b86a63629e00066408f36085f | [
"Apache-2.0"
] | null | null | null | bits/77_wbxml.js | DmitriySlabodchikov/js-xlsx | 7018e02771e3696b86a63629e00066408f36085f | [
"Apache-2.0"
] | 2 | 2020-09-14T08:43:49.000Z | 2021-09-17T11:55:33.000Z | /* 18.2 Workbook */
var wbnsregex = /<\w+:workbook/;
function parse_wb_xml(data, opts) {
var wb = { AppVersion:{}, WBProps:{}, WBView:[], Sheets:[], CalcPr:{}, xmlns: "" };
var pass = false, xmlns = "xmlns";
data.match(tagregex).forEach(function xml_wb(x) {
var y = parsexmltag(x);
switch(strip_ns(y[0])) {
case '<?xml': break;
/* 18.2.27 workbook CT_Workbook 1 */
case '<workbook':
if(x.match(wbnsregex)) xmlns = "xmlns" + x.match(/<(\w+):/)[1];
wb.xmlns = y[xmlns];
break;
case '</workbook>': break;
/* 18.2.13 fileVersion CT_FileVersion ? */
case '<fileVersion': delete y[0]; wb.AppVersion = y; break;
case '<fileVersion/>': break;
/* 18.2.12 fileSharing CT_FileSharing ? */
case '<fileSharing': case '<fileSharing/>': break;
/* 18.2.28 workbookPr CT_WorkbookPr ? */
case '<workbookPr': delete y[0]; wb.WBProps = y; break;
case '<workbookPr/>': delete y[0]; wb.WBProps = y; break;
/* 18.2.29 workbookProtection CT_WorkbookProtection ? */
case '<workbookProtection': break;
case '<workbookProtection/>': break;
/* 18.2.1 bookViews CT_BookViews ? */
case '<bookViews>': case '</bookViews>': break;
/* 18.2.30 workbookView CT_BookView + */
case '<workbookView': delete y[0]; wb.WBView.push(y); break;
/* 18.2.20 sheets CT_Sheets 1 */
case '<sheets>': case '</sheets>': break; // aggregate sheet
/* 18.2.19 sheet CT_Sheet + */
case '<sheet': delete y[0]; y.name = utf8read(y.name); wb.Sheets.push(y); break;
/* 18.2.15 functionGroups CT_FunctionGroups ? */
case '<functionGroups': case '<functionGroups/>': break;
/* 18.2.14 functionGroup CT_FunctionGroup + */
case '<functionGroup': break;
/* 18.2.9 externalReferences CT_ExternalReferences ? */
case '<externalReferences': case '</externalReferences>': case '<externalReferences>': break;
/* 18.2.8 externalReference CT_ExternalReference + */
case '<externalReference': break;
/* 18.2.6 definedNames CT_DefinedNames ? */
case '<definedNames/>': break;
case '<definedNames>': case '<definedNames': pass=true; break;
case '</definedNames>': pass=false; break;
/* 18.2.5 definedName CT_DefinedName + */
case '<definedName': case '<definedName/>': case '</definedName>': break;
/* 18.2.2 calcPr CT_CalcPr ? */
case '<calcPr': delete y[0]; wb.CalcPr = y; break;
case '<calcPr/>': delete y[0]; wb.CalcPr = y; break;
/* 18.2.16 oleSize CT_OleSize ? (ref required) */
case '<oleSize': break;
/* 18.2.4 customWorkbookViews CT_CustomWorkbookViews ? */
case '<customWorkbookViews>': case '</customWorkbookViews>': case '<customWorkbookViews': break;
/* 18.2.3 customWorkbookView CT_CustomWorkbookView + */
case '<customWorkbookView': case '</customWorkbookView>': break;
/* 18.2.18 pivotCaches CT_PivotCaches ? */
case '<pivotCaches>': case '</pivotCaches>': case '<pivotCaches': break;
/* 18.2.17 pivotCache CT_PivotCache ? */
case '<pivotCache': break;
/* 18.2.21 smartTagPr CT_SmartTagPr ? */
case '<smartTagPr': case '<smartTagPr/>': break;
/* 18.2.23 smartTagTypes CT_SmartTagTypes ? */
case '<smartTagTypes': case '<smartTagTypes>': case '</smartTagTypes>': break;
/* 18.2.22 smartTagType CT_SmartTagType ? */
case '<smartTagType': break;
/* 18.2.24 webPublishing CT_WebPublishing ? */
case '<webPublishing': case '<webPublishing/>': break;
/* 18.2.11 fileRecoveryPr CT_FileRecoveryPr ? */
case '<fileRecoveryPr': case '<fileRecoveryPr/>': break;
/* 18.2.26 webPublishObjects CT_WebPublishObjects ? */
case '<webPublishObjects>': case '<webPublishObjects': case '</webPublishObjects>': break;
/* 18.2.25 webPublishObject CT_WebPublishObject ? */
case '<webPublishObject': break;
/* 18.2.10 extLst CT_ExtensionList ? */
case '<extLst>': case '</extLst>': case '<extLst/>': break;
/* 18.2.7 ext CT_Extension + */
case '<ext': pass=true; break; //TODO: check with versions of excel
case '</ext>': pass=false; break;
/* Others */
case '<ArchID': break;
case '<AlternateContent': pass=true; break;
case '</AlternateContent>': pass=false; break;
default: if(!pass && opts.WTF) throw 'unrecognized ' + y[0] + ' in workbook';
}
});
if(XMLNS.main.indexOf(wb.xmlns) === -1) throw new Error("Unknown Namespace: " + wb.xmlns);
parse_wb_defaults(wb);
return wb;
}
var WB_XML_ROOT = writextag('workbook', null, {
'xmlns': XMLNS.main[0],
//'xmlns:mx': XMLNS.mx,
//'xmlns:s': XMLNS.main[0],
'xmlns:r': XMLNS.r
});
function safe1904(wb) {
/* TODO: store date1904 somewhere else */
try { return parsexmlbool(wb.Workbook.WBProps.date1904) ? "true" : "false"; } catch(e) { return "false"; }
}
function write_wb_xml(wb, opts) {
var o = [XML_HEADER];
o[o.length] = WB_XML_ROOT;
o[o.length] = (writextag('workbookPr', null, {date1904:safe1904(wb)}));
o[o.length] = "<sheets>";
for(var i = 0; i != wb.SheetNames.length; ++i)
o[o.length] = (writextag('sheet',null,{name:wb.SheetNames[i].substr(0,31), sheetId:""+(i+1), "r:id":"rId"+(i+1)}));
o[o.length] = "</sheets>";
var hasPrintHeaders = false;
for(var i = 0; i != wb.SheetNames.length; ++i) {
var sheetName = wb.SheetNames[i];
var sheet = wb.Sheets[sheetName]
if (sheet['!printHeader']) {
if (sheet['!printHeader'].length !== 2) {
throw "!printHeaders must be an array of length 2: "+sheet['!printHeader'];
}
hasPrintHeaders = true;
}
}
if (hasPrintHeaders) {
o[o.length] = '<definedNames>';
for(var i = 0; i != wb.SheetNames.length; ++i) {
var sheetName = wb.SheetNames[i];
var sheet = wb.Sheets[sheetName]
if (sheet['!printHeader'] || sheet['!printColumns']) {
var printHeader = sheet['!printHeader'];
var printColumns = sheet['!printColumns'];
//Sheet1!$A:$C,Sheet1!$1:$1
var range = "";
if (printColumns) range += ("'" + sheetName + "'!") + ("$" + printColumns[0] + ":$" + printColumns[1]);
if (printColumns && printHeader) range += ","
if (printHeader) range += ("'" + sheetName + "'!" ) + ("$" + printHeader[0] + ":$" + printHeader[1]);
console.log("-----------------------------")
console.log(range)
o[o.length] = (writextag('definedName', range, {
"name":"_xlnm.Print_Titles",
localSheetId : ''+i
}))
}
}
o[o.length] = '</definedNames>';
}
var write_names = (wb.Workbook && (wb.Workbook.Names||[]).length > 0);
if(write_names) {
o[o.length] = "<definedNames>";
if(wb.Workbook && wb.Workbook.Names){
for(var i = 0; i<wb.Workbook.Names.length; i++){
var n = wb.Workbook.Names[i];
var d = {name:n.Name};
if(n.Comment) d.comment = n.Comment;
if(n.Sheet != null) d.localSheetId = ""+n.Sheet;
if(!n.Ref) return;
o[o.length] = writextag('definedName', String(n.Ref), d);
}
}
o[o.length] = "</definedNames>";
}
if(o.length>2){ o[o.length] = '</workbook>'; o[1]=o[1].replace("/>",">"); }
return o.join("");
}
| 35.827411 | 117 | 0.611646 |
c863dfc6b9312c530a44e23b4d90fb80e569ebd2 | 2,938 | js | JavaScript | bootstrap.js | jsrun/wi.core._ | 53fe1c79b30300dae30077a7582b2dc967338e17 | [
"MIT"
] | null | null | null | bootstrap.js | jsrun/wi.core._ | 53fe1c79b30300dae30077a7582b2dc967338e17 | [
"MIT"
] | null | null | null | bootstrap.js | jsrun/wi.core._ | 53fe1c79b30300dae30077a7582b2dc967338e17 | [
"MIT"
] | null | null | null | /**
* __ __ _ _____ _____ ______
* \ \ / / | | |_ _| __ \| ____|
* \ \ /\ / /__| |__ | | | | | | |__
* \ \/ \/ / _ \ '_ \ | | | | | | __|
* \ /\ / __/ |_) || |_| |__| | |____
* \/ \/ \___|_.__/_____|_____/|______|
* ______
* |______|
*
* @author André Ferreira <andrehrf@gmail.com>
* @license MIT
*/
"use strict";
module.exports = {
/**
* List of clients in socket.io
* @type object
*/
clients: {},
/**
* List of events to socket.io
* @type array
*/
events: [],
/**
* List module assets
* @type object
*/
assetsCore: {
css: [__dirname + "/node_modules/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.css",
__dirname + "/node_modules/tooltipster/dist/css/tooltipster.bundle.min.css",
__dirname + "/jquery-ui-1.12.1.min.css"],
js: [__dirname + "/node_modules/jquery/dist/jquery.min.js",
__dirname + "/jquery-ui-1.12.1.min.js",
__dirname + "/node_modules/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.concat.min.js",
__dirname + "/node_modules/tooltipster/dist/js/tooltipster.bundle.min.js",
__dirname + "/lodash.min.js",
__dirname + "/lib.js",
__dirname + "/core.js"]
},
/**
* Function to configure new events to sockets
*
* @param function fn
* @return void
*/
setSocketsEvents: function(fn){
for(let key in this.clients)
if(typeof fn == "function")
fn(this.clients[key]);
if(typeof fn == "function")
this.events.push(fn);
},
/**
* Function to get a socket object
*
* @param string id
* @return object|null
*/
getSocket: function(id){
try{ return (this.clients[id]) ? this.clients[id] : null; } catch(e) { return null; }
},
/**
* Module startup function
*
* @param object app
* @return this
*/
bootstrap: function(io, _){
io.on('connection', function(socket){
if(!_.clients[socket.id]){
_.clients[socket.id] = socket;
socket.hasEvent = function(event){//Function to prevent the same event from being instantiated several times
try{ return (socket._events[event]); }
catch(e){ return false; }
};
for(let key in _.events)
_.events[key](socket);
}
});
}
}; | 31.591398 | 125 | 0.440776 |
c863fc7e99f8bccf97c9e4f35f7632597ab28ef1 | 647 | js | JavaScript | app/src/containers/AdressRegisterPage/styles.js | ThalesMilanezi/Ifuture-frontend | 53b5f98bd98b0de88a3752bf6d8c6fc6601b6bc5 | [
"MIT"
] | null | null | null | app/src/containers/AdressRegisterPage/styles.js | ThalesMilanezi/Ifuture-frontend | 53b5f98bd98b0de88a3752bf6d8c6fc6601b6bc5 | [
"MIT"
] | 5 | 2020-01-23T14:58:10.000Z | 2020-06-18T14:45:20.000Z | app/src/containers/AdressRegisterPage/styles.js | ThalesMilanezi/Ifuture-frontend | 53b5f98bd98b0de88a3752bf6d8c6fc6601b6bc5 | [
"MIT"
] | 5 | 2020-07-17T22:41:44.000Z | 2021-03-01T16:41:03.000Z | import styled from 'styled-components';
import { TextField, Button, Typography } from '@material-ui/core';
export const AndressRegisterWrapper = styled.div`
text-align: center;
background-color: #ffffff;
height: 100vh;
`
export const Title = styled(Typography)`
height: 42px;
display: flex;
justify-content: center;
align-items: center;
font-size: 16px;
margin: 28px 0 20px 0;
`
export const Form = styled.form`
display: flex;
flex-direction: column;
`
export const Input = styled(TextField)`
margin: 8px 16px;
`
export const ButtonSubmit = styled(Button)`
background: #e8222e;
margin: 8px 16px;
height: 42px;
` | 19.606061 | 66 | 0.710974 |
c8640c4777cfa850c0be328f61ea134a7a7afd6c | 232,704 | js | JavaScript | js/vendor/angular-soundmanager2.js | cqs1995/listen1_chrome_extension | a5684ab528270dbde2a4df8ed605061064c1b77d | [
"MIT"
] | 2 | 2018-03-30T09:17:26.000Z | 2018-03-30T09:47:13.000Z | js/vendor/angular-soundmanager2.js | cqs1995/listen1_chrome_extension | a5684ab528270dbde2a4df8ed605061064c1b77d | [
"MIT"
] | null | null | null | js/vendor/angular-soundmanager2.js | cqs1995/listen1_chrome_extension | a5684ab528270dbde2a4df8ed605061064c1b77d | [
"MIT"
] | 1 | 2017-08-12T08:49:10.000Z | 2017-08-12T08:49:10.000Z | /** @license
*
* SoundManager 2: JavaScript Sound for the Web
* ----------------------------------------------
* http://schillmania.com/projects/soundmanager2/
*
* Copyright (c) 2007, Scott Schiller. All rights reserved.
* Code provided under the BSD License:
* http://schillmania.com/projects/soundmanager2/license.txt
*
* V2.97a.20140901
*/
/*global window, SM2_DEFER, sm2Debugger, console, document, navigator, setTimeout, setInterval, clearInterval, Audio, opera, module, define */
/*jslint regexp: true, sloppy: true, white: true, nomen: true, plusplus: true, todo: true */
/**
* About this file
* -------------------------------------------------------------------------------------
* This is the fully-commented source version of the SoundManager 2 API,
* recommended for use during development and testing.
*
* See soundmanager2-nodebug-jsmin.js for an optimized build (~11KB with gzip.)
* http://schillmania.com/projects/soundmanager2/doc/getstarted/#basic-inclusion
* Alternately, serve this file with gzip for 75% compression savings (~30KB over HTTP.)
*
* You may notice <d> and </d> comments in this source; these are delimiters for
* debug blocks which are removed in the -nodebug builds, further optimizing code size.
*
* Also, as you may note: Whoa, reliable cross-platform/device audio support is hard! ;)
*/
(function(window, _undefined) {
"use strict";
if(!window || !window.document) {
// Don't cross the [environment] streams. SM2 expects to be running in a browser, not under node.js etc.
// Additionally, if a browser somehow manages to fail this test, as Egon said: "It would be bad."
throw new Error('SoundManager requires a browser with window and document objects.');
}
var soundManager = null;
/**
* The SoundManager constructor.
*
* @constructor
* @param {string} smURL Optional: Path to SWF files
* @param {string} smID Optional: The ID to use for the SWF container element
* @this {SoundManager}
* @return {SoundManager} The new SoundManager instance
*/
function SoundManager(smURL, smID) {
/**
* soundManager configuration options list
* defines top-level configuration properties to be applied to the soundManager instance (eg. soundManager.flashVersion)
* to set these properties, use the setup() method - eg., soundManager.setup({url: '/swf/', flashVersion: 9})
*/
this.setupOptions = {
'url': (smURL || null), // path (directory) where SoundManager 2 SWFs exist, eg., /path/to/swfs/
'flashVersion': 8, // flash build to use (8 or 9.) Some API features require 9.
'debugMode': true, // enable debugging output (console.log() with HTML fallback)
'debugFlash': false, // enable debugging output inside SWF, troubleshoot Flash/browser issues
'useConsole': true, // use console.log() if available (otherwise, writes to #soundmanager-debug element)
'consoleOnly': true, // if console is being used, do not create/write to #soundmanager-debug
'waitForWindowLoad': false, // force SM2 to wait for window.onload() before trying to call soundManager.onload()
'bgColor': '#ffffff', // SWF background color. N/A when wmode = 'transparent'
'useHighPerformance': false, // position:fixed flash movie can help increase js/flash speed, minimize lag
'flashPollingInterval': null, // msec affecting whileplaying/loading callback frequency. If null, default of 50 msec is used.
'html5PollingInterval': null, // msec affecting whileplaying() for HTML5 audio, excluding mobile devices. If null, native HTML5 update events are used.
'flashLoadTimeout': 1000, // msec to wait for flash movie to load before failing (0 = infinity)
'wmode': null, // flash rendering mode - null, 'transparent', or 'opaque' (last two allow z-index to work)
'allowScriptAccess': 'always', // for scripting the SWF (object/embed property), 'always' or 'sameDomain'
'useFlashBlock': false, // *requires flashblock.css, see demos* - allow recovery from flash blockers. Wait indefinitely and apply timeout CSS to SWF, if applicable.
'useHTML5Audio': true, // use HTML5 Audio() where API is supported (most Safari, Chrome versions), Firefox (no MP3/MP4.) Ideally, transparent vs. Flash API where possible.
'html5Test': /^(probably|maybe)$/i, // HTML5 Audio() format support test. Use /^probably$/i; if you want to be more conservative.
'preferFlash': false, // overrides useHTML5audio, will use Flash for MP3/MP4/AAC if present. Potential option if HTML5 playback with these formats is quirky.
'noSWFCache': false, // if true, appends ?ts={date} to break aggressive SWF caching.
'idPrefix': 'sound' // if an id is not provided to createSound(), this prefix is used for generated IDs - 'sound0', 'sound1' etc.
};
this.defaultOptions = {
/**
* the default configuration for sound objects made with createSound() and related methods
* eg., volume, auto-load behaviour and so forth
*/
'autoLoad': false, // enable automatic loading (otherwise .load() will be called on demand with .play(), the latter being nicer on bandwidth - if you want to .load yourself, you also can)
'autoPlay': false, // enable playing of file as soon as possible (much faster if "stream" is true)
'from': null, // position to start playback within a sound (msec), default = beginning
'loops': 1, // how many times to repeat the sound (position will wrap around to 0, setPosition() will break out of loop when >0)
'onid3': null, // callback function for "ID3 data is added/available"
'onload': null, // callback function for "load finished"
'whileloading': null, // callback function for "download progress update" (X of Y bytes received)
'onplay': null, // callback for "play" start
'onpause': null, // callback for "pause"
'onresume': null, // callback for "resume" (pause toggle)
'whileplaying': null, // callback during play (position update)
'onposition': null, // object containing times and function callbacks for positions of interest
'onstop': null, // callback for "user stop"
'onfailure': null, // callback function for when playing fails
'onfinish': null, // callback function for "sound finished playing"
'multiShot': true, // let sounds "restart" or layer on top of each other when played multiple times, rather than one-shot/one at a time
'multiShotEvents': false, // fire multiple sound events (currently onfinish() only) when multiShot is enabled
'position': null, // offset (milliseconds) to seek to within loaded sound data.
'pan': 0, // "pan" settings, left-to-right, -100 to 100
'stream': true, // allows playing before entire file has loaded (recommended)
'to': null, // position to end playback within a sound (msec), default = end
'type': null, // MIME-like hint for file pattern / canPlay() tests, eg. audio/mp3
'usePolicyFile': false, // enable crossdomain.xml request for audio on remote domains (for ID3/waveform access)
'volume': 100 // self-explanatory. 0-100, the latter being the max.
};
this.flash9Options = {
/**
* flash 9-only options,
* merged into defaultOptions if flash 9 is being used
*/
'isMovieStar': null, // "MovieStar" MPEG4 audio mode. Null (default) = auto detect MP4, AAC etc. based on URL. true = force on, ignore URL
'usePeakData': false, // enable left/right channel peak (level) data
'useWaveformData': false, // enable sound spectrum (raw waveform data) - NOTE: May increase CPU load.
'useEQData': false, // enable sound EQ (frequency spectrum data) - NOTE: May increase CPU load.
'onbufferchange': null, // callback for "isBuffering" property change
'ondataerror': null // callback for waveform/eq data access error (flash playing audio in other tabs/domains)
};
this.movieStarOptions = {
/**
* flash 9.0r115+ MPEG4 audio options,
* merged into defaultOptions if flash 9+movieStar mode is enabled
*/
'bufferTime': 3, // seconds of data to buffer before playback begins (null = flash default of 0.1 seconds - if AAC playback is gappy, try increasing.)
'serverURL': null, // rtmp: FMS or FMIS server to connect to, required when requesting media via RTMP or one of its variants
'onconnect': null, // rtmp: callback for connection to flash media server
'duration': null // rtmp: song duration (msec)
};
this.audioFormats = {
/**
* determines HTML5 support + flash requirements.
* if no support (via flash and/or HTML5) for a "required" format, SM2 will fail to start.
* flash fallback is used for MP3 or MP4 if HTML5 can't play it (or if preferFlash = true)
*/
'mp3': {
'type': ['audio/mpeg; codecs="mp3"', 'audio/mpeg', 'audio/mp3', 'audio/MPA', 'audio/mpa-robust'],
'required': true
},
'mp4': {
'related': ['aac', 'm4a', 'm4b'], // additional formats under the MP4 container
'type': ['audio/mp4; codecs="mp4a.40.2"', 'audio/aac', 'audio/x-m4a', 'audio/MP4A-LATM', 'audio/mpeg4-generic'],
'required': false
},
'ogg': {
'type': ['audio/ogg; codecs=vorbis'],
'required': false
},
'opus': {
'type': ['audio/ogg; codecs=opus', 'audio/opus'],
'required': false
},
'wav': {
'type': ['audio/wav; codecs="1"', 'audio/wav', 'audio/wave', 'audio/x-wav'],
'required': false
}
};
// HTML attributes (id + class names) for the SWF container
this.movieID = 'sm2-container';
this.id = (smID || 'sm2movie');
this.debugID = 'soundmanager-debug';
this.debugURLParam = /([#?&])debug=1/i;
// dynamic attributes
this.versionNumber = 'V2.97a.20140901';
this.version = null;
this.movieURL = null;
this.altURL = null;
this.swfLoaded = false;
this.enabled = false;
this.oMC = null;
this.sounds = {};
this.soundIDs = [];
this.muted = false;
this.didFlashBlock = false;
this.filePattern = null;
this.filePatterns = {
'flash8': /\.mp3(\?.*)?$/i,
'flash9': /\.mp3(\?.*)?$/i
};
// support indicators, set at init
this.features = {
'buffering': false,
'peakData': false,
'waveformData': false,
'eqData': false,
'movieStar': false
};
// flash sandbox info, used primarily in troubleshooting
this.sandbox = {
// <d>
'type': null,
'types': {
'remote': 'remote (domain-based) rules',
'localWithFile': 'local with file access (no internet access)',
'localWithNetwork': 'local with network (internet access only, no local access)',
'localTrusted': 'local, trusted (local+internet access)'
},
'description': null,
'noRemote': null,
'noLocal': null
// </d>
};
/**
* format support (html5/flash)
* stores canPlayType() results based on audioFormats.
* eg. { mp3: boolean, mp4: boolean }
* treat as read-only.
*/
this.html5 = {
'usingFlash': null // set if/when flash fallback is needed
};
// file type support hash
this.flash = {};
// determined at init time
this.html5Only = false;
// used for special cases (eg. iPad/iPhone/palm OS?)
this.ignoreFlash = false;
/**
* a few private internals (OK, a lot. :D)
*/
var SMSound,
sm2 = this,
globalHTML5Audio = null,
flash = null,
sm = 'soundManager',
smc = sm + ': ',
h5 = 'HTML5::',
id, ua = navigator.userAgent,
wl = window.location.href.toString(),
doc = document,
doNothing, setProperties, init, fV, on_queue = [],
debugOpen = true,
debugTS, didAppend = false,
appendSuccess = false,
didInit = false,
disabled = false,
windowLoaded = false,
_wDS, wdCount = 0,
initComplete, mixin, assign, extraOptions, addOnEvent, processOnEvents, initUserOnload, delayWaitForEI, waitForEI, rebootIntoHTML5, setVersionInfo, handleFocus, strings, initMovie, preInit, domContentLoaded, winOnLoad, didDCLoaded, getDocument, createMovie, catchError, setPolling, initDebug, debugLevels = ['log', 'info', 'warn', 'error'],
defaultFlashVersion = 8,
disableObject, failSafely, normalizeMovieURL, oRemoved = null,
oRemovedHTML = null,
str, flashBlockHandler, getSWFCSS, swfCSS, toggleDebug, loopFix, policyFix, complain, idCheck, waitingForEI = false,
initPending = false,
startTimer, stopTimer, timerExecute, h5TimerCount = 0,
h5IntervalTimer = null,
parseURL, messages = [],
canIgnoreFlash, needsFlash = null,
featureCheck, html5OK, html5CanPlay, html5Ext, html5Unload, domContentLoadedIE, testHTML5, event, slice = Array.prototype.slice,
useGlobalHTML5Audio = false,
lastGlobalHTML5URL, hasFlash, detectFlash, badSafariFix, html5_events, showSupport, flushMessages, wrapCallback, idCounter = 0,
is_iDevice = ua.match(/(ipad|iphone|ipod)/i),
isAndroid = ua.match(/android/i),
isIE = ua.match(/msie/i),
isWebkit = ua.match(/webkit/i),
isSafari = (ua.match(/safari/i) && !ua.match(/chrome/i)),
isOpera = (ua.match(/opera/i)),
mobileHTML5 = (ua.match(/(mobile|pre\/|xoom)/i) || is_iDevice || isAndroid),
isBadSafari = (!wl.match(/usehtml5audio/i) && !wl.match(/sm2\-ignorebadua/i) && isSafari && !ua.match(/silk/i) && ua.match(/OS X 10_6_([3-7])/i)), // Safari 4 and 5 (excluding Kindle Fire, "Silk") occasionally fail to load/play HTML5 audio on Snow Leopard 10.6.3 through 10.6.7 due to bug(s) in QuickTime X and/or other underlying frameworks. :/ Confirmed bug. https://bugs.webkit.org/show_bug.cgi?id=32159
hasConsole = (window.console !== _undefined && console.log !== _undefined),
isFocused = (doc.hasFocus !== _undefined ? doc.hasFocus() : null),
tryInitOnFocus = (isSafari && (doc.hasFocus === _undefined || !doc.hasFocus())),
okToDisable = !tryInitOnFocus,
flashMIME = /(mp3|mp4|mpa|m4a|m4b)/i,
msecScale = 1000,
emptyURL = 'about:blank', // safe URL to unload, or load nothing from (flash 8 + most HTML5 UAs)
emptyWAV = 'data:audio/wave;base64,/UklGRiYAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQIAAAD//w==', // tiny WAV for HTML5 unloading
overHTTP = (doc.location ? doc.location.protocol.match(/http/i) : null),
http = (!overHTTP ? 'http:/' + '/' : ''),
// mp3, mp4, aac etc.
netStreamMimeTypes = /^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|m4b|mp4v|3gp|3g2)\s*(?:$|;)/i,
// Flash v9.0r115+ "moviestar" formats
netStreamTypes = ['mpeg4', 'aac', 'flv', 'mov', 'mp4', 'm4v', 'f4v', 'm4a', 'm4b', 'mp4v', '3gp', '3g2'],
netStreamPattern = new RegExp('\\.(' + netStreamTypes.join('|') + ')(\\?.*)?$', 'i');
this.mimePattern = /^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i; // default mp3 set
// use altURL if not "online"
this.useAltURL = !overHTTP;
swfCSS = {
'swfBox': 'sm2-object-box',
'swfDefault': 'movieContainer',
'swfError': 'swf_error', // SWF loaded, but SM2 couldn't start (other error)
'swfTimedout': 'swf_timedout',
'swfLoaded': 'swf_loaded',
'swfUnblocked': 'swf_unblocked', // or loaded OK
'sm2Debug': 'sm2_debug',
'highPerf': 'high_performance',
'flashDebug': 'flash_debug'
};
/**
* basic HTML5 Audio() support test
* try...catch because of IE 9 "not implemented" nonsense
* https://github.com/Modernizr/Modernizr/issues/224
*/
this.hasHTML5 = (function() {
try {
// new Audio(null) for stupid Opera 9.64 case, which throws not_enough_arguments exception otherwise.
return(Audio !== _undefined && (isOpera && opera !== _undefined && opera.version() < 10 ? new Audio(null) : new Audio()).canPlayType !== _undefined);
} catch(e) {
return false;
}
}());
/**
* Public SoundManager API
* -----------------------
*/
/**
* Configures top-level soundManager properties.
*
* @param {object} options Option parameters, eg. { flashVersion: 9, url: '/path/to/swfs/' }
* onready and ontimeout are also accepted parameters. call soundManager.setup() to see the full list.
*/
this.setup = function(options) {
var noURL = (!sm2.url);
// warn if flash options have already been applied
if(options !== _undefined && didInit && needsFlash && sm2.ok() && (options.flashVersion !== _undefined || options.url !== _undefined || options.html5Test !== _undefined)) {
complain(str('setupLate'));
}
// TODO: defer: true?
assign(options);
// special case 1: "Late setup". SM2 loaded normally, but user didn't assign flash URL eg., setup({url:...}) before SM2 init. Treat as delayed init.
if(options) {
if(noURL && didDCLoaded && options.url !== _undefined) {
sm2.beginDelayedInit();
}
// special case 2: If lazy-loading SM2 (DOMContentLoaded has already happened) and user calls setup() with url: parameter, try to init ASAP.
if(!didDCLoaded && options.url !== _undefined && doc.readyState === 'complete') {
setTimeout(domContentLoaded, 1);
}
}
return sm2;
};
this.ok = function() {
return(needsFlash ? (didInit && !disabled) : (sm2.useHTML5Audio && sm2.hasHTML5));
};
this.supported = this.ok; // legacy
this.getMovie = function(smID) {
// safety net: some old browsers differ on SWF references, possibly related to ExternalInterface / flash version
return id(smID) || doc[smID] || window[smID];
};
/**
* Creates a SMSound sound object instance.
*
* @param {object} oOptions Sound options (at minimum, id and url parameters are required.)
* @return {object} SMSound The new SMSound object.
*/
this.createSound = function(oOptions, _url) {
var cs, cs_string, options, oSound = null;
// <d>
cs = sm + '.createSound(): ';
cs_string = cs + str(!didInit ? 'notReady' : 'notOK');
// </d>
if(!didInit || !sm2.ok()) {
complain(cs_string);
return false;
}
if(_url !== _undefined) {
// function overloading in JS! :) ..assume simple createSound(id, url) use case
oOptions = {
'id': oOptions,
'url': _url
};
}
// inherit from defaultOptions
options = mixin(oOptions);
options.url = parseURL(options.url);
// generate an id, if needed.
if(options.id === undefined) {
options.id = sm2.setupOptions.idPrefix + (idCounter++);
}
// <d>
if(options.id.toString().charAt(0).match(/^[0-9]$/)) {
sm2._wD(cs + str('badID', options.id), 2);
}
sm2._wD(cs + options.id + (options.url ? ' (' + options.url + ')' : ''), 1);
// </d>
if(idCheck(options.id, true)) {
sm2._wD(cs + options.id + ' exists', 1);
return sm2.sounds[options.id];
}
function make() {
options = loopFix(options);
sm2.sounds[options.id] = new SMSound(options);
sm2.soundIDs.push(options.id);
return sm2.sounds[options.id];
}
if(html5OK(options)) {
oSound = make();
sm2._wD(options.id + ': Using HTML5');
oSound._setup_html5(options);
} else {
if(sm2.html5Only) {
sm2._wD(options.id + ': No HTML5 support for this sound, and no Flash. Exiting.');
return make();
}
// TODO: Move HTML5/flash checks into generic URL parsing/handling function.
if(sm2.html5.usingFlash && options.url && options.url.match(/data\:/i)) {
// data: URIs not supported by Flash, either.
sm2._wD(options.id + ': data: URIs not supported via Flash. Exiting.');
return make();
}
if(fV > 8) {
if(options.isMovieStar === null) {
// attempt to detect MPEG-4 formats
options.isMovieStar = !! (options.serverURL || (options.type ? options.type.match(netStreamMimeTypes) : false) || (options.url && options.url.match(netStreamPattern)));
}
// <d>
if(options.isMovieStar) {
sm2._wD(cs + 'using MovieStar handling');
if(options.loops > 1) {
_wDS('noNSLoop');
}
}
// </d>
}
options = policyFix(options, cs);
oSound = make();
if(fV === 8) {
flash._createSound(options.id, options.loops || 1, options.usePolicyFile);
} else {
flash._createSound(options.id, options.url, options.usePeakData, options.useWaveformData, options.useEQData, options.isMovieStar, (options.isMovieStar ? options.bufferTime : false), options.loops || 1, options.serverURL, options.duration || null, options.autoPlay, true, options.autoLoad, options.usePolicyFile);
if(!options.serverURL) {
// We are connected immediately
oSound.connected = true;
if(options.onconnect) {
options.onconnect.apply(oSound);
}
}
}
if(!options.serverURL && (options.autoLoad || options.autoPlay)) {
// call load for non-rtmp streams
oSound.load(options);
}
}
// rtmp will play in onconnect
if(!options.serverURL && options.autoPlay) {
oSound.play();
}
return oSound;
};
/**
* Destroys a SMSound sound object instance.
*
* @param {string} sID The ID of the sound to destroy
*/
this.destroySound = function(sID, _bFromSound) {
// explicitly destroy a sound before normal page unload, etc.
if(!idCheck(sID)) {
return false;
}
var oS = sm2.sounds[sID],
i;
// Disable all callbacks while the sound is being destroyed
oS._iO = {};
oS.stop();
oS.unload();
for(i = 0; i < sm2.soundIDs.length; i++) {
if(sm2.soundIDs[i] === sID) {
sm2.soundIDs.splice(i, 1);
break;
}
}
if(!_bFromSound) {
// ignore if being called from SMSound instance
oS.destruct(true);
}
oS = null;
delete sm2.sounds[sID];
return true;
};
/**
* Calls the load() method of a SMSound object by ID.
*
* @param {string} sID The ID of the sound
* @param {object} oOptions Optional: Sound options
*/
this.load = function(sID, oOptions) {
if(!idCheck(sID)) {
return false;
}
return sm2.sounds[sID].load(oOptions);
};
/**
* Calls the unload() method of a SMSound object by ID.
*
* @param {string} sID The ID of the sound
*/
this.unload = function(sID) {
if(!idCheck(sID)) {
return false;
}
return sm2.sounds[sID].unload();
};
/**
* Calls the onPosition() method of a SMSound object by ID.
*
* @param {string} sID The ID of the sound
* @param {number} nPosition The position to watch for
* @param {function} oMethod The relevant callback to fire
* @param {object} oScope Optional: The scope to apply the callback to
* @return {SMSound} The SMSound object
*/
this.onPosition = function(sID, nPosition, oMethod, oScope) {
if(!idCheck(sID)) {
return false;
}
return sm2.sounds[sID].onposition(nPosition, oMethod, oScope);
};
// legacy/backwards-compability: lower-case method name
this.onposition = this.onPosition;
/**
* Calls the clearOnPosition() method of a SMSound object by ID.
*
* @param {string} sID The ID of the sound
* @param {number} nPosition The position to watch for
* @param {function} oMethod Optional: The relevant callback to fire
* @return {SMSound} The SMSound object
*/
this.clearOnPosition = function(sID, nPosition, oMethod) {
if(!idCheck(sID)) {
return false;
}
return sm2.sounds[sID].clearOnPosition(nPosition, oMethod);
};
/**
* Calls the play() method of a SMSound object by ID.
*
* @param {string} sID The ID of the sound
* @param {object} oOptions Optional: Sound options
* @return {SMSound} The SMSound object
*/
this.play = function(sID, oOptions) {
var result = null,
// legacy function-overloading use case: play('mySound', '/path/to/some.mp3');
overloaded = (oOptions && !(oOptions instanceof Object));
if(!didInit || !sm2.ok()) {
complain(sm + '.play(): ' + str(!didInit ? 'notReady' : 'notOK'));
return false;
}
if(!idCheck(sID, overloaded)) {
if(!overloaded) {
// no sound found for the given ID. Bail.
return false;
}
if(overloaded) {
oOptions = {
url: oOptions
};
}
if(oOptions && oOptions.url) {
// overloading use case, create+play: .play('someID', {url:'/path/to.mp3'});
sm2._wD(sm + '.play(): Attempting to create "' + sID + '"', 1);
oOptions.id = sID;
result = sm2.createSound(oOptions).play();
}
} else if(overloaded) {
// existing sound object case
oOptions = {
url: oOptions
};
}
if(result === null) {
// default case
result = sm2.sounds[sID].play(oOptions);
}
return result;
};
this.start = this.play; // just for convenience
/**
* Calls the setPosition() method of a SMSound object by ID.
*
* @param {string} sID The ID of the sound
* @param {number} nMsecOffset Position (milliseconds)
* @return {SMSound} The SMSound object
*/
this.setPosition = function(sID, nMsecOffset) {
if(!idCheck(sID)) {
return false;
}
return sm2.sounds[sID].setPosition(nMsecOffset);
};
/**
* Calls the stop() method of a SMSound object by ID.
*
* @param {string} sID The ID of the sound
* @return {SMSound} The SMSound object
*/
this.stop = function(sID) {
if(!idCheck(sID)) {
return false;
}
sm2._wD(sm + '.stop(' + sID + ')', 1);
return sm2.sounds[sID].stop();
};
/**
* Stops all currently-playing sounds.
*/
this.stopAll = function() {
var oSound;
sm2._wD(sm + '.stopAll()', 1);
for(oSound in sm2.sounds) {
if(sm2.sounds.hasOwnProperty(oSound)) {
// apply only to sound objects
sm2.sounds[oSound].stop();
}
}
};
/**
* Calls the pause() method of a SMSound object by ID.
*
* @param {string} sID The ID of the sound
* @return {SMSound} The SMSound object
*/
this.pause = function(sID) {
if(!idCheck(sID)) {
return false;
}
return sm2.sounds[sID].pause();
};
/**
* Pauses all currently-playing sounds.
*/
this.pauseAll = function() {
var i;
for(i = sm2.soundIDs.length - 1; i >= 0; i--) {
sm2.sounds[sm2.soundIDs[i]].pause();
}
};
/**
* Calls the resume() method of a SMSound object by ID.
*
* @param {string} sID The ID of the sound
* @return {SMSound} The SMSound object
*/
this.resume = function(sID) {
if(!idCheck(sID)) {
return false;
}
return sm2.sounds[sID].resume();
};
/**
* Resumes all currently-paused sounds.
*/
this.resumeAll = function() {
var i;
for(i = sm2.soundIDs.length - 1; i >= 0; i--) {
sm2.sounds[sm2.soundIDs[i]].resume();
}
};
/**
* Calls the togglePause() method of a SMSound object by ID.
*
* @param {string} sID The ID of the sound
* @return {SMSound} The SMSound object
*/
this.togglePause = function(sID) {
if(!idCheck(sID)) {
return false;
}
return sm2.sounds[sID].togglePause();
};
/**
* Calls the setPan() method of a SMSound object by ID.
*
* @param {string} sID The ID of the sound
* @param {number} nPan The pan value (-100 to 100)
* @return {SMSound} The SMSound object
*/
this.setPan = function(sID, nPan) {
if(!idCheck(sID)) {
return false;
}
return sm2.sounds[sID].setPan(nPan);
};
/**
* Calls the setVolume() method of a SMSound object by ID.
*
* @param {string} sID The ID of the sound
* @param {number} nVol The volume value (0 to 100)
* @return {SMSound} The SMSound object
*/
this.setVolume = function(sID, nVol) {
if(!idCheck(sID)) {
return false;
}
return sm2.sounds[sID].setVolume(nVol);
};
/**
* Calls the mute() method of either a single SMSound object by ID, or all sound objects.
*
* @param {string} sID Optional: The ID of the sound (if omitted, all sounds will be used.)
*/
this.mute = function(sID) {
var i = 0;
if(sID instanceof String) {
sID = null;
}
if(!sID) {
sm2._wD(sm + '.mute(): Muting all sounds');
for(i = sm2.soundIDs.length - 1; i >= 0; i--) {
sm2.sounds[sm2.soundIDs[i]].mute();
}
sm2.muted = true;
} else {
if(!idCheck(sID)) {
return false;
}
sm2._wD(sm + '.mute(): Muting "' + sID + '"');
return sm2.sounds[sID].mute();
}
return true;
};
/**
* Mutes all sounds.
*/
this.muteAll = function() {
sm2.mute();
};
/**
* Calls the unmute() method of either a single SMSound object by ID, or all sound objects.
*
* @param {string} sID Optional: The ID of the sound (if omitted, all sounds will be used.)
*/
this.unmute = function(sID) {
var i;
if(sID instanceof String) {
sID = null;
}
if(!sID) {
sm2._wD(sm + '.unmute(): Unmuting all sounds');
for(i = sm2.soundIDs.length - 1; i >= 0; i--) {
sm2.sounds[sm2.soundIDs[i]].unmute();
}
sm2.muted = false;
} else {
if(!idCheck(sID)) {
return false;
}
sm2._wD(sm + '.unmute(): Unmuting "' + sID + '"');
return sm2.sounds[sID].unmute();
}
return true;
};
/**
* Unmutes all sounds.
*/
this.unmuteAll = function() {
sm2.unmute();
};
/**
* Calls the toggleMute() method of a SMSound object by ID.
*
* @param {string} sID The ID of the sound
* @return {SMSound} The SMSound object
*/
this.toggleMute = function(sID) {
if(!idCheck(sID)) {
return false;
}
return sm2.sounds[sID].toggleMute();
};
/**
* Retrieves the memory used by the flash plugin.
*
* @return {number} The amount of memory in use
*/
this.getMemoryUse = function() {
// flash-only
var ram = 0;
if(flash && fV !== 8) {
ram = parseInt(flash._getMemoryUse(), 10);
}
return ram;
};
/**
* Undocumented: NOPs soundManager and all SMSound objects.
*/
this.disable = function(bNoDisable) {
// destroy all functions
var i;
if(bNoDisable === _undefined) {
bNoDisable = false;
}
if(disabled) {
return false;
}
disabled = true;
_wDS('shutdown', 1);
for(i = sm2.soundIDs.length - 1; i >= 0; i--) {
disableObject(sm2.sounds[sm2.soundIDs[i]]);
}
// fire "complete", despite fail
initComplete(bNoDisable);
event.remove(window, 'load', initUserOnload);
return true;
};
/**
* Determines playability of a MIME type, eg. 'audio/mp3'.
*/
this.canPlayMIME = function(sMIME) {
var result;
if(sm2.hasHTML5) {
result = html5CanPlay({
type: sMIME
});
}
if(!result && needsFlash) {
// if flash 9, test netStream (movieStar) types as well.
result = (sMIME && sm2.ok() ? !! ((fV > 8 ? sMIME.match(netStreamMimeTypes) : null) || sMIME.match(sm2.mimePattern)) : null); // TODO: make less "weird" (per JSLint)
}
return result;
};
/**
* Determines playability of a URL based on audio support.
*
* @param {string} sURL The URL to test
* @return {boolean} URL playability
*/
this.canPlayURL = function(sURL) {
var result;
if(sm2.hasHTML5) {
result = html5CanPlay({
url: sURL
});
}
if(!result && needsFlash) {
result = (sURL && sm2.ok() ? !! (sURL.match(sm2.filePattern)) : null);
}
return result;
};
/**
* Determines playability of an HTML DOM <a> object (or similar object literal) based on audio support.
*
* @param {object} oLink an HTML DOM <a> object or object literal including href and/or type attributes
* @return {boolean} URL playability
*/
this.canPlayLink = function(oLink) {
if(oLink.type !== _undefined && oLink.type) {
if(sm2.canPlayMIME(oLink.type)) {
return true;
}
}
return sm2.canPlayURL(oLink.href);
};
/**
* Retrieves a SMSound object by ID.
*
* @param {string} sID The ID of the sound
* @return {SMSound} The SMSound object
*/
this.getSoundById = function(sID, _suppressDebug) {
if(!sID) {
return null;
}
var result = sm2.sounds[sID];
// <d>
if(!result && !_suppressDebug) {
sm2._wD(sm + '.getSoundById(): Sound "' + sID + '" not found.', 2);
}
// </d>
return result;
};
/**
* Queues a callback for execution when SoundManager has successfully initialized.
*
* @param {function} oMethod The callback method to fire
* @param {object} oScope Optional: The scope to apply to the callback
*/
this.onready = function(oMethod, oScope) {
var sType = 'onready',
result = false;
if(typeof oMethod === 'function') {
// <d>
if(didInit) {
sm2._wD(str('queue', sType));
}
// </d>
if(!oScope) {
oScope = window;
}
addOnEvent(sType, oMethod, oScope);
processOnEvents();
result = true;
} else {
throw str('needFunction', sType);
}
return result;
};
/**
* Queues a callback for execution when SoundManager has failed to initialize.
*
* @param {function} oMethod The callback method to fire
* @param {object} oScope Optional: The scope to apply to the callback
*/
this.ontimeout = function(oMethod, oScope) {
var sType = 'ontimeout',
result = false;
if(typeof oMethod === 'function') {
// <d>
if(didInit) {
sm2._wD(str('queue', sType));
}
// </d>
if(!oScope) {
oScope = window;
}
addOnEvent(sType, oMethod, oScope);
processOnEvents({
type: sType
});
result = true;
} else {
throw str('needFunction', sType);
}
return result;
};
/**
* Writes console.log()-style debug output to a console or in-browser element.
* Applies when debugMode = true
*
* @param {string} sText The console message
* @param {object} nType Optional log level (number), or object. Number case: Log type/style where 0 = 'info', 1 = 'warn', 2 = 'error'. Object case: Object to be dumped.
*/
this._writeDebug = function(sText, sTypeOrObject) {
// pseudo-private console.log()-style output
// <d>
var sDID = 'soundmanager-debug',
o, oItem;
if(!sm2.debugMode) {
return false;
}
if(hasConsole && sm2.useConsole) {
if(sTypeOrObject && typeof sTypeOrObject === 'object') {
// object passed; dump to console.
console.log(sText, sTypeOrObject);
} else if(debugLevels[sTypeOrObject] !== _undefined) {
console[debugLevels[sTypeOrObject]](sText);
} else {
console.log(sText);
}
if(sm2.consoleOnly) {
return true;
}
}
o = id(sDID);
if(!o) {
return false;
}
oItem = doc.createElement('div');
if(++wdCount % 2 === 0) {
oItem.className = 'sm2-alt';
}
if(sTypeOrObject === _undefined) {
sTypeOrObject = 0;
} else {
sTypeOrObject = parseInt(sTypeOrObject, 10);
}
oItem.appendChild(doc.createTextNode(sText));
if(sTypeOrObject) {
if(sTypeOrObject >= 2) {
oItem.style.fontWeight = 'bold';
}
if(sTypeOrObject === 3) {
oItem.style.color = '#ff3333';
}
}
// top-to-bottom
// o.appendChild(oItem);
// bottom-to-top
o.insertBefore(oItem, o.firstChild);
o = null;
// </d>
return true;
};
// <d>
// last-resort debugging option
if(wl.indexOf('sm2-debug=alert') !== -1) {
this._writeDebug = function(sText) {
window.alert(sText);
};
}
// </d>
// alias
this._wD = this._writeDebug;
/**
* Provides debug / state information on all SMSound objects.
*/
this._debug = function() {
// <d>
var i, j;
_wDS('currentObj', 1);
for(i = 0, j = sm2.soundIDs.length; i < j; i++) {
sm2.sounds[sm2.soundIDs[i]]._debug();
}
// </d>
};
/**
* Restarts and re-initializes the SoundManager instance.
*
* @param {boolean} resetEvents Optional: When true, removes all registered onready and ontimeout event callbacks.
* @param {boolean} excludeInit Options: When true, does not call beginDelayedInit() (which would restart SM2).
* @return {object} soundManager The soundManager instance.
*/
this.reboot = function(resetEvents, excludeInit) {
// reset some (or all) state, and re-init unless otherwise specified.
// <d>
if(sm2.soundIDs.length) {
sm2._wD('Destroying ' + sm2.soundIDs.length + ' SMSound object' + (sm2.soundIDs.length !== 1 ? 's' : '') + '...');
}
// </d>
var i, j, k;
for(i = sm2.soundIDs.length - 1; i >= 0; i--) {
sm2.sounds[sm2.soundIDs[i]].destruct();
}
// trash ze flash (remove from the DOM)
if(flash) {
try {
if(isIE) {
oRemovedHTML = flash.innerHTML;
}
oRemoved = flash.parentNode.removeChild(flash);
} catch(e) {
// Remove failed? May be due to flash blockers silently removing the SWF object/embed node from the DOM. Warn and continue.
_wDS('badRemove', 2);
}
}
// actually, force recreate of movie.
oRemovedHTML = oRemoved = needsFlash = flash = null;
sm2.enabled = didDCLoaded = didInit = waitingForEI = initPending = didAppend = appendSuccess = disabled = useGlobalHTML5Audio = sm2.swfLoaded = false;
sm2.soundIDs = [];
sm2.sounds = {};
idCounter = 0;
if(!resetEvents) {
// reset callbacks for onready, ontimeout etc. so that they will fire again on re-init
for(i in on_queue) {
if(on_queue.hasOwnProperty(i)) {
for(j = 0, k = on_queue[i].length; j < k; j++) {
on_queue[i][j].fired = false;
}
}
}
} else {
// remove all callbacks entirely
on_queue = [];
}
// <d>
if(!excludeInit) {
sm2._wD(sm + ': Rebooting...');
}
// </d>
// reset HTML5 and flash canPlay test results
sm2.html5 = {
'usingFlash': null
};
sm2.flash = {};
// reset device-specific HTML/flash mode switches
sm2.html5Only = false;
sm2.ignoreFlash = false;
window.setTimeout(function() {
preInit();
// by default, re-init
if(!excludeInit) {
sm2.beginDelayedInit();
}
}, 20);
return sm2;
};
this.reset = function() {
/**
* Shuts down and restores the SoundManager instance to its original loaded state, without an explicit reboot. All onready/ontimeout handlers are removed.
* After this call, SM2 may be re-initialized via soundManager.beginDelayedInit().
* @return {object} soundManager The soundManager instance.
*/
_wDS('reset');
return sm2.reboot(true, true);
};
/**
* Undocumented: Determines the SM2 flash movie's load progress.
*
* @return {number or null} Percent loaded, or if invalid/unsupported, null.
*/
this.getMoviePercent = function() {
/**
* Interesting syntax notes...
* Flash/ExternalInterface (ActiveX/NPAPI) bridge methods are not typeof "function" nor instanceof Function, but are still valid.
* Additionally, JSLint dislikes ('PercentLoaded' in flash)-style syntax and recommends hasOwnProperty(), which does not work in this case.
* Furthermore, using (flash && flash.PercentLoaded) causes IE to throw "object doesn't support this property or method".
* Thus, 'in' syntax must be used.
*/
return(flash && 'PercentLoaded' in flash ? flash.PercentLoaded() : null); // Yes, JSLint. See nearby comment in source for explanation.
};
/**
* Additional helper for manually invoking SM2's init process after DOM Ready / window.onload().
*/
this.beginDelayedInit = function() {
windowLoaded = true;
domContentLoaded();
setTimeout(function() {
if(initPending) {
return false;
}
createMovie();
initMovie();
initPending = true;
return true;
}, 20);
delayWaitForEI();
};
/**
* Destroys the SoundManager instance and all SMSound instances.
*/
this.destruct = function() {
sm2._wD(sm + '.destruct()');
sm2.disable(true);
};
/**
* SMSound() (sound object) constructor
* ------------------------------------
*
* @param {object} oOptions Sound options (id and url are required attributes)
* @return {SMSound} The new SMSound object
*/
SMSound = function(oOptions) {
var s = this,
resetProperties, add_html5_events, remove_html5_events, stop_html5_timer, start_html5_timer, attachOnPosition, onplay_called = false,
onPositionItems = [],
onPositionFired = 0,
detachOnPosition, applyFromTo, lastURL = null,
lastHTML5State, urlOmitted;
lastHTML5State = {
// tracks duration + position (time)
duration: null,
time: null
};
this.id = oOptions.id;
// legacy
this.sID = this.id;
this.url = oOptions.url;
this.options = mixin(oOptions);
// per-play-instance-specific options
this.instanceOptions = this.options;
// short alias
this._iO = this.instanceOptions;
// assign property defaults
this.pan = this.options.pan;
this.volume = this.options.volume;
// whether or not this object is using HTML5
this.isHTML5 = false;
// internal HTML5 Audio() object reference
this._a = null;
// for flash 8 special-case createSound() without url, followed by load/play with url case
urlOmitted = (this.url ? false : true);
/**
* SMSound() public methods
* ------------------------
*/
this.id3 = {};
/**
* Writes SMSound object parameters to debug console
*/
this._debug = function() {
// <d>
sm2._wD(s.id + ': Merged options:', s.options);
// </d>
};
/**
* Begins loading a sound per its *url*.
*
* @param {object} oOptions Optional: Sound options
* @return {SMSound} The SMSound object
*/
this.load = function(oOptions) {
var oSound = null,
instanceOptions;
if(oOptions !== _undefined) {
s._iO = mixin(oOptions, s.options);
} else {
oOptions = s.options;
s._iO = oOptions;
if(lastURL && lastURL !== s.url) {
_wDS('manURL');
s._iO.url = s.url;
s.url = null;
}
}
if(!s._iO.url) {
s._iO.url = s.url;
}
s._iO.url = parseURL(s._iO.url);
// ensure we're in sync
s.instanceOptions = s._iO;
// local shortcut
instanceOptions = s._iO;
sm2._wD(s.id + ': load (' + instanceOptions.url + ')');
if(!instanceOptions.url && !s.url) {
sm2._wD(s.id + ': load(): url is unassigned. Exiting.', 2);
return s;
}
// <d>
if(!s.isHTML5 && fV === 8 && !s.url && !instanceOptions.autoPlay) {
// flash 8 load() -> play() won't work before onload has fired.
sm2._wD(s.id + ': Flash 8 load() limitation: Wait for onload() before calling play().', 1);
}
// </d>
if(instanceOptions.url === s.url && s.readyState !== 0 && s.readyState !== 2) {
_wDS('onURL', 1);
// if loaded and an onload() exists, fire immediately.
if(s.readyState === 3 && instanceOptions.onload) {
// assume success based on truthy duration.
wrapCallback(s, function() {
instanceOptions.onload.apply(s, [( !! s.duration)]);
});
}
return s;
}
// reset a few state properties
s.loaded = false;
s.readyState = 1;
s.playState = 0;
s.id3 = {};
// TODO: If switching from HTML5 -> flash (or vice versa), stop currently-playing audio.
if(html5OK(instanceOptions)) {
oSound = s._setup_html5(instanceOptions);
if(!oSound._called_load) {
s._html5_canplay = false;
// TODO: review called_load / html5_canplay logic
// if url provided directly to load(), assign it here.
if(s.url !== instanceOptions.url) {
sm2._wD(_wDS('manURL') + ': ' + instanceOptions.url);
s._a.src = instanceOptions.url;
// TODO: review / re-apply all relevant options (volume, loop, onposition etc.)
// reset position for new URL
s.setPosition(0);
}
// given explicit load call, try to preload.
// early HTML5 implementation (non-standard)
s._a.autobuffer = 'auto';
// standard property, values: none / metadata / auto
// reference: http://msdn.microsoft.com/en-us/library/ie/ff974759%28v=vs.85%29.aspx
s._a.preload = 'auto';
s._a._called_load = true;
} else {
sm2._wD(s.id + ': Ignoring request to load again');
}
} else {
if(sm2.html5Only) {
sm2._wD(s.id + ': No flash support. Exiting.');
return s;
}
if(s._iO.url && s._iO.url.match(/data\:/i)) {
// data: URIs not supported by Flash, either.
sm2._wD(s.id + ': data: URIs not supported via Flash. Exiting.');
return s;
}
try {
s.isHTML5 = false;
s._iO = policyFix(loopFix(instanceOptions));
// if we have "position", disable auto-play as we'll be seeking to that position at onload().
if(s._iO.autoPlay && (s._iO.position || s._iO.from)) {
sm2._wD(s.id + ': Disabling autoPlay because of non-zero offset case');
s._iO.autoPlay = false;
}
// re-assign local shortcut
instanceOptions = s._iO;
if(fV === 8) {
flash._load(s.id, instanceOptions.url, instanceOptions.stream, instanceOptions.autoPlay, instanceOptions.usePolicyFile);
} else {
flash._load(s.id, instanceOptions.url, !! (instanceOptions.stream), !! (instanceOptions.autoPlay), instanceOptions.loops || 1, !! (instanceOptions.autoLoad), instanceOptions.usePolicyFile);
}
} catch(e) {
_wDS('smError', 2);
debugTS('onload', false);
catchError({
type: 'SMSOUND_LOAD_JS_EXCEPTION',
fatal: true
});
}
}
// after all of this, ensure sound url is up to date.
s.url = instanceOptions.url;
return s;
};
/**
* Unloads a sound, canceling any open HTTP requests.
*
* @return {SMSound} The SMSound object
*/
this.unload = function() {
// Flash 8/AS2 can't "close" a stream - fake it by loading an empty URL
// Flash 9/AS3: Close stream, preventing further load
// HTML5: Most UAs will use empty URL
if(s.readyState !== 0) {
sm2._wD(s.id + ': unload()');
if(!s.isHTML5) {
if(fV === 8) {
flash._unload(s.id, emptyURL);
} else {
flash._unload(s.id);
}
} else {
stop_html5_timer();
if(s._a) {
s._a.pause();
// update empty URL, too
lastURL = html5Unload(s._a);
}
}
// reset load/status flags
resetProperties();
}
return s;
};
/**
* Unloads and destroys a sound.
*/
this.destruct = function(_bFromSM) {
sm2._wD(s.id + ': Destruct');
if(!s.isHTML5) {
// kill sound within Flash
// Disable the onfailure handler
s._iO.onfailure = null;
flash._destroySound(s.id);
} else {
stop_html5_timer();
if(s._a) {
s._a.pause();
html5Unload(s._a);
if(!useGlobalHTML5Audio) {
remove_html5_events();
}
// break obvious circular reference
s._a._s = null;
s._a = null;
}
}
if(!_bFromSM) {
// ensure deletion from controller
sm2.destroySound(s.id, true);
}
};
/**
* Begins playing a sound.
*
* @param {object} oOptions Optional: Sound options
* @return {SMSound} The SMSound object
*/
this.play = function(oOptions, _updatePlayState) {
var fN, allowMulti, a, onready,
audioClone, onended, oncanplay,
startOK = true,
exit = null;
// <d>
fN = s.id + ': play(): ';
// </d>
// default to true
_updatePlayState = (_updatePlayState === _undefined ? true : _updatePlayState);
if(!oOptions) {
oOptions = {};
}
// first, use local URL (if specified)
if(s.url) {
s._iO.url = s.url;
}
// mix in any options defined at createSound()
s._iO = mixin(s._iO, s.options);
// mix in any options specific to this method
s._iO = mixin(oOptions, s._iO);
s._iO.url = parseURL(s._iO.url);
s.instanceOptions = s._iO;
// RTMP-only
if(!s.isHTML5 && s._iO.serverURL && !s.connected) {
if(!s.getAutoPlay()) {
sm2._wD(fN + ' Netstream not connected yet - setting autoPlay');
s.setAutoPlay(true);
}
// play will be called in onconnect()
return s;
}
if(html5OK(s._iO)) {
s._setup_html5(s._iO);
start_html5_timer();
}
if(s.playState === 1 && !s.paused) {
allowMulti = s._iO.multiShot;
if(!allowMulti) {
sm2._wD(fN + 'Already playing (one-shot)', 1);
if(s.isHTML5) {
// go back to original position.
s.setPosition(s._iO.position);
}
exit = s;
} else {
sm2._wD(fN + 'Already playing (multi-shot)', 1);
}
}
if(exit !== null) {
return exit;
}
// edge case: play() with explicit URL parameter
if(oOptions.url && oOptions.url !== s.url) {
// special case for createSound() followed by load() / play() with url; avoid double-load case.
if(!s.readyState && !s.isHTML5 && fV === 8 && urlOmitted) {
urlOmitted = false;
} else {
// load using merged options
s.load(s._iO);
}
}
if(!s.loaded) {
if(s.readyState === 0) {
sm2._wD(fN + 'Attempting to load');
// try to get this sound playing ASAP
if(!s.isHTML5 && !sm2.html5Only) {
// flash: assign directly because setAutoPlay() increments the instanceCount
s._iO.autoPlay = true;
s.load(s._iO);
} else if(s.isHTML5) {
// iOS needs this when recycling sounds, loading a new URL on an existing object.
s.load(s._iO);
} else {
sm2._wD(fN + 'Unsupported type. Exiting.');
exit = s;
}
// HTML5 hack - re-set instanceOptions?
s.instanceOptions = s._iO;
} else if(s.readyState === 2) {
sm2._wD(fN + 'Could not load - exiting', 2);
exit = s;
} else {
sm2._wD(fN + 'Loading - attempting to play...');
}
} else {
// "play()"
sm2._wD(fN.substr(0, fN.lastIndexOf(':')));
}
if(exit !== null) {
return exit;
}
if(!s.isHTML5 && fV === 9 && s.position > 0 && s.position === s.duration) {
// flash 9 needs a position reset if play() is called while at the end of a sound.
sm2._wD(fN + 'Sound at end, resetting to position:0');
oOptions.position = 0;
}
/**
* Streams will pause when their buffer is full if they are being loaded.
* In this case paused is true, but the song hasn't started playing yet.
* If we just call resume() the onplay() callback will never be called.
* So only call resume() if the position is > 0.
* Another reason is because options like volume won't have been applied yet.
* For normal sounds, just resume.
*/
if(s.paused && s.position >= 0 && (!s._iO.serverURL || s.position > 0)) {
// https://gist.github.com/37b17df75cc4d7a90bf6
sm2._wD(fN + 'Resuming from paused state', 1);
s.resume();
} else {
s._iO = mixin(oOptions, s._iO);
/**
* Preload in the event of play() with position under Flash,
* or from/to parameters and non-RTMP case
*/
if(((!s.isHTML5 && s._iO.position !== null && s._iO.position > 0) || (s._iO.from !== null && s._iO.from > 0) || s._iO.to !== null) && s.instanceCount === 0 && s.playState === 0 && !s._iO.serverURL) {
onready = function() {
// sound "canplay" or onload()
// re-apply position/from/to to instance options, and start playback
s._iO = mixin(oOptions, s._iO);
s.play(s._iO);
};
// HTML5 needs to at least have "canplay" fired before seeking.
if(s.isHTML5 && !s._html5_canplay) {
// this hasn't been loaded yet. load it first, and then do this again.
sm2._wD(fN + 'Beginning load for non-zero offset case');
s.load({
// note: custom HTML5-only event added for from/to implementation.
_oncanplay: onready
});
exit = false;
} else if(!s.isHTML5 && !s.loaded && (!s.readyState || s.readyState !== 2)) {
// to be safe, preload the whole thing in Flash.
sm2._wD(fN + 'Preloading for non-zero offset case');
s.load({
onload: onready
});
exit = false;
}
if(exit !== null) {
return exit;
}
// otherwise, we're ready to go. re-apply local options, and continue
s._iO = applyFromTo();
}
// sm2._wD(fN + 'Starting to play');
// increment instance counter, where enabled + supported
if(!s.instanceCount || s._iO.multiShotEvents || (s.isHTML5 && s._iO.multiShot && !useGlobalHTML5Audio) || (!s.isHTML5 && fV > 8 && !s.getAutoPlay())) {
s.instanceCount++;
}
// if first play and onposition parameters exist, apply them now
if(s._iO.onposition && s.playState === 0) {
attachOnPosition(s);
}
s.playState = 1;
s.paused = false;
s.position = (s._iO.position !== _undefined && !isNaN(s._iO.position) ? s._iO.position : 0);
if(!s.isHTML5) {
s._iO = policyFix(loopFix(s._iO));
}
if(s._iO.onplay && _updatePlayState) {
s._iO.onplay.apply(s);
onplay_called = true;
}
s.setVolume(s._iO.volume, true);
s.setPan(s._iO.pan, true);
if(!s.isHTML5) {
startOK = flash._start(s.id, s._iO.loops || 1, (fV === 9 ? s.position : s.position / msecScale), s._iO.multiShot || false);
if(fV === 9 && !startOK) {
// edge case: no sound hardware, or 32-channel flash ceiling hit.
// applies only to Flash 9, non-NetStream/MovieStar sounds.
// http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Sound.html#play%28%29
sm2._wD(fN + 'No sound hardware, or 32-sound ceiling hit', 2);
if(s._iO.onplayerror) {
s._iO.onplayerror.apply(s);
}
}
} else {
if(s.instanceCount < 2) {
// HTML5 single-instance case
start_html5_timer();
a = s._setup_html5();
s.setPosition(s._iO.position);
a.play();
} else {
// HTML5 multi-shot case
sm2._wD(s.id + ': Cloning Audio() for instance #' + s.instanceCount + '...');
audioClone = new Audio(s._iO.url);
onended = function() {
event.remove(audioClone, 'ended', onended);
s._onfinish(s);
// cleanup
html5Unload(audioClone);
audioClone = null;
};
oncanplay = function() {
event.remove(audioClone, 'canplay', oncanplay);
try {
audioClone.currentTime = s._iO.position / msecScale;
} catch(err) {
complain(s.id + ': multiShot play() failed to apply position of ' + (s._iO.position / msecScale));
}
audioClone.play();
};
event.add(audioClone, 'ended', onended);
// apply volume to clones, too
if(s._iO.volume !== undefined) {
audioClone.volume = Math.max(0, Math.min(1, s._iO.volume / 100));
}
// playing multiple muted sounds? if you do this, you're weird ;) - but let's cover it.
if(s.muted) {
audioClone.muted = true;
}
if(s._iO.position) {
// HTML5 audio can't seek before onplay() event has fired.
// wait for canplay, then seek to position and start playback.
event.add(audioClone, 'canplay', oncanplay);
} else {
// begin playback at currentTime: 0
audioClone.play();
}
}
}
}
return s;
};
// just for convenience
this.start = this.play;
/**
* Stops playing a sound (and optionally, all sounds)
*
* @param {boolean} bAll Optional: Whether to stop all sounds
* @return {SMSound} The SMSound object
*/
this.stop = function(bAll) {
var instanceOptions = s._iO,
originalPosition;
if(s.playState === 1) {
sm2._wD(s.id + ': stop()');
s._onbufferchange(0);
s._resetOnPosition(0);
s.paused = false;
if(!s.isHTML5) {
s.playState = 0;
}
// remove onPosition listeners, if any
detachOnPosition();
// and "to" position, if set
if(instanceOptions.to) {
s.clearOnPosition(instanceOptions.to);
}
if(!s.isHTML5) {
flash._stop(s.id, bAll);
// hack for netStream: just unload
if(instanceOptions.serverURL) {
s.unload();
}
} else {
if(s._a) {
originalPosition = s.position;
// act like Flash, though
s.setPosition(0);
// hack: reflect old position for onstop() (also like Flash)
s.position = originalPosition;
// html5 has no stop()
// NOTE: pausing means iOS requires interaction to resume.
s._a.pause();
s.playState = 0;
// and update UI
s._onTimer();
stop_html5_timer();
}
}
s.instanceCount = 0;
s._iO = {};
if(instanceOptions.onstop) {
instanceOptions.onstop.apply(s);
}
}
return s;
};
/**
* Undocumented/internal: Sets autoPlay for RTMP.
*
* @param {boolean} autoPlay state
*/
this.setAutoPlay = function(autoPlay) {
sm2._wD(s.id + ': Autoplay turned ' + (autoPlay ? 'on' : 'off'));
s._iO.autoPlay = autoPlay;
if(!s.isHTML5) {
flash._setAutoPlay(s.id, autoPlay);
if(autoPlay) {
// only increment the instanceCount if the sound isn't loaded (TODO: verify RTMP)
if(!s.instanceCount && s.readyState === 1) {
s.instanceCount++;
sm2._wD(s.id + ': Incremented instance count to ' + s.instanceCount);
}
}
}
};
/**
* Undocumented/internal: Returns the autoPlay boolean.
*
* @return {boolean} The current autoPlay value
*/
this.getAutoPlay = function() {
return s._iO.autoPlay;
};
/**
* Sets the position of a sound.
*
* @param {number} nMsecOffset Position (milliseconds)
* @return {SMSound} The SMSound object
*/
this.setPosition = function(nMsecOffset) {
if(nMsecOffset === _undefined) {
nMsecOffset = 0;
}
var position, position1K,
// Use the duration from the instance options, if we don't have a track duration yet.
// position >= 0 and <= current available (loaded) duration
offset = (s.isHTML5 ? Math.max(nMsecOffset, 0) : Math.min(s.duration || s._iO.duration, Math.max(nMsecOffset, 0)));
s.position = offset;
position1K = s.position / msecScale;
s._resetOnPosition(s.position);
s._iO.position = offset;
if(!s.isHTML5) {
position = (fV === 9 ? s.position : position1K);
if(s.readyState && s.readyState !== 2) {
// if paused or not playing, will not resume (by playing)
flash._setPosition(s.id, position, (s.paused || !s.playState), s._iO.multiShot);
}
} else if(s._a) {
// Set the position in the canplay handler if the sound is not ready yet
if(s._html5_canplay) {
if(s._a.currentTime !== position1K) {
/**
* DOM/JS errors/exceptions to watch out for:
* if seek is beyond (loaded?) position, "DOM exception 11"
* "INDEX_SIZE_ERR": DOM exception 1
*/
sm2._wD(s.id + ': setPosition(' + position1K + ')');
try {
s._a.currentTime = position1K;
if(s.playState === 0 || s.paused) {
// allow seek without auto-play/resume
s._a.pause();
}
} catch(e) {
sm2._wD(s.id + ': setPosition(' + position1K + ') failed: ' + e.message, 2);
}
}
} else if(position1K) {
// warn on non-zero seek attempts
sm2._wD(s.id + ': setPosition(' + position1K + '): Cannot seek yet, sound not ready', 2);
return s;
}
if(s.paused) {
// if paused, refresh UI right away
// force update
s._onTimer(true);
}
}
return s;
};
/**
* Pauses sound playback.
*
* @return {SMSound} The SMSound object
*/
this.pause = function(_bCallFlash) {
if(s.paused || (s.playState === 0 && s.readyState !== 1)) {
return s;
}
sm2._wD(s.id + ': pause()');
s.paused = true;
if(!s.isHTML5) {
if(_bCallFlash || _bCallFlash === _undefined) {
flash._pause(s.id, s._iO.multiShot);
}
} else {
s._setup_html5().pause();
stop_html5_timer();
}
if(s._iO.onpause) {
s._iO.onpause.apply(s);
}
return s;
};
/**
* Resumes sound playback.
*
* @return {SMSound} The SMSound object
*/
/**
* When auto-loaded streams pause on buffer full they have a playState of 0.
* We need to make sure that the playState is set to 1 when these streams "resume".
* When a paused stream is resumed, we need to trigger the onplay() callback if it
* hasn't been called already. In this case since the sound is being played for the
* first time, I think it's more appropriate to call onplay() rather than onresume().
*/
this.resume = function() {
var instanceOptions = s._iO;
if(!s.paused) {
return s;
}
sm2._wD(s.id + ': resume()');
s.paused = false;
s.playState = 1;
if(!s.isHTML5) {
if(instanceOptions.isMovieStar && !instanceOptions.serverURL) {
// Bizarre Webkit bug (Chrome reported via 8tracks.com dudes): AAC content paused for 30+ seconds(?) will not resume without a reposition.
s.setPosition(s.position);
}
// flash method is toggle-based (pause/resume)
flash._pause(s.id, instanceOptions.multiShot);
} else {
s._setup_html5().play();
start_html5_timer();
}
if(!onplay_called && instanceOptions.onplay) {
instanceOptions.onplay.apply(s);
onplay_called = true;
} else if(instanceOptions.onresume) {
instanceOptions.onresume.apply(s);
}
return s;
};
/**
* Toggles sound playback.
*
* @return {SMSound} The SMSound object
*/
this.togglePause = function() {
sm2._wD(s.id + ': togglePause()');
if(s.playState === 0) {
s.play({
position: (fV === 9 && !s.isHTML5 ? s.position : s.position / msecScale)
});
return s;
}
if(s.paused) {
s.resume();
} else {
s.pause();
}
return s;
};
/**
* Sets the panning (L-R) effect.
*
* @param {number} nPan The pan value (-100 to 100)
* @return {SMSound} The SMSound object
*/
this.setPan = function(nPan, bInstanceOnly) {
if(nPan === _undefined) {
nPan = 0;
}
if(bInstanceOnly === _undefined) {
bInstanceOnly = false;
}
if(!s.isHTML5) {
flash._setPan(s.id, nPan);
} // else { no HTML5 pan? }
s._iO.pan = nPan;
if(!bInstanceOnly) {
s.pan = nPan;
s.options.pan = nPan;
}
return s;
};
/**
* Sets the volume.
*
* @param {number} nVol The volume value (0 to 100)
* @return {SMSound} The SMSound object
*/
this.setVolume = function(nVol, _bInstanceOnly) {
/**
* Note: Setting volume has no effect on iOS "special snowflake" devices.
* Hardware volume control overrides software, and volume
* will always return 1 per Apple docs. (iOS 4 + 5.)
* http://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/HTML-canvas-guide/AddingSoundtoCanvasAnimations/AddingSoundtoCanvasAnimations.html
*/
if(nVol === _undefined) {
nVol = 100;
}
if(_bInstanceOnly === _undefined) {
_bInstanceOnly = false;
}
if(!s.isHTML5) {
flash._setVolume(s.id, (sm2.muted && !s.muted) || s.muted ? 0 : nVol);
} else if(s._a) {
if(sm2.muted && !s.muted) {
s.muted = true;
s._a.muted = true;
}
// valid range: 0-1
s._a.volume = Math.max(0, Math.min(1, nVol / 100));
}
s._iO.volume = nVol;
if(!_bInstanceOnly) {
s.volume = nVol;
s.options.volume = nVol;
}
return s;
};
/**
* Mutes the sound.
*
* @return {SMSound} The SMSound object
*/
this.mute = function() {
s.muted = true;
if(!s.isHTML5) {
flash._setVolume(s.id, 0);
} else if(s._a) {
s._a.muted = true;
}
return s;
};
/**
* Unmutes the sound.
*
* @return {SMSound} The SMSound object
*/
this.unmute = function() {
s.muted = false;
var hasIO = (s._iO.volume !== _undefined);
if(!s.isHTML5) {
flash._setVolume(s.id, hasIO ? s._iO.volume : s.options.volume);
} else if(s._a) {
s._a.muted = false;
}
return s;
};
/**
* Toggles the muted state of a sound.
*
* @return {SMSound} The SMSound object
*/
this.toggleMute = function() {
return(s.muted ? s.unmute() : s.mute());
};
/**
* Registers a callback to be fired when a sound reaches a given position during playback.
*
* @param {number} nPosition The position to watch for
* @param {function} oMethod The relevant callback to fire
* @param {object} oScope Optional: The scope to apply the callback to
* @return {SMSound} The SMSound object
*/
this.onPosition = function(nPosition, oMethod, oScope) {
// TODO: basic dupe checking?
onPositionItems.push({
position: parseInt(nPosition, 10),
method: oMethod,
scope: (oScope !== _undefined ? oScope : s),
fired: false
});
return s;
};
// legacy/backwards-compability: lower-case method name
this.onposition = this.onPosition;
/**
* Removes registered callback(s) from a sound, by position and/or callback.
*
* @param {number} nPosition The position to clear callback(s) for
* @param {function} oMethod Optional: Identify one callback to be removed when multiple listeners exist for one position
* @return {SMSound} The SMSound object
*/
this.clearOnPosition = function(nPosition, oMethod) {
var i;
nPosition = parseInt(nPosition, 10);
if(isNaN(nPosition)) {
// safety check
return false;
}
for(i = 0; i < onPositionItems.length; i++) {
if(nPosition === onPositionItems[i].position) {
// remove this item if no method was specified, or, if the method matches
if(!oMethod || (oMethod === onPositionItems[i].method)) {
if(onPositionItems[i].fired) {
// decrement "fired" counter, too
onPositionFired--;
}
onPositionItems.splice(i, 1);
}
}
}
};
this._processOnPosition = function() {
var i, item, j = onPositionItems.length;
if(!j || !s.playState || onPositionFired >= j) {
return false;
}
for(i = j - 1; i >= 0; i--) {
item = onPositionItems[i];
if(!item.fired && s.position >= item.position) {
item.fired = true;
onPositionFired++;
item.method.apply(item.scope, [item.position]);
j = onPositionItems.length; // reset j -- onPositionItems.length can be changed in the item callback above... occasionally breaking the loop.
}
}
return true;
};
this._resetOnPosition = function(nPosition) {
// reset "fired" for items interested in this position
var i, item, j = onPositionItems.length;
if(!j) {
return false;
}
for(i = j - 1; i >= 0; i--) {
item = onPositionItems[i];
if(item.fired && nPosition <= item.position) {
item.fired = false;
onPositionFired--;
}
}
return true;
};
/**
* SMSound() private internals
* --------------------------------
*/
applyFromTo = function() {
var instanceOptions = s._iO,
f = instanceOptions.from,
t = instanceOptions.to,
start, end;
end = function() {
// end has been reached.
sm2._wD(s.id + ': "To" time of ' + t + ' reached.');
// detach listener
s.clearOnPosition(t, end);
// stop should clear this, too
s.stop();
};
start = function() {
sm2._wD(s.id + ': Playing "from" ' + f);
// add listener for end
if(t !== null && !isNaN(t)) {
s.onPosition(t, end);
}
};
if(f !== null && !isNaN(f)) {
// apply to instance options, guaranteeing correct start position.
instanceOptions.position = f;
// multiShot timing can't be tracked, so prevent that.
instanceOptions.multiShot = false;
start();
}
// return updated instanceOptions including starting position
return instanceOptions;
};
attachOnPosition = function() {
var item,
op = s._iO.onposition;
// attach onposition things, if any, now.
if(op) {
for(item in op) {
if(op.hasOwnProperty(item)) {
s.onPosition(parseInt(item, 10), op[item]);
}
}
}
};
detachOnPosition = function() {
var item,
op = s._iO.onposition;
// detach any onposition()-style listeners.
if(op) {
for(item in op) {
if(op.hasOwnProperty(item)) {
s.clearOnPosition(parseInt(item, 10));
}
}
}
};
start_html5_timer = function() {
if(s.isHTML5) {
startTimer(s);
}
};
stop_html5_timer = function() {
if(s.isHTML5) {
stopTimer(s);
}
};
resetProperties = function(retainPosition) {
if(!retainPosition) {
onPositionItems = [];
onPositionFired = 0;
}
onplay_called = false;
s._hasTimer = null;
s._a = null;
s._html5_canplay = false;
s.bytesLoaded = null;
s.bytesTotal = null;
s.duration = (s._iO && s._iO.duration ? s._iO.duration : null);
s.durationEstimate = null;
s.buffered = [];
// legacy: 1D array
s.eqData = [];
s.eqData.left = [];
s.eqData.right = [];
s.failures = 0;
s.isBuffering = false;
s.instanceOptions = {};
s.instanceCount = 0;
s.loaded = false;
s.metadata = {};
// 0 = uninitialised, 1 = loading, 2 = failed/error, 3 = loaded/success
s.readyState = 0;
s.muted = false;
s.paused = false;
s.peakData = {
left: 0,
right: 0
};
s.waveformData = {
left: [],
right: []
};
s.playState = 0;
s.position = null;
s.id3 = {};
};
resetProperties();
/**
* Pseudo-private SMSound internals
* --------------------------------
*/
this._onTimer = function(bForce) {
/**
* HTML5-only _whileplaying() etc.
* called from both HTML5 native events, and polling/interval-based timers
* mimics flash and fires only when time/duration change, so as to be polling-friendly
*/
var duration, isNew = false,
time, x = {};
if(s._hasTimer || bForce) {
// TODO: May not need to track readyState (1 = loading)
if(s._a && (bForce || ((s.playState > 0 || s.readyState === 1) && !s.paused))) {
duration = s._get_html5_duration();
if(duration !== lastHTML5State.duration) {
lastHTML5State.duration = duration;
s.duration = duration;
isNew = true;
}
// TODO: investigate why this goes wack if not set/re-set each time.
s.durationEstimate = s.duration;
time = (s._a.currentTime * msecScale || 0);
if(time !== lastHTML5State.time) {
lastHTML5State.time = time;
isNew = true;
}
if(isNew || bForce) {
s._whileplaying(time, x, x, x, x);
}
}
/* else {
// sm2._wD('_onTimer: Warn for "'+s.id+'": '+(!s._a?'Could not find element. ':'')+(s.playState === 0?'playState bad, 0?':'playState = '+s.playState+', OK'));
return false;
}*/
return isNew;
}
};
this._get_html5_duration = function() {
var instanceOptions = s._iO,
// if audio object exists, use its duration - else, instance option duration (if provided - it's a hack, really, and should be retired) OR null
d = (s._a && s._a.duration ? s._a.duration * msecScale : (instanceOptions && instanceOptions.duration ? instanceOptions.duration : null)),
result = (d && !isNaN(d) && d !== Infinity ? d : null);
return result;
};
this._apply_loop = function(a, nLoops) {
/**
* boolean instead of "loop", for webkit? - spec says string. http://www.w3.org/TR/html-markup/audio.html#audio.attrs.loop
* note that loop is either off or infinite under HTML5, unlike Flash which allows arbitrary loop counts to be specified.
*/
// <d>
if(!a.loop && nLoops > 1) {
sm2._wD('Note: Native HTML5 looping is infinite.', 1);
}
// </d>
a.loop = (nLoops > 1 ? 'loop' : '');
};
this._setup_html5 = function(oOptions) {
var instanceOptions = mixin(s._iO, oOptions),
a = useGlobalHTML5Audio ? globalHTML5Audio : s._a,
dURL = decodeURI(instanceOptions.url),
sameURL;
/**
* "First things first, I, Poppa..." (reset the previous state of the old sound, if playing)
* Fixes case with devices that can only play one sound at a time
* Otherwise, other sounds in mid-play will be terminated without warning and in a stuck state
*/
if(useGlobalHTML5Audio) {
if(dURL === decodeURI(lastGlobalHTML5URL)) {
// global HTML5 audio: re-use of URL
sameURL = true;
}
} else if(dURL === decodeURI(lastURL)) {
// options URL is the same as the "last" URL, and we used (loaded) it
sameURL = true;
}
if(a) {
if(a._s) {
if(useGlobalHTML5Audio) {
if(a._s && a._s.playState && !sameURL) {
// global HTML5 audio case, and loading a new URL. stop the currently-playing one.
a._s.stop();
}
} else if(!useGlobalHTML5Audio && dURL === decodeURI(lastURL)) {
// non-global HTML5 reuse case: same url, ignore request
s._apply_loop(a, instanceOptions.loops);
return a;
}
}
if(!sameURL) {
// don't retain onPosition() stuff with new URLs.
if(lastURL) {
resetProperties(false);
}
// assign new HTML5 URL
a.src = instanceOptions.url;
s.url = instanceOptions.url;
lastURL = instanceOptions.url;
lastGlobalHTML5URL = instanceOptions.url;
a._called_load = false;
}
} else {
if(instanceOptions.autoLoad || instanceOptions.autoPlay) {
s._a = new Audio(instanceOptions.url);
s._a.load();
} else {
// null for stupid Opera 9.64 case
s._a = (isOpera && opera.version() < 10 ? new Audio(null) : new Audio());
}
// assign local reference
a = s._a;
a._called_load = false;
if(useGlobalHTML5Audio) {
globalHTML5Audio = a;
}
}
s.isHTML5 = true;
// store a ref on the track
s._a = a;
// store a ref on the audio
a._s = s;
add_html5_events();
s._apply_loop(a, instanceOptions.loops);
if(instanceOptions.autoLoad || instanceOptions.autoPlay) {
s.load();
} else {
// early HTML5 implementation (non-standard)
a.autobuffer = false;
// standard ('none' is also an option.)
a.preload = 'auto';
}
return a;
};
add_html5_events = function() {
if(s._a._added_events) {
return false;
}
var f;
function add(oEvt, oFn, bCapture) {
return s._a ? s._a.addEventListener(oEvt, oFn, bCapture || false) : null;
}
s._a._added_events = true;
for(f in html5_events) {
if(html5_events.hasOwnProperty(f)) {
add(f, html5_events[f]);
}
}
return true;
};
remove_html5_events = function() {
// Remove event listeners
var f;
function remove(oEvt, oFn, bCapture) {
return(s._a ? s._a.removeEventListener(oEvt, oFn, bCapture || false) : null);
}
sm2._wD(s.id + ': Removing event listeners');
s._a._added_events = false;
for(f in html5_events) {
if(html5_events.hasOwnProperty(f)) {
remove(f, html5_events[f]);
}
}
};
/**
* Pseudo-private event internals
* ------------------------------
*/
this._onload = function(nSuccess) {
var fN,
// check for duration to prevent false positives from flash 8 when loading from cache.
loadOK = !! nSuccess || (!s.isHTML5 && fV === 8 && s.duration);
// <d>
fN = s.id + ': ';
sm2._wD(fN + (loadOK ? 'onload()' : 'Failed to load / invalid sound?' + (!s.duration ? ' Zero-length duration reported.' : ' -') + ' (' + s.url + ')'), (loadOK ? 1 : 2));
if(!loadOK && !s.isHTML5) {
if(sm2.sandbox.noRemote === true) {
sm2._wD(fN + str('noNet'), 1);
}
if(sm2.sandbox.noLocal === true) {
sm2._wD(fN + str('noLocal'), 1);
}
}
// </d>
s.loaded = loadOK;
s.readyState = loadOK ? 3 : 2;
s._onbufferchange(0);
if(s._iO.onload) {
wrapCallback(s, function() {
s._iO.onload.apply(s, [loadOK]);
});
}
return true;
};
this._onbufferchange = function(nIsBuffering) {
if(s.playState === 0) {
// ignore if not playing
return false;
}
if((nIsBuffering && s.isBuffering) || (!nIsBuffering && !s.isBuffering)) {
return false;
}
s.isBuffering = (nIsBuffering === 1);
if(s._iO.onbufferchange) {
sm2._wD(s.id + ': Buffer state change: ' + nIsBuffering);
s._iO.onbufferchange.apply(s, [nIsBuffering]);
}
return true;
};
/**
* Playback may have stopped due to buffering, or related reason.
* This state can be encountered on iOS < 6 when auto-play is blocked.
*/
this._onsuspend = function() {
if(s._iO.onsuspend) {
sm2._wD(s.id + ': Playback suspended');
s._iO.onsuspend.apply(s);
}
return true;
};
/**
* flash 9/movieStar + RTMP-only method, should fire only once at most
* at this point we just recreate failed sounds rather than trying to reconnect
*/
this._onfailure = function(msg, level, code) {
s.failures++;
sm2._wD(s.id + ': Failure (' + s.failures + '): ' + msg);
if(s._iO.onfailure && s.failures === 1) {
s._iO.onfailure(msg, level, code);
} else {
sm2._wD(s.id + ': Ignoring failure');
}
};
/**
* flash 9/movieStar + RTMP-only method for unhandled warnings/exceptions from Flash
* e.g., RTMP "method missing" warning (non-fatal) for getStreamLength on server
*/
this._onwarning = function(msg, level, code) {
if(s._iO.onwarning) {
s._iO.onwarning(msg, level, code);
}
};
this._onfinish = function() {
// store local copy before it gets trashed...
var io_onfinish = s._iO.onfinish;
s._onbufferchange(0);
s._resetOnPosition(0);
// reset some state items
if(s.instanceCount) {
s.instanceCount--;
if(!s.instanceCount) {
// remove onPosition listeners, if any
detachOnPosition();
// reset instance options
s.playState = 0;
s.paused = false;
s.instanceCount = 0;
s.instanceOptions = {};
s._iO = {};
stop_html5_timer();
// reset position, too
if(s.isHTML5) {
s.position = 0;
}
}
if(!s.instanceCount || s._iO.multiShotEvents) {
// fire onfinish for last, or every instance
if(io_onfinish) {
sm2._wD(s.id + ': onfinish()');
wrapCallback(s, function() {
io_onfinish.apply(s);
});
}
}
}
};
this._whileloading = function(nBytesLoaded, nBytesTotal, nDuration, nBufferLength) {
var instanceOptions = s._iO;
s.bytesLoaded = nBytesLoaded;
s.bytesTotal = nBytesTotal;
s.duration = Math.floor(nDuration);
s.bufferLength = nBufferLength;
if(!s.isHTML5 && !instanceOptions.isMovieStar) {
if(instanceOptions.duration) {
// use duration from options, if specified and larger. nobody should be specifying duration in options, actually, and it should be retired.
s.durationEstimate = (s.duration > instanceOptions.duration) ? s.duration : instanceOptions.duration;
} else {
s.durationEstimate = parseInt((s.bytesTotal / s.bytesLoaded) * s.duration, 10);
}
} else {
s.durationEstimate = s.duration;
}
// for flash, reflect sequential-load-style buffering
if(!s.isHTML5) {
s.buffered = [{
'start': 0,
'end': s.duration
}];
}
// allow whileloading to fire even if "load" fired under HTML5, due to HTTP range/partials
if((s.readyState !== 3 || s.isHTML5) && instanceOptions.whileloading) {
instanceOptions.whileloading.apply(s);
}
};
this._whileplaying = function(nPosition, oPeakData, oWaveformDataLeft, oWaveformDataRight, oEQData) {
var instanceOptions = s._iO,
eqLeft;
if(isNaN(nPosition) || nPosition === null) {
// flash safety net
return false;
}
// Safari HTML5 play() may return small -ve values when starting from position: 0, eg. -50.120396875. Unexpected/invalid per W3, I think. Normalize to 0.
s.position = Math.max(0, nPosition);
s._processOnPosition();
if(!s.isHTML5 && fV > 8) {
if(instanceOptions.usePeakData && oPeakData !== _undefined && oPeakData) {
s.peakData = {
left: oPeakData.leftPeak,
right: oPeakData.rightPeak
};
}
if(instanceOptions.useWaveformData && oWaveformDataLeft !== _undefined && oWaveformDataLeft) {
s.waveformData = {
left: oWaveformDataLeft.split(','),
right: oWaveformDataRight.split(',')
};
}
if(instanceOptions.useEQData) {
if(oEQData !== _undefined && oEQData && oEQData.leftEQ) {
eqLeft = oEQData.leftEQ.split(',');
s.eqData = eqLeft;
s.eqData.left = eqLeft;
if(oEQData.rightEQ !== _undefined && oEQData.rightEQ) {
s.eqData.right = oEQData.rightEQ.split(',');
}
}
}
}
if(s.playState === 1) {
// special case/hack: ensure buffering is false if loading from cache (and not yet started)
if(!s.isHTML5 && fV === 8 && !s.position && s.isBuffering) {
s._onbufferchange(0);
}
if(instanceOptions.whileplaying) {
// flash may call after actual finish
instanceOptions.whileplaying.apply(s);
}
}
return true;
};
this._oncaptiondata = function(oData) {
/**
* internal: flash 9 + NetStream (MovieStar/RTMP-only) feature
*
* @param {object} oData
*/
sm2._wD(s.id + ': Caption data received.');
s.captiondata = oData;
if(s._iO.oncaptiondata) {
s._iO.oncaptiondata.apply(s, [oData]);
}
};
this._onmetadata = function(oMDProps, oMDData) {
/**
* internal: flash 9 + NetStream (MovieStar/RTMP-only) feature
* RTMP may include song title, MovieStar content may include encoding info
*
* @param {array} oMDProps (names)
* @param {array} oMDData (values)
*/
sm2._wD(s.id + ': Metadata received.');
var oData = {}, i, j;
for(i = 0, j = oMDProps.length; i < j; i++) {
oData[oMDProps[i]] = oMDData[i];
}
s.metadata = oData;
console.log('updated metadata', s.metadata);
if(s._iO.onmetadata) {
s._iO.onmetadata.call(s, s.metadata);
}
};
this._onid3 = function(oID3Props, oID3Data) {
/**
* internal: flash 8 + flash 9 ID3 feature
* may include artist, song title etc.
*
* @param {array} oID3Props (names)
* @param {array} oID3Data (values)
*/
sm2._wD(s.id + ': ID3 data received.');
var oData = [],
i, j;
for(i = 0, j = oID3Props.length; i < j; i++) {
oData[oID3Props[i]] = oID3Data[i];
}
s.id3 = mixin(s.id3, oData);
if(s._iO.onid3) {
s._iO.onid3.apply(s);
}
};
// flash/RTMP-only
this._onconnect = function(bSuccess) {
bSuccess = (bSuccess === 1);
sm2._wD(s.id + ': ' + (bSuccess ? 'Connected.' : 'Failed to connect? - ' + s.url), (bSuccess ? 1 : 2));
s.connected = bSuccess;
if(bSuccess) {
s.failures = 0;
if(idCheck(s.id)) {
if(s.getAutoPlay()) {
// only update the play state if auto playing
s.play(_undefined, s.getAutoPlay());
} else if(s._iO.autoLoad) {
s.load();
}
}
if(s._iO.onconnect) {
s._iO.onconnect.apply(s, [bSuccess]);
}
}
};
this._ondataerror = function(sError) {
// flash 9 wave/eq data handler
// hack: called at start, and end from flash at/after onfinish()
if(s.playState > 0) {
sm2._wD(s.id + ': Data error: ' + sError);
if(s._iO.ondataerror) {
s._iO.ondataerror.apply(s);
}
}
};
// <d>
this._debug();
// </d>
}; // SMSound()
/**
* Private SoundManager internals
* ------------------------------
*/
getDocument = function() {
return(doc.body || doc.getElementsByTagName('div')[0]);
};
id = function(sID) {
return doc.getElementById(sID);
};
mixin = function(oMain, oAdd) {
// non-destructive merge
var o1 = (oMain || {}),
o2, o;
// if unspecified, o2 is the default options object
o2 = (oAdd === _undefined ? sm2.defaultOptions : oAdd);
for(o in o2) {
if(o2.hasOwnProperty(o) && o1[o] === _undefined) {
if(typeof o2[o] !== 'object' || o2[o] === null) {
// assign directly
o1[o] = o2[o];
} else {
// recurse through o2
o1[o] = mixin(o1[o], o2[o]);
}
}
}
return o1;
};
wrapCallback = function(oSound, callback) {
/**
* 03/03/2013: Fix for Flash Player 11.6.602.171 + Flash 8 (flashVersion = 8) SWF issue
* setTimeout() fix for certain SMSound callbacks like onload() and onfinish(), where subsequent calls like play() and load() fail when Flash Player 11.6.602.171 is installed, and using soundManager with flashVersion = 8 (which is the default).
* Not sure of exact cause. Suspect race condition and/or invalid (NaN-style) position argument trickling down to the next JS -> Flash _start() call, in the play() case.
* Fix: setTimeout() to yield, plus safer null / NaN checking on position argument provided to Flash.
* https://getsatisfaction.com/schillmania/topics/recent_chrome_update_seems_to_have_broken_my_sm2_audio_player
*/
if(!oSound.isHTML5 && fV === 8) {
window.setTimeout(callback, 0);
} else {
callback();
}
};
// additional soundManager properties that soundManager.setup() will accept
extraOptions = {
'onready': 1,
'ontimeout': 1,
'defaultOptions': 1,
'flash9Options': 1,
'movieStarOptions': 1
};
assign = function(o, oParent) {
/**
* recursive assignment of properties, soundManager.setup() helper
* allows property assignment based on whitelist
*/
var i,
result = true,
hasParent = (oParent !== _undefined),
setupOptions = sm2.setupOptions,
bonusOptions = extraOptions;
// <d>
// if soundManager.setup() called, show accepted parameters.
if(o === _undefined) {
result = [];
for(i in setupOptions) {
if(setupOptions.hasOwnProperty(i)) {
result.push(i);
}
}
for(i in bonusOptions) {
if(bonusOptions.hasOwnProperty(i)) {
if(typeof sm2[i] === 'object') {
result.push(i + ': {...}');
} else if(sm2[i] instanceof Function) {
result.push(i + ': function() {...}');
} else {
result.push(i);
}
}
}
sm2._wD(str('setup', result.join(', ')));
return false;
}
// </d>
for(i in o) {
if(o.hasOwnProperty(i)) {
// if not an {object} we want to recurse through...
if(typeof o[i] !== 'object' || o[i] === null || o[i] instanceof Array || o[i] instanceof RegExp) {
// check "allowed" options
if(hasParent && bonusOptions[oParent] !== _undefined) {
// valid recursive / nested object option, eg., { defaultOptions: { volume: 50 } }
sm2[oParent][i] = o[i];
} else if(setupOptions[i] !== _undefined) {
// special case: assign to setupOptions object, which soundManager property references
sm2.setupOptions[i] = o[i];
// assign directly to soundManager, too
sm2[i] = o[i];
} else if(bonusOptions[i] === _undefined) {
// invalid or disallowed parameter. complain.
complain(str((sm2[i] === _undefined ? 'setupUndef' : 'setupError'), i), 2);
result = false;
} else {
/**
* valid extraOptions (bonusOptions) parameter.
* is it a method, like onready/ontimeout? call it.
* multiple parameters should be in an array, eg. soundManager.setup({onready: [myHandler, myScope]});
*/
if(sm2[i] instanceof Function) {
sm2[i].apply(sm2, (o[i] instanceof Array ? o[i] : [o[i]]));
} else {
// good old-fashioned direct assignment
sm2[i] = o[i];
}
}
} else {
// recursion case, eg., { defaultOptions: { ... } }
if(bonusOptions[i] === _undefined) {
// invalid or disallowed parameter. complain.
complain(str((sm2[i] === _undefined ? 'setupUndef' : 'setupError'), i), 2);
result = false;
} else {
// recurse through object
return assign(o[i], i);
}
}
}
}
return result;
};
function preferFlashCheck(kind) {
// whether flash should play a given type
return(sm2.preferFlash && hasFlash && !sm2.ignoreFlash && (sm2.flash[kind] !== _undefined && sm2.flash[kind]));
}
/**
* Internal DOM2-level event helpers
* ---------------------------------
*/
event = (function() {
// normalize event methods
var old = (window.attachEvent),
evt = {
add: (old ? 'attachEvent' : 'addEventListener'),
remove: (old ? 'detachEvent' : 'removeEventListener')
};
// normalize "on" event prefix, optional capture argument
function getArgs(oArgs) {
var args = slice.call(oArgs),
len = args.length;
if(old) {
// prefix
args[1] = 'on' + args[1];
if(len > 3) {
// no capture
args.pop();
}
} else if(len === 3) {
args.push(false);
}
return args;
}
function apply(args, sType) {
// normalize and call the event method, with the proper arguments
var element = args.shift(),
method = [evt[sType]];
if(old) {
// old IE can't do apply().
element[method](args[0], args[1]);
} else {
element[method].apply(element, args);
}
}
function add() {
apply(getArgs(arguments), 'add');
}
function remove() {
apply(getArgs(arguments), 'remove');
}
return {
'add': add,
'remove': remove
};
}());
/**
* Internal HTML5 event handling
* -----------------------------
*/
function html5_event(oFn) {
// wrap html5 event handlers so we don't call them on destroyed and/or unloaded sounds
return function(e) {
var s = this._s,
result;
if(!s || !s._a) {
// <d>
if(s && s.id) {
sm2._wD(s.id + ': Ignoring ' + e.type);
} else {
sm2._wD(h5 + 'Ignoring ' + e.type);
}
// </d>
result = null;
} else {
result = oFn.call(this, e);
}
return result;
};
}
html5_events = {
// HTML5 event-name-to-handler map
abort: html5_event(function() {
sm2._wD(this._s.id + ': abort');
}),
// enough has loaded to play
canplay: html5_event(function() {
var s = this._s,
position1K;
if(s._html5_canplay) {
// this event has already fired. ignore.
return true;
}
s._html5_canplay = true;
sm2._wD(s.id + ': canplay');
s._onbufferchange(0);
// position according to instance options
position1K = (s._iO.position !== _undefined && !isNaN(s._iO.position) ? s._iO.position / msecScale : null);
// set the position if position was provided before the sound loaded
if(this.currentTime !== position1K) {
sm2._wD(s.id + ': canplay: Setting position to ' + position1K);
try {
this.currentTime = position1K;
} catch(ee) {
sm2._wD(s.id + ': canplay: Setting position of ' + position1K + ' failed: ' + ee.message, 2);
}
}
// hack for HTML5 from/to case
if(s._iO._oncanplay) {
s._iO._oncanplay();
}
}),
canplaythrough: html5_event(function() {
var s = this._s;
if(!s.loaded) {
s._onbufferchange(0);
s._whileloading(s.bytesLoaded, s.bytesTotal, s._get_html5_duration());
s._onload(true);
}
}),
durationchange: html5_event(function() {
// durationchange may fire at various times, probably the safest way to capture accurate/final duration.
var s = this._s,
duration;
duration = s._get_html5_duration();
if(!isNaN(duration) && duration !== s.duration) {
sm2._wD(this._s.id + ': durationchange (' + duration + ')' + (s.duration ? ', previously ' + s.duration : ''));
s.durationEstimate = s.duration = duration;
}
}),
// TODO: Reserved for potential use
/*
emptied: html5_event(function() {
sm2._wD(this._s.id + ': emptied');
}),
*/
ended: html5_event(function() {
var s = this._s;
sm2._wD(s.id + ': ended');
s._onfinish();
}),
error: html5_event(function() {
sm2._wD(this._s.id + ': HTML5 error, code ' + this.error.code);
/**
* HTML5 error codes, per W3C
* Error 1: Client aborted download at user's request.
* Error 2: Network error after load started.
* Error 3: Decoding issue.
* Error 4: Media (audio file) not supported.
* Reference: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#error-codes
*/
// call load with error state?
this._s._onload(false);
}),
loadeddata: html5_event(function() {
var s = this._s;
sm2._wD(s.id + ': loadeddata');
// safari seems to nicely report progress events, eventually totalling 100%
if(!s._loaded && !isSafari) {
s.duration = s._get_html5_duration();
}
}),
loadedmetadata: html5_event(function() {
sm2._wD(this._s.id + ': loadedmetadata');
}),
loadstart: html5_event(function() {
sm2._wD(this._s.id + ': loadstart');
// assume buffering at first
this._s._onbufferchange(1);
}),
play: html5_event(function() {
// sm2._wD(this._s.id + ': play()');
// once play starts, no buffering
this._s._onbufferchange(0);
}),
playing: html5_event(function() {
sm2._wD(this._s.id + ': playing ' + String.fromCharCode(9835));
// once play starts, no buffering
this._s._onbufferchange(0);
}),
progress: html5_event(function(e) {
// note: can fire repeatedly after "loaded" event, due to use of HTTP range/partials
var s = this._s,
i, j, progStr, buffered = 0,
isProgress = (e.type === 'progress'),
ranges = e.target.buffered,
// firefox 3.6 implements e.loaded/total (bytes)
loaded = (e.loaded || 0),
total = (e.total || 1);
// reset the "buffered" (loaded byte ranges) array
s.buffered = [];
if(ranges && ranges.length) {
// if loaded is 0, try TimeRanges implementation as % of load
// https://developer.mozilla.org/en/DOM/TimeRanges
// re-build "buffered" array
// HTML5 returns seconds. SM2 API uses msec for setPosition() etc., whether Flash or HTML5.
for(i = 0, j = ranges.length; i < j; i++) {
s.buffered.push({
'start': ranges.start(i) * msecScale,
'end': ranges.end(i) * msecScale
});
}
// use the last value locally
buffered = (ranges.end(0) - ranges.start(0)) * msecScale;
// linear case, buffer sum; does not account for seeking and HTTP partials / byte ranges
loaded = Math.min(1, buffered / (e.target.duration * msecScale));
// <d>
if(isProgress && ranges.length > 1) {
progStr = [];
j = ranges.length;
for(i = 0; i < j; i++) {
progStr.push(e.target.buffered.start(i) * msecScale + '-' + e.target.buffered.end(i) * msecScale);
}
sm2._wD(this._s.id + ': progress, timeRanges: ' + progStr.join(', '));
}
if(isProgress && !isNaN(loaded)) {
sm2._wD(this._s.id + ': progress, ' + Math.floor(loaded * 100) + '% loaded');
}
// </d>
}
if(!isNaN(loaded)) {
// TODO: prevent calls with duplicate values.
s._whileloading(loaded, total, s._get_html5_duration());
if(loaded && total && loaded === total) {
// in case "onload" doesn't fire (eg. gecko 1.9.2)
html5_events.canplaythrough.call(this, e);
}
}
}),
ratechange: html5_event(function() {
sm2._wD(this._s.id + ': ratechange');
}),
suspend: html5_event(function(e) {
// download paused/stopped, may have finished (eg. onload)
var s = this._s;
sm2._wD(this._s.id + ': suspend');
html5_events.progress.call(this, e);
s._onsuspend();
}),
stalled: html5_event(function() {
sm2._wD(this._s.id + ': stalled');
}),
timeupdate: html5_event(function() {
this._s._onTimer();
}),
waiting: html5_event(function() {
var s = this._s;
// see also: seeking
sm2._wD(this._s.id + ': waiting');
// playback faster than download rate, etc.
s._onbufferchange(1);
})
};
html5OK = function(iO) {
// playability test based on URL or MIME type
var result;
if(!iO || (!iO.type && !iO.url && !iO.serverURL)) {
// nothing to check
result = false;
} else if(iO.serverURL || (iO.type && preferFlashCheck(iO.type))) {
// RTMP, or preferring flash
result = false;
} else {
// Use type, if specified. Pass data: URIs to HTML5. If HTML5-only mode, no other options, so just give 'er
result = ((iO.type ? html5CanPlay({
type: iO.type
}) : html5CanPlay({
url: iO.url
}) || sm2.html5Only || iO.url.match(/data\:/i)));
}
return result;
};
html5Unload = function(oAudio) {
/**
* Internal method: Unload media, and cancel any current/pending network requests.
* Firefox can load an empty URL, which allegedly destroys the decoder and stops the download.
* https://developer.mozilla.org/En/Using_audio_and_video_in_Firefox#Stopping_the_download_of_media
* However, Firefox has been seen loading a relative URL from '' and thus requesting the hosting page on unload.
* Other UA behaviour is unclear, so everyone else gets an about:blank-style URL.
*/
var url;
if(oAudio) {
// Firefox and Chrome accept short WAVe data: URIs. Chome dislikes audio/wav, but accepts audio/wav for data: MIME.
// Desktop Safari complains / fails on data: URI, so it gets about:blank.
url = (isSafari ? emptyURL : (sm2.html5.canPlayType('audio/wav') ? emptyWAV : emptyURL));
oAudio.src = url;
// reset some state, too
if(oAudio._called_unload !== undefined) {
oAudio._called_load = false;
}
}
if(useGlobalHTML5Audio) {
// ensure URL state is trashed, also
lastGlobalHTML5URL = null;
}
return url;
};
html5CanPlay = function(o) {
/**
* Try to find MIME, test and return truthiness
* o = {
* url: '/path/to/an.mp3',
* type: 'audio/mp3'
* }
*/
if(!sm2.useHTML5Audio || !sm2.hasHTML5) {
return false;
}
var url = (o.url || null),
mime = (o.type || null),
aF = sm2.audioFormats,
result,
offset,
fileExt,
item;
// account for known cases like audio/mp3
if(mime && sm2.html5[mime] !== _undefined) {
return(sm2.html5[mime] && !preferFlashCheck(mime));
}
if(!html5Ext) {
html5Ext = [];
for(item in aF) {
if(aF.hasOwnProperty(item)) {
html5Ext.push(item);
if(aF[item].related) {
html5Ext = html5Ext.concat(aF[item].related);
}
}
}
html5Ext = new RegExp('\\.(' + html5Ext.join('|') + ')(\\?.*)?$', 'i');
}
// TODO: Strip URL queries, etc.
fileExt = (url ? url.toLowerCase().match(html5Ext) : null);
if(!fileExt || !fileExt.length) {
if(!mime) {
result = false;
} else {
// audio/mp3 -> mp3, result should be known
offset = mime.indexOf(';');
// strip "audio/X; codecs..."
fileExt = (offset !== -1 ? mime.substr(0, offset) : mime).substr(6);
}
} else {
// match the raw extension name - "mp3", for example
fileExt = fileExt[1];
}
if(fileExt && sm2.html5[fileExt] !== _undefined) {
// result known
result = (sm2.html5[fileExt] && !preferFlashCheck(fileExt));
} else {
mime = 'audio/' + fileExt;
result = sm2.html5.canPlayType({
type: mime
});
sm2.html5[fileExt] = result;
// sm2._wD('canPlayType, found result: ' + result);
result = (result && sm2.html5[mime] && !preferFlashCheck(mime));
}
return result;
};
testHTML5 = function() {
/**
* Internal: Iterates over audioFormats, determining support eg. audio/mp3, audio/mpeg and so on
* assigns results to html5[] and flash[].
*/
if(!sm2.useHTML5Audio || !sm2.hasHTML5) {
// without HTML5, we need Flash.
sm2.html5.usingFlash = true;
needsFlash = true;
return false;
}
// double-whammy: Opera 9.64 throws WRONG_ARGUMENTS_ERR if no parameter passed to Audio(), and Webkit + iOS happily tries to load "null" as a URL. :/
var a = (Audio !== _undefined ? (isOpera && opera.version() < 10 ? new Audio(null) : new Audio()) : null),
item, lookup, support = {}, aF, i;
function cp(m) {
var canPlay, j,
result = false,
isOK = false;
if(!a || typeof a.canPlayType !== 'function') {
return result;
}
if(m instanceof Array) {
// iterate through all mime types, return any successes
for(i = 0, j = m.length; i < j; i++) {
if(sm2.html5[m[i]] || a.canPlayType(m[i]).match(sm2.html5Test)) {
isOK = true;
sm2.html5[m[i]] = true;
// note flash support, too
sm2.flash[m[i]] = !! (m[i].match(flashMIME));
}
}
result = isOK;
} else {
canPlay = (a && typeof a.canPlayType === 'function' ? a.canPlayType(m) : false);
result = !! (canPlay && (canPlay.match(sm2.html5Test)));
}
return result;
}
// test all registered formats + codecs
aF = sm2.audioFormats;
for(item in aF) {
if(aF.hasOwnProperty(item)) {
lookup = 'audio/' + item;
support[item] = cp(aF[item].type);
// write back generic type too, eg. audio/mp3
support[lookup] = support[item];
// assign flash
if(item.match(flashMIME)) {
sm2.flash[item] = true;
sm2.flash[lookup] = true;
} else {
sm2.flash[item] = false;
sm2.flash[lookup] = false;
}
// assign result to related formats, too
if(aF[item] && aF[item].related) {
for(i = aF[item].related.length - 1; i >= 0; i--) {
// eg. audio/m4a
support['audio/' + aF[item].related[i]] = support[item];
sm2.html5[aF[item].related[i]] = support[item];
sm2.flash[aF[item].related[i]] = support[item];
}
}
}
}
support.canPlayType = (a ? cp : null);
sm2.html5 = mixin(sm2.html5, support);
sm2.html5.usingFlash = featureCheck();
needsFlash = sm2.html5.usingFlash;
return true;
};
strings = {
// <d>
notReady: 'Unavailable - wait until onready() has fired.',
notOK: 'Audio support is not available.',
domError: sm + 'exception caught while appending SWF to DOM.',
spcWmode: 'Removing wmode, preventing known SWF loading issue(s)',
swf404: smc + 'Verify that %s is a valid path.',
tryDebug: 'Try ' + sm + '.debugFlash = true for more security details (output goes to SWF.)',
checkSWF: 'See SWF output for more debug info.',
localFail: smc + 'Non-HTTP page (' + doc.location.protocol + ' URL?) Review Flash player security settings for this special case:\nhttp://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html\nMay need to add/allow path, eg. c:/sm2/ or /users/me/sm2/',
waitFocus: smc + 'Special case: Waiting for SWF to load with window focus...',
waitForever: smc + 'Waiting indefinitely for Flash (will recover if unblocked)...',
waitSWF: smc + 'Waiting for 100% SWF load...',
needFunction: smc + 'Function object expected for %s',
badID: 'Sound ID "%s" should be a string, starting with a non-numeric character',
currentObj: smc + '_debug(): Current sound objects',
waitOnload: smc + 'Waiting for window.onload()',
docLoaded: smc + 'Document already loaded',
onload: smc + 'initComplete(): calling soundManager.onload()',
onloadOK: sm + '.onload() complete',
didInit: smc + 'init(): Already called?',
secNote: 'Flash security note: Network/internet URLs will not load due to security restrictions. Access can be configured via Flash Player Global Security Settings Page: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html',
badRemove: smc + 'Failed to remove Flash node.',
shutdown: sm + '.disable(): Shutting down',
queue: smc + 'Queueing %s handler',
smError: 'SMSound.load(): Exception: JS-Flash communication failed, or JS error.',
fbTimeout: 'No flash response, applying .' + swfCSS.swfTimedout + ' CSS...',
fbLoaded: 'Flash loaded',
fbHandler: smc + 'flashBlockHandler()',
manURL: 'SMSound.load(): Using manually-assigned URL',
onURL: sm + '.load(): current URL already assigned.',
badFV: sm + '.flashVersion must be 8 or 9. "%s" is invalid. Reverting to %s.',
as2loop: 'Note: Setting stream:false so looping can work (flash 8 limitation)',
noNSLoop: 'Note: Looping not implemented for MovieStar formats',
needfl9: 'Note: Switching to flash 9, required for MP4 formats.',
mfTimeout: 'Setting flashLoadTimeout = 0 (infinite) for off-screen, mobile flash case',
needFlash: smc + 'Fatal error: Flash is needed to play some required formats, but is not available.',
gotFocus: smc + 'Got window focus.',
policy: 'Enabling usePolicyFile for data access',
setup: sm + '.setup(): allowed parameters: %s',
setupError: sm + '.setup(): "%s" cannot be assigned with this method.',
setupUndef: sm + '.setup(): Could not find option "%s"',
setupLate: sm + '.setup(): url, flashVersion and html5Test property changes will not take effect until reboot().',
noURL: smc + 'Flash URL required. Call soundManager.setup({url:...}) to get started.',
sm2Loaded: 'SoundManager 2: Ready. ' + String.fromCharCode(10003),
reset: sm + '.reset(): Removing event callbacks',
mobileUA: 'Mobile UA detected, preferring HTML5 by default.',
globalHTML5: 'Using singleton HTML5 Audio() pattern for this device.'
// </d>
};
str = function() {
// internal string replace helper.
// arguments: o [,items to replace]
// <d>
var args,
i, j, o,
sstr;
// real array, please
args = slice.call(arguments);
// first argument
o = args.shift();
sstr = (strings && strings[o] ? strings[o] : '');
if(sstr && args && args.length) {
for(i = 0, j = args.length; i < j; i++) {
sstr = sstr.replace('%s', args[i]);
}
}
return sstr;
// </d>
};
loopFix = function(sOpt) {
// flash 8 requires stream = false for looping to work
if(fV === 8 && sOpt.loops > 1 && sOpt.stream) {
_wDS('as2loop');
sOpt.stream = false;
}
return sOpt;
};
policyFix = function(sOpt, sPre) {
if(sOpt && !sOpt.usePolicyFile && (sOpt.onid3 || sOpt.usePeakData || sOpt.useWaveformData || sOpt.useEQData)) {
sm2._wD((sPre || '') + str('policy'));
sOpt.usePolicyFile = true;
}
return sOpt;
};
complain = function(sMsg) {
// <d>
if(hasConsole && console.warn !== _undefined) {
console.warn(sMsg);
} else {
sm2._wD(sMsg);
}
// </d>
};
doNothing = function() {
return false;
};
disableObject = function(o) {
var oProp;
for(oProp in o) {
if(o.hasOwnProperty(oProp) && typeof o[oProp] === 'function') {
o[oProp] = doNothing;
}
}
oProp = null;
};
failSafely = function(bNoDisable) {
// general failure exception handler
if(bNoDisable === _undefined) {
bNoDisable = false;
}
if(disabled || bNoDisable) {
sm2.disable(bNoDisable);
}
};
normalizeMovieURL = function(smURL) {
var urlParams = null,
url;
if(smURL) {
if(smURL.match(/\.swf(\?.*)?$/i)) {
urlParams = smURL.substr(smURL.toLowerCase().lastIndexOf('.swf?') + 4);
if(urlParams) {
// assume user knows what they're doing
return smURL;
}
} else if(smURL.lastIndexOf('/') !== smURL.length - 1) {
// append trailing slash, if needed
smURL += '/';
}
}
url = (smURL && smURL.lastIndexOf('/') !== -1 ? smURL.substr(0, smURL.lastIndexOf('/') + 1) : './') + sm2.movieURL;
if(sm2.noSWFCache) {
url += ('?ts=' + new Date().getTime());
}
return url;
};
setVersionInfo = function() {
// short-hand for internal use
fV = parseInt(sm2.flashVersion, 10);
if(fV !== 8 && fV !== 9) {
sm2._wD(str('badFV', fV, defaultFlashVersion));
sm2.flashVersion = fV = defaultFlashVersion;
}
// debug flash movie, if applicable
var isDebug = (sm2.debugMode || sm2.debugFlash ? '_debug.swf' : '.swf');
if(sm2.useHTML5Audio && !sm2.html5Only && sm2.audioFormats.mp4.required && fV < 9) {
sm2._wD(str('needfl9'));
sm2.flashVersion = fV = 9;
}
sm2.version = sm2.versionNumber + (sm2.html5Only ? ' (HTML5-only mode)' : (fV === 9 ? ' (AS3/Flash 9)' : ' (AS2/Flash 8)'));
// set up default options
if(fV > 8) {
// +flash 9 base options
sm2.defaultOptions = mixin(sm2.defaultOptions, sm2.flash9Options);
sm2.features.buffering = true;
// +moviestar support
sm2.defaultOptions = mixin(sm2.defaultOptions, sm2.movieStarOptions);
sm2.filePatterns.flash9 = new RegExp('\\.(mp3|' + netStreamTypes.join('|') + ')(\\?.*)?$', 'i');
sm2.features.movieStar = true;
} else {
sm2.features.movieStar = false;
}
// regExp for flash canPlay(), etc.
sm2.filePattern = sm2.filePatterns[(fV !== 8 ? 'flash9' : 'flash8')];
// if applicable, use _debug versions of SWFs
sm2.movieURL = (fV === 8 ? 'soundmanager2.swf' : 'soundmanager2_flash9.swf').replace('.swf', isDebug);
sm2.features.peakData = sm2.features.waveformData = sm2.features.eqData = (fV > 8);
};
setPolling = function(bPolling, bHighPerformance) {
if(!flash) {
return false;
}
flash._setPolling(bPolling, bHighPerformance);
};
initDebug = function() {
// starts debug mode, creating output <div> for UAs without console object
// allow force of debug mode via URL
// <d>
if(sm2.debugURLParam.test(wl)) {
sm2.debugMode = true;
}
if(id(sm2.debugID)) {
return false;
}
var oD, oDebug, oTarget, oToggle, tmp;
if(sm2.debugMode && !id(sm2.debugID) && (!hasConsole || !sm2.useConsole || !sm2.consoleOnly)) {
oD = doc.createElement('div');
oD.id = sm2.debugID + '-toggle';
oToggle = {
'position': 'fixed',
'bottom': '0px',
'right': '0px',
'width': '1.2em',
'height': '1.2em',
'lineHeight': '1.2em',
'margin': '2px',
'textAlign': 'center',
'border': '1px solid #999',
'cursor': 'pointer',
'background': '#fff',
'color': '#333',
'zIndex': 10001
};
oD.appendChild(doc.createTextNode('-'));
oD.onclick = toggleDebug;
oD.title = 'Toggle SM2 debug console';
if(ua.match(/msie 6/i)) {
oD.style.position = 'absolute';
oD.style.cursor = 'hand';
}
for(tmp in oToggle) {
if(oToggle.hasOwnProperty(tmp)) {
oD.style[tmp] = oToggle[tmp];
}
}
oDebug = doc.createElement('div');
oDebug.id = sm2.debugID;
oDebug.style.display = (sm2.debugMode ? 'block' : 'none');
if(sm2.debugMode && !id(oD.id)) {
try {
oTarget = getDocument();
oTarget.appendChild(oD);
} catch(e2) {
throw new Error(str('domError') + ' \n' + e2.toString());
}
oTarget.appendChild(oDebug);
}
}
oTarget = null;
// </d>
};
idCheck = this.getSoundById;
// <d>
_wDS = function(o, errorLevel) {
return(!o ? '' : sm2._wD(str(o), errorLevel));
};
toggleDebug = function() {
var o = id(sm2.debugID),
oT = id(sm2.debugID + '-toggle');
if(!o) {
return false;
}
if(debugOpen) {
// minimize
oT.innerHTML = '+';
o.style.display = 'none';
} else {
oT.innerHTML = '-';
o.style.display = 'block';
}
debugOpen = !debugOpen;
};
debugTS = function(sEventType, bSuccess, sMessage) {
// troubleshooter debug hooks
if(window.sm2Debugger !== _undefined) {
try {
sm2Debugger.handleEvent(sEventType, bSuccess, sMessage);
} catch(e) {
// oh well
return false;
}
}
return true;
};
// </d>
getSWFCSS = function() {
var css = [];
if(sm2.debugMode) {
css.push(swfCSS.sm2Debug);
}
if(sm2.debugFlash) {
css.push(swfCSS.flashDebug);
}
if(sm2.useHighPerformance) {
css.push(swfCSS.highPerf);
}
return css.join(' ');
};
flashBlockHandler = function() {
// *possible* flash block situation.
var name = str('fbHandler'),
p = sm2.getMoviePercent(),
css = swfCSS,
error = {
type: 'FLASHBLOCK'
};
if(sm2.html5Only) {
// no flash, or unused
return false;
}
if(!sm2.ok()) {
if(needsFlash) {
// make the movie more visible, so user can fix
sm2.oMC.className = getSWFCSS() + ' ' + css.swfDefault + ' ' + (p === null ? css.swfTimedout : css.swfError);
sm2._wD(name + ': ' + str('fbTimeout') + (p ? ' (' + str('fbLoaded') + ')' : ''));
}
sm2.didFlashBlock = true;
// fire onready(), complain lightly
processOnEvents({
type: 'ontimeout',
ignoreInit: true,
error: error
});
catchError(error);
} else {
// SM2 loaded OK (or recovered)
// <d>
if(sm2.didFlashBlock) {
sm2._wD(name + ': Unblocked');
}
// </d>
if(sm2.oMC) {
sm2.oMC.className = [getSWFCSS(), css.swfDefault, css.swfLoaded + (sm2.didFlashBlock ? ' ' + css.swfUnblocked : '')].join(' ');
}
}
};
addOnEvent = function(sType, oMethod, oScope) {
if(on_queue[sType] === _undefined) {
on_queue[sType] = [];
}
on_queue[sType].push({
'method': oMethod,
'scope': (oScope || null),
'fired': false
});
};
processOnEvents = function(oOptions) {
// if unspecified, assume OK/error
if(!oOptions) {
oOptions = {
type: (sm2.ok() ? 'onready' : 'ontimeout')
};
}
if(!didInit && oOptions && !oOptions.ignoreInit) {
// not ready yet.
return false;
}
if(oOptions.type === 'ontimeout' && (sm2.ok() || (disabled && !oOptions.ignoreInit))) {
// invalid case
return false;
}
var status = {
success: (oOptions && oOptions.ignoreInit ? sm2.ok() : !disabled)
},
// queue specified by type, or none
srcQueue = (oOptions && oOptions.type ? on_queue[oOptions.type] || [] : []),
queue = [],
i, j,
args = [status],
canRetry = (needsFlash && !sm2.ok());
if(oOptions.error) {
args[0].error = oOptions.error;
}
for(i = 0, j = srcQueue.length; i < j; i++) {
if(srcQueue[i].fired !== true) {
queue.push(srcQueue[i]);
}
}
if(queue.length) {
// sm2._wD(sm + ': Firing ' + queue.length + ' ' + oOptions.type + '() item' + (queue.length === 1 ? '' : 's'));
for(i = 0, j = queue.length; i < j; i++) {
if(queue[i].scope) {
queue[i].method.apply(queue[i].scope, args);
} else {
queue[i].method.apply(this, args);
}
if(!canRetry) {
// useFlashBlock and SWF timeout case doesn't count here.
queue[i].fired = true;
}
}
}
return true;
};
initUserOnload = function() {
window.setTimeout(function() {
if(sm2.useFlashBlock) {
flashBlockHandler();
}
processOnEvents();
// call user-defined "onload", scoped to window
if(typeof sm2.onload === 'function') {
_wDS('onload', 1);
sm2.onload.apply(window);
_wDS('onloadOK', 1);
}
if(sm2.waitForWindowLoad) {
event.add(window, 'load', initUserOnload);
}
}, 1);
};
detectFlash = function() {
// hat tip: Flash Detect library (BSD, (C) 2007) by Carl "DocYes" S. Yestrau - http://featureblend.com/javascript-flash-detection-library.html / http://featureblend.com/license.txt
if(hasFlash !== _undefined) {
// this work has already been done.
return hasFlash;
}
var hasPlugin = false,
n = navigator,
nP = n.plugins,
obj, type, types, AX = window.ActiveXObject;
if(nP && nP.length) {
type = 'application/x-shockwave-flash';
types = n.mimeTypes;
if(types && types[type] && types[type].enabledPlugin && types[type].enabledPlugin.description) {
hasPlugin = true;
}
} else if(AX !== _undefined && !ua.match(/MSAppHost/i)) {
// Windows 8 Store Apps (MSAppHost) are weird (compatibility?) and won't complain here, but will barf if Flash/ActiveX object is appended to the DOM.
try {
obj = new AX('ShockwaveFlash.ShockwaveFlash');
} catch(e) {
// oh well
obj = null;
}
hasPlugin = ( !! obj);
// cleanup, because it is ActiveX after all
obj = null;
}
hasFlash = hasPlugin;
return hasPlugin;
};
featureCheck = function() {
var flashNeeded,
item,
formats = sm2.audioFormats,
// iPhone <= 3.1 has broken HTML5 audio(), but firmware 3.2 (original iPad) + iOS4 works.
isSpecial = (is_iDevice && !! (ua.match(/os (1|2|3_0|3_1)\s/i)));
if(isSpecial) {
// has Audio(), but is broken; let it load links directly.
sm2.hasHTML5 = false;
// ignore flash case, however
sm2.html5Only = true;
// hide the SWF, if present
if(sm2.oMC) {
sm2.oMC.style.display = 'none';
}
} else {
if(sm2.useHTML5Audio) {
if(!sm2.html5 || !sm2.html5.canPlayType) {
sm2._wD('SoundManager: No HTML5 Audio() support detected.');
sm2.hasHTML5 = false;
}
// <d>
if(isBadSafari) {
sm2._wD(smc + 'Note: Buggy HTML5 Audio in Safari on this OS X release, see https://bugs.webkit.org/show_bug.cgi?id=32159 - ' + (!hasFlash ? ' would use flash fallback for MP3/MP4, but none detected.' : 'will use flash fallback for MP3/MP4, if available'), 1);
}
// </d>
}
}
if(sm2.useHTML5Audio && sm2.hasHTML5) {
// sort out whether flash is optional, required or can be ignored.
// innocent until proven guilty.
canIgnoreFlash = true;
for(item in formats) {
if(formats.hasOwnProperty(item)) {
if(formats[item].required) {
if(!sm2.html5.canPlayType(formats[item].type)) {
// 100% HTML5 mode is not possible.
canIgnoreFlash = false;
flashNeeded = true;
} else if(sm2.preferFlash && (sm2.flash[item] || sm2.flash[formats[item].type])) {
// flash may be required, or preferred for this format.
flashNeeded = true;
}
}
}
}
}
// sanity check...
if(sm2.ignoreFlash) {
flashNeeded = false;
canIgnoreFlash = true;
}
sm2.html5Only = (sm2.hasHTML5 && sm2.useHTML5Audio && !flashNeeded);
return(!sm2.html5Only);
};
parseURL = function(url) {
/**
* Internal: Finds and returns the first playable URL (or failing that, the first URL.)
* @param {string or array} url A single URL string, OR, an array of URL strings or {url:'/path/to/resource', type:'audio/mp3'} objects.
*/
var i, j, urlResult = 0,
result;
if(url instanceof Array) {
// find the first good one
for(i = 0, j = url.length; i < j; i++) {
if(url[i] instanceof Object) {
// MIME check
if(sm2.canPlayMIME(url[i].type)) {
urlResult = i;
break;
}
} else if(sm2.canPlayURL(url[i])) {
// URL string check
urlResult = i;
break;
}
}
// normalize to string
if(url[urlResult].url) {
url[urlResult] = url[urlResult].url;
}
result = url[urlResult];
} else {
// single URL case
result = url;
}
return result;
};
startTimer = function(oSound) {
/**
* attach a timer to this sound, and start an interval if needed
*/
if(!oSound._hasTimer) {
oSound._hasTimer = true;
if(!mobileHTML5 && sm2.html5PollingInterval) {
if(h5IntervalTimer === null && h5TimerCount === 0) {
h5IntervalTimer = setInterval(timerExecute, sm2.html5PollingInterval);
}
h5TimerCount++;
}
}
};
stopTimer = function(oSound) {
/**
* detach a timer
*/
if(oSound._hasTimer) {
oSound._hasTimer = false;
if(!mobileHTML5 && sm2.html5PollingInterval) {
// interval will stop itself at next execution.
h5TimerCount--;
}
}
};
timerExecute = function() {
/**
* manual polling for HTML5 progress events, ie., whileplaying() (can achieve greater precision than conservative default HTML5 interval)
*/
var i;
if(h5IntervalTimer !== null && !h5TimerCount) {
// no active timers, stop polling interval.
clearInterval(h5IntervalTimer);
h5IntervalTimer = null;
return false;
}
// check all HTML5 sounds with timers
for(i = sm2.soundIDs.length - 1; i >= 0; i--) {
if(sm2.sounds[sm2.soundIDs[i]].isHTML5 && sm2.sounds[sm2.soundIDs[i]]._hasTimer) {
sm2.sounds[sm2.soundIDs[i]]._onTimer();
}
}
};
catchError = function(options) {
options = (options !== _undefined ? options : {});
if(typeof sm2.onerror === 'function') {
sm2.onerror.apply(window, [{
type: (options.type !== _undefined ? options.type : null)
}]);
}
if(options.fatal !== _undefined && options.fatal) {
sm2.disable();
}
};
badSafariFix = function() {
// special case: "bad" Safari (OS X 10.3 - 10.7) must fall back to flash for MP3/MP4
if(!isBadSafari || !detectFlash()) {
// doesn't apply
return false;
}
var aF = sm2.audioFormats,
i, item;
for(item in aF) {
if(aF.hasOwnProperty(item)) {
if(item === 'mp3' || item === 'mp4') {
sm2._wD(sm + ': Using flash fallback for ' + item + ' format');
sm2.html5[item] = false;
// assign result to related formats, too
if(aF[item] && aF[item].related) {
for(i = aF[item].related.length - 1; i >= 0; i--) {
sm2.html5[aF[item].related[i]] = false;
}
}
}
}
}
};
/**
* Pseudo-private flash/ExternalInterface methods
* ----------------------------------------------
*/
this._setSandboxType = function(sandboxType) {
// <d>
var sb = sm2.sandbox;
sb.type = sandboxType;
sb.description = sb.types[(sb.types[sandboxType] !== _undefined ? sandboxType : 'unknown')];
if(sb.type === 'localWithFile') {
sb.noRemote = true;
sb.noLocal = false;
_wDS('secNote', 2);
} else if(sb.type === 'localWithNetwork') {
sb.noRemote = false;
sb.noLocal = true;
} else if(sb.type === 'localTrusted') {
sb.noRemote = false;
sb.noLocal = false;
}
// </d>
};
this._externalInterfaceOK = function(swfVersion) {
// flash callback confirming flash loaded, EI working etc.
// swfVersion: SWF build string
if(sm2.swfLoaded) {
return false;
}
var e;
debugTS('swf', true);
debugTS('flashtojs', true);
sm2.swfLoaded = true;
tryInitOnFocus = false;
if(isBadSafari) {
badSafariFix();
}
// complain if JS + SWF build/version strings don't match, excluding +DEV builds
// <d>
if(!swfVersion || swfVersion.replace(/\+dev/i, '') !== sm2.versionNumber.replace(/\+dev/i, '')) {
e = sm + ': Fatal: JavaScript file build "' + sm2.versionNumber + '" does not match Flash SWF build "' + swfVersion + '" at ' + sm2.url + '. Ensure both are up-to-date.';
// escape flash -> JS stack so this error fires in window.
setTimeout(function versionMismatch() {
throw new Error(e);
}, 0);
// exit, init will fail with timeout
return false;
}
// </d>
// IE needs a larger timeout
setTimeout(init, isIE ? 100 : 1);
};
/**
* Private initialization helpers
* ------------------------------
*/
createMovie = function(smID, smURL) {
if(didAppend && appendSuccess) {
// ignore if already succeeded
return false;
}
function initMsg() {
// <d>
var options = [],
title,
msg = [],
delimiter = ' + ';
title = 'SoundManager ' + sm2.version + (!sm2.html5Only && sm2.useHTML5Audio ? (sm2.hasHTML5 ? ' + HTML5 audio' : ', no HTML5 audio support') : '');
if(!sm2.html5Only) {
if(sm2.preferFlash) {
options.push('preferFlash');
}
if(sm2.useHighPerformance) {
options.push('useHighPerformance');
}
if(sm2.flashPollingInterval) {
options.push('flashPollingInterval (' + sm2.flashPollingInterval + 'ms)');
}
if(sm2.html5PollingInterval) {
options.push('html5PollingInterval (' + sm2.html5PollingInterval + 'ms)');
}
if(sm2.wmode) {
options.push('wmode (' + sm2.wmode + ')');
}
if(sm2.debugFlash) {
options.push('debugFlash');
}
if(sm2.useFlashBlock) {
options.push('flashBlock');
}
} else {
if(sm2.html5PollingInterval) {
options.push('html5PollingInterval (' + sm2.html5PollingInterval + 'ms)');
}
}
if(options.length) {
msg = msg.concat([options.join(delimiter)]);
}
sm2._wD(title + (msg.length ? delimiter + msg.join(', ') : ''), 1);
showSupport();
// </d>
}
if(sm2.html5Only) {
// 100% HTML5 mode
setVersionInfo();
initMsg();
sm2.oMC = id(sm2.movieID);
init();
// prevent multiple init attempts
didAppend = true;
appendSuccess = true;
return false;
}
// flash path
var remoteURL = (smURL || sm2.url),
localURL = (sm2.altURL || remoteURL),
swfTitle = 'JS/Flash audio component (SoundManager 2)',
oTarget = getDocument(),
extraClass = getSWFCSS(),
isRTL = null,
html = doc.getElementsByTagName('html')[0],
oEmbed, oMovie, tmp, movieHTML, oEl, s, x, sClass;
isRTL = (html && html.dir && html.dir.match(/rtl/i));
smID = (smID === _undefined ? sm2.id : smID);
function param(name, value) {
return '<param name="' + name + '" value="' + value + '" />';
}
// safety check for legacy (change to Flash 9 URL)
setVersionInfo();
sm2.url = normalizeMovieURL(overHTTP ? remoteURL : localURL);
smURL = sm2.url;
sm2.wmode = (!sm2.wmode && sm2.useHighPerformance ? 'transparent' : sm2.wmode);
if(sm2.wmode !== null && (ua.match(/msie 8/i) || (!isIE && !sm2.useHighPerformance)) && navigator.platform.match(/win32|win64/i)) {
/**
* extra-special case: movie doesn't load until scrolled into view when using wmode = anything but 'window' here
* does not apply when using high performance (position:fixed means on-screen), OR infinite flash load timeout
* wmode breaks IE 8 on Vista + Win7 too in some cases, as of January 2011 (?)
*/
messages.push(strings.spcWmode);
sm2.wmode = null;
}
oEmbed = {
'name': smID,
'id': smID,
'src': smURL,
'quality': 'high',
'allowScriptAccess': sm2.allowScriptAccess,
'bgcolor': sm2.bgColor,
'pluginspage': http + 'www.macromedia.com/go/getflashplayer',
'title': swfTitle,
'type': 'application/x-shockwave-flash',
'wmode': sm2.wmode,
// http://help.adobe.com/en_US/as3/mobile/WS4bebcd66a74275c36cfb8137124318eebc6-7ffd.html
'hasPriority': 'true'
};
if(sm2.debugFlash) {
oEmbed.FlashVars = 'debug=1';
}
if(!sm2.wmode) {
// don't write empty attribute
delete oEmbed.wmode;
}
if(isIE) {
// IE is "special".
oMovie = doc.createElement('div');
movieHTML = ['<object id="' + smID + '" data="' + smURL + '" type="' + oEmbed.type + '" title="' + oEmbed.title + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="' + http + 'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0">',
param('movie', smURL),
param('AllowScriptAccess', sm2.allowScriptAccess),
param('quality', oEmbed.quality), (sm2.wmode ? param('wmode', sm2.wmode) : ''),
param('bgcolor', sm2.bgColor),
param('hasPriority', 'true'), (sm2.debugFlash ? param('FlashVars', oEmbed.FlashVars) : ''), '</object>'
].join('');
} else {
oMovie = doc.createElement('embed');
for(tmp in oEmbed) {
if(oEmbed.hasOwnProperty(tmp)) {
oMovie.setAttribute(tmp, oEmbed[tmp]);
}
}
}
initDebug();
extraClass = getSWFCSS();
oTarget = getDocument();
if(oTarget) {
sm2.oMC = (id(sm2.movieID) || doc.createElement('div'));
if(!sm2.oMC.id) {
sm2.oMC.id = sm2.movieID;
sm2.oMC.className = swfCSS.swfDefault + ' ' + extraClass;
s = null;
oEl = null;
if(!sm2.useFlashBlock) {
if(sm2.useHighPerformance) {
// on-screen at all times
s = {
'position': 'fixed',
'width': '8px',
'height': '8px',
// >= 6px for flash to run fast, >= 8px to start up under Firefox/win32 in some cases. odd? yes.
'bottom': '0px',
'left': '0px',
'overflow': 'hidden'
};
} else {
// hide off-screen, lower priority
s = {
'position': 'absolute',
'width': '6px',
'height': '6px',
'top': '-9999px',
'left': '-9999px'
};
if(isRTL) {
s.left = Math.abs(parseInt(s.left, 10)) + 'px';
}
}
}
if(isWebkit) {
// soundcloud-reported render/crash fix, safari 5
sm2.oMC.style.zIndex = 10000;
}
if(!sm2.debugFlash) {
for(x in s) {
if(s.hasOwnProperty(x)) {
sm2.oMC.style[x] = s[x];
}
}
}
try {
if(!isIE) {
sm2.oMC.appendChild(oMovie);
}
oTarget.appendChild(sm2.oMC);
if(isIE) {
oEl = sm2.oMC.appendChild(doc.createElement('div'));
oEl.className = swfCSS.swfBox;
oEl.innerHTML = movieHTML;
}
appendSuccess = true;
} catch(e) {
throw new Error(str('domError') + ' \n' + e.toString());
}
} else {
// SM2 container is already in the document (eg. flashblock use case)
sClass = sm2.oMC.className;
sm2.oMC.className = (sClass ? sClass + ' ' : swfCSS.swfDefault) + (extraClass ? ' ' + extraClass : '');
sm2.oMC.appendChild(oMovie);
if(isIE) {
oEl = sm2.oMC.appendChild(doc.createElement('div'));
oEl.className = swfCSS.swfBox;
oEl.innerHTML = movieHTML;
}
appendSuccess = true;
}
}
didAppend = true;
initMsg();
// sm2._wD(sm + ': Trying to load ' + smURL + (!overHTTP && sm2.altURL ? ' (alternate URL)' : ''), 1);
return true;
};
initMovie = function() {
if(sm2.html5Only) {
createMovie();
return false;
}
// attempt to get, or create, movie (may already exist)
if(flash) {
return false;
}
if(!sm2.url) {
/**
* Something isn't right - we've reached init, but the soundManager url property has not been set.
* User has not called setup({url: ...}), or has not set soundManager.url (legacy use case) directly before init time.
* Notify and exit. If user calls setup() with a url: property, init will be restarted as in the deferred loading case.
*/
_wDS('noURL');
return false;
}
// inline markup case
flash = sm2.getMovie(sm2.id);
if(!flash) {
if(!oRemoved) {
// try to create
createMovie(sm2.id, sm2.url);
} else {
// try to re-append removed movie after reboot()
if(!isIE) {
sm2.oMC.appendChild(oRemoved);
} else {
sm2.oMC.innerHTML = oRemovedHTML;
}
oRemoved = null;
didAppend = true;
}
flash = sm2.getMovie(sm2.id);
}
if(typeof sm2.oninitmovie === 'function') {
setTimeout(sm2.oninitmovie, 1);
}
// <d>
flushMessages();
// </d>
return true;
};
delayWaitForEI = function() {
setTimeout(waitForEI, 1000);
};
rebootIntoHTML5 = function() {
// special case: try for a reboot with preferFlash: false, if 100% HTML5 mode is possible and useFlashBlock is not enabled.
window.setTimeout(function() {
complain(smc + 'useFlashBlock is false, 100% HTML5 mode is possible. Rebooting with preferFlash: false...');
sm2.setup({
preferFlash: false
}).reboot();
// if for some reason you want to detect this case, use an ontimeout() callback and look for html5Only and didFlashBlock == true.
sm2.didFlashBlock = true;
sm2.beginDelayedInit();
}, 1);
};
waitForEI = function() {
var p,
loadIncomplete = false;
if(!sm2.url) {
// No SWF url to load (noURL case) - exit for now. Will be retried when url is set.
return false;
}
if(waitingForEI) {
return false;
}
waitingForEI = true;
event.remove(window, 'load', delayWaitForEI);
if(hasFlash && tryInitOnFocus && !isFocused) {
// Safari won't load flash in background tabs, only when focused.
_wDS('waitFocus');
return false;
}
if(!didInit) {
p = sm2.getMoviePercent();
if(p > 0 && p < 100) {
loadIncomplete = true;
}
}
setTimeout(function() {
p = sm2.getMoviePercent();
if(loadIncomplete) {
// special case: if movie *partially* loaded, retry until it's 100% before assuming failure.
waitingForEI = false;
sm2._wD(str('waitSWF'));
window.setTimeout(delayWaitForEI, 1);
return false;
}
// <d>
if(!didInit) {
sm2._wD(sm + ': No Flash response within expected time. Likely causes: ' + (p === 0 ? 'SWF load failed, ' : '') + 'Flash blocked or JS-Flash security error.' + (sm2.debugFlash ? ' ' + str('checkSWF') : ''), 2);
if(!overHTTP && p) {
_wDS('localFail', 2);
if(!sm2.debugFlash) {
_wDS('tryDebug', 2);
}
}
if(p === 0) {
// if 0 (not null), probably a 404.
sm2._wD(str('swf404', sm2.url), 1);
}
debugTS('flashtojs', false, ': Timed out' + overHTTP ? ' (Check flash security or flash blockers)' : ' (No plugin/missing SWF?)');
}
// </d>
// give up / time-out, depending
if(!didInit && okToDisable) {
if(p === null) {
// SWF failed to report load progress. Possibly blocked.
if(sm2.useFlashBlock || sm2.flashLoadTimeout === 0) {
if(sm2.useFlashBlock) {
flashBlockHandler();
}
_wDS('waitForever');
} else {
// no custom flash block handling, but SWF has timed out. Will recover if user unblocks / allows SWF load.
if(!sm2.useFlashBlock && canIgnoreFlash) {
rebootIntoHTML5();
} else {
_wDS('waitForever');
// fire any regular registered ontimeout() listeners.
processOnEvents({
type: 'ontimeout',
ignoreInit: true,
error: {
type: 'INIT_FLASHBLOCK'
}
});
}
}
} else {
// SWF loaded? Shouldn't be a blocking issue, then.
if(sm2.flashLoadTimeout === 0) {
_wDS('waitForever');
} else {
if(!sm2.useFlashBlock && canIgnoreFlash) {
rebootIntoHTML5();
} else {
failSafely(true);
}
}
}
}
}, sm2.flashLoadTimeout);
};
handleFocus = function() {
function cleanup() {
event.remove(window, 'focus', handleFocus);
}
if(isFocused || !tryInitOnFocus) {
// already focused, or not special Safari background tab case
cleanup();
return true;
}
okToDisable = true;
isFocused = true;
_wDS('gotFocus');
// allow init to restart
waitingForEI = false;
// kick off ExternalInterface timeout, now that the SWF has started
delayWaitForEI();
cleanup();
return true;
};
flushMessages = function() {
// <d>
// SM2 pre-init debug messages
if(messages.length) {
sm2._wD('SoundManager 2: ' + messages.join(' '), 1);
messages = [];
}
// </d>
};
showSupport = function() {
// <d>
flushMessages();
var item, tests = [];
if(sm2.useHTML5Audio && sm2.hasHTML5) {
for(item in sm2.audioFormats) {
if(sm2.audioFormats.hasOwnProperty(item)) {
tests.push(item + ' = ' + sm2.html5[item] + (!sm2.html5[item] && needsFlash && sm2.flash[item] ? ' (using flash)' : (sm2.preferFlash && sm2.flash[item] && needsFlash ? ' (preferring flash)' : (!sm2.html5[item] ? ' (' + (sm2.audioFormats[item].required ? 'required, ' : '') + 'and no flash support)' : ''))));
}
}
sm2._wD('SoundManager 2 HTML5 support: ' + tests.join(', '), 1);
}
// </d>
};
initComplete = function(bNoDisable) {
if(didInit) {
return false;
}
if(sm2.html5Only) {
// all good.
_wDS('sm2Loaded', 1);
didInit = true;
initUserOnload();
debugTS('onload', true);
return true;
}
var wasTimeout = (sm2.useFlashBlock && sm2.flashLoadTimeout && !sm2.getMoviePercent()),
result = true,
error;
if(!wasTimeout) {
didInit = true;
}
error = {
type: (!hasFlash && needsFlash ? 'NO_FLASH' : 'INIT_TIMEOUT')
};
sm2._wD('SoundManager 2 ' + (disabled ? 'failed to load' : 'loaded') + ' (' + (disabled ? 'Flash security/load error' : 'OK') + ') ' + String.fromCharCode(disabled ? 10006 : 10003), disabled ? 2 : 1);
if(disabled || bNoDisable) {
if(sm2.useFlashBlock && sm2.oMC) {
sm2.oMC.className = getSWFCSS() + ' ' + (sm2.getMoviePercent() === null ? swfCSS.swfTimedout : swfCSS.swfError);
}
processOnEvents({
type: 'ontimeout',
error: error,
ignoreInit: true
});
debugTS('onload', false);
catchError(error);
result = false;
} else {
debugTS('onload', true);
}
if(!disabled) {
if(sm2.waitForWindowLoad && !windowLoaded) {
_wDS('waitOnload');
event.add(window, 'load', initUserOnload);
} else {
// <d>
if(sm2.waitForWindowLoad && windowLoaded) {
_wDS('docLoaded');
}
// </d>
initUserOnload();
}
}
return result;
};
/**
* apply top-level setupOptions object as local properties, eg., this.setupOptions.flashVersion -> this.flashVersion (soundManager.flashVersion)
* this maintains backward compatibility, and allows properties to be defined separately for use by soundManager.setup().
*/
setProperties = function() {
var i,
o = sm2.setupOptions;
for(i in o) {
if(o.hasOwnProperty(i)) {
// assign local property if not already defined
if(sm2[i] === _undefined) {
sm2[i] = o[i];
} else if(sm2[i] !== o[i]) {
// legacy support: write manually-assigned property (eg., soundManager.url) back to setupOptions to keep things in sync
sm2.setupOptions[i] = sm2[i];
}
}
}
};
init = function() {
// called after onload()
if(didInit) {
_wDS('didInit');
return false;
}
function cleanup() {
event.remove(window, 'load', sm2.beginDelayedInit);
}
if(sm2.html5Only) {
if(!didInit) {
// we don't need no steenking flash!
cleanup();
sm2.enabled = true;
initComplete();
}
return true;
}
// flash path
initMovie();
try {
// attempt to talk to Flash
flash._externalInterfaceTest(false);
// apply user-specified polling interval, OR, if "high performance" set, faster vs. default polling
// (determines frequency of whileloading/whileplaying callbacks, effectively driving UI framerates)
setPolling(true, (sm2.flashPollingInterval || (sm2.useHighPerformance ? 10 : 50)));
if(!sm2.debugMode) {
// stop the SWF from making debug output calls to JS
flash._disableDebug();
}
sm2.enabled = true;
debugTS('jstoflash', true);
if(!sm2.html5Only) {
// prevent browser from showing cached page state (or rather, restoring "suspended" page state) via back button, because flash may be dead
// http://www.webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/
event.add(window, 'unload', doNothing);
}
} catch(e) {
sm2._wD('js/flash exception: ' + e.toString());
debugTS('jstoflash', false);
catchError({
type: 'JS_TO_FLASH_EXCEPTION',
fatal: true
});
// don't disable, for reboot()
failSafely(true);
initComplete();
return false;
}
initComplete();
// disconnect events
cleanup();
return true;
};
domContentLoaded = function() {
if(didDCLoaded) {
return false;
}
didDCLoaded = true;
// assign top-level soundManager properties eg. soundManager.url
setProperties();
initDebug();
/**
* Temporary feature: allow force of HTML5 via URL params: sm2-usehtml5audio=0 or 1
* Ditto for sm2-preferFlash, too.
*/
// <d>
(function() {
var a = 'sm2-usehtml5audio=',
a2 = 'sm2-preferflash=',
b = null,
b2 = null,
l = wl.toLowerCase();
if(l.indexOf(a) !== -1) {
b = (l.charAt(l.indexOf(a) + a.length) === '1');
if(hasConsole) {
console.log((b ? 'Enabling ' : 'Disabling ') + 'useHTML5Audio via URL parameter');
}
sm2.setup({
'useHTML5Audio': b
});
}
if(l.indexOf(a2) !== -1) {
b2 = (l.charAt(l.indexOf(a2) + a2.length) === '1');
if(hasConsole) {
console.log((b2 ? 'Enabling ' : 'Disabling ') + 'preferFlash via URL parameter');
}
sm2.setup({
'preferFlash': b2
});
}
}());
// </d>
if(!hasFlash && sm2.hasHTML5) {
sm2._wD('SoundManager 2: No Flash detected' + (!sm2.useHTML5Audio ? ', enabling HTML5.' : '. Trying HTML5-only mode.'), 1);
sm2.setup({
'useHTML5Audio': true,
// make sure we aren't preferring flash, either
// TODO: preferFlash should not matter if flash is not installed. Currently, stuff breaks without the below tweak.
'preferFlash': false
});
}
testHTML5();
if(!hasFlash && needsFlash) {
messages.push(strings.needFlash);
// TODO: Fatal here vs. timeout approach, etc.
// hack: fail sooner.
sm2.setup({
'flashLoadTimeout': 1
});
}
if(doc.removeEventListener) {
doc.removeEventListener('DOMContentLoaded', domContentLoaded, false);
}
initMovie();
return true;
};
domContentLoadedIE = function() {
if(doc.readyState === 'complete') {
domContentLoaded();
doc.detachEvent('onreadystatechange', domContentLoadedIE);
}
return true;
};
winOnLoad = function() {
// catch edge case of initComplete() firing after window.load()
windowLoaded = true;
// catch case where DOMContentLoaded has been sent, but we're still in doc.readyState = 'interactive'
domContentLoaded();
event.remove(window, 'load', winOnLoad);
};
/**
* miscellaneous run-time, pre-init stuff
*/
preInit = function() {
if(mobileHTML5) {
// prefer HTML5 for mobile + tablet-like devices, probably more reliable vs. flash at this point.
// <d>
if(!sm2.setupOptions.useHTML5Audio || sm2.setupOptions.preferFlash) {
// notify that defaults are being changed.
messages.push(strings.mobileUA);
}
// </d>
sm2.setupOptions.useHTML5Audio = true;
sm2.setupOptions.preferFlash = false;
if(is_iDevice || (isAndroid && !ua.match(/android\s2\.3/i))) {
// iOS and Android devices tend to work better with a single audio instance, specifically for chained playback of sounds in sequence.
// common use case: exiting sound onfinish() -> createSound() -> play()
// <d>
messages.push(strings.globalHTML5);
// </d>
if(is_iDevice) {
sm2.ignoreFlash = true;
}
useGlobalHTML5Audio = true;
}
}
};
preInit();
// sniff up-front
detectFlash();
// focus and window load, init (primarily flash-driven)
event.add(window, 'focus', handleFocus);
event.add(window, 'load', delayWaitForEI);
event.add(window, 'load', winOnLoad);
if(doc.addEventListener) {
doc.addEventListener('DOMContentLoaded', domContentLoaded, false);
} else if(doc.attachEvent) {
doc.attachEvent('onreadystatechange', domContentLoadedIE);
} else {
// no add/attachevent support - safe to assume no JS -> Flash either
debugTS('onload', false);
catchError({
type: 'NO_DOM2_EVENTS',
fatal: true
});
}
} // SoundManager()
// SM2_DEFER details: http://www.schillmania.com/projects/soundmanager2/doc/getstarted/#lazy-loading
if(window.SM2_DEFER === undefined || !SM2_DEFER) {
soundManager = new SoundManager();
}
/**
* SoundManager public interfaces
* ------------------------------
*/
if(typeof module === 'object' && module && typeof module.exports === 'object') {
/**
* commonJS module
* note: SM2 requires a window global due to Flash, which makes calls to window.soundManager.
* flash may not always be needed, but this is not known until async init and SM2 may even "reboot" into Flash mode.
*/
window.soundManager = soundManager;
module.exports.SoundManager = SoundManager;
module.exports.soundManager = soundManager;
} else if(typeof define === 'function' && define.amd) {
// AMD - requireJS
define('SoundManager', [], function() {
return {
SoundManager: SoundManager,
soundManager: soundManager
};
});
} else {
// standard browser case
window.SoundManager = SoundManager; // constructor
window.soundManager = soundManager; // public API, flash callbacks etc.
}
}(window));
var ngSoundManager = angular.module('angularSoundManager', [])
.config(['$logProvider', function($logProvider){
$logProvider.debugEnabled(false);
}]);
ngSoundManager.filter('humanTime', function () {
return function (input) {
function pad(d) {
return (d < 10) ? '0' + d.toString() : d.toString();
}
var min = (input / 1000 / 60) << 0,
sec = Math.floor((input / 1000) % 60);
return pad(min) + ':' + pad(sec);
};
});
ngSoundManager.factory('angularPlayer', ['$rootScope', '$log',
function($rootScope, $log) {
var currentTrack = null,
repeat = false,
autoPlay = true,
isPlaying = false,
volume = 90,
trackProgress = 0,
playlist = [],
shuffle = false,
repeatOne = false,
shufflelist= [],
shuffleCount = 0,
shuffleIndex = -1,
bootstrapTrack = null;
return {
/**
* Initialize soundmanager,
* requires soundmanager2 to be loaded first
*/
init: function() {
if(typeof soundManager === 'undefined') {
alert('Please include SoundManager2 Library!');
}
soundManager.setup({
//url: '/path/to/swfs/',
//flashVersion: 9,
preferFlash: false, // prefer 100% HTML5 mode, where both supported
debugMode: false, // enable debugging output ($log.debug() with HTML fallback)
useHTML5Audio: true,
onready: function() {
//$log.debug('sound manager ready!');
},
ontimeout: function() {
alert('SM2 failed to start. Flash missing, blocked or security error?');
alert('The status is ' + status.success + ', the error type is ' + status.error.type);
},
defaultOptions: {
// set global default volume for all sound objects
autoLoad: false, // enable automatic loading (otherwise .load() will call with .play())
autoPlay: false, // enable playing of file ASAP (much faster if "stream" is true)
from: null, // position to start playback within a sound (msec), see demo
loops: 1, // number of times to play the sound. Related: looping (API demo)
multiShot: false, // let sounds "restart" or "chorus" when played multiple times..
multiShotEvents: false, // allow events (onfinish()) to fire for each shot, if supported.
onid3: null, // callback function for "ID3 data is added/available"
onload: null, // callback function for "load finished"
onstop: null, // callback for "user stop"
onfailure: 'nextTrack', // callback function for when playing fails
onpause: null, // callback for "pause"
onplay: null, // callback for "play" start
onresume: null, // callback for "resume" (pause toggle)
position: null, // offset (milliseconds) to seek to within downloaded sound.
pan: 0, // "pan" settings, left-to-right, -100 to 100
stream: true, // allows playing before entire file has loaded (recommended)
to: null, // position to end playback within a sound (msec), see demo
type: 'audio/mp3', // MIME-like hint for canPlay() tests, eg. 'audio/mp3'
usePolicyFile: false, // enable crossdomain.xml request for remote domains (for ID3/waveform access)
volume: volume, // self-explanatory. 0-100, the latter being the max.
whileloading: function() {
//soundManager._writeDebug('sound '+this.id+' loading, '+this.bytesLoaded+' of '+this.bytesTotal);
var trackLoaded = ((this.bytesLoaded/this.bytesTotal)*100);
$rootScope.$broadcast('track:loaded', trackLoaded);
},
whileplaying: function() {
//soundManager._writeDebug('sound '+this.id+' playing, '+this.position+' of '+this.duration);
//broadcast current playing track id
currentTrack = this.id;
//$rootScope.$broadcast('track:id', this.id);
//broadcast current playing track progress
trackProgress = ((this.position / this.duration) * 100);
$rootScope.$broadcast('track:progress', trackProgress);
//broadcast track position
$rootScope.$broadcast('currentTrack:position', this.position);
//broadcast track duration
$rootScope.$broadcast('currentTrack:duration', this.duration);
},
onfinish: function() {
soundManager._writeDebug(this.id + ' finished playing');
if(autoPlay === true) {
//play next track if autoplay is on
//get your angular app
var elem = angular.element(document.querySelector('[ng-app]'));
//get the injector.
var injector = elem.injector();
//get the service.
var angularPlayer = injector.get('angularPlayer');
// repeat current track
if(repeatOne === true) {
angularPlayer.playTrack(this.id);
} else {
angularPlayer.nextTrack();
}
$rootScope.$broadcast('track:id', currentTrack);
}
}
}
});
soundManager.onready(function() {
$log.debug('song manager ready!');
// Ready to use; soundManager.createSound() etc. can now be called.
var isSupported = soundManager.ok();
$log.debug('is supported: ' + isSupported);
$rootScope.$broadcast('angularPlayer:ready', true);
});
},
/**
* To check if value is in array
*/
isInArray: function(array, value) {
for(var i = 0; i < array.length; i++) {
if(array[i].id === value) {
return i;
}
}
return false;
},
/**
* getIndexByValue used by this factory
*/
getIndexByValue: function(array, value) {
for(var i = 0; i < array.length; i++) {
if(array[i] === value) {
return i;
}
}
return false;
},
/**
* asyncLoop used by this factory
*/
asyncLoop: function(o) {
var i = -1;
var loop = function() {
i++;
if(i == o.length) {
o.callback();
return;
}
o.functionToLoop(loop, i);
};
loop(); //init
},
setCurrentTrack: function(key) {
currentTrack = key;
},
getCurrentTrack: function() {
return currentTrack;
},
currentTrackData: function() {
var trackId = this.getCurrentTrack();
var currentKey = this.isInArray(playlist, trackId);
return playlist[currentKey];
},
getPlaylist: function(key) {
if(typeof key === 'undefined') {
return playlist;
} else {
return playlist[key];
}
},
getTrack: function(trackId) {
for (var i=0; i< playlist.length; i++) {
if (playlist[i].id == trackId) {
return playlist[i];
}
}
return null;
},
addToPlaylist: function(track) {
playlist.push(track);
//broadcast playlist
$rootScope.$broadcast('player:playlist', playlist);
},
isTrackValid: function (track) {
if (typeof track == 'undefined') {
$log.debug('invalid track data');
return false;
}
if (track.url.indexOf("soundcloud") > -1) {
//if soundcloud url
if(typeof track.url == 'undefined') {
$log.debug('invalid soundcloud track url');
return false;
}
} else {
if(soundManager.canPlayURL(track.url) !== true) {
$log.debug('invalid song url');
return false;
}
}
},
addTrack: function(track) {
//check if track itself is valid and if its url is playable
// disable track valid check because request url without
// proper extension name can be playable.
// if (!this.isTrackValid) {
// return null;
// }
//check if song already does not exists then add to playlist
var inArrayKey = this.isInArray(this.getPlaylist(), track.id);
if(inArrayKey === false) {
//$log.debug('song does not exists in playlist');
//add to sound manager
soundManager.createSound({
id: track.id,
url: track.url
});
shufflelist.push(track.id);
//add to playlist
this.addToPlaylist(track);
}
return track.id;
},
addTrackArray: function(trackArray) {
for(var i = 0; i < trackArray.length; i++) {
var track = trackArray[i];
//check if track itself is valid and if its url is playable
// if (!this.isTrackValid(track)) {
// console.log('track invalid');
// continue;
// }
//check if song already does not exists then add to playlist
var inArrayKey = this.isInArray(this.getPlaylist(), track.id);
if(inArrayKey === false) {
//$log.debug('song does not exists in playlist');
//add to sound manager
soundManager.createSound({
id: track.id,
url: track.url
});
shufflelist.push(track.id);
//add to playlist
playlist.push(track);
}
}
//broadcast playlist
$rootScope.$broadcast('player:playlist', playlist);
},
removeSong: function(song, index) {
//if this song is playing stop it
if(song === currentTrack) {
this.stop();
}
//unload from soundManager
soundManager.destroySound(song);
//remove from playlist
playlist.splice(index, 1);
//remove from shufflelist
var removeIndex = this.getIndexByValue(shufflelist, song);
shufflelist.splice(removeIndex, 1);
if (removeIndex <= shuffleIndex) {
shuffleIndex --;
}
if (removeIndex <= shuffleCount - 1 ) {
shuffleCount --;
}
//once all done then broadcast
$rootScope.$broadcast('player:playlist', playlist);
},
initPlayTrack: function(trackId, isResume, isloadOnly, successCallback, failCallback) {
if(isResume !== true) {
//stop and unload currently playing track
this.stop();
//set new track as current track
this.setCurrentTrack(trackId);
}
if ((bootstrapTrack != null) && (isResume !== true)) {
var angularPlayerObj = this;
var sound = soundManager.getSoundById(trackId);
sound.setVolume(volume);
bootstrapTrack(sound, this.currentTrackData(), function(){
soundManager.play(trackId);
$rootScope.$broadcast('track:id', trackId);
//set as playing
isPlaying = true;
$rootScope.$broadcast('music:isPlaying', isPlaying);
if (isloadOnly == true) {
angularPlayerObj.pause();
}
if(successCallback != undefined) {
successCallback();
}
}, function(){
if(failCallback != undefined) {
failCallback();
}
});
}
else {
soundManager.play(trackId);
$rootScope.$broadcast('track:id', trackId);
//set as playing
isPlaying = true;
$rootScope.$broadcast('music:isPlaying', isPlaying);
}
},
play: function() {
var trackToPlay = null;
//check if no track loaded, else play loaded track
if(this.getCurrentTrack() === null) {
if(soundManager.soundIDs.length === 0) {
$log.debug('playlist is empty!');
return;
}
trackToPlay = soundManager.soundIDs[0];
this.initPlayTrack(trackToPlay);
} else {
trackToPlay = this.getCurrentTrack();
this.initPlayTrack(trackToPlay, true);
}
},
pause: function() {
soundManager.pause(this.getCurrentTrack());
//set as not playing
isPlaying = false;
$rootScope.$broadcast('music:isPlaying', isPlaying);
},
stop: function() {
//first pause it
this.pause();
this.resetProgress();
$rootScope.$broadcast('track:progress', trackProgress);
$rootScope.$broadcast('currentTrack:position', 0);
$rootScope.$broadcast('currentTrack:duration', 0);
soundManager.stopAll();
soundManager.unload(this.getCurrentTrack());
},
loadTrack: function(trackId) {
// play track and pause at beginning
this.initPlayTrack(trackId, false, true);
},
playTrack: function(trackId) {
var player = this;
this.initPlayTrack(trackId, false, false, undefined, function(){player.nextTrack()});
},
playTrackFailToPrev: function(trackId) {
var player = this;
this.initPlayTrack(trackId, false, false, undefined, function(){player.prevTrack()});
},
nextTrack: function() {
if (shuffle) {
if (shuffleCount == 0) {
if (shufflelist.length == 0){
// initial shuffle related data
shufflelist = soundManager.soundIDs.slice();
}
// swap current song to first element
var index = this.getIndexByValue(shufflelist, this.getCurrentTrack());
var temp = shufflelist[index];
shufflelist[index] = shufflelist[shuffleCount];
shufflelist[shuffleCount] = temp;
shuffleIndex++;
shuffleCount++;
}
if (shuffleIndex + 1 < shuffleCount) {
shuffleIndex++;
this.playTrack(shufflelist[shuffleIndex]);
return;
}
// choose one song from [shuffleCount, shufflelist.length-1]
if (shuffleCount == shufflelist.length) {
shuffleCount = 0;
shuffleIndex = -1;
}
var index = shuffleCount + Math.floor(Math.random() * (shufflelist.length-shuffleCount));
// swap shuffle count and index
var temp = shufflelist[index];
shufflelist[index] = shufflelist[shuffleCount];
shufflelist[shuffleCount] = temp;
shuffleIndex++;
this.playTrack(shufflelist[shuffleIndex]);
shuffleCount++;
return;
}
if(this.getCurrentTrack() === null) {
$log.debug("Please click on Play before this action");
return null;
}
var currentTrackKey = this.getIndexByValue(soundManager.soundIDs, this.getCurrentTrack());
var nextTrackKey = +currentTrackKey + 1;
var nextTrackId = soundManager.soundIDs[nextTrackKey];
if(typeof nextTrackId !== 'undefined') {
this.playTrack(nextTrackId);
} else {
//if no next track found
if(repeat === true) {
//start first track if repeat is on
this.playTrack(soundManager.soundIDs[0]);
} else {
//breadcase not playing anything
isPlaying = false;
$rootScope.$broadcast('music:isPlaying', isPlaying);
}
}
},
prevTrack: function() {
if (shuffle) {
if (shuffleIndex <= 0){
// no prev found
return;
}
shuffleIndex--;
this.playTrackFailToPrev(shufflelist[shuffleIndex]);
return;
}
if(this.getCurrentTrack() === null) {
$log.debug("Please click on Play before this action");
return null;
}
var currentTrackKey = this.getIndexByValue(soundManager.soundIDs, this.getCurrentTrack());
var prevTrackKey = +currentTrackKey - 1;
var prevTrackId = soundManager.soundIDs[prevTrackKey];
if(typeof prevTrackId !== 'undefined') {
this.playTrackFailToPrev(prevTrackId);
} else {
$log.debug('no prev track found!');
}
},
mute: function() {
if(soundManager.muted === true) {
soundManager.unmute();
} else {
soundManager.mute();
}
$rootScope.$broadcast('music:mute', soundManager.muted);
},
getMuteStatus: function() {
return soundManager.muted;
},
repeatToggle: function() {
if(repeat === true) {
repeat = false;
} else {
repeat = true;
}
$rootScope.$broadcast('music:repeat', repeat);
},
getRepeatStatus: function() {
return repeat;
},
repeatOneToggle: function() {
if(repeatOne === true) {
repeatOne = false;
} else {
repeatOne = true;
}
},
getRepeatOneStatus: function() {
return repeatOne;
},
setRepeatOneStatus: function(value) {
repeatOne = value ;
},
getVolume: function() {
return volume;
},
adjustVolume: function(increase) {
var changeVolume = function(volume) {
for(var i = 0; i < soundManager.soundIDs.length; i++) {
var mySound = soundManager.getSoundById(soundManager.soundIDs[i]);
mySound.setVolume(volume);
}
$rootScope.$broadcast('music:volume', volume);
};
if(increase === true) {
if(volume < 100) {
volume = volume + 10;
changeVolume(volume);
}
} else {
if(volume > 0) {
volume = volume - 10;
changeVolume(volume);
}
}
},
adjustVolumeSlider: function(value) {
var changeVolume = function(volume) {
for(var i = 0; i < soundManager.soundIDs.length; i++) {
var mySound = soundManager.getSoundById(soundManager.soundIDs[i]);
mySound.setVolume(volume);
}
$rootScope.$broadcast('music:volume', volume);
};
volume = value;
changeVolume(value);
},
clearPlaylist: function(callback) {
$log.debug('clear playlist');
this.resetProgress();
this.clearShuffle();
//unload and destroy soundmanager sounds
var smIdsLength = soundManager.soundIDs.length;
this.asyncLoop({
length: smIdsLength,
functionToLoop: function(loop, i) {
setTimeout(function() {
//custom code
soundManager.destroySound(soundManager.soundIDs[0]);
//custom code
loop();
// accelerate remove speed reduce timeout to 0
}, 0);
},
callback: function() {
//callback custom code
$log.debug('All done!');
//clear playlist
playlist = [];
$rootScope.$broadcast('player:playlist', playlist);
callback(true);
//callback custom code
}
});
},
resetProgress: function() {
trackProgress = 0;
},
isPlayingStatus: function() {
return isPlaying;
},
clearShuffle: function() {
shufflelist = [];
shuffleCount = 0;
shuffleIndex = -1;
},
getShuffle: function(){
return shuffle;
},
toggleShuffle: function() {
shuffle = !shuffle;
this.clearShuffle();
},
setBootstrapTrack: function(fn){
bootstrapTrack = fn;
}
};
}
]);
ngSoundManager.directive('soundManager', ['$filter', '$timeout', 'angularPlayer',
function($filter, $timeout, angularPlayer) {
return {
restrict: "E",
link: function(scope, element, attrs) {
//init and load sound manager 2
angularPlayer.init();
scope.$on('track:progress', function(event, data) {
$timeout(function() {
scope.progress = data;
});
});
scope.$on('track:id', function(event, data) {
$timeout(function() {
scope.currentPlaying = angularPlayer.currentTrackData();
});
});
scope.$on('currentTrack:position', function(event, data) {
$timeout(function() {
scope.currentPosition = $filter('humanTime')(data);
});
});
scope.$on('currentTrack:duration', function(event, data) {
$timeout(function() {
scope.currentDuration = $filter('humanTime')(data);
});
});
scope.isPlaying = false;
scope.$on('music:isPlaying', function(event, data) {
$timeout(function() {
scope.isPlaying = data;
});
});
scope.playlist = angularPlayer.getPlaylist(); //on load
scope.$on('player:playlist', function(event, data) {
$timeout(function() {
scope.playlist = data;
});
});
}
};
}
]);
ngSoundManager.directive('musicPlayer', ['angularPlayer', '$log',
function(angularPlayer, $log) {
return {
restrict: "EA",
scope: {
song: "=addSong"
},
link: function(scope, element, attrs) {
var addToPlaylist = function() {
var trackId = angularPlayer.addTrack(scope.song);
//if request to play the track
if(attrs.musicPlayer === 'play') {
angularPlayer.playTrack(trackId);
}
};
element.bind('click', function() {
$log.debug('adding song to playlist');
addToPlaylist();
});
}
};
}
]);
ngSoundManager.directive('playFromPlaylist', ['angularPlayer', function (angularPlayer) {
return {
restrict: "EA",
scope: {
song: "=playFromPlaylist"
},
link: function (scope, element, attrs) {
element.bind('click', function (event) {
angularPlayer.playTrack(scope.song.id);
});
}
};
}]);
ngSoundManager.directive('removeFromPlaylist', ['angularPlayer',
function(angularPlayer) {
return {
restrict: "EA",
scope: {
song: "=removeFromPlaylist"
},
link: function(scope, element, attrs) {
element.bind('click', function(event) {
angularPlayer.removeSong(scope.song.id, attrs.index);
});
}
};
}
]);
ngSoundManager.directive('seekTrack', ['angularPlayer', '$log', function (angularPlayer, $log) {
return {
restrict: "EA",
link: function (scope, element, attrs) {
element.bind('click', function (event) {
if (angularPlayer.getCurrentTrack() === null) {
$log.debug('no track loaded');
return;
}
var sound = soundManager.getSoundById(angularPlayer.getCurrentTrack());
var getXOffset = function (event) {
var x = 0, element = event.target;
while (element && !isNaN(element.offsetLeft) && !isNaN(element.offsetTop)) {
x += element.offsetLeft - element.scrollLeft;
element = element.offsetParent;
}
return event.clientX - x;
};
var x = event.offsetX || getXOffset(event),
width = element[0].clientWidth,
duration = sound.durationEstimate;
sound.setPosition((x / width) * duration);
});
}
};
}]);
ngSoundManager.directive('playMusic', ['angularPlayer', function (angularPlayer) {
return {
restrict: "EA",
link: function (scope, element, attrs) {
element.bind('click', function (event) {
angularPlayer.play();
});
}
};
}]);
ngSoundManager.directive('pauseMusic', ['angularPlayer', function (angularPlayer) {
return {
restrict: "EA",
link: function (scope, element, attrs) {
element.bind('click', function (event) {
angularPlayer.pause();
});
}
};
}]);
ngSoundManager.directive('stopMusic', ['angularPlayer', function (angularPlayer) {
return {
restrict: "EA",
link: function (scope, element, attrs) {
element.bind('click', function (event) {
angularPlayer.stop();
});
}
};
}]);
ngSoundManager.directive('nextTrack', ['angularPlayer', function (angularPlayer) {
return {
restrict: "EA",
link: function (scope, element, attrs) {
element.bind('click', function (event) {
angularPlayer.nextTrack();
});
}
};
}]);
ngSoundManager.directive('prevTrack', ['angularPlayer', function (angularPlayer) {
return {
restrict: "EA",
link: function (scope, element, attrs) {
element.bind('click', function (event) {
angularPlayer.prevTrack();
});
}
};
}]);
ngSoundManager.directive('muteMusic', ['angularPlayer', function (angularPlayer) {
return {
restrict: "EA",
link: function (scope, element, attrs) {
element.bind('click', function (event) {
angularPlayer.mute();
});
scope.mute = angularPlayer.getMuteStatus();
scope.$on('music:mute', function (event, data) {
scope.$apply(function () {
scope.mute = data;
});
});
}
};
}]);
ngSoundManager.directive('repeatMusic', ['angularPlayer', function (angularPlayer) {
return {
restrict: "EA",
link: function (scope, element, attrs) {
element.bind('click', function (event) {
angularPlayer.repeatToggle();
});
scope.repeat = angularPlayer.getRepeatStatus();
scope.$on('music:repeat', function (event, data) {
scope.$apply(function () {
scope.repeat = data;
});
});
}
};
}]);
ngSoundManager.directive('musicVolume', ['angularPlayer',
function(angularPlayer) {
return {
restrict: "EA",
link: function(scope, element, attrs) {
element.bind('click', function(event) {
if(attrs.type === 'increase') {
angularPlayer.adjustVolume(true);
} else {
angularPlayer.adjustVolume(false);
}
});
scope.volume = angularPlayer.getVolume();
scope.$on('music:volume', function(event, data) {
scope.$apply(function() {
scope.volume = data;
});
});
}
};
}
]);
ngSoundManager.directive('clearPlaylist', ['angularPlayer', '$log',
function(angularPlayer, $log) {
return {
restrict: "EA",
link: function(scope, element, attrs) {
element.bind('click', function(event) {
//first stop any playing music
angularPlayer.stop();
angularPlayer.setCurrentTrack(null);
angularPlayer.clearPlaylist(function(data) {
$log.debug('all clear!');
});
});
}
};
}
]);
ngSoundManager.directive('playAll', ['angularPlayer', '$log',
function(angularPlayer, $log) {
return {
restrict: "EA",
scope: {
songs: '=playAll'
},
link: function(scope, element, attrs) {
element.bind('click', function(event) {
//first clear the playlist
angularPlayer.clearPlaylist(function(data) {
$log.debug('cleared, ok now add to playlist');
//add songs to playlist
for(var i = 0; i < scope.songs.length; i++) {
angularPlayer.addTrack(scope.songs[i]);
}
if (attrs.play != 'false') {
//play first song
angularPlayer.play();
}
});
});
}
};
}
]);
ngSoundManager.directive('volumeBar', ['angularPlayer',
function(angularPlayer) {
return {
restrict: "EA",
link: function(scope, element, attrs) {
element.bind('click', function(event) {
var getXOffset = function(event) {
var x = 0,
element = event.target;
while(element && !isNaN(element.offsetLeft) && !isNaN(element.offsetTop)) {
x += element.offsetLeft - element.scrollLeft;
element = element.offsetParent;
}
return event.clientX - x;
};
var x = event.offsetX || getXOffset(event),
width = element[0].clientWidth,
duration = 100;
var volume = (x / width) * duration;
angularPlayer.adjustVolumeSlider(volume);
});
scope.volume = angularPlayer.getVolume();
scope.$on('music:volume', function(event, data) {
scope.$apply(function() {
scope.volume = data;
});
});
}
};
}
]);
ngSoundManager.directive('playPauseToggle', ['angularPlayer',
function(angularPlayer) {
return {
restrict: "EA",
link: function(scope, element, attrs) {
scope.$on('music:isPlaying', function(event, data) {
//update html
if (data) {
if(typeof attrs.pause != 'undefined') {
element.html(attrs.pause);
} else {
element.html('Pause');
}
} else {
if(typeof attrs.play != 'undefined') {
element.html(attrs.play);
} else {
element.html('Play');
}
}
});
element.bind('click', function(event) {
if(angularPlayer.isPlayingStatus()) {
//if playing then pause
angularPlayer.pause();
} else {
//else play if not playing
angularPlayer.play();
}
});
}
};
}
]);
| 43.55306 | 418 | 0.439821 |
c8641172c6248d0d2782580e5e556f45204dec61 | 799 | js | JavaScript | remark/withBlitzLinks.js | donni106/blitzjs.com | 7162cd134bef10cdec939a6e32e95db12a8fe1a1 | [
"MIT"
] | 171 | 2020-02-22T10:04:48.000Z | 2022-03-31T02:09:48.000Z | remark/withBlitzLinks.js | donni106/blitzjs.com | 7162cd134bef10cdec939a6e32e95db12a8fe1a1 | [
"MIT"
] | 649 | 2020-02-22T03:40:35.000Z | 2022-03-28T09:59:33.000Z | remark/withBlitzLinks.js | donni106/blitzjs.com | 7162cd134bef10cdec939a6e32e95db12a8fe1a1 | [
"MIT"
] | 363 | 2020-02-25T04:52:06.000Z | 2022-03-31T02:09:00.000Z | import {addImport} from "./utils"
export const withBlitzLinks = () => {
return (tree) => {
const component = addImport(tree, "blitz", "Link")
function walk(root) {
if (!root.children) return
let i = 0
while (i < root.children.length) {
let node = root.children[i]
if (node.type === "link" && node.url.startsWith("/")) {
root.children = [
...root.children.slice(0, i),
{type: "jsx", value: `<${component} href="${node.url}" passHref><a>`},
...node.children,
{type: "jsx", value: `</a></${component}>`},
...root.children.slice(i + 1),
]
i += node.children.length + 2
} else {
i += 1
}
walk(node)
}
}
walk(tree)
}
}
| 26.633333 | 82 | 0.473091 |
c8643ee80de087835f25fef872aab71abcca1533 | 722 | js | JavaScript | test/built-ins/AsyncGeneratorFunction/invoked-as-constructor-no-arguments.js | katemihalikova/test262 | aaf4402b4ca9923012e61830fba588bf7ceb6027 | [
"BSD-3-Clause"
] | 2,602 | 2015-01-02T10:45:13.000Z | 2022-03-30T23:04:17.000Z | test/built-ins/AsyncGeneratorFunction/invoked-as-constructor-no-arguments.js | katemihalikova/test262 | aaf4402b4ca9923012e61830fba588bf7ceb6027 | [
"BSD-3-Clause"
] | 2,157 | 2015-01-06T05:01:55.000Z | 2022-03-31T17:18:08.000Z | test/built-ins/AsyncGeneratorFunction/invoked-as-constructor-no-arguments.js | katemihalikova/test262 | aaf4402b4ca9923012e61830fba588bf7ceb6027 | [
"BSD-3-Clause"
] | 527 | 2015-01-08T16:04:26.000Z | 2022-03-24T03:34:47.000Z | // Copyright (C) 2018 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-asyncgeneratorfunction
description: >
When invoked via the constructor invocation pattern without arguments, the
GeneratorFunction intrinsic returns a valid async generator with an empty body.
features: [async-iteration]
flags: [async]
---*/
var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
var g = new AsyncGeneratorFunction();
var iter = g();
iter.next().then(function(result) {
assert.sameValue(result.value, undefined, 'Result `value`');
assert.sameValue(result.done, true, 'Result `done` flag');
}).then($DONE, $DONE)
| 32.818182 | 86 | 0.739612 |
c8646ab41fd0db14ef694119d5bd8c316f92f6c8 | 2,360 | js | JavaScript | components/src/Checkbox/CheckboxGroup.story.js | JonErikDSuero/design-system | 1ec57344ba6bb24517807a5296968b9097573619 | [
"MIT"
] | null | null | null | components/src/Checkbox/CheckboxGroup.story.js | JonErikDSuero/design-system | 1ec57344ba6bb24517807a5296968b9097573619 | [
"MIT"
] | null | null | null | components/src/Checkbox/CheckboxGroup.story.js | JonErikDSuero/design-system | 1ec57344ba6bb24517807a5296968b9097573619 | [
"MIT"
] | null | null | null | import React from "react";
import { storiesOf } from "@storybook/react";
import { Checkbox, CheckboxGroup } from "../index";
const errorList = ["Error message 1", "Error message 2"];
storiesOf("CheckboxGroup", module)
.add("CheckboxGroup", () => (
<CheckboxGroup labelText="Setting Selection" name="settingSelection">
<Checkbox value="a" labelText="Option A" />
<Checkbox value="b" labelText="Option B" />
<Checkbox value="c" labelText="Option C" />
</CheckboxGroup>
))
.add("CheckboxGroup with all props", () => (
<CheckboxGroup
labelText="Setting Selection"
name="settingSelection"
helpText="Select a setting from the menu below:"
required
requirementText="(Required)"
defaultValue={["a"]}
>
<Checkbox value="a" labelText="Option A" />
<Checkbox value="b" labelText="Option B" />
<Checkbox value="c" labelText="Option C" />
</CheckboxGroup>
))
.add("with error message", () => (
<CheckboxGroup
errorMessage="Please select an option"
labelText="Setting Selection"
name="settingSelection"
defaultValue={["a"]}
>
<Checkbox value="a" labelText="Option A" />
<Checkbox value="b" labelText="Option B" />
<Checkbox value="c" labelText="Option C" />
</CheckboxGroup>
))
.add("with error list", () => (
<CheckboxGroup
errorMessage="Please select an option"
errorList={errorList}
labelText="Setting Selection"
name="settingSelection"
defaultValue={["a"]}
>
<Checkbox value="a" labelText="Option A" />
<Checkbox value="b" labelText="Option B" />
<Checkbox value="c" labelText="Option C" />
</CheckboxGroup>
))
.add("Set to disabled", () => (
<CheckboxGroup disabled labelText="Setting Selection" name="settingSelection" defaultValue={["a"]}>
<Checkbox value="a" labelText="Option A" />
<Checkbox value="b" labelText="Option B" />
<Checkbox value="c" labelText="Option C" />
</CheckboxGroup>
))
.add("Controlled", () => (
<CheckboxGroup labelText="Setting Selection" name="settingSelection" checkedValue={["a"]} onChange={() => {}}>
<Checkbox value="a" labelText="Option A" />
<Checkbox value="b" labelText="Option B" />
<Checkbox value="c" labelText="Option C" />
</CheckboxGroup>
));
| 34.705882 | 114 | 0.619915 |
c8653d30f7bccb6050e0c577593110ac863b53a3 | 3,093 | js | JavaScript | node_modules/caniuse-lite/data/regions/CK.js | yashn007/nodejs | d15b0a52a043172321b9abc6761fabf235832cca | [
"MIT"
] | 26 | 2018-03-15T01:37:29.000Z | 2022-03-07T20:40:04.000Z | node_modules/caniuse-lite/data/regions/CK.js | yashn007/nodejs | d15b0a52a043172321b9abc6761fabf235832cca | [
"MIT"
] | 51 | 2018-04-24T00:15:29.000Z | 2022-02-27T13:53:42.000Z | node_modules/caniuse-lite/data/regions/CK.js | yashn007/nodejs | d15b0a52a043172321b9abc6761fabf235832cca | [
"MIT"
] | 8 | 2020-01-16T09:21:48.000Z | 2022-03-02T11:31:58.000Z | module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0.03393,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0.02545,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0.00848,"77":0,"78":0,"79":0,"80":0.00848,"81":0,"82":0,"83":0.00848,"84":0,"85":0.09331,"86":0.3478,"87":0.07635,"88":0,"89":0,"90":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":41.43097,"47":0,"48":0,"49":3.05388,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0.04242,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0.03393,"66":0,"67":0.01697,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0.03393,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0.00848,"81":0,"83":0.00848,"84":0,"85":0.05938,"86":0,"87":0.04242,"88":13.41162,"89":4.25847,"90":0,"91":0,"92":0,_:"93"},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0.03393,"75":0.00848,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0,"7.0-7.1":0,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.01831,"10.0-10.2":0,"10.3":0.00969,"11.0-11.2":0.00431,"11.3-11.4":0.05278,"12.0-12.1":0.1481,"12.2-12.4":0.16749,"13.0-13.1":0.08778,"13.2":0.05601,"13.3":0.33067,"13.4-13.7":0.55793,"14.0-14.4":3.82097,"14.5":0.00162},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.00848,"14":0.17814,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0.01697,"12.1":0.04242,"13.1":0.12725},B:{"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0.0509,"79":0,"80":0.00848,"81":0,"83":0,"84":0.01697,"85":0,"86":0,"87":0,"88":7.27841,"89":0.5514,"90":0},P:{"4":0.02014,"5.0-5.4":0.01007,"6.2-6.4":0,"7.2-7.4":0.01007,"8.2":0,"9.2":0.10069,"10.1":0.04028,"11.1-11.2":0.07048,"12.0":0.13089,"13.0":1.56066,"14.0":0},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00353,"4.4":0,"4.4.3-4.4.4":0.01343},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.21208,"5.5":0},J:{"7":0,"10":0},N:{"10":0,"11":0},S:{"2.5":0},R:{_:"0"},M:{"0":0.08344},Q:{"10.4":0},O:{"0":0.00607},H:{"0":0.03878},L:{"0":19.23619}};
| 1,546.5 | 3,092 | 0.467507 |
c86546036d5a28feabbd99930147201286bdc74c | 1,435 | js | JavaScript | motion.js | JFCCoding12/ellen-s-mirror | 4fc878b42ae96233cf7171e72357347be9435b12 | [
"MIT"
] | 2 | 2021-04-07T00:40:32.000Z | 2021-07-11T00:29:22.000Z | motion.js | steveshp/smart-mirror | 1193ef42ec899c82d69c9303d915fc94188ee708 | [
"MIT"
] | null | null | null | motion.js | steveshp/smart-mirror | 1193ef42ec899c82d69c9303d915fc94188ee708 | [
"MIT"
] | 1 | 2019-03-20T02:20:00.000Z | 2019-03-20T02:20:00.000Z | 'use strict'
// Load in smart mirror config
var config = require("./config.json")
if(!config || !config.motion || !config.motion.enabled || !config.motion.pin || !config.general.language){
console.log("!E:","Configuration Error! See: https://docs.smart-mirror.io/docs/configure_the_mirror.html#motion")
}
if (config.motion.enabled == true && require.resolve('johnny-five').length > 0 && require.resolve('raspi-io').length > 0 ) {
// Configure johnny-five
var five = require('johnny-five');
var Raspi = require("raspi-io");
var board = new five.Board({
io: new Raspi()
});
board.on("ready",function() {
var motion = new five.Motion(config.motion.pin);
// "calibrated" occurs once, at the beginning of a session,
motion.on("calibrated", function() {
console.log("!c:","calibrated");
});
// "motionstart" events are fired when the "calibrated"
// proximal area is disrupted, generally by some form of movement
motion.on("motionstart", function() {
console.log("!s:","motionstart");
});
// "motionend" events are fired following a "motionstart" event
// when no movement has occurred in X ms
motion.on("motionend", function() {
console.log("!e:","motionend");
});
});
} else if ( config.motion.enabled == true){
console.error("!E:","Motion Dependencies are missing! Therefore despite my best efforts I'll have to disable motion, Dave. This is most embarrassing for us both.")
}
| 35 | 164 | 0.676655 |
c86574d372026dbf5b689025c212f6103f8aba07 | 4,036 | js | JavaScript | assets/jspm_packages/npm/babel-core@5.6.15/lib/babel/transformation/transformers/internal/modules.js | diztinct-tim/BeautyBridge | 07b535ae1e033974525bf26520afde4e498ed1fd | [
"MIT"
] | 3 | 2017-04-30T20:37:55.000Z | 2019-03-14T22:20:51.000Z | assets/jspm_packages/npm/babel-core@5.6.15/lib/babel/transformation/transformers/internal/modules.js | diztinct-tim/BeautyBridge | 07b535ae1e033974525bf26520afde4e498ed1fd | [
"MIT"
] | null | null | null | assets/jspm_packages/npm/babel-core@5.6.15/lib/babel/transformation/transformers/internal/modules.js | diztinct-tim/BeautyBridge | 07b535ae1e033974525bf26520afde4e498ed1fd | [
"MIT"
] | 1 | 2018-03-31T01:10:36.000Z | 2018-03-31T01:10:36.000Z | /* */
"format cjs";
"use strict";
var _toolsProtectJs2 = require("./../../../tools/protect.js");
var _toolsProtectJs3 = _interopRequireDefault(_toolsProtectJs2);
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }
// in this transformer we have to split up classes and function declarations
// from their exports. why? because sometimes we need to replace classes with
// nodes that aren't allowed in the same contexts. also, if you're exporting
// a generator function as a default then regenerator will destroy the export
// declaration and leave a variable declaration in it's place... yeah, handy.
var _lodashLangClone = require("lodash/lang/clone");
var _lodashLangClone2 = _interopRequireDefault(_lodashLangClone);
var _types = require("../../../types");
var t = _interopRequireWildcard(_types);
_toolsProtectJs3["default"](module);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function getDeclar(node) {
var declar = node.declaration;
t.inheritsComments(declar, node);
t.removeComments(node);
declar._ignoreUserWhitespace = true;
return declar;
}
function buildExportSpecifier(id) {
return t.exportSpecifier(_lodashLangClone2["default"](id), _lodashLangClone2["default"](id));
}
var metadata = {
group: "builtin-pre"
};
exports.metadata = metadata;
var visitor = {
ExportDefaultDeclaration: function ExportDefaultDeclaration(node, parent, scope) {
var declar = node.declaration;
if (t.isClassDeclaration(declar)) {
// export default class Foo {};
var nodes = [getDeclar(node), node];
node.declaration = declar.id;
return nodes;
} else if (t.isClassExpression(declar)) {
// export default class {};
var temp = scope.generateUidIdentifier("default");
node.declaration = t.variableDeclaration("var", [t.variableDeclarator(temp, declar)]);
var nodes = [getDeclar(node), node];
node.declaration = temp;
return nodes;
} else if (t.isFunctionDeclaration(declar)) {
// export default function Foo() {}
node._blockHoist = 2;
var nodes = [getDeclar(node), node];
node.declaration = declar.id;
return nodes;
}
},
ExportNamedDeclaration: function ExportNamedDeclaration(node) {
var declar = node.declaration;
if (t.isClassDeclaration(declar)) {
// export class Foo {}
node.specifiers = [buildExportSpecifier(declar.id)];
var nodes = [getDeclar(node), node];
node.declaration = null;
return nodes;
} else if (t.isFunctionDeclaration(declar)) {
// export function Foo() {}
node.specifiers = [buildExportSpecifier(declar.id)];
node._blockHoist = 2;
var nodes = [getDeclar(node), node];
node.declaration = null;
return nodes;
} else if (t.isVariableDeclaration(declar)) {
// export var foo = "bar";
var specifiers = [];
var bindings = this.get("declaration").getBindingIdentifiers();
for (var key in bindings) {
specifiers.push(buildExportSpecifier(bindings[key]));
}
return [declar, t.exportNamedDeclaration(null, specifiers)];
}
},
Program: {
enter: function enter(node) {
var imports = [];
var rest = [];
for (var i = 0; i < node.body.length; i++) {
var bodyNode = node.body[i];
if (t.isImportDeclaration(bodyNode)) {
imports.push(bodyNode);
} else {
rest.push(bodyNode);
}
}
node.body = imports.concat(rest);
},
exit: function exit(node, parent, scope, file) {
if (!file.transformers["es6.modules"].canTransform()) return;
if (file.moduleFormatter.setup) {
file.moduleFormatter.setup();
}
}
}
};
exports.visitor = visitor; | 31.046154 | 272 | 0.657582 |
c865a08316e590803d2bca69375d1abe957e9a11 | 294 | js | JavaScript | driver.js | jtyler258/action-slack-incoming-webhook | 706ff266137a4500bba8f467650c061c3aa293d1 | [
"MIT"
] | 49 | 2020-05-13T07:09:40.000Z | 2022-03-10T23:01:53.000Z | driver.js | jtyler258/action-slack-incoming-webhook | 706ff266137a4500bba8f467650c061c3aa293d1 | [
"MIT"
] | 4 | 2021-01-02T09:14:20.000Z | 2021-11-22T02:19:47.000Z | driver.js | jtyler258/action-slack-incoming-webhook | 706ff266137a4500bba8f467650c061c3aa293d1 | [
"MIT"
] | 3 | 2020-07-12T18:27:29.000Z | 2021-08-09T06:56:12.000Z | const run = require('./run')
function setupInputs(inputs) {
for (const input in inputs) {
let key = 'INPUT_' + input.toUpperCase()
process.env[key] = JSON.stringify(inputs[input])
}
}
process.env.INCOMING_WEBHOOK_URL = 'YOUR WEBHOOK URL'
setupInputs({
text: "Hello"
})
run()
| 16.333333 | 53 | 0.666667 |
c867b354b2d4bcab008f12c2e142f502229e010f | 465 | js | JavaScript | packages/scripts/libs/build.js | uedlinker/scripts | e8ec3f51c1589438913f503f0a5be8667bf0e34d | [
"MIT"
] | null | null | null | packages/scripts/libs/build.js | uedlinker/scripts | e8ec3f51c1589438913f503f0a5be8667bf0e34d | [
"MIT"
] | 1 | 2018-09-06T03:26:00.000Z | 2018-09-06T10:16:48.000Z | packages/scripts/libs/build.js | uedlinker/scripts | e8ec3f51c1589438913f503f0a5be8667bf0e34d | [
"MIT"
] | null | null | null | module.exports = () => {
process.env.NODE_ENV = 'production'
process.env.BABEL_ENV = 'production'
process.on('unhandledRejection', err => {
throw err
})
const { execFileSync } = require('child_process')
const file = require.resolve('webpack/bin/webpack.js')
const args = process.argv.slice(3)
args.unshift('--config', require.resolve('../config/webpack.js'))
execFileSync(file, args, {
cwd: process.cwd(),
stdio: 'inherit',
})
}
| 23.25 | 67 | 0.653763 |
c868bb42543e74bfc29c4529741e47882097ac9b | 4,955 | js | JavaScript | js/app/job/event-log-adder.js | hal-platform/hal | 32db4d0990adf0bdd081ad79b85c9f1909dfe520 | [
"MIT"
] | 16 | 2017-01-11T18:16:48.000Z | 2021-02-05T18:52:48.000Z | js/app/job/event-log-adder.js | hal-platform/hal | 32db4d0990adf0bdd081ad79b85c9f1909dfe520 | [
"MIT"
] | 59 | 2017-01-19T19:29:04.000Z | 2018-05-18T16:48:31.000Z | js/app/job/event-log-adder.js | hal-platform/hal | 32db4d0990adf0bdd081ad79b85c9f1909dfe520 | [
"MIT"
] | 1 | 2021-08-10T14:07:30.000Z | 2021-08-10T14:07:30.000Z | import 'jquery';
import { generateIcon } from '../util/icon';
import { formatTime } from '../util/time-formatter';
import { initEventLogLoader } from '../job/event-log-loader';
let logTableTarget = '.js-event-logs',
logTarget = '[data-log]';
var $logTable = null,
logs = {};
function initEventLogAdder() {
// global state: logs, $logTable
// stub event logs, dont need to be updated further
$logTable = $(logTableTarget);
if ($logTable.length <= 0) {
return;
}
$logTable
.find(logTarget)
.each(function(index, item) {
let id = $(item).data('log');
logs[id] = 'embedded';
});
}
// Requires these properties:
// - count
// - _embedded.events
// - _embedded.events[].id
// - _embedded.events[].name
// - _embedded.events[].message
// - _embedded.events[].created
function checkEventLogs($elem) {
// global state: $logTable, logs
if ($logTable === null) { return; }
let id = $elem.data('build'),
logsEndpoint = generateURL(id);
$.getJSON(logsEndpoint, function(data) {
if (data.count < 1) {
return;
}
if (!data._embedded || !data._embedded.events) {
return;
}
let logs = data._embedded.events,
hasNewLogs = false;
for(let index in logs) {
let log = logs[index];
if (typeof logs[log.id] == 'undefined') {
hasNewLogs = true;
logs[log.id] = log.message;
$logTable
.append(renderEventRow(log));
}
}
if (hasNewLogs) {
$logTable
.find('.js-empty-row')
.remove().end()
.find('.js-thinking-row')
.appendTo($logTable);
}
});
}
function updateEventLogTable(jobStatus) {
// global state: $logTable, logTarget
if ($logTable === null) { return; }
handleThinkingLogs($logTable, jobStatus);
handleLogExpanding($logTable, logTarget, jobStatus);
}
// Handles the "Be patient, log messages are loading" message.
function handleThinkingLogs($table, jobStatus) {
if (jobStatus == 'pending' || jobStatus == 'running' || jobStatus == 'deploying') {
var $thinking = $table.find('.js-thinking-row');
// If thinking row already exists, just move it to the bottom
if ($thinking.length > 0) {
$thinking.appendTo($table);
} else {
$thinking = $('<tbody class="js-thinking-row">')
.append('<tr><td><span class="status-icon--thinking">Loading...</span></td></tr>')
.appendTo($table);
}
} else {
$table
.find('.js-thinking-row')
.remove();
}
}
// Attach event log loader once the job is finished.
function handleLogExpanding($table, eventTarget, jobStatus) {
// global state: $logTable, logTarget
if ($table === null) { return; }
// is finished
if (jobStatus == 'success' || jobStatus == 'failure') {
// wait 2 seconds so any remaining logs can be loaded
window.setTimeout(() => {
$table
.find(eventTarget)
.each((i, e) => { $(e).attr('data-log-loadable', '1'); });
initEventLogLoader();
}, 2000);
}
}
function renderEventRow(event) {
let event_name = formatEventName(event.name),
event_time = formatTime(event.created),
event_failure_class = event.status === 'failure' ? 'event-log--error' : '';
let event_block_class = 'status-block--info';
let event_icon = 'paragraph-justify-2';
if (event.status === 'success') {
event_block_class = 'status-block--success';
event_icon = 'tick';
}
if (event.status === 'failure') {
event_block_class = 'status-block--error';
event_icon = 'spam-2';
}
let event_icon_svg = generateIcon(event_icon);
let template = `
<tbody data-log="${event.id}">
<tr class="${event_failure_class}">
<td>
<span class="${event_block_class}">
${event_icon_svg} ${event_name}
</span>
</td>
<td>
<time datetime="${event.created}" title="${event_time.absolute}">${event_time.relative}</time>
</td>
<td>${event.message}</td>
<td class="tr js-event-logs-loader"></td>
</tr>
</tbody>
`;
return template;
}
function formatEventName(eventName) {
let eventRegex = /^(build|release).([a-z]*)$/i,
match = null,
logName = '';
match = eventRegex.exec(eventName);
if (match !== null && match.length > 0) {
logName = match.pop();
}
return logName.charAt(0).toUpperCase() + logName.slice(1);
}
function generateURL(buildID) {
return '/api/builds/' + buildID + '/events?embed=events';
}
export { initEventLogAdder, checkEventLogs, updateEventLogTable };
| 27.375691 | 106 | 0.556609 |
c86a3ff1cb3702e6c766015831dc8637c1a040fd | 794 | js | JavaScript | server-app/src/page/Page.js | gclaussn/ssg | fa5b43c019eef28381d1d488dded3a4c4f7e943f | [
"Apache-2.0"
] | null | null | null | server-app/src/page/Page.js | gclaussn/ssg | fa5b43c019eef28381d1d488dded3a4c4f7e943f | [
"Apache-2.0"
] | null | null | null | server-app/src/page/Page.js | gclaussn/ssg | fa5b43c019eef28381d1d488dded3a4c4f7e943f | [
"Apache-2.0"
] | null | null | null | import axios from "axios";
export default class Page {
static get(id) {
return axios.get(`/api/pages/${id}`).then(res => {
return new Page(res.data);
}).catch(err => {
throw err;
});
}
static getAll() {
return axios.get("/api/pages").then(res => {
return res.data.map(data => new Page(data));
}).catch(err => {
throw err;
});
}
static getData(id) {
return axios.get(`/api/pages/${id}/data`).then(res => {
return res.data;
}).catch (err => {
throw err;
});
}
constructor(data) {
this._data = data;
}
get id() {
return this._data.id;
}
get rejected() {
return this._data.rejected;
}
get skipped() {
return this._data.skipped;
}
get url() {
return this._data.url;
}
}
| 17.644444 | 59 | 0.537783 |
c86b7198c7466d23f3d9622df6d67716bcf8834d | 4,418 | js | JavaScript | .venv/lib/python3.8/site-packages/notebook/static/components/MathJax/localization/en/MathMenu.js | eo1989/VectorBTanalysis | bea3deaf2ee3fc114b308146f2af3e4f35f70197 | [
"MIT"
] | 1 | 2021-09-07T05:26:21.000Z | 2021-09-07T05:26:21.000Z | .venv/lib/python3.8/site-packages/notebook/static/components/MathJax/localization/en/MathMenu.js | eo1989/VectorBTanalysis | bea3deaf2ee3fc114b308146f2af3e4f35f70197 | [
"MIT"
] | null | null | null | .venv/lib/python3.8/site-packages/notebook/static/components/MathJax/localization/en/MathMenu.js | eo1989/VectorBTanalysis | bea3deaf2ee3fc114b308146f2af3e4f35f70197 | [
"MIT"
] | 1 | 2016-10-20T11:54:20.000Z | 2016-10-20T11:54:20.000Z | /*
* /MathJax-v2/localization/en/MathMenu.js
*
* Copyright (c) 2009-2018 The MathJax Consortium
*
* 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.
*/
MathJax.Localization.addTranslation("en","MathMenu",{version:"2.7.8",isLoaded:true,strings:{Show:"Show math as",MathMLcode:"MathML code",OriginalMathML:"Original MathML",TeXCommands:"TeX commands",AsciiMathInput:"AsciiMathML input",Original:"Original form",ErrorMessage:"Error message",Annotation:"Annotation",TeX:"TeX",StarMath:"StarMath",Maple:"Maple",ContentMathML:"Content MathML",OpenMath:"OpenMath",texHints:"Show TeX hints in MathML",Settings:"Math settings",ZoomTrigger:"Zoom trigger",Hover:"Hover",Click:"Click",DoubleClick:"Double-click",NoZoom:"No zoom",TriggerRequires:"Trigger requires:",Option:"Option",Alt:"Alt",Command:"Command",Control:"Control",Shift:"Shift",ZoomFactor:"Zoom factor",Renderer:"Math renderer",MPHandles:"Let MathPlayer handle:",MenuEvents:"Menu events",MouseEvents:"Mouse events",MenuAndMouse:"Mouse and menu events",FontPrefs:"Font preferences",ForHTMLCSS:"For HTML-CSS:",Auto:"Auto",TeXLocal:"TeX (local)",TeXWeb:"TeX (web)",TeXImage:"TeX (image)",STIXLocal:"STIX (local)",STIXWeb:"STIX (web)",AsanaMathWeb:"Asana Math (web)",GyrePagellaWeb:"Gyre Pagella (web)",GyreTermesWeb:"Gyre Termes (web)",LatinModernWeb:"Latin Modern (web)",NeoEulerWeb:"Neo Euler (web)",ContextMenu:"Contextual menu",Browser:"Browser",Scale:"Scale all math ...",Discoverable:"Highlight on hover",Locale:"Language",LoadLocale:"Load from URL ...",About:"About MathJax",Help:"MathJax help",localTeXfonts:"using local TeX fonts",webTeXfonts:"using web TeX font",imagefonts:"using Image fonts",localSTIXfonts:"using local STIX fonts",webSVGfonts:"using web SVG fonts",genericfonts:"using generic Unicode fonts",wofforotffonts:"WOFF or OTF fonts",eotffonts:"EOT fonts",svgfonts:"SVG fonts",WebkitNativeMMLWarning:"Your browser does not seem to support MathML natively, so switching to MathML output may cause the mathematics on the page to become unreadable",MSIENativeMMLWarning:"Internet Explorer requires the MathPlayer plugin in order to process MathML output.",OperaNativeMMLWarning:"Opera's support for MathML is limited, so switching to MathML output may cause some expressions to render poorly.",SafariNativeMMLWarning:"Your browser's native MathML does not implement all the features used by MathJax, so some expressions may not render properly.",FirefoxNativeMMLWarning:"Your browser's native MathML does not implement all the features used by MathJax, so some expressions may not render properly.",MSIESVGWarning:"SVG is not implemented in Internet Explorer prior to IE9 or when it is emulating IE8 or below. Switching to SVG output will cause the mathematics to not display properly.",LoadURL:"Load translation data from this URL:",BadURL:"The URL should be for a JavaScript file that defines MathJax translation data. JavaScript file names should end with '.js'",BadData:"Failed to load translation data from %1",SwitchAnyway:"Switch the renderer anyway?\n\n(Press OK to switch, CANCEL to continue with the current renderer)",ScaleMath:"Scale all mathematics (compared to surrounding text) by",NonZeroScale:"The scale should not be zero",PercentScale:"The scale should be a percentage (for example 120%%)",IE8warning:"This will disable the MathJax menu and zoom features, but you can Alt-Click on an expression to obtain the MathJax menu instead.\n\nReally change the MathPlayer settings?",IE9warning:"The MathJax contextual menu will be disabled, but you can Alt-Click on an expression to obtain the MathJax menu instead.",NoOriginalForm:"No original form available",Close:"Close",EqSource:"MathJax Equation Source",CloseAboutDialog:"Close about MathJax dialog",FastPreview:"Fast Preview",AssistiveMML:"Assistive MathML",InTabOrder:"Include in Tab Order"}});MathJax.Ajax.loadComplete("[MathJax]/localization/en/MathMenu.js");
| 220.9 | 3,744 | 0.786329 |
c86bbe4a3347149fb2e6b4544b4c7bfa3be9bfaa | 1,514 | js | JavaScript | packages/the-moon/index.js | omrilotan/mono | f88052cc84ae77f3337e6c1b74fbb23ca0aecb38 | [
"MIT"
] | 29 | 2018-06-03T06:42:20.000Z | 2021-11-08T09:00:27.000Z | packages/the-moon/index.js | omrilotan/mono | f88052cc84ae77f3337e6c1b74fbb23ca0aecb38 | [
"MIT"
] | 157 | 2018-09-05T10:47:51.000Z | 2021-07-30T03:15:14.000Z | packages/the-moon/index.js | omrilotan/mono | f88052cc84ae77f3337e6c1b74fbb23ca0aecb38 | [
"MIT"
] | 5 | 2018-11-01T10:16:50.000Z | 2021-12-31T15:16:47.000Z | const {
MOON_CYCLE,
YEAR_CYCLE,
MONTH_CYCLE,
} = require('./lib/cycles');
const {
FORMAT_ICON,
FORMAT_CODE,
FORMAT_NAME,
FORMATS,
} = require('./lib/formats');
const {
ICONS,
CODES,
} = require('./lib/names');
const word = require('./lib/word');
const NINETEEN_HUNDRED = 694039.09;
const SUFFIX = 'Moon';
function moon(...args) {
const options = typeof args[args.length - 1] === 'object' ? args.pop() : {};
const { format = FORMAT_ICON } = options;
const now = new Date();
let [
year = now.getFullYear(),
month = now.getMonth() + 1,
day = now.getDate(),
] = args;
if (month < 3) {
year--;
month += 12;
}
let total_days_elapsed = year * YEAR_CYCLE + month * MONTH_CYCLE + day - NINETEEN_HUNDRED;
total_days_elapsed /= MOON_CYCLE;
total_days_elapsed -= parseInt(total_days_elapsed); // subtract integer part to leave fractional part of original
let phase = Math.round(total_days_elapsed * ICONS.length);
phase = phase >= ICONS.length ? 0 : phase; // turn 8 into 0
switch (format) {
case FORMAT_CODE:
return CODES[phase];
case FORMAT_NAME:
return [ word(CODES[phase]), SUFFIX ].join(' ');
default:
return ICONS[phase];
}
}
module.exports = Object.defineProperties(
moon,
{
ICONS: {
value: ICONS,
enumerable: true,
},
CODES: {
value: CODES,
enumerable: true,
},
NAMES: {
get: () => CODES.map(
name => [ word(name), SUFFIX ].join(' '),
),
enumerable: true,
},
FORMATS: {
value: FORMATS,
enumerable: true,
},
},
);
| 19.921053 | 114 | 0.633421 |
c86c183d9d2f1cbb18f3de551b49b7e540309343 | 842 | js | JavaScript | ui/src/components/erc/Inspect/SelectFile/SelectFile.js | nuest/o2r-UI | 7bb58498da2eba22a70caad424e4e5f8f081cef9 | [
"Apache-2.0"
] | 3 | 2019-09-04T12:42:24.000Z | 2021-05-14T00:11:17.000Z | ui/src/components/erc/Inspect/SelectFile/SelectFile.js | nuest/o2r-UI | 7bb58498da2eba22a70caad424e4e5f8f081cef9 | [
"Apache-2.0"
] | 132 | 2019-04-17T09:34:19.000Z | 2022-02-23T10:27:38.000Z | ui/src/components/erc/Inspect/SelectFile/SelectFile.js | nuest/o2r-UI | 7bb58498da2eba22a70caad424e4e5f8f081cef9 | [
"Apache-2.0"
] | 5 | 2019-04-15T15:17:27.000Z | 2021-01-08T15:40:38.000Z | import React, { Component } from "react";
import { Select, FilledInput, InputLabel, FormControl } from "@material-ui/core";
class SelectFile extends Component {
render() {
const props=this.props;
return (
<FormControl variant="outlined">
<InputLabel htmlFor="outlined-age-native-simple"></InputLabel>
<Select native
value={props.value}
onChange={props.handleChange}
input={<FilledInput name={props.name} id="filled-age-native-simple" />}
>
{props.options.map((option, index) => (
<option value={option} key={index}>{option}</option>
))}
</Select>
</FormControl>
);
}
}
export default SelectFile; | 33.68 | 91 | 0.517815 |
c86d5b8b7e93658b5566d925686eda3959611b56 | 2,559 | js | JavaScript | client/src/components/Resources/Navbar/Navbar.test.js | AlexKMarshall/regMan | 1924d9c649927310e8b7d747bb8ed26c006f2032 | [
"MIT"
] | 2 | 2020-08-28T12:19:44.000Z | 2021-01-25T04:16:17.000Z | client/src/components/Resources/Navbar/Navbar.test.js | AlexKMarshall/regMan | 1924d9c649927310e8b7d747bb8ed26c006f2032 | [
"MIT"
] | 113 | 2020-08-05T18:08:11.000Z | 2020-08-13T10:21:47.000Z | client/src/components/Resources/Navbar/Navbar.test.js | AlexKMarshall/regMan | 1924d9c649927310e8b7d747bb8ed26c006f2032 | [
"MIT"
] | null | null | null | import React from 'react';
import { MemoryRouter } from 'react-router-dom';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import Navbar from './Navbar';
import { useAuth0 } from '@auth0/auth0-react';
jest.mock('@auth0/auth0-react');
describe('Navbar', () => {
test('it should show Admin Access button for logged-out user', () => {
useAuth0.mockReturnValue({ isAuthenticated: false });
render(<Navbar />);
expect(
screen.getByRole('button', {
name: 'Admin Access',
})
).toBeInTheDocument();
});
test('it should not show admin-only links for logged-out user', () => {
useAuth0.mockReturnValue({ isAuthenticated: false });
render(<Navbar />);
expect(
screen.queryByRole('link', { name: 'Dashboard' })
).not.toBeInTheDocument();
expect(
screen.queryByRole('link', { name: 'Groups' })
).not.toBeInTheDocument();
expect(
screen.queryByRole('button', { name: 'Logout' })
).not.toBeInTheDocument();
});
test('it should call the authentication service when clicking Admin Access button', async () => {
useAuth0.mockReturnValue({
isAuthenticated: false,
loginWithRedirect: jest.fn(),
});
render(<Navbar />);
const { loginWithRedirect } = useAuth0();
const loginButton = screen.getByRole('button', {
name: 'Admin Access',
});
await userEvent.click(loginButton);
expect(loginWithRedirect).toHaveBeenCalledTimes(1);
});
test('it should render admin-only links for logged-in user', () => {
useAuth0.mockReturnValue({ isAuthenticated: true });
render(
<MemoryRouter>
<Navbar />
</MemoryRouter>
);
expect(screen.getByRole('link', { name: 'Dashboard' })).toBeInTheDocument();
expect(screen.getByRole('link', { name: 'Groups' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'Log Out' })).toBeInTheDocument();
expect(
screen.queryByRole('button', { name: 'Admin Access' })
).not.toBeInTheDocument();
});
test('it should logout when admin clicks the logout button', async () => {
useAuth0.mockReturnValue({
isAuthenticated: true,
logout: jest.fn(),
});
render(
<MemoryRouter>
<Navbar />
</MemoryRouter>
);
const { logout } = useAuth0();
const logoutButton = screen.getByRole('button', {
name: 'Log Out',
});
await userEvent.click(logoutButton);
expect(logout).toHaveBeenCalledTimes(1);
});
});
| 28.433333 | 99 | 0.62837 |
c86d61e9572d20cc24bd7c226f45622ce7979d7e | 29,956 | js | JavaScript | cordova/platforms/android/app/src/main/assets/www/nuxtfiles/c055023e37ad7a93330d.js | BiancaKaroline/newschool-frontend | 37761ddfcf72176eeafbba107106e0e518409368 | [
"Apache-2.0"
] | 6 | 2020-01-16T04:34:48.000Z | 2020-12-31T03:41:43.000Z | cordova/platforms/android/app/src/main/assets/www/nuxtfiles/c055023e37ad7a93330d.js | BiancaKaroline/newschool-frontend | 37761ddfcf72176eeafbba107106e0e518409368 | [
"Apache-2.0"
] | 1 | 2020-08-31T21:27:39.000Z | 2020-08-31T21:27:52.000Z | cordova/platforms/android/app/src/main/assets/www/nuxtfiles/c055023e37ad7a93330d.js | BiancaKaroline/newschool-frontend | 37761ddfcf72176eeafbba107106e0e518409368 | [
"Apache-2.0"
] | null | null | null | (window.webpackJsonp=window.webpackJsonp||[]).push([[27],{276:function(e,t,o){var content=o(281);"string"==typeof content&&(content=[[e.i,content,""]]),content.locals&&(e.exports=content.locals);(0,o(23).default)("77f4c5a8",content,!0,{sourceMap:!1})},277:function(e,t,o){var content=o(283);"string"==typeof content&&(content=[[e.i,content,""]]),content.locals&&(e.exports=content.locals);(0,o(23).default)("10e8a9fe",content,!0,{sourceMap:!1})},278:function(e,t,o){var content=o(288);"string"==typeof content&&(content=[[e.i,content,""]]),content.locals&&(e.exports=content.locals);(0,o(23).default)("8a50623e",content,!0,{sourceMap:!1})},279:function(e,t,o){"use strict";o(174),o(19),o(9),o(6),o(11),o(36),o(5);var r=o(3),l=o(290),n=o.n(l),f=o(105),x=o(104);function d(object,e){var t=Object.keys(object);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(object);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(object,e).enumerable}))),t.push.apply(t,o)}return t}var c={data:function(){return{menu:[{id:1,label:"Meu Perfil",icon:"mdi-account",link:"perfil"},{id:2,label:"Meus Cursos",icon:"mdi-library",link:"meus-cursos"},{id:3,label:"Meus Certificados",icon:"mdi-school",link:"certificados"},{id:4,label:"Cola com Nóix",icon:"mdi-gesture-double-tap",link:"/contribua"},{id:5,label:"O que é a new school?",icon:"mdi-library-books",link:"/sobre"},{id:7,label:"Fale com a gente",icon:"mdi-phone-message-outline",link:"/contato"},{id:8,label:"Apoie a new school",icon:"mdi-volume-high",link:"/investidores"}]}},methods:function(e){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?d(Object(source),!0).forEach((function(t){Object(r.a)(e,t,source[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(source)):d(Object(source)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(source,t))}))}return e}({},Object(f.b)("user",["clearInfoUser"]),{closeMenu:function(){document.getElementById("menu-btn").click()},logout:function(){var e=this;this.logoutSocial().then((function(){localStorage.clear(),$nuxt._router.push("/login"),e.clearInfoUser()}))},changeRoutingIfAdmin:function(){"ADMIN"===this.$store.state.user.data.role&&(this.menu[1].link="/admin/listar-cursos")},logoutSocial:function(){return this.$auth.loggedIn?this.$auth.logout():Promise.resolve()}}),computed:{user:function(){return this.$store.state.user.data}},mounted:function(){x.a.isTokenValid().status&&(this.auth=!0,this.changeRoutingIfAdmin())},filters:{simplifyName:function(e){if(!e)return"";return e.split(" ").length>2?/^(\S*\s+\S+).*/.exec(e)[1]:e}},components:{Avatar:n.a}},m=(o(280),o(39)),w=o(43),h=o.n(w),k=o(272),v=o(268),component=Object(m.a)(c,(function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"container-page"},[o("main",[o("section",{attrs:{id:"info"}},[o("div",{attrs:{id:"avatar"}},[o("div",{staticClass:"flex-center border-profile-photo"},[o("div",{staticClass:"flex-center profile-container"},[o("avatar",{attrs:{username:e._f("simplifyName")(e.user.name),size:90}})],1)])]),e._v(" "),o("div",{staticClass:"flex-center",attrs:{id:"flex-info-user"}},[o("h1",[e._v(e._s(e.user.name))]),e._v(" "),o("p",[e._v(e._s(e.user.type))]),e._v(" "),o("v-btn",{attrs:{id:"btnLogout",small:"",outlined:"",color:"error",width:"80px"},on:{click:e.logout}},[e._v("Sair")])],1)]),e._v(" "),o("div",{attrs:{id:"close"}},[o("v-icon",{attrs:{id:"close-btn",color:"primary"},on:{click:function(t){return e.closeMenu()}}},[e._v("mdi-close-circle")])],1)]),e._v(" "),o("section",{staticClass:"menu-list"},e._l(e.menu,(function(t){return o("router-link",{key:t.id,staticClass:"item-menu",attrs:{tag:"div",to:t.link},nativeOn:{click:function(t){return e.closeMenu()}}},[o("div",[o("v-icon",{attrs:{color:"primary"}},[e._v(e._s(t.icon))])],1),e._v(" "),o("p",{staticClass:"text-menu"},[e._v(e._s(t.label))])])})),1)])}),[],!1,null,"7640787c",null),y=component.exports;h()(component,{VBtn:k.a,VIcon:v.a});var _={data:function(){return{viewMenu:!1,auth:!1,menu:[{id:1,name:"Home",icon:"mdi-home",link:"/aluno/home"},{id:2,name:"Perfil",icon:"mdi-account",link:"/aluno/perfil"},{id:3,name:"Meus Cursos",icon:"mdi-library",link:"/aluno/meus-cursos"},{id:4,name:"Certificados",icon:"mdi-school",link:"/aluno/certificados",class:""}]}},components:{SideMenu:y},mounted:function(){x.a.isTokenValid().status&&(this.auth=!0,this.changeRoutingIfAdmin())},methods:{setViewMenu:function(){this.viewMenu=!this.viewMenu},changeRoutingIfAdmin:function(){"ADMIN"===this.$store.state.user.data.role&&(this.menu[0].link="/admin/home",this.menu[1].link="/admin/perfil",this.menu[2].link="/admin/listar-cursos",this.menu[3].class="remove-certificates")}}},O=(o(282),o(607)),j=Object(m.a)(_,(function(){var e=this,t=e.$createElement,o=e._self._c||t;return e.auth?o("div",[o("side-menu",{directives:[{name:"show",rawName:"v-show",value:e.viewMenu,expression:"viewMenu"}],staticClass:"intro-transition"}),e._v(" "),o("v-bottom-navigation",{attrs:{"scroll-target":"#page",fixed:"","scroll-threshold":"500",color:"write",horizontal:""}},[e._l(e.menu,(function(t){return o("v-btn",{key:t.id,staticClass:"btn-fixed menu__bottom",class:t.class,attrs:{to:t.link},on:{click:function(t){e.viewMenu=!1}}},[o("span",[e._v(e._s(t.name))]),e._v(" "),o("v-icon",[e._v(e._s(t.icon))])],1)})),e._v(" "),o("v-btn",{staticClass:"btn-fixed",attrs:{id:"menu-btn"},on:{click:e.setViewMenu}},[o("span",[e._v("Outros")]),e._v(" "),o("v-icon",[e._v("mdi-apps")])],1)],2)],1):e._e()}),[],!1,null,"49e11fd7",null);t.a=j.exports;h()(j,{VBottomNavigation:O.a,VBtn:k.a,VIcon:v.a})},280:function(e,t,o){"use strict";var r=o(276);o.n(r).a},281:function(e,t,o){(t=o(22)(!1)).push([e.i,".container-page[data-v-7640787c]{z-index:2}#btnLogout[data-v-7640787c]{margin-top:5px}.container-page>main[data-v-7640787c]{-webkit-box-pack:justify;justify-content:space-between;padding:.5rem;margin-top:1rem;width:100%}#info[data-v-7640787c],.container-page>main[data-v-7640787c]{display:-webkit-box;display:flex}#avatar[data-v-7640787c]{margin-right:1rem}.text-menu[data-v-7640787c]{text-transform:uppercase}h1[data-v-7640787c]{font-size:1.4rem;font-weight:600;text-transform:capitalize}.container-page[data-v-7640787c]{background-color:#fff;position:fixed;width:100%;height:100%;top:0;left:0}.row[data-v-7640787c]{margin-left:0}#close-btn[data-v-7640787c]{cursor:pointer;font-size:30px}#flex-info-user[data-v-7640787c]{-webkit-box-pack:start;justify-content:flex-start;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;-webkit-box-align:baseline;align-items:baseline}.flex-center[data-v-7640787c]{display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center;-webkit-box-align:center;align-items:center}.border-profile-photo[data-v-7640787c]{height:95px;width:95px;border:1px solid #60c;border-radius:50px}.profile-container[data-v-7640787c]{width:85px;height:85px;border-radius:50px;overflow:hidden}.profile-container img[data-v-7640787c]{width:100%}.item-menu[data-v-7640787c]{width:100%;padding:13px;border-bottom:1px solid #e8e8e8;-webkit-box-align:center;align-items:center;color:#60c!important;cursor:pointer}.item-menu[data-v-7640787c],.item-menu div[data-v-7640787c]{display:-webkit-box;display:flex}.item-menu div[data-v-7640787c]{width:50px;-webkit-box-pack:center;justify-content:center;margin-right:2rem}.item-menu[data-v-7640787c]:hover{background-color:#e8d1ff}.col-flex-center[data-v-7640787c]{display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center;-webkit-box-align:baseline;align-items:baseline}p[data-v-7640787c]{margin-bottom:0!important}h4[data-v-7640787c]{font-weight:600}@media(max-width:320px){.item-menu[data-v-7640787c]{height:42px}}",""]),e.exports=t},282:function(e,t,o){"use strict";var r=o(277);o.n(r).a},283:function(e,t,o){(t=o(22)(!1)).push([e.i,"[data-v-49e11fd7] .v-item-group.v-bottom-navigation--horizontal .v-btn>.v-btn__content{-webkit-box-orient:vertical!important;-webkit-box-direction:reverse!important;flex-direction:column-reverse!important}.v-icon[data-v-49e11fd7]{margin-right:0!important}#page[data-v-49e11fd7]{margin-bottom:5rem!important}.btn-fixed[data-v-49e11fd7]{height:100%!important}.intro-transition[data-v-49e11fd7]{-webkit-animation-name:intro;animation-name:intro;-webkit-animation-duration:.2s;animation-duration:.2s}[data-v-49e11fd7] .v-item-group.v-bottom-navigation .v-btn.v-btn--active .v-btn__content{color:#60c}@media (max-width:375px){.v-btn[data-v-49e11fd7]{min-width:55px!important;font-size:.6rem!important}}@media (max-width:415px){.v-btn[data-v-49e11fd7]{font-size:.65rem!important}}.remove-certificates[data-v-49e11fd7]{display:none}",""]),e.exports=t},284:function(e,t,o){var content=o(289);"string"==typeof content&&(content=[[e.i,content,""]]),content.locals&&(e.exports=content.locals);(0,o(23).default)("744bab4a",content,!0,{sourceMap:!1})},285:function(e,t,o){"use strict";o.d(t,"a",(function(){return l}));o(66),o(6),o(5),o(11);var r=o(1);function l(e){return r.default.extend({name:"v-".concat(e),functional:!0,props:{id:String,tag:{type:String,default:"div"}},render:function(t,o){var r=o.props,data=o.data,l=o.children;data.staticClass="".concat(e," ").concat(data.staticClass||"").trim();var n=data.attrs;if(n){data.attrs={};var f=Object.keys(n).filter((function(e){if("slot"===e)return!1;var t=n[e];return e.startsWith("data-")?(data.attrs[e]=t,!1):t||"string"==typeof t}));f.length&&(data.staticClass+=" ".concat(f.join(" ")))}return r.id&&(data.domProps=data.domProps||{},data.domProps.id=r.id),t(r.tag,data,l)}})}},286:function(e,t,o){"use strict";var r={props:["title","backPage"],methods:{comeBackPage:function(){this.$router.back()}}},l=(o(287),o(39)),n=o(43),f=o.n(n),x=o(272),d=o(268),component=Object(l.a)(r,(function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{attrs:{id:"head__bar"}},[e.backPage?o("v-btn",{staticClass:"btn-back",attrs:{text:"",icon:""},on:{click:e.comeBackPage}},[o("v-icon",[e._v("mdi-arrow-left")])],1):e._e(),e._v(" "),o("h1",{staticClass:"h1__theme"},[e._v(e._s(e.title))])],1)}),[],!1,null,"3f62119b",null);t.a=component.exports;f()(component,{VBtn:x.a,VIcon:d.a})},287:function(e,t,o){"use strict";var r=o(278);o.n(r).a},288:function(e,t,o){(t=o(22)(!1)).push([e.i,".h1__theme[data-v-3f62119b]{font-size:1.4444rem}#head__bar[data-v-3f62119b]{display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center;padding:1.2rem;position:relative;-webkit-box-align:center;align-items:center;background:transparent}[data-v-3f62119b] .btn-back{padding-right:2rem;margin-top:unset!important}[data-v-3f62119b] .btn-back .theme--light.v-icon{color:#60c;font-size:35px}[data-v-3f62119b] .btn-back{position:absolute;left:1rem}",""]),e.exports=t},289:function(e,t,o){(t=o(22)(!1)).push([e.i,".container.grow-shrink-0{-webkit-box-flex:0;flex-grow:0;flex-shrink:0}.container.fill-height{-webkit-box-align:center;align-items:center;display:-webkit-box;display:flex;flex-wrap:wrap}.container.fill-height>.row{-webkit-box-flex:1;flex:1 1 100%;max-width:100%}.container.fill-height>.layout{height:100%;-webkit-box-flex:1;flex:1 1 auto}.container.fill-height>.layout.grow-shrink-0{-webkit-box-flex:0;flex-grow:0;flex-shrink:0}.container.grid-list-xs .layout .flex{padding:1px}.container.grid-list-xs .layout:only-child{margin:-1px}.container.grid-list-xs .layout:not(:only-child){margin:auto -1px}.container.grid-list-xs :not(:only-child) .layout:first-child{margin-top:-1px}.container.grid-list-xs :not(:only-child) .layout:last-child{margin-bottom:-1px}.container.grid-list-sm .layout .flex{padding:2px}.container.grid-list-sm .layout:only-child{margin:-2px}.container.grid-list-sm .layout:not(:only-child){margin:auto -2px}.container.grid-list-sm :not(:only-child) .layout:first-child{margin-top:-2px}.container.grid-list-sm :not(:only-child) .layout:last-child{margin-bottom:-2px}.container.grid-list-md .layout .flex{padding:4px}.container.grid-list-md .layout:only-child{margin:-4px}.container.grid-list-md .layout:not(:only-child){margin:auto -4px}.container.grid-list-md :not(:only-child) .layout:first-child{margin-top:-4px}.container.grid-list-md :not(:only-child) .layout:last-child{margin-bottom:-4px}.container.grid-list-lg .layout .flex{padding:8px}.container.grid-list-lg .layout:only-child{margin:-8px}.container.grid-list-lg .layout:not(:only-child){margin:auto -8px}.container.grid-list-lg :not(:only-child) .layout:first-child{margin-top:-8px}.container.grid-list-lg :not(:only-child) .layout:last-child{margin-bottom:-8px}.container.grid-list-xl .layout .flex{padding:12px}.container.grid-list-xl .layout:only-child{margin:-12px}.container.grid-list-xl .layout:not(:only-child){margin:auto -12px}.container.grid-list-xl :not(:only-child) .layout:first-child{margin-top:-12px}.container.grid-list-xl :not(:only-child) .layout:last-child{margin-bottom:-12px}.layout{display:-webkit-box;display:flex;-webkit-box-flex:1;flex:1 1 auto;flex-wrap:nowrap;min-width:0}.layout.reverse{-webkit-box-orient:horizontal;-webkit-box-direction:reverse;flex-direction:row-reverse}.layout.column{-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}.layout.column.reverse{-webkit-box-orient:vertical;-webkit-box-direction:reverse;flex-direction:column-reverse}.layout.column>.flex{max-width:100%}.layout.wrap{flex-wrap:wrap}.layout.grow-shrink-0{-webkit-box-flex:0;flex-grow:0;flex-shrink:0}@media (min-width:0){.flex.xs12{flex-basis:100%;-webkit-box-flex:0;flex-grow:0;max-width:100%}.flex.order-xs12{-webkit-box-ordinal-group:13;order:12}.flex.xs11{flex-basis:91.6666666667%;-webkit-box-flex:0;flex-grow:0;max-width:91.6666666667%}.flex.order-xs11{-webkit-box-ordinal-group:12;order:11}.flex.xs10{flex-basis:83.3333333333%;-webkit-box-flex:0;flex-grow:0;max-width:83.3333333333%}.flex.order-xs10{-webkit-box-ordinal-group:11;order:10}.flex.xs9{flex-basis:75%;-webkit-box-flex:0;flex-grow:0;max-width:75%}.flex.order-xs9{-webkit-box-ordinal-group:10;order:9}.flex.xs8{flex-basis:66.6666666667%;-webkit-box-flex:0;flex-grow:0;max-width:66.6666666667%}.flex.order-xs8{-webkit-box-ordinal-group:9;order:8}.flex.xs7{flex-basis:58.3333333333%;-webkit-box-flex:0;flex-grow:0;max-width:58.3333333333%}.flex.order-xs7{-webkit-box-ordinal-group:8;order:7}.flex.xs6{flex-basis:50%;-webkit-box-flex:0;flex-grow:0;max-width:50%}.flex.order-xs6{-webkit-box-ordinal-group:7;order:6}.flex.xs5{flex-basis:41.6666666667%;-webkit-box-flex:0;flex-grow:0;max-width:41.6666666667%}.flex.order-xs5{-webkit-box-ordinal-group:6;order:5}.flex.xs4{flex-basis:33.3333333333%;-webkit-box-flex:0;flex-grow:0;max-width:33.3333333333%}.flex.order-xs4{-webkit-box-ordinal-group:5;order:4}.flex.xs3{flex-basis:25%;-webkit-box-flex:0;flex-grow:0;max-width:25%}.flex.order-xs3{-webkit-box-ordinal-group:4;order:3}.flex.xs2{flex-basis:16.6666666667%;-webkit-box-flex:0;flex-grow:0;max-width:16.6666666667%}.flex.order-xs2{-webkit-box-ordinal-group:3;order:2}.flex.xs1{flex-basis:8.3333333333%;-webkit-box-flex:0;flex-grow:0;max-width:8.3333333333%}.flex.order-xs1{-webkit-box-ordinal-group:2;order:1}.flex.offset-xs12{margin-left:100%}.flex.offset-xs11{margin-left:91.6666666667%}.flex.offset-xs10{margin-left:83.3333333333%}.flex.offset-xs9{margin-left:75%}.flex.offset-xs8{margin-left:66.6666666667%}.flex.offset-xs7{margin-left:58.3333333333%}.flex.offset-xs6{margin-left:50%}.flex.offset-xs5{margin-left:41.6666666667%}.flex.offset-xs4{margin-left:33.3333333333%}.flex.offset-xs3{margin-left:25%}.flex.offset-xs2{margin-left:16.6666666667%}.flex.offset-xs1{margin-left:8.3333333333%}.flex.offset-xs0{margin-left:0}}@media (min-width:600px){.flex.sm12{flex-basis:100%;-webkit-box-flex:0;flex-grow:0;max-width:100%}.flex.order-sm12{-webkit-box-ordinal-group:13;order:12}.flex.sm11{flex-basis:91.6666666667%;-webkit-box-flex:0;flex-grow:0;max-width:91.6666666667%}.flex.order-sm11{-webkit-box-ordinal-group:12;order:11}.flex.sm10{flex-basis:83.3333333333%;-webkit-box-flex:0;flex-grow:0;max-width:83.3333333333%}.flex.order-sm10{-webkit-box-ordinal-group:11;order:10}.flex.sm9{flex-basis:75%;-webkit-box-flex:0;flex-grow:0;max-width:75%}.flex.order-sm9{-webkit-box-ordinal-group:10;order:9}.flex.sm8{flex-basis:66.6666666667%;-webkit-box-flex:0;flex-grow:0;max-width:66.6666666667%}.flex.order-sm8{-webkit-box-ordinal-group:9;order:8}.flex.sm7{flex-basis:58.3333333333%;-webkit-box-flex:0;flex-grow:0;max-width:58.3333333333%}.flex.order-sm7{-webkit-box-ordinal-group:8;order:7}.flex.sm6{flex-basis:50%;-webkit-box-flex:0;flex-grow:0;max-width:50%}.flex.order-sm6{-webkit-box-ordinal-group:7;order:6}.flex.sm5{flex-basis:41.6666666667%;-webkit-box-flex:0;flex-grow:0;max-width:41.6666666667%}.flex.order-sm5{-webkit-box-ordinal-group:6;order:5}.flex.sm4{flex-basis:33.3333333333%;-webkit-box-flex:0;flex-grow:0;max-width:33.3333333333%}.flex.order-sm4{-webkit-box-ordinal-group:5;order:4}.flex.sm3{flex-basis:25%;-webkit-box-flex:0;flex-grow:0;max-width:25%}.flex.order-sm3{-webkit-box-ordinal-group:4;order:3}.flex.sm2{flex-basis:16.6666666667%;-webkit-box-flex:0;flex-grow:0;max-width:16.6666666667%}.flex.order-sm2{-webkit-box-ordinal-group:3;order:2}.flex.sm1{flex-basis:8.3333333333%;-webkit-box-flex:0;flex-grow:0;max-width:8.3333333333%}.flex.order-sm1{-webkit-box-ordinal-group:2;order:1}.flex.offset-sm12{margin-left:100%}.flex.offset-sm11{margin-left:91.6666666667%}.flex.offset-sm10{margin-left:83.3333333333%}.flex.offset-sm9{margin-left:75%}.flex.offset-sm8{margin-left:66.6666666667%}.flex.offset-sm7{margin-left:58.3333333333%}.flex.offset-sm6{margin-left:50%}.flex.offset-sm5{margin-left:41.6666666667%}.flex.offset-sm4{margin-left:33.3333333333%}.flex.offset-sm3{margin-left:25%}.flex.offset-sm2{margin-left:16.6666666667%}.flex.offset-sm1{margin-left:8.3333333333%}.flex.offset-sm0{margin-left:0}}@media (min-width:960px){.flex.md12{flex-basis:100%;-webkit-box-flex:0;flex-grow:0;max-width:100%}.flex.order-md12{-webkit-box-ordinal-group:13;order:12}.flex.md11{flex-basis:91.6666666667%;-webkit-box-flex:0;flex-grow:0;max-width:91.6666666667%}.flex.order-md11{-webkit-box-ordinal-group:12;order:11}.flex.md10{flex-basis:83.3333333333%;-webkit-box-flex:0;flex-grow:0;max-width:83.3333333333%}.flex.order-md10{-webkit-box-ordinal-group:11;order:10}.flex.md9{flex-basis:75%;-webkit-box-flex:0;flex-grow:0;max-width:75%}.flex.order-md9{-webkit-box-ordinal-group:10;order:9}.flex.md8{flex-basis:66.6666666667%;-webkit-box-flex:0;flex-grow:0;max-width:66.6666666667%}.flex.order-md8{-webkit-box-ordinal-group:9;order:8}.flex.md7{flex-basis:58.3333333333%;-webkit-box-flex:0;flex-grow:0;max-width:58.3333333333%}.flex.order-md7{-webkit-box-ordinal-group:8;order:7}.flex.md6{flex-basis:50%;-webkit-box-flex:0;flex-grow:0;max-width:50%}.flex.order-md6{-webkit-box-ordinal-group:7;order:6}.flex.md5{flex-basis:41.6666666667%;-webkit-box-flex:0;flex-grow:0;max-width:41.6666666667%}.flex.order-md5{-webkit-box-ordinal-group:6;order:5}.flex.md4{flex-basis:33.3333333333%;-webkit-box-flex:0;flex-grow:0;max-width:33.3333333333%}.flex.order-md4{-webkit-box-ordinal-group:5;order:4}.flex.md3{flex-basis:25%;-webkit-box-flex:0;flex-grow:0;max-width:25%}.flex.order-md3{-webkit-box-ordinal-group:4;order:3}.flex.md2{flex-basis:16.6666666667%;-webkit-box-flex:0;flex-grow:0;max-width:16.6666666667%}.flex.order-md2{-webkit-box-ordinal-group:3;order:2}.flex.md1{flex-basis:8.3333333333%;-webkit-box-flex:0;flex-grow:0;max-width:8.3333333333%}.flex.order-md1{-webkit-box-ordinal-group:2;order:1}.flex.offset-md12{margin-left:100%}.flex.offset-md11{margin-left:91.6666666667%}.flex.offset-md10{margin-left:83.3333333333%}.flex.offset-md9{margin-left:75%}.flex.offset-md8{margin-left:66.6666666667%}.flex.offset-md7{margin-left:58.3333333333%}.flex.offset-md6{margin-left:50%}.flex.offset-md5{margin-left:41.6666666667%}.flex.offset-md4{margin-left:33.3333333333%}.flex.offset-md3{margin-left:25%}.flex.offset-md2{margin-left:16.6666666667%}.flex.offset-md1{margin-left:8.3333333333%}.flex.offset-md0{margin-left:0}}@media (min-width:1264px){.flex.lg12{flex-basis:100%;-webkit-box-flex:0;flex-grow:0;max-width:100%}.flex.order-lg12{-webkit-box-ordinal-group:13;order:12}.flex.lg11{flex-basis:91.6666666667%;-webkit-box-flex:0;flex-grow:0;max-width:91.6666666667%}.flex.order-lg11{-webkit-box-ordinal-group:12;order:11}.flex.lg10{flex-basis:83.3333333333%;-webkit-box-flex:0;flex-grow:0;max-width:83.3333333333%}.flex.order-lg10{-webkit-box-ordinal-group:11;order:10}.flex.lg9{flex-basis:75%;-webkit-box-flex:0;flex-grow:0;max-width:75%}.flex.order-lg9{-webkit-box-ordinal-group:10;order:9}.flex.lg8{flex-basis:66.6666666667%;-webkit-box-flex:0;flex-grow:0;max-width:66.6666666667%}.flex.order-lg8{-webkit-box-ordinal-group:9;order:8}.flex.lg7{flex-basis:58.3333333333%;-webkit-box-flex:0;flex-grow:0;max-width:58.3333333333%}.flex.order-lg7{-webkit-box-ordinal-group:8;order:7}.flex.lg6{flex-basis:50%;-webkit-box-flex:0;flex-grow:0;max-width:50%}.flex.order-lg6{-webkit-box-ordinal-group:7;order:6}.flex.lg5{flex-basis:41.6666666667%;-webkit-box-flex:0;flex-grow:0;max-width:41.6666666667%}.flex.order-lg5{-webkit-box-ordinal-group:6;order:5}.flex.lg4{flex-basis:33.3333333333%;-webkit-box-flex:0;flex-grow:0;max-width:33.3333333333%}.flex.order-lg4{-webkit-box-ordinal-group:5;order:4}.flex.lg3{flex-basis:25%;-webkit-box-flex:0;flex-grow:0;max-width:25%}.flex.order-lg3{-webkit-box-ordinal-group:4;order:3}.flex.lg2{flex-basis:16.6666666667%;-webkit-box-flex:0;flex-grow:0;max-width:16.6666666667%}.flex.order-lg2{-webkit-box-ordinal-group:3;order:2}.flex.lg1{flex-basis:8.3333333333%;-webkit-box-flex:0;flex-grow:0;max-width:8.3333333333%}.flex.order-lg1{-webkit-box-ordinal-group:2;order:1}.flex.offset-lg12{margin-left:100%}.flex.offset-lg11{margin-left:91.6666666667%}.flex.offset-lg10{margin-left:83.3333333333%}.flex.offset-lg9{margin-left:75%}.flex.offset-lg8{margin-left:66.6666666667%}.flex.offset-lg7{margin-left:58.3333333333%}.flex.offset-lg6{margin-left:50%}.flex.offset-lg5{margin-left:41.6666666667%}.flex.offset-lg4{margin-left:33.3333333333%}.flex.offset-lg3{margin-left:25%}.flex.offset-lg2{margin-left:16.6666666667%}.flex.offset-lg1{margin-left:8.3333333333%}.flex.offset-lg0{margin-left:0}}@media (min-width:1904px){.flex.xl12{flex-basis:100%;-webkit-box-flex:0;flex-grow:0;max-width:100%}.flex.order-xl12{-webkit-box-ordinal-group:13;order:12}.flex.xl11{flex-basis:91.6666666667%;-webkit-box-flex:0;flex-grow:0;max-width:91.6666666667%}.flex.order-xl11{-webkit-box-ordinal-group:12;order:11}.flex.xl10{flex-basis:83.3333333333%;-webkit-box-flex:0;flex-grow:0;max-width:83.3333333333%}.flex.order-xl10{-webkit-box-ordinal-group:11;order:10}.flex.xl9{flex-basis:75%;-webkit-box-flex:0;flex-grow:0;max-width:75%}.flex.order-xl9{-webkit-box-ordinal-group:10;order:9}.flex.xl8{flex-basis:66.6666666667%;-webkit-box-flex:0;flex-grow:0;max-width:66.6666666667%}.flex.order-xl8{-webkit-box-ordinal-group:9;order:8}.flex.xl7{flex-basis:58.3333333333%;-webkit-box-flex:0;flex-grow:0;max-width:58.3333333333%}.flex.order-xl7{-webkit-box-ordinal-group:8;order:7}.flex.xl6{flex-basis:50%;-webkit-box-flex:0;flex-grow:0;max-width:50%}.flex.order-xl6{-webkit-box-ordinal-group:7;order:6}.flex.xl5{flex-basis:41.6666666667%;-webkit-box-flex:0;flex-grow:0;max-width:41.6666666667%}.flex.order-xl5{-webkit-box-ordinal-group:6;order:5}.flex.xl4{flex-basis:33.3333333333%;-webkit-box-flex:0;flex-grow:0;max-width:33.3333333333%}.flex.order-xl4{-webkit-box-ordinal-group:5;order:4}.flex.xl3{flex-basis:25%;-webkit-box-flex:0;flex-grow:0;max-width:25%}.flex.order-xl3{-webkit-box-ordinal-group:4;order:3}.flex.xl2{flex-basis:16.6666666667%;-webkit-box-flex:0;flex-grow:0;max-width:16.6666666667%}.flex.order-xl2{-webkit-box-ordinal-group:3;order:2}.flex.xl1{flex-basis:8.3333333333%;-webkit-box-flex:0;flex-grow:0;max-width:8.3333333333%}.flex.order-xl1{-webkit-box-ordinal-group:2;order:1}.flex.offset-xl12{margin-left:100%}.flex.offset-xl11{margin-left:91.6666666667%}.flex.offset-xl10{margin-left:83.3333333333%}.flex.offset-xl9{margin-left:75%}.flex.offset-xl8{margin-left:66.6666666667%}.flex.offset-xl7{margin-left:58.3333333333%}.flex.offset-xl6{margin-left:50%}.flex.offset-xl5{margin-left:41.6666666667%}.flex.offset-xl4{margin-left:33.3333333333%}.flex.offset-xl3{margin-left:25%}.flex.offset-xl2{margin-left:16.6666666667%}.flex.offset-xl1{margin-left:8.3333333333%}.flex.offset-xl0{margin-left:0}}.child-flex>*,.flex{-webkit-box-flex:1;flex:1 1 auto;max-width:100%}.child-flex>.grow-shrink-0,.flex.grow-shrink-0{-webkit-box-flex:0;flex-grow:0;flex-shrink:0}.grow,.spacer{-webkit-box-flex:1!important;flex-grow:1!important}.grow{flex-shrink:0!important}.shrink{-webkit-box-flex:0!important;flex-grow:0!important;flex-shrink:1!important}.fill-height{height:100%}",""]),e.exports=t},292:function(e,t,o){"use strict";o.d(t,"a",(function(){return w}));o(19);var r=o(3),l=(o(5),o(11),o(12)),n=(o(62),o(9),o(36),o(6),o(7));function f(object,e){var t=Object.keys(object);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(object);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(object,e).enumerable}))),t.push.apply(t,o)}return t}function x(e){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?f(Object(source),!0).forEach((function(t){Object(r.a)(e,t,source[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(source)):f(Object(source)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(source,t))}))}return e}var d=/;(?![^(]*\))/g,c=/:(.*)/;function m(style){var e={},t=!0,o=!1,r=void 0;try{for(var f,x=style.split(d)[Symbol.iterator]();!(t=(f=x.next()).done);t=!0){var m=f.value.split(c),w=Object(l.a)(m,2),h=w[0],k=w[1];(h=h.trim())&&("string"==typeof k&&(k=k.trim()),e[Object(n.c)(h)]=k)}}catch(e){o=!0,r=e}finally{try{t||null==x.return||x.return()}finally{if(o)throw r}}return e}function w(){for(var e,t,o={},i=arguments.length;i--;)for(var r=0,l=Object.keys(arguments[i]);r<l.length;r++)switch(e=l[r]){case"class":case"style":case"directives":if(Array.isArray(o[e])||(o[e]=[]),"style"===e){var style=void 0;style=Array.isArray(arguments[i].style)?arguments[i].style:[arguments[i].style];for(var n=0;n<style.length;n++){var s=style[n];"string"==typeof s&&(style[n]=m(s))}arguments[i].style=style}o[e]=o[e].concat(arguments[i][e]);break;case"staticClass":if(!arguments[i][e])break;void 0===o[e]&&(o[e]=""),o[e]&&(o[e]+=" "),o[e]+=arguments[i][e].trim();break;case"on":case"nativeOn":o[e]||(o[e]={});for(var f=o[e],d=0,c=Object.keys(arguments[i][e]||{});d<c.length;d++)f[t=c[d]]?f[t]=Array().concat(f[t],arguments[i][e][t]):f[t]=arguments[i][e][t];break;case"attrs":case"props":case"domProps":case"scopedSlots":case"staticStyle":case"hook":case"transition":o[e]||(o[e]={}),o[e]=x({},arguments[i][e],{},o[e]);break;case"slot":case"key":case"ref":case"tag":case"show":case"keepAlive":default:o[e]||(o[e]=arguments[i][e])}return o}},300:function(e,t,o){"use strict";o(284);var r=o(285);t.a=Object(r.a)("layout")},310:function(e,t,o){"use strict";o(284);var r=o(285);t.a=Object(r.a)("flex")},340:function(e,t,o){var content=o(459);"string"==typeof content&&(content=[[e.i,content,""]]),content.locals&&(e.exports=content.locals);(0,o(23).default)("2ed54025",content,!0,{sourceMap:!1})},341:function(e,t){},458:function(e,t,o){"use strict";var r=o(340);o.n(r).a},459:function(e,t,o){(t=o(22)(!1)).push([e.i,"#page h1[data-v-68338999],#page p[data-v-68338999]{color:#60c;text-transform:uppercase}",""]),e.exports=t},460:function(e,t,o){"use strict";var r=o(341),l=o.n(r);t.default=l.a},614:function(e,t,o){"use strict";o.r(t);o(36);var r=o(279),l=o(286),n=o(290),f=o.n(n),x={components:{HeaderBar:l.a,Avatar:f.a,NavigationBar:r.a},methods:{goToChangePassword:function(){$nuxt._router.push("/admin/alterar-senha")},goToChangeData:function(){$nuxt._router.push("/admin/alterar")},goToExit:function(){localStorage.clear(),$nuxt._router.push("/login"),this.clearInfoUser()}},computed:{user:function(){return this.$store.state.user.data}},filters:{simplifyName:function(e){if(!e)return"";return e.split(" ").length>2?/^(\S*\s+\S+).*/.exec(e)[1]:e}}},d=(o(458),o(39)),c=o(460),m=o(43),w=o.n(m),h=o(272),k=o(597),v=o(414),y=o(310),_=o(268),O=o(300),j=o(599),component=Object(d.a)(x,(function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{attrs:{id:"page"}},[o("HeaderBar",{attrs:{title:"Meu Perfil",backPage:!0}}),e._v(" "),o("v-layout",{attrs:{"align-center":"","justify-center":""}},[o("v-flex",{ref:"flex",staticStyle:{"text-align":"-webkit-center"},attrs:{role:"main",xs10:"",sm8:"",md4:""}},[o("v-container",[o("v-row",[o("v-col",{attrs:{cols:"12"}},[o("avatar",{attrs:{username:e._f("simplifyName")(e.user.name),size:150}})],1),e._v(" "),o("v-col",{attrs:{cols:"12"}},[o("h1",[e._v(e._s(e.user.name))]),e._v(" "),o("p",[e._v("Administrador")])]),e._v(" "),o("v-col",{attrs:{cols:"12"}},[o("v-btn",{attrs:{large:"",color:"#6600cc",outlined:"",block:""},on:{click:e.goToChangePassword}},[e._v("\n Alterar Senha"),o("v-icon",{attrs:{right:""}},[e._v("mdi-key")])],1)],1),e._v(" "),o("v-col",{attrs:{cols:"12"}},[o("v-btn",{attrs:{large:"",color:"#6600cc",outlined:"",block:""},on:{click:e.goToChangeData}},[e._v("\n Alterar Dados"),o("v-icon",{attrs:{right:""}},[e._v("mdi-pencil")])],1)],1),e._v(" "),o("v-col",{attrs:{cols:"12"}},[o("v-btn",{attrs:{large:"",color:"red",outlined:"",block:""},on:{click:e.goToExit}},[e._v("\n Sair"),o("v-icon",{attrs:{right:""}},[e._v("mdi-exit-to-app")])],1)],1)],1)],1)],1)],1),e._v(" "),o("client-only",[o("navigation-bar")],1)],1)}),[],!1,null,"68338999",null);"function"==typeof c.default&&Object(c.default)(component);t.default=component.exports;w()(component,{VBtn:h.a,VCol:k.a,VContainer:v.a,VFlex:y.a,VIcon:_.a,VLayout:O.a,VRow:j.a})}}]); | 29,956 | 29,956 | 0.725931 |
c86ec849f3d370b37df52300607c1c0d0f0bff3d | 29 | js | JavaScript | src/axes/index.js | yoshiso/react-financial-chart | 199aa60513395575c4dc30beb2d32b11ed684634 | [
"MIT"
] | null | null | null | src/axes/index.js | yoshiso/react-financial-chart | 199aa60513395575c4dc30beb2d32b11ed684634 | [
"MIT"
] | null | null | null | src/axes/index.js | yoshiso/react-financial-chart | 199aa60513395575c4dc30beb2d32b11ed684634 | [
"MIT"
] | null | null | null | export XAxis from './XAxis';
| 14.5 | 28 | 0.689655 |
c86f165fe1c6cbf3433622e80687b19da94e195b | 2,813 | js | JavaScript | src/ledger/parse/transaction.js | callchain/call-lib-all | 0a3f32297e150fb120dceaefb989af10af42fa3e | [
"ISC"
] | 1 | 2018-05-24T07:27:33.000Z | 2018-05-24T07:27:33.000Z | src/ledger/parse/transaction.js | callchain/call-lib | afd1e1738d990a4007843a5218352875450ae76b | [
"0BSD"
] | 4 | 2019-01-18T02:32:11.000Z | 2020-08-12T04:16:11.000Z | src/ledger/parse/transaction.js | callchain/call-lib-all | 0a3f32297e150fb120dceaefb989af10af42fa3e | [
"ISC"
] | 3 | 2018-11-15T02:55:07.000Z | 2019-09-11T06:36:56.000Z | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var assert = require("assert");
var utils_1 = require("./utils");
var common_1 = require("../../common");
var payment_1 = require("./payment");
var trustline_1 = require("./trustline");
var order_1 = require("./order");
var cancellation_1 = require("./cancellation");
var settings_1 = require("./settings");
var escrow_creation_1 = require("./escrow-creation");
var escrow_execution_1 = require("./escrow-execution");
var escrow_cancellation_1 = require("./escrow-cancellation");
var payment_channel_create_1 = require("./payment-channel-create");
var payment_channel_fund_1 = require("./payment-channel-fund");
var payment_channel_claim_1 = require("./payment-channel-claim");
var fee_update_1 = require("./fee-update");
var amendment_1 = require("./amendment");
function parseTransactionType(type) {
var mapping = {
Payment: 'payment',
TrustSet: 'trustline',
OfferCreate: 'order',
OfferCancel: 'orderCancellation',
AccountSet: 'settings',
SetRegularKey: 'settings',
EscrowCreate: 'escrowCreation',
EscrowFinish: 'escrowExecution',
EscrowCancel: 'escrowCancellation',
PaymentChannelCreate: 'paymentChannelCreate',
PaymentChannelFund: 'paymentChannelFund',
PaymentChannelClaim: 'paymentChannelClaim',
SignerListSet: 'settings',
SetFee: 'feeUpdate',
EnableAmendment: 'amendment' // pseudo-transaction
};
return mapping[type] || null;
}
function parseTransaction(tx) {
var type = parseTransactionType(tx.TransactionType);
var mapping = {
'payment': payment_1.default,
'trustline': trustline_1.default,
'order': order_1.default,
'orderCancellation': cancellation_1.default,
'settings': settings_1.default,
'escrowCreation': escrow_creation_1.default,
'escrowExecution': escrow_execution_1.default,
'escrowCancellation': escrow_cancellation_1.default,
'paymentChannelCreate': payment_channel_create_1.default,
'paymentChannelFund': payment_channel_fund_1.default,
'paymentChannelClaim': payment_channel_claim_1.default,
'feeUpdate': fee_update_1.default,
'amendment': amendment_1.default
};
var parser = mapping[type];
assert(parser !== undefined, 'Unrecognized transaction type');
var specification = parser(tx);
var outcome = utils_1.parseOutcome(tx);
return common_1.removeUndefined({
type: type,
address: tx.Account,
sequence: tx.Sequence,
id: tx.hash,
specification: common_1.removeUndefined(specification),
outcome: outcome ? common_1.removeUndefined(outcome) : undefined
});
}
exports.default = parseTransaction;
| 40.185714 | 72 | 0.688944 |
c86fb086042d85c0c07694fba50059a9ae49bea6 | 2,031 | js | JavaScript | frontend/src/components/InventorySelector.js | INSRapperswil/nornir-web | 458e6b24bc373197044b4b7b5da74f16f93a9459 | [
"MIT"
] | 2 | 2021-06-01T08:33:04.000Z | 2021-08-20T04:22:39.000Z | frontend/src/components/InventorySelector.js | INSRapperswil/nornir-web | 458e6b24bc373197044b4b7b5da74f16f93a9459 | [
"MIT"
] | null | null | null | frontend/src/components/InventorySelector.js | INSRapperswil/nornir-web | 458e6b24bc373197044b4b7b5da74f16f93a9459 | [
"MIT"
] | null | null | null | import React, { useState, useEffect } from 'react';
import { connect } from 'react-redux';
import { FormControl, InputLabel, MenuItem, Select } from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';
import { getInventoryList } from '../api';
import { checkAndGetToken, updateInventorySelection } from '../redux/actions';
import { getInventorySelectionId } from '../redux/reducers';
function InventorySelector({ checkAndGetToken, inventory, onInventoryChange, updateInventorySelection }) {
let [inventoryList, setInventoryList] = useState([{ "id": 1, "name": "Loading...", "notLoaded": true }]);
useEffect(() => {
if (inventoryList[0].notLoaded) {
checkAndGetToken().then((token) => {
getInventoryList(token).then((response) => setInventoryList(response.results));
});
}
}, [checkAndGetToken, inventoryList, setInventoryList]);
const useStyles = makeStyles({
formControl: {
minWidth: 240,
},
});
const handleChange = (event) => {
updateInventorySelection({ inventory: event.target.value });
onInventoryChange(event.target.value);
};
const classes = useStyles();
return (
<FormControl variant="outlined" className={classes.formControl}>
<InputLabel id="inventory-select-label">Inventory</InputLabel>
<Select
labelId="inventory-select-label"
id="inventory-select"
onChange={handleChange}
value={inventory}
label="Inventory"
>
{Object.keys(inventoryList).map((key) => (
<MenuItem key={inventoryList[key].id} value={inventoryList[key].id}>{inventoryList[key].name}</MenuItem>
))}
</Select>
</FormControl>
)
}
const mapStateToProps = (state) => {
return {
inventory: getInventorySelectionId(state),
};
};
const mapDispatchToProps = {
checkAndGetToken,
updateInventorySelection,
}
export default connect(mapStateToProps, mapDispatchToProps)(InventorySelector); | 32.238095 | 115 | 0.655835 |
c86fd2dbd4ddb5dfc106a12610efc9358be1a788 | 45,836 | js | JavaScript | Navbar-App/output/polyfills.js | TJSTONE99/Angular-elements-tracer | e2fae92d076c5e7148988f2afea69e3fee7b9946 | [
"MIT"
] | null | null | null | Navbar-App/output/polyfills.js | TJSTONE99/Angular-elements-tracer | e2fae92d076c5e7148988f2afea69e3fee7b9946 | [
"MIT"
] | null | null | null | Navbar-App/output/polyfills.js | TJSTONE99/Angular-elements-tracer | e2fae92d076c5e7148988f2afea69e3fee7b9946 | [
"MIT"
] | null | null | null | !function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,(function(t){return e[t]}).bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}({"0TWp":function(e,t,n){var r,o;void 0===(o="function"==typeof(r=function(){"use strict";!function(e){var t=e.performance;function n(e){t&&t.mark&&t.mark(e)}function r(e,n){t&&t.measure&&t.measure(e,n)}n("Zone");var o=e.__Zone_symbol_prefix||"__zone_symbol__";function a(e){return o+e}var i=!0===e[a("forceDuplicateZoneCheck")];if(e.Zone){if(i||"function"!=typeof e.Zone.__symbol__)throw new Error("Zone already loaded.");return e.Zone}var c=function(){function t(e,t){this._parent=e,this._name=t?t.name||"unnamed":"<root>",this._properties=t&&t.properties||{},this._zoneDelegate=new l(this,this._parent&&this._parent._zoneDelegate,t)}return t.assertZonePatched=function(){if(e.Promise!==D.ZoneAwarePromise)throw new Error("Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.\nMost likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)")},Object.defineProperty(t,"root",{get:function(){for(var e=t.current;e.parent;)e=e.parent;return e},enumerable:!0,configurable:!0}),Object.defineProperty(t,"current",{get:function(){return C.zone},enumerable:!0,configurable:!0}),Object.defineProperty(t,"currentTask",{get:function(){return z},enumerable:!0,configurable:!0}),t.__load_patch=function(o,a){if(D.hasOwnProperty(o)){if(i)throw Error("Already loaded patch: "+o)}else if(!e["__Zone_disable_"+o]){var c="Zone:"+o;n(c),D[o]=a(e,t,j),r(c,c)}},Object.defineProperty(t.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),t.prototype.get=function(e){var t=this.getZoneWith(e);if(t)return t._properties[e]},t.prototype.getZoneWith=function(e){for(var t=this;t;){if(t._properties.hasOwnProperty(e))return t;t=t._parent}return null},t.prototype.fork=function(e){if(!e)throw new Error("ZoneSpec required!");return this._zoneDelegate.fork(this,e)},t.prototype.wrap=function(e,t){if("function"!=typeof e)throw new Error("Expecting function got: "+e);var n=this._zoneDelegate.intercept(this,e,t),r=this;return function(){return r.runGuarded(n,this,arguments,t)}},t.prototype.run=function(e,t,n,r){C={parent:C,zone:this};try{return this._zoneDelegate.invoke(this,e,t,n,r)}finally{C=C.parent}},t.prototype.runGuarded=function(e,t,n,r){void 0===t&&(t=null),C={parent:C,zone:this};try{try{return this._zoneDelegate.invoke(this,e,t,n,r)}catch(o){if(this._zoneDelegate.handleError(this,o))throw o}}finally{C=C.parent}},t.prototype.runTask=function(e,t,n){if(e.zone!=this)throw new Error("A task can only be run in the zone of creation! (Creation: "+(e.zone||m).name+"; Execution: "+this.name+")");if(e.state!==b||e.type!==Z&&e.type!==P){var r=e.state!=E;r&&e._transitionTo(E,T),e.runCount++;var o=z;z=e,C={parent:C,zone:this};try{e.type==P&&e.data&&!e.data.isPeriodic&&(e.cancelFn=void 0);try{return this._zoneDelegate.invokeTask(this,e,t,n)}catch(a){if(this._zoneDelegate.handleError(this,a))throw a}}finally{e.state!==b&&e.state!==S&&(e.type==Z||e.data&&e.data.isPeriodic?r&&e._transitionTo(T,E):(e.runCount=0,this._updateTaskCount(e,-1),r&&e._transitionTo(b,E,b))),C=C.parent,z=o}}},t.prototype.scheduleTask=function(e){if(e.zone&&e.zone!==this)for(var t=this;t;){if(t===e.zone)throw Error("can not reschedule task to "+this.name+" which is descendants of the original zone "+e.zone.name);t=t.parent}e._transitionTo(k,b);var n=[];e._zoneDelegates=n,e._zone=this;try{e=this._zoneDelegate.scheduleTask(this,e)}catch(r){throw e._transitionTo(S,k,b),this._zoneDelegate.handleError(this,r),r}return e._zoneDelegates===n&&this._updateTaskCount(e,1),e.state==k&&e._transitionTo(T,k),e},t.prototype.scheduleMicroTask=function(e,t,n,r){return this.scheduleTask(new f(O,e,t,n,r,void 0))},t.prototype.scheduleMacroTask=function(e,t,n,r,o){return this.scheduleTask(new f(P,e,t,n,r,o))},t.prototype.scheduleEventTask=function(e,t,n,r,o){return this.scheduleTask(new f(Z,e,t,n,r,o))},t.prototype.cancelTask=function(e){if(e.zone!=this)throw new Error("A task can only be cancelled in the zone of creation! (Creation: "+(e.zone||m).name+"; Execution: "+this.name+")");e._transitionTo(w,T,E);try{this._zoneDelegate.cancelTask(this,e)}catch(t){throw e._transitionTo(S,w),this._zoneDelegate.handleError(this,t),t}return this._updateTaskCount(e,-1),e._transitionTo(b,w),e.runCount=0,e},t.prototype._updateTaskCount=function(e,t){var n=e._zoneDelegates;-1==t&&(e._zoneDelegates=null);for(var r=0;r<n.length;r++)n[r]._updateTaskCount(e.type,t)},t}();c.__symbol__=a;var s,u={name:"",onHasTask:function(e,t,n,r){return e.hasTask(n,r)},onScheduleTask:function(e,t,n,r){return e.scheduleTask(n,r)},onInvokeTask:function(e,t,n,r,o,a){return e.invokeTask(n,r,o,a)},onCancelTask:function(e,t,n,r){return e.cancelTask(n,r)}},l=function(){function e(e,t,n){this._taskCounts={microTask:0,macroTask:0,eventTask:0},this.zone=e,this._parentDelegate=t,this._forkZS=n&&(n&&n.onFork?n:t._forkZS),this._forkDlgt=n&&(n.onFork?t:t._forkDlgt),this._forkCurrZone=n&&(n.onFork?this.zone:t._forkCurrZone),this._interceptZS=n&&(n.onIntercept?n:t._interceptZS),this._interceptDlgt=n&&(n.onIntercept?t:t._interceptDlgt),this._interceptCurrZone=n&&(n.onIntercept?this.zone:t._interceptCurrZone),this._invokeZS=n&&(n.onInvoke?n:t._invokeZS),this._invokeDlgt=n&&(n.onInvoke?t:t._invokeDlgt),this._invokeCurrZone=n&&(n.onInvoke?this.zone:t._invokeCurrZone),this._handleErrorZS=n&&(n.onHandleError?n:t._handleErrorZS),this._handleErrorDlgt=n&&(n.onHandleError?t:t._handleErrorDlgt),this._handleErrorCurrZone=n&&(n.onHandleError?this.zone:t._handleErrorCurrZone),this._scheduleTaskZS=n&&(n.onScheduleTask?n:t._scheduleTaskZS),this._scheduleTaskDlgt=n&&(n.onScheduleTask?t:t._scheduleTaskDlgt),this._scheduleTaskCurrZone=n&&(n.onScheduleTask?this.zone:t._scheduleTaskCurrZone),this._invokeTaskZS=n&&(n.onInvokeTask?n:t._invokeTaskZS),this._invokeTaskDlgt=n&&(n.onInvokeTask?t:t._invokeTaskDlgt),this._invokeTaskCurrZone=n&&(n.onInvokeTask?this.zone:t._invokeTaskCurrZone),this._cancelTaskZS=n&&(n.onCancelTask?n:t._cancelTaskZS),this._cancelTaskDlgt=n&&(n.onCancelTask?t:t._cancelTaskDlgt),this._cancelTaskCurrZone=n&&(n.onCancelTask?this.zone:t._cancelTaskCurrZone),this._hasTaskZS=null,this._hasTaskDlgt=null,this._hasTaskDlgtOwner=null,this._hasTaskCurrZone=null;var r=n&&n.onHasTask;(r||t&&t._hasTaskZS)&&(this._hasTaskZS=r?n:u,this._hasTaskDlgt=t,this._hasTaskDlgtOwner=this,this._hasTaskCurrZone=e,n.onScheduleTask||(this._scheduleTaskZS=u,this._scheduleTaskDlgt=t,this._scheduleTaskCurrZone=this.zone),n.onInvokeTask||(this._invokeTaskZS=u,this._invokeTaskDlgt=t,this._invokeTaskCurrZone=this.zone),n.onCancelTask||(this._cancelTaskZS=u,this._cancelTaskDlgt=t,this._cancelTaskCurrZone=this.zone))}return e.prototype.fork=function(e,t){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,e,t):new c(e,t)},e.prototype.intercept=function(e,t,n){return this._interceptZS?this._interceptZS.onIntercept(this._interceptDlgt,this._interceptCurrZone,e,t,n):t},e.prototype.invoke=function(e,t,n,r,o){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this._invokeCurrZone,e,t,n,r,o):t.apply(n,r)},e.prototype.handleError=function(e,t){return!this._handleErrorZS||this._handleErrorZS.onHandleError(this._handleErrorDlgt,this._handleErrorCurrZone,e,t)},e.prototype.scheduleTask=function(e,t){var n=t;if(this._scheduleTaskZS)this._hasTaskZS&&n._zoneDelegates.push(this._hasTaskDlgtOwner),(n=this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt,this._scheduleTaskCurrZone,e,t))||(n=t);else if(t.scheduleFn)t.scheduleFn(t);else{if(t.type!=O)throw new Error("Task is missing scheduleFn.");y(t)}return n},e.prototype.invokeTask=function(e,t,n,r){return this._invokeTaskZS?this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt,this._invokeTaskCurrZone,e,t,n,r):t.callback.apply(n,r)},e.prototype.cancelTask=function(e,t){var n;if(this._cancelTaskZS)n=this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt,this._cancelTaskCurrZone,e,t);else{if(!t.cancelFn)throw Error("Task is not cancelable");n=t.cancelFn(t)}return n},e.prototype.hasTask=function(e,t){try{this._hasTaskZS&&this._hasTaskZS.onHasTask(this._hasTaskDlgt,this._hasTaskCurrZone,e,t)}catch(n){this.handleError(e,n)}},e.prototype._updateTaskCount=function(e,t){var n=this._taskCounts,r=n[e],o=n[e]=r+t;if(o<0)throw new Error("More tasks executed then were scheduled.");0!=r&&0!=o||this.hasTask(this.zone,{microTask:n.microTask>0,macroTask:n.macroTask>0,eventTask:n.eventTask>0,change:e})},e}(),f=function(){function t(n,r,o,a,i,c){if(this._zone=null,this.runCount=0,this._zoneDelegates=null,this._state="notScheduled",this.type=n,this.source=r,this.data=a,this.scheduleFn=i,this.cancelFn=c,!o)throw new Error("callback is not defined");this.callback=o;var s=this;this.invoke=n===Z&&a&&a.useG?t.invokeTask:function(){return t.invokeTask.call(e,s,this,arguments)}}return t.invokeTask=function(e,t,n){e||(e=this),M++;try{return e.runCount++,e.zone.runTask(e,t,n)}finally{1==M&&_(),M--}},Object.defineProperty(t.prototype,"zone",{get:function(){return this._zone},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:!0,configurable:!0}),t.prototype.cancelScheduleRequest=function(){this._transitionTo(b,k)},t.prototype._transitionTo=function(e,t,n){if(this._state!==t&&this._state!==n)throw new Error(this.type+" '"+this.source+"': can not transition to '"+e+"', expecting state '"+t+"'"+(n?" or '"+n+"'":"")+", was '"+this._state+"'.");this._state=e,e==b&&(this._zoneDelegates=null)},t.prototype.toString=function(){return this.data&&void 0!==this.data.handleId?this.data.handleId.toString():Object.prototype.toString.call(this)},t.prototype.toJSON=function(){return{type:this.type,state:this.state,source:this.source,zone:this.zone.name,runCount:this.runCount}},t}(),p=a("setTimeout"),h=a("Promise"),d=a("then"),v=[],g=!1;function y(t){if(0===M&&0===v.length)if(s||e[h]&&(s=e[h].resolve(0)),s){var n=s[d];n||(n=s.then),n.call(s,_)}else e[p](_,0);t&&v.push(t)}function _(){if(!g){for(g=!0;v.length;){var e=v;v=[];for(var t=0;t<e.length;t++){var n=e[t];try{n.zone.runTask(n,null,null)}catch(r){j.onUnhandledError(r)}}}j.microtaskDrainDone(),g=!1}}var m={name:"NO ZONE"},b="notScheduled",k="scheduling",T="scheduled",E="running",w="canceling",S="unknown",O="microTask",P="macroTask",Z="eventTask",D={},j={symbol:a,currentZoneFrame:function(){return C},onUnhandledError:I,microtaskDrainDone:I,scheduleMicroTask:y,showUncaughtError:function(){return!c[a("ignoreConsoleErrorUncaughtError")]},patchEventTarget:function(){return[]},patchOnProperties:I,patchMethod:function(){return I},bindArguments:function(){return[]},patchThen:function(){return I},patchMacroTask:function(){return I},setNativePromise:function(e){e&&"function"==typeof e.resolve&&(s=e.resolve(0))},patchEventPrototype:function(){return I},isIEOrEdge:function(){return!1},getGlobalObjects:function(){},ObjectDefineProperty:function(){return I},ObjectGetOwnPropertyDescriptor:function(){},ObjectCreate:function(){},ArraySlice:function(){return[]},patchClass:function(){return I},wrapWithCurrentZone:function(){return I},filterProperties:function(){return[]},attachOriginToPatched:function(){return I},_redefineProperty:function(){return I},patchCallbacks:function(){return I}},C={parent:null,zone:new c(null,null)},z=null,M=0;function I(){}r("Zone","Zone"),e.Zone=c}("undefined"!=typeof window&&window||"undefined"!=typeof self&&self||global),Zone.__load_patch("ZoneAwarePromise",function(e,t,n){var r=Object.getOwnPropertyDescriptor,o=Object.defineProperty,a=n.symbol,i=[],c=!0===e[a("DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION")],s=a("Promise"),u=a("then");n.onUnhandledError=function(e){if(n.showUncaughtError()){var t=e&&e.rejection;t?console.error("Unhandled Promise rejection:",t instanceof Error?t.message:t,"; Zone:",e.zone.name,"; Task:",e.task&&e.task.source,"; Value:",t,t instanceof Error?t.stack:void 0):console.error(e)}},n.microtaskDrainDone=function(){for(var e=function(){var e=i.shift();try{e.zone.runGuarded(function(){throw e})}catch(r){!function(e){n.onUnhandledError(e);try{var r=t[l];"function"==typeof r&&r.call(this,e)}catch(o){}}(r)}};i.length;)e()};var l=a("unhandledPromiseRejectionHandler");function f(e){return e&&e.then}function p(e){return e}function h(e){return D.reject(e)}var d=a("state"),v=a("value"),g=a("finally"),y=a("parentPromiseValue"),_=a("parentPromiseState"),m=null,b=!0,k=!1;function T(e,t){return function(n){try{w(e,t,n)}catch(r){w(e,!1,r)}}}var E=a("currentTaskTrace");function w(e,r,a){var s,u,l=(s=!1,function(e){return function(){s||(s=!0,e.apply(null,arguments))}});if(e===a)throw new TypeError("Promise resolved with itself");if(e[d]===m){var f=null;try{"object"!=typeof a&&"function"!=typeof a||(f=a&&a.then)}catch(j){return l(function(){w(e,!1,j)})(),e}if(r!==k&&a instanceof D&&a.hasOwnProperty(d)&&a.hasOwnProperty(v)&&a[d]!==m)O(a),w(e,a[d],a[v]);else if(r!==k&&"function"==typeof f)try{f.call(a,l(T(e,r)),l(T(e,!1)))}catch(j){l(function(){w(e,!1,j)})()}else{e[d]=r;var p=e[v];if(e[v]=a,e[g]===g&&r===b&&(e[d]=e[_],e[v]=e[y]),r===k&&a instanceof Error){var h=t.currentTask&&t.currentTask.data&&t.currentTask.data.__creationTrace__;h&&o(a,E,{configurable:!0,enumerable:!1,writable:!0,value:h})}for(var S=0;S<p.length;)P(e,p[S++],p[S++],p[S++],p[S++]);if(0==p.length&&r==k){e[d]=0;var Z=a;if(!c)try{throw new Error("Uncaught (in promise): "+((u=a)&&u.toString===Object.prototype.toString?(u.constructor&&u.constructor.name||"")+": "+JSON.stringify(u):u?u.toString():Object.prototype.toString.call(u))+(a&&a.stack?"\n"+a.stack:""))}catch(j){Z=j}Z.rejection=a,Z.promise=e,Z.zone=t.current,Z.task=t.currentTask,i.push(Z),n.scheduleMicroTask()}}}return e}var S=a("rejectionHandledHandler");function O(e){if(0===e[d]){try{var n=t[S];n&&"function"==typeof n&&n.call(this,{rejection:e[v],promise:e})}catch(o){}e[d]=k;for(var r=0;r<i.length;r++)e===i[r].promise&&i.splice(r,1)}}function P(e,t,n,r,o){O(e);var a=e[d],i=a?"function"==typeof r?r:p:"function"==typeof o?o:h;t.scheduleMicroTask("Promise.then",function(){try{var r=e[v],o=!!n&&g===n[g];o&&(n[y]=r,n[_]=a);var c=t.run(i,void 0,o&&i!==h&&i!==p?[]:[r]);w(n,!0,c)}catch(s){w(n,!1,s)}},n)}var Z=function(){},D=function(){function e(t){var n=this;if(!(n instanceof e))throw new Error("Must be an instanceof Promise.");n[d]=m,n[v]=[];try{t&&t(T(n,b),T(n,k))}catch(r){w(n,!1,r)}}return e.toString=function(){return"function ZoneAwarePromise() { [native code] }"},e.resolve=function(e){return w(new this(null),b,e)},e.reject=function(e){return w(new this(null),k,e)},e.race=function(e){var t,n,r=new this(function(e,r){t=e,n=r});function o(e){t(e)}function a(e){n(e)}for(var i=0,c=e;i<c.length;i++){var s=c[i];f(s)||(s=this.resolve(s)),s.then(o,a)}return r},e.all=function(t){return e.allWithCallback(t)},e.allSettled=function(t){return(this&&this.prototype instanceof e?this:e).allWithCallback(t,{thenCallback:function(e){return{status:"fulfilled",value:e}},errorCallback:function(e){return{status:"rejected",reason:e}}})},e.allWithCallback=function(e,t){for(var n,r,o=new this(function(e,t){n=e,r=t}),a=2,i=0,c=[],s=function(e){f(e)||(e=u.resolve(e));var o=i;try{e.then(function(e){c[o]=t?t.thenCallback(e):e,0==--a&&n(c)},function(e){t?(c[o]=t.errorCallback(e),0==--a&&n(c)):r(e)})}catch(s){r(s)}a++,i++},u=this,l=0,p=e;l<p.length;l++)s(p[l]);return 0==(a-=2)&&n(c),o},Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"Promise"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,Symbol.species,{get:function(){return e},enumerable:!0,configurable:!0}),e.prototype.then=function(n,r){var o=this.constructor[Symbol.species];o&&"function"==typeof o||(o=this.constructor||e);var a=new o(Z),i=t.current;return this[d]==m?this[v].push(i,a,n,r):P(this,i,a,n,r),a},e.prototype.catch=function(e){return this.then(null,e)},e.prototype.finally=function(n){var r=this.constructor[Symbol.species];r&&"function"==typeof r||(r=e);var o=new r(Z);o[g]=g;var a=t.current;return this[d]==m?this[v].push(a,o,n,n):P(this,a,o,n,n),o},e}();D.resolve=D.resolve,D.reject=D.reject,D.race=D.race,D.all=D.all;var j=e[s]=e.Promise,C=t.__symbol__("ZoneAwarePromise"),z=r(e,"Promise");z&&!z.configurable||(z&&delete z.writable,z&&delete z.value,z||(z={configurable:!0,enumerable:!0}),z.get=function(){return e[C]?e[C]:e[s]},z.set=function(t){t===D?e[C]=t:(e[s]=t,t.prototype[u]||R(t),n.setNativePromise(t))},o(e,"Promise",z)),e.Promise=D;var M,I=a("thenPatched");function R(e){var t=e.prototype,n=r(t,"then");if(!n||!1!==n.writable&&n.configurable){var o=t.then;t[u]=o,e.prototype.then=function(e,t){var n=this;return new D(function(e,t){o.call(n,e,t)}).then(e,t)},e[I]=!0}}if(n.patchThen=R,j){R(j);var L=e.fetch;"function"==typeof L&&(e[n.symbol("fetch")]=L,e.fetch=(M=L,function(){var e=M.apply(this,arguments);if(e instanceof D)return e;var t=e.constructor;return t[I]||R(t),e}))}return Promise[t.__symbol__("uncaughtPromiseErrors")]=i,D});var e=Object.getOwnPropertyDescriptor,t=Object.defineProperty,n=Object.getPrototypeOf,r=Object.create,o=Array.prototype.slice,a="addEventListener",i="removeEventListener",c=Zone.__symbol__(a),s=Zone.__symbol__(i),u="true",l="false",f=Zone.__symbol__("");function p(e,t){return Zone.current.wrap(e,t)}function h(e,t,n,r,o){return Zone.current.scheduleMacroTask(e,t,n,r,o)}var d=Zone.__symbol__,v="undefined"!=typeof window,g=v?window:void 0,y=v&&g||"object"==typeof self&&self||global,_=[null];function m(e,t){for(var n=e.length-1;n>=0;n--)"function"==typeof e[n]&&(e[n]=p(e[n],t+"_"+n));return e}function b(e){return!e||!1!==e.writable&&!("function"==typeof e.get&&void 0===e.set)}var k="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,T=!("nw"in y)&&void 0!==y.process&&"[object process]"==={}.toString.call(y.process),E=!T&&!k&&!(!v||!g.HTMLElement),w=void 0!==y.process&&"[object process]"==={}.toString.call(y.process)&&!k&&!(!v||!g.HTMLElement),S={},O=function(e){if(e=e||y.event){var t=S[e.type];t||(t=S[e.type]=d("ON_PROPERTY"+e.type));var n,r=this||e.target||y,o=r[t];return E&&r===g&&"error"===e.type?!0===(n=o&&o.call(this,e.message,e.filename,e.lineno,e.colno,e.error))&&e.preventDefault():null==(n=o&&o.apply(this,arguments))||n||e.preventDefault(),n}};function P(n,r,o){var a=e(n,r);if(!a&&o&&e(o,r)&&(a={enumerable:!0,configurable:!0}),a&&a.configurable){var i=d("on"+r+"patched");if(!n.hasOwnProperty(i)||!n[i]){delete a.writable,delete a.value;var c=a.get,s=a.set,u=r.substr(2),l=S[u];l||(l=S[u]=d("ON_PROPERTY"+u)),a.set=function(e){var t=this;t||n!==y||(t=y),t&&(t[l]&&t.removeEventListener(u,O),s&&s.apply(t,_),"function"==typeof e?(t[l]=e,t.addEventListener(u,O,!1)):t[l]=null)},a.get=function(){var e=this;if(e||n!==y||(e=y),!e)return null;var t=e[l];if(t)return t;if(c){var o=c&&c.call(this);if(o)return a.set.call(this,o),"function"==typeof e.removeAttribute&&e.removeAttribute(r),o}return null},t(n,r,a),n[i]=!0}}}function Z(e,t,n){if(t)for(var r=0;r<t.length;r++)P(e,"on"+t[r],n);else{var o=[];for(var a in e)"on"==a.substr(0,2)&&o.push(a);for(var i=0;i<o.length;i++)P(e,o[i],n)}}var D=d("originalInstance");function j(e){var n=y[e];if(n){y[d(e)]=n,y[e]=function(){var t=m(arguments,e);switch(t.length){case 0:this[D]=new n;break;case 1:this[D]=new n(t[0]);break;case 2:this[D]=new n(t[0],t[1]);break;case 3:this[D]=new n(t[0],t[1],t[2]);break;case 4:this[D]=new n(t[0],t[1],t[2],t[3]);break;default:throw new Error("Arg list too long.")}},M(y[e],n);var r,o=new n(function(){});for(r in o)"XMLHttpRequest"===e&&"responseBlob"===r||function(n){"function"==typeof o[n]?y[e].prototype[n]=function(){return this[D][n].apply(this[D],arguments)}:t(y[e].prototype,n,{set:function(t){"function"==typeof t?(this[D][n]=p(t,e+"."+n),M(this[D][n],t)):this[D][n]=t},get:function(){return this[D][n]}})}(r);for(r in n)"prototype"!==r&&n.hasOwnProperty(r)&&(y[e][r]=n[r])}}function C(t,r,o){for(var a=t;a&&!a.hasOwnProperty(r);)a=n(a);!a&&t[r]&&(a=t);var i=d(r),c=null;if(a&&!(c=a[i])&&(c=a[i]=a[r],b(a&&e(a,r)))){var s=o(c,i,r);a[r]=function(){return s(this,arguments)},M(a[r],c)}return c}function z(e,t,n){var r=null;function o(e){var t=e.data;return t.args[t.cbIdx]=function(){e.invoke.apply(this,arguments)},r.apply(t.target,t.args),e}r=C(e,t,function(e){return function(t,r){var a=n(t,r);return a.cbIdx>=0&&"function"==typeof r[a.cbIdx]?h(a.name,r[a.cbIdx],a,o):e.apply(t,r)}})}function M(e,t){e[d("OriginalDelegate")]=t}var I=!1,R=!1;function L(){try{var e=g.navigator.userAgent;if(-1!==e.indexOf("MSIE ")||-1!==e.indexOf("Trident/"))return!0}catch(t){}return!1}function N(){if(I)return R;I=!0;try{var e=g.navigator.userAgent;-1===e.indexOf("MSIE ")&&-1===e.indexOf("Trident/")&&-1===e.indexOf("Edge/")||(R=!0)}catch(t){}return R}Zone.__load_patch("toString",function(e){var t=Function.prototype.toString,n=d("OriginalDelegate"),r=d("Promise"),o=d("Error"),a=function(){if("function"==typeof this){var a=this[n];if(a)return"function"==typeof a?t.call(a):Object.prototype.toString.call(a);if(this===Promise){var i=e[r];if(i)return t.call(i)}if(this===Error){var c=e[o];if(c)return t.call(c)}}return t.call(this)};a[n]=t,Function.prototype.toString=a;var i=Object.prototype.toString;Object.prototype.toString=function(){return this instanceof Promise?"[object Promise]":i.call(this)}});var x=!1;if("undefined"!=typeof window)try{var F=Object.defineProperty({},"passive",{get:function(){x=!0}});window.addEventListener("test",F,F),window.removeEventListener("test",F,F)}catch(we){x=!1}var A={useG:!0},H={},B={},G=new RegExp("^"+f+"(\\w+)(true|false)$"),W=d("propagationStopped");function q(e,t){var n=(t?t(e):e)+l,r=(t?t(e):e)+u,o=f+n,a=f+r;H[e]={},H[e].false=o,H[e].true=a}function U(e,t,r){var o=r&&r.add||a,c=r&&r.rm||i,s=r&&r.listeners||"eventListeners",p=r&&r.rmAll||"removeAllListeners",h=d(o),v="."+o+":",g=function(e,t,n){if(!e.isRemoved){var r=e.callback;"object"==typeof r&&r.handleEvent&&(e.callback=function(e){return r.handleEvent(e)},e.originalDelegate=r),e.invoke(e,t,[n]);var o=e.options;o&&"object"==typeof o&&o.once&&t[c].call(t,n.type,e.originalDelegate?e.originalDelegate:e.callback,o)}},y=function(t){if(t=t||e.event){var n=this||t.target||e,r=n[H[t.type].false];if(r)if(1===r.length)g(r[0],n,t);else for(var o=r.slice(),a=0;a<o.length&&(!t||!0!==t[W]);a++)g(o[a],n,t)}},_=function(t){if(t=t||e.event){var n=this||t.target||e,r=n[H[t.type].true];if(r)if(1===r.length)g(r[0],n,t);else for(var o=r.slice(),a=0;a<o.length&&(!t||!0!==t[W]);a++)g(o[a],n,t)}};function m(t,r){if(!t)return!1;var a=!0;r&&void 0!==r.useG&&(a=r.useG);var i=r&&r.vh,g=!0;r&&void 0!==r.chkDup&&(g=r.chkDup);var m=!1;r&&void 0!==r.rt&&(m=r.rt);for(var b=t;b&&!b.hasOwnProperty(o);)b=n(b);if(!b&&t[o]&&(b=t),!b)return!1;if(b[h])return!1;var k,E=r&&r.eventNameToString,w={},S=b[h]=b[o],O=b[d(c)]=b[c],P=b[d(s)]=b[s],Z=b[d(p)]=b[p];function D(e,t){return!x&&"object"==typeof e&&e?!!e.capture:x&&t?"boolean"==typeof e?{capture:e,passive:!0}:e?"object"==typeof e&&!1!==e.passive?Object.assign(Object.assign({},e),{passive:!0}):e:{passive:!0}:e}r&&r.prepend&&(k=b[d(r.prepend)]=b[r.prepend]);var j=a?function(e){if(!w.isExisting)return S.call(w.target,w.eventName,w.capture?_:y,w.options)}:function(e){return S.call(w.target,w.eventName,e.invoke,w.options)},C=a?function(e){if(!e.isRemoved){var t=H[e.eventName],n=void 0;t&&(n=t[e.capture?u:l]);var r=n&&e.target[n];if(r)for(var o=0;o<r.length;o++)if(r[o]===e){r.splice(o,1),e.isRemoved=!0,0===r.length&&(e.allRemoved=!0,e.target[n]=null);break}}if(e.allRemoved)return O.call(e.target,e.eventName,e.capture?_:y,e.options)}:function(e){return O.call(e.target,e.eventName,e.invoke,e.options)},z=r&&r.diff?r.diff:function(e,t){var n=typeof t;return"function"===n&&e.callback===t||"object"===n&&e.originalDelegate===t},I=Zone[d("BLACK_LISTED_EVENTS")],R=e[d("PASSIVE_EVENTS")],L=function(t,n,o,c,s,f){return void 0===s&&(s=!1),void 0===f&&(f=!1),function(){var p=this||e,h=arguments[0];r&&r.transferEventName&&(h=r.transferEventName(h));var d=arguments[1];if(!d)return t.apply(this,arguments);if(T&&"uncaughtException"===h)return t.apply(this,arguments);var v=!1;if("function"!=typeof d){if(!d.handleEvent)return t.apply(this,arguments);v=!0}if(!i||i(t,d,p,arguments)){var y=x&&!!R&&-1!==R.indexOf(h),_=D(arguments[2],y);if(I)for(var m=0;m<I.length;m++)if(h===I[m])return y?t.call(p,h,d,_):t.apply(this,arguments);var b=!!_&&("boolean"==typeof _||_.capture),k=!(!_||"object"!=typeof _)&&_.once,S=Zone.current,O=H[h];O||(q(h,E),O=H[h]);var P,Z=O[b?u:l],j=p[Z],C=!1;if(j){if(C=!0,g)for(m=0;m<j.length;m++)if(z(j[m],d))return}else j=p[Z]=[];var M=p.constructor.name,L=B[M];L&&(P=L[h]),P||(P=M+n+(E?E(h):h)),w.options=_,k&&(w.options.once=!1),w.target=p,w.capture=b,w.eventName=h,w.isExisting=C;var N=a?A:void 0;N&&(N.taskData=w);var F=S.scheduleEventTask(P,d,N,o,c);return w.target=null,N&&(N.taskData=null),k&&(_.once=!0),(x||"boolean"!=typeof F.options)&&(F.options=_),F.target=p,F.capture=b,F.eventName=h,v&&(F.originalDelegate=d),f?j.unshift(F):j.push(F),s?p:void 0}}};return b[o]=L(S,v,j,C,m),k&&(b.prependListener=L(k,".prependListener:",function(e){return k.call(w.target,w.eventName,e.invoke,w.options)},C,m,!0)),b[c]=function(){var t=this||e,n=arguments[0];r&&r.transferEventName&&(n=r.transferEventName(n));var o=arguments[2],a=!!o&&("boolean"==typeof o||o.capture),c=arguments[1];if(!c)return O.apply(this,arguments);if(!i||i(O,c,t,arguments)){var s,p=H[n];p&&(s=p[a?u:l]);var h=s&&t[s];if(h)for(var d=0;d<h.length;d++){var v=h[d];if(z(v,c))return h.splice(d,1),v.isRemoved=!0,0===h.length&&(v.allRemoved=!0,t[s]=null,"string"==typeof n&&(t[f+"ON_PROPERTY"+n]=null)),v.zone.cancelTask(v),m?t:void 0}return O.apply(this,arguments)}},b[s]=function(){var t=this||e,n=arguments[0];r&&r.transferEventName&&(n=r.transferEventName(n));for(var o=[],a=V(t,E?E(n):n),i=0;i<a.length;i++){var c=a[i];o.push(c.originalDelegate?c.originalDelegate:c.callback)}return o},b[p]=function(){var t=this||e,n=arguments[0];if(n){r&&r.transferEventName&&(n=r.transferEventName(n));var o=H[n];if(o){var a=t[o.false],i=t[o.true];if(a){var s=a.slice();for(f=0;f<s.length;f++)this[c].call(this,n,(u=s[f]).originalDelegate?u.originalDelegate:u.callback,u.options)}if(i)for(s=i.slice(),f=0;f<s.length;f++){var u;this[c].call(this,n,(u=s[f]).originalDelegate?u.originalDelegate:u.callback,u.options)}}}else{for(var l=Object.keys(t),f=0;f<l.length;f++){var h=G.exec(l[f]),d=h&&h[1];d&&"removeListener"!==d&&this[p].call(this,d)}this[p].call(this,"removeListener")}if(m)return this},M(b[o],S),M(b[c],O),Z&&M(b[p],Z),P&&M(b[s],P),!0}for(var b=[],k=0;k<t.length;k++)b[k]=m(t[k],r);return b}function V(e,t){if(!t){var n=[];for(var r in e){var o=G.exec(r),a=o&&o[1];if(a&&(!t||a===t)){var i=e[r];if(i)for(var c=0;c<i.length;c++)n.push(i[c])}}return n}var s=H[t];s||(q(t),s=H[t]);var u=e[s.false],l=e[s.true];return u?l?u.concat(l):u.slice():l?l.slice():[]}function X(e,t){var n=e.Event;n&&n.prototype&&t.patchMethod(n.prototype,"stopImmediatePropagation",function(e){return function(t,n){t[W]=!0,e&&e.apply(t,n)}})}function Y(e,t,n,r,o){var a=Zone.__symbol__(r);if(!t[a]){var i=t[a]=t[r];t[r]=function(a,c,s){return c&&c.prototype&&o.forEach(function(t){var o=n+"."+r+"::"+t,a=c.prototype;if(a.hasOwnProperty(t)){var i=e.ObjectGetOwnPropertyDescriptor(a,t);i&&i.value?(i.value=e.wrapWithCurrentZone(i.value,o),e._redefineProperty(c.prototype,t,i)):a[t]&&(a[t]=e.wrapWithCurrentZone(a[t],o))}else a[t]&&(a[t]=e.wrapWithCurrentZone(a[t],o))}),i.call(t,a,c,s)},e.attachOriginToPatched(t[r],i)}}var K,J,Q,$,ee,te=["absolutedeviceorientation","afterinput","afterprint","appinstalled","beforeinstallprompt","beforeprint","beforeunload","devicelight","devicemotion","deviceorientation","deviceorientationabsolute","deviceproximity","hashchange","languagechange","message","mozbeforepaint","offline","online","paint","pageshow","pagehide","popstate","rejectionhandled","storage","unhandledrejection","unload","userproximity","vrdisplayconnected","vrdisplaydisconnected","vrdisplaypresentchange"],ne=["encrypted","waitingforkey","msneedkey","mozinterruptbegin","mozinterruptend"],re=["load"],oe=["blur","error","focus","load","resize","scroll","messageerror"],ae=["bounce","finish","start"],ie=["loadstart","progress","abort","error","load","progress","timeout","loadend","readystatechange"],ce=["upgradeneeded","complete","abort","success","error","blocked","versionchange","close"],se=["close","error","open","message"],ue=["error","message"],le=["abort","animationcancel","animationend","animationiteration","auxclick","beforeinput","blur","cancel","canplay","canplaythrough","change","compositionstart","compositionupdate","compositionend","cuechange","click","close","contextmenu","curechange","dblclick","drag","dragend","dragenter","dragexit","dragleave","dragover","drop","durationchange","emptied","ended","error","focus","focusin","focusout","gotpointercapture","input","invalid","keydown","keypress","keyup","load","loadstart","loadeddata","loadedmetadata","lostpointercapture","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","mousewheel","orientationchange","pause","play","playing","pointercancel","pointerdown","pointerenter","pointerleave","pointerlockchange","mozpointerlockchange","webkitpointerlockerchange","pointerlockerror","mozpointerlockerror","webkitpointerlockerror","pointermove","pointout","pointerover","pointerup","progress","ratechange","reset","resize","scroll","seeked","seeking","select","selectionchange","selectstart","show","sort","stalled","submit","suspend","timeupdate","volumechange","touchcancel","touchmove","touchstart","touchend","transitioncancel","transitionend","waiting","wheel"].concat(["webglcontextrestored","webglcontextlost","webglcontextcreationerror"],["autocomplete","autocompleteerror"],["toggle"],["afterscriptexecute","beforescriptexecute","DOMContentLoaded","freeze","fullscreenchange","mozfullscreenchange","webkitfullscreenchange","msfullscreenchange","fullscreenerror","mozfullscreenerror","webkitfullscreenerror","msfullscreenerror","readystatechange","visibilitychange","resume"],te,["beforecopy","beforecut","beforepaste","copy","cut","paste","dragstart","loadend","animationstart","search","transitionrun","transitionstart","webkitanimationend","webkitanimationiteration","webkitanimationstart","webkittransitionend"],["activate","afterupdate","ariarequest","beforeactivate","beforedeactivate","beforeeditfocus","beforeupdate","cellchange","controlselect","dataavailable","datasetchanged","datasetcomplete","errorupdate","filterchange","layoutcomplete","losecapture","move","moveend","movestart","propertychange","resizeend","resizestart","rowenter","rowexit","rowsdelete","rowsinserted","command","compassneedscalibration","deactivate","help","mscontentzoom","msmanipulationstatechanged","msgesturechange","msgesturedoubletap","msgestureend","msgesturehold","msgesturestart","msgesturetap","msgotpointercapture","msinertiastart","mslostpointercapture","mspointercancel","mspointerdown","mspointerenter","mspointerhover","mspointerleave","mspointermove","mspointerout","mspointerover","mspointerup","pointerout","mssitemodejumplistitemremoved","msthumbnailclick","stop","storagecommit"]);function fe(e,t,n){if(!n||0===n.length)return t;var r=n.filter(function(t){return t.target===e});if(!r||0===r.length)return t;var o=r[0].ignoreProperties;return t.filter(function(e){return-1===o.indexOf(e)})}function pe(e,t,n,r){e&&Z(e,fe(e,t,n),r)}function he(e,t){if((!T||w)&&!Zone[e.symbol("patchEvents")]){var r="undefined"!=typeof WebSocket,o=t.__Zone_ignore_on_properties;if(E){var a=window,i=L?[{target:a,ignoreProperties:["error"]}]:[];pe(a,le.concat(["messageerror"]),o?o.concat(i):o,n(a)),pe(Document.prototype,le,o),void 0!==a.SVGElement&&pe(a.SVGElement.prototype,le,o),pe(Element.prototype,le,o),pe(HTMLElement.prototype,le,o),pe(HTMLMediaElement.prototype,ne,o),pe(HTMLFrameSetElement.prototype,te.concat(oe),o),pe(HTMLBodyElement.prototype,te.concat(oe),o),pe(HTMLFrameElement.prototype,re,o),pe(HTMLIFrameElement.prototype,re,o);var c=a.HTMLMarqueeElement;c&&pe(c.prototype,ae,o);var s=a.Worker;s&&pe(s.prototype,ue,o)}var u=t.XMLHttpRequest;u&&pe(u.prototype,ie,o);var l=t.XMLHttpRequestEventTarget;l&&pe(l&&l.prototype,ie,o),"undefined"!=typeof IDBIndex&&(pe(IDBIndex.prototype,ce,o),pe(IDBRequest.prototype,ce,o),pe(IDBOpenDBRequest.prototype,ce,o),pe(IDBDatabase.prototype,ce,o),pe(IDBTransaction.prototype,ce,o),pe(IDBCursor.prototype,ce,o)),r&&pe(WebSocket.prototype,se,o)}}function de(){K=Zone.__symbol__,J=Object[K("defineProperty")]=Object.defineProperty,Q=Object[K("getOwnPropertyDescriptor")]=Object.getOwnPropertyDescriptor,$=Object.create,ee=K("unconfigurables"),Object.defineProperty=function(e,t,n){if(ge(e,t))throw new TypeError("Cannot assign to read only property '"+t+"' of "+e);var r=n.configurable;return"prototype"!==t&&(n=ye(e,t,n)),_e(e,t,n,r)},Object.defineProperties=function(e,t){return Object.keys(t).forEach(function(n){Object.defineProperty(e,n,t[n])}),e},Object.create=function(e,t){return"object"!=typeof t||Object.isFrozen(t)||Object.keys(t).forEach(function(n){t[n]=ye(e,n,t[n])}),$(e,t)},Object.getOwnPropertyDescriptor=function(e,t){var n=Q(e,t);return n&&ge(e,t)&&(n.configurable=!1),n}}function ve(e,t,n){var r=n.configurable;return _e(e,t,n=ye(e,t,n),r)}function ge(e,t){return e&&e[ee]&&e[ee][t]}function ye(e,t,n){return Object.isFrozen(n)||(n.configurable=!0),n.configurable||(e[ee]||Object.isFrozen(e)||J(e,ee,{writable:!0,value:{}}),e[ee]&&(e[ee][t]=!0)),n}function _e(e,t,n,r){try{return J(e,t,n)}catch(a){if(!n.configurable)throw a;void 0===r?delete n.configurable:n.configurable=r;try{return J(e,t,n)}catch(a){var o=null;try{o=JSON.stringify(n)}catch(a){o=n.toString()}console.log("Attempting to configure '"+t+"' with descriptor '"+o+"' on object '"+e+"' and got error, giving up: "+a)}}}function me(e,t){var n=t.getGlobalObjects(),r=n.eventNames,o=n.globalSources,a=n.zoneSymbolEventNames,i=n.TRUE_STR,c=n.FALSE_STR,s=n.ZONE_SYMBOL_PREFIX,u="ApplicationCache,EventSource,FileReader,InputMethodContext,MediaController,MessagePort,Node,Performance,SVGElementInstance,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebKitNamedFlow,Window,Worker,WorkerGlobalScope,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload,IDBRequest,IDBOpenDBRequest,IDBDatabase,IDBTransaction,IDBCursor,DBIndex,WebSocket".split(","),l=[],f=e.wtf,p="Anchor,Area,Audio,BR,Base,BaseFont,Body,Button,Canvas,Content,DList,Directory,Div,Embed,FieldSet,Font,Form,Frame,FrameSet,HR,Head,Heading,Html,IFrame,Image,Input,Keygen,LI,Label,Legend,Link,Map,Marquee,Media,Menu,Meta,Meter,Mod,OList,Object,OptGroup,Option,Output,Paragraph,Pre,Progress,Quote,Script,Select,Source,Span,Style,TableCaption,TableCell,TableCol,Table,TableRow,TableSection,TextArea,Title,Track,UList,Unknown,Video".split(",");f?l=p.map(function(e){return"HTML"+e+"Element"}).concat(u):e.EventTarget?l.push("EventTarget"):l=u;for(var h=e.__Zone_disable_IE_check||!1,d=e.__Zone_enable_cross_context_check||!1,v=t.isIEOrEdge(),g="[object FunctionWrapper]",y="function __BROWSERTOOLS_CONSOLE_SAFEFUNC() { [native code] }",_={MSPointerCancel:"pointercancel",MSPointerDown:"pointerdown",MSPointerEnter:"pointerenter",MSPointerHover:"pointerhover",MSPointerLeave:"pointerleave",MSPointerMove:"pointermove",MSPointerOut:"pointerout",MSPointerOver:"pointerover",MSPointerUp:"pointerup"},m=0;m<r.length;m++){var b=s+((S=r[m])+c),k=s+(S+i);a[S]={},a[S][c]=b,a[S][i]=k}for(m=0;m<p.length;m++)for(var T=p[m],E=o[T]={},w=0;w<r.length;w++){var S;E[S=r[w]]=T+".addEventListener:"+S}var O=[];for(m=0;m<l.length;m++){var P=e[l[m]];O.push(P&&P.prototype)}return t.patchEventTarget(e,O,{vh:function(e,t,n,r){if(!h&&v){if(d)try{var o;if((o=t.toString())===g||o==y)return e.apply(n,r),!1}catch(a){return e.apply(n,r),!1}else if((o=t.toString())===g||o==y)return e.apply(n,r),!1}else if(d)try{t.toString()}catch(a){return e.apply(n,r),!1}return!0},transferEventName:function(e){return _[e]||e}}),Zone[t.symbol("patchEventTarget")]=!!e.EventTarget,!0}function be(e,t){var n=e.getGlobalObjects();if((!n.isNode||n.isMix)&&!function(e,t){var n=e.getGlobalObjects();if((n.isBrowser||n.isMix)&&!e.ObjectGetOwnPropertyDescriptor(HTMLElement.prototype,"onclick")&&"undefined"!=typeof Element){var r=e.ObjectGetOwnPropertyDescriptor(Element.prototype,"onclick");if(r&&!r.configurable)return!1;if(r){e.ObjectDefineProperty(Element.prototype,"onclick",{enumerable:!0,configurable:!0,get:function(){return!0}});var o=!!document.createElement("div").onclick;return e.ObjectDefineProperty(Element.prototype,"onclick",r),o}}var a=t.XMLHttpRequest;if(!a)return!1;var i="onreadystatechange",c=a.prototype,s=e.ObjectGetOwnPropertyDescriptor(c,i);if(s)return e.ObjectDefineProperty(c,i,{enumerable:!0,configurable:!0,get:function(){return!0}}),o=!!(l=new a).onreadystatechange,e.ObjectDefineProperty(c,i,s||{}),o;var u=e.symbol("fake");e.ObjectDefineProperty(c,i,{enumerable:!0,configurable:!0,get:function(){return this[u]},set:function(e){this[u]=e}});var l,f=function(){};return(l=new a).onreadystatechange=f,o=l[u]===f,l.onreadystatechange=null,o}(e,t)){var r="undefined"!=typeof WebSocket;(function(e){for(var t=e.getGlobalObjects().eventNames,n=e.symbol("unbound"),r=function(r){var o=t[r],a="on"+o;self.addEventListener(o,function(t){var r,o,i=t.target;for(o=i?i.constructor.name+"."+a:"unknown."+a;i;)i[a]&&!i[a][n]&&((r=e.wrapWithCurrentZone(i[a],o))[n]=i[a],i[a]=r),i=i.parentElement},!0)},o=0;o<t.length;o++)r(o)})(e),e.patchClass("XMLHttpRequest"),r&&function(e,t){var n=e.getGlobalObjects(),r=n.ADD_EVENT_LISTENER_STR,o=n.REMOVE_EVENT_LISTENER_STR,a=t.WebSocket;t.EventTarget||e.patchEventTarget(t,[a.prototype]),t.WebSocket=function(t,n){var i,c,s=arguments.length>1?new a(t,n):new a(t),u=e.ObjectGetOwnPropertyDescriptor(s,"onmessage");return u&&!1===u.configurable?(i=e.ObjectCreate(s),c=s,[r,o,"send","close"].forEach(function(t){i[t]=function(){var n=e.ArraySlice.call(arguments);if(t===r||t===o){var a=n.length>0?n[0]:void 0;if(a){var c=Zone.__symbol__("ON_PROPERTY"+a);s[c]=i[c]}}return s[t].apply(s,n)}})):i=s,e.patchOnProperties(i,["close","error","message","open"],c),i};var i=t.WebSocket;for(var c in a)i[c]=a[c]}(e,t),Zone[e.symbol("patchEvents")]=!0}}Zone.__load_patch("util",function(n,c,s){s.patchOnProperties=Z,s.patchMethod=C,s.bindArguments=m,s.patchMacroTask=z;var h=c.__symbol__("BLACK_LISTED_EVENTS"),d=c.__symbol__("UNPATCHED_EVENTS");n[d]&&(n[h]=n[d]),n[h]&&(c[h]=c[d]=n[h]),s.patchEventPrototype=X,s.patchEventTarget=U,s.isIEOrEdge=N,s.ObjectDefineProperty=t,s.ObjectGetOwnPropertyDescriptor=e,s.ObjectCreate=r,s.ArraySlice=o,s.patchClass=j,s.wrapWithCurrentZone=p,s.filterProperties=fe,s.attachOriginToPatched=M,s._redefineProperty=Object.defineProperty,s.patchCallbacks=Y,s.getGlobalObjects=function(){return{globalSources:B,zoneSymbolEventNames:H,eventNames:le,isBrowser:E,isMix:w,isNode:T,TRUE_STR:u,FALSE_STR:l,ZONE_SYMBOL_PREFIX:f,ADD_EVENT_LISTENER_STR:a,REMOVE_EVENT_LISTENER_STR:i}}}),function(e){e[("legacyPatch",(e.__Zone_symbol_prefix||"__zone_symbol__")+"legacyPatch")]=function(){var t=e.Zone;t.__load_patch("defineProperty",function(e,t,n){n._redefineProperty=ve,de()}),t.__load_patch("registerElement",function(e,t,n){!function(e,t){var n=t.getGlobalObjects();(n.isBrowser||n.isMix)&&"registerElement"in e.document&&t.patchCallbacks(t,document,"Document","registerElement",["createdCallback","attachedCallback","detachedCallback","attributeChangedCallback"])}(e,n)}),t.__load_patch("EventTargetLegacy",function(e,t,n){me(e,n),be(n,e)})}}("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{});var ke=d("zoneTask");function Te(e,t,n,r){var o=null,a=null;n+=r;var i={};function c(t){var n=t.data;return n.args[0]=function(){try{t.invoke.apply(this,arguments)}finally{t.data&&t.data.isPeriodic||("number"==typeof n.handleId?delete i[n.handleId]:n.handleId&&(n.handleId[ke]=null))}},n.handleId=o.apply(e,n.args),t}function s(e){return a(e.data.handleId)}o=C(e,t+=r,function(n){return function(o,a){if("function"==typeof a[0]){var u=h(t,a[0],{isPeriodic:"Interval"===r,delay:"Timeout"===r||"Interval"===r?a[1]||0:void 0,args:a},c,s);if(!u)return u;var l=u.data.handleId;return"number"==typeof l?i[l]=u:l&&(l[ke]=u),l&&l.ref&&l.unref&&"function"==typeof l.ref&&"function"==typeof l.unref&&(u.ref=l.ref.bind(l),u.unref=l.unref.bind(l)),"number"==typeof l||l?l:u}return n.apply(e,a)}}),a=C(e,n,function(t){return function(n,r){var o,a=r[0];"number"==typeof a?o=i[a]:(o=a&&a[ke])||(o=a),o&&"string"==typeof o.type?"notScheduled"!==o.state&&(o.cancelFn&&o.data.isPeriodic||0===o.runCount)&&("number"==typeof a?delete i[a]:a&&(a[ke]=null),o.zone.cancelTask(o)):t.apply(e,r)}})}function Ee(e,t){if(!Zone[t.symbol("patchEventTarget")]){for(var n=t.getGlobalObjects(),r=n.eventNames,o=n.zoneSymbolEventNames,a=n.TRUE_STR,i=n.FALSE_STR,c=n.ZONE_SYMBOL_PREFIX,s=0;s<r.length;s++){var u=r[s],l=c+(u+i),f=c+(u+a);o[u]={},o[u][i]=l,o[u][a]=f}var p=e.EventTarget;if(p&&p.prototype)return t.patchEventTarget(e,[p&&p.prototype]),!0}}Zone.__load_patch("legacy",function(e){var t=e[Zone.__symbol__("legacyPatch")];t&&t()}),Zone.__load_patch("timers",function(e){var t="set",n="clear";Te(e,t,n,"Timeout"),Te(e,t,n,"Interval"),Te(e,t,n,"Immediate")}),Zone.__load_patch("requestAnimationFrame",function(e){Te(e,"request","cancel","AnimationFrame"),Te(e,"mozRequest","mozCancel","AnimationFrame"),Te(e,"webkitRequest","webkitCancel","AnimationFrame")}),Zone.__load_patch("blocking",function(e,t){for(var n=["alert","prompt","confirm"],r=0;r<n.length;r++)C(e,n[r],function(n,r,o){return function(r,a){return t.current.run(n,e,a,o)}})}),Zone.__load_patch("EventTarget",function(e,t,n){(function(e,t){t.patchEventPrototype(e,t)})(e,n),Ee(e,n);var r=e.XMLHttpRequestEventTarget;r&&r.prototype&&n.patchEventTarget(e,[r.prototype]),j("MutationObserver"),j("WebKitMutationObserver"),j("IntersectionObserver"),j("FileReader")}),Zone.__load_patch("on_property",function(e,t,n){he(n,e)}),Zone.__load_patch("customElements",function(e,t,n){!function(e,t){var n=t.getGlobalObjects();(n.isBrowser||n.isMix)&&e.customElements&&"customElements"in e&&t.patchCallbacks(t,e.customElements,"customElements","define",["connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback"])}(e,n)}),Zone.__load_patch("XHR",function(e,t){!function(e){var l=e.XMLHttpRequest;if(l){var f=l.prototype,p=f[c],v=f[s];if(!p){var g=e.XMLHttpRequestEventTarget;if(g){var y=g.prototype;p=y[c],v=y[s]}}var _="readystatechange",m="scheduled",b=C(f,"open",function(){return function(e,t){return e[r]=0==t[2],e[i]=t[1],b.apply(e,t)}}),k=d("fetchTaskAborting"),T=d("fetchTaskScheduling"),E=C(f,"send",function(){return function(e,n){if(!0===t.current[T])return E.apply(e,n);if(e[r])return E.apply(e,n);var o={target:e,url:e[i],isPeriodic:!1,args:n,aborted:!1},a=h("XMLHttpRequest.send",O,o,S,P);e&&!0===e[u]&&!o.aborted&&a.state===m&&a.invoke()}}),w=C(f,"abort",function(){return function(e,r){var o=e[n];if(o&&"string"==typeof o.type){if(null==o.cancelFn||o.data&&o.data.aborted)return;o.zone.cancelTask(o)}else if(!0===t.current[k])return w.apply(e,r)}})}function S(e){var r=e.data,i=r.target;i[a]=!1,i[u]=!1;var l=i[o];p||(p=i[c],v=i[s]),l&&v.call(i,_,l);var f=i[o]=function(){if(i.readyState===i.DONE)if(!r.aborted&&i[a]&&e.state===m){var n=i[t.__symbol__("loadfalse")];if(n&&n.length>0){var o=e.invoke;e.invoke=function(){for(var n=i[t.__symbol__("loadfalse")],a=0;a<n.length;a++)n[a]===e&&n.splice(a,1);r.aborted||e.state!==m||o.call(e)},n.push(e)}else e.invoke()}else r.aborted||!1!==i[a]||(i[u]=!0)};return p.call(i,_,f),i[n]||(i[n]=e),E.apply(i,r.args),i[a]=!0,e}function O(){}function P(e){var t=e.data;return t.aborted=!0,w.apply(t.target,t.args)}}(e);var n=d("xhrTask"),r=d("xhrSync"),o=d("xhrListener"),a=d("xhrScheduled"),i=d("xhrURL"),u=d("xhrErrorBeforeScheduled")}),Zone.__load_patch("geolocation",function(t){t.navigator&&t.navigator.geolocation&&function(t,n){for(var r=t.constructor.name,o=function(o){var a=n[o],i=t[a];if(i){if(!b(e(t,a)))return"continue";t[a]=function(e){var t=function(){return e.apply(this,m(arguments,r+"."+a))};return M(t,e),t}(i)}},a=0;a<n.length;a++)o(a)}(t.navigator.geolocation,["getCurrentPosition","watchPosition"])}),Zone.__load_patch("PromiseRejectionEvent",function(e,t){function n(t){return function(n){V(e,t).forEach(function(r){var o=e.PromiseRejectionEvent;if(o){var a=new o(t,{promise:n.promise,reason:n.rejection});r.invoke(a)}})}}e.PromiseRejectionEvent&&(t[d("unhandledPromiseRejectionHandler")]=n("unhandledrejection"),t[d("rejectionHandledHandler")]=n("rejectionhandled"))})})?r.call(t,n,t,e):r)||(e.exports=o)},1:function(e,t,n){e.exports=n("hN/g")},"hN/g":function(e,t,n){"use strict";n.r(t),n("0TWp")}}); | 45,836 | 45,836 | 0.715682 |
c87001036371b7ddf4aaba7040ded8d1da2c22b3 | 165 | js | JavaScript | src/lib/graphql-client.js | zexhan17/my-developer-portfolio | 045283ec2c848dac5e9c01178d68f4291529a6d1 | [
"MIT"
] | null | null | null | src/lib/graphql-client.js | zexhan17/my-developer-portfolio | 045283ec2c848dac5e9c01178d68f4291529a6d1 | [
"MIT"
] | null | null | null | src/lib/graphql-client.js | zexhan17/my-developer-portfolio | 045283ec2c848dac5e9c01178d68f4291529a6d1 | [
"MIT"
] | null | null | null | import { GraphQLClient } from 'graphql-request'
const GRAPHQL_ENDPOINT = import.meta.env.VITE_GRAPHQL_API
export const client = new GraphQLClient(GRAPHQL_ENDPOINT)
| 33 | 57 | 0.824242 |
c870148065abf860c5f2413becee0995c05877e2 | 8,391 | js | JavaScript | lib/g11nLocaleFactory.js | krakenjs/localeResolver | 4a693d70cdf16a0b4adf1a4d17d3d6bf24ecb870 | [
"Apache-2.0"
] | null | null | null | lib/g11nLocaleFactory.js | krakenjs/localeResolver | 4a693d70cdf16a0b4adf1a4d17d3d6bf24ecb870 | [
"Apache-2.0"
] | 3 | 2015-10-22T19:06:21.000Z | 2015-10-23T03:59:43.000Z | lib/g11nLocaleFactory.js | krakenjs/localeResolver | 4a693d70cdf16a0b4adf1a4d17d3d6bf24ecb870 | [
"Apache-2.0"
] | 4 | 2015-10-22T23:12:38.000Z | 2021-01-19T10:33:13.000Z | 'use strict';
var fs = require('fs'),
path = require('path'),
assert = require('assert'),
G11nLocale = require('./g11nLocale'),
debug = require('debuglog')('g11nLocaleFR');
/**
*
*
* @param bcp47LocaleFile a hash containing locales in the format:
[
{
"bcp47Locale": "es-US-x-AD",
"countryCode": "AD",
"language": "es-US",
"locale": "es_XC",
"cldrLocale": "es-AD"
}
], ....
*
* @param countryTZsFile a hash of country timezones in the format:
{ "ISO 3166 Country Code": {
"primaryTimeZone": "Pacific/Efate",
"timeZones": ["Pacific/Efate"]
}, ....
}
*
* @param countryLanguagesFile a hash of country supported languages in the format:
*
* { "VU": [
"fr-FR",
"es-US",
"en-US",
"zh-Hans-CN"
], .....
}
*
* @param metadataFile optional contains the file names for bcp47LocaleFile, countryTZsFile, and countryLanguagesFile
* as well as comprehensive version number assuming these files are released as one managed unit
*
*
* @returns {G11nLocaleFactory|*} the single instance of the G11nLocaleFactory
* @constructor
*/
function G11nLocaleFactory(bcp47LocaleFile, countryTZsFile, countryLanguagesFile, metadataFile) {
if(G11nLocaleFactory.prototype.instance !== undefined) { return G11nLocaleFactory.prototype.instance; }
assert(bcp47LocaleFile && countryTZsFile && countryLanguagesFile);
// the cached instance
G11nLocaleFactory.prototype.instance = this;
// All locale objects (G11nLocale types) from the original source
this.locales;
/* Map of G11nLocale s keyed by BCP47 as a String ((such as 'de-DE-x-DE') */
this.g11nLocalesByBCP47 = {};
/**
* Map of G11nLocale s keyed by country then 'legacy' locale as a String
* ((such as 'en_AU'). The reason is that legacy locale are not unique
*/
this.g11nLocalesByCountryAndLocale = {};
/**
* Map of G11nLocales keyed by country then CLDR locale as a String
* ((such as 'en-AU')
*/
this.g11nLocalesByCountryAndCLDRLocale = {};
/**
* Hash of country and language where language is a proper language string
*/
this.g11nLocalesByCountryandLang = {};
var bcp47Locales = require(bcp47LocaleFile);
this.countryTimeZones = require(countryTZsFile);
this.countrySupportedLangs = require(countryLanguagesFile);
this._setLocales(bcp47Locales);
if(metadataFile) {
var bcp47Metadata = require(metadataFile);
this.sVersion = bcp47Metadata.CURRENT_METADATA_VERSION;
}
}
/**
* This method is needed so the the public representation of a G11nLocale object can remain constant while the
* underlying data that is used to create/munge it can change at a different rate.
*
* @param internalG11nLocale
* @returns {*}
*/
G11nLocaleFactory.prototype.createG11nLocale = function createG11nLocale(internalG11nLocale) {
var g11nLocale;
if(internalG11nLocale) {
g11nLocale = new G11nLocale(internalG11nLocale.bcp47Locale,
internalG11nLocale.countryCode,
internalG11nLocale.language,
internalG11nLocale.locale,
internalG11nLocale.cldrLocale);
g11nLocale.timeZones = internalG11nLocale.timeZones;
g11nLocale.primaryTimeZone = internalG11nLocale.primaryTimeZone;
g11nLocale.supportedLanguages = internalG11nLocale.supportedLanguages;
}
return g11nLocale;
};
/**
*
* @param langStr must be in valid lang format such as "en-US" or "zh-Hans-CN". Should NOT be a locale legacy format
* using the underscore symbol such as 'en_US'. You are assuming legacy locale is a language and it is
* not in the context of this function.
*
* @param countryCode
* @returns {*|boolean}
*/
G11nLocaleFactory.prototype.isLangValidForCountry = function isLangValidForCountry(langStr, countryCode) {
return this.countrySupportedLangs[countryCode] && this.countrySupportedLangs[countryCode].indexOf(langStr) !== -1;
};
/**
*
* @param bcp47LocaleStr
*/
G11nLocaleFactory.prototype.isBcp47Locale = function isBcp47Locale(bcp47LocaleStr) {
return (this.g11nLocalesByBCP47[bcp47LocaleStr] !== undefined);
};
/**
* @param aBCP47Locale string
* (such as 'de-DE-x-DE')
* @return a corresponding object in G11nLocale format
*/
G11nLocaleFactory.prototype.getG11LocaleForBCP47Locale = function getG11LocaleForBCP47Locale(aBCP47Locale) {
return this.createG11nLocale(this.g11nLocalesByBCP47[aBCP47Locale]);
};
/**
* @param aBCP47Locale string
* (such as 'de-DE-x-DE')
* @return a corresponding String for the legacy locale format
*/
G11nLocaleFactory.prototype.getLegacyLocaleForBCP47Locale = function getG11LocaleForBCP47Locale(aBCP47Locale) {
return this.g11nLocalesByBCP47[aBCP47Locale].locale;
};
/**
*
* @param countryCode
* @param lang this should be a language string in the BCP47 format
* @returns {*}
*/
G11nLocaleFactory.prototype.getG11LocaleForCountryWithLang = function getG11LocaleForCountryWithLang(countryCode, lang ) {
var countryLocales = this.g11nLocalesByCountryandLang[countryCode];
if(countryLocales && lang) {
return this.createG11nLocale( countryLocales.locales[lang] );
}
return null;
};
/**
* aLocale is expected to be in the xx_YY format. However this method is
* tolerant to the formatting and would accept xx-YY as locale and language
* are often used (wrongly) interchangeably by many
*
* @param countryCode
* (such as 'AU')
* @param aLocale
* (such as 'en_AU')
* @return a corresponding object in G11nLocale format
* @deprecated
*/
G11nLocaleFactory.prototype.getG11LocaleForCountryWithLocale = function getG11LocaleForCountryWithLocale(countryCode, aLocale ) {
var countryLocales = this.g11nLocalesByCountryAndLocale[countryCode];
if(countryLocales && aLocale) {
var legacyLocale = aLocale.replace('-', '_');
return this.createG11nLocale( countryLocales.locales[legacyLocale] );
}
return null;
};
/**
* aCLDRLocale is expected to be in the xx-YY format.
* @param countryCode
* (such as 'AD')
* @param aCLDRLocale
* (such as 'es-AD')
* @return a corresponding object in G11nLocale format
*/
G11nLocaleFactory.prototype.getG11LocaleForCLDRLocale = function getG11LocaleForCLDRLocale(countryCode, aCLDRLocale) {
var countryLocales = this.g11nLocalesByCountryAndCLDRLocale[countryCode];
if(countryLocales && aCLDRLocale) {
return this.createG11nLocale( countryLocales.locales[aCLDRLocale] );
}
return null;
};
/**
* @param theLocales
*/
G11nLocaleFactory.prototype._setLocales = function _setLocales(theLocales) {
var that = this;
// All locale objects (G11nLocale types) from the original source
this.locales = theLocales;
theLocales.forEach( function(aLocale) {
that.g11nLocalesByBCP47[aLocale.bcp47Locale] = aLocale;
if(!that.g11nLocalesByCountryAndLocale[aLocale.countryCode]) {
that.g11nLocalesByCountryAndLocale[aLocale.countryCode] = { 'locales': {} };
}
if(!that.g11nLocalesByCountryAndCLDRLocale[aLocale.countryCode]) {
that.g11nLocalesByCountryAndCLDRLocale[aLocale.countryCode] = { 'locales': {} };
}
if(!that.g11nLocalesByCountryandLang[aLocale.countryCode]) {
that.g11nLocalesByCountryandLang[aLocale.countryCode] = { 'locales': {} };
}
// for each country enter holistic locale info for 'legacy' locale key
that.g11nLocalesByCountryAndLocale[aLocale.countryCode].locales[aLocale.locale] = aLocale;
that.g11nLocalesByCountryAndCLDRLocale[aLocale.countryCode].locales[aLocale.cldrLocale] = aLocale;
that.g11nLocalesByCountryandLang[aLocale.countryCode].locales[aLocale.language] = aLocale;
if(that.countryTimeZones[aLocale.countryCode]) {
aLocale.primaryTimeZone = that.countryTimeZones[aLocale.countryCode].primaryTimeZone;
aLocale.timeZones = that.countryTimeZones[aLocale.countryCode].timeZones;
}
if(that.countrySupportedLangs[aLocale.countryCode]) {
aLocale.supportedLanguages = that.countrySupportedLangs[aLocale.countryCode];
}
});
};
module.exports = G11nLocaleFactory;
| 32.273077 | 129 | 0.696818 |
c870502bad7287e6465f6ff163169d5422d6e15a | 6,964 | js | JavaScript | public/js/custom/home.js | rGunti/node-mpd-ui | cac8c899193c17beff6c01bb30a371dcbdc791a8 | [
"MIT"
] | 2 | 2017-06-20T16:45:03.000Z | 2017-06-20T16:45:05.000Z | public/js/custom/home.js | rGunti/node-mpd-ui | cac8c899193c17beff6c01bb30a371dcbdc791a8 | [
"MIT"
] | 13 | 2017-06-16T12:32:05.000Z | 2017-12-03T12:42:15.000Z | public/js/custom/home.js | rGunti/node-mpd-ui | cac8c899193c17beff6c01bb30a371dcbdc791a8 | [
"MIT"
] | null | null | null | /*********************************************************************************** *
* MIT License
*
* Copyright (c) 2017 Raphael "rGunti" Guntersweiler
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
* ********************************************************************************* */
function calculateArtworkWidth() {
// Calculate Album Cover Height
var screenHeight = $(window).height();
var screenWidth = $(window).width();
var contentWidth = $('.main-raised > .container').width();
var contentMargin = Number($('.main-raised > .container').css('padding-left').replace('px',''));
var footerHeight = $('footer').height();
var navHeight = 100;
var currentTitleHeight = $('#currentTitle').parent().height();
var currentArtistAlbumHeight = $('#currentArtist').parent().height();
var timestampHeight = $('#currentTimestamp').parent().parent().height();
var timestampBarHeight = $('#timestampProgressBar').parent().parent().height();
var buttonHeight = $('.row.text-center').height();
var failSafe = 30;
var songInfoHeight = currentTitleHeight + currentArtistAlbumHeight + timestampHeight + timestampBarHeight;
var albumCoverHeight = screenHeight
- footerHeight
- navHeight
- songInfoHeight
- buttonHeight
- failSafe
;
albumCoverHeight = Math.min(albumCoverHeight, screenWidth);
$('.album-cover-row').css({ height: albumCoverHeight + 15, position: 'relative' });
$('.album-cover-row > img')
.height(albumCoverHeight)
.width(albumCoverHeight)
.css({
left: (contentWidth / 2) - (albumCoverHeight / 2) + contentMargin,
position: 'absolute'
})
;
$('.album-cover-row').show();
}
/**
* Updates a given Song Info and triggers the recalculation method, unless prevented by parameter
* @param target Target Object (jQuery Selector)
* @param value Value
* @param preventEvent If given and true, the recalculation will not be triggered
*/
function updateSongInfoText(target, value, preventEvent) {
$(target).text(value);
//if (!preventEvent) calculateArtworkWidth();
}
function updateSongTitle(value, preventEvent) { updateSongInfoText('#currentTitle', value, preventEvent) }
function updateSongArtist(value, preventEvent) { updateSongInfoText('#currentArtist', value, preventEvent) }
function updateSongAlbum(value, preventEvent) { updateSongInfoText('#currentAlbum', value, preventEvent) }
function updateSongTimestamp(value) { updateSongInfoText('#currentSongLength', value, true); }
function updateCurrentTimestamp(value) { updateSongInfoText('#currentTimestamp', value, true); }
function updatePlayPauseButton(state) {
$('#playPauseButton > i.material-icons').text((state === 'play' ? 'pause' : 'play_arrow'));
}
function updateTimestampProgressBar(val, max) {
$('#timestampProgressBar').css({
width: ((val / max) * 100) + '%'
});
}
function updateStatusButton(id, val) {
var hasClass = $(id).hasClass('green');
if (val === "1" && !hasClass) {
$(id).addClass('green');
} else if (val === "0" && hasClass) {
$(id).removeClass('green');
}
}
function updateAllSongInfo(title,
artist,
album,
length,
lengthString,
timestamp,
timestampString,
state,
repeat,
random) {
updateSongTitle(title, false);
updateSongArtist(artist, false);
updateSongAlbum(album, false);
updateSongTimestamp(lengthString);
updateCurrentTimestamp(timestampString);
updatePlayPauseButton(state);
updateTimestampProgressBar(timestamp, length);
updateStatusButton('#repeatButton', repeat);
updateStatusButton('#randomButton', random);
//calculateArtworkWidth();
}
function updateUILoop() {
$.ajax({
url: '/mpd/status'
}).done(function(response) {
if (response.ok) {
updateAllSongInfo(
(response.data.currentSong ? response.data.currentSong.Title || '-' : '-'),
(response.data.currentSong ? response.data.currentSong.Artist || '-' : '-'),
(response.data.currentSong ? response.data.currentSong.Album || '-' : '-'),
response.data.songLength,
response.data.songLengthString,
response.data.currentTimestamp,
response.data.currentTimestampString,
response.data.state,
response.data.mpdObject.repeat,
response.data.mpdObject.random
);
}
setTimeout(updateUILoop, 250);
});
}
function executeSimpleRequest(url, method) {
$.ajax({ url: url, method: method || 'post' });
}
$(document).ready(function() {
// Resize Stuff if the Window Size changes
$(window).resize(calculateArtworkWidth);
// Initial Recalc Method
//calculateArtworkWidth();
// Initialize UI Loop
updateUILoop();
// Set Button Events
$('#previousSongButton').click(function() { executeSimpleRequest('/mpd/control/prev') });
$('#playPauseButton').click(function() { executeSimpleRequest('/mpd/control/playPause') });
$('#nextSongButton').click(function() { executeSimpleRequest('/mpd/control/skip') });
$('#repeatButton').click(function() {
$.ajax({
url: '/mpd/repeat',
data: {
repeat: ($('#repeatButton').hasClass('green') ? 0 : 1)
},
method: 'post'
});
});
$('#randomButton').click(function() {
$.ajax({
url: '/mpd/random',
data: {
random: ($('#randomButton').hasClass('green') ? 0 : 1)
},
method: 'post'
});
});
});
| 37.643243 | 110 | 0.612435 |
c87093ba9f704f1330cadec4c3c1b939edf149a7 | 132 | js | JavaScript | get-env.js | RedstoneWizard08/Forem-Multiarch-Docker | 8c4c0bd2967a686c4e21c7528ee57b531eca7776 | [
"MIT"
] | null | null | null | get-env.js | RedstoneWizard08/Forem-Multiarch-Docker | 8c4c0bd2967a686c4e21c7528ee57b531eca7776 | [
"MIT"
] | null | null | null | get-env.js | RedstoneWizard08/Forem-Multiarch-Docker | 8c4c0bd2967a686c4e21c7528ee57b531eca7776 | [
"MIT"
] | null | null | null | const e = process.env.ENVIRONMENT;
if(!e) {
console.log("development");
process.exit(0);
}
console.log(e);
process.exit(0); | 16.5 | 34 | 0.651515 |
c8711a528f0a152dbe77b341e21a825a818497fe | 128 | js | JavaScript | src/includes/Api.js | acarolinafg/dados-brasil-dashboard | 38e1645830c77ee9cc4b209adb6f0c069b22902b | [
"MIT"
] | null | null | null | src/includes/Api.js | acarolinafg/dados-brasil-dashboard | 38e1645830c77ee9cc4b209adb6f0c069b22902b | [
"MIT"
] | null | null | null | src/includes/Api.js | acarolinafg/dados-brasil-dashboard | 38e1645830c77ee9cc4b209adb6f0c069b22902b | [
"MIT"
] | null | null | null | import axios from 'axios';
const API = axios.create({
baseURL: 'http://dadosbrasil.org.br/api/v1/',
});
export default API;
| 16 | 47 | 0.679688 |
c87126604dc96969b510695301e2c3c97af43914 | 3,355 | js | JavaScript | apps/clock/js/alarm_manager.js | pdehaan/gaia | 0ea959d81cefa0128157ec3ff0e2b7bdd29afacf | [
"Apache-2.0"
] | 1 | 2015-03-19T19:15:33.000Z | 2015-03-19T19:15:33.000Z | apps/clock/js/alarm_manager.js | caseyyee/gaia | fa82433dda06e9ae7d35a1f74cc16f4dd72cc514 | [
"Apache-2.0"
] | null | null | null | apps/clock/js/alarm_manager.js | caseyyee/gaia | fa82433dda06e9ae7d35a1f74cc16f4dd72cc514 | [
"Apache-2.0"
] | null | null | null | define(function(require) {
/* An Alarm's ID:
* ID in Clock app ID in mozAlarms API
* id (unique) id (unique)
* type: 'normal' or 'snooze'
*
*
* An alarm has its own id in the Clock app's indexDB(alarmsdb.js).
* In order to maintain(add,remove) an alarm by mozAlarms API,
* we prepare an registeredAlarms object that contains each alarm type:
* 'snooze' and 'normal'
*
* In order to identify the active alarm which comes from mozAlarms API,
* we pass id and type in JSON object data during adding an alarm by API.
* id: sync with each alarm's own id in Clock app's
* type: 'normal', 'snooze' corresponding alarm type
*
*
* An Alarm's Life:
* We maintain an alarm's life cycle immediately when the alarm goes off.
* If user click the snooze button when the alarm goes off,
* we request a snooze alarm immediately.
*
*
* Example:
* (): set a alarm in start state
* []: alarm goes off
* O: an once alarm
* R: a repeatable alarm
* S: a snooze alarm
*
* ====>: the flow of normal alarm
* ---->: the flow of snooze alarm
* |: User click the snooze button
*
* Flow map:
* i. Once Alarm:
* (O) ====> [O]
*
* or (O) ====> [O]
* |
* | ----> [S] ----> [S]
*
*
* ii. Repeat Alarm:
* (R) ====> [R] ====> [R]
* |
* | ----> [S] ----> [S]
*
* | ----> [S] ----> [S]
* | ----> [S] |
* | |
* or (R) ====> [R] ====> [R] ====> [R] ====> [R] ====> [R] ====> [R]
* |
* | ----> [S] ----> [S]
*/
var Utils = require('utils');
var AlarmsDB = require('alarmsdb');
var AlarmManager = {
toggleAlarm: function am_toggleAlarm(alarm, enabled, callback) {
alarm.setEnabled(enabled, callback);
},
updateAlarmStatusBar: function am_updateAlarmStatusBar() {
var request = navigator.mozAlarms.getAll();
request.onsuccess = function(e) {
var hasAlarmEnabled = false;
var generator = Utils.async.generator(function(err) {
if (!err && navigator.mozSettings) {
navigator.mozSettings.createLock().set({
'alarm.enabled': hasAlarmEnabled
});
}
});
var endCb = generator();
for (var i = 0; i < e.target.result.length && !hasAlarmEnabled; i++) {
var data = e.target.result[i].data;
if (!data.id || ['alarm', 'snooze'].indexOf(data.type) === -1) {
return;
}
AlarmsDB.getAlarm(data.id,
(function(mozAlarm, doneCb) {
return function(err, alarm) {
if (!err) {
for (var j in alarm.registeredAlarms) {
if (alarm.registeredAlarms[j] === mozAlarm.id) {
hasAlarmEnabled = true;
}
}
}
doneCb();
};
})(e.target.result[i], generator()));
}
endCb();
};
request.onerror = function(e) {
console.error('get all alarm fail');
};
},
regUpdateAlarmEnableState: function am_regUpdateAlarmEnableState(handler) {
this._updateAlarmEableStateHandler = handler;
}
};
return AlarmManager;
});
| 29.690265 | 77 | 0.504322 |
c871fb844c43f2f5725ec61933130408c6f141cd | 1,664 | js | JavaScript | src/server/middleware/render.js | Dev-vixx/car-filter-client | d85ac1fa9456a16b5cd9963509e644d6c74c301f | [
"MIT"
] | null | null | null | src/server/middleware/render.js | Dev-vixx/car-filter-client | d85ac1fa9456a16b5cd9963509e644d6c74c301f | [
"MIT"
] | null | null | null | src/server/middleware/render.js | Dev-vixx/car-filter-client | d85ac1fa9456a16b5cd9963509e644d6c74c301f | [
"MIT"
] | null | null | null | import escapeStringRegexp from "escape-string-regexp";
import React from "react";
import ReactDOMServer from "react-dom/server";
import { Helmet } from "react-helmet";
import App from "../../App";
import { StaticRouter } from "react-router-dom";
import { Provider as ReduxProvider } from "react-redux";
import serialize from "serialize-javascript";
const renderMiddleware = () => (req, res) => {
let html = req.html;
// reacte router
const routerContext = {};
const store = req.store;
const htmlContent = ReactDOMServer.renderToString(
<ReduxProvider store={store}>
<StaticRouter location={req.url} context={routerContext}>
<App />
</StaticRouter>
</ReduxProvider>
);
const helmet = Helmet.renderStatic();
const htmlReplacements = {
HTML_CONTENT: htmlContent,
PRELOADED_STATE: serialize(store.getState(), { isJSON: true }),
HELMET_HTML_ATTRIBUTES: helmet.htmlAttributes.toString(),
HELMET_META_ATTRIBUTES: `
${helmet.title.toString()}
${helmet.meta.toString()}
${helmet.link.toString()}
`,
HELMET_BODY_ATTRIBUTES: helmet.bodyAttributes.toString()
};
Object.keys(htmlReplacements).forEach(key => {
const value = htmlReplacements[key];
html = html.replace(
new RegExp("__" + escapeStringRegexp(key) + "__", "g"),
value
);
});
if (routerContext.url) {
res.header("Cache-Control", "no-cache, no-store, must-revalidate");
res.header("Pragma", "no-cache");
res.header("Expires", 0);
res.redirect(302, routerContext.url);
} else {
res.send(html);
}
// res.send(html);
};
export default renderMiddleware;
| 30.814815 | 71 | 0.66226 |
c872de81a94dc6304b2f617930be95daa9881428 | 96 | js | JavaScript | corehq/apps/users/_design/views/by_username/map.js | dimagilg/commcare-hq | ea1786238eae556bb7f1cbd8d2460171af1b619c | [
"BSD-3-Clause"
] | 471 | 2015-01-10T02:55:01.000Z | 2022-03-29T18:07:18.000Z | corehq/apps/users/_design/views/by_username/map.js | dimagilg/commcare-hq | ea1786238eae556bb7f1cbd8d2460171af1b619c | [
"BSD-3-Clause"
] | 14,354 | 2015-01-01T07:38:23.000Z | 2022-03-31T20:55:14.000Z | corehq/apps/users/_design/views/by_username/map.js | dimagilg/commcare-hq | ea1786238eae556bb7f1cbd8d2460171af1b619c | [
"BSD-3-Clause"
] | 175 | 2015-01-06T07:16:47.000Z | 2022-03-29T13:27:01.000Z | function(doc) {
if(doc.base_doc === "CouchUser") {
emit(doc.username, null);
}
} | 19.2 | 38 | 0.541667 |
c873216006092e6ac0a20c93b7711089a2aaf121 | 2,919 | js | JavaScript | packages/ui/src/components/common/APSelect/APGroupSelect.js | max-vorabhol-zipmex/express-app | 455efc2eaebd64b0a50fba98c19e4e8eda5a13f6 | [
"MIT"
] | null | null | null | packages/ui/src/components/common/APSelect/APGroupSelect.js | max-vorabhol-zipmex/express-app | 455efc2eaebd64b0a50fba98c19e4e8eda5a13f6 | [
"MIT"
] | 3 | 2021-07-12T02:06:20.000Z | 2021-08-11T01:48:33.000Z | packages/ui/src/components/common/APSelect/APGroupSelect.js | max-vorabhol-zipmex/express-app | 455efc2eaebd64b0a50fba98c19e4e8eda5a13f6 | [
"MIT"
] | null | null | null | import React from 'react';
import PropTypes from 'prop-types';
import { Field } from 'redux-form';
import classnames from 'classnames';
import { getBEMClasses } from '../../../helpers/cssClassesHelper';
import { Text } from 'design/typography';
import './APSelect.css';
export const GroupSelect = (props) => {
const {
input,
meta,
classModifiers,
customClass,
info,
label,
onSelect,
showTriangles,
optionGroups = [],
placeholder,
...passedProps
} = props;
const baseClasses = getBEMClasses(['ap-select', customClass]);
return (
<div
className={`form-group ${baseClasses('select-wrapper', classModifiers)}`}
>
<label className={`ap--label ${baseClasses('select-label')}`}>
<Text>{label}</Text>
</label>
{showTriangles ? (
<div className={baseClasses('triangles-container')}>
<span className={'triangle-down'} />
</div>
) : (
''
)}
<select
className={classnames(
`form-control ${baseClasses('select')}`,
input && !input.value && baseClasses('select-unselected')
)}
{...input}
{...passedProps}
onChange={(e) => {
if (onSelect) onSelect(e.target.value);
input && input.onChange(e);
}}
>
{placeholder && (
<option
className={baseClasses('option-placeholder')}
value=""
disabled
>
{placeholder}
</option>
)}
{optionGroups.map((i) => {
return (
<optgroup key={i.label} label={i.label}>
{i.options.map((j) => {
return (
<option key={j.value} value={j.value}>
{j.label}
</option>
);
})}
</optgroup>
);
})}
</select>
<small className={`form-text-muted ${baseClasses('select-info')}`}>
{info}
</small>
{meta && meta.dirty && meta.error && (
<span className={baseClasses('select-error')}>{meta.error}</span>
)}
</div>
);
};
const APGroupSelect = (props) => (
<Field name={props.name} component={GroupSelect} {...props} />
);
APGroupSelect.defaultProps = {
name: '',
label: '',
classes: 'input',
customClass: 'custom-select',
classModifiers: '',
info: '',
autoFocus: '',
disabled: false,
multiple: false,
required: false,
};
APGroupSelect.propTypes = {
name: PropTypes.string,
label: PropTypes.string,
classes: PropTypes.string,
customClass: PropTypes.string,
classModifiers: PropTypes.string,
info: PropTypes.string,
autoFocus: PropTypes.string,
onSelect: PropTypes.func,
disabled: PropTypes.bool,
multiple: PropTypes.bool,
required: PropTypes.bool,
placeholder: PropTypes.string,
};
export default APGroupSelect;
| 23.92623 | 79 | 0.550531 |
c873ac41a792a17ee20f91064f702296646508e4 | 495 | js | JavaScript | ui/src/icons/ArrowLeftIcon.js | icgc-dcc/portal-x | e0febf8795795188e1b9bc50aafb5bbfa8fea528 | [
"BSD-3-Clause"
] | null | null | null | ui/src/icons/ArrowLeftIcon.js | icgc-dcc/portal-x | e0febf8795795188e1b9bc50aafb5bbfa8fea528 | [
"BSD-3-Clause"
] | null | null | null | ui/src/icons/ArrowLeftIcon.js | icgc-dcc/portal-x | e0febf8795795188e1b9bc50aafb5bbfa8fea528 | [
"BSD-3-Clause"
] | null | null | null | import React from 'react';
import { InlineSvg } from 'icons';
const ArrowLeftIcon = ({
fill = 'currentColor',
width = '6px',
height = '8px',
viewBox = '0 0 75 100',
...props
}) =>
InlineSvg({
alt: 'Left Arrow Icon',
viewBox,
width,
height,
fill,
path: (
<path d="M38,3.05l-35,35a10.54,10.54,0,0,0,0,14.83l35,35A10.42,10.42,0,0,0,52.78,73.14L25.1,45.46,52.78,17.79A10.42,10.42,0,0,0,38,3.05" />
),
...props,
});
export default ArrowLeftIcon;
| 20.625 | 145 | 0.579798 |
c87414abca87ee11f637f277724d00343cde0bcd | 505 | js | JavaScript | packages/test-vectors/src/generators/PostalAddress.js | margojohnson24/traceability-vocab | 1aed295cdbda5192240b8e7626cb92576298231e | [
"Apache-2.0",
"W3C-20150513"
] | 13 | 2020-10-21T16:27:41.000Z | 2022-03-23T07:07:41.000Z | packages/test-vectors/src/generators/PostalAddress.js | margojohnson24/traceability-vocab | 1aed295cdbda5192240b8e7626cb92576298231e | [
"Apache-2.0",
"W3C-20150513"
] | 275 | 2020-10-14T16:28:52.000Z | 2022-03-29T18:29:58.000Z | packages/test-vectors/src/generators/PostalAddress.js | margojohnson24/traceability-vocab | 1aed295cdbda5192240b8e7626cb92576298231e | [
"Apache-2.0",
"W3C-20150513"
] | 26 | 2020-10-19T18:45:31.000Z | 2022-03-09T10:51:13.000Z | const faker = require('faker');
const getPostalAddress = () => {
const example = {
'@context': ['https://w3id.org/traceability/v1'],
type: 'PostalAddress',
organizationName: faker.company.companyName(),
streetAddress: faker.address.streetAddress(),
addressLocality: faker.address.city(),
addressRegion: faker.address.state(),
postalCode: faker.address.zipCode(),
addressCountry: faker.address.country(),
};
return example;
};
module.exports = { getPostalAddress };
| 28.055556 | 53 | 0.687129 |
c875800731e3fee1a7c05ab201e6dae29b826153 | 811 | js | JavaScript | app.js | meow-it/meow-server | 03191c51cf1be24d7605c19c85a9fdf4dd4359fe | [
"MIT"
] | null | null | null | app.js | meow-it/meow-server | 03191c51cf1be24d7605c19c85a9fdf4dd4359fe | [
"MIT"
] | null | null | null | app.js | meow-it/meow-server | 03191c51cf1be24d7605c19c85a9fdf4dd4359fe | [
"MIT"
] | null | null | null | const dotenv = require("dotenv")
dotenv.config()
const express = require("express")
const app = express()
require("./database")
const { cors } = require("./middleware")
const port = process.env.PORT || 3003
app.listen(port, () => {
console.log(`Server running on port ${port}`)
})
app.use(express.json())
app.use(express.urlencoded({ extended: true }))
// API Routes
const registerAPI = require("./routes/api/register")
const meowAPI = require("./routes/api/meow")
const commentAPI = require("./routes/api/comment")
const reportAPI = require("./routes/api/report")
app.use("/api/register", cors, registerAPI)
app.use("/api/meow", cors, meowAPI)
app.use("/api/comment", cors, commentAPI)
app.use("/api/report", cors, reportAPI)
app.get("/", (_, res) => {
res.status(200).send({ text: "Hello World!"})
})
| 26.16129 | 52 | 0.680641 |
c875d7b36753e9456aa3bbd7e44f18b67b3cfcf5 | 1,740 | js | JavaScript | src/pages/404.js | DavidKindler/davidkindler.github.io | be8d1846feeaa78604f2c50e97bd3cd825d48172 | [
"MIT"
] | null | null | null | src/pages/404.js | DavidKindler/davidkindler.github.io | be8d1846feeaa78604f2c50e97bd3cd825d48172 | [
"MIT"
] | null | null | null | src/pages/404.js | DavidKindler/davidkindler.github.io | be8d1846feeaa78604f2c50e97bd3cd825d48172 | [
"MIT"
] | null | null | null | /* eslint-disable jsx-a11y/accessible-emoji */
import React from 'react'
import { graphql, useStaticQuery } from 'gatsby'
import styled from 'styled-components'
import Layout from '../layout'
import Wrapper from '../components/Wrapper'
import SEO from '../components/SEO'
import RelatedPosts from '../components/RelatedPosts'
import { Text } from '../components/Commons'
const MainTitle = styled.h1`
line-height: 1.5;
text-align: center;
font-size: 3rem;
`
const Ghost = styled.span`
display: block;
line-height: 1.5;
text-align: center;
font-size: 7rem;
`
const SubTitle = styled.h2`
padding-top: 40px;
line-height: 1.2;
border-top: 1px solid #ececec;
margin-top: 44px;
`
const NotFoundPage = props => {
const data = useStaticQuery(graphql`
query {
posts: allMdx(
sort: { fields: [frontmatter___date], order: DESC }
filter: { fileAbsolutePath: { regex: "//content/posts//" } }
limit: 5
) {
edges {
node {
excerpt
frontmatter {
date
title
tags
slug
}
}
}
}
}
`)
const posts = data.posts.edges
return (
<Layout location={props.location} noCover={true}>
<SEO title="Page Not Found" />
<Wrapper>
<MainTitle>404 Page Not Found</MainTitle>
<Ghost role="img" aria-label="Ghost">
👻
</Ghost>
<Text>
Looks like you've followed a broken link or entered a URL that doesn't
exist on this site.
</Text>
<SubTitle>Recent Posts</SubTitle>
<RelatedPosts posts={posts} />
</Wrapper>
</Layout>
)
}
export default NotFoundPage
| 22.025316 | 80 | 0.583333 |
c8764275f639dfe2e76ad0edff6de06818f8107f | 25,195 | js | JavaScript | generated/docs/hydra/722c9931.dcf24c1a.js | jaredpreston/web-1 | 0d2f2ce8a839d157a5acc4aae7cc9a4620e1a804 | [
"Apache-2.0"
] | 25 | 2020-07-02T08:17:54.000Z | 2022-03-22T15:06:04.000Z | generated/docs/hydra/722c9931.dcf24c1a.js | jaredpreston/web-1 | 0d2f2ce8a839d157a5acc4aae7cc9a4620e1a804 | [
"Apache-2.0"
] | 554 | 2020-07-02T08:05:51.000Z | 2022-03-31T10:54:32.000Z | generated/docs/hydra/722c9931.dcf24c1a.js | jaredpreston/web-1 | 0d2f2ce8a839d157a5acc4aae7cc9a4620e1a804 | [
"Apache-2.0"
] | 21 | 2020-08-03T11:38:33.000Z | 2022-03-18T13:37:09.000Z | (window.webpackJsonp=window.webpackJsonp||[]).push([[173],{242:function(e,n,t){"use strict";t.r(n),t.d(n,"frontMatter",(function(){return c})),t.d(n,"metadata",(function(){return l})),t.d(n,"rightToc",(function(){return d})),t.d(n,"default",(function(){return b}));var a=t(3),o=t(7),r=(t(0),t(481)),s=t(484),i=t(485),c={id:"consent",title:"Implementing the Consent Endpoint & UI",sidebar_label:"Consent Endpoint"},l={unversionedId:"guides/consent",id:"version-v1.9/guides/consent",isDocsHomePage:!1,title:"Implementing the Consent Endpoint & UI",description:"Please read the Consent Flow Documentation first!",source:"@site/versioned_docs/version-v1.9/guides/consent.mdx",slug:"/guides/consent",permalink:"/hydra/docs/guides/consent",editUrl:"https://github.com/ory/hydra/edit/master/docs/versioned_docs/version-v1.9/guides/consent.mdx",version:"v1.9",lastUpdatedBy:"aeneasr",lastUpdatedAt:1603200622,sidebar_label:"Consent Endpoint",sidebar:"version-v1.9/docs",previous:{title:"Implementing the Login Endpoint",permalink:"/hydra/docs/guides/login"},next:{title:"Implementing the Logout Endpoint & UI",permalink:"/hydra/docs/guides/logout"}},d=[{value:"Implementing the Consent HTML Form",id:"implementing-the-consent-html-form",children:[]},{value:"Accepting the Consent Request",id:"accepting-the-consent-request",children:[]},{value:"Rejecting the Consent Request",id:"rejecting-the-consent-request",children:[]},{value:"Complete Endpoint",id:"complete-endpoint",children:[]}],h={rightToc:d};function b(e){var n=e.components,c=Object(o.a)(e,["components"]);return Object(r.b)("wrapper",Object(a.a)({},h,c,{components:n,mdxType:"MDXLayout"}),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"note")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"Please read the ",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"/hydra/docs/concepts/consent"}),"Consent Flow Documentation")," first!"))),Object(r.b)("p",null,"In this document, you will learn how to implement the Consent Endpoint using our\nORY Hydra SDKs. The goal for this document is to have document this for multiple\nprogramming languages. If you are an expert in one of these languages, your help\nis highly appreciated in improving these docs!"),Object(r.b)("h2",{id:"implementing-the-consent-html-form"},"Implementing the Consent HTML Form"),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"note")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"The Consent HTML Form cannot be a Single Page App (Client-side browser\napplication) or a Mobile App! It has to be a server-side application with access\nto ORY Hydra's Admin Endpoint!"))),Object(r.b)(s.a,{defaultValue:"ui",values:[{label:"UI",value:"ui"},{label:"NodeJS",value:"node"},{label:"HTML Example",value:"html"}],mdxType:"Tabs"},Object(r.b)(i.a,{value:"ui",mdxType:"TabItem"},Object(r.b)("p",null,Object(r.b)("img",{alt:"OAuth2 Consent UI Screen",src:t(646).default}))),Object(r.b)(i.a,{value:"node",mdxType:"TabItem"},Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"note")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"Check out our\n",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"https://github.com/ory/hydra-login-consent-node"}),"reference implementation")," of\nthis endpoint!"))),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-typescript",metastring:'title="routes/consent.ts"',title:'"routes/consent.ts"'}),"// This example uses ExpressJS\nimport express from 'express'\nimport url from 'url'\nimport csrf from 'csurf'\nimport { AdminApi } from '@oryd/hydra-client'\n\nconst hydraAdmin = new AdminApi(process.env.HYDRA_ADMIN_URL)\n\n// Sets up csrf protection. Always do this when handling HTML forms!\nconst csrfProtection = csrf({ cookie: true })\nconst router = express.Router()\n\nrouter.get('/get', csrfProtection, (req, res, next) => {\n // Parses the URL query\n const query = url.parse(req.url, true).query\n\n // The challenge is used to fetch information about the consent request from ORY hydraAdmin.\n const challenge = String(query.consent_challenge)\n\n hydraAdmin\n .getConsentRequest(challenge)\n // This will be called if the HTTP request was successful\n .then(({ body }) => {\n // If a user has granted this application the requested scope, hydra will tell us to not show the UI.\n if (body.skip) {\n // You can apply logic here, for example grant another scope, or do whatever...\n // ...\n\n // Now it's time to grant the consent request. You could also deny the request if something went terribly wrong\n return hydraAdmin\n .acceptConsentRequest(challenge, {\n // We can grant all scopes that have been requested - hydra already checked for us that no additional scopes\n // are requested accidentally.\n grantScope: body.requestedScope,\n\n // ORY Hydra checks if requested audiences are allowed by the client, so we can simply echo this.\n grantAccessTokenAudience: body.requestedAccessTokenAudience,\n\n // The session allows us to set session data for id and access tokens\n session: {\n // This data will be available when introspecting the token. Try to avoid sensitive information here,\n // unless you limit who can introspect tokens.\n // accessToken: { foo: 'bar' },\n // This data will be available in the ID token.\n // idToken: { baz: 'bar' },\n }\n })\n .then(({ body }) => {\n // All we need to do now is to redirect the user back to hydra!\n res.redirect(String(body.redirectTo))\n })\n }\n\n // If consent can't be skipped we MUST show the consent UI.\n res.render('consent', {\n csrfToken: req.csrfToken(),\n challenge: challenge,\n // We have a bunch of data available from the response, check out the API docs to find what these values mean\n // and what additional data you have available.\n requested_scope: body.requestedScope,\n user: body.subject,\n client: body.client\n })\n })\n // This will handle any error that happens when making HTTP calls to hydra\n .catch(next)\n})\n"))),Object(r.b)(i.a,{value:"html",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-html"}),'<form action="/consent" method="POST">\n <input type="hidden" name="challenge" value="#{ challenge }" />\n <input type="hidden" name="_csrf" value="#{ csrfToken }" />\n <p>\n Hi #{ user }, application <strong>#{ client.client_name }</strong> wants\n access resources on your behalf and to:\n </p>\n\n \x3c!--\n In a real application, you would iterate over all the scopes the OAuth2 Client has requested here.\n\n For the sake of simplicity, we\'ll just show the two scopes `openid` and `offline` here:\n --\x3e\n <input type="checkbox" id="openid" value="openid" name="grant_scope" />\n <label for="openid">openid</label><br />\n\n <input type="checkbox" id="offline" value="offline" name="grant_scope" />\n <label for="offline">offline</label><br />\n\n <p>\n Do you want to be asked next time when this application wants to access your\n data? The application will not be able to ask for more permissions without\n your consent.\n </p>\n\n <input type="checkbox" id="remember" name="remember" value="1" />\n <label for="remember">Do not ask me again</label><br />\n\n <input type="submit" id="accept" name="submit" value="Allow access" />\n <input type="submit" id="reject" name="submit" value="Deny access" />\n</form>\n')))),Object(r.b)("h2",{id:"accepting-the-consent-request"},"Accepting the Consent Request"),Object(r.b)(s.a,{defaultValue:"node",values:[{label:"NodeJS",value:"node"}],mdxType:"Tabs"},Object(r.b)(i.a,{value:"node",mdxType:"TabItem"},Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"note")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"Check out our\n",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"https://github.com/ory/hydra-login-consent-node"}),"reference implementation")," of\nthis endpoint!"))),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-typescript"}),"hydraAdmin\n .acceptConsentRequest(challenge, {\n // We can grant all scopes that have been requested - hydra already checked for us that no additional scopes\n // are requested accidentally.\n grantScope: ['email', 'openid'],\n\n // The session allows us to set session data for id and access tokens\n session: {\n // This data will be available when introspecting the token. Try to avoid sensitive information here,\n // unless you limit who can introspect tokens.\n access_token: {\n // foo: 'bar'\n },\n\n // This data will be available in the ID token.\n id_token: {\n // baz: 'bar'\n }\n },\n\n // This tells hydra to remember this consent request and allow the same client to request the same\n // scopes from the same user, without showing the UI, in the future.\n remember: true,\n\n // When this \"remember\" sesion expires, in seconds. Set this to 0 so it will never expire.\n rememberFor: 3600\n })\n .then(({ body }) => {\n // All we need to do now is to redirect the user back to hydra!\n res.redirect(String(body.redirectTo))\n })\n// This will handle any error that happens when making HTTP calls to hydra\n// .catch(next);\n")))),Object(r.b)("h2",{id:"rejecting-the-consent-request"},"Rejecting the Consent Request"),Object(r.b)(s.a,{defaultValue:"node",values:[{label:"NodeJS",value:"node"}],mdxType:"Tabs"},Object(r.b)(i.a,{value:"node",mdxType:"TabItem"},Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"note")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"Check out our\n",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"https://github.com/ory/hydra-login-consent-node"}),"reference implementation")," of\nthis endpoint!"))),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-typescript"}),"hydraAdmin\n .rejectConsentRequest(challenge, {\n error: 'access_denied',\n errorDescription: 'The resource owner denied the request'\n })\n .then(({ body }) => {\n // All we need to do now is to redirect the browser back to hydra!\n res.redirect(String(body.redirectTo))\n })\n// This will handle any error that happens when making HTTP calls to hydra\n// .catch(next);\n")))),Object(r.b)("h2",{id:"complete-endpoint"},"Complete Endpoint"),Object(r.b)(s.a,{defaultValue:"node",values:[{label:"NodeJS",value:"node"}],mdxType:"Tabs"},Object(r.b)(i.a,{value:"node",mdxType:"TabItem"},Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"note")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"Check out our\n",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"https://github.com/ory/hydra-login-consent-node"}),"reference implementation")," of\nthis endpoint!"))),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-typescript",metastring:'title="routes/consent.ts"',title:'"routes/consent.ts"'}),"// This is the endpoint the user ends up at once she/he inserts their password and username and hits \"Log in\".\nrouter.post('/consent', csrfProtection, (req, res, next) => {\n // The challenge is now a hidden input field, so let's take it from the request body instead\n const challenge = req.body.challenge;\n\n // Let's see if the user decided to accept or reject the consent request..\n if (req.body.submit !== 'Allow access') {\n // Looks like the consent request was denied by the user\n return hydraAdmin.rejectConsentRequest(challenge, {\n error: 'access_denied',\n errorDescription: 'The resource owner denied the request'\n }).then(({body}) => {\n // All we need to do now is to redirect the browser back to hydra!\n res.redirect(String(body.redirectTo));\n })\n // This will handle any error that happens when making HTTP calls to hydra\n .catch(next);\n }\n\n // Helps with form arrays\n let grantScope = req.body.grant_scope\n if (!Array.isArray(grantScope)) {\n grantScope = [grantScope]\n }\n\n // The session allows us to set session data for id and access tokens\n let session = {\n // This data will be available when introspecting the token. Try to avoid sensitive information here,\n // unless you limit who can introspect tokens.\n accessToken: {\n foo: 'bar'\n },\n\n // This data will be available in the ID token.\n idToken: {\n // baz: 'bar'\n },\n }\n\n // Here is also the place to add data to the ID or access token. For example,\n // if the scope 'profile' is added, add the family and given name to the ID Token claims:\n if (grantScope.indexOf('profile')) {\n session.idToken.family_name = 'Doe'\n session.idToken.given_name = 'John'\n }\n\n // Let's fetch the consent request again to be able to set `grantAccessTokenAudience` properly.\n hydraAdmin.getConsentRequest(challenge)\n // This will be called if the HTTP request was successful\n .then(({body}) => {\n return hydraAdmin.acceptConsentRequest(challenge, {\n // We can grant all scopes that have been requested - hydra already checked for us that no additional scopes\n // are requested accidentally.\n grantScope: grantScope,\n\n // The session allows us to set session data for id and access tokens\n session: session,\n\n // ORY Hydra checks if requested audiences are allowed by the client, so we can simply echo this.\n grantAccessTokenAudience: body.`requestedAccessTokenAudience`,\n\n // This tells hydra to remember this consent request and allow the same client to request the same\n // scopes from the same user, without showing the UI, in the future.\n remember: Boolean(req.body.remember),\n\n // When this \"remember\" sesion expires, in seconds. Set this to 0 so it will never expire.\n rememberFor: 3600,\n }).then(({body}) => {\n // All we need to do now is to redirect the user back to hydra!\n res.redirect(String(body.redirectTo));\n })\n })\n // This will handle any error that happens when making HTTP calls to hydra\n .catch(next);\n});\n")))))}b.isMDXComponent=!0},481:function(e,n,t){"use strict";t.d(n,"a",(function(){return h})),t.d(n,"b",(function(){return u}));var a=t(0),o=t.n(a);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function s(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function i(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?s(Object(t),!0).forEach((function(n){r(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function c(e,n){if(null==e)return{};var t,a,o=function(e,n){if(null==e)return{};var t,a,o={},r=Object.keys(e);for(a=0;a<r.length;a++)t=r[a],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)t=r[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=o.a.createContext({}),d=function(e){var n=o.a.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},h=function(e){var n=d(e.components);return o.a.createElement(l.Provider,{value:n},e.children)},b={inlineCode:"code",wrapper:function(e){var n=e.children;return o.a.createElement(o.a.Fragment,{},n)}},p=o.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,r=e.originalType,s=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),h=d(t),p=a,u=h["".concat(s,".").concat(p)]||h[p]||b[p]||r;return t?o.a.createElement(u,i(i({ref:n},l),{},{components:t})):o.a.createElement(u,i({ref:n},l))}));function u(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var r=t.length,s=new Array(r);s[0]=p;var i={};for(var c in n)hasOwnProperty.call(n,c)&&(i[c]=n[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var l=2;l<r;l++)s[l]=t[l];return o.a.createElement.apply(null,s)}return o.a.createElement.apply(null,t)}p.displayName="MDXCreateElement"},484:function(e,n,t){"use strict";var a=t(0),o=t.n(a),r=t(491),s=t(486),i=t(55),c=t.n(i),l=37,d=39;n.a=function(e){var n=e.lazy,t=e.block,i=e.defaultValue,h=e.values,b=e.groupId,p=e.className,u=Object(r.a)(),m=u.tabGroupChoices,f=u.setTabGroupChoices,v=Object(a.useState)(i),g=v[0],y=v[1],O=a.Children.toArray(e.children);if(null!=b){var j=m[b];null!=j&&j!==g&&h.some((function(e){return e.value===j}))&&y(j)}var w=function(e){y(e),null!=b&&f(b,e)},T=[];return o.a.createElement("div",null,o.a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:Object(s.a)("tabs",{"tabs--block":t},p)},h.map((function(e){var n=e.value,t=e.label;return o.a.createElement("li",{role:"tab",tabIndex:0,"aria-selected":g===n,className:Object(s.a)("tabs__item",c.a.tabItem,{"tabs__item--active":g===n}),key:n,ref:function(e){return T.push(e)},onKeyDown:function(e){!function(e,n,t){switch(t.keyCode){case d:!function(e,n){var t=e.indexOf(n)+1;e[t]?e[t].focus():e[0].focus()}(e,n);break;case l:!function(e,n){var t=e.indexOf(n)-1;e[t]?e[t].focus():e[e.length-1].focus()}(e,n)}}(T,e.target,e)},onFocus:function(){return w(n)},onClick:function(){w(n)}},t)}))),n?Object(a.cloneElement)(O.filter((function(e){return e.props.value===g}))[0],{className:"margin-vert--md"}):o.a.createElement("div",{className:"margin-vert--md"},O.map((function(e,n){return Object(a.cloneElement)(e,{key:n,hidden:e.props.value!==g})}))))}},485:function(e,n,t){"use strict";var a=t(3),o=t(0),r=t.n(o);n.a=function(e){var n=e.children,t=e.hidden,o=e.className;return r.a.createElement("div",Object(a.a)({role:"tabpanel"},{hidden:t,className:o}),n)}},486:function(e,n,t){"use strict";function a(e){var n,t,o="";if("string"==typeof e||"number"==typeof e)o+=e;else if("object"==typeof e)if(Array.isArray(e))for(n=0;n<e.length;n++)e[n]&&(t=a(e[n]))&&(o&&(o+=" "),o+=t);else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}n.a=function(){for(var e,n,t=0,o="";t<arguments.length;)(e=arguments[t++])&&(n=a(e))&&(o&&(o+=" "),o+=n);return o}},491:function(e,n,t){"use strict";var a=t(0),o=t(492);n.a=function(){var e=Object(a.useContext)(o.a);if(null==e)throw new Error("`useUserPreferencesContext` is used outside of `Layout` Component.");return e}},492:function(e,n,t){"use strict";var a=t(0),o=Object(a.createContext)(void 0);n.a=o},646:function(e,n,t){"use strict";t.r(n),n.default=t.p+"assets/images/consent-endpoint-31856a0555a6a8438d4603692bdab5d2.png"}}]); | 25,195 | 25,195 | 0.671403 |
c87674e203214f22017667402ee0ec361bb1d0c2 | 96 | js | JavaScript | view/adminhtml/requirejs-config.js | hafeez3000/botamp-magento | 7591bf9135d1815b5b1b21ae71977d1411cf81c3 | [
"MIT"
] | null | null | null | view/adminhtml/requirejs-config.js | hafeez3000/botamp-magento | 7591bf9135d1815b5b1b21ae71977d1411cf81c3 | [
"MIT"
] | null | null | null | view/adminhtml/requirejs-config.js | hafeez3000/botamp-magento | 7591bf9135d1815b5b1b21ae71977d1411cf81c3 | [
"MIT"
] | null | null | null | var config = {
map: {
'*': {
botampImport: 'Botamp_Botamp/js/import'
}
}
};
| 12 | 47 | 0.46875 |
c877263b1843e5c88f8754a865bf0012da385107 | 829 | js | JavaScript | lib/sw_services/xilpuf/doc/html/api/navtreeindex0.js | martinexner/embeddedsw | 32c95d3b7dbc21c3b84c84d497596304c87948b7 | [
"BSD-2-Clause",
"MIT"
] | 595 | 2015-02-03T15:07:36.000Z | 2022-03-31T18:21:23.000Z | lib/sw_services/xilpuf/doc/html/api/navtreeindex0.js | martinexner/embeddedsw | 32c95d3b7dbc21c3b84c84d497596304c87948b7 | [
"BSD-2-Clause",
"MIT"
] | 144 | 2016-01-08T17:56:37.000Z | 2022-03-31T13:23:52.000Z | lib/sw_services/xilpuf/doc/html/api/navtreeindex0.js | martinexner/embeddedsw | 32c95d3b7dbc21c3b84c84d497596304c87948b7 | [
"BSD-2-Clause",
"MIT"
] | 955 | 2015-03-30T00:54:27.000Z | 2022-03-31T11:32:23.000Z | var NAVTREEINDEX0 =
{
"files.html":[1],
"globals.html":[0,0],
"globals_func.html":[0,1],
"index.html":[],
"pages.html":[],
"xilpuf__enc__dec__data__example_8c.html":[1,0],
"xilpuf__example_8c.html":[1,1],
"xilpuf__example_8h.html":[1,2],
"xilpuf__regeneration__example_8c.html":[1,3],
"xpuf_8c.html":[1,4],
"xpuf_8c.html#ga03c85715b04394967ebb2274f09f510a":[1,4,1],
"xpuf_8c.html#ga2f60c4624b046d3f5c74d8cb01f8f90d":[1,4,2],
"xpuf_8c.html#ga651bbcfe2834f71fa821e1cb113a723f":[1,4,0],
"xpuf_8c.html#gae2607f20a8f0199c8f0eb53d0dfc9f0a":[1,4,3],
"xpuf_8h.html":[1,5],
"xpuf_8h.html#ga03c85715b04394967ebb2274f09f510a":[1,5,1],
"xpuf_8h.html#ga2f60c4624b046d3f5c74d8cb01f8f90d":[1,5,2],
"xpuf_8h.html#ga651bbcfe2834f71fa821e1cb113a723f":[1,5,0],
"xpuf_8h.html#gae2607f20a8f0199c8f0eb53d0dfc9f0a":[1,5,3],
"xpuf__hw_8h.html":[1,6]
};
| 34.541667 | 58 | 0.757539 |
c877c18d2d800d5d5884470d9da7c188ff455c23 | 113 | js | JavaScript | src/pages/login/actions/counter.js | yucopowo/study_webpack4 | 7d4040b1c50d2998ee3c14488b905fe409cdc575 | [
"MIT"
] | null | null | null | src/pages/login/actions/counter.js | yucopowo/study_webpack4 | 7d4040b1c50d2998ee3c14488b905fe409cdc575 | [
"MIT"
] | null | null | null | src/pages/login/actions/counter.js | yucopowo/study_webpack4 | 7d4040b1c50d2998ee3c14488b905fe409cdc575 | [
"MIT"
] | null | null | null | import { INCREMENT } from '../constants/counter';
export const onIncrement = () => ({
type: 'INCREMENT'
});
| 18.833333 | 49 | 0.619469 |
c8783aee6d8ba2daef9c9e2dfb3725ea0211bec0 | 1,606 | js | JavaScript | word-consumer/index.js | Dunkelheit/word-platform | 80a85bc2482a97e5a3220eeb39a076cbbf855bea | [
"MIT"
] | null | null | null | word-consumer/index.js | Dunkelheit/word-platform | 80a85bc2482a97e5a3220eeb39a076cbbf855bea | [
"MIT"
] | 1 | 2017-06-13T13:07:04.000Z | 2017-06-13T13:07:04.000Z | word-consumer/index.js | Dunkelheit/word-platform | 80a85bc2482a97e5a3220eeb39a076cbbf855bea | [
"MIT"
] | null | null | null | 'use strict';
const kafka = require('kafka-node');
const log = require('./log');
const metrics = require('./metrics');
log.info('Starting up word-consumer');
const Producer = kafka.Producer;
const Consumer = kafka.Consumer;
const client = new kafka.Client('zookeeper:2181', 'word-consumer-client', {
spinDelay: 1000,
retries: 20
});
const producer = new Producer(client);
const consumer = new Consumer(client, [{ topic: 'Words', partition: 0}], { autoCommit: false });
let producerReady = false;
consumer.on('message', function (message) {
metrics.increment('messages.received.word-consumer');
log.debug({ topic: message.topic, message: message.value }, 'Word consumer received a message');
const messageObject = JSON.parse(message.value);
const points = messageObject.message.split(' ').length;
const userId = messageObject.userId;
log.debug({ points, userId }, 'Word consumer transforms the message into points');
if (!producerReady) {
log.fatal('Producer is not ready yet!');
}
const payloadMessage = JSON.stringify({
points,
userId
});
const payloads = [{
topic: 'Points',
messages: [payloadMessage]
}];
producer.send(payloads, function (err, data) {
metrics.increment('messages.sent.word-consumer');
if (err) {
log.error(err, 'An error has occurred!');
}
log.debug({ data, payloadMessage }, 'Word consumer sent some transformed data');
});
});
producer.on('ready', function () {
producerReady = true;
log.info('Producer is ready');
}); | 29.740741 | 100 | 0.648194 |
c8784c91fe5175aea2be553466156d1e9b49524c | 1,027 | js | JavaScript | public/scripts/page-orphanages.js | Bodegami/rocketseat-nlw3 | 0a13bdcc44563a87f0caec09bd15d907394b9317 | [
"MIT"
] | null | null | null | public/scripts/page-orphanages.js | Bodegami/rocketseat-nlw3 | 0a13bdcc44563a87f0caec09bd15d907394b9317 | [
"MIT"
] | null | null | null | public/scripts/page-orphanages.js | Bodegami/rocketseat-nlw3 | 0a13bdcc44563a87f0caec09bd15d907394b9317 | [
"MIT"
] | null | null | null | //create map
const map = L.map('mapid').setView([-23.6073693,-46.6469192], 15);
//create and add tileLayer
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', ).addTo(map);
//create icon
const icon = L.icon({
iconUrl: "/images/map-marker.svg",
iconSize: [58, 68],
iconAnchor: [29,68],
popupAnchor: [170, 2]
})
function addmarker({id , name, lat, lng}) {
//create popup overlay
const popup = L.popup({
closeButton: false,
className: 'map-popup',
minWidth: 240,
minHeight: 240
}).setContent(`${name} <a href="/orphanage?id=${id}"> <img src="/images/arrow-white.svg" </a>`)
//create and add marker
L.marker([lat,lng], {icon: icon}).addTo(map)
.bindPopup(popup)
}
const orphanagesSpan = document.querySelectorAll('.orphanages span')
orphanagesSpan.forEach(span => {
const orphanage = {
id: span.dataset.id,
name: span.dataset.name,
lat: span.dataset.lat,
lng: span.dataset.lng
}
addmarker(orphanage)
})
| 21.395833 | 99 | 0.617332 |
c8784f78813ea1971b4e07e262ba2cb22eef87e6 | 99,746 | js | JavaScript | public/bower_components/angular/angular.min.js | krutika20/empadmintheme | 31640d8cb8eb038ef87f522bf094713a6721838a | [
"MIT"
] | 1 | 2020-04-28T00:23:13.000Z | 2020-04-28T00:23:13.000Z | public/bower_components/angular/angular.min.js | krutika20/empadmintheme | 31640d8cb8eb038ef87f522bf094713a6721838a | [
"MIT"
] | null | null | null | public/bower_components/angular/angular.min.js | krutika20/empadmintheme | 31640d8cb8eb038ef87f522bf094713a6721838a | [
"MIT"
] | 2 | 2018-03-10T11:54:39.000Z | 2018-03-10T11:57:19.000Z | /*
AngularJS v1.2.5
(c) 2010-2014 Google, Inc. http://angularjs.org
License: MIT
*/
(function(W,N,r){'use strict';function G(b){return function(){var a=arguments[0],c,a="["+(b?b+":":"")+a+"] http://errors.angularjs.org/1.2.5/"+(b?b+"/":"")+a;for(c=1;c<arguments.length;c++)a=a+(1==c?"?":"&")+"p"+(c-1)+"="+encodeURIComponent("function"==typeof arguments[c]?arguments[c].toString().replace(/ \{[\s\S]*$/,""):"undefined"==typeof arguments[c]?"undefined":"string"!=typeof arguments[c]?JSON.stringify(arguments[c]):arguments[c]);return Error(a)}}function pb(b){if(null==b||Aa(b))return!1;var a=
b.length;return 1===b.nodeType&&a?!0:D(b)||L(b)||0===a||"number"===typeof a&&0<a&&a-1 in b}function q(b,a,c){var d;if(b)if(A(b))for(d in b)"prototype"!=d&&("length"!=d&&"name"!=d&&b.hasOwnProperty(d))&&a.call(c,b[d],d);else if(b.forEach&&b.forEach!==q)b.forEach(a,c);else if(pb(b))for(d=0;d<b.length;d++)a.call(c,b[d],d);else for(d in b)b.hasOwnProperty(d)&&a.call(c,b[d],d);return b}function Ob(b){var a=[],c;for(c in b)b.hasOwnProperty(c)&&a.push(c);return a.sort()}function Nc(b,a,c){for(var d=Ob(b),
e=0;e<d.length;e++)a.call(c,b[d[e]],d[e]);return d}function Pb(b){return function(a,c){b(c,a)}}function Za(){for(var b=ja.length,a;b;){b--;a=ja[b].charCodeAt(0);if(57==a)return ja[b]="A",ja.join("");if(90==a)ja[b]="0";else return ja[b]=String.fromCharCode(a+1),ja.join("")}ja.unshift("0");return ja.join("")}function Qb(b,a){a?b.$$hashKey=a:delete b.$$hashKey}function w(b){var a=b.$$hashKey;q(arguments,function(a){a!==b&&q(a,function(a,c){b[c]=a})});Qb(b,a);return b}function R(b){return parseInt(b,
10)}function Rb(b,a){return w(new (w(function(){},{prototype:b})),a)}function s(){}function Ba(b){return b}function ca(b){return function(){return b}}function H(b){return"undefined"===typeof b}function z(b){return"undefined"!==typeof b}function U(b){return null!=b&&"object"===typeof b}function D(b){return"string"===typeof b}function qb(b){return"number"===typeof b}function La(b){return"[object Date]"===$a.call(b)}function L(b){return"[object Array]"===$a.call(b)}function A(b){return"function"===typeof b}
function ab(b){return"[object RegExp]"===$a.call(b)}function Aa(b){return b&&b.document&&b.location&&b.alert&&b.setInterval}function Oc(b){return!(!b||!(b.nodeName||b.on&&b.find))}function Pc(b,a,c){var d=[];q(b,function(b,g,f){d.push(a.call(c,b,g,f))});return d}function bb(b,a){if(b.indexOf)return b.indexOf(a);for(var c=0;c<b.length;c++)if(a===b[c])return c;return-1}function Ma(b,a){var c=bb(b,a);0<=c&&b.splice(c,1);return a}function ga(b,a){if(Aa(b)||b&&b.$evalAsync&&b.$watch)throw Na("cpws");if(a){if(b===
a)throw Na("cpi");if(L(b))for(var c=a.length=0;c<b.length;c++)a.push(ga(b[c]));else{c=a.$$hashKey;q(a,function(b,c){delete a[c]});for(var d in b)a[d]=ga(b[d]);Qb(a,c)}}else(a=b)&&(L(b)?a=ga(b,[]):La(b)?a=new Date(b.getTime()):ab(b)?a=RegExp(b.source):U(b)&&(a=ga(b,{})));return a}function Qc(b,a){a=a||{};for(var c in b)b.hasOwnProperty(c)&&"$$"!==c.substr(0,2)&&(a[c]=b[c]);return a}function ta(b,a){if(b===a)return!0;if(null===b||null===a)return!1;if(b!==b&&a!==a)return!0;var c=typeof b,d;if(c==typeof a&&
"object"==c)if(L(b)){if(!L(a))return!1;if((c=b.length)==a.length){for(d=0;d<c;d++)if(!ta(b[d],a[d]))return!1;return!0}}else{if(La(b))return La(a)&&b.getTime()==a.getTime();if(ab(b)&&ab(a))return b.toString()==a.toString();if(b&&b.$evalAsync&&b.$watch||a&&a.$evalAsync&&a.$watch||Aa(b)||Aa(a)||L(a))return!1;c={};for(d in b)if("$"!==d.charAt(0)&&!A(b[d])){if(!ta(b[d],a[d]))return!1;c[d]=!0}for(d in a)if(!c.hasOwnProperty(d)&&"$"!==d.charAt(0)&&a[d]!==r&&!A(a[d]))return!1;return!0}return!1}function Sb(){return N.securityPolicy&&
N.securityPolicy.isActive||N.querySelector&&!(!N.querySelector("[ng-csp]")&&!N.querySelector("[data-ng-csp]"))}function rb(b,a){var c=2<arguments.length?ua.call(arguments,2):[];return!A(a)||a instanceof RegExp?a:c.length?function(){return arguments.length?a.apply(b,c.concat(ua.call(arguments,0))):a.apply(b,c)}:function(){return arguments.length?a.apply(b,arguments):a.call(b)}}function Rc(b,a){var c=a;"string"===typeof b&&"$"===b.charAt(0)?c=r:Aa(a)?c="$WINDOW":a&&N===a?c="$DOCUMENT":a&&(a.$evalAsync&&
a.$watch)&&(c="$SCOPE");return c}function oa(b,a){return"undefined"===typeof b?r:JSON.stringify(b,Rc,a?" ":null)}function Tb(b){return D(b)?JSON.parse(b):b}function Oa(b){b&&0!==b.length?(b=v(""+b),b=!("f"==b||"0"==b||"false"==b||"no"==b||"n"==b||"[]"==b)):b=!1;return b}function ha(b){b=x(b).clone();try{b.empty()}catch(a){}var c=x("<div>").append(b).html();try{return 3===b[0].nodeType?v(c):c.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,function(a,b){return"<"+v(b)})}catch(d){return v(c)}}function Ub(b){try{return decodeURIComponent(b)}catch(a){}}
function Vb(b){var a={},c,d;q((b||"").split("&"),function(b){b&&(c=b.split("="),d=Ub(c[0]),z(d)&&(b=z(c[1])?Ub(c[1]):!0,a[d]?L(a[d])?a[d].push(b):a[d]=[a[d],b]:a[d]=b))});return a}function Wb(b){var a=[];q(b,function(b,d){L(b)?q(b,function(b){a.push(va(d,!0)+(!0===b?"":"="+va(b,!0)))}):a.push(va(d,!0)+(!0===b?"":"="+va(b,!0)))});return a.length?a.join("&"):""}function sb(b){return va(b,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function va(b,a){return encodeURIComponent(b).replace(/%40/gi,
"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,a?"%20":"+")}function Sc(b,a){function c(a){a&&d.push(a)}var d=[b],e,g,f=["ng:app","ng-app","x-ng-app","data-ng-app"],h=/\sng[:\-]app(:\s*([\w\d_]+);?)?\s/;q(f,function(a){f[a]=!0;c(N.getElementById(a));a=a.replace(":","\\:");b.querySelectorAll&&(q(b.querySelectorAll("."+a),c),q(b.querySelectorAll("."+a+"\\:"),c),q(b.querySelectorAll("["+a+"]"),c))});q(d,function(a){if(!e){var b=h.exec(" "+a.className+" ");b?(e=a,g=
(b[2]||"").replace(/\s+/g,",")):q(a.attributes,function(b){!e&&f[b.name]&&(e=a,g=b.value)})}});e&&a(e,g?[g]:[])}function Xb(b,a){var c=function(){b=x(b);if(b.injector()){var c=b[0]===N?"document":ha(b);throw Na("btstrpd",c);}a=a||[];a.unshift(["$provide",function(a){a.value("$rootElement",b)}]);a.unshift("ng");c=Yb(a);c.invoke(["$rootScope","$rootElement","$compile","$injector","$animate",function(a,b,c,d,e){a.$apply(function(){b.data("$injector",d);c(b)(a)})}]);return c},d=/^NG_DEFER_BOOTSTRAP!/;
if(W&&!d.test(W.name))return c();W.name=W.name.replace(d,"");Pa.resumeBootstrap=function(b){q(b,function(b){a.push(b)});c()}}function cb(b,a){a=a||"_";return b.replace(Tc,function(b,d){return(d?a:"")+b.toLowerCase()})}function tb(b,a,c){if(!b)throw Na("areq",a||"?",c||"required");return b}function Qa(b,a,c){c&&L(b)&&(b=b[b.length-1]);tb(A(b),a,"not a function, got "+(b&&"object"==typeof b?b.constructor.name||"Object":typeof b));return b}function wa(b,a){if("hasOwnProperty"===b)throw Na("badname",
a);}function ub(b,a,c){if(!a)return b;a=a.split(".");for(var d,e=b,g=a.length,f=0;f<g;f++)d=a[f],b&&(b=(e=b)[d]);return!c&&A(b)?rb(e,b):b}function vb(b){var a=b[0];b=b[b.length-1];if(a===b)return x(a);var c=[a];do{a=a.nextSibling;if(!a)break;c.push(a)}while(a!==b);return x(c)}function Uc(b){var a=G("$injector"),c=G("ng");b=b.angular||(b.angular={});b.$$minErr=b.$$minErr||G;return b.module||(b.module=function(){var b={};return function(e,g,f){if("hasOwnProperty"===e)throw c("badname","module");g&&
b.hasOwnProperty(e)&&(b[e]=null);return b[e]||(b[e]=function(){function b(a,d,e){return function(){c[e||"push"]([a,d,arguments]);return n}}if(!g)throw a("nomod",e);var c=[],d=[],m=b("$injector","invoke"),n={_invokeQueue:c,_runBlocks:d,requires:g,name:e,provider:b("$provide","provider"),factory:b("$provide","factory"),service:b("$provide","service"),value:b("$provide","value"),constant:b("$provide","constant","unshift"),animation:b("$animateProvider","register"),filter:b("$filterProvider","register"),
controller:b("$controllerProvider","register"),directive:b("$compileProvider","directive"),config:m,run:function(a){d.push(a);return this}};f&&m(f);return n}())}}())}function Ra(b){return b.replace(Vc,function(a,b,d,e){return e?d.toUpperCase():d}).replace(Wc,"Moz$1")}function wb(b,a,c,d){function e(b){var e=c&&b?[this.filter(b)]:[this],l=a,k,m,n,p,t,C;if(!d||null!=b)for(;e.length;)for(k=e.shift(),m=0,n=k.length;m<n;m++)for(p=x(k[m]),l?p.triggerHandler("$destroy"):l=!l,t=0,p=(C=p.children()).length;t<
p;t++)e.push(Ca(C[t]));return g.apply(this,arguments)}var g=Ca.fn[b],g=g.$original||g;e.$original=g;Ca.fn[b]=e}function I(b){if(b instanceof I)return b;if(!(this instanceof I)){if(D(b)&&"<"!=b.charAt(0))throw xb("nosel");return new I(b)}if(D(b)){var a=N.createElement("div");a.innerHTML="<div> </div>"+b;a.removeChild(a.firstChild);yb(this,a.childNodes);x(N.createDocumentFragment()).append(this)}else yb(this,b)}function zb(b){return b.cloneNode(!0)}function Da(b){Zb(b);var a=0;for(b=b.childNodes||
[];a<b.length;a++)Da(b[a])}function $b(b,a,c,d){if(z(d))throw xb("offargs");var e=ka(b,"events");ka(b,"handle")&&(H(a)?q(e,function(a,c){Ab(b,c,a);delete e[c]}):q(a.split(" "),function(a){H(c)?(Ab(b,a,e[a]),delete e[a]):Ma(e[a]||[],c)}))}function Zb(b,a){var c=b[db],d=Sa[c];d&&(a?delete Sa[c].data[a]:(d.handle&&(d.events.$destroy&&d.handle({},"$destroy"),$b(b)),delete Sa[c],b[db]=r))}function ka(b,a,c){var d=b[db],d=Sa[d||-1];if(z(c))d||(b[db]=d=++Xc,d=Sa[d]={}),d[a]=c;else return d&&d[a]}function ac(b,
a,c){var d=ka(b,"data"),e=z(c),g=!e&&z(a),f=g&&!U(a);d||f||ka(b,"data",d={});if(e)d[a]=c;else if(g){if(f)return d&&d[a];w(d,a)}else return d}function Bb(b,a){return b.getAttribute?-1<(" "+(b.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").indexOf(" "+a+" "):!1}function Cb(b,a){a&&b.setAttribute&&q(a.split(" "),function(a){b.setAttribute("class",aa((" "+(b.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").replace(" "+aa(a)+" "," ")))})}function Db(b,a){if(a&&b.setAttribute){var c=(" "+
(b.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ");q(a.split(" "),function(a){a=aa(a);-1===c.indexOf(" "+a+" ")&&(c+=a+" ")});b.setAttribute("class",aa(c))}}function yb(b,a){if(a){a=a.nodeName||!z(a.length)||Aa(a)?[a]:a;for(var c=0;c<a.length;c++)b.push(a[c])}}function bc(b,a){return eb(b,"$"+(a||"ngController")+"Controller")}function eb(b,a,c){b=x(b);9==b[0].nodeType&&(b=b.find("html"));for(a=L(a)?a:[a];b.length;){for(var d=0,e=a.length;d<e;d++)if((c=b.data(a[d]))!==r)return c;b=b.parent()}}
function cc(b){for(var a=0,c=b.childNodes;a<c.length;a++)Da(c[a]);for(;b.firstChild;)b.removeChild(b.firstChild)}function dc(b,a){var c=fb[a.toLowerCase()];return c&&ec[b.nodeName]&&c}function Yc(b,a){var c=function(c,e){c.preventDefault||(c.preventDefault=function(){c.returnValue=!1});c.stopPropagation||(c.stopPropagation=function(){c.cancelBubble=!0});c.target||(c.target=c.srcElement||N);if(H(c.defaultPrevented)){var g=c.preventDefault;c.preventDefault=function(){c.defaultPrevented=!0;g.call(c)};
c.defaultPrevented=!1}c.isDefaultPrevented=function(){return c.defaultPrevented||!1===c.returnValue};q(a[e||c.type],function(a){a.call(b,c)});8>=E?(c.preventDefault=null,c.stopPropagation=null,c.isDefaultPrevented=null):(delete c.preventDefault,delete c.stopPropagation,delete c.isDefaultPrevented)};c.elem=b;return c}function Ea(b){var a=typeof b,c;"object"==a&&null!==b?"function"==typeof(c=b.$$hashKey)?c=b.$$hashKey():c===r&&(c=b.$$hashKey=Za()):c=b;return a+":"+c}function Ta(b){q(b,this.put,this)}
function fc(b){var a,c;"function"==typeof b?(a=b.$inject)||(a=[],b.length&&(c=b.toString().replace(Zc,""),c=c.match($c),q(c[1].split(ad),function(b){b.replace(bd,function(b,c,d){a.push(d)})})),b.$inject=a):L(b)?(c=b.length-1,Qa(b[c],"fn"),a=b.slice(0,c)):Qa(b,"fn",!0);return a}function Yb(b){function a(a){return function(b,c){if(U(b))q(b,Pb(a));else return a(b,c)}}function c(a,b){wa(a,"service");if(A(b)||L(b))b=n.instantiate(b);if(!b.$get)throw Ua("pget",a);return m[a+h]=b}function d(a,b){return c(a,
{$get:b})}function e(a){var b=[],c,d,h,g;q(a,function(a){if(!k.get(a)){k.put(a,!0);try{if(D(a))for(c=Va(a),b=b.concat(e(c.requires)).concat(c._runBlocks),d=c._invokeQueue,h=0,g=d.length;h<g;h++){var f=d[h],l=n.get(f[0]);l[f[1]].apply(l,f[2])}else A(a)?b.push(n.invoke(a)):L(a)?b.push(n.invoke(a)):Qa(a,"module")}catch(m){throw L(a)&&(a=a[a.length-1]),m.message&&(m.stack&&-1==m.stack.indexOf(m.message))&&(m=m.message+"\n"+m.stack),Ua("modulerr",a,m.stack||m.message||m);}}});return b}function g(a,b){function c(d){if(a.hasOwnProperty(d)){if(a[d]===
f)throw Ua("cdep",l.join(" <- "));return a[d]}try{return l.unshift(d),a[d]=f,a[d]=b(d)}finally{l.shift()}}function d(a,b,e){var h=[],g=fc(a),f,k,l;k=0;for(f=g.length;k<f;k++){l=g[k];if("string"!==typeof l)throw Ua("itkn",l);h.push(e&&e.hasOwnProperty(l)?e[l]:c(l))}a.$inject||(a=a[f]);return a.apply(b,h)}return{invoke:d,instantiate:function(a,b){var c=function(){},e;c.prototype=(L(a)?a[a.length-1]:a).prototype;c=new c;e=d(a,c,b);return U(e)||A(e)?e:c},get:c,annotate:fc,has:function(b){return m.hasOwnProperty(b+
h)||a.hasOwnProperty(b)}}}var f={},h="Provider",l=[],k=new Ta,m={$provide:{provider:a(c),factory:a(d),service:a(function(a,b){return d(a,["$injector",function(a){return a.instantiate(b)}])}),value:a(function(a,b){return d(a,ca(b))}),constant:a(function(a,b){wa(a,"constant");m[a]=b;p[a]=b}),decorator:function(a,b){var c=n.get(a+h),d=c.$get;c.$get=function(){var a=t.invoke(d,c);return t.invoke(b,null,{$delegate:a})}}}},n=m.$injector=g(m,function(){throw Ua("unpr",l.join(" <- "));}),p={},t=p.$injector=
g(p,function(a){a=n.get(a+h);return t.invoke(a.$get,a)});q(e(b),function(a){t.invoke(a||s)});return t}function cd(){var b=!0;this.disableAutoScrolling=function(){b=!1};this.$get=["$window","$location","$rootScope",function(a,c,d){function e(a){var b=null;q(a,function(a){b||"a"!==v(a.nodeName)||(b=a)});return b}function g(){var b=c.hash(),d;b?(d=f.getElementById(b))?d.scrollIntoView():(d=e(f.getElementsByName(b)))?d.scrollIntoView():"top"===b&&a.scrollTo(0,0):a.scrollTo(0,0)}var f=a.document;b&&d.$watch(function(){return c.hash()},
function(){d.$evalAsync(g)});return g}]}function dd(b,a,c,d){function e(a){try{a.apply(null,ua.call(arguments,1))}finally{if(C--,0===C)for(;B.length;)try{B.pop()()}catch(b){c.error(b)}}}function g(a,b){(function la(){q(K,function(a){a()});u=b(la,a)})()}function f(){y=null;P!=h.url()&&(P=h.url(),q(ba,function(a){a(h.url())}))}var h=this,l=a[0],k=b.location,m=b.history,n=b.setTimeout,p=b.clearTimeout,t={};h.isMock=!1;var C=0,B=[];h.$$completeOutstandingRequest=e;h.$$incOutstandingRequestCount=function(){C++};
h.notifyWhenNoOutstandingRequests=function(a){q(K,function(a){a()});0===C?a():B.push(a)};var K=[],u;h.addPollFn=function(a){H(u)&&g(100,n);K.push(a);return a};var P=k.href,Z=a.find("base"),y=null;h.url=function(a,c){k!==b.location&&(k=b.location);if(a){if(P!=a)return P=a,d.history?c?m.replaceState(null,"",a):(m.pushState(null,"",a),Z.attr("href",Z.attr("href"))):(y=a,c?k.replace(a):k.href=a),h}else return y||k.href.replace(/%27/g,"'")};var ba=[],Q=!1;h.onUrlChange=function(a){if(!Q){if(d.history)x(b).on("popstate",
f);if(d.hashchange)x(b).on("hashchange",f);else h.addPollFn(f);Q=!0}ba.push(a);return a};h.baseHref=function(){var a=Z.attr("href");return a?a.replace(/^https?\:\/\/[^\/]*/,""):""};var Y={},X="",$=h.baseHref();h.cookies=function(a,b){var d,e,g,h;if(a)b===r?l.cookie=escape(a)+"=;path="+$+";expires=Thu, 01 Jan 1970 00:00:00 GMT":D(b)&&(d=(l.cookie=escape(a)+"="+escape(b)+";path="+$).length+1,4096<d&&c.warn("Cookie '"+a+"' possibly not set or overflowed because it was too large ("+d+" > 4096 bytes)!"));
else{if(l.cookie!==X)for(X=l.cookie,d=X.split("; "),Y={},g=0;g<d.length;g++)e=d[g],h=e.indexOf("="),0<h&&(a=unescape(e.substring(0,h)),Y[a]===r&&(Y[a]=unescape(e.substring(h+1))));return Y}};h.defer=function(a,b){var c;C++;c=n(function(){delete t[c];e(a)},b||0);t[c]=!0;return c};h.defer.cancel=function(a){return t[a]?(delete t[a],p(a),e(s),!0):!1}}function ed(){this.$get=["$window","$log","$sniffer","$document",function(b,a,c,d){return new dd(b,d,a,c)}]}function fd(){this.$get=function(){function b(b,
d){function e(a){a!=n&&(p?p==a&&(p=a.n):p=a,g(a.n,a.p),g(a,n),n=a,n.n=null)}function g(a,b){a!=b&&(a&&(a.p=b),b&&(b.n=a))}if(b in a)throw G("$cacheFactory")("iid",b);var f=0,h=w({},d,{id:b}),l={},k=d&&d.capacity||Number.MAX_VALUE,m={},n=null,p=null;return a[b]={put:function(a,b){var c=m[a]||(m[a]={key:a});e(c);if(!H(b))return a in l||f++,l[a]=b,f>k&&this.remove(p.key),b},get:function(a){var b=m[a];if(b)return e(b),l[a]},remove:function(a){var b=m[a];b&&(b==n&&(n=b.p),b==p&&(p=b.n),g(b.n,b.p),delete m[a],
delete l[a],f--)},removeAll:function(){l={};f=0;m={};n=p=null},destroy:function(){m=h=l=null;delete a[b]},info:function(){return w({},h,{size:f})}}}var a={};b.info=function(){var b={};q(a,function(a,e){b[e]=a.info()});return b};b.get=function(b){return a[b]};return b}}function gd(){this.$get=["$cacheFactory",function(b){return b("templates")}]}function hc(b,a){var c={},d="Directive",e=/^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/,g=/(([\d\w\-_]+)(?:\:([^;]+))?;?)/,f=/^(on[a-z]+|formaction)$/;this.directive=
function l(a,e){wa(a,"directive");D(a)?(tb(e,"directiveFactory"),c.hasOwnProperty(a)||(c[a]=[],b.factory(a+d,["$injector","$exceptionHandler",function(b,d){var e=[];q(c[a],function(c,g){try{var f=b.invoke(c);A(f)?f={compile:ca(f)}:!f.compile&&f.link&&(f.compile=ca(f.link));f.priority=f.priority||0;f.index=g;f.name=f.name||a;f.require=f.require||f.controller&&f.name;f.restrict=f.restrict||"A";e.push(f)}catch(l){d(l)}});return e}])),c[a].push(e)):q(a,Pb(l));return this};this.aHrefSanitizationWhitelist=
function(b){return z(b)?(a.aHrefSanitizationWhitelist(b),this):a.aHrefSanitizationWhitelist()};this.imgSrcSanitizationWhitelist=function(b){return z(b)?(a.imgSrcSanitizationWhitelist(b),this):a.imgSrcSanitizationWhitelist()};this.$get=["$injector","$interpolate","$exceptionHandler","$http","$templateCache","$parse","$controller","$rootScope","$document","$sce","$animate","$$sanitizeUri",function(a,b,m,n,p,t,C,B,K,u,P,Z){function y(a,b,c,d,e){a instanceof x||(a=x(a));q(a,function(b,c){3==b.nodeType&&
b.nodeValue.match(/\S+/)&&(a[c]=x(b).wrap("<span></span>").parent()[0])});var g=Q(a,b,a,c,d,e);return function(b,c,d){tb(b,"scope");var e=c?Fa.clone.call(a):a;q(d,function(a,b){e.data("$"+b+"Controller",a)});d=0;for(var f=e.length;d<f;d++){var k=e[d];1!=k.nodeType&&9!=k.nodeType||e.eq(d).data("$scope",b)}ba(e,"ng-scope");c&&c(e,b);g&&g(b,e,e);return e}}function ba(a,b){try{a.addClass(b)}catch(c){}}function Q(a,b,c,d,e,g){function f(a,c,d,e){var g,l,m,p,n,t,C,da=[];n=0;for(t=c.length;n<t;n++)da.push(c[n]);
C=n=0;for(t=k.length;n<t;C++)l=da[C],c=k[n++],g=k[n++],m=x(l),c?(c.scope?(p=a.$new(),m.data("$scope",p),ba(m,"ng-scope")):p=a,(m=c.transclude)||!e&&b?c(g,p,l,d,Y(a,m||b)):c(g,p,l,d,e)):g&&g(a,l.childNodes,r,e)}for(var k=[],l,m,p,n=0;n<a.length;n++)m=new Eb,l=X(a[n],[],m,0===n?d:r,e),l=(g=l.length?M(l,a[n],m,b,c,null,[],[],g):null)&&g.terminal||!a[n].childNodes||!a[n].childNodes.length?null:Q(a[n].childNodes,g?g.transclude:b),k.push(g),k.push(l),p=p||g||l,g=null;return p?f:null}function Y(a,b){return function(c,
d,e){var g=!1;c||(c=a.$new(),g=c.$$transcluded=!0);d=b(c,d,e);if(g)d.on("$destroy",rb(c,c.$destroy));return d}}function X(a,b,c,d,f){var k=c.$attr,l;switch(a.nodeType){case 1:la(b,ma(Ga(a).toLowerCase()),"E",d,f);var m,p,n;l=a.attributes;for(var t=0,C=l&&l.length;t<C;t++){var B=!1,y=!1;m=l[t];if(!E||8<=E||m.specified){p=m.name;n=ma(p);xa.test(n)&&(p=cb(n.substr(6),"-"));var P=n.replace(/(Start|End)$/,"");n===P+"Start"&&(B=p,y=p.substr(0,p.length-5)+"end",p=p.substr(0,p.length-6));n=ma(p.toLowerCase());
k[n]=p;c[n]=m=aa(E&&"href"==p?decodeURIComponent(a.getAttribute(p,2)):m.value);dc(a,n)&&(c[n]=!0);I(a,b,m,n);la(b,n,"A",d,f,B,y)}}a=a.className;if(D(a)&&""!==a)for(;l=g.exec(a);)n=ma(l[2]),la(b,n,"C",d,f)&&(c[n]=aa(l[3])),a=a.substr(l.index+l[0].length);break;case 3:v(b,a.nodeValue);break;case 8:try{if(l=e.exec(a.nodeValue))n=ma(l[1]),la(b,n,"M",d,f)&&(c[n]=aa(l[2]))}catch(K){}}b.sort(s);return b}function $(a,b,c){var d=[],e=0;if(b&&a.hasAttribute&&a.hasAttribute(b)){do{if(!a)throw ia("uterdir",b,
c);1==a.nodeType&&(a.hasAttribute(b)&&e++,a.hasAttribute(c)&&e--);d.push(a);a=a.nextSibling}while(0<e)}else d.push(a);return x(d)}function O(a,b,c){return function(d,e,g,f,k){e=$(e[0],b,c);return a(d,e,g,f,k)}}function M(a,c,d,e,g,f,l,p,n){function B(a,b,c,d){if(a){c&&(a=O(a,c,d));a.require=F.require;if(Q===F||F.$$isolateScope)a=T(a,{isolateScope:!0});l.push(a)}if(b){c&&(b=O(b,c,d));b.require=F.require;if(Q===F||F.$$isolateScope)b=T(b,{isolateScope:!0});p.push(b)}}function P(a,b,c){var d,e="data",
g=!1;if(D(a)){for(;"^"==(d=a.charAt(0))||"?"==d;)a=a.substr(1),"^"==d&&(e="inheritedData"),g=g||"?"==d;d=null;c&&"data"===e&&(d=c[a]);d=d||b[e]("$"+a+"Controller");if(!d&&!g)throw ia("ctreq",a,ea);}else L(a)&&(d=[],q(a,function(a){d.push(P(a,b,c))}));return d}function K(a,e,g,f,n){function B(a,b){var c;2>arguments.length&&(b=a,a=r);Ha&&(c=O);return n(a,b,c)}var y,da,Y,u,$,J,O={},X;y=c===g?d:Qc(d,new Eb(x(g),d.$attr));da=y.$$element;if(Q){var S=/^\s*([@=&])(\??)\s*(\w*)\s*$/;f=x(g);J=e.$new(!0);M&&
M===Q.$$originalDirective?f.data("$isolateScope",J):f.data("$isolateScopeNoTemplate",J);ba(f,"ng-isolate-scope");q(Q.scope,function(a,c){var d=a.match(S)||[],g=d[3]||c,f="?"==d[2],d=d[1],l,m,n,p;J.$$isolateBindings[c]=d+g;switch(d){case "@":y.$observe(g,function(a){J[c]=a});y.$$observers[g].$$scope=e;y[g]&&(J[c]=b(y[g])(e));break;case "=":if(f&&!y[g])break;m=t(y[g]);p=m.literal?ta:function(a,b){return a===b};n=m.assign||function(){l=J[c]=m(e);throw ia("nonassign",y[g],Q.name);};l=J[c]=m(e);J.$watch(function(){var a=
m(e);p(a,J[c])||(p(a,l)?n(e,a=J[c]):J[c]=a);return l=a},null,m.literal);break;case "&":m=t(y[g]);J[c]=function(a){return m(e,a)};break;default:throw ia("iscp",Q.name,c,a);}})}X=n&&B;Z&&q(Z,function(a){var b={$scope:a===Q||a.$$isolateScope?J:e,$element:da,$attrs:y,$transclude:X},c;$=a.controller;"@"==$&&($=y[a.name]);c=C($,b);O[a.name]=c;Ha||da.data("$"+a.name+"Controller",c);a.controllerAs&&(b.$scope[a.controllerAs]=c)});f=0;for(Y=l.length;f<Y;f++)try{u=l[f],u(u.isolateScope?J:e,da,y,u.require&&P(u.require,
da,O),X)}catch(v){m(v,ha(da))}f=e;Q&&(Q.template||null===Q.templateUrl)&&(f=J);a&&a(f,g.childNodes,r,n);for(f=p.length-1;0<=f;f--)try{u=p[f],u(u.isolateScope?J:e,da,y,u.require&&P(u.require,da,O),X)}catch(hd){m(hd,ha(da))}}n=n||{};var Y=-Number.MAX_VALUE,u,Z=n.controllerDirectives,Q=n.newIsolateScopeDirective,M=n.templateDirective;n=n.nonTlbTranscludeDirective;for(var la=!1,Ha=!1,s=d.$$element=x(c),F,ea,v,w=e,G,I=0,E=a.length;I<E;I++){F=a[I];var xa=F.$$start,gb=F.$$end;xa&&(s=$(c,xa,gb));v=r;if(Y>
F.priority)break;if(v=F.scope)u=u||F,F.templateUrl||(H("new/isolated scope",Q,F,s),U(v)&&(Q=F));ea=F.name;!F.templateUrl&&F.controller&&(v=F.controller,Z=Z||{},H("'"+ea+"' controller",Z[ea],F,s),Z[ea]=F);if(v=F.transclude)la=!0,F.$$tlb||(H("transclusion",n,F,s),n=F),"element"==v?(Ha=!0,Y=F.priority,v=$(c,xa,gb),s=d.$$element=x(N.createComment(" "+ea+": "+d[ea]+" ")),c=s[0],R(g,x(ua.call(v,0)),c),w=y(v,e,Y,f&&f.name,{nonTlbTranscludeDirective:n})):(v=x(zb(c)).contents(),s.empty(),w=y(v,e));if(F.template)if(H("template",
M,F,s),M=F,v=A(F.template)?F.template(s,d):F.template,v=ic(v),F.replace){f=F;v=x("<div>"+aa(v)+"</div>").contents();c=v[0];if(1!=v.length||1!==c.nodeType)throw ia("tplrt",ea,"");R(g,s,c);E={$attr:{}};v=X(c,[],E);var V=a.splice(I+1,a.length-(I+1));Q&&S(v);a=a.concat(v).concat(V);gc(d,E);E=a.length}else s.html(v);if(F.templateUrl)H("template",M,F,s),M=F,F.replace&&(f=F),K=z(a.splice(I,a.length-I),s,d,g,w,l,p,{controllerDirectives:Z,newIsolateScopeDirective:Q,templateDirective:M,nonTlbTranscludeDirective:n}),
E=a.length;else if(F.compile)try{G=F.compile(s,d,w),A(G)?B(null,G,xa,gb):G&&B(G.pre,G.post,xa,gb)}catch(W){m(W,ha(s))}F.terminal&&(K.terminal=!0,Y=Math.max(Y,F.priority))}K.scope=u&&!0===u.scope;K.transclude=la&&w;return K}function S(a){for(var b=0,c=a.length;b<c;b++)a[b]=Rb(a[b],{$$isolateScope:!0})}function la(b,e,g,f,k,n,p){if(e===k)return null;k=null;if(c.hasOwnProperty(e)){var t;e=a.get(e+d);for(var C=0,B=e.length;C<B;C++)try{t=e[C],(f===r||f>t.priority)&&-1!=t.restrict.indexOf(g)&&(n&&(t=Rb(t,
{$$start:n,$$end:p})),b.push(t),k=t)}catch(y){m(y)}}return k}function gc(a,b){var c=b.$attr,d=a.$attr,e=a.$$element;q(a,function(d,e){"$"!=e.charAt(0)&&(b[e]&&(d+=("style"===e?";":" ")+b[e]),a.$set(e,d,!0,c[e]))});q(b,function(b,g){"class"==g?(ba(e,b),a["class"]=(a["class"]?a["class"]+" ":"")+b):"style"==g?(e.attr("style",e.attr("style")+";"+b),a.style=(a.style?a.style+";":"")+b):"$"==g.charAt(0)||a.hasOwnProperty(g)||(a[g]=b,d[g]=c[g])})}function z(a,b,c,d,e,g,f,k){var l=[],m,t,C=b[0],B=a.shift(),
y=w({},B,{templateUrl:null,transclude:null,replace:null,$$originalDirective:B}),P=A(B.templateUrl)?B.templateUrl(b,c):B.templateUrl;b.empty();n.get(u.getTrustedResourceUrl(P),{cache:p}).success(function(n){var p,K;n=ic(n);if(B.replace){n=x("<div>"+aa(n)+"</div>").contents();p=n[0];if(1!=n.length||1!==p.nodeType)throw ia("tplrt",B.name,P);n={$attr:{}};R(d,b,p);var u=X(p,[],n);U(B.scope)&&S(u);a=u.concat(a);gc(c,n)}else p=C,b.html(n);a.unshift(y);m=M(a,p,c,e,b,B,g,f,k);q(d,function(a,c){a==p&&(d[c]=
b[0])});for(t=Q(b[0].childNodes,e);l.length;){n=l.shift();K=l.shift();var ba=l.shift(),Z=l.shift(),u=b[0];K!==C&&(u=zb(p),R(ba,x(K),u));K=m.transclude?Y(n,m.transclude):Z;m(t,n,u,d,K)}l=null}).error(function(a,b,c,d){throw ia("tpload",d.url);});return function(a,b,c,d,e){l?(l.push(b),l.push(c),l.push(d),l.push(e)):m(t,b,c,d,e)}}function s(a,b){var c=b.priority-a.priority;return 0!==c?c:a.name!==b.name?a.name<b.name?-1:1:a.index-b.index}function H(a,b,c,d){if(b)throw ia("multidir",b.name,c.name,a,
ha(d));}function v(a,c){var d=b(c,!0);d&&a.push({priority:0,compile:ca(function(a,b){var c=b.parent(),e=c.data("$binding")||[];e.push(d);ba(c.data("$binding",e),"ng-binding");a.$watch(d,function(a){b[0].nodeValue=a})})})}function G(a,b){if("srcdoc"==b)return u.HTML;var c=Ga(a);if("xlinkHref"==b||"FORM"==c&&"action"==b||"IMG"!=c&&("src"==b||"ngSrc"==b))return u.RESOURCE_URL}function I(a,c,d,e){var g=b(d,!0);if(g){if("multiple"===e&&"SELECT"===Ga(a))throw ia("selmulti",ha(a));c.push({priority:100,compile:function(){return{pre:function(c,
d,l){d=l.$$observers||(l.$$observers={});if(f.test(e))throw ia("nodomevents");if(g=b(l[e],!0,G(a,e)))l[e]=g(c),(d[e]||(d[e]=[])).$$inter=!0,(l.$$observers&&l.$$observers[e].$$scope||c).$watch(g,function(a,b){"class"===e&&a!=b?l.$updateClass(a,b):l.$set(e,a)})}}}})}}function R(a,b,c){var d=b[0],e=b.length,g=d.parentNode,f,l;if(a)for(f=0,l=a.length;f<l;f++)if(a[f]==d){a[f++]=c;l=f+e-1;for(var k=a.length;f<k;f++,l++)l<k?a[f]=a[l]:delete a[f];a.length-=e-1;break}g&&g.replaceChild(c,d);a=N.createDocumentFragment();
a.appendChild(d);c[x.expando]=d[x.expando];d=1;for(e=b.length;d<e;d++)g=b[d],x(g).remove(),a.appendChild(g),delete b[d];b[0]=c;b.length=1}function T(a,b){return w(function(){return a.apply(null,arguments)},a,b)}var Eb=function(a,b){this.$$element=a;this.$attr=b||{}};Eb.prototype={$normalize:ma,$addClass:function(a){a&&0<a.length&&P.addClass(this.$$element,a)},$removeClass:function(a){a&&0<a.length&&P.removeClass(this.$$element,a)},$updateClass:function(a,b){this.$removeClass(jc(b,a));this.$addClass(jc(a,
b))},$set:function(a,b,c,d){var e=dc(this.$$element[0],a);e&&(this.$$element.prop(a,b),d=e);this[a]=b;d?this.$attr[a]=d:(d=this.$attr[a])||(this.$attr[a]=d=cb(a,"-"));e=Ga(this.$$element);if("A"===e&&"href"===a||"IMG"===e&&"src"===a)this[a]=b=Z(b,"src"===a);!1!==c&&(null===b||b===r?this.$$element.removeAttr(d):this.$$element.attr(d,b));(c=this.$$observers)&&q(c[a],function(a){try{a(b)}catch(c){m(c)}})},$observe:function(a,b){var c=this,d=c.$$observers||(c.$$observers={}),e=d[a]||(d[a]=[]);e.push(b);
B.$evalAsync(function(){e.$$inter||b(c[a])});return b}};var ea=b.startSymbol(),Ha=b.endSymbol(),ic="{{"==ea||"}}"==Ha?Ba:function(a){return a.replace(/\{\{/g,ea).replace(/}}/g,Ha)},xa=/^ngAttr[A-Z]/;return y}]}function ma(b){return Ra(b.replace(id,""))}function jc(b,a){var c="",d=b.split(/\s+/),e=a.split(/\s+/),g=0;a:for(;g<d.length;g++){for(var f=d[g],h=0;h<e.length;h++)if(f==e[h])continue a;c+=(0<c.length?" ":"")+f}return c}function jd(){var b={},a=/^(\S+)(\s+as\s+(\w+))?$/;this.register=function(a,
d){wa(a,"controller");U(a)?w(b,a):b[a]=d};this.$get=["$injector","$window",function(c,d){return function(e,g){var f,h,l;D(e)&&(f=e.match(a),h=f[1],l=f[3],e=b.hasOwnProperty(h)?b[h]:ub(g.$scope,h,!0)||ub(d,h,!0),Qa(e,h,!0));f=c.instantiate(e,g);if(l){if(!g||"object"!=typeof g.$scope)throw G("$controller")("noscp",h||e.name,l);g.$scope[l]=f}return f}}]}function kd(){this.$get=["$window",function(b){return x(b.document)}]}function ld(){this.$get=["$log",function(b){return function(a,c){b.error.apply(b,
arguments)}}]}function kc(b){var a={},c,d,e;if(!b)return a;q(b.split("\n"),function(b){e=b.indexOf(":");c=v(aa(b.substr(0,e)));d=aa(b.substr(e+1));c&&(a[c]=a[c]?a[c]+(", "+d):d)});return a}function lc(b){var a=U(b)?b:r;return function(c){a||(a=kc(b));return c?a[v(c)]||null:a}}function mc(b,a,c){if(A(c))return c(b,a);q(c,function(c){b=c(b,a)});return b}function md(){var b=/^\s*(\[|\{[^\{])/,a=/[\}\]]\s*$/,c=/^\)\]\}',?\n/,d={"Content-Type":"application/json;charset=utf-8"},e=this.defaults={transformResponse:[function(d){D(d)&&
(d=d.replace(c,""),b.test(d)&&a.test(d)&&(d=Tb(d)));return d}],transformRequest:[function(a){return U(a)&&"[object File]"!==$a.call(a)?oa(a):a}],headers:{common:{Accept:"application/json, text/plain, */*"},post:d,put:d,patch:d},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"},g=this.interceptors=[],f=this.responseInterceptors=[];this.$get=["$httpBackend","$browser","$cacheFactory","$rootScope","$q","$injector",function(a,b,c,d,n,p){function t(a){function c(a){var b=w({},a,{data:mc(a.data,
a.headers,d.transformResponse)});return 200<=a.status&&300>a.status?b:n.reject(b)}var d={transformRequest:e.transformRequest,transformResponse:e.transformResponse},g=function(a){function b(a){var c;q(a,function(b,d){A(b)&&(c=b(),null!=c?a[d]=c:delete a[d])})}var c=e.headers,d=w({},a.headers),g,f,c=w({},c.common,c[v(a.method)]);b(c);b(d);a:for(g in c){a=v(g);for(f in d)if(v(f)===a)continue a;d[g]=c[g]}return d}(a);w(d,a);d.headers=g;d.method=Ia(d.method);(a=Fb(d.url)?b.cookies()[d.xsrfCookieName||
e.xsrfCookieName]:r)&&(g[d.xsrfHeaderName||e.xsrfHeaderName]=a);var f=[function(a){g=a.headers;var b=mc(a.data,lc(g),a.transformRequest);H(a.data)&&q(g,function(a,b){"content-type"===v(b)&&delete g[b]});H(a.withCredentials)&&!H(e.withCredentials)&&(a.withCredentials=e.withCredentials);return C(a,b,g).then(c,c)},r],h=n.when(d);for(q(u,function(a){(a.request||a.requestError)&&f.unshift(a.request,a.requestError);(a.response||a.responseError)&&f.push(a.response,a.responseError)});f.length;){a=f.shift();
var k=f.shift(),h=h.then(a,k)}h.success=function(a){h.then(function(b){a(b.data,b.status,b.headers,d)});return h};h.error=function(a){h.then(null,function(b){a(b.data,b.status,b.headers,d)});return h};return h}function C(b,c,g){function f(a,b,c){u&&(200<=a&&300>a?u.put(r,[a,b,kc(c)]):u.remove(r));l(b,a,c);d.$$phase||d.$apply()}function l(a,c,d){c=Math.max(c,0);(200<=c&&300>c?p.resolve:p.reject)({data:a,status:c,headers:lc(d),config:b})}function k(){var a=bb(t.pendingRequests,b);-1!==a&&t.pendingRequests.splice(a,
1)}var p=n.defer(),C=p.promise,u,q,r=B(b.url,b.params);t.pendingRequests.push(b);C.then(k,k);(b.cache||e.cache)&&(!1!==b.cache&&"GET"==b.method)&&(u=U(b.cache)?b.cache:U(e.cache)?e.cache:K);if(u)if(q=u.get(r),z(q)){if(q.then)return q.then(k,k),q;L(q)?l(q[1],q[0],ga(q[2])):l(q,200,{})}else u.put(r,C);H(q)&&a(b.method,r,c,f,g,b.timeout,b.withCredentials,b.responseType);return C}function B(a,b){if(!b)return a;var c=[];Nc(b,function(a,b){null===a||H(a)||(L(a)||(a=[a]),q(a,function(a){U(a)&&(a=oa(a));
c.push(va(b)+"="+va(a))}))});return a+(-1==a.indexOf("?")?"?":"&")+c.join("&")}var K=c("$http"),u=[];q(g,function(a){u.unshift(D(a)?p.get(a):p.invoke(a))});q(f,function(a,b){var c=D(a)?p.get(a):p.invoke(a);u.splice(b,0,{response:function(a){return c(n.when(a))},responseError:function(a){return c(n.reject(a))}})});t.pendingRequests=[];(function(a){q(arguments,function(a){t[a]=function(b,c){return t(w(c||{},{method:a,url:b}))}})})("get","delete","head","jsonp");(function(a){q(arguments,function(a){t[a]=
function(b,c,d){return t(w(d||{},{method:a,url:b,data:c}))}})})("post","put");t.defaults=e;return t}]}function nd(){this.$get=["$browser","$window","$document",function(b,a,c){return od(b,pd,b.defer,a.angular.callbacks,c[0])}]}function od(b,a,c,d,e){function g(a,b){var c=e.createElement("script"),d=function(){c.onreadystatechange=c.onload=c.onerror=null;e.body.removeChild(c);b&&b()};c.type="text/javascript";c.src=a;E&&8>=E?c.onreadystatechange=function(){/loaded|complete/.test(c.readyState)&&d()}:
c.onload=c.onerror=function(){d()};e.body.appendChild(c);return d}var f=-1;return function(e,l,k,m,n,p,t,C){function B(){u=f;r&&r();y&&y.abort()}function K(a,d,e,g){var f=ya(l).protocol;ba&&c.cancel(ba);r=y=null;d="file"==f&&0===d?e?200:404:d;a(1223==d?204:d,e,g);b.$$completeOutstandingRequest(s)}var u;b.$$incOutstandingRequestCount();l=l||b.url();if("jsonp"==v(e)){var P="_"+(d.counter++).toString(36);d[P]=function(a){d[P].data=a};var r=g(l.replace("JSON_CALLBACK","angular.callbacks."+P),function(){d[P].data?
K(m,200,d[P].data):K(m,u||-2);delete d[P]})}else{var y=new a;y.open(e,l,!0);q(n,function(a,b){z(a)&&y.setRequestHeader(b,a)});y.onreadystatechange=function(){if(4==y.readyState){var a=null,b=null;u!==f&&(a=y.getAllResponseHeaders(),b=y.responseType?y.response:y.responseText);K(m,u||y.status,b,a)}};t&&(y.withCredentials=!0);C&&(y.responseType=C);y.send(k||null)}if(0<p)var ba=c(B,p);else p&&p.then&&p.then(B)}}function qd(){var b="{{",a="}}";this.startSymbol=function(a){return a?(b=a,this):b};this.endSymbol=
function(b){return b?(a=b,this):a};this.$get=["$parse","$exceptionHandler","$sce",function(c,d,e){function g(g,k,m){for(var n,p,t=0,C=[],B=g.length,K=!1,u=[];t<B;)-1!=(n=g.indexOf(b,t))&&-1!=(p=g.indexOf(a,n+f))?(t!=n&&C.push(g.substring(t,n)),C.push(t=c(K=g.substring(n+f,p))),t.exp=K,t=p+h,K=!0):(t!=B&&C.push(g.substring(t)),t=B);(B=C.length)||(C.push(""),B=1);if(m&&1<C.length)throw nc("noconcat",g);if(!k||K)return u.length=B,t=function(a){try{for(var b=0,c=B,f;b<c;b++)"function"==typeof(f=C[b])&&
(f=f(a),f=m?e.getTrusted(m,f):e.valueOf(f),null===f||H(f)?f="":"string"!=typeof f&&(f=oa(f))),u[b]=f;return u.join("")}catch(h){a=nc("interr",g,h.toString()),d(a)}},t.exp=g,t.parts=C,t}var f=b.length,h=a.length;g.startSymbol=function(){return b};g.endSymbol=function(){return a};return g}]}function rd(){this.$get=["$rootScope","$window","$q",function(b,a,c){function d(d,f,h,l){var k=a.setInterval,m=a.clearInterval,n=c.defer(),p=n.promise,t=0,C=z(l)&&!l;h=z(h)?h:0;p.then(null,null,d);p.$$intervalId=
k(function(){n.notify(t++);0<h&&t>=h&&(n.resolve(t),m(p.$$intervalId),delete e[p.$$intervalId]);C||b.$apply()},f);e[p.$$intervalId]=n;return p}var e={};d.cancel=function(a){return a&&a.$$intervalId in e?(e[a.$$intervalId].reject("canceled"),clearInterval(a.$$intervalId),delete e[a.$$intervalId],!0):!1};return d}]}function sd(){this.$get=function(){return{id:"en-us",NUMBER_FORMATS:{DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{minInt:1,minFrac:0,maxFrac:3,posPre:"",posSuf:"",negPre:"-",negSuf:"",gSize:3,
lgSize:3},{minInt:1,minFrac:2,maxFrac:2,posPre:"\u00a4",posSuf:"",negPre:"(\u00a4",negSuf:")",gSize:3,lgSize:3}],CURRENCY_SYM:"$"},DATETIME_FORMATS:{MONTH:"January February March April May June July August September October November December".split(" "),SHORTMONTH:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),DAY:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),SHORTDAY:"Sun Mon Tue Wed Thu Fri Sat".split(" "),AMPMS:["AM","PM"],medium:"MMM d, y h:mm:ss a","short":"M/d/yy h:mm a",
fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",mediumDate:"MMM d, y",shortDate:"M/d/yy",mediumTime:"h:mm:ss a",shortTime:"h:mm a"},pluralCat:function(b){return 1===b?"one":"other"}}}}function oc(b){b=b.split("/");for(var a=b.length;a--;)b[a]=sb(b[a]);return b.join("/")}function pc(b,a,c){b=ya(b,c);a.$$protocol=b.protocol;a.$$host=b.hostname;a.$$port=R(b.port)||td[b.protocol]||null}function qc(b,a,c){var d="/"!==b.charAt(0);d&&(b="/"+b);b=ya(b,c);a.$$path=decodeURIComponent(d&&"/"===b.pathname.charAt(0)?
b.pathname.substring(1):b.pathname);a.$$search=Vb(b.search);a.$$hash=decodeURIComponent(b.hash);a.$$path&&"/"!=a.$$path.charAt(0)&&(a.$$path="/"+a.$$path)}function na(b,a){if(0===a.indexOf(b))return a.substr(b.length)}function Wa(b){var a=b.indexOf("#");return-1==a?b:b.substr(0,a)}function Gb(b){return b.substr(0,Wa(b).lastIndexOf("/")+1)}function rc(b,a){this.$$html5=!0;a=a||"";var c=Gb(b);pc(b,this,b);this.$$parse=function(a){var e=na(c,a);if(!D(e))throw Hb("ipthprfx",a,c);qc(e,this,b);this.$$path||
(this.$$path="/");this.$$compose()};this.$$compose=function(){var a=Wb(this.$$search),b=this.$$hash?"#"+sb(this.$$hash):"";this.$$url=oc(this.$$path)+(a?"?"+a:"")+b;this.$$absUrl=c+this.$$url.substr(1)};this.$$rewrite=function(d){var e;if((e=na(b,d))!==r)return d=e,(e=na(a,e))!==r?c+(na("/",e)||e):b+d;if((e=na(c,d))!==r)return c+e;if(c==d+"/")return c}}function Ib(b,a){var c=Gb(b);pc(b,this,b);this.$$parse=function(d){var e=na(b,d)||na(c,d),e="#"==e.charAt(0)?na(a,e):this.$$html5?e:"";if(!D(e))throw Hb("ihshprfx",
d,a);qc(e,this,b);d=this.$$path;var g=/^\/?.*?:(\/.*)/;0===e.indexOf(b)&&(e=e.replace(b,""));g.exec(e)||(d=(e=g.exec(d))?e[1]:d);this.$$path=d;this.$$compose()};this.$$compose=function(){var c=Wb(this.$$search),e=this.$$hash?"#"+sb(this.$$hash):"";this.$$url=oc(this.$$path)+(c?"?"+c:"")+e;this.$$absUrl=b+(this.$$url?a+this.$$url:"")};this.$$rewrite=function(a){if(Wa(b)==Wa(a))return a}}function sc(b,a){this.$$html5=!0;Ib.apply(this,arguments);var c=Gb(b);this.$$rewrite=function(d){var e;if(b==Wa(d))return d;
if(e=na(c,d))return b+a+e;if(c===d+"/")return c}}function hb(b){return function(){return this[b]}}function tc(b,a){return function(c){if(H(c))return this[b];this[b]=a(c);this.$$compose();return this}}function ud(){var b="",a=!1;this.hashPrefix=function(a){return z(a)?(b=a,this):b};this.html5Mode=function(b){return z(b)?(a=b,this):a};this.$get=["$rootScope","$browser","$sniffer","$rootElement",function(c,d,e,g){function f(a){c.$broadcast("$locationChangeSuccess",h.absUrl(),a)}var h,l=d.baseHref(),
k=d.url();a?(l=k.substring(0,k.indexOf("/",k.indexOf("//")+2))+(l||"/"),e=e.history?rc:sc):(l=Wa(k),e=Ib);h=new e(l,"#"+b);h.$$parse(h.$$rewrite(k));g.on("click",function(a){if(!a.ctrlKey&&!a.metaKey&&2!=a.which){for(var b=x(a.target);"a"!==v(b[0].nodeName);)if(b[0]===g[0]||!(b=b.parent())[0])return;var e=b.prop("href"),f=h.$$rewrite(e);e&&(!b.attr("target")&&f&&!a.isDefaultPrevented())&&(a.preventDefault(),f!=d.url()&&(h.$$parse(f),c.$apply(),W.angular["ff-684208-preventDefault"]=!0))}});h.absUrl()!=
k&&d.url(h.absUrl(),!0);d.onUrlChange(function(a){h.absUrl()!=a&&(c.$broadcast("$locationChangeStart",a,h.absUrl()).defaultPrevented?d.url(h.absUrl()):(c.$evalAsync(function(){var b=h.absUrl();h.$$parse(a);f(b)}),c.$$phase||c.$digest()))});var m=0;c.$watch(function(){var a=d.url(),b=h.$$replace;m&&a==h.absUrl()||(m++,c.$evalAsync(function(){c.$broadcast("$locationChangeStart",h.absUrl(),a).defaultPrevented?h.$$parse(a):(d.url(h.absUrl(),b),f(a))}));h.$$replace=!1;return m});return h}]}function vd(){var b=
!0,a=this;this.debugEnabled=function(a){return z(a)?(b=a,this):b};this.$get=["$window",function(c){function d(a){a instanceof Error&&(a.stack?a=a.message&&-1===a.stack.indexOf(a.message)?"Error: "+a.message+"\n"+a.stack:a.stack:a.sourceURL&&(a=a.message+"\n"+a.sourceURL+":"+a.line));return a}function e(a){var b=c.console||{},e=b[a]||b.log||s;return e.apply?function(){var a=[];q(arguments,function(b){a.push(d(b))});return e.apply(b,a)}:function(a,b){e(a,null==b?"":b)}}return{log:e("log"),info:e("info"),
warn:e("warn"),error:e("error"),debug:function(){var c=e("debug");return function(){b&&c.apply(a,arguments)}}()}}]}function pa(b,a){if("constructor"===b)throw za("isecfld",a);return b}function Xa(b,a){if(b){if(b.constructor===b)throw za("isecfn",a);if(b.document&&b.location&&b.alert&&b.setInterval)throw za("isecwindow",a);if(b.children&&(b.nodeName||b.on&&b.find))throw za("isecdom",a);}return b}function ib(b,a,c,d,e){e=e||{};a=a.split(".");for(var g,f=0;1<a.length;f++){g=pa(a.shift(),d);var h=b[g];
h||(h={},b[g]=h);b=h;b.then&&e.unwrapPromises&&(qa(d),"$$v"in b||function(a){a.then(function(b){a.$$v=b})}(b),b.$$v===r&&(b.$$v={}),b=b.$$v)}g=pa(a.shift(),d);return b[g]=c}function uc(b,a,c,d,e,g,f){pa(b,g);pa(a,g);pa(c,g);pa(d,g);pa(e,g);return f.unwrapPromises?function(f,l){var k=l&&l.hasOwnProperty(b)?l:f,m;if(null===k||k===r)return k;(k=k[b])&&k.then&&(qa(g),"$$v"in k||(m=k,m.$$v=r,m.then(function(a){m.$$v=a})),k=k.$$v);if(!a||null===k||k===r)return k;(k=k[a])&&k.then&&(qa(g),"$$v"in k||(m=k,
m.$$v=r,m.then(function(a){m.$$v=a})),k=k.$$v);if(!c||null===k||k===r)return k;(k=k[c])&&k.then&&(qa(g),"$$v"in k||(m=k,m.$$v=r,m.then(function(a){m.$$v=a})),k=k.$$v);if(!d||null===k||k===r)return k;(k=k[d])&&k.then&&(qa(g),"$$v"in k||(m=k,m.$$v=r,m.then(function(a){m.$$v=a})),k=k.$$v);if(!e||null===k||k===r)return k;(k=k[e])&&k.then&&(qa(g),"$$v"in k||(m=k,m.$$v=r,m.then(function(a){m.$$v=a})),k=k.$$v);return k}:function(g,f){var k=f&&f.hasOwnProperty(b)?f:g;if(null===k||k===r)return k;k=k[b];if(!a||
null===k||k===r)return k;k=k[a];if(!c||null===k||k===r)return k;k=k[c];if(!d||null===k||k===r)return k;k=k[d];return e&&null!==k&&k!==r?k=k[e]:k}}function vc(b,a,c){if(Jb.hasOwnProperty(b))return Jb[b];var d=b.split("."),e=d.length,g;if(a.csp)g=6>e?uc(d[0],d[1],d[2],d[3],d[4],c,a):function(b,g){var f=0,h;do h=uc(d[f++],d[f++],d[f++],d[f++],d[f++],c,a)(b,g),g=r,b=h;while(f<e);return h};else{var f="var l, fn, p;\n";q(d,function(b,d){pa(b,c);f+="if(s === null || s === undefined) return s;\nl=s;\ns="+
(d?"s":'((k&&k.hasOwnProperty("'+b+'"))?k:s)')+'["'+b+'"];\n'+(a.unwrapPromises?'if (s && s.then) {\n pw("'+c.replace(/(["\r\n])/g,"\\$1")+'");\n if (!("$$v" in s)) {\n p=s;\n p.$$v = undefined;\n p.then(function(v) {p.$$v=v;});\n}\n s=s.$$v\n}\n':"")});var f=f+"return s;",h=new Function("s","k","pw",f);h.toString=function(){return f};g=function(a,b){return h(a,b,qa)}}"hasOwnProperty"!==b&&(Jb[b]=g);return g}function wd(){var b={},a={csp:!1,unwrapPromises:!1,logPromiseWarnings:!0};this.unwrapPromises=
function(b){return z(b)?(a.unwrapPromises=!!b,this):a.unwrapPromises};this.logPromiseWarnings=function(b){return z(b)?(a.logPromiseWarnings=b,this):a.logPromiseWarnings};this.$get=["$filter","$sniffer","$log",function(c,d,e){a.csp=d.csp;qa=function(b){a.logPromiseWarnings&&!wc.hasOwnProperty(b)&&(wc[b]=!0,e.warn("[$parse] Promise found in the expression `"+b+"`. Automatic unwrapping of promises in Angular expressions is deprecated."))};return function(d){var e;switch(typeof d){case "string":if(b.hasOwnProperty(d))return b[d];
e=new Kb(a);e=(new Ya(e,c,a)).parse(d,!1);"hasOwnProperty"!==d&&(b[d]=e);return e;case "function":return d;default:return s}}}]}function xd(){this.$get=["$rootScope","$exceptionHandler",function(b,a){return yd(function(a){b.$evalAsync(a)},a)}]}function yd(b,a){function c(a){return a}function d(a){return f(a)}var e=function(){var h=[],l,k;return k={resolve:function(a){if(h){var c=h;h=r;l=g(a);c.length&&b(function(){for(var a,b=0,d=c.length;b<d;b++)a=c[b],l.then(a[0],a[1],a[2])})}},reject:function(a){k.resolve(f(a))},
notify:function(a){if(h){var c=h;h.length&&b(function(){for(var b,d=0,e=c.length;d<e;d++)b=c[d],b[2](a)})}},promise:{then:function(b,f,g){var k=e(),C=function(d){try{k.resolve((A(b)?b:c)(d))}catch(e){k.reject(e),a(e)}},B=function(b){try{k.resolve((A(f)?f:d)(b))}catch(c){k.reject(c),a(c)}},K=function(b){try{k.notify((A(g)?g:c)(b))}catch(d){a(d)}};h?h.push([C,B,K]):l.then(C,B,K);return k.promise},"catch":function(a){return this.then(null,a)},"finally":function(a){function b(a,c){var d=e();c?d.resolve(a):
d.reject(a);return d.promise}function d(e,f){var g=null;try{g=(a||c)()}catch(h){return b(h,!1)}return g&&A(g.then)?g.then(function(){return b(e,f)},function(a){return b(a,!1)}):b(e,f)}return this.then(function(a){return d(a,!0)},function(a){return d(a,!1)})}}}},g=function(a){return a&&A(a.then)?a:{then:function(c){var d=e();b(function(){d.resolve(c(a))});return d.promise}}},f=function(c){return{then:function(f,g){var m=e();b(function(){try{m.resolve((A(g)?g:d)(c))}catch(b){m.reject(b),a(b)}});return m.promise}}};
return{defer:e,reject:f,when:function(h,l,k,m){var n=e(),p,t=function(b){try{return(A(l)?l:c)(b)}catch(d){return a(d),f(d)}},C=function(b){try{return(A(k)?k:d)(b)}catch(c){return a(c),f(c)}},B=function(b){try{return(A(m)?m:c)(b)}catch(d){a(d)}};b(function(){g(h).then(function(a){p||(p=!0,n.resolve(g(a).then(t,C,B)))},function(a){p||(p=!0,n.resolve(C(a)))},function(a){p||n.notify(B(a))})});return n.promise},all:function(a){var b=e(),c=0,d=L(a)?[]:{};q(a,function(a,e){c++;g(a).then(function(a){d.hasOwnProperty(e)||
(d[e]=a,--c||b.resolve(d))},function(a){d.hasOwnProperty(e)||b.reject(a)})});0===c&&b.resolve(d);return b.promise}}}function zd(){var b=10,a=G("$rootScope"),c=null;this.digestTtl=function(a){arguments.length&&(b=a);return b};this.$get=["$injector","$exceptionHandler","$parse","$browser",function(d,e,g,f){function h(){this.$id=Za();this.$$phase=this.$parent=this.$$watchers=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null;this["this"]=this.$root=this;this.$$destroyed=!1;
this.$$asyncQueue=[];this.$$postDigestQueue=[];this.$$listeners={};this.$$isolateBindings={}}function l(b){if(n.$$phase)throw a("inprog",n.$$phase);n.$$phase=b}function k(a,b){var c=g(a);Qa(c,b);return c}function m(){}h.prototype={constructor:h,$new:function(a){a?(a=new h,a.$root=this.$root,a.$$asyncQueue=this.$$asyncQueue,a.$$postDigestQueue=this.$$postDigestQueue):(a=function(){},a.prototype=this,a=new a,a.$id=Za());a["this"]=a;a.$$listeners={};a.$parent=this;a.$$watchers=a.$$nextSibling=a.$$childHead=
a.$$childTail=null;a.$$prevSibling=this.$$childTail;this.$$childHead?this.$$childTail=this.$$childTail.$$nextSibling=a:this.$$childHead=this.$$childTail=a;return a},$watch:function(a,b,d){var e=k(a,"watch"),g=this.$$watchers,f={fn:b,last:m,get:e,exp:a,eq:!!d};c=null;if(!A(b)){var h=k(b||s,"listener");f.fn=function(a,b,c){h(c)}}if("string"==typeof a&&e.constant){var l=f.fn;f.fn=function(a,b,c){l.call(this,a,b,c);Ma(g,f)}}g||(g=this.$$watchers=[]);g.unshift(f);return function(){Ma(g,f)}},$watchCollection:function(a,
b){var c=this,d,e,f=0,h=g(a),l=[],k={},m=0;return this.$watch(function(){e=h(c);var a,b;if(U(e))if(pb(e))for(d!==l&&(d=l,m=d.length=0,f++),a=e.length,m!==a&&(f++,d.length=m=a),b=0;b<a;b++)d[b]!==e[b]&&(f++,d[b]=e[b]);else{d!==k&&(d=k={},m=0,f++);a=0;for(b in e)e.hasOwnProperty(b)&&(a++,d.hasOwnProperty(b)?d[b]!==e[b]&&(f++,d[b]=e[b]):(m++,d[b]=e[b],f++));if(m>a)for(b in f++,d)d.hasOwnProperty(b)&&!e.hasOwnProperty(b)&&(m--,delete d[b])}else d!==e&&(d=e,f++);return f},function(){b(e,d,c)})},$digest:function(){var d,
f,g,h,k=this.$$asyncQueue,q=this.$$postDigestQueue,r,v,y=b,s,x=[],z,X,$;l("$digest");c=null;do{v=!1;for(s=this;k.length;){try{$=k.shift(),$.scope.$eval($.expression)}catch(O){n.$$phase=null,e(O)}c=null}a:do{if(h=s.$$watchers)for(r=h.length;r--;)try{if(d=h[r])if((f=d.get(s))!==(g=d.last)&&!(d.eq?ta(f,g):"number"==typeof f&&"number"==typeof g&&isNaN(f)&&isNaN(g)))v=!0,c=d,d.last=d.eq?ga(f):f,d.fn(f,g===m?f:g,s),5>y&&(z=4-y,x[z]||(x[z]=[]),X=A(d.exp)?"fn: "+(d.exp.name||d.exp.toString()):d.exp,X+="; newVal: "+
oa(f)+"; oldVal: "+oa(g),x[z].push(X));else if(d===c){v=!1;break a}}catch(M){n.$$phase=null,e(M)}if(!(h=s.$$childHead||s!==this&&s.$$nextSibling))for(;s!==this&&!(h=s.$$nextSibling);)s=s.$parent}while(s=h);if(v&&!y--)throw n.$$phase=null,a("infdig",b,oa(x));}while(v||k.length);for(n.$$phase=null;q.length;)try{q.shift()()}catch(S){e(S)}},$destroy:function(){if(!this.$$destroyed){var a=this.$parent;this.$broadcast("$destroy");this.$$destroyed=!0;this!==n&&(a.$$childHead==this&&(a.$$childHead=this.$$nextSibling),
a.$$childTail==this&&(a.$$childTail=this.$$prevSibling),this.$$prevSibling&&(this.$$prevSibling.$$nextSibling=this.$$nextSibling),this.$$nextSibling&&(this.$$nextSibling.$$prevSibling=this.$$prevSibling),this.$parent=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null)}},$eval:function(a,b){return g(a)(this,b)},$evalAsync:function(a){n.$$phase||n.$$asyncQueue.length||f.defer(function(){n.$$asyncQueue.length&&n.$digest()});this.$$asyncQueue.push({scope:this,expression:a})},
$$postDigest:function(a){this.$$postDigestQueue.push(a)},$apply:function(a){try{return l("$apply"),this.$eval(a)}catch(b){e(b)}finally{n.$$phase=null;try{n.$digest()}catch(c){throw e(c),c;}}},$on:function(a,b){var c=this.$$listeners[a];c||(this.$$listeners[a]=c=[]);c.push(b);return function(){c[bb(c,b)]=null}},$emit:function(a,b){var c=[],d,f=this,g=!1,h={name:a,targetScope:f,stopPropagation:function(){g=!0},preventDefault:function(){h.defaultPrevented=!0},defaultPrevented:!1},l=[h].concat(ua.call(arguments,
1)),k,m;do{d=f.$$listeners[a]||c;h.currentScope=f;k=0;for(m=d.length;k<m;k++)if(d[k])try{d[k].apply(null,l)}catch(n){e(n)}else d.splice(k,1),k--,m--;if(g)break;f=f.$parent}while(f);return h},$broadcast:function(a,b){var c=this,d=this,f={name:a,targetScope:this,preventDefault:function(){f.defaultPrevented=!0},defaultPrevented:!1},g=[f].concat(ua.call(arguments,1)),h,k;do{c=d;f.currentScope=c;d=c.$$listeners[a]||[];h=0;for(k=d.length;h<k;h++)if(d[h])try{d[h].apply(null,g)}catch(l){e(l)}else d.splice(h,
1),h--,k--;if(!(d=c.$$childHead||c!==this&&c.$$nextSibling))for(;c!==this&&!(d=c.$$nextSibling);)c=c.$parent}while(c=d);return f}};var n=new h;return n}]}function Ad(){var b=/^\s*(https?|ftp|mailto|tel|file):/,a=/^\s*(https?|ftp|file):|data:image\//;this.aHrefSanitizationWhitelist=function(a){return z(a)?(b=a,this):b};this.imgSrcSanitizationWhitelist=function(b){return z(b)?(a=b,this):a};this.$get=function(){return function(c,d){var e=d?a:b,g;if(!E||8<=E)if(g=ya(c).href,""!==g&&!g.match(e))return"unsafe:"+
g;return c}}}function Bd(b){if("self"===b)return b;if(D(b)){if(-1<b.indexOf("***"))throw ra("iwcard",b);b=b.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08").replace("\\*\\*",".*").replace("\\*","[^:/.?&;]*");return RegExp("^"+b+"$")}if(ab(b))return RegExp("^"+b.source+"$");throw ra("imatcher");}function xc(b){var a=[];z(b)&&q(b,function(b){a.push(Bd(b))});return a}function Cd(){this.SCE_CONTEXTS=fa;var b=["self"],a=[];this.resourceUrlWhitelist=function(a){arguments.length&&
(b=xc(a));return b};this.resourceUrlBlacklist=function(b){arguments.length&&(a=xc(b));return a};this.$get=["$injector",function(c){function d(a){var b=function(a){this.$$unwrapTrustedValue=function(){return a}};a&&(b.prototype=new a);b.prototype.valueOf=function(){return this.$$unwrapTrustedValue()};b.prototype.toString=function(){return this.$$unwrapTrustedValue().toString()};return b}var e=function(a){throw ra("unsafe");};c.has("$sanitize")&&(e=c.get("$sanitize"));var g=d(),f={};f[fa.HTML]=d(g);
f[fa.CSS]=d(g);f[fa.URL]=d(g);f[fa.JS]=d(g);f[fa.RESOURCE_URL]=d(f[fa.URL]);return{trustAs:function(a,b){var c=f.hasOwnProperty(a)?f[a]:null;if(!c)throw ra("icontext",a,b);if(null===b||b===r||""===b)return b;if("string"!==typeof b)throw ra("itype",a);return new c(b)},getTrusted:function(c,d){if(null===d||d===r||""===d)return d;var g=f.hasOwnProperty(c)?f[c]:null;if(g&&d instanceof g)return d.$$unwrapTrustedValue();if(c===fa.RESOURCE_URL){var g=ya(d.toString()),m,n,p=!1;m=0;for(n=b.length;m<n;m++)if("self"===
b[m]?Fb(g):b[m].exec(g.href)){p=!0;break}if(p)for(m=0,n=a.length;m<n;m++)if("self"===a[m]?Fb(g):a[m].exec(g.href)){p=!1;break}if(p)return d;throw ra("insecurl",d.toString());}if(c===fa.HTML)return e(d);throw ra("unsafe");},valueOf:function(a){return a instanceof g?a.$$unwrapTrustedValue():a}}}]}function Dd(){var b=!0;this.enabled=function(a){arguments.length&&(b=!!a);return b};this.$get=["$parse","$sniffer","$sceDelegate",function(a,c,d){if(b&&c.msie&&8>c.msieDocumentMode)throw ra("iequirks");var e=
ga(fa);e.isEnabled=function(){return b};e.trustAs=d.trustAs;e.getTrusted=d.getTrusted;e.valueOf=d.valueOf;b||(e.trustAs=e.getTrusted=function(a,b){return b},e.valueOf=Ba);e.parseAs=function(b,c){var d=a(c);return d.literal&&d.constant?d:function(a,c){return e.getTrusted(b,d(a,c))}};var g=e.parseAs,f=e.getTrusted,h=e.trustAs;q(fa,function(a,b){var c=v(b);e[Ra("parse_as_"+c)]=function(b){return g(a,b)};e[Ra("get_trusted_"+c)]=function(b){return f(a,b)};e[Ra("trust_as_"+c)]=function(b){return h(a,b)}});
return e}]}function Ed(){this.$get=["$window","$document",function(b,a){var c={},d=R((/android (\d+)/.exec(v((b.navigator||{}).userAgent))||[])[1]),e=/Boxee/i.test((b.navigator||{}).userAgent),g=a[0]||{},f=g.documentMode,h,l=/^(Moz|webkit|O|ms)(?=[A-Z])/,k=g.body&&g.body.style,m=!1,n=!1;if(k){for(var p in k)if(m=l.exec(p)){h=m[0];h=h.substr(0,1).toUpperCase()+h.substr(1);break}h||(h="WebkitOpacity"in k&&"webkit");m=!!("transition"in k||h+"Transition"in k);n=!!("animation"in k||h+"Animation"in k);
!d||m&&n||(m=D(g.body.style.webkitTransition),n=D(g.body.style.webkitAnimation))}return{history:!(!b.history||!b.history.pushState||4>d||e),hashchange:"onhashchange"in b&&(!f||7<f),hasEvent:function(a){if("input"==a&&9==E)return!1;if(H(c[a])){var b=g.createElement("div");c[a]="on"+a in b}return c[a]},csp:Sb(),vendorPrefix:h,transitions:m,animations:n,msie:E,msieDocumentMode:f}}]}function Fd(){this.$get=["$rootScope","$browser","$q","$exceptionHandler",function(b,a,c,d){function e(e,h,l){var k=c.defer(),
m=k.promise,n=z(l)&&!l;h=a.defer(function(){try{k.resolve(e())}catch(a){k.reject(a),d(a)}finally{delete g[m.$$timeoutId]}n||b.$apply()},h);m.$$timeoutId=h;g[h]=k;return m}var g={};e.cancel=function(b){return b&&b.$$timeoutId in g?(g[b.$$timeoutId].reject("canceled"),delete g[b.$$timeoutId],a.defer.cancel(b.$$timeoutId)):!1};return e}]}function ya(b,a){var c=b;E&&(T.setAttribute("href",c),c=T.href);T.setAttribute("href",c);return{href:T.href,protocol:T.protocol?T.protocol.replace(/:$/,""):"",host:T.host,
search:T.search?T.search.replace(/^\?/,""):"",hash:T.hash?T.hash.replace(/^#/,""):"",hostname:T.hostname,port:T.port,pathname:"/"===T.pathname.charAt(0)?T.pathname:"/"+T.pathname}}function Fb(b){b=D(b)?ya(b):b;return b.protocol===yc.protocol&&b.host===yc.host}function Gd(){this.$get=ca(W)}function zc(b){function a(d,e){if(U(d)){var g={};q(d,function(b,c){g[c]=a(c,b)});return g}return b.factory(d+c,e)}var c="Filter";this.register=a;this.$get=["$injector",function(a){return function(b){return a.get(b+
c)}}];a("currency",Ac);a("date",Bc);a("filter",Hd);a("json",Id);a("limitTo",Jd);a("lowercase",Kd);a("number",Cc);a("orderBy",Dc);a("uppercase",Ld)}function Hd(){return function(b,a,c){if(!L(b))return b;var d=typeof c,e=[];e.check=function(a){for(var b=0;b<e.length;b++)if(!e[b](a))return!1;return!0};"function"!==d&&(c="boolean"===d&&c?function(a,b){return Pa.equals(a,b)}:function(a,b){b=(""+b).toLowerCase();return-1<(""+a).toLowerCase().indexOf(b)});var g=function(a,b){if("string"==typeof b&&"!"===
b.charAt(0))return!g(a,b.substr(1));switch(typeof a){case "boolean":case "number":case "string":return c(a,b);case "object":switch(typeof b){case "object":return c(a,b);default:for(var d in a)if("$"!==d.charAt(0)&&g(a[d],b))return!0}return!1;case "array":for(d=0;d<a.length;d++)if(g(a[d],b))return!0;return!1;default:return!1}};switch(typeof a){case "boolean":case "number":case "string":a={$:a};case "object":for(var f in a)"$"==f?function(){if(a[f]){var b=f;e.push(function(c){return g(c,a[b])})}}():
function(){if("undefined"!=typeof a[f]){var b=f;e.push(function(c){return g(ub(c,b),a[b])})}}();break;case "function":e.push(a);break;default:return b}for(var d=[],h=0;h<b.length;h++){var l=b[h];e.check(l)&&d.push(l)}return d}}function Ac(b){var a=b.NUMBER_FORMATS;return function(b,d){H(d)&&(d=a.CURRENCY_SYM);return Ec(b,a.PATTERNS[1],a.GROUP_SEP,a.DECIMAL_SEP,2).replace(/\u00A4/g,d)}}function Cc(b){var a=b.NUMBER_FORMATS;return function(b,d){return Ec(b,a.PATTERNS[0],a.GROUP_SEP,a.DECIMAL_SEP,d)}}
function Ec(b,a,c,d,e){if(isNaN(b)||!isFinite(b))return"";var g=0>b;b=Math.abs(b);var f=b+"",h="",l=[],k=!1;if(-1!==f.indexOf("e")){var m=f.match(/([\d\.]+)e(-?)(\d+)/);m&&"-"==m[2]&&m[3]>e+1?f="0":(h=f,k=!0)}if(k)0<e&&(-1<b&&1>b)&&(h=b.toFixed(e));else{f=(f.split(Fc)[1]||"").length;H(e)&&(e=Math.min(Math.max(a.minFrac,f),a.maxFrac));f=Math.pow(10,e);b=Math.round(b*f)/f;b=(""+b).split(Fc);f=b[0];b=b[1]||"";var m=0,n=a.lgSize,p=a.gSize;if(f.length>=n+p)for(m=f.length-n,k=0;k<m;k++)0===(m-k)%p&&0!==
k&&(h+=c),h+=f.charAt(k);for(k=m;k<f.length;k++)0===(f.length-k)%n&&0!==k&&(h+=c),h+=f.charAt(k);for(;b.length<e;)b+="0";e&&"0"!==e&&(h+=d+b.substr(0,e))}l.push(g?a.negPre:a.posPre);l.push(h);l.push(g?a.negSuf:a.posSuf);return l.join("")}function Lb(b,a,c){var d="";0>b&&(d="-",b=-b);for(b=""+b;b.length<a;)b="0"+b;c&&(b=b.substr(b.length-a));return d+b}function V(b,a,c,d){c=c||0;return function(e){e=e["get"+b]();if(0<c||e>-c)e+=c;0===e&&-12==c&&(e=12);return Lb(e,a,d)}}function jb(b,a){return function(c,
d){var e=c["get"+b](),g=Ia(a?"SHORT"+b:b);return d[g][e]}}function Bc(b){function a(a){var b;if(b=a.match(c)){a=new Date(0);var g=0,f=0,h=b[8]?a.setUTCFullYear:a.setFullYear,l=b[8]?a.setUTCHours:a.setHours;b[9]&&(g=R(b[9]+b[10]),f=R(b[9]+b[11]));h.call(a,R(b[1]),R(b[2])-1,R(b[3]));g=R(b[4]||0)-g;f=R(b[5]||0)-f;h=R(b[6]||0);b=Math.round(1E3*parseFloat("0."+(b[7]||0)));l.call(a,g,f,h,b)}return a}var c=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
return function(c,e){var g="",f=[],h,l;e=e||"mediumDate";e=b.DATETIME_FORMATS[e]||e;D(c)&&(c=Md.test(c)?R(c):a(c));qb(c)&&(c=new Date(c));if(!La(c))return c;for(;e;)(l=Nd.exec(e))?(f=f.concat(ua.call(l,1)),e=f.pop()):(f.push(e),e=null);q(f,function(a){h=Od[a];g+=h?h(c,b.DATETIME_FORMATS):a.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return g}}function Id(){return function(b){return oa(b,!0)}}function Jd(){return function(b,a){if(!L(b)&&!D(b))return b;a=R(a);if(D(b))return a?0<=a?b.slice(0,a):b.slice(a,
b.length):"";var c=[],d,e;a>b.length?a=b.length:a<-b.length&&(a=-b.length);0<a?(d=0,e=a):(d=b.length+a,e=b.length);for(;d<e;d++)c.push(b[d]);return c}}function Dc(b){return function(a,c,d){function e(a,b){return Oa(b)?function(b,c){return a(c,b)}:a}if(!L(a)||!c)return a;c=L(c)?c:[c];c=Pc(c,function(a){var c=!1,d=a||Ba;if(D(a)){if("+"==a.charAt(0)||"-"==a.charAt(0))c="-"==a.charAt(0),a=a.substring(1);d=b(a)}return e(function(a,b){var c;c=d(a);var e=d(b),f=typeof c,g=typeof e;f==g?("string"==f&&(c=
c.toLowerCase(),e=e.toLowerCase()),c=c===e?0:c<e?-1:1):c=f<g?-1:1;return c},c)});for(var g=[],f=0;f<a.length;f++)g.push(a[f]);return g.sort(e(function(a,b){for(var d=0;d<c.length;d++){var e=c[d](a,b);if(0!==e)return e}return 0},d))}}function sa(b){A(b)&&(b={link:b});b.restrict=b.restrict||"AC";return ca(b)}function Gc(b,a){function c(a,c){c=c?"-"+cb(c,"-"):"";b.removeClass((a?kb:lb)+c).addClass((a?lb:kb)+c)}var d=this,e=b.parent().controller("form")||mb,g=0,f=d.$error={},h=[];d.$name=a.name||a.ngForm;
d.$dirty=!1;d.$pristine=!0;d.$valid=!0;d.$invalid=!1;e.$addControl(d);b.addClass(Ja);c(!0);d.$addControl=function(a){wa(a.$name,"input");h.push(a);a.$name&&(d[a.$name]=a)};d.$removeControl=function(a){a.$name&&d[a.$name]===a&&delete d[a.$name];q(f,function(b,c){d.$setValidity(c,!0,a)});Ma(h,a)};d.$setValidity=function(a,b,h){var n=f[a];if(b)n&&(Ma(n,h),n.length||(g--,g||(c(b),d.$valid=!0,d.$invalid=!1),f[a]=!1,c(!0,a),e.$setValidity(a,!0,d)));else{g||c(b);if(n){if(-1!=bb(n,h))return}else f[a]=n=[],
g++,c(!1,a),e.$setValidity(a,!1,d);n.push(h);d.$valid=!1;d.$invalid=!0}};d.$setDirty=function(){b.removeClass(Ja).addClass(nb);d.$dirty=!0;d.$pristine=!1;e.$setDirty()};d.$setPristine=function(){b.removeClass(nb).addClass(Ja);d.$dirty=!1;d.$pristine=!0;q(h,function(a){a.$setPristine()})}}function ob(b,a,c,d,e,g){var f=!1;a.on("compositionstart",function(){f=!0});a.on("compositionend",function(){f=!1});var h=function(){if(!f){var e=a.val();Oa(c.ngTrim||"T")&&(e=aa(e));d.$viewValue!==e&&b.$apply(function(){d.$setViewValue(e)})}};
if(e.hasEvent("input"))a.on("input",h);else{var l,k=function(){l||(l=g.defer(function(){h();l=null}))};a.on("keydown",function(a){a=a.keyCode;91===a||(15<a&&19>a||37<=a&&40>=a)||k()});if(e.hasEvent("paste"))a.on("paste cut",k)}a.on("change",h);d.$render=function(){a.val(d.$isEmpty(d.$viewValue)?"":d.$viewValue)};var m=c.ngPattern,n=function(a,b){if(d.$isEmpty(b)||a.test(b))return d.$setValidity("pattern",!0),b;d.$setValidity("pattern",!1);return r};m&&((e=m.match(/^\/(.*)\/([gim]*)$/))?(m=RegExp(e[1],
e[2]),e=function(a){return n(m,a)}):e=function(c){var d=b.$eval(m);if(!d||!d.test)throw G("ngPattern")("noregexp",m,d,ha(a));return n(d,c)},d.$formatters.push(e),d.$parsers.push(e));if(c.ngMinlength){var p=R(c.ngMinlength);e=function(a){if(!d.$isEmpty(a)&&a.length<p)return d.$setValidity("minlength",!1),r;d.$setValidity("minlength",!0);return a};d.$parsers.push(e);d.$formatters.push(e)}if(c.ngMaxlength){var t=R(c.ngMaxlength);e=function(a){if(!d.$isEmpty(a)&&a.length>t)return d.$setValidity("maxlength",
!1),r;d.$setValidity("maxlength",!0);return a};d.$parsers.push(e);d.$formatters.push(e)}}function Mb(b,a){b="ngClass"+b;return function(){return{restrict:"AC",link:function(c,d,e){function g(b){if(!0===a||c.$index%2===a){var d=f(b||"");h?ta(b,h)||e.$updateClass(d,f(h)):e.$addClass(d)}h=ga(b)}function f(a){if(L(a))return a.join(" ");if(U(a)){var b=[];q(a,function(a,c){a&&b.push(c)});return b.join(" ")}return a}var h;c.$watch(e[b],g,!0);e.$observe("class",function(a){g(c.$eval(e[b]))});"ngClass"!==
b&&c.$watch("$index",function(d,g){var h=d&1;if(h!==g&1){var n=f(c.$eval(e[b]));h===a?e.$addClass(n):e.$removeClass(n)}})}}}}var v=function(b){return D(b)?b.toLowerCase():b},Ia=function(b){return D(b)?b.toUpperCase():b},E,x,Ca,ua=[].slice,Pd=[].push,$a=Object.prototype.toString,Na=G("ng"),Pa=W.angular||(W.angular={}),Va,Ga,ja=["0","0","0"];E=R((/msie (\d+)/.exec(v(navigator.userAgent))||[])[1]);isNaN(E)&&(E=R((/trident\/.*; rv:(\d+)/.exec(v(navigator.userAgent))||[])[1]));s.$inject=[];Ba.$inject=
[];var aa=function(){return String.prototype.trim?function(b){return D(b)?b.trim():b}:function(b){return D(b)?b.replace(/^\s\s*/,"").replace(/\s\s*$/,""):b}}();Ga=9>E?function(b){b=b.nodeName?b:b[0];return b.scopeName&&"HTML"!=b.scopeName?Ia(b.scopeName+":"+b.nodeName):b.nodeName}:function(b){return b.nodeName?b.nodeName:b[0].nodeName};var Tc=/[A-Z]/g,Qd={full:"1.2.5",major:1,minor:2,dot:5,codeName:"singularity-expansion"},Sa=I.cache={},db=I.expando="ng-"+(new Date).getTime(),Xc=1,Hc=W.document.addEventListener?
function(b,a,c){b.addEventListener(a,c,!1)}:function(b,a,c){b.attachEvent("on"+a,c)},Ab=W.document.removeEventListener?function(b,a,c){b.removeEventListener(a,c,!1)}:function(b,a,c){b.detachEvent("on"+a,c)},Vc=/([\:\-\_]+(.))/g,Wc=/^moz([A-Z])/,xb=G("jqLite"),Fa=I.prototype={ready:function(b){function a(){c||(c=!0,b())}var c=!1;"complete"===N.readyState?setTimeout(a):(this.on("DOMContentLoaded",a),I(W).on("load",a))},toString:function(){var b=[];q(this,function(a){b.push(""+a)});return"["+b.join(", ")+
"]"},eq:function(b){return 0<=b?x(this[b]):x(this[this.length+b])},length:0,push:Pd,sort:[].sort,splice:[].splice},fb={};q("multiple selected checked disabled readOnly required open".split(" "),function(b){fb[v(b)]=b});var ec={};q("input select option textarea button form details".split(" "),function(b){ec[Ia(b)]=!0});q({data:ac,inheritedData:eb,scope:function(b){return x(b).data("$scope")||eb(b.parentNode||b,["$isolateScope","$scope"])},isolateScope:function(b){return x(b).data("$isolateScope")||
x(b).data("$isolateScopeNoTemplate")},controller:bc,injector:function(b){return eb(b,"$injector")},removeAttr:function(b,a){b.removeAttribute(a)},hasClass:Bb,css:function(b,a,c){a=Ra(a);if(z(c))b.style[a]=c;else{var d;8>=E&&(d=b.currentStyle&&b.currentStyle[a],""===d&&(d="auto"));d=d||b.style[a];8>=E&&(d=""===d?r:d);return d}},attr:function(b,a,c){var d=v(a);if(fb[d])if(z(c))c?(b[a]=!0,b.setAttribute(a,d)):(b[a]=!1,b.removeAttribute(d));else return b[a]||(b.attributes.getNamedItem(a)||s).specified?
d:r;else if(z(c))b.setAttribute(a,c);else if(b.getAttribute)return b=b.getAttribute(a,2),null===b?r:b},prop:function(b,a,c){if(z(c))b[a]=c;else return b[a]},text:function(){function b(b,d){var e=a[b.nodeType];if(H(d))return e?b[e]:"";b[e]=d}var a=[];9>E?(a[1]="innerText",a[3]="nodeValue"):a[1]=a[3]="textContent";b.$dv="";return b}(),val:function(b,a){if(H(a)){if("SELECT"===Ga(b)&&b.multiple){var c=[];q(b.options,function(a){a.selected&&c.push(a.value||a.text)});return 0===c.length?null:c}return b.value}b.value=
a},html:function(b,a){if(H(a))return b.innerHTML;for(var c=0,d=b.childNodes;c<d.length;c++)Da(d[c]);b.innerHTML=a},empty:cc},function(b,a){I.prototype[a]=function(a,d){var e,g;if(b!==cc&&(2==b.length&&b!==Bb&&b!==bc?a:d)===r){if(U(a)){for(e=0;e<this.length;e++)if(b===ac)b(this[e],a);else for(g in a)b(this[e],g,a[g]);return this}e=b.$dv;g=e===r?Math.min(this.length,1):this.length;for(var f=0;f<g;f++){var h=b(this[f],a,d);e=e?e+h:h}return e}for(e=0;e<this.length;e++)b(this[e],a,d);return this}});q({removeData:Zb,
dealoc:Da,on:function a(c,d,e,g){if(z(g))throw xb("onargs");var f=ka(c,"events"),h=ka(c,"handle");f||ka(c,"events",f={});h||ka(c,"handle",h=Yc(c,f));q(d.split(" "),function(d){var g=f[d];if(!g){if("mouseenter"==d||"mouseleave"==d){var m=N.body.contains||N.body.compareDocumentPosition?function(a,c){var d=9===a.nodeType?a.documentElement:a,e=c&&c.parentNode;return a===e||!!(e&&1===e.nodeType&&(d.contains?d.contains(e):a.compareDocumentPosition&&a.compareDocumentPosition(e)&16))}:function(a,c){if(c)for(;c=
c.parentNode;)if(c===a)return!0;return!1};f[d]=[];a(c,{mouseleave:"mouseout",mouseenter:"mouseover"}[d],function(a){var c=a.relatedTarget;c&&(c===this||m(this,c))||h(a,d)})}else Hc(c,d,h),f[d]=[];g=f[d]}g.push(e)})},off:$b,replaceWith:function(a,c){var d,e=a.parentNode;Da(a);q(new I(c),function(c){d?e.insertBefore(c,d.nextSibling):e.replaceChild(c,a);d=c})},children:function(a){var c=[];q(a.childNodes,function(a){1===a.nodeType&&c.push(a)});return c},contents:function(a){return a.childNodes||[]},
append:function(a,c){q(new I(c),function(c){1!==a.nodeType&&11!==a.nodeType||a.appendChild(c)})},prepend:function(a,c){if(1===a.nodeType){var d=a.firstChild;q(new I(c),function(c){a.insertBefore(c,d)})}},wrap:function(a,c){c=x(c)[0];var d=a.parentNode;d&&d.replaceChild(c,a);c.appendChild(a)},remove:function(a){Da(a);var c=a.parentNode;c&&c.removeChild(a)},after:function(a,c){var d=a,e=a.parentNode;q(new I(c),function(a){e.insertBefore(a,d.nextSibling);d=a})},addClass:Db,removeClass:Cb,toggleClass:function(a,
c,d){H(d)&&(d=!Bb(a,c));(d?Db:Cb)(a,c)},parent:function(a){return(a=a.parentNode)&&11!==a.nodeType?a:null},next:function(a){if(a.nextElementSibling)return a.nextElementSibling;for(a=a.nextSibling;null!=a&&1!==a.nodeType;)a=a.nextSibling;return a},find:function(a,c){return a.getElementsByTagName?a.getElementsByTagName(c):[]},clone:zb,triggerHandler:function(a,c,d){c=(ka(a,"events")||{})[c];d=d||[];var e=[{preventDefault:s,stopPropagation:s}];q(c,function(c){c.apply(a,e.concat(d))})}},function(a,c){I.prototype[c]=
function(c,e,g){for(var f,h=0;h<this.length;h++)H(f)?(f=a(this[h],c,e,g),z(f)&&(f=x(f))):yb(f,a(this[h],c,e,g));return z(f)?f:this};I.prototype.bind=I.prototype.on;I.prototype.unbind=I.prototype.off});Ta.prototype={put:function(a,c){this[Ea(a)]=c},get:function(a){return this[Ea(a)]},remove:function(a){var c=this[a=Ea(a)];delete this[a];return c}};var $c=/^function\s*[^\(]*\(\s*([^\)]*)\)/m,ad=/,/,bd=/^\s*(_?)(\S+?)\1\s*$/,Zc=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,Ua=G("$injector"),Rd=G("$animate"),Sd=
["$provide",function(a){this.$$selectors={};this.register=function(c,d){var e=c+"-animation";if(c&&"."!=c.charAt(0))throw Rd("notcsel",c);this.$$selectors[c.substr(1)]=e;a.factory(e,d)};this.$get=["$timeout",function(a){return{enter:function(d,e,g,f){g?g.after(d):(e&&e[0]||(e=g.parent()),e.append(d));f&&a(f,0,!1)},leave:function(d,e){d.remove();e&&a(e,0,!1)},move:function(a,c,g,f){this.enter(a,c,g,f)},addClass:function(d,e,g){e=D(e)?e:L(e)?e.join(" "):"";q(d,function(a){Db(a,e)});g&&a(g,0,!1)},removeClass:function(d,
e,g){e=D(e)?e:L(e)?e.join(" "):"";q(d,function(a){Cb(a,e)});g&&a(g,0,!1)},enabled:s}}]}],ia=G("$compile");hc.$inject=["$provide","$$sanitizeUriProvider"];var id=/^(x[\:\-_]|data[\:\-_])/i,pd=W.XMLHttpRequest||function(){try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(c){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(d){}throw G("$httpBackend")("noxhr");},nc=G("$interpolate"),Td=/^([^\?#]*)(\?([^#]*))?(#(.*))?$/,td={http:80,
https:443,ftp:21},Hb=G("$location");sc.prototype=Ib.prototype=rc.prototype={$$html5:!1,$$replace:!1,absUrl:hb("$$absUrl"),url:function(a,c){if(H(a))return this.$$url;var d=Td.exec(a);d[1]&&this.path(decodeURIComponent(d[1]));(d[2]||d[1])&&this.search(d[3]||"");this.hash(d[5]||"",c);return this},protocol:hb("$$protocol"),host:hb("$$host"),port:hb("$$port"),path:tc("$$path",function(a){return"/"==a.charAt(0)?a:"/"+a}),search:function(a,c){switch(arguments.length){case 0:return this.$$search;case 1:if(D(a))this.$$search=
Vb(a);else if(U(a))this.$$search=a;else throw Hb("isrcharg");break;default:H(c)||null===c?delete this.$$search[a]:this.$$search[a]=c}this.$$compose();return this},hash:tc("$$hash",Ba),replace:function(){this.$$replace=!0;return this}};var za=G("$parse"),wc={},qa,Ka={"null":function(){return null},"true":function(){return!0},"false":function(){return!1},undefined:s,"+":function(a,c,d,e){d=d(a,c);e=e(a,c);return z(d)?z(e)?d+e:d:z(e)?e:r},"-":function(a,c,d,e){d=d(a,c);e=e(a,c);return(z(d)?d:0)-(z(e)?
e:0)},"*":function(a,c,d,e){return d(a,c)*e(a,c)},"/":function(a,c,d,e){return d(a,c)/e(a,c)},"%":function(a,c,d,e){return d(a,c)%e(a,c)},"^":function(a,c,d,e){return d(a,c)^e(a,c)},"=":s,"===":function(a,c,d,e){return d(a,c)===e(a,c)},"!==":function(a,c,d,e){return d(a,c)!==e(a,c)},"==":function(a,c,d,e){return d(a,c)==e(a,c)},"!=":function(a,c,d,e){return d(a,c)!=e(a,c)},"<":function(a,c,d,e){return d(a,c)<e(a,c)},">":function(a,c,d,e){return d(a,c)>e(a,c)},"<=":function(a,c,d,e){return d(a,c)<=
e(a,c)},">=":function(a,c,d,e){return d(a,c)>=e(a,c)},"&&":function(a,c,d,e){return d(a,c)&&e(a,c)},"||":function(a,c,d,e){return d(a,c)||e(a,c)},"&":function(a,c,d,e){return d(a,c)&e(a,c)},"|":function(a,c,d,e){return e(a,c)(a,c,d(a,c))},"!":function(a,c,d){return!d(a,c)}},Ud={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},Kb=function(a){this.options=a};Kb.prototype={constructor:Kb,lex:function(a){this.text=a;this.index=0;this.ch=r;this.lastCh=":";this.tokens=[];var c;for(a=[];this.index<this.text.length;){this.ch=
this.text.charAt(this.index);if(this.is("\"'"))this.readString(this.ch);else if(this.isNumber(this.ch)||this.is(".")&&this.isNumber(this.peek()))this.readNumber();else if(this.isIdent(this.ch))this.readIdent(),this.was("{,")&&("{"===a[0]&&(c=this.tokens[this.tokens.length-1]))&&(c.json=-1===c.text.indexOf("."));else if(this.is("(){}[].,;:?"))this.tokens.push({index:this.index,text:this.ch,json:this.was(":[,")&&this.is("{[")||this.is("}]:,")}),this.is("{[")&&a.unshift(this.ch),this.is("}]")&&a.shift(),
this.index++;else if(this.isWhitespace(this.ch)){this.index++;continue}else{var d=this.ch+this.peek(),e=d+this.peek(2),g=Ka[this.ch],f=Ka[d],h=Ka[e];h?(this.tokens.push({index:this.index,text:e,fn:h}),this.index+=3):f?(this.tokens.push({index:this.index,text:d,fn:f}),this.index+=2):g?(this.tokens.push({index:this.index,text:this.ch,fn:g,json:this.was("[,:")&&this.is("+-")}),this.index+=1):this.throwError("Unexpected next character ",this.index,this.index+1)}this.lastCh=this.ch}return this.tokens},
is:function(a){return-1!==a.indexOf(this.ch)},was:function(a){return-1!==a.indexOf(this.lastCh)},peek:function(a){a=a||1;return this.index+a<this.text.length?this.text.charAt(this.index+a):!1},isNumber:function(a){return"0"<=a&&"9">=a},isWhitespace:function(a){return" "===a||"\r"===a||"\t"===a||"\n"===a||"\v"===a||"\u00a0"===a},isIdent:function(a){return"a"<=a&&"z">=a||"A"<=a&&"Z">=a||"_"===a||"$"===a},isExpOperator:function(a){return"-"===a||"+"===a||this.isNumber(a)},throwError:function(a,c,d){d=
d||this.index;c=z(c)?"s "+c+"-"+this.index+" ["+this.text.substring(c,d)+"]":" "+d;throw za("lexerr",a,c,this.text);},readNumber:function(){for(var a="",c=this.index;this.index<this.text.length;){var d=v(this.text.charAt(this.index));if("."==d||this.isNumber(d))a+=d;else{var e=this.peek();if("e"==d&&this.isExpOperator(e))a+=d;else if(this.isExpOperator(d)&&e&&this.isNumber(e)&&"e"==a.charAt(a.length-1))a+=d;else if(!this.isExpOperator(d)||e&&this.isNumber(e)||"e"!=a.charAt(a.length-1))break;else this.throwError("Invalid exponent")}this.index++}a*=
1;this.tokens.push({index:c,text:a,json:!0,fn:function(){return a}})},readIdent:function(){for(var a=this,c="",d=this.index,e,g,f,h;this.index<this.text.length;){h=this.text.charAt(this.index);if("."===h||this.isIdent(h)||this.isNumber(h))"."===h&&(e=this.index),c+=h;else break;this.index++}if(e)for(g=this.index;g<this.text.length;){h=this.text.charAt(g);if("("===h){f=c.substr(e-d+1);c=c.substr(0,e-d);this.index=g;break}if(this.isWhitespace(h))g++;else break}d={index:d,text:c};if(Ka.hasOwnProperty(c))d.fn=
Ka[c],d.json=Ka[c];else{var l=vc(c,this.options,this.text);d.fn=w(function(a,c){return l(a,c)},{assign:function(d,e){return ib(d,c,e,a.text,a.options)}})}this.tokens.push(d);f&&(this.tokens.push({index:e,text:".",json:!1}),this.tokens.push({index:e+1,text:f,json:!1}))},readString:function(a){var c=this.index;this.index++;for(var d="",e=a,g=!1;this.index<this.text.length;){var f=this.text.charAt(this.index),e=e+f;if(g)"u"===f?(f=this.text.substring(this.index+1,this.index+5),f.match(/[\da-f]{4}/i)||
this.throwError("Invalid unicode escape [\\u"+f+"]"),this.index+=4,d+=String.fromCharCode(parseInt(f,16))):d=(g=Ud[f])?d+g:d+f,g=!1;else if("\\"===f)g=!0;else{if(f===a){this.index++;this.tokens.push({index:c,text:e,string:d,json:!0,fn:function(){return d}});return}d+=f}this.index++}this.throwError("Unterminated quote",c)}};var Ya=function(a,c,d){this.lexer=a;this.$filter=c;this.options=d};Ya.ZERO=function(){return 0};Ya.prototype={constructor:Ya,parse:function(a,c){this.text=a;this.json=c;this.tokens=
this.lexer.lex(a);c&&(this.assignment=this.logicalOR,this.functionCall=this.fieldAccess=this.objectIndex=this.filterChain=function(){this.throwError("is not valid json",{text:a,index:0})});var d=c?this.primary():this.statements();0!==this.tokens.length&&this.throwError("is an unexpected token",this.tokens[0]);d.literal=!!d.literal;d.constant=!!d.constant;return d},primary:function(){var a;if(this.expect("("))a=this.filterChain(),this.consume(")");else if(this.expect("["))a=this.arrayDeclaration();
else if(this.expect("{"))a=this.object();else{var c=this.expect();(a=c.fn)||this.throwError("not a primary expression",c);c.json&&(a.constant=!0,a.literal=!0)}for(var d;c=this.expect("(","[",".");)"("===c.text?(a=this.functionCall(a,d),d=null):"["===c.text?(d=a,a=this.objectIndex(a)):"."===c.text?(d=a,a=this.fieldAccess(a)):this.throwError("IMPOSSIBLE");return a},throwError:function(a,c){throw za("syntax",c.text,a,c.index+1,this.text,this.text.substring(c.index));},peekToken:function(){if(0===this.tokens.length)throw za("ueoe",
this.text);return this.tokens[0]},peek:function(a,c,d,e){if(0<this.tokens.length){var g=this.tokens[0],f=g.text;if(f===a||f===c||f===d||f===e||!(a||c||d||e))return g}return!1},expect:function(a,c,d,e){return(a=this.peek(a,c,d,e))?(this.json&&!a.json&&this.throwError("is not valid json",a),this.tokens.shift(),a):!1},consume:function(a){this.expect(a)||this.throwError("is unexpected, expecting ["+a+"]",this.peek())},unaryFn:function(a,c){return w(function(d,e){return a(d,e,c)},{constant:c.constant})},
ternaryFn:function(a,c,d){return w(function(e,g){return a(e,g)?c(e,g):d(e,g)},{constant:a.constant&&c.constant&&d.constant})},binaryFn:function(a,c,d){return w(function(e,g){return c(e,g,a,d)},{constant:a.constant&&d.constant})},statements:function(){for(var a=[];;)if(0<this.tokens.length&&!this.peek("}",")",";","]")&&a.push(this.filterChain()),!this.expect(";"))return 1===a.length?a[0]:function(c,d){for(var e,g=0;g<a.length;g++){var f=a[g];f&&(e=f(c,d))}return e}},filterChain:function(){for(var a=
this.expression(),c;;)if(c=this.expect("|"))a=this.binaryFn(a,c.fn,this.filter());else return a},filter:function(){for(var a=this.expect(),c=this.$filter(a.text),d=[];;)if(a=this.expect(":"))d.push(this.expression());else{var e=function(a,e,h){h=[h];for(var l=0;l<d.length;l++)h.push(d[l](a,e));return c.apply(a,h)};return function(){return e}}},expression:function(){return this.assignment()},assignment:function(){var a=this.ternary(),c,d;return(d=this.expect("="))?(a.assign||this.throwError("implies assignment but ["+
this.text.substring(0,d.index)+"] can not be assigned to",d),c=this.ternary(),function(d,g){return a.assign(d,c(d,g),g)}):a},ternary:function(){var a=this.logicalOR(),c,d;if(this.expect("?")){c=this.ternary();if(d=this.expect(":"))return this.ternaryFn(a,c,this.ternary());this.throwError("expected :",d)}else return a},logicalOR:function(){for(var a=this.logicalAND(),c;;)if(c=this.expect("||"))a=this.binaryFn(a,c.fn,this.logicalAND());else return a},logicalAND:function(){var a=this.equality(),c;if(c=
this.expect("&&"))a=this.binaryFn(a,c.fn,this.logicalAND());return a},equality:function(){var a=this.relational(),c;if(c=this.expect("==","!=","===","!=="))a=this.binaryFn(a,c.fn,this.equality());return a},relational:function(){var a=this.additive(),c;if(c=this.expect("<",">","<=",">="))a=this.binaryFn(a,c.fn,this.relational());return a},additive:function(){for(var a=this.multiplicative(),c;c=this.expect("+","-");)a=this.binaryFn(a,c.fn,this.multiplicative());return a},multiplicative:function(){for(var a=
this.unary(),c;c=this.expect("*","/","%");)a=this.binaryFn(a,c.fn,this.unary());return a},unary:function(){var a;return this.expect("+")?this.primary():(a=this.expect("-"))?this.binaryFn(Ya.ZERO,a.fn,this.unary()):(a=this.expect("!"))?this.unaryFn(a.fn,this.unary()):this.primary()},fieldAccess:function(a){var c=this,d=this.expect().text,e=vc(d,this.options,this.text);return w(function(c,d,h){return e(h||a(c,d),d)},{assign:function(e,f,h){return ib(a(e,h),d,f,c.text,c.options)}})},objectIndex:function(a){var c=
this,d=this.expression();this.consume("]");return w(function(e,g){var f=a(e,g),h=d(e,g),l;if(!f)return r;(f=Xa(f[h],c.text))&&(f.then&&c.options.unwrapPromises)&&(l=f,"$$v"in f||(l.$$v=r,l.then(function(a){l.$$v=a})),f=f.$$v);return f},{assign:function(e,g,f){var h=d(e,f);return Xa(a(e,f),c.text)[h]=g}})},functionCall:function(a,c){var d=[];if(")"!==this.peekToken().text){do d.push(this.expression());while(this.expect(","))}this.consume(")");var e=this;return function(g,f){for(var h=[],l=c?c(g,f):
g,k=0;k<d.length;k++)h.push(d[k](g,f));k=a(g,f,l)||s;Xa(l,e.text);Xa(k,e.text);h=k.apply?k.apply(l,h):k(h[0],h[1],h[2],h[3],h[4]);return Xa(h,e.text)}},arrayDeclaration:function(){var a=[],c=!0;if("]"!==this.peekToken().text){do{var d=this.expression();a.push(d);d.constant||(c=!1)}while(this.expect(","))}this.consume("]");return w(function(c,d){for(var f=[],h=0;h<a.length;h++)f.push(a[h](c,d));return f},{literal:!0,constant:c})},object:function(){var a=[],c=!0;if("}"!==this.peekToken().text){do{var d=
this.expect(),d=d.string||d.text;this.consume(":");var e=this.expression();a.push({key:d,value:e});e.constant||(c=!1)}while(this.expect(","))}this.consume("}");return w(function(c,d){for(var e={},l=0;l<a.length;l++){var k=a[l];e[k.key]=k.value(c,d)}return e},{literal:!0,constant:c})}};var Jb={},ra=G("$sce"),fa={HTML:"html",CSS:"css",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"},T=N.createElement("a"),yc=ya(W.location.href,!0);zc.$inject=["$provide"];Ac.$inject=["$locale"];Cc.$inject=["$locale"];var Fc=
".",Od={yyyy:V("FullYear",4),yy:V("FullYear",2,0,!0),y:V("FullYear",1),MMMM:jb("Month"),MMM:jb("Month",!0),MM:V("Month",2,1),M:V("Month",1,1),dd:V("Date",2),d:V("Date",1),HH:V("Hours",2),H:V("Hours",1),hh:V("Hours",2,-12),h:V("Hours",1,-12),mm:V("Minutes",2),m:V("Minutes",1),ss:V("Seconds",2),s:V("Seconds",1),sss:V("Milliseconds",3),EEEE:jb("Day"),EEE:jb("Day",!0),a:function(a,c){return 12>a.getHours()?c.AMPMS[0]:c.AMPMS[1]},Z:function(a){a=-1*a.getTimezoneOffset();return a=(0<=a?"+":"")+(Lb(Math[0<
a?"floor":"ceil"](a/60),2)+Lb(Math.abs(a%60),2))}},Nd=/((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,Md=/^\-?\d+$/;Bc.$inject=["$locale"];var Kd=ca(v),Ld=ca(Ia);Dc.$inject=["$parse"];var Vd=ca({restrict:"E",compile:function(a,c){8>=E&&(c.href||c.name||c.$set("href",""),a.append(N.createComment("IE fix")));if(!c.href&&!c.name)return function(a,c){c.on("click",function(a){c.attr("href")||a.preventDefault()})}}}),Nb={};q(fb,function(a,c){if("multiple"!=a){var d=ma("ng-"+
c);Nb[d]=function(){return{priority:100,compile:function(){return function(a,g,f){a.$watch(f[d],function(a){f.$set(c,!!a)})}}}}}});q(["src","srcset","href"],function(a){var c=ma("ng-"+a);Nb[c]=function(){return{priority:99,link:function(d,e,g){g.$observe(c,function(c){c&&(g.$set(a,c),E&&e.prop(a,g[a]))})}}}});var mb={$addControl:s,$removeControl:s,$setValidity:s,$setDirty:s,$setPristine:s};Gc.$inject=["$element","$attrs","$scope"];var Ic=function(a){return["$timeout",function(c){return{name:"form",
restrict:a?"EAC":"E",controller:Gc,compile:function(){return{pre:function(a,e,g,f){if(!g.action){var h=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1};Hc(e[0],"submit",h);e.on("$destroy",function(){c(function(){Ab(e[0],"submit",h)},0,!1)})}var l=e.parent().controller("form"),k=g.name||g.ngForm;k&&ib(a,k,f,k);if(l)e.on("$destroy",function(){l.$removeControl(f);k&&ib(a,k,r,k);w(f,mb)})}}}}}]},Wd=Ic(),Xd=Ic(!0),Yd=/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/,
Zd=/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}$/,$d=/^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/,Jc={text:ob,number:function(a,c,d,e,g,f){ob(a,c,d,e,g,f);e.$parsers.push(function(a){var c=e.$isEmpty(a);if(c||$d.test(a))return e.$setValidity("number",!0),""===a?null:c?a:parseFloat(a);e.$setValidity("number",!1);return r});e.$formatters.push(function(a){return e.$isEmpty(a)?"":""+a});d.min&&(a=function(a){var c=parseFloat(d.min);if(!e.$isEmpty(a)&&a<c)return e.$setValidity("min",!1),r;e.$setValidity("min",
!0);return a},e.$parsers.push(a),e.$formatters.push(a));d.max&&(a=function(a){var c=parseFloat(d.max);if(!e.$isEmpty(a)&&a>c)return e.$setValidity("max",!1),r;e.$setValidity("max",!0);return a},e.$parsers.push(a),e.$formatters.push(a));e.$formatters.push(function(a){if(e.$isEmpty(a)||qb(a))return e.$setValidity("number",!0),a;e.$setValidity("number",!1);return r})},url:function(a,c,d,e,g,f){ob(a,c,d,e,g,f);a=function(a){if(e.$isEmpty(a)||Yd.test(a))return e.$setValidity("url",!0),a;e.$setValidity("url",
!1);return r};e.$formatters.push(a);e.$parsers.push(a)},email:function(a,c,d,e,g,f){ob(a,c,d,e,g,f);a=function(a){if(e.$isEmpty(a)||Zd.test(a))return e.$setValidity("email",!0),a;e.$setValidity("email",!1);return r};e.$formatters.push(a);e.$parsers.push(a)},radio:function(a,c,d,e){H(d.name)&&c.attr("name",Za());c.on("click",function(){c[0].checked&&a.$apply(function(){e.$setViewValue(d.value)})});e.$render=function(){c[0].checked=d.value==e.$viewValue};d.$observe("value",e.$render)},checkbox:function(a,
c,d,e){var g=d.ngTrueValue,f=d.ngFalseValue;D(g)||(g=!0);D(f)||(f=!1);c.on("click",function(){a.$apply(function(){e.$setViewValue(c[0].checked)})});e.$render=function(){c[0].checked=e.$viewValue};e.$isEmpty=function(a){return a!==g};e.$formatters.push(function(a){return a===g});e.$parsers.push(function(a){return a?g:f})},hidden:s,button:s,submit:s,reset:s},Kc=["$browser","$sniffer",function(a,c){return{restrict:"E",require:"?ngModel",link:function(d,e,g,f){f&&(Jc[v(g.type)]||Jc.text)(d,e,g,f,c,a)}}}],
lb="ng-valid",kb="ng-invalid",Ja="ng-pristine",nb="ng-dirty",ae=["$scope","$exceptionHandler","$attrs","$element","$parse",function(a,c,d,e,g){function f(a,c){c=c?"-"+cb(c,"-"):"";e.removeClass((a?kb:lb)+c).addClass((a?lb:kb)+c)}this.$modelValue=this.$viewValue=Number.NaN;this.$parsers=[];this.$formatters=[];this.$viewChangeListeners=[];this.$pristine=!0;this.$dirty=!1;this.$valid=!0;this.$invalid=!1;this.$name=d.name;var h=g(d.ngModel),l=h.assign;if(!l)throw G("ngModel")("nonassign",d.ngModel,ha(e));
this.$render=s;this.$isEmpty=function(a){return H(a)||""===a||null===a||a!==a};var k=e.inheritedData("$formController")||mb,m=0,n=this.$error={};e.addClass(Ja);f(!0);this.$setValidity=function(a,c){n[a]!==!c&&(c?(n[a]&&m--,m||(f(!0),this.$valid=!0,this.$invalid=!1)):(f(!1),this.$invalid=!0,this.$valid=!1,m++),n[a]=!c,f(c,a),k.$setValidity(a,c,this))};this.$setPristine=function(){this.$dirty=!1;this.$pristine=!0;e.removeClass(nb).addClass(Ja)};this.$setViewValue=function(d){this.$viewValue=d;this.$pristine&&
(this.$dirty=!0,this.$pristine=!1,e.removeClass(Ja).addClass(nb),k.$setDirty());q(this.$parsers,function(a){d=a(d)});this.$modelValue!==d&&(this.$modelValue=d,l(a,d),q(this.$viewChangeListeners,function(a){try{a()}catch(d){c(d)}}))};var p=this;a.$watch(function(){var c=h(a);if(p.$modelValue!==c){var d=p.$formatters,e=d.length;for(p.$modelValue=c;e--;)c=d[e](c);p.$viewValue!==c&&(p.$viewValue=c,p.$render())}return c})}],be=function(){return{require:["ngModel","^?form"],controller:ae,link:function(a,
c,d,e){var g=e[0],f=e[1]||mb;f.$addControl(g);a.$on("$destroy",function(){f.$removeControl(g)})}}},ce=ca({require:"ngModel",link:function(a,c,d,e){e.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),Lc=function(){return{require:"?ngModel",link:function(a,c,d,e){if(e){d.required=!0;var g=function(a){if(d.required&&e.$isEmpty(a))e.$setValidity("required",!1);else return e.$setValidity("required",!0),a};e.$formatters.push(g);e.$parsers.unshift(g);d.$observe("required",function(){g(e.$viewValue)})}}}},
de=function(){return{require:"ngModel",link:function(a,c,d,e){var g=(a=/\/(.*)\//.exec(d.ngList))&&RegExp(a[1])||d.ngList||",";e.$parsers.push(function(a){if(!H(a)){var c=[];a&&q(a.split(g),function(a){a&&c.push(aa(a))});return c}});e.$formatters.push(function(a){return L(a)?a.join(", "):r});e.$isEmpty=function(a){return!a||!a.length}}}},ee=/^(true|false|\d+)$/,fe=function(){return{priority:100,compile:function(a,c){return ee.test(c.ngValue)?function(a,c,g){g.$set("value",a.$eval(g.ngValue))}:function(a,
c,g){a.$watch(g.ngValue,function(a){g.$set("value",a)})}}}},ge=sa(function(a,c,d){c.addClass("ng-binding").data("$binding",d.ngBind);a.$watch(d.ngBind,function(a){c.text(a==r?"":a)})}),he=["$interpolate",function(a){return function(c,d,e){c=a(d.attr(e.$attr.ngBindTemplate));d.addClass("ng-binding").data("$binding",c);e.$observe("ngBindTemplate",function(a){d.text(a)})}}],ie=["$sce","$parse",function(a,c){return function(d,e,g){e.addClass("ng-binding").data("$binding",g.ngBindHtml);var f=c(g.ngBindHtml);
d.$watch(function(){return(f(d)||"").toString()},function(c){e.html(a.getTrustedHtml(f(d))||"")})}}],je=Mb("",!0),ke=Mb("Odd",0),le=Mb("Even",1),me=sa({compile:function(a,c){c.$set("ngCloak",r);a.removeClass("ng-cloak")}}),ne=[function(){return{scope:!0,controller:"@",priority:500}}],Mc={};q("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "),function(a){var c=ma("ng-"+a);Mc[c]=["$parse",function(d){return{compile:function(e,
g){var f=d(g[c]);return function(c,d,e){d.on(v(a),function(a){c.$apply(function(){f(c,{$event:a})})})}}}}]});var oe=["$animate",function(a){return{transclude:"element",priority:600,terminal:!0,restrict:"A",$$tlb:!0,link:function(c,d,e,g,f){var h,l;c.$watch(e.ngIf,function(g){Oa(g)?l||(l=c.$new(),f(l,function(c){c[c.length++]=N.createComment(" end ngIf: "+e.ngIf+" ");h={clone:c};a.enter(c,d.parent(),d)})):(l&&(l.$destroy(),l=null),h&&(a.leave(vb(h.clone)),h=null))})}}}],pe=["$http","$templateCache",
"$anchorScroll","$animate","$sce",function(a,c,d,e,g){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:Pa.noop,compile:function(f,h){var l=h.ngInclude||h.src,k=h.onload||"",m=h.autoscroll;return function(f,h,q,r,B){var s=0,u,v,x=function(){u&&(u.$destroy(),u=null);v&&(e.leave(v),v=null)};f.$watch(g.parseAsResourceUrl(l),function(g){var l=function(){!z(m)||m&&!f.$eval(m)||d()},q=++s;g?(a.get(g,{cache:c}).success(function(a){if(q===s){var c=f.$new();r.template=a;a=B(c,
function(a){x();e.enter(a,null,h,l)});u=c;v=a;u.$emit("$includeContentLoaded");f.$eval(k)}}).error(function(){q===s&&x()}),f.$emit("$includeContentRequested")):(x(),r.template=null)})}}}}],qe=["$compile",function(a){return{restrict:"ECA",priority:-400,require:"ngInclude",link:function(c,d,e,g){d.html(g.template);a(d.contents())(c)}}}],re=sa({priority:450,compile:function(){return{pre:function(a,c,d){a.$eval(d.ngInit)}}}}),se=sa({terminal:!0,priority:1E3}),te=["$locale","$interpolate",function(a,c){var d=
/{}/g;return{restrict:"EA",link:function(e,g,f){var h=f.count,l=f.$attr.when&&g.attr(f.$attr.when),k=f.offset||0,m=e.$eval(l)||{},n={},p=c.startSymbol(),t=c.endSymbol(),r=/^when(Minus)?(.+)$/;q(f,function(a,c){r.test(c)&&(m[v(c.replace("when","").replace("Minus","-"))]=g.attr(f.$attr[c]))});q(m,function(a,e){n[e]=c(a.replace(d,p+h+"-"+k+t))});e.$watch(function(){var c=parseFloat(e.$eval(h));if(isNaN(c))return"";c in m||(c=a.pluralCat(c-k));return n[c](e,g,!0)},function(a){g.text(a)})}}}],ue=["$parse",
"$animate",function(a,c){var d=G("ngRepeat");return{transclude:"element",priority:1E3,terminal:!0,$$tlb:!0,link:function(e,g,f,h,l){var k=f.ngRepeat,m=k.match(/^\s*(.+)\s+in\s+(.*?)\s*(\s+track\s+by\s+(.+)\s*)?$/),n,p,t,r,s,v,u={$id:Ea};if(!m)throw d("iexp",k);f=m[1];h=m[2];(m=m[4])?(n=a(m),p=function(a,c,d){v&&(u[v]=a);u[s]=c;u.$index=d;return n(e,u)}):(t=function(a,c){return Ea(c)},r=function(a){return a});m=f.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/);if(!m)throw d("iidexp",f);s=m[3]||
m[1];v=m[2];var z={};e.$watchCollection(h,function(a){var f,h,m=g[0],n,u={},H,O,M,S,D,w,G=[];if(pb(a))D=a,n=p||t;else{n=p||r;D=[];for(M in a)a.hasOwnProperty(M)&&"$"!=M.charAt(0)&&D.push(M);D.sort()}H=D.length;h=G.length=D.length;for(f=0;f<h;f++)if(M=a===D?f:D[f],S=a[M],S=n(M,S,f),wa(S,"`track by` id"),z.hasOwnProperty(S))w=z[S],delete z[S],u[S]=w,G[f]=w;else{if(u.hasOwnProperty(S))throw q(G,function(a){a&&a.scope&&(z[a.id]=a)}),d("dupes",k,S);G[f]={id:S};u[S]=!1}for(M in z)z.hasOwnProperty(M)&&(w=
z[M],f=vb(w.clone),c.leave(f),q(f,function(a){a.$$NG_REMOVED=!0}),w.scope.$destroy());f=0;for(h=D.length;f<h;f++){M=a===D?f:D[f];S=a[M];w=G[f];G[f-1]&&(m=G[f-1].clone[G[f-1].clone.length-1]);if(w.scope){O=w.scope;n=m;do n=n.nextSibling;while(n&&n.$$NG_REMOVED);w.clone[0]!=n&&c.move(vb(w.clone),null,x(m));m=w.clone[w.clone.length-1]}else O=e.$new();O[s]=S;v&&(O[v]=M);O.$index=f;O.$first=0===f;O.$last=f===H-1;O.$middle=!(O.$first||O.$last);O.$odd=!(O.$even=0===(f&1));w.scope||l(O,function(a){a[a.length++]=
N.createComment(" end ngRepeat: "+k+" ");c.enter(a,null,x(m));m=a;w.scope=O;w.clone=a;u[w.id]=w})}z=u})}}}],ve=["$animate",function(a){return function(c,d,e){c.$watch(e.ngShow,function(c){a[Oa(c)?"removeClass":"addClass"](d,"ng-hide")})}}],we=["$animate",function(a){return function(c,d,e){c.$watch(e.ngHide,function(c){a[Oa(c)?"addClass":"removeClass"](d,"ng-hide")})}}],xe=sa(function(a,c,d){a.$watch(d.ngStyle,function(a,d){d&&a!==d&&q(d,function(a,d){c.css(d,"")});a&&c.css(a)},!0)}),ye=["$animate",
function(a){return{restrict:"EA",require:"ngSwitch",controller:["$scope",function(){this.cases={}}],link:function(c,d,e,g){var f,h,l=[];c.$watch(e.ngSwitch||e.on,function(d){for(var m=0,n=l.length;m<n;m++)l[m].$destroy(),a.leave(h[m]);h=[];l=[];if(f=g.cases["!"+d]||g.cases["?"])c.$eval(e.change),q(f,function(d){var e=c.$new();l.push(e);d.transclude(e,function(c){var e=d.element;h.push(c);a.enter(c,e.parent(),e)})})})}}}],ze=sa({transclude:"element",priority:800,require:"^ngSwitch",compile:function(a,
c){return function(a,e,g,f,h){f.cases["!"+c.ngSwitchWhen]=f.cases["!"+c.ngSwitchWhen]||[];f.cases["!"+c.ngSwitchWhen].push({transclude:h,element:e})}}}),Ae=sa({transclude:"element",priority:800,require:"^ngSwitch",link:function(a,c,d,e,g){e.cases["?"]=e.cases["?"]||[];e.cases["?"].push({transclude:g,element:c})}}),Be=sa({controller:["$element","$transclude",function(a,c){if(!c)throw G("ngTransclude")("orphan",ha(a));this.$transclude=c}],link:function(a,c,d,e){e.$transclude(function(a){c.empty();c.append(a)})}}),
Ce=["$templateCache",function(a){return{restrict:"E",terminal:!0,compile:function(c,d){"text/ng-template"==d.type&&a.put(d.id,c[0].text)}}}],De=G("ngOptions"),Ee=ca({terminal:!0}),Fe=["$compile","$parse",function(a,c){var d=/^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+(.*?)(?:\s+track\s+by\s+(.*?))?$/,e={$setViewValue:s};return{restrict:"E",require:["select","?ngModel"],controller:["$element","$scope",
"$attrs",function(a,c,d){var l=this,k={},m=e,n;l.databound=d.ngModel;l.init=function(a,c,d){m=a;n=d};l.addOption=function(c){wa(c,'"option value"');k[c]=!0;m.$viewValue==c&&(a.val(c),n.parent()&&n.remove())};l.removeOption=function(a){this.hasOption(a)&&(delete k[a],m.$viewValue==a&&this.renderUnknownOption(a))};l.renderUnknownOption=function(c){c="? "+Ea(c)+" ?";n.val(c);a.prepend(n);a.val(c);n.prop("selected",!0)};l.hasOption=function(a){return k.hasOwnProperty(a)};c.$on("$destroy",function(){l.renderUnknownOption=
s})}],link:function(e,f,h,l){function k(a,c,d,e){d.$render=function(){var a=d.$viewValue;e.hasOption(a)?(y.parent()&&y.remove(),c.val(a),""===a&&u.prop("selected",!0)):H(a)&&u?c.val(""):e.renderUnknownOption(a)};c.on("change",function(){a.$apply(function(){y.parent()&&y.remove();d.$setViewValue(c.val())})})}function m(a,c,d){var e;d.$render=function(){var a=new Ta(d.$viewValue);q(c.find("option"),function(c){c.selected=z(a.get(c.value))})};a.$watch(function(){ta(e,d.$viewValue)||(e=ga(d.$viewValue),
d.$render())});c.on("change",function(){a.$apply(function(){var a=[];q(c.find("option"),function(c){c.selected&&a.push(c.value)});d.$setViewValue(a)})})}function n(e,f,g){function h(){var a={"":[]},c=[""],d,k,r,s,x;s=g.$modelValue;x=t(e)||[];var B=n?Ob(x):x,H,A,J;A={};r=!1;var E,I;if(v)if(u&&L(s))for(r=new Ta([]),J=0;J<s.length;J++)A[m]=s[J],r.put(u(e,A),s[J]);else r=new Ta(s);for(J=0;H=B.length,J<H;J++){k=J;if(n){k=B[J];if("$"===k.charAt(0))continue;A[n]=k}A[m]=x[k];d=p(e,A)||"";(k=a[d])||(k=a[d]=
[],c.push(d));v?d=z(r.remove(u?u(e,A):q(e,A))):(u?(d={},d[m]=s,d=u(e,d)===u(e,A)):d=s===q(e,A),r=r||d);E=l(e,A);E=z(E)?E:"";k.push({id:u?u(e,A):n?B[J]:J,label:E,selected:d})}v||(w||null===s?a[""].unshift({id:"",label:"",selected:!r}):r||a[""].unshift({id:"?",label:"",selected:!0}));A=0;for(B=c.length;A<B;A++){d=c[A];k=a[d];y.length<=A?(s={element:G.clone().attr("label",d),label:k.label},x=[s],y.push(x),f.append(s.element)):(x=y[A],s=x[0],s.label!=d&&s.element.attr("label",s.label=d));E=null;J=0;for(H=
k.length;J<H;J++)r=k[J],(d=x[J+1])?(E=d.element,d.label!==r.label&&E.text(d.label=r.label),d.id!==r.id&&E.val(d.id=r.id),E[0].selected!==r.selected&&E.prop("selected",d.selected=r.selected)):(""===r.id&&w?I=w:(I=D.clone()).val(r.id).attr("selected",r.selected).text(r.label),x.push({element:I,label:r.label,id:r.id,selected:r.selected}),E?E.after(I):s.element.append(I),E=I);for(J++;x.length>J;)x.pop().element.remove()}for(;y.length>A;)y.pop()[0].element.remove()}var k;if(!(k=s.match(d)))throw De("iexp",
s,ha(f));var l=c(k[2]||k[1]),m=k[4]||k[6],n=k[5],p=c(k[3]||""),q=c(k[2]?k[1]:m),t=c(k[7]),u=k[8]?c(k[8]):null,y=[[{element:f,label:""}]];w&&(a(w)(e),w.removeClass("ng-scope"),w.remove());f.empty();f.on("change",function(){e.$apply(function(){var a,c=t(e)||[],d={},h,k,l,p,s,x,w;if(v)for(k=[],p=0,x=y.length;p<x;p++)for(a=y[p],l=1,s=a.length;l<s;l++){if((h=a[l].element)[0].selected){h=h.val();n&&(d[n]=h);if(u)for(w=0;w<c.length&&(d[m]=c[w],u(e,d)!=h);w++);else d[m]=c[h];k.push(q(e,d))}}else if(h=f.val(),
"?"==h)k=r;else if(""===h)k=null;else if(u)for(w=0;w<c.length;w++){if(d[m]=c[w],u(e,d)==h){k=q(e,d);break}}else d[m]=c[h],n&&(d[n]=h),k=q(e,d);g.$setViewValue(k)})});g.$render=h;e.$watch(h)}if(l[1]){var p=l[0],t=l[1],v=h.multiple,s=h.ngOptions,w=!1,u,D=x(N.createElement("option")),G=x(N.createElement("optgroup")),y=D.clone();l=0;for(var A=f.children(),I=A.length;l<I;l++)if(""===A[l].value){u=w=A.eq(l);break}p.init(t,w,y);if(v&&(h.required||h.ngRequired)){var E=function(a){t.$setValidity("required",
!h.required||a&&a.length);return a};t.$parsers.push(E);t.$formatters.unshift(E);h.$observe("required",function(){E(t.$viewValue)})}s?n(e,f,t):v?m(e,f,t):k(e,f,t,p)}}}}],Ge=["$interpolate",function(a){var c={addOption:s,removeOption:s};return{restrict:"E",priority:100,compile:function(d,e){if(H(e.value)){var g=a(d.text(),!0);g||e.$set("value",d.text())}return function(a,d,e){var k=d.parent(),m=k.data("$selectController")||k.parent().data("$selectController");m&&m.databound?d.prop("selected",!1):m=
c;g?a.$watch(g,function(a,c){e.$set("value",a);a!==c&&m.removeOption(c);m.addOption(a)}):m.addOption(e.value);d.on("$destroy",function(){m.removeOption(e.value)})}}}}],He=ca({restrict:"E",terminal:!0});(Ca=W.jQuery)?(x=Ca,w(Ca.fn,{scope:Fa.scope,isolateScope:Fa.isolateScope,controller:Fa.controller,injector:Fa.injector,inheritedData:Fa.inheritedData}),wb("remove",!0,!0,!1),wb("empty",!1,!1,!1),wb("html",!1,!1,!0)):x=I;Pa.element=x;(function(a){w(a,{bootstrap:Xb,copy:ga,extend:w,equals:ta,element:x,
forEach:q,injector:Yb,noop:s,bind:rb,toJson:oa,fromJson:Tb,identity:Ba,isUndefined:H,isDefined:z,isString:D,isFunction:A,isObject:U,isNumber:qb,isElement:Oc,isArray:L,version:Qd,isDate:La,lowercase:v,uppercase:Ia,callbacks:{counter:0},$$minErr:G,$$csp:Sb});Va=Uc(W);try{Va("ngLocale")}catch(c){Va("ngLocale",[]).provider("$locale",sd)}Va("ng",["ngLocale"],["$provide",function(a){a.provider({$$sanitizeUri:Ad});a.provider("$compile",hc).directive({a:Vd,input:Kc,textarea:Kc,form:Wd,script:Ce,select:Fe,
style:He,option:Ge,ngBind:ge,ngBindHtml:ie,ngBindTemplate:he,ngClass:je,ngClassEven:le,ngClassOdd:ke,ngCloak:me,ngController:ne,ngForm:Xd,ngHide:we,ngIf:oe,ngInclude:pe,ngInit:re,ngNonBindable:se,ngPluralize:te,ngRepeat:ue,ngShow:ve,ngStyle:xe,ngSwitch:ye,ngSwitchWhen:ze,ngSwitchDefault:Ae,ngOptions:Ee,ngTransclude:Be,ngModel:be,ngList:de,ngChange:ce,required:Lc,ngRequired:Lc,ngValue:fe}).directive({ngInclude:qe}).directive(Nb).directive(Mc);a.provider({$anchorScroll:cd,$animate:Sd,$browser:ed,$cacheFactory:fd,
$controller:jd,$document:kd,$exceptionHandler:ld,$filter:zc,$interpolate:qd,$interval:rd,$http:md,$httpBackend:nd,$location:ud,$log:vd,$parse:wd,$rootScope:zd,$q:xd,$sce:Dd,$sceDelegate:Cd,$sniffer:Ed,$templateCache:gd,$timeout:Fd,$window:Gd})}])})(Pa);x(N).ready(function(){Sc(N,Xb)})})(window,document);!angular.$$csp()&&angular.element(document).find("head").prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide{display:none !important;}ng\\:form{display:block;}.ng-animate-start{border-spacing:1px 1px;-ms-zoom:1.0001;}.ng-animate-active{border-spacing:0px 0px;-ms-zoom:1;}</style>');
//# sourceMappingURL=angular.min.js.map | 496.248756 | 668 | 0.632948 |
c87859b3e8ec67b768883278c9da82821b92bd08 | 604 | js | JavaScript | src/__tests__/reducer.test.js | lnked/CMS | 96ea776b8a5509f95f14d68516de5cf7f7f1e60a | [
"BSD-3-Clause"
] | 1 | 2021-03-18T11:17:06.000Z | 2021-03-18T11:17:06.000Z | src/__tests__/reducer.test.js | lnked/CMS | 96ea776b8a5509f95f14d68516de5cf7f7f1e60a | [
"BSD-3-Clause"
] | 2 | 2020-09-04T02:11:05.000Z | 2021-01-06T08:13:21.000Z | src/__tests__/reducer.test.js | lnked/CMS | 96ea776b8a5509f95f14d68516de5cf7f7f1e60a | [
"BSD-3-Clause"
] | null | null | null | test('test', () => { })
// // src/reducers/__tests__/index_spec.tsx
// import reducers, {
// initialState,
// } from '../index'
// import {
// incrementCounter
// } from '../../actions'
// const resultOf = actions =>
// actions.reduce(reducers, initialState)
// describe('reducers/counter', () => {
// it('starts at 0', () =>
// expect(resultOf([])).toMatchSnapshot())
// it('increments to 6', () =>
// expect(resultOf([
// incrementCounter(1),
// incrementCounter(2),
// incrementCounter(3),
// ])).toMatchSnapshot())
// })
| 23.230769 | 48 | 0.529801 |
c878709616a7fa4c7a7a81929f51d5594befa636 | 12,048 | js | JavaScript | src/pages/Partners.js | artemiiberko/mini-admin | 81e7152d34c5e288bd161d5d8e576982208e60d3 | [
"MIT"
] | null | null | null | src/pages/Partners.js | artemiiberko/mini-admin | 81e7152d34c5e288bd161d5d8e576982208e60d3 | [
"MIT"
] | null | null | null | src/pages/Partners.js | artemiiberko/mini-admin | 81e7152d34c5e288bd161d5d8e576982208e60d3 | [
"MIT"
] | null | null | null | import { Link, Route, Routes } from 'react-router-dom';
import { filter } from 'lodash';
import { Icon } from '@iconify/react';
import { sentenceCase } from 'change-case';
import { useState } from 'react';
import plusFill from '@iconify/icons-eva/plus-fill';
// material
import {
Card,
Table,
Stack,
Button,
Checkbox,
TableRow,
TableBody,
TableCell,
Container,
Typography,
TableContainer,
TablePagination,
Select,
MenuItem
} from '@mui/material';
// components
import Page from '../components/Page';
import Label from '../components/Label';
import Scrollbar from '../components/Scrollbar';
import SearchNotFound from '../components/SearchNotFound';
import { UserListHead, UserListToolbar, UserMoreMenu } from '../components/_dashboard/user';
//
import PARTNERS from '../_mocks_/partners';
import AddPartner from './add/AddPartner';
import EditPage from './EditPage';
import ViewPage from './ViewPage';
// ----------------------------------------------------------------------
const TABLE_HEAD = [
{ id: 'id', label: 'ID', alignRight: false },
{ id: 'title', label: 'Title', alignRight: false },
{ id: 'logo', label: 'Logo', alignRight: false },
{ id: 'link', label: 'Link', alignRight: false },
{ id: 'status', label: 'Status', alignRight: false },
{ id: '' }
];
const statuslist = ['Active', 'Inactive'];
const editlist = {
text: [
{ name: 'Title', id: 'title' },
{ name: 'Link', id: 'link' }
],
select: [{ name: 'Status', id: 'status' }],
file: [{ name: 'Logo', id: 'logo' }],
date: [],
time: [],
datetime: [],
checkbox: [],
textmb: [],
selectmb: [],
filemb: [],
datemb: [],
timemb: [],
datetimemb: []
};
// ----------------------------------------------------------------------
function descendingComparator(a, b, orderBy) {
if (b[orderBy] < a[orderBy]) {
return -1;
}
if (b[orderBy] > a[orderBy]) {
return 1;
}
return 0;
}
function getComparator(order, orderBy) {
return order === 'desc'
? (a, b) => descendingComparator(a, b, orderBy)
: (a, b) => -descendingComparator(a, b, orderBy);
}
function applySortFilter(array, comparator, query, status) {
const stabilizedThis = array.map((el, index) => [el, index]);
stabilizedThis.sort((a, b) => {
const order = comparator(a[0], b[0]);
if (order !== 0) return order;
return a[1] - b[1];
});
if (query || status) {
return filter(
array,
(partners) =>
(partners.title.toLowerCase().indexOf(query.toLowerCase()) !== -1 ||
partners.link.toLowerCase().indexOf(query.toLowerCase()) !== -1 ||
partners.id.toString().indexOf(query.toLowerCase()) !== -1) &&
partners.status.indexOf(status) !== -1
);
}
return stabilizedThis.map((el) => el[0]);
}
export default function Partners() {
const [page, setPage] = useState(0);
const [order, setOrder] = useState('asc');
const [selected, setSelected] = useState([]);
const [orderBy, setOrderBy] = useState('id');
const [filter, setFilter] = useState('');
const [filterStatus, setFilterStatus] = useState('');
const [rowsPerPage, setRowsPerPage] = useState(5);
const [changePartners, setChangePartners] = useState(PARTNERS);
const [itemId, setItemId] = useState(0);
const [editviewRecord, setEditviewRecord] = useState({});
const getItem = (id) => {
setItemId(id);
setEditviewRecord(changePartners.find((x) => x.id === id));
};
const handleRequestSort = (event, property) => {
const isAsc = orderBy === property && order === 'asc';
setOrder(isAsc ? 'desc' : 'asc');
setOrderBy(property);
};
const handleSelectAllClick = (event) => {
if (event.target.checked) {
const newSelecteds = filteredPartners.map((n) => n.id);
setSelected(newSelecteds);
return;
}
setSelected([]);
};
const handleClick = (event, id) => {
const selectedIndex = selected.indexOf(id);
let newSelected = [];
if (selectedIndex === -1) {
newSelected = newSelected.concat(selected, id);
} else if (selectedIndex === 0) {
newSelected = newSelected.concat(selected.slice(1));
} else if (selectedIndex === selected.length - 1) {
newSelected = newSelected.concat(selected.slice(0, -1));
} else if (selectedIndex > 0) {
newSelected = newSelected.concat(
selected.slice(0, selectedIndex),
selected.slice(selectedIndex + 1)
);
}
setSelected(newSelected);
};
const handleChangePage = (event, newPage) => {
setPage(newPage);
};
const handleChangeRowsPerPage = (event) => {
setRowsPerPage(parseInt(event.target.value, 10));
setPage(0);
};
const handleFilter = (event) => {
setFilter(event.target.value);
};
const handleFilterStatus = (event) => {
setFilterStatus(event.target.value);
};
const emptyRows = page > 0 ? Math.max(0, (1 + page) * rowsPerPage - PARTNERS.length) : 0;
const filteredPartners = applySortFilter(
changePartners,
getComparator(order, orderBy),
filter,
filterStatus
);
const isPartnerNotFound = filteredPartners.length === 0;
const toggleStatus = (e) => {
const objIndex = changePartners.findIndex((x) => x.id === parseInt(e.target.id, 10));
const newArr = [...changePartners];
if (changePartners[objIndex].status === 'Active') {
newArr[objIndex].status = 'Inactive';
} else {
newArr[objIndex].status = 'Active';
}
setChangePartners(newArr);
};
return (
<Routes>
<Route
path=""
element={
<Page title="Partner">
<Container maxWidth="false">
<Stack direction="row" alignItems="center" justifyContent="space-between" mb={5}>
<Typography variant="h4" gutterBottom>
Partner
</Typography>
<Link to="./add">
<Button variant="contained" startIcon={<Icon icon={plusFill} />}>
New Partner
</Button>
</Link>
</Stack>
<Card>
<UserListToolbar
numSelected={selected.length}
filterName={filter}
onFilterName={handleFilter}
selectedItems={selected}
setSelectedItems={setSelected}
setChangeData={setChangePartners}
changeData={changePartners}
/>
<div className="filter">
<Stack sx={{ flexBasis: '25%', padding: '0px 10px' }}>
<Select
displayEmpty
size="small"
onChange={handleFilterStatus}
value={filterStatus}
style={{ margin: '5px' }}
>
<MenuItem key="status" value="" style={{ color: 'grey' }}>
All Status
</MenuItem>
{statuslist.map((status) => (
<MenuItem key={status} value={status}>
{status}
</MenuItem>
))}
</Select>
</Stack>
</div>
<Scrollbar>
<TableContainer sx={{ minWidth: 800 }}>
<Table>
<UserListHead
order={order}
orderBy={orderBy}
headLabel={TABLE_HEAD}
rowCount={changePartners.length}
numSelected={selected.length}
onRequestSort={handleRequestSort}
onSelectAllClick={handleSelectAllClick}
/>
<TableBody>
{filteredPartners
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
.map((row) => {
const { id, title, link, status, logo } = row;
const isItemSelected = selected.indexOf(id) !== -1;
return (
<TableRow
hover
key={id}
tabIndex={-1}
role="checkbox"
selected={isItemSelected}
aria-checked={isItemSelected}
>
<TableCell padding="checkbox">
<Checkbox
checked={isItemSelected}
onChange={(event) => handleClick(event, id)}
/>
</TableCell>
<TableCell align="left">{id}</TableCell>
<TableCell align="left">{title}</TableCell>
<TableCell align="left">{logo}</TableCell>
<TableCell align="left">{link}</TableCell>
<TableCell align="left">
<Label
id={id}
onClick={toggleStatus}
variant="ghost"
color={status === 'Inactive' ? 'error' : 'success'}
>
{sentenceCase(status)}
</Label>
</TableCell>
<TableCell onClick={() => getItem(id)} align="right">
<UserMoreMenu
id={id}
setChangeData={setChangePartners}
changeData={changePartners}
/>
</TableCell>
</TableRow>
);
})}
{emptyRows > 0 && (
<TableRow style={{ height: 53 * emptyRows }}>
<TableCell colSpan={6} />
</TableRow>
)}
</TableBody>
{isPartnerNotFound && (
<TableBody>
<TableRow>
<TableCell align="center" colSpan={6} sx={{ py: 3 }}>
<SearchNotFound searchQuery={filter} />
</TableCell>
</TableRow>
</TableBody>
)}
</Table>
</TableContainer>
</Scrollbar>
<TablePagination
rowsPerPageOptions={[5, 10, 25]}
component="div"
count={filteredPartners.length}
rowsPerPage={rowsPerPage}
page={page}
onPageChange={handleChangePage}
onRowsPerPageChange={handleChangeRowsPerPage}
/>
</Card>
</Container>
</Page>
}
/>
<Route
path="/add"
element={
<AddPartner changePartners={changePartners} setChangePartners={setChangePartners} />
}
/>
<Route
path="/edit"
element={
<EditPage
id={itemId}
editviewRecord={editviewRecord}
setChangeData={setChangePartners}
changeData={changePartners}
editlist={editlist}
/>
}
/>
<Route
path="/view"
element={<ViewPage editviewRecord={editviewRecord} editlist={editlist} />}
/>
</Routes>
);
}
| 33.938028 | 95 | 0.471448 |
c8793125768994476e3389e0e87c5656c851ece8 | 4,692 | js | JavaScript | components/radio/src/index.js | abdelrahmanrifai/govuk-react | c58bcbefa9416f85d470d7d4d214283be3f95744 | [
"MIT"
] | null | null | null | components/radio/src/index.js | abdelrahmanrifai/govuk-react | c58bcbefa9416f85d470d7d4d214283be3f95744 | [
"MIT"
] | null | null | null | components/radio/src/index.js | abdelrahmanrifai/govuk-react | c58bcbefa9416f85d470d7d4d214283be3f95744 | [
"MIT"
] | null | null | null | import React from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { FOCUS_COLOUR } from 'govuk-colours';
import { withWhiteSpace } from '@govuk-react/hoc';
import { typography } from '@govuk-react/lib';
import HintText from '@govuk-react/hint-text';
import {
BORDER_WIDTH_FORM_ELEMENT,
FOCUS_WIDTH,
FOCUS_WIDTH_RAW,
MEDIA_QUERIES,
SPACING_POINTS,
} from '@govuk-react/constants';
const radioSize = SPACING_POINTS[7];
const labelPaddingLeftRight = SPACING_POINTS[3];
// When the default focus width is used on a curved edge it looks visually smaller.
// So for the circular radios we bump the default to make it look visually consistent.
const RADIOS_FOCUS_WIDTH = `${FOCUS_WIDTH_RAW + 1}px`;
const Label = styled('label')(
typography.font({ size: 19 }),
{
display: 'block',
position: 'relative',
minHeight: radioSize,
padding: `0 0 0 ${radioSize}px`,
clear: 'left',
},
({ inline }) => (inline && {
[MEDIA_QUERIES.LARGESCREEN]: {
float: 'left',
clear: 'none',
marginRight: SPACING_POINTS[4],
},
}),
);
const Input = styled('input')(
{
position: 'absolute',
zIndex: 1,
top: 0,
left: 0,
width: radioSize,
height: radioSize,
cursor: 'pointer',
opacity: 0,
':checked + span::after': {
opacity: 1,
},
':focus + span::before': {
outline: `${FOCUS_WIDTH} solid transparent`,
outlineOffset: FOCUS_WIDTH,
boxShadow: `0 0 0 ${RADIOS_FOCUS_WIDTH} ${FOCUS_COLOUR}`,
},
},
({ disabled }) => ({
cursor: disabled ? 'auto' : 'pointer',
' + span': {
opacity: disabled ? '.5' : '1',
pointerEvents: disabled ? 'none' : 'auto',
},
}),
);
const LabelText = styled('span')({
display: 'inline-block',
marginBottom: 0,
padding: `8px ${labelPaddingLeftRight}px ${SPACING_POINTS[1]}px`,
cursor: 'pointer',
MsTouchAction: 'manipulation',
touchAction: 'manipulation',
':before': {
content: "''",
boxSizing: 'border-box',
position: 'absolute',
top: 0,
left: 0,
width: radioSize,
height: radioSize,
border: `${BORDER_WIDTH_FORM_ELEMENT} solid black`,
borderRadius: '50%',
background: 'transparent',
},
':after': {
content: "''",
position: 'absolute',
top: SPACING_POINTS[2],
left: SPACING_POINTS[2],
width: 0,
height: 0,
border: `${SPACING_POINTS[2]}px solid`,
borderRadius: '50%',
opacity: 0,
},
});
const StyledRadioHint = styled(HintText)({
display: 'block',
paddingLeft: labelPaddingLeftRight,
paddingRight: labelPaddingLeftRight,
});
/**
*
* ### Usage
*
* Simple
* ```jsx
* <Radio name="group1">Radio button text example</Radio>
* ```
*
* Radio stacked
* ```jsx
* <div>
* <Radio name="group1">Waste from animal carcasses</Radio>
* <Radio name="group1">Waste from mines or quarries</Radio>
* <Radio name="group1">Farm or agricultural waste</Radio>
* </div>
* ```
*
* Radio inline
* ```jsx
* <div>
* <Radio name="group1" inline>
* Yes
* </Radio>
* <Radio name="group1" inline>
* No
* </Radio>
* </div>
* ```
*
* Radio disabled
* ```jsx
* <div>
* <Radio name="group1" disabled="disabled">
* Disabled checkbox option
* </Radio>
* </div>
* ```
*
* Radio preselected
* ```jsx
* <div>
* <Radio name="group1" checked>
* Farm or agricultural waste
* </Radio>
* </div>
* ```
*
* Radio preselected & disabled
* ```jsx
* <div>
* <Radio name="group1" disabled="disabled" checked>
* Farm or agricultural waste
* </Radio>
* </div>
* ```
* Radio with hint text
* ```jsx
* <div>
* <Radio
* name="group1"
* hint="You'll have a user ID if you've registered for Self Assessment or filed a tax return
* online before."
* >
* Sign in with Government Gateway
* </Radio>
* </div>
* ```
* ### References:
* - https://github.com/alphagov/govuk-frontend/blob/master/src/components/radios/_radios.scss
* - https://github.com/alphagov/govuk_elements/blob/master/assets/sass/elements/_forms.scss
*/
const Radio = ({
inline, children, className, hint, ...input
}) => (
<Label inline={inline} className={className}>
<Input type="radio" {...input} />
<LabelText>{children}</LabelText>
{hint && <StyledRadioHint>{hint}</StyledRadioHint>}
</Label>
);
Radio.defaultProps = {
hint: undefined,
inline: false,
className: undefined,
};
Radio.propTypes = {
hint: PropTypes.node,
inline: PropTypes.bool,
className: PropTypes.string,
children: PropTypes.node.isRequired,
};
export default withWhiteSpace({ marginBottom: 2 })(Radio);
| 23.227723 | 96 | 0.615303 |
c8796881080c4fc3016a0449db6a582d6b0f3403 | 347 | js | JavaScript | tests/dummy/app/routes/chart-obj.js | Glavin001/ember-c3 | f9dcce109e0efdbfd56d81b06233af12fc9d00b5 | [
"MIT"
] | 67 | 2015-01-18T04:03:27.000Z | 2021-11-13T04:40:59.000Z | tests/dummy/app/routes/chart-obj.js | Glavin001/ember-c3 | f9dcce109e0efdbfd56d81b06233af12fc9d00b5 | [
"MIT"
] | 74 | 2015-01-06T02:32:55.000Z | 2022-02-04T18:39:27.000Z | tests/dummy/app/routes/chart-obj.js | Glavin001/ember-c3 | f9dcce109e0efdbfd56d81b06233af12fc9d00b5 | [
"MIT"
] | 75 | 2015-01-06T02:27:14.000Z | 2021-12-31T01:15:31.000Z | import Route from "@ember/routing/route";
export default class ChartObjRoute extends Route {
setupController(controller, model) {
super.setupController(controller, model);
controller.set("legendVisible", true);
controller.set("graphVisible", true);
controller.set("isBar", false);
controller.set("isStacked", false);
}
}
| 26.692308 | 50 | 0.717579 |
c87976936449897366f2d9c4bc545914c4d15d9e | 682 | js | JavaScript | lib/directoryView.js | LightBoom/epay-ftl-middleware | 544435fc2fb8bfb06c87aee79fd4b8adabcca385 | [
"MIT"
] | null | null | null | lib/directoryView.js | LightBoom/epay-ftl-middleware | 544435fc2fb8bfb06c87aee79fd4b8adabcca385 | [
"MIT"
] | null | null | null | lib/directoryView.js | LightBoom/epay-ftl-middleware | 544435fc2fb8bfb06c87aee79fd4b8adabcca385 | [
"MIT"
] | null | null | null | /**
* 文件列表视图
*/
module.exports = function (files) {
return (
'<!DOCTYPE html>' +
'<html>' +
'<head>' +
'<meta charset="UTF-8">' +
'<meta name="viewport" content="width=device-width, initial-scale=1.0">' +
'<meta http-equiv="X-UA-Compatible" content="ie=edge">' +
'<title>FreemarkerMiddleware</title>' +
'</head>' +
'<body>' +
'<ul>' +
files.map(function(option) {
if (typeof option === 'string') {
option = {
href: option,
text: option
}
}
return '<li><a href="' + option.href + '">' + option.text + '</a></li>'
}).join('') +
'</ul>' +
'</body>' +
'</html>'
)
}
| 22.733333 | 78 | 0.472141 |
c8797fe4888519957068585556150a48e215be00 | 123 | js | JavaScript | src/_services/index.js | Alex-Telonic/MigroFrontendApp | 9e3e23465aa4be97691b53ef9dd2a5686206a8c4 | [
"MIT"
] | 1 | 2020-10-11T04:45:03.000Z | 2020-10-11T04:45:03.000Z | src/_services/index.js | Alex-Telonic/MigroFrontendApp | 9e3e23465aa4be97691b53ef9dd2a5686206a8c4 | [
"MIT"
] | null | null | null | src/_services/index.js | Alex-Telonic/MigroFrontendApp | 9e3e23465aa4be97691b53ef9dd2a5686206a8c4 | [
"MIT"
] | null | null | null | export * from './user.service';
export * from './user.model';
export * from './search.service';
export * from './headers';
| 24.6 | 33 | 0.650407 |
c879c581f4752b007036c32523232cb4e1d138d5 | 518 | js | JavaScript | test/int/coin/bitcore/address.js | bookmoons/cashshufflejs | 651cf41f97356750784b693e7edad37e29bf4985 | [
"Unlicense"
] | 3 | 2018-09-13T19:18:53.000Z | 2018-10-12T18:29:21.000Z | test/int/coin/bitcore/address.js | bookmoons/cashshufflejs | 651cf41f97356750784b693e7edad37e29bf4985 | [
"Unlicense"
] | 32 | 2018-07-16T10:31:27.000Z | 2019-04-19T04:51:36.000Z | test/int/coin/bitcore/address.js | bookmoons/cashshufflejs | 651cf41f97356750784b693e7edad37e29bf4985 | [
"Unlicense"
] | null | null | null | import test from 'ava'
import Coin from 'coin/bitcore/main'
import address from 'coin/bitcore/address'
const publicKeyString =
'0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798'
const expectedAddress =
'bitcoincash:qp63uahgrxged4z5jswyt5dn5v3lzsem6cy4spdc2h'
test.before(t => {
Object.assign(Coin.prototype, {
address
})
})
test('correct', async t => {
const coin = new Coin()
const producedAddress = await coin.address(publicKeyString)
t.is(producedAddress, expectedAddress)
})
| 24.666667 | 70 | 0.772201 |
c879e480eef2289a331ff75ae4434235083694e7 | 9,747 | js | JavaScript | webapp/WEB-INF/js/mjt/src/freebase/api.js | gagoel/acre | f5774af2dfbd2fc337d614846748ac6620c421c0 | [
"Apache-2.0"
] | null | null | null | webapp/WEB-INF/js/mjt/src/freebase/api.js | gagoel/acre | f5774af2dfbd2fc337d614846748ac6620c421c0 | [
"Apache-2.0"
] | null | null | null | webapp/WEB-INF/js/mjt/src/freebase/api.js | gagoel/acre | f5774af2dfbd2fc337d614846748ac6620c421c0 | [
"Apache-2.0"
] | null | null | null |
/**
* Freebase service definitions using JsonP()
*
* uses:
* JSON.stringify()
* jsonp.js: JsonP()
* task.js: define_task()
* util.js: thunk(), formquote, log(), error()
*
*/
(function (mjt) {
if (typeof mjt.freebase == 'undefined')
mjt.freebase = {};
mjt.freebase.default_service_url = 'http://www.freebase.com';
mjt.freebase.set_service_url = function (service_url) {
var loc;
if (typeof window != 'undefined')
loc = window.location.protocol + '//' + window.location.host;
if (typeof acre != 'undefined')
loc = acre.environ.server_protocol + '//' + acre.environ.host;
mjt.freebase.service_url = service_url;
mjt.freebase.xhr_ok = mjt.freebase.service_url == loc ? true : false;
// if anybody included the schema cache code, initialize it here.
if (typeof mjt.freebase.SchemaCache != 'undefined') {
this.schema_cache = new this.SchemaCache(this);
}
};
mjt.freebase.set_service_url(mjt.freebase.default_service_url);
/**
* @class Defines the logic to test the freshness of JsonP tasks
*
* freshness is based on the mwLastWriteTime cookie.
* XXX note that you can only check mwLastWriteTime if the service_url has
* the same origin as the current page.
*/
function FreebaseCacheController() {
// save the mwLastWriteTime cookie, to compare freshness if re-used
var _mwLastWriteTime = mjt.freebase.readCookie('mwLastWriteTime');
this.is_fresh = function(task) {
var mwLastWriteTime = mjt.freebase.readCookie('mwLastWriteTime'); // latest cookie
// if tokens are not identical then a write (or login) has happened
return (_mwLastWriteTime == mwLastWriteTime);
};
}
/**
* @class a task which depends on an external mjt.JsonP task.
*
*/
mjt.freebase.FreebaseJsonPTask = mjt.define_task();
mjt.freebase.FreebaseJsonPTask.prototype.init = function() {
this.jsonp = mjt.JsonP();
if (typeof mjt.freebase.readCookie != 'undefined') {
// this wraps the current lastwrite cookie in a closure
// for later comparison.
this.jsonp.cache_controller = new FreebaseCacheController();
}
};
/**
* make a single jsonp request to freebase.com
*
*/
mjt.freebase.FreebaseJsonPTask.prototype.service_request = function(path, form) {
var service_url = mjt.freebase.service_url;
// the service_url may be overridden on a task-by-task basis, see Touch() for example
if (typeof this.service_url != 'undefined' && this.service_url)
service_url = this.service_url;
var url = service_url + path;
this.jsonp.set_timeout()
.jsonp_request_form(url, form, 'callback')
.onready('handle_envelope', this)
.onerror('handle_error_jsonp', this);
return this;
};
/**
* handle a jsonp response from freebase.com
*
*/
mjt.freebase.FreebaseJsonPTask.prototype.handle_envelope = function (o) {
//mjt.log('freebase.BaseTask.handle_envelope', this, o.code);
if (o.code != '/api/status/ok') {
var msg = o.messages[0];
return this.error(msg.code, msg.message, msg);
}
return this.response(o);
};
/**
* handle errors at the jsonp layer
*
*/
mjt.freebase.FreebaseJsonPTask.prototype.handle_error_jsonp = function() {
//mjt.warn('JSONP ERROR', arguments);
this.error.apply(this, arguments);
};
/**
* send the request
*
* "subclasses" of BaseTask should override this
*
*/
mjt.freebase.FreebaseJsonPTask.prototype.request = function() {
mjt.error('must override BaseTask.request()');
};
/**
* "subclasses" of BaseTask should override this
*
*/
mjt.freebase.FreebaseJsonPTask.prototype.response = function(o) {
mjt.error('must override BaseTask.response()');
};
//////////////////////////////////////////////////////////////////////
/**
*
*/
mjt.freebase.MqlRead = mjt.define_task(mjt.freebase.FreebaseJsonPTask,
[{name:'query'},
{name:'qenv', 'default':{}}]);
/**
*
*/
mjt.freebase.MqlRead.prototype.build_envelope = function () {
var envelope = {
escape: false
};
for (var k in this.qenv)
envelope[k] = this.qenv[k];
envelope.query = this.query;
if (this.query instanceof Array) {
if (typeof envelope.cursor == 'undefined') {
envelope.cursor = true; // always ask for cursor with multiple results
this.start = 0;
}
// if the cursor is already present, we can't know this.start.
// if this MqlRead was set up by a pager from a previous mqlread,
// this.start should have been set by the .next() method there.
this.requested_count = this.query[0].limit || 100;
}
return envelope;
};
/**
*
*/
mjt.freebase.MqlRead.prototype.request = function () {
var envelope = this.build_envelope();
var s = JSON.stringify(envelope);
return this.service_request('/api/service/mqlread', { query: s });
};
/**
*
*/
mjt.freebase.MqlRead.prototype.response = function(o) {
if (o.result === null)
return this.error('/user/mjt/messages/empty_result',
'no results found');
if (typeof o.cursor === 'string')
this.next_cursor = o.cursor;
if (o.result instanceof Array) {
this.count = o.result.length;
this.more_available = false;
// was the last read shorter than requested?
// did the last read return cursor == false?
if (this.count >= this.requested_count
&& this.next_cursor != false)
this.more_available = true;
}
return this.ready(o.result);
};
/**
* creates a new read request that continues this
* query using the returned cursor. by default it
* requests the same number of results as the last
* query.
* @param {reqcount} how many more results to request
* @returns the new instance of MqlRead
*/
mjt.freebase.MqlRead.prototype.next = function (reqcount) {
if (this.state !== 'ready') {
throw new Error('MqlRead.next(): bad state ' + this.state);
}
if (!this.more_available) {
// app shouldn't be asking for more
mjt.warn('paging .next(): no more items', this);
return null;
}
// we're going to mess with the toplevel .limit, but
// everything else we copy.
var qold = this.query[0]
var q = {};
for (var k in qold) {
if (qold.hasOwnProperty(k))
q[k] = qold[k];
}
if (typeof reqcount != 'undefined')
q.limit = reqcount;
var task = mjt.freebase.MqlRead([q], { cursor: this.next_cursor });
task.start = this.start + this.count;
return task;
};
//////////////////////////////////////////////////////////////////////
/**
* @class bundles multiple MqlReads into a single HTTP request.
* @constructor
*
* this works by combining multiple MqlRead tasks, rather
* than combining multiple JSON queries. not intuitive and should
* be changed.
*/
mjt.freebase.MqlReadMultiple = mjt.define_task(mjt.freebase.FreebaseJsonPTask);
mjt.freebase.MqlReadMultiple.prototype.init = function () {
this.reads = {};
};
/**
*
*/
mjt.freebase.MqlReadMultiple.prototype.request = function () {
var queries = {};
for (var k in this.reads)
queries[k] = this.reads[k].build_envelope();
var s = JSON.stringify(queries);
return this.service_request('/api/service/mqlread', { queries: s });
};
/**
* add a new query
*
* @param key identifies the subquery
* @param q the mql subquery
*
*/
mjt.freebase.MqlReadMultiple.prototype.mqlread = function (key, task) {
this.reads[key] = task;
return this;
};
/**
*
*/
mjt.freebase.MqlReadMultiple.prototype.response = function (o) {
for (var k in this.reads) {
var task = this.reads[k];
task.handle_envelope(o[k]);
}
return this.ready(o.result);
};
//////////////////////////////////////////////////////////////////////
/**
*
*/
mjt.freebase.TransGet = mjt.define_task(mjt.freebase.FreebaseJsonPTask,
[{ name:'id' },
{ name:'trans_type', 'default': 'raw' },
{ name:'values', 'default': null }]);
/**
*
*/
mjt.freebase.TransGet.prototype.request = function() {
if (this.values === null) this.values = {};
var path = '/api/trans/' + this.trans_type + this.id;
return this.service_request(path, this.values);
};
/**
*
*/
mjt.freebase.TransGet.prototype.response = function(o) {
// XXX workaround for https://bugs.freebase.com/browse/ME-1397
o.result.media_type = o.result.media_type.replace(/^\/media_type\//, '');
if (typeof o.result.text_encoding == 'string')
o.result.text_encoding = o.result.text_encoding.replace(/^\/media_type\/text_encoding\//, '');
// end workaround
return this.ready(o.result);
};
//////////////////////////////////////////////////////////////////////
/**
* mjt.task wrapper for freebase /api/service/touch
* the service_url allows you to touch a different server,
* though that may not help if the browser has third-party cookies blocked.
*/
mjt.freebase.Touch = mjt.define_task(mjt.freebase.FreebaseJsonPTask,
[{name:'service_url', 'default':null}]);
/**
*
*/
mjt.freebase.Touch.prototype.request = function () {
// Touch should never be cached
this.jsonp.cache_controller = {
is_fresh : function(task) {
return false;
}
};
return this.service_request('/api/service/touch');
};
mjt.freebase.Touch.prototype.response = function(o) {
// no response expected for now but whatever
return this.ready(null);
};
})(mjt);
| 26.70411 | 102 | 0.613112 |