Version Description
( April, 2015) =
Download this release
Release Info
Developer | Desertsnowman |
Plugin | Caldera Forms – More Than Contact Forms |
Version | 1.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.9.10 to 1.2.0
- assets/css/admin.css +16 -2
- assets/css/modals.css +140 -127
- assets/css/processors-edit.css +0 -3
- assets/js/admin.min.js +75 -3
- assets/js/conditionals.js +1 -1
- assets/js/conditionals.min.js +1 -1
- assets/js/edit.js +11 -48
- assets/js/edit.min.js +2 -2
- assets/js/shortcode-insert.js +2 -2
- assets/js/shortcode-insert.min.js +1 -1
- assets/js/wp-baldrick-full.js +4961 -0
- caldera-core.php +2 -2
- classes/admin.php +21 -5
- classes/core.php +77 -52
- fields/calculation/config.php +2 -3
- fields/calculation/line-templates.php +2 -1
- fields/phone/config.php +4 -4
- fields/phone/field.php +1 -1
- readme.txt +60 -24
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- screenshot-4.png +0 -0
- ui/admin.php +3 -3
- ui/admin_templates.php +16 -28
- ui/edit.php +10 -7
- ui/panels/emailer.php +2 -0
- ui/panels/layout.php +1 -1
- ui/panels/layout_side.php +2 -1
- ui/panels/pages.php +1 -0
- ui/panels/processors.php +2 -1
- ui/panels/variables.php +1 -0
assets/css/admin.css
CHANGED
@@ -872,7 +872,7 @@ input.disabled-input {
|
|
872 |
}
|
873 |
.tab-detail-panel > h4 {
|
874 |
font-weight: bold;
|
875 |
-
margin: 0
|
876 |
}
|
877 |
.tab-detail-panel > h4 small {
|
878 |
color: #A9A9A9;
|
@@ -908,6 +908,7 @@ input.disabled-input {
|
|
908 |
}
|
909 |
#form-entries-viewer.spinner {
|
910 |
display: block;
|
|
|
911 |
float: left;
|
912 |
height: 22px;
|
913 |
padding: 0;
|
@@ -1614,4 +1615,17 @@ tr.form_entry_row.loading {
|
|
1614 |
position: absolute;
|
1615 |
top: -75px;
|
1616 |
box-shadow: 0 3px 5px rgba(0,0,0,0.2);
|
1617 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
872 |
}
|
873 |
.tab-detail-panel > h4 {
|
874 |
font-weight: bold;
|
875 |
+
margin: 0 0 12px;
|
876 |
}
|
877 |
.tab-detail-panel > h4 small {
|
878 |
color: #A9A9A9;
|
908 |
}
|
909 |
#form-entries-viewer.spinner {
|
910 |
display: block;
|
911 |
+
visibility: visible;
|
912 |
float: left;
|
913 |
height: 22px;
|
914 |
padding: 0;
|
1615 |
position: absolute;
|
1616 |
top: -75px;
|
1617 |
box-shadow: 0 3px 5px rgba(0,0,0,0.2);
|
1618 |
+
z-index: 99999;
|
1619 |
+
}
|
1620 |
+
.tablenav.caldera-table-nav {
|
1621 |
+
clear: none;
|
1622 |
+
float: right;
|
1623 |
+
margin: -42px 18px 0 0;
|
1624 |
+
}
|
1625 |
+
.caldera-table-nav .tablenav-pages{
|
1626 |
+
float: left;
|
1627 |
+
}
|
1628 |
+
.caldera-table-nav .tablenav-pages .current-page{
|
1629 |
+
width: 45px;
|
1630 |
+
}
|
1631 |
+
|
assets/css/modals.css
CHANGED
@@ -73,7 +73,8 @@
|
|
73 |
padding: 12px 12px 8.9px;
|
74 |
position: absolute;
|
75 |
right: 0;
|
76 |
-
top: 43px;
|
|
|
77 |
}
|
78 |
#extend_cf_baldrickModalBody{
|
79 |
overflow: auto;
|
@@ -119,164 +120,176 @@
|
|
119 |
width: 45px;
|
120 |
}
|
121 |
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
.profile-features > li,
|
127 |
-
.modal-side-tabs > li {
|
128 |
display: inline-block;
|
129 |
-
float:
|
130 |
-
|
|
|
|
|
|
|
131 |
}
|
132 |
-
|
133 |
-
|
134 |
-
|
|
|
|
|
135 |
display: block;
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
background-color: #efefef;
|
144 |
-
}
|
145 |
-
.caldera-manage-groups-tip {
|
146 |
-
padding: 10px 0;
|
147 |
-
text-align: center;
|
148 |
}
|
149 |
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
.
|
156 |
-
|
157 |
-
|
158 |
-
padding-right: 10px;
|
159 |
-
overflow: auto;
|
160 |
}
|
161 |
-
.modal-
|
162 |
-
|
163 |
-
|
|
|
|
|
|
|
164 |
}
|
165 |
-
.
|
166 |
border-bottom: 1px solid #EFEFEF;
|
167 |
-
padding: 5px;
|
168 |
}
|
169 |
-
|
170 |
-
|
|
|
|
|
|
|
|
|
|
|
171 |
}
|
172 |
-
|
173 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
}
|
175 |
|
176 |
-
.modal-
|
177 |
-
|
|
|
|
|
178 |
bottom: 0;
|
179 |
left: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
overflow: auto;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
position: absolute;
|
182 |
-
|
183 |
-
|
184 |
}
|
185 |
-
|
186 |
-
|
187 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
}
|
189 |
-
|
190 |
-
|
|
|
|
|
|
|
|
|
191 |
bottom: 0;
|
|
|
|
|
|
|
192 |
margin: 0;
|
|
|
193 |
overflow: auto;
|
|
|
|
|
194 |
position: absolute;
|
195 |
top: 0;
|
196 |
-
width:
|
197 |
-
min-height: 100px;
|
198 |
-
}
|
199 |
-
.modal-side-bar.has-avatar .modal-side-tabs{
|
200 |
-
top: 150px;
|
201 |
-
}
|
202 |
-
.modal-side-tabs > li .modal-side-tab {
|
203 |
-
background-color: #989898;
|
204 |
-
color: #FFFFFF;
|
205 |
-
}
|
206 |
-
.modal-side-tabs > li .modal-side-tab:hover{
|
207 |
-
background-color: #efefef;
|
208 |
-
color: #585858;
|
209 |
-
}
|
210 |
-
.modal-side-tabs > li .modal-side-tab.active {
|
211 |
-
background-color: #FFF;
|
212 |
-
color: #585858;
|
213 |
-
}
|
214 |
-
.modal-side-bar .modal-side-tabs > li {
|
215 |
-
width: 100%;
|
216 |
}
|
217 |
-
.
|
218 |
-
|
219 |
-
width: 100%;
|
220 |
}
|
221 |
-
.
|
222 |
-
|
223 |
-
width: 80px;
|
224 |
-
color: #898989;
|
225 |
}
|
226 |
-
|
227 |
-
|
228 |
-
|
|
|
|
|
|
|
|
|
229 |
}
|
230 |
-
.
|
231 |
-
|
232 |
-
margin: 0.6em 0;
|
233 |
}
|
234 |
-
.
|
235 |
-
|
236 |
-
|
237 |
-
font-weight: normal;
|
238 |
}
|
239 |
-
|
240 |
-
|
|
|
|
|
|
|
|
|
|
|
241 |
}
|
242 |
-
.
|
243 |
-
|
|
|
244 |
}
|
245 |
-
.caldera-
|
246 |
-
|
247 |
-
|
248 |
-
clear: both;
|
249 |
-
padding: 6px;
|
250 |
-
text-align: right;
|
251 |
}
|
252 |
-
.
|
253 |
-
|
|
|
254 |
}
|
255 |
-
|
256 |
-
|
257 |
-
.caldera-modal-body.spinner {
|
258 |
-
background-position: 12px 12px;
|
259 |
-
min-height: 44px;
|
260 |
-
display: block;
|
261 |
-
float: none;
|
262 |
-
text-align: center;
|
263 |
-
width: 100%;
|
264 |
}
|
265 |
-
|
266 |
-
|
267 |
-
margin-left: 150px;
|
268 |
}
|
269 |
-
|
270 |
-
@media (max-width: 600px) {
|
271 |
-
/* Small Screens */
|
272 |
-
.caldera-modal-wrap.caldera-front-modal-wrap{
|
273 |
-
bottom: 0;
|
274 |
-
display: block;
|
275 |
-
left: 0;
|
276 |
-
margin: 0 !important;
|
277 |
-
overflow: auto;
|
278 |
-
padding: 0 !important;
|
279 |
-
top: 0;
|
280 |
-
width: 100% !important;
|
281 |
-
}
|
282 |
-
}
|
73 |
padding: 12px 12px 8.9px;
|
74 |
position: absolute;
|
75 |
right: 0;
|
76 |
+
top: 43px;
|
77 |
+
overflow: auto;
|
78 |
}
|
79 |
#extend_cf_baldrickModalBody{
|
80 |
overflow: auto;
|
120 |
width: 45px;
|
121 |
}
|
122 |
|
123 |
+
.baldrick-modal-body.spinner,
|
124 |
+
.baldrick-modal-wrap .spinner.loading {
|
125 |
+
background-position: center center;
|
|
|
|
|
|
|
126 |
display: inline-block;
|
127 |
+
float: none;
|
128 |
+
height: auto;
|
129 |
+
position: absolute;
|
130 |
+
width: auto;
|
131 |
+
visibility: visible;
|
132 |
}
|
133 |
+
|
134 |
+
/* MODALS */
|
135 |
+
.baldrick-backdrop {
|
136 |
+
background: none repeat scroll 0 0 #000000;
|
137 |
+
bottom: 0;
|
138 |
display: block;
|
139 |
+
left: 0;
|
140 |
+
min-height: 360px;
|
141 |
+
opacity: 0.7;
|
142 |
+
position: fixed;
|
143 |
+
right: 0;
|
144 |
+
top: 0;
|
145 |
+
z-index: 100100;
|
|
|
|
|
|
|
|
|
|
|
146 |
}
|
147 |
|
148 |
+
.baldrick-modal-wrap {
|
149 |
+
background-color: #FFFFFF;
|
150 |
+
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
|
151 |
+
display: block;
|
152 |
+
position: fixed;
|
153 |
+
transition: height 0.2s ease 0s, margin-top 0.2s ease 0s;
|
154 |
+
width: 500px;
|
155 |
+
z-index: 100105;
|
|
|
|
|
156 |
}
|
157 |
+
.baldrick-modal-wrap.baldrick-front-modal-wrap{
|
158 |
+
position: absolute;
|
159 |
+
bottom: auto;
|
160 |
+
width: 600px;
|
161 |
+
margin-left: -300px;
|
162 |
+
margin-top: 0;
|
163 |
}
|
164 |
+
.baldrick-modal-title {
|
165 |
border-bottom: 1px solid #EFEFEF;
|
|
|
166 |
}
|
167 |
+
|
168 |
+
.baldrick-modal-closer {
|
169 |
+
color: #808080;
|
170 |
+
float: right;
|
171 |
+
font-size: 24px;
|
172 |
+
padding: 12px;
|
173 |
+
text-decoration: none;
|
174 |
}
|
175 |
+
|
176 |
+
.baldrick-modal-closer.baldrick-front-modal-closer:hover,
|
177 |
+
.baldrick-modal-closer.baldrick-front-modal-closer:active{
|
178 |
+
text-decoration: none;
|
179 |
+
color: inherit;
|
180 |
+
}
|
181 |
+
.baldrick-modal-title > h3 {
|
182 |
+
font-weight: 400;
|
183 |
+
margin: 0;
|
184 |
+
padding: 12px 40px 12px 12px;
|
185 |
}
|
186 |
|
187 |
+
.baldrick-modal-body {
|
188 |
+
-moz-box-sizing: border-box; /* Firefox 1, probably can drop this */
|
189 |
+
-webkit-box-sizing: border-box; /* Safari 3-4, also probably droppable */
|
190 |
+
box-sizing: border-box; /* Everything else */
|
191 |
bottom: 0;
|
192 |
left: 0;
|
193 |
+
margin-left: 0;
|
194 |
+
margin-right: 0;
|
195 |
+
margin-top: 0;
|
196 |
+
padding: 12px;
|
197 |
+
position: absolute;
|
198 |
+
right: 0;
|
199 |
+
top: 43px;
|
200 |
overflow: auto;
|
201 |
+
}
|
202 |
+
.baldrick-modal-body.has-buttons{
|
203 |
+
bottom: 53px;
|
204 |
+
}
|
205 |
+
.baldrick-modal-footer {
|
206 |
+
background: none repeat scroll 0 0 #EFEFEF;
|
207 |
+
border-top: 1px solid #E0E0E0;
|
208 |
+
bottom: 0;
|
209 |
+
left: 0;
|
210 |
+
padding: 12px;
|
211 |
position: absolute;
|
212 |
+
right: 0;
|
213 |
+
text-align: right;
|
214 |
}
|
215 |
+
|
216 |
+
|
217 |
+
@media (max-width: 600px) {
|
218 |
+
/* Small Screens */
|
219 |
+
.baldrick-modal-wrap.baldrick-front-modal-wrap{
|
220 |
+
bottom: 0;
|
221 |
+
display: block;
|
222 |
+
left: 0;
|
223 |
+
margin: 0 !important;
|
224 |
+
overflow: auto;
|
225 |
+
padding: 0 !important;
|
226 |
+
top: 0;
|
227 |
+
width: 100% !important;
|
228 |
+
}
|
229 |
}
|
230 |
+
|
231 |
+
|
232 |
+
/* EXPERIMENTAL TABS */
|
233 |
+
.baldrick-modal-wrap .navtabs {
|
234 |
+
background-color: #f1f1f1;
|
235 |
+
border-right: 1px solid #dfdfdf;
|
236 |
bottom: 0;
|
237 |
+
box-sizing: padding-box;
|
238 |
+
float: left;
|
239 |
+
left: 0;
|
240 |
margin: 0;
|
241 |
+
padding: 12px 0 0;
|
242 |
overflow: auto;
|
243 |
+
overflow-x: hidden;
|
244 |
+
white-space: nowrap;
|
245 |
position: absolute;
|
246 |
top: 0;
|
247 |
+
width: 150px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
}
|
249 |
+
.baldrick-modal-wrap .navtabs > li{
|
250 |
+
margin: 0;
|
|
|
251 |
}
|
252 |
+
.baldrick-modal-wrap .navtabs > li:hover{
|
253 |
+
background-color: #dfdfdf;
|
|
|
|
|
254 |
}
|
255 |
+
.baldrick-modal-wrap .navtabs > li a {
|
256 |
+
color: #738e2f;
|
257 |
+
display: block;
|
258 |
+
padding: 8px 12px;
|
259 |
+
text-decoration: none;
|
260 |
+
text-overflow: ellipsis;
|
261 |
+
overflow: hidden;
|
262 |
}
|
263 |
+
.baldrick-modal-body.has-tabs {
|
264 |
+
margin-left: 150px;
|
|
|
265 |
}
|
266 |
+
.baldrick-modal-wrap .navtabs > li.selected > a {
|
267 |
+
background: none repeat scroll 0 0 #a3be5f;
|
268 |
+
color: #fff !important;
|
|
|
269 |
}
|
270 |
+
|
271 |
+
.caldera-modal-title .modal-label,
|
272 |
+
.caldera-modal-title .caldera-modal-closer,
|
273 |
+
.baldrick-modal-title .modal-label,
|
274 |
+
.baldrick-modal-title .baldrick-modal-closer{
|
275 |
+
color: #fff;
|
276 |
+
text-shadow: 0 0 2px rgba(0, 0, 0, 0.3);
|
277 |
}
|
278 |
+
.caldera-modal-title .caldera-modal-closer:hover,
|
279 |
+
.baldrick-modal-title .baldrick-modal-closer:hover {
|
280 |
+
background: none repeat scroll 0 0 rgba(0, 0, 0, 0.2);
|
281 |
}
|
282 |
+
.caldera-modal-title .modal-label,
|
283 |
+
.baldrick-modal-title .modal-label{
|
284 |
+
background-color: #a3be5f;
|
|
|
|
|
|
|
285 |
}
|
286 |
+
.modal-body .modal-list-item {
|
287 |
+
border-bottom: 1px solid #EFEFEF;
|
288 |
+
padding: 5px;
|
289 |
}
|
290 |
+
.modal-list-item:hover {
|
291 |
+
background: none repeat scroll 0 0 #EFEFEF;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
}
|
293 |
+
.modal-list-item .description {
|
294 |
+
color: #919191;
|
|
|
295 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/css/processors-edit.css
CHANGED
@@ -38,9 +38,6 @@ h3.caldera-editor-processor-title {
|
|
38 |
padding: 6px 134px 6px 72px;
|
39 |
}
|
40 |
|
41 |
-
.form-modal-add-line:hover {
|
42 |
-
background-color: #f7f7f7;
|
43 |
-
}
|
44 |
button.button.info-button {
|
45 |
float: right;
|
46 |
margin-right: -120px;
|
38 |
padding: 6px 134px 6px 72px;
|
39 |
}
|
40 |
|
|
|
|
|
|
|
41 |
button.button.info-button {
|
42 |
float: right;
|
43 |
margin-right: -120px;
|
assets/js/admin.min.js
CHANGED
@@ -1,3 +1,75 @@
|
|
1 |
-
var baldrickTriggers,loop_loader;jQuery(document).ready(function(a){baldrickTriggers=function(){a(".ajax-trigger").baldrick({request:ajaxurl,method:"POST",complete:function(){a(".init_field_type[data-type]").each(function(b,c){var d=a(c);"function"==typeof window[d.data("type")+"_init"]&&window[d.data("type")+"_init"](d.prop("id"),d[0])})}})},loop_loader=function(){var c=Math.round(1e7*Math.random());return{__id__:c}},baldrickTriggers(),a("body").on("click",".modal-side-tab",function(b){b.preventDefault();var c=a(this),d=c.closest(".caldera-modal-body"),e=d.find(".tab-detail-panel"),f=a(c.attr("href"));d.find(".modal-side-tab.active").removeClass("active"),c.addClass("active"),e.hide(),f.show()}),a("body").on("click",".caldera-group-remover",function(b){b.preventDefault();var c=a(this),d=c.closest(".caldera-repeater-group");d.slideUp(200,function(){d.remove()})}),a("body").on("click",".form-delete a.form-control",function(b){var c=a(this);confirm(c.data("confirm"))||b.preventDefault()})}),function(a,b){"function"==typeof define&&define.amd?define([],b):"object"==typeof exports?module.exports=b():a.Handlebars=a.Handlebars||b()}(this,function(){var a=function(){"use strict";function b(a){this.string=a}var a;return b.prototype.toString=function(){return""+this.string},a=b}(),b=function(a){"use strict";function g(a){return d[a]}function h(a){for(var b=1;b<arguments.length;b++)for(var c in arguments[b])Object.prototype.hasOwnProperty.call(arguments[b],c)&&(a[c]=arguments[b][c]);return a}function l(a){return a instanceof c?a.toString():null==a?"":a?(a=""+a,f.test(a)?a.replace(e,g):a):a+""}function m(a){return a||0===a?k(a)&&0===a.length?!0:!1:!0}function n(a,b){return(a?a+".":"")+b}var b={},c=a,d={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},e=/[&<>"'`]/g,f=/[&<>"'`]/;b.extend=h;var i=Object.prototype.toString;b.toString=i;var j=function(a){return"function"==typeof a};j(/x/)&&(j=function(a){return"function"==typeof a&&"[object Function]"===i.call(a)});var j;b.isFunction=j;var k=Array.isArray||function(a){return a&&"object"==typeof a?"[object Array]"===i.call(a):!1};return b.isArray=k,b.escapeExpression=l,b.isEmpty=m,b.appendContextPath=n,b}(a),c=function(){"use strict";function c(a,c){var d;c&&c.firstLine&&(d=c.firstLine,a+=" - "+d+":"+c.firstColumn);for(var e=Error.prototype.constructor.call(this,a),f=0;f<b.length;f++)this[b[f]]=e[b[f]];d&&(this.lineNumber=d,this.column=c.firstColumn)}var a,b=["description","fileName","lineNumber","message","name","number","stack"];return c.prototype=new Error,a=c}(),d=function(a,b){"use strict";function m(a,b){this.helpers=a||{},this.partials=b||{},n(this)}function n(a){a.registerHelper("helperMissing",function(){if(1===arguments.length)return void 0;throw new e("Missing helper: '"+arguments[arguments.length-1].name+"'")}),a.registerHelper("blockHelperMissing",function(b,c){var e=c.inverse,f=c.fn;if(b===!0)return f(this);if(b===!1||null==b)return e(this);if(i(b))return b.length>0?(c.ids&&(c.ids=[c.name]),a.helpers.each(b,c)):e(this);if(c.data&&c.ids){var g=q(c.data);g.contextPath=d.appendContextPath(c.data.contextPath,c.name),c={data:g}}return f(b,c)}),a.registerHelper("each",function(a,b){if(!b)throw new e("Must pass iterator to #each");var k,l,c=b.fn,f=b.inverse,g=0,h="";if(b.data&&b.ids&&(l=d.appendContextPath(b.data.contextPath,b.ids[0])+"."),j(a)&&(a=a.call(this)),b.data&&(k=q(b.data)),a&&"object"==typeof a)if(i(a))for(var m=a.length;m>g;g++)k&&(k.index=g,k.first=0===g,k.last=g===a.length-1,l&&(k.contextPath=l+g)),h+=c(a[g],{data:k});else for(var n in a)a.hasOwnProperty(n)&&(k&&(k.key=n,k.index=g,k.first=0===g,l&&(k.contextPath=l+n)),h+=c(a[n],{data:k}),g++);return 0===g&&(h=f(this)),h}),a.registerHelper("if",function(a,b){return j(a)&&(a=a.call(this)),!b.hash.includeZero&&!a||d.isEmpty(a)?b.inverse(this):b.fn(this)}),a.registerHelper("unless",function(b,c){return a.helpers["if"].call(this,b,{fn:c.inverse,inverse:c.fn,hash:c.hash})}),a.registerHelper("with",function(a,b){j(a)&&(a=a.call(this));var c=b.fn;if(d.isEmpty(a))return b.inverse(this);if(b.data&&b.ids){var e=q(b.data);e.contextPath=d.appendContextPath(b.data.contextPath,b.ids[0]),b={data:e}}return c(a,b)}),a.registerHelper("log",function(b,c){var d=c.data&&null!=c.data.level?parseInt(c.data.level,10):1;a.log(d,b)}),a.registerHelper("lookup",function(a,b){return a&&a[b]})}var c={},d=a,e=b,f="2.0.0";c.VERSION=f;var g=6;c.COMPILER_REVISION=g;var h={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1"};c.REVISION_CHANGES=h;var i=d.isArray,j=d.isFunction,k=d.toString,l="[object Object]";c.HandlebarsEnvironment=m,m.prototype={constructor:m,logger:o,log:p,registerHelper:function(a,b){if(k.call(a)===l){if(b)throw new e("Arg not supported with multiple helpers");d.extend(this.helpers,a)}else this.helpers[a]=b},unregisterHelper:function(a){delete this.helpers[a]},registerPartial:function(a,b){k.call(a)===l?d.extend(this.partials,a):this.partials[a]=b},unregisterPartial:function(a){delete this.partials[a]}};var o={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(a,b){if(o.level<=a){var c=o.methodMap[a];"undefined"!=typeof console&&console[c]&&console[c].call(console,b)}}};c.logger=o;var p=o.log;c.log=p;var q=function(a){var b=d.extend({},a);return b._parent=a,b};return c.createFrame=q,c}(b,c),e=function(a,b,c){"use strict";function j(a){var b=a&&a[0]||1,c=g;if(b!==c){if(c>b){var d=h[c],e=h[b];throw new f("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+d+") or downgrade your runtime to an older version ("+e+").")}throw new f("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+a[1]+").")}}function k(a,b){if(!b)throw new f("No environment passed to template");if(!a||!a.main)throw new f("Unknown template object: "+typeof a);b.VM.checkRevision(a.compiler);var c=function(c,d,g,h,i,j,k,l,m){i&&(h=e.extend({},h,i));var n=b.VM.invokePartial.call(this,c,g,h,j,k,l,m);if(null==n&&b.compile){var o={helpers:j,partials:k,data:l,depths:m};k[g]=b.compile(c,{data:void 0!==l,compat:a.compat},b),n=k[g](h,o)}if(null!=n){if(d){for(var p=n.split("\n"),q=0,r=p.length;r>q&&(p[q]||q+1!==r);q++)p[q]=d+p[q];n=p.join("\n")}return n}throw new f("The partial "+g+" could not be compiled when running in runtime-only mode")},d={lookup:function(a,b){for(var c=a.length,d=0;c>d;d++)if(a[d]&&null!=a[d][b])return a[d][b]},lambda:function(a,b){return"function"==typeof a?a.call(b):a},escapeExpression:e.escapeExpression,invokePartial:c,fn:function(b){return a[b]},programs:[],program:function(a,b,c){var d=this.programs[a],e=this.fn(a);return b||c?d=l(this,a,e,b,c):d||(d=this.programs[a]=l(this,a,e)),d},data:function(a,b){for(;a&&b--;)a=a._parent;return a},merge:function(a,b){var c=a||b;return a&&b&&a!==b&&(c=e.extend({},b,a)),c},noop:b.VM.noop,compilerInfo:a.compiler},g=function(b,c){c=c||{};var e=c.data;g._setup(c),!c.partial&&a.useData&&(e=o(b,e));var f;return a.useDepths&&(f=c.depths?[b].concat(c.depths):[b]),a.main.call(d,b,d.helpers,d.partials,e,f)};return g.isTop=!0,g._setup=function(c){c.partial?(d.helpers=c.helpers,d.partials=c.partials):(d.helpers=d.merge(c.helpers,b.helpers),a.usePartial&&(d.partials=d.merge(c.partials,b.partials)))},g._child=function(b,c,e){if(a.useDepths&&!e)throw new f("must pass parent depths");return l(d,b,a[b],c,e)},g}function l(a,b,c,d,e){var f=function(b,f){return f=f||{},c.call(a,b,a.helpers,a.partials,f.data||d,e&&[b].concat(e))};return f.program=b,f.depth=e?e.length:0,f}function m(a,b,c,d,e,g,h){var i={partial:!0,helpers:d,partials:e,data:g,depths:h};if(void 0===a)throw new f("The partial "+b+" could not be found");return a instanceof Function?a(c,i):void 0}function n(){return""}function o(a,b){return b&&"root"in b||(b=b?i(b):{},b.root=a),b}var d={},e=a,f=b,g=c.COMPILER_REVISION,h=c.REVISION_CHANGES,i=c.createFrame;return d.checkRevision=j,d.template=k,d.program=l,d.invokePartial=m,d.noop=n,d}(b,c,d),f=function(a,b,c,d,e){"use strict";var f,g=a,h=b,i=c,j=d,k=e,l=function(){var a=new g.HandlebarsEnvironment;return j.extend(a,g),a.SafeString=h,a.Exception=i,a.Utils=j,a.escapeExpression=j.escapeExpression,a.VM=k,a.template=function(b){return k.template(b,a)},a},m=l();return m.create=l,m["default"]=m,f=m}(d,a,c,b,e),g=function(a){"use strict";function d(a){a=a||{},this.firstLine=a.first_line,this.firstColumn=a.first_column,this.lastColumn=a.last_column,this.lastLine=a.last_line}var b,c=a,e={ProgramNode:function(a,b,c){d.call(this,c),this.type="program",this.statements=a,this.strip=b},MustacheNode:function(a,b,c,f,g){if(d.call(this,g),this.type="mustache",this.strip=f,null!=c&&c.charAt){var h=c.charAt(3)||c.charAt(2);this.escaped="{"!==h&&"&"!==h}else this.escaped=!!c;this.sexpr=a instanceof e.SexprNode?a:new e.SexprNode(a,b),this.id=this.sexpr.id,this.params=this.sexpr.params,this.hash=this.sexpr.hash,this.eligibleHelper=this.sexpr.eligibleHelper,this.isHelper=this.sexpr.isHelper},SexprNode:function(a,b,c){d.call(this,c),this.type="sexpr",this.hash=b;var e=this.id=a[0],f=this.params=a.slice(1);this.isHelper=!(!f.length&&!b),this.eligibleHelper=this.isHelper||e.isSimple},PartialNode:function(a,b,c,e,f){d.call(this,f),this.type="partial",this.partialName=a,this.context=b,this.hash=c,this.strip=e,this.strip.inlineStandalone=!0},BlockNode:function(a,b,c,e,f){d.call(this,f),this.type="block",this.mustache=a,this.program=b,this.inverse=c,this.strip=e,c&&!b&&(this.isInverse=!0)},RawBlockNode:function(a,b,f,g){if(d.call(this,g),a.sexpr.id.original!==f)throw new c(a.sexpr.id.original+" doesn't match "+f,this);b=new e.ContentNode(b,g),this.type="block",this.mustache=a,this.program=new e.ProgramNode([b],{},g)},ContentNode:function(a,b){d.call(this,b),this.type="content",this.original=this.string=a},HashNode:function(a,b){d.call(this,b),this.type="hash",this.pairs=a},IdNode:function(a,b){d.call(this,b),this.type="ID";for(var e="",f=[],g=0,h="",i=0,j=a.length;j>i;i++){var k=a[i].part;if(e+=(a[i].separator||"")+k,".."===k||"."===k||"this"===k){if(f.length>0)throw new c("Invalid path: "+e,this);".."===k?(g++,h+="../"):this.isScoped=!0}else f.push(k)}this.original=e,this.parts=f,this.string=f.join("."),this.depth=g,this.idName=h+this.string,this.isSimple=1===a.length&&!this.isScoped&&0===g,this.stringModeValue=this.string},PartialNameNode:function(a,b){d.call(this,b),this.type="PARTIAL_NAME",this.name=a.original},DataNode:function(a,b){d.call(this,b),this.type="DATA",this.id=a,this.stringModeValue=a.stringModeValue,this.idName="@"+a.stringModeValue},StringNode:function(a,b){d.call(this,b),this.type="STRING",this.original=this.string=this.stringModeValue=a},NumberNode:function(a,b){d.call(this,b),this.type="NUMBER",this.original=this.number=a,this.stringModeValue=Number(a)},BooleanNode:function(a,b){d.call(this,b),this.type="BOOLEAN",this.bool=a,this.stringModeValue="true"===a},CommentNode:function(a,b){d.call(this,b),this.type="comment",this.comment=a,this.strip={inlineStandalone:!0}}};return b=e}(c),h=function(){"use strict";var a,b=function(){function c(){this.yy={}}var a={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,program_repetition0:6,statement:7,mustache:8,block:9,rawBlock:10,partial:11,CONTENT:12,COMMENT:13,openRawBlock:14,END_RAW_BLOCK:15,OPEN_RAW_BLOCK:16,sexpr:17,CLOSE_RAW_BLOCK:18,openBlock:19,block_option0:20,closeBlock:21,openInverse:22,block_option1:23,OPEN_BLOCK:24,CLOSE:25,OPEN_INVERSE:26,inverseAndProgram:27,INVERSE:28,OPEN_ENDBLOCK:29,path:30,OPEN:31,OPEN_UNESCAPED:32,CLOSE_UNESCAPED:33,OPEN_PARTIAL:34,partialName:35,param:36,partial_option0:37,partial_option1:38,sexpr_repetition0:39,sexpr_option0:40,dataName:41,STRING:42,NUMBER:43,BOOLEAN:44,OPEN_SEXPR:45,CLOSE_SEXPR:46,hash:47,hash_repetition_plus0:48,hashSegment:49,ID:50,EQUALS:51,DATA:52,pathSegments:53,SEP:54,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",12:"CONTENT",13:"COMMENT",15:"END_RAW_BLOCK",16:"OPEN_RAW_BLOCK",18:"CLOSE_RAW_BLOCK",24:"OPEN_BLOCK",25:"CLOSE",26:"OPEN_INVERSE",28:"INVERSE",29:"OPEN_ENDBLOCK",31:"OPEN",32:"OPEN_UNESCAPED",33:"CLOSE_UNESCAPED",34:"OPEN_PARTIAL",42:"STRING",43:"NUMBER",44:"BOOLEAN",45:"OPEN_SEXPR",46:"CLOSE_SEXPR",50:"ID",51:"EQUALS",52:"DATA",54:"SEP"},productions_:[0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[10,3],[14,3],[9,4],[9,4],[19,3],[22,3],[27,2],[21,3],[8,3],[8,3],[11,5],[11,4],[17,3],[17,1],[36,1],[36,1],[36,1],[36,1],[36,1],[36,3],[47,1],[49,3],[35,1],[35,1],[35,1],[41,2],[30,1],[53,3],[53,1],[6,0],[6,2],[20,0],[20,1],[23,0],[23,1],[37,0],[37,1],[38,0],[38,1],[39,0],[39,2],[40,0],[40,1],[48,1],[48,2]],performAction:function(a,b,c,d,e,f){var h=f.length-1;switch(e){case 1:return d.prepareProgram(f[h-1].statements,!0),f[h-1];case 2:this.$=new d.ProgramNode(d.prepareProgram(f[h]),{},this._$);break;case 3:this.$=f[h];break;case 4:this.$=f[h];break;case 5:this.$=f[h];break;case 6:this.$=f[h];break;case 7:this.$=new d.ContentNode(f[h],this._$);break;case 8:this.$=new d.CommentNode(f[h],this._$);break;case 9:this.$=new d.RawBlockNode(f[h-2],f[h-1],f[h],this._$);break;case 10:this.$=new d.MustacheNode(f[h-1],null,"","",this._$);break;case 11:this.$=d.prepareBlock(f[h-3],f[h-2],f[h-1],f[h],!1,this._$);break;case 12:this.$=d.prepareBlock(f[h-3],f[h-2],f[h-1],f[h],!0,this._$);break;case 13:this.$=new d.MustacheNode(f[h-1],null,f[h-2],d.stripFlags(f[h-2],f[h]),this._$);break;case 14:this.$=new d.MustacheNode(f[h-1],null,f[h-2],d.stripFlags(f[h-2],f[h]),this._$);break;case 15:this.$={strip:d.stripFlags(f[h-1],f[h-1]),program:f[h]};break;case 16:this.$={path:f[h-1],strip:d.stripFlags(f[h-2],f[h])};break;case 17:this.$=new d.MustacheNode(f[h-1],null,f[h-2],d.stripFlags(f[h-2],f[h]),this._$);break;case 18:this.$=new d.MustacheNode(f[h-1],null,f[h-2],d.stripFlags(f[h-2],f[h]),this._$);break;case 19:this.$=new d.PartialNode(f[h-3],f[h-2],f[h-1],d.stripFlags(f[h-4],f[h]),this._$);break;case 20:this.$=new d.PartialNode(f[h-2],void 0,f[h-1],d.stripFlags(f[h-3],f[h]),this._$);break;case 21:this.$=new d.SexprNode([f[h-2]].concat(f[h-1]),f[h],this._$);break;case 22:this.$=new d.SexprNode([f[h]],null,this._$);break;case 23:this.$=f[h];break;case 24:this.$=new d.StringNode(f[h],this._$);break;case 25:this.$=new d.NumberNode(f[h],this._$);break;case 26:this.$=new d.BooleanNode(f[h],this._$);break;case 27:this.$=f[h];break;case 28:f[h-1].isHelper=!0,this.$=f[h-1];break;case 29:this.$=new d.HashNode(f[h],this._$);break;case 30:this.$=[f[h-2],f[h]];break;case 31:this.$=new d.PartialNameNode(f[h],this._$);break;case 32:this.$=new d.PartialNameNode(new d.StringNode(f[h],this._$),this._$);break;case 33:this.$=new d.PartialNameNode(new d.NumberNode(f[h],this._$));break;case 34:this.$=new d.DataNode(f[h],this._$);break;case 35:this.$=new d.IdNode(f[h],this._$);break;case 36:f[h-2].push({part:f[h],separator:f[h-1]}),this.$=f[h-2];break;case 37:this.$=[{part:f[h]}];break;case 38:this.$=[];break;case 39:f[h-1].push(f[h]);break;case 48:this.$=[];break;case 49:f[h-1].push(f[h]);break;case 52:this.$=[f[h]];break;case 53:f[h-1].push(f[h])}},table:[{3:1,4:2,5:[2,38],6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],31:[2,38],32:[2,38],34:[2,38]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:[1,10],13:[1,11],14:16,16:[1,20],19:14,22:15,24:[1,18],26:[1,19],28:[2,2],29:[2,2],31:[1,12],32:[1,13],34:[1,17]},{1:[2,1]},{5:[2,39],12:[2,39],13:[2,39],16:[2,39],24:[2,39],26:[2,39],28:[2,39],29:[2,39],31:[2,39],32:[2,39],34:[2,39]},{5:[2,3],12:[2,3],13:[2,3],16:[2,3],24:[2,3],26:[2,3],28:[2,3],29:[2,3],31:[2,3],32:[2,3],34:[2,3]},{5:[2,4],12:[2,4],13:[2,4],16:[2,4],24:[2,4],26:[2,4],28:[2,4],29:[2,4],31:[2,4],32:[2,4],34:[2,4]},{5:[2,5],12:[2,5],13:[2,5],16:[2,5],24:[2,5],26:[2,5],28:[2,5],29:[2,5],31:[2,5],32:[2,5],34:[2,5]},{5:[2,6],12:[2,6],13:[2,6],16:[2,6],24:[2,6],26:[2,6],28:[2,6],29:[2,6],31:[2,6],32:[2,6],34:[2,6]},{5:[2,7],12:[2,7],13:[2,7],16:[2,7],24:[2,7],26:[2,7],28:[2,7],29:[2,7],31:[2,7],32:[2,7],34:[2,7]},{5:[2,8],12:[2,8],13:[2,8],16:[2,8],24:[2,8],26:[2,8],28:[2,8],29:[2,8],31:[2,8],32:[2,8],34:[2,8]},{17:21,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:27,30:22,41:23,50:[1,26],52:[1,25],53:24},{4:28,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],28:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{4:29,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],28:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{12:[1,30]},{30:32,35:31,42:[1,33],43:[1,34],50:[1,26],53:24},{17:35,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:36,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:37,30:22,41:23,50:[1,26],52:[1,25],53:24},{25:[1,38]},{18:[2,48],25:[2,48],33:[2,48],39:39,42:[2,48],43:[2,48],44:[2,48],45:[2,48],46:[2,48],50:[2,48],52:[2,48]},{18:[2,22],25:[2,22],33:[2,22],46:[2,22]},{18:[2,35],25:[2,35],33:[2,35],42:[2,35],43:[2,35],44:[2,35],45:[2,35],46:[2,35],50:[2,35],52:[2,35],54:[1,40]},{30:41,50:[1,26],53:24},{18:[2,37],25:[2,37],33:[2,37],42:[2,37],43:[2,37],44:[2,37],45:[2,37],46:[2,37],50:[2,37],52:[2,37],54:[2,37]},{33:[1,42]},{20:43,27:44,28:[1,45],29:[2,40]},{23:46,27:47,28:[1,45],29:[2,42]},{15:[1,48]},{25:[2,46],30:51,36:49,38:50,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],47:57,48:58,49:60,50:[1,59],52:[1,25],53:24},{25:[2,31],42:[2,31],43:[2,31],44:[2,31],45:[2,31],50:[2,31],52:[2,31]},{25:[2,32],42:[2,32],43:[2,32],44:[2,32],45:[2,32],50:[2,32],52:[2,32]},{25:[2,33],42:[2,33],43:[2,33],44:[2,33],45:[2,33],50:[2,33],52:[2,33]},{25:[1,61]},{25:[1,62]},{18:[1,63]},{5:[2,17],12:[2,17],13:[2,17],16:[2,17],24:[2,17],26:[2,17],28:[2,17],29:[2,17],31:[2,17],32:[2,17],34:[2,17]},{18:[2,50],25:[2,50],30:51,33:[2,50],36:65,40:64,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],46:[2,50],47:66,48:58,49:60,50:[1,59],52:[1,25],53:24},{50:[1,67]},{18:[2,34],25:[2,34],33:[2,34],42:[2,34],43:[2,34],44:[2,34],45:[2,34],46:[2,34],50:[2,34],52:[2,34]},{5:[2,18],12:[2,18],13:[2,18],16:[2,18],24:[2,18],26:[2,18],28:[2,18],29:[2,18],31:[2,18],32:[2,18],34:[2,18]},{21:68,29:[1,69]},{29:[2,41]},{4:70,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{21:71,29:[1,69]},{29:[2,43]},{5:[2,9],12:[2,9],13:[2,9],16:[2,9],24:[2,9],26:[2,9],28:[2,9],29:[2,9],31:[2,9],32:[2,9],34:[2,9]},{25:[2,44],37:72,47:73,48:58,49:60,50:[1,74]},{25:[1,75]},{18:[2,23],25:[2,23],33:[2,23],42:[2,23],43:[2,23],44:[2,23],45:[2,23],46:[2,23],50:[2,23],52:[2,23]},{18:[2,24],25:[2,24],33:[2,24],42:[2,24],43:[2,24],44:[2,24],45:[2,24],46:[2,24],50:[2,24],52:[2,24]},{18:[2,25],25:[2,25],33:[2,25],42:[2,25],43:[2,25],44:[2,25],45:[2,25],46:[2,25],50:[2,25],52:[2,25]},{18:[2,26],25:[2,26],33:[2,26],42:[2,26],43:[2,26],44:[2,26],45:[2,26],46:[2,26],50:[2,26],52:[2,26]},{18:[2,27],25:[2,27],33:[2,27],42:[2,27],43:[2,27],44:[2,27],45:[2,27],46:[2,27],50:[2,27],52:[2,27]},{17:76,30:22,41:23,50:[1,26],52:[1,25],53:24},{25:[2,47]},{18:[2,29],25:[2,29],33:[2,29],46:[2,29],49:77,50:[1,74]},{18:[2,37],25:[2,37],33:[2,37],42:[2,37],43:[2,37],44:[2,37],45:[2,37],46:[2,37],50:[2,37],51:[1,78],52:[2,37],54:[2,37]},{18:[2,52],25:[2,52],33:[2,52],46:[2,52],50:[2,52]},{12:[2,13],13:[2,13],16:[2,13],24:[2,13],26:[2,13],28:[2,13],29:[2,13],31:[2,13],32:[2,13],34:[2,13]},{12:[2,14],13:[2,14],16:[2,14],24:[2,14],26:[2,14],28:[2,14],29:[2,14],31:[2,14],32:[2,14],34:[2,14]},{12:[2,10]},{18:[2,21],25:[2,21],33:[2,21],46:[2,21]},{18:[2,49],25:[2,49],33:[2,49],42:[2,49],43:[2,49],44:[2,49],45:[2,49],46:[2,49],50:[2,49],52:[2,49]},{18:[2,51],25:[2,51],33:[2,51],46:[2,51]},{18:[2,36],25:[2,36],33:[2,36],42:[2,36],43:[2,36],44:[2,36],45:[2,36],46:[2,36],50:[2,36],52:[2,36],54:[2,36]},{5:[2,11],12:[2,11],13:[2,11],16:[2,11],24:[2,11],26:[2,11],28:[2,11],29:[2,11],31:[2,11],32:[2,11],34:[2,11]},{30:79,50:[1,26],53:24},{29:[2,15]},{5:[2,12],12:[2,12],13:[2,12],16:[2,12],24:[2,12],26:[2,12],28:[2,12],29:[2,12],31:[2,12],32:[2,12],34:[2,12]},{25:[1,80]},{25:[2,45]},{51:[1,78]},{5:[2,20],12:[2,20],13:[2,20],16:[2,20],24:[2,20],26:[2,20],28:[2,20],29:[2,20],31:[2,20],32:[2,20],34:[2,20]},{46:[1,81]},{18:[2,53],25:[2,53],33:[2,53],46:[2,53],50:[2,53]},{30:51,36:82,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],50:[1,26],52:[1,25],53:24},{25:[1,83]},{5:[2,19],12:[2,19],13:[2,19],16:[2,19],24:[2,19],26:[2,19],28:[2,19],29:[2,19],31:[2,19],32:[2,19],34:[2,19]},{18:[2,28],25:[2,28],33:[2,28],42:[2,28],43:[2,28],44:[2,28],45:[2,28],46:[2,28],50:[2,28],52:[2,28]},{18:[2,30],25:[2,30],33:[2,30],46:[2,30],50:[2,30]},{5:[2,16],12:[2,16],13:[2,16],16:[2,16],24:[2,16],26:[2,16],28:[2,16],29:[2,16],31:[2,16],32:[2,16],34:[2,16]}],defaultActions:{4:[2,1],44:[2,41],47:[2,43],57:[2,47],63:[2,10],70:[2,15],73:[2,45]},parseError:function(a){throw new Error(a)},parse:function(a){function p(){var a;return a=b.lexer.lex()||1,"number"!=typeof a&&(a=b.symbols_[a]||a),a}var b=this,c=[0],d=[null],e=[],f=this.table,g="",h=0,i=0,j=0;this.lexer.setInput(a),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,"undefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc={});var m=this.lexer.yylloc;e.push(m);var n=this.lexer.options&&this.lexer.options.ranges;"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var q,r,s,t,v,x,y,z,A,w={};;){if(s=c[c.length-1],this.defaultActions[s]?t=this.defaultActions[s]:((null===q||"undefined"==typeof q)&&(q=p()),t=f[s]&&f[s][q]),"undefined"==typeof t||!t.length||!t[0]){var B="";if(!j){A=[];for(x in f[s])this.terminals_[x]&&x>2&&A.push("'"+this.terminals_[x]+"'");B=this.lexer.showPosition?"Parse error on line "+(h+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[q]||q)+"'":"Parse error on line "+(h+1)+": Unexpected "+(1==q?"end of input":"'"+(this.terminals_[q]||q)+"'"),this.parseError(B,{text:this.lexer.match,token:this.terminals_[q]||q,line:this.lexer.yylineno,loc:m,expected:A})}}if(t[0]instanceof Array&&t.length>1)throw new Error("Parse Error: multiple actions possible at state: "+s+", token: "+q);switch(t[0]){case 1:c.push(q),d.push(this.lexer.yytext),e.push(this.lexer.yylloc),c.push(t[1]),q=null,r?(q=r,r=null):(i=this.lexer.yyleng,g=this.lexer.yytext,h=this.lexer.yylineno,m=this.lexer.yylloc,j>0&&j--);break;case 2:if(y=this.productions_[t[1]][1],w.$=d[d.length-y],w._$={first_line:e[e.length-(y||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(y||1)].first_column,last_column:e[e.length-1].last_column},n&&(w._$.range=[e[e.length-(y||1)].range[0],e[e.length-1].range[1]]),v=this.performAction.call(w,g,i,h,this.yy,t[1],d,e),"undefined"!=typeof v)return v;y&&(c=c.slice(0,2*-1*y),d=d.slice(0,-1*y),e=e.slice(0,-1*y)),c.push(this.productions_[t[1]][0]),d.push(w.$),e.push(w._$),z=f[c[c.length-2]][c[c.length-1]],c.push(z);break;case 3:return!0}}return!0}},b=function(){var a={EOF:1,parseError:function(a,b){if(!this.yy.parser)throw new Error(a);this.yy.parser.parseError(a,b)},setInput:function(a){return this._input=a,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var b=a.match(/(?:\r\n?|\n).*/g);return b?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},unput:function(a){var b=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b-1),this.offset-=b;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var e=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===d.length?this.yylloc.first_column:0)+d[d.length-c.length].length-c[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[e[0],e[0]+this.yyleng-b]),this},more:function(){return this._more=!0,this},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=new Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+b+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d,f;this._more||(this.yytext="",this.match="");for(var g=this._currentRules(),h=0;h<g.length&&(c=this._input.match(this.rules[g[h]]),!c||b&&!(c[0].length>b[0].length)||(b=c,d=h,this.options.flex));h++);return b?(f=b[0].match(/(?:\r\n?|\n).*/g),f&&(this.yylineno+=f.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:f?f[f.length-1].length-f[f.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+b[0].length},this.yytext+=b[0],this.match+=b[0],this.matches=b,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(b[0].length),this.matched+=b[0],a=this.performAction.call(this,this.yy,this,g[d],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),a?a:void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var a=this.next();return"undefined"!=typeof a?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(a){this.begin(a)}};return a.options={},a.performAction=function(a,b,c,d){function e(a,c){return b.yytext=b.yytext.substr(a,b.yyleng-c)}switch(c){case 0:if("\\\\"===b.yytext.slice(-2)?(e(0,1),this.begin("mu")):"\\"===b.yytext.slice(-1)?(e(0,1),this.begin("emu")):this.begin("mu"),b.yytext)return 12;break;case 1:return 12;case 2:return this.popState(),12;case 3:return b.yytext=b.yytext.substr(5,b.yyleng-9),this.popState(),15;case 4:return 12;case 5:return e(0,4),this.popState(),13;case 6:return 45;case 7:return 46;case 8:return 16;case 9:return this.popState(),this.begin("raw"),18;case 10:return 34;case 11:return 24;case 12:return 29;case 13:return this.popState(),28;case 14:return this.popState(),28;case 15:return 26;case 16:return 26;case 17:return 32;case 18:return 31;case 19:this.popState(),this.begin("com");break;case 20:return e(3,5),this.popState(),13;case 21:return 31;case 22:return 51;case 23:return 50;case 24:return 50;case 25:return 54;case 26:break;case 27:return this.popState(),33;case 28:return this.popState(),25;case 29:return b.yytext=e(1,2).replace(/\\"/g,'"'),42;case 30:return b.yytext=e(1,2).replace(/\\'/g,"'"),42;case 31:return 52;case 32:return 44;case 33:return 44;case 34:return 43;case 35:return 50;case 36:return b.yytext=e(1,2),50;case 37:return"INVALID";case 38:return 5}},a.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{\/)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/],a.conditions={mu:{rules:[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[5],inclusive:!1},raw:{rules:[3,4],inclusive:!1},INITIAL:{rules:[0,1,38],inclusive:!0}},a}();return a.lexer=b,c.prototype=a,a.Parser=c,new c}();return a=b}(),i=function(a){"use strict";function d(a,b){return{left:"~"===a.charAt(2),right:"~"===b.charAt(b.length-3)}}function e(a,b,d,e,f,k){if(a.sexpr.id.original!==e.path.original)throw new c(a.sexpr.id.original+" doesn't match "+e.path.original,a);var l=d&&d.program,m={left:a.strip.left,right:e.strip.right,openStandalone:h(b.statements),closeStandalone:g((l||b).statements)};if(a.strip.right&&i(b.statements,null,!0),l){var n=d.strip;n.left&&j(b.statements,null,!0),n.right&&i(l.statements,null,!0),e.strip.left&&j(l.statements,null,!0),g(b.statements)&&h(l.statements)&&(j(b.statements),i(l.statements))}else e.strip.left&&j(b.statements,null,!0);return f?new this.BlockNode(a,l,b,m,k):new this.BlockNode(a,b,l,m,k)}function f(a,b){for(var c=0,d=a.length;d>c;c++){var e=a[c],f=e.strip;if(f){var k=g(a,c,b,"partial"===e.type),l=h(a,c,b),m=f.openStandalone&&k,n=f.closeStandalone&&l,o=f.inlineStandalone&&k&&l;f.right&&i(a,c,!0),f.left&&j(a,c,!0),o&&(i(a,c),j(a,c)&&"partial"===e.type&&(e.indent=/([ \t]+$)/.exec(a[c-1].original)?RegExp.$1:"")),m&&(i((e.program||e.inverse).statements),j(a,c)),n&&(i(a,c),j((e.inverse||e.program).statements))}}return a}function g(a,b,c){void 0===b&&(b=a.length);var d=a[b-1],e=a[b-2];return d?"content"===d.type?(e||!c?/\r?\n\s*?$/:/(^|\r?\n)\s*?$/).test(d.original):void 0:c}function h(a,b,c){void 0===b&&(b=-1);var d=a[b+1],e=a[b+2];return d?"content"===d.type?(e||!c?/^\s*?\r?\n/:/^\s*?(\r?\n|$)/).test(d.original):void 0:c}function i(a,b,c){var d=a[null==b?0:b+1];if(d&&"content"===d.type&&(c||!d.rightStripped)){var e=d.string;d.string=d.string.replace(c?/^\s+/:/^[ \t]*\r?\n?/,""),d.rightStripped=d.string!==e}}function j(a,b,c){var d=a[null==b?a.length-1:b-1];if(d&&"content"===d.type&&(c||!d.leftStripped)){var e=d.string;return d.string=d.string.replace(c?/\s+$/:/[ \t]+$/,""),d.leftStripped=d.string!==e,d.leftStripped}}var b={},c=a;return b.stripFlags=d,b.prepareBlock=e,b.prepareProgram=f,b}(c),j=function(a,b,c,d){"use strict";function k(a){return a.constructor===g.ProgramNode?a:(f.yy=j,f.parse(a))}var e={},f=a,g=b,h=c,i=d.extend;e.parser=f;var j={};return i(j,h,g),e.parse=k,e}(h,g,i,b),k=function(a,b){"use strict";function g(){}function h(a,b,c){if(null==a||"string"!=typeof a&&a.constructor!==c.AST.ProgramNode)throw new d("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+a);b=b||{},"data"in b||(b.data=!0),b.compat&&(b.useDepths=!0);var e=c.parse(a),f=(new c.Compiler).compile(e,b);return(new c.JavaScriptCompiler).compile(f,b)}function i(a,b,c){function f(){var d=c.parse(a),e=(new c.Compiler).compile(d,b),f=(new c.JavaScriptCompiler).compile(e,b,void 0,!0);return c.template(f)}if(null==a||"string"!=typeof a&&a.constructor!==c.AST.ProgramNode)throw new d("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+a);b=b||{},"data"in b||(b.data=!0),b.compat&&(b.useDepths=!0);var e,g=function(a,b){return e||(e=f()),e.call(this,a,b)};return g._setup=function(a){return e||(e=f()),e._setup(a)},g._child=function(a,b,c){return e||(e=f()),e._child(a,b,c)},g}function j(a,b){if(a===b)return!0;if(e(a)&&e(b)&&a.length===b.length){for(var c=0;c<a.length;c++)if(!j(a[c],b[c]))return!1;
|
2 |
-
return!0}}var c={},d=a,e=b.isArray,f=[].slice;return c.Compiler=g,g.prototype={compiler:g,equals:function(a){var b=this.opcodes.length;if(a.opcodes.length!==b)return!1;for(var c=0;b>c;c++){var d=this.opcodes[c],e=a.opcodes[c];if(d.opcode!==e.opcode||!j(d.args,e.args))return!1}for(b=this.children.length,c=0;b>c;c++)if(!this.children[c].equals(a.children[c]))return!1;return!0},guid:0,compile:function(a,b){this.opcodes=[],this.children=[],this.depths={list:[]},this.options=b,this.stringParams=b.stringParams,this.trackIds=b.trackIds;var c=this.options.knownHelpers;if(this.options.knownHelpers={helperMissing:!0,blockHelperMissing:!0,each:!0,"if":!0,unless:!0,"with":!0,log:!0,lookup:!0},c)for(var d in c)this.options.knownHelpers[d]=c[d];return this.accept(a)},accept:function(a){return this[a.type](a)},program:function(a){for(var b=a.statements,c=0,d=b.length;d>c;c++)this.accept(b[c]);return this.isSimple=1===d,this.depths.list=this.depths.list.sort(function(a,b){return a-b}),this},compileProgram:function(a){var d,b=(new this.compiler).compile(a,this.options),c=this.guid++;this.usePartial=this.usePartial||b.usePartial,this.children[c]=b;for(var e=0,f=b.depths.list.length;f>e;e++)d=b.depths.list[e],2>d||this.addDepth(d-1);return c},block:function(a){var b=a.mustache,c=a.program,d=a.inverse;c&&(c=this.compileProgram(c)),d&&(d=this.compileProgram(d));var e=b.sexpr,f=this.classifySexpr(e);"helper"===f?this.helperSexpr(e,c,d):"simple"===f?(this.simpleSexpr(e),this.opcode("pushProgram",c),this.opcode("pushProgram",d),this.opcode("emptyHash"),this.opcode("blockValue",e.id.original)):(this.ambiguousSexpr(e,c,d),this.opcode("pushProgram",c),this.opcode("pushProgram",d),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue")),this.opcode("append")},hash:function(a){var c,d,b=a.pairs;for(this.opcode("pushHash"),c=0,d=b.length;d>c;c++)this.pushParam(b[c][1]);for(;c--;)this.opcode("assignToHash",b[c][0]);this.opcode("popHash")},partial:function(a){var b=a.partialName;this.usePartial=!0,a.hash?this.accept(a.hash):this.opcode("push","undefined"),a.context?this.accept(a.context):(this.opcode("getContext",0),this.opcode("pushContext")),this.opcode("invokePartial",b.name,a.indent||""),this.opcode("append")},content:function(a){a.string&&this.opcode("appendContent",a.string)},mustache:function(a){this.sexpr(a.sexpr),a.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},ambiguousSexpr:function(a,b,c){var d=a.id,e=d.parts[0],f=null!=b||null!=c;this.opcode("getContext",d.depth),this.opcode("pushProgram",b),this.opcode("pushProgram",c),this.ID(d),this.opcode("invokeAmbiguous",e,f)},simpleSexpr:function(a){var b=a.id;"DATA"===b.type?this.DATA(b):b.parts.length?this.ID(b):(this.addDepth(b.depth),this.opcode("getContext",b.depth),this.opcode("pushContext")),this.opcode("resolvePossibleLambda")},helperSexpr:function(a,b,c){var e=this.setupFullMustacheParams(a,b,c),f=a.id,g=f.parts[0];if(this.options.knownHelpers[g])this.opcode("invokeKnownHelper",e.length,g);else{if(this.options.knownHelpersOnly)throw new d("You specified knownHelpersOnly, but used the unknown helper "+g,a);f.falsy=!0,this.ID(f),this.opcode("invokeHelper",e.length,f.original,f.isSimple)}},sexpr:function(a){var b=this.classifySexpr(a);"simple"===b?this.simpleSexpr(a):"helper"===b?this.helperSexpr(a):this.ambiguousSexpr(a)},ID:function(a){this.addDepth(a.depth),this.opcode("getContext",a.depth);var b=a.parts[0];b?this.opcode("lookupOnContext",a.parts,a.falsy,a.isScoped):this.opcode("pushContext")},DATA:function(a){this.options.data=!0,this.opcode("lookupData",a.id.depth,a.id.parts)},STRING:function(a){this.opcode("pushString",a.string)},NUMBER:function(a){this.opcode("pushLiteral",a.number)},BOOLEAN:function(a){this.opcode("pushLiteral",a.bool)},comment:function(){},opcode:function(a){this.opcodes.push({opcode:a,args:f.call(arguments,1)})},addDepth:function(a){0!==a&&(this.depths[a]||(this.depths[a]=!0,this.depths.list.push(a)))},classifySexpr:function(a){var b=a.isHelper,c=a.eligibleHelper,d=this.options;if(c&&!b){var e=a.id.parts[0];d.knownHelpers[e]?b=!0:d.knownHelpersOnly&&(c=!1)}return b?"helper":c?"ambiguous":"simple"},pushParams:function(a){for(var b=0,c=a.length;c>b;b++)this.pushParam(a[b])},pushParam:function(a){this.stringParams?(a.depth&&this.addDepth(a.depth),this.opcode("getContext",a.depth||0),this.opcode("pushStringParam",a.stringModeValue,a.type),"sexpr"===a.type&&this.sexpr(a)):(this.trackIds&&this.opcode("pushId",a.type,a.idName||a.stringModeValue),this.accept(a))},setupFullMustacheParams:function(a,b,c){var d=a.params;return this.pushParams(d),this.opcode("pushProgram",b),this.opcode("pushProgram",c),a.hash?this.hash(a.hash):this.opcode("emptyHash"),d}},c.precompile=h,c.compile=i,c}(c,b),l=function(a,b){"use strict";function g(a){this.value=a}function h(){}var c,d=a.COMPILER_REVISION,e=a.REVISION_CHANGES,f=b;h.prototype={nameLookup:function(a,b){return h.isValidJavaScriptVariableName(b)?a+"."+b:a+"['"+b+"']"},depthedLookup:function(a){return this.aliases.lookup="this.lookup",'lookup(depths, "'+a+'")'},compilerInfo:function(){var a=d,b=e[a];return[a,b]},appendToBuffer:function(a){return this.environment.isSimple?"return "+a+";":{appendToBuffer:!0,content:a,toString:function(){return"buffer += "+a+";"}}},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(a,b,c,d){this.environment=a,this.options=b,this.stringParams=this.options.stringParams,this.trackIds=this.options.trackIds,this.precompile=!d,this.name=this.environment.name,this.isChild=!!c,this.context=c||{programs:[],environments:[]},this.preamble(),this.stackSlot=0,this.stackVars=[],this.aliases={},this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.compileChildren(a,b),this.useDepths=this.useDepths||a.depths.list.length||this.options.compat;var g,h,i,e=a.opcodes;for(h=0,i=e.length;i>h;h++)g=e[h],this[g.opcode].apply(this,g.args);if(this.pushSource(""),this.stackSlot||this.inlineStack.length||this.compileStack.length)throw new f("Compile completed with content left on stack");var j=this.createFunctionContext(d);if(this.isChild)return j;var k={compiler:this.compilerInfo(),main:j},l=this.context.programs;for(h=0,i=l.length;i>h;h++)l[h]&&(k[h]=l[h]);return this.environment.usePartial&&(k.usePartial=!0),this.options.data&&(k.useData=!0),this.useDepths&&(k.useDepths=!0),this.options.compat&&(k.compat=!0),d||(k.compiler=JSON.stringify(k.compiler),k=this.objectLiteral(k)),k},preamble:function(){this.lastContext=0,this.source=[]},createFunctionContext:function(a){var b="",c=this.stackVars.concat(this.registers.list);c.length>0&&(b+=", "+c.join(", "));for(var d in this.aliases)this.aliases.hasOwnProperty(d)&&(b+=", "+d+"="+this.aliases[d]);var e=["depth0","helpers","partials","data"];this.useDepths&&e.push("depths");var f=this.mergeSource(b);return a?(e.push(f),Function.apply(this,e)):"function("+e.join(",")+") {\n "+f+"}"},mergeSource:function(a){for(var c,e,b="",d=!this.forceBuffer,f=0,g=this.source.length;g>f;f++){var h=this.source[f];h.appendToBuffer?c=c?c+"\n + "+h.content:h.content:(c&&(b?b+="buffer += "+c+";\n ":(e=!0,b=c+";\n "),c=void 0),b+=h+"\n ",this.environment.isSimple||(d=!1))}return d?(c||!b)&&(b+="return "+(c||'""')+";\n"):(a+=", buffer = "+(e?"":this.initializeBuffer()),b+=c?"return buffer + "+c+";\n":"return buffer;\n"),a&&(b="var "+a.substring(2)+(e?"":";\n ")+b),b},blockValue:function(a){this.aliases.blockHelperMissing="helpers.blockHelperMissing";var b=[this.contextName(0)];this.setupParams(a,0,b);var c=this.popStack();b.splice(1,0,c),this.push("blockHelperMissing.call("+b.join(", ")+")")},ambiguousBlockValue:function(){this.aliases.blockHelperMissing="helpers.blockHelperMissing";var a=[this.contextName(0)];this.setupParams("",0,a,!0),this.flushInline();var b=this.topStack();a.splice(1,0,b),this.pushSource("if (!"+this.lastHelper+") { "+b+" = blockHelperMissing.call("+a.join(", ")+"); }")},appendContent:function(a){this.pendingContent&&(a=this.pendingContent+a),this.pendingContent=a},append:function(){this.flushInline();var a=this.popStack();this.pushSource("if ("+a+" != null) { "+this.appendToBuffer(a)+" }"),this.environment.isSimple&&this.pushSource("else { "+this.appendToBuffer("''")+" }")},appendEscaped:function(){this.aliases.escapeExpression="this.escapeExpression",this.pushSource(this.appendToBuffer("escapeExpression("+this.popStack()+")"))},getContext:function(a){this.lastContext=a},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(a,b,c){var d=0,e=a.length;for(c||!this.options.compat||this.lastContext?this.pushContext():this.push(this.depthedLookup(a[d++]));e>d;d++)this.replaceStack(function(c){var e=this.nameLookup(c,a[d],"context");return b?" && "+e:" != null ? "+e+" : "+c})},lookupData:function(a,b){a?this.pushStackLiteral("this.data(data, "+a+")"):this.pushStackLiteral("data");for(var c=b.length,d=0;c>d;d++)this.replaceStack(function(a){return" && "+this.nameLookup(a,b[d],"data")})},resolvePossibleLambda:function(){this.aliases.lambda="this.lambda",this.push("lambda("+this.popStack()+", "+this.contextName(0)+")")},pushStringParam:function(a,b){this.pushContext(),this.pushString(b),"sexpr"!==b&&("string"==typeof a?this.pushString(a):this.pushStackLiteral(a))},emptyHash:function(){this.pushStackLiteral("{}"),this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}"))},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:[],types:[],contexts:[],ids:[]}},popHash:function(){var a=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push("{"+a.ids.join(",")+"}"),this.stringParams&&(this.push("{"+a.contexts.join(",")+"}"),this.push("{"+a.types.join(",")+"}")),this.push("{\n "+a.values.join(",\n ")+"\n }")},pushString:function(a){this.pushStackLiteral(this.quotedString(a))},push:function(a){return this.inlineStack.push(a),a},pushLiteral:function(a){this.pushStackLiteral(a)},pushProgram:function(a){null!=a?this.pushStackLiteral(this.programExpression(a)):this.pushStackLiteral(null)},invokeHelper:function(a,b,c){this.aliases.helperMissing="helpers.helperMissing";var d=this.popStack(),e=this.setupHelper(a,b),f=(c?e.name+" || ":"")+d+" || helperMissing";this.push("(("+f+").call("+e.callParams+"))")},invokeKnownHelper:function(a,b){var c=this.setupHelper(a,b);this.push(c.name+".call("+c.callParams+")")},invokeAmbiguous:function(a,b){this.aliases.functionType='"function"',this.aliases.helperMissing="helpers.helperMissing",this.useRegister("helper");var c=this.popStack();this.emptyHash();var d=this.setupHelper(0,a,b),e=this.lastHelper=this.nameLookup("helpers",a,"helper");this.push("((helper = (helper = "+e+" || "+c+") != null ? helper : helperMissing"+(d.paramsInit?"),("+d.paramsInit:"")+"),"+"(typeof helper === functionType ? helper.call("+d.callParams+") : helper))")},invokePartial:function(a,b){var c=[this.nameLookup("partials",a,"partial"),"'"+b+"'","'"+a+"'",this.popStack(),this.popStack(),"helpers","partials"];this.options.data?c.push("data"):this.options.compat&&c.push("undefined"),this.options.compat&&c.push("depths"),this.push("this.invokePartial("+c.join(", ")+")")},assignToHash:function(a){var c,d,e,b=this.popStack();this.trackIds&&(e=this.popStack()),this.stringParams&&(d=this.popStack(),c=this.popStack());var f=this.hash;c&&f.contexts.push("'"+a+"': "+c),d&&f.types.push("'"+a+"': "+d),e&&f.ids.push("'"+a+"': "+e),f.values.push("'"+a+"': ("+b+")")},pushId:function(a,b){"ID"===a||"DATA"===a?this.pushString(b):"sexpr"===a?this.pushStackLiteral("true"):this.pushStackLiteral("null")},compiler:h,compileChildren:function(a,b){for(var d,e,c=a.children,f=0,g=c.length;g>f;f++){d=c[f],e=new this.compiler;var h=this.matchExistingProgram(d);null==h?(this.context.programs.push(""),h=this.context.programs.length,d.index=h,d.name="program"+h,this.context.programs[h]=e.compile(d,b,this.context,!this.precompile),this.context.environments[h]=d,this.useDepths=this.useDepths||e.useDepths):(d.index=h,d.name="program"+h)}},matchExistingProgram:function(a){for(var b=0,c=this.context.environments.length;c>b;b++){var d=this.context.environments[b];if(d&&d.equals(a))return b}},programExpression:function(a){var b=this.environment.children[a],d=(b.depths.list,this.useDepths),f=[b.index,"data"];return d&&f.push("depths"),"this.program("+f.join(", ")+")"},useRegister:function(a){this.registers[a]||(this.registers[a]=!0,this.registers.list.push(a))},pushStackLiteral:function(a){return this.push(new g(a))},pushSource:function(a){this.pendingContent&&(this.source.push(this.appendToBuffer(this.quotedString(this.pendingContent))),this.pendingContent=void 0),a&&this.source.push(a)},pushStack:function(a){this.flushInline();var b=this.incrStack();return this.pushSource(b+" = "+a+";"),this.compileStack.push(b),b},replaceStack:function(a){var d,e,h,b="";if(this.isInline(),!this.isInline())throw new f("replaceStack on non-inline");var i=this.popStack(!0);if(i instanceof g)b=d=i.value,h=!0;else{e=!this.stackSlot;var j=e?this.incrStack():this.topStackName();b="("+this.push(j)+" = "+i+")",d=this.topStack()}var k=a.call(this,d);h||this.popStack(),e&&this.stackSlot--,this.push("("+b+k+")")},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var a=this.inlineStack;if(a.length){this.inlineStack=[];for(var b=0,c=a.length;c>b;b++){var d=a[b];d instanceof g?this.compileStack.push(d):this.pushStack(d)}}},isInline:function(){return this.inlineStack.length},popStack:function(a){var b=this.isInline(),c=(b?this.inlineStack:this.compileStack).pop();if(!a&&c instanceof g)return c.value;if(!b){if(!this.stackSlot)throw new f("Invalid stack pop");this.stackSlot--}return c},topStack:function(){var a=this.isInline()?this.inlineStack:this.compileStack,b=a[a.length-1];return b instanceof g?b.value:b},contextName:function(a){return this.useDepths&&a?"depths["+a+"]":"depth"+a},quotedString:function(a){return'"'+a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},objectLiteral:function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(this.quotedString(c)+":"+a[c]);return"{"+b.join(",")+"}"},setupHelper:function(a,b,c){var d=[],e=this.setupParams(b,a,d,c),f=this.nameLookup("helpers",b,"helper");return{params:d,paramsInit:e,name:f,callParams:[this.contextName(0)].concat(d).join(", ")}},setupOptions:function(a,b,c){var h,i,j,d={},e=[],f=[],g=[];d.name=this.quotedString(a),d.hash=this.popStack(),this.trackIds&&(d.hashIds=this.popStack()),this.stringParams&&(d.hashTypes=this.popStack(),d.hashContexts=this.popStack()),i=this.popStack(),j=this.popStack(),(j||i)&&(j||(j="this.noop"),i||(i="this.noop"),d.fn=j,d.inverse=i);for(var k=b;k--;)h=this.popStack(),c[k]=h,this.trackIds&&(g[k]=this.popStack()),this.stringParams&&(f[k]=this.popStack(),e[k]=this.popStack());return this.trackIds&&(d.ids="["+g.join(",")+"]"),this.stringParams&&(d.types="["+f.join(",")+"]",d.contexts="["+e.join(",")+"]"),this.options.data&&(d.data="data"),d},setupParams:function(a,b,c,d){var e=this.objectLiteral(this.setupOptions(a,b,c));return d?(this.useRegister("options"),c.push("options"),"options="+e):(c.push(e),"")}};for(var i="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "),j=h.RESERVED_WORDS={},k=0,l=i.length;l>k;k++)j[i[k]]=!0;return h.isValidJavaScriptVariableName=function(a){return!h.RESERVED_WORDS[a]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(a)},c=h}(d,c),m=function(a,b,c,d,e){"use strict";var f,g=a,h=b,i=c.parser,j=c.parse,k=d.Compiler,l=d.compile,m=d.precompile,n=e,o=g.create,p=function(){var a=o();return a.compile=function(b,c){return l(b,c,a)},a.precompile=function(b,c){return m(b,c,a)},a.AST=h,a.Compiler=k,a.JavaScriptCompiler=n,a.Parser=i,a.parse=j,a};return g=p(),g.create=p,g["default"]=g,f=g}(f,g,j,k,l);return m}),Handlebars.registerHelper("is_single",function(a,b){return 1!==Object.keys(a).length?!1:b.fn(this)}),Handlebars.registerHelper("script",function(a){return a.hash.src?'<script type="text/javascript" src="'+a.fn(this)+'"></script>':'<script type="text/javascript">'+a.fn(this)+"</script>"}),Handlebars.registerHelper("is",function(a,b){return"@key"===b.hash.value&&(b.hash.value=b.data.key),b.hash.value===a?b.fn(this):this[b.hash.value]&&this[b.hash.value]===a?b.fn(this):b.inverse(this)}),function(a){var b={},c={},d={_plugins:{},load:{},bind:{},event:function(a){return a},pre_filter:function(a){return a.data},filter:function(a){return a},target:function(a){if("string"==typeof a.params.success?"function"==typeof window[a.params.success]&&window[a.params.success](a):"function"==typeof a.params.success&&a.params.success(a),a.params.target)if(a.params.target.is("textarea,input")&&"object"==typeof a.data?a.params.target.val(JSON.stringify(a.data)).trigger("change"):a.params.target[a.params.targetInsert](a.data),"string"==typeof a.params.callback){if("function"==typeof window[a.params.callback])return window[a.params.callback](a)}else if("function"==typeof a.params.callback)return a.params.callback(a)},request_data:function(a){return a.data},request:function(d){if((d.params.trigger.data("cacheLocal")||d.params.trigger.data("cacheSession"))&&!d.params.trigger.data("cachePurge")){var e;if(d.params.trigger.data("cacheLocal")?e=d.params.trigger.data("cacheLocal"):d.params.trigger.data("cacheSession")&&(e=d.params.trigger.data("cacheSession")),"undefined"!=typeof b[e])return{data:b[e]};if("undefined"!=typeof Storage){var f;if(d.params.trigger.data("cacheLocal")?f=localStorage.getItem(e):d.params.trigger.data("cacheSession")&&(f=sessionStorage.getItem(e)),f){try{f=JSON.parse(f)}catch(g){f=f}return{data:f}}}}return c[d.params.trigger.prop("id")]&&c[d.params.trigger.prop("id")].abort(),c[d.params.trigger.prop("id")]=a.ajax(d.request),c[d.params.trigger.prop("id")]},request_complete:function(a){a.params.complete(a),a.params.loadElement.removeClass(a.params.loadClass),c[a.params.trigger.prop("id")]&&delete c[a.params.trigger.prop("id")]},request_error:function(a){a.params.error(a),a.params.complete(a.jqxhr,a.textStatus)},refresh:function(b,c){a(c.triggerClass).baldrick(c)}};a.fn.baldrick=function(b){var c=function(a,b,c){var d;for(var e in h.helpers._plugins)if("function"==typeof h.helpers._plugins[e][a]&&(d=h.helpers._plugins[e][a](b,h,c),"undefined"!=typeof d&&(b=d),b===!1))return!1;if("function"==typeof h.helpers[a]&&(d=h.helpers[a](b,h,c),"undefined"!=typeof d&&(b=d),!b))return!1;for(var f in h.helpers._plugins)if("function"==typeof h.helpers._plugins[f]["after_"+a]&&(d=h.helpers._plugins[f]["after_"+a](b,h,c),"undefined"!=typeof d&&(b=d),b===!1))return!1;return b},e=function(b){var c={},d=b.find("input,radio,checkbox,select,textarea,file"),f={};if(d.length){for(var g=0;g<d.length;g++)if(null!==d[g].getAttribute("name")){for(var h=a(d[g]),i=h.prop("name").replace(/\[/gi,":").replace(/\]/gi,""),j=i.split(":"),k=h.is(":checkbox,:radio")?h.filter(":checked").val():h.val(),l={},m=j.length-1;m>=0;m--){var n=j[m];if(0===n.length&&("undefined"==typeof f[j[m-1]]?f[j[m-1]]=0:f[j[m-1]]+=1,n=f[j[m-1]]),m===j.length-1)l[n]=k;else{var o=l;l={},l[n]=o}}a.extend(!0,c,l)}return c}},f=this.selector,g=this.not("._tisBound");g.addClass("_tisBound"),"undefined"!=typeof b&&"object"==typeof b.helper&&(d._plugins._params_helpers_=b.helper);var h=a.extend(!0,b,{helpers:d},{triggerClass:f}),i=function(){return!0},j={before:i,callback:!1,success:!1,complete:i,error:i};for(var l in j)"string"==typeof h[l]?j[l]="function"==typeof window[h[l]]?window[h[l]]:i:"function"==typeof h[l]&&(j[l]=h[l]);return g=c("bind",g),g===!1?this:c("ready",g.each(function(b){this.id||(this.id="baldrick_trigger_"+((new Date).getTime()+b));var d=a(this),f=d.data("event")?d.data("event"):h.event?h.event:d.is("form")?"submit":"click";return d.on(f,function(b){var d=a(c("event",this,b));if(d.data("for")){var i=a(d.data("for")),k=a.extend({},i.data(),d.data());return delete k["for"],i.data(k),i.is("form")?(i.submit(),this):i.trigger(i.data("event")?i.data("event"):f)}if(d.is("form")&&!d.data("request")&&d.attr("action")&&d.data("request",d.attr("action")),d.is("a")&&!d.data("request")&&d.attr("href")&&(d.attr("href").indexOf("#")<0?d.data("request",d.attr("href")):d.data("href",d.attr("href"))),(d.data("before")?"function"==typeof window[d.data("before")]?window[d.data("before")](this,b):j.before(this,b):j.before(this,b))!==!1){var l={trigger:d,callback:d.data("callback")?"function"==typeof window[d.data("callback")]?window[d.data("callback")]:d.data("callback"):j.callback,success:d.data("success")?"function"==typeof window[d.data("success")]?window[d.data("success")]:d.data("success"):j.success,method:d.data("method")?d.data("method"):d.attr("method")?d.attr("method"):h.method?h.method:"GET",dataType:d.data("type")?d.data("type"):h.dataType?h.dataType:!1,timeout:d.data("timeout")?d.data("timeout"):12e4,target:d.data("target")?"_parent"===d.data("target")?d.parent():"_self"===d.data("target")?a(d):a(d.data("target")):h.target?a(h.target):a("<html>"),targetInsert:d.data("targetInsert")?"replace"===d.data("targetInsert")?"replaceWith":d.data("targetInsert"):h.targetInsert?"replace"===h.targetInsert?"replaceWith":h.targetInsert:"html",loadClass:d.data("loadClass")?d.data("loadClass"):h.loadClass?h.loadClass:"loading",activeClass:d.data("activeClass")?d.data("activeClass"):h.activeClass?h.activeClass:"active",activeElement:d.data("activeElement")?"_parent"===d.data("activeElement")?d.parent():a(d.data("activeElement")):h.activeElement?"_parent"===h.activeElement?d.parent():a(h.activeElement):d,cache:d.data("cache")?d.data("cache"):h.cache?h.cache:!1,complete:d.data("complete")?"function"==typeof window[d.data("complete")]?window[d.data("complete")]:j.complete:j.complete,error:d.data("error")?"function"==typeof window[d.data("error")]?window[d.data("error")]:j.error:j.error,resultSelector:!1,event:f};if(l.url=d.data("request")?d.data("request"):h.request?h.request:l.callback,l.loadElement=d.data("loadElement")?"_parent"===d.data("loadElement")?d.parent():a(d.data("loadElement")):h.loadElement?a(h.loadElement)?a(h.loadElement):l.target:l.target,l=c("params",l),l===!1)return!1;if(b.preventDefault(),"function"==typeof window[l.url]){var m=window[l.url](l,f);return m=c("pre_filter",{data:m,params:l}),m=c("filter",{data:m,rawData:m,params:l}),c("target",m),c("refresh",{params:l}),c("request_complete",{jqxhr:null,textStatus:"complete",request:w,params:l}),this}try{if(a(l.url).length)var m=a(l.url).is("input,select,radio,checkbox,file,textarea")?a(l.url).val():a(l.url).is("form")?e(a(l.url)):a(l.url).html()}catch(b){}if("undefined"!=typeof m){if("json"===l.dataType)try{m=JSON.parse(m)}catch(b){}return m=c("pre_filter",{data:m,params:l}),m=c("filter",{data:m,rawData:m,params:l}),c("target",m),c("refresh",{params:l}),c("request_complete",{jqxhr:null,textStatus:"complete",request:w,params:l}),this}switch(typeof l.url){case"function":return l.url(this,b);case"boolean":case"object":return;case"string":if(l.url.indexOf(" ")>-1){var o=l.url.split(" ");l.url=o[0],l.resultSelector=o[1]}}d.data("group")?a('._tisBound[data-group="'+d.data("group")+'"]').each(function(){var b=a(this),c=b.data("activeElement")?"_parent"===b.data("activeElement")?b.parent():a(b.data("activeElement")):h.activeElement?"_parent"===h.activeElement?d.parent():a(h.activeElement):b;c.removeClass(b.data("activeClass")?b.data("activeClass"):h.activeClass?h.activeClass:l.activeClass)}):a("._tisBound:not([data-group])").each(function(){var b=a(this),c=b.data("activeElement")?"_parent"===b.data("activeElement")?b.parent():a(b.data("activeElement")):h.activeElement?"_parent"===h.activeElement?d.parent():a(h.activeElement):b;c.removeClass(b.data("activeClass")?b.data("activeClass"):h.activeClass?h.activeClass:l.activeClass)}),l.activeElement.addClass(l.activeClass),l.loadElement.addClass(l.loadClass);var q;if(FormData&&(d.is("input:file")||"POST"===l.method)){l.method="POST",l.contentType=!1,l.processData=!1,l.cache=!1,l.xhrFields={onprogress:function(a){a.lengthComputable}},q=d.is("form")?new FormData(d[0]):new FormData,d.is("input,select,textarea")&&d.data("_value",d.val());for(var r in l.trigger.data())q.append(r,l.trigger.data(r));if(l.data&&q.append("data",JSON.stringify(l.data)),d.is("input,select,textarea"))if(d.is("input:file"))if(d[0].files.length>1)for(var s=0;s<d[0].files.length;s++)q.append(d.prop("name"),d[0].files[s]);else q.append(d.prop("name"),d[0].files[0]);else d.is("input:checkbox")||d.is("input:radio")?d.prop("checked")&&q.append(d.prop("name"),d.val()):q.append(d.prop("name"),d.val())}else{var t=d.serializeArray(),u=l.trigger.data(),v=[];h.data&&(u=a.extend(h.data,u)),t.length&&(a.each(t,function(a,b){v.push(b)}),l.requestData=e(d)),l.data&&(u=a.extend(u,l.data)),q=u,l.requestData=a.extend(d.data(),l.requestData)}var w={url:l.url,data:c("request_data",{data:q,params:l}),cache:l.cache,timeout:l.timeout,type:l.method,success:function(b,d,e){if(l.resultSelector)if("object"==typeof b){for(var f=l.resultSelector.replace(/\[/g,".").replace(/\]/g,"").split("."),g=b,h=0;h<f.length;h++)g=g[f[h]];b=g}else if("string"==typeof b){var i=a(l.resultSelector,a("<html>").html(b));1===i.length?b=a("<html>").html(i).html():(b=a("<html>"),i.each(function(){b.append(this)}),b=b.html())}var j=b;if(l.trigger.data("cacheLocal")||l.trigger.data("cacheSession")){var k;if(l.trigger.data("cacheLocal")?k=l.trigger.data("cacheLocal"):l.trigger.data("cacheSession")&&(k=l.trigger.data("cacheSession")),"undefined"!=typeof Storage)if(l.trigger.data("cacheLocal"))try{localStorage.setItem(k,e.responseText)}catch(m){console.log(m)}else if(l.trigger.data("cacheSession"))try{sessionStorage.setItem(k,e.responseText)}catch(m){console.log(m)}a(window).trigger("baldrick.cache",k)}b=c("pre_filter",{data:b,request:w,params:l,xhr:e}),b=c("filter",{data:b,rawData:j,request:w,params:l,xhr:e}),c("target",b)},complete:function(a,b){c("request_complete",{jqxhr:a,textStatus:b,request:w,params:l}),c("refresh",{jqxhr:a,textStatus:b,request:w,params:l}),d.data("once")&&d.off(f).removeClass("_tisBound")},error:function(a,b,d){c("request_error",{jqxhr:a,textStatus:b,error:d,request:w,params:l})}};if(l.dataType&&(w.dataType=l.dataType),"undefined"!=typeof l.contentType&&(w.contentType=l.contentType),"undefined"!=typeof l.processData&&(w.processData=l.processData),"undefined"!=typeof l.xhrFields&&(w.xhrFields=l.xhrFields),w=c("request_params",w,l),w===!1)return g;var x=c("request",{request:w,params:l});if(x.data){var m=x.data;c("target",c("filter",c("pre_filter",{data:m,request:w,params:l}))),c("request_complete",{jqxhr:!1,textStatus:!0,request:w,params:l}),c("refresh",{jqxhr:!1,textStatus:!0,request:w,params:l})}}}),(d.data("autoload")||d.data("poll"))&&(d.data("delay")?setTimeout(function(a,b){return a.trigger(b)},d.data("delay"),d,f):d.trigger(f)),d.data("poll")&&(d.data("delay")?setTimeout(function(a,b){return setInterval(function(a,b){return a.trigger(b)},a.data("poll"),a,b)},d.data("delay")):setInterval(function(a,b){return a.trigger(b)},d.data("poll"),d,f)),this}))},a.fn.baldrick.cacheObject=function(a,c){b[a]=c},a.fn.baldrick.registerhelper=function(b,c,e){var f={};"object"==typeof c?(f[b]=c,d._plugins=a.extend(!0,f,d._plugins)):"string"==typeof c&&"string"==typeof b&&"function"==typeof e&&(f[c]={},f[c][b]=e,d._plugins=a.extend(!0,f,d._plugins))}}(jQuery),Handlebars.registerHelper("even",function(a){var b=a.data.index/2;return b===Math.ceil(b)?a.fn(this):!1}),Handlebars.registerHelper("odd",function(a){var b=a.data.index/2;return b===Math.ceil(b)?!1:a.fn(this)}),Handlebars.registerHelper("json",function(a){return JSON.stringify(a)}),function(a){var b={};a.fn.baldrick.registerhelper("handlebars",{bind:function(c){var e=c.filter("[data-template-url]");e.length&&e.each(function(){var c=a(this);if("undefined"==typeof b[c.data("templateUrl")]){if(b[c.data("templateUrl")]=!0,"undefined"!=typeof Storage){var d,e;c.data("cacheLocal")?(e=c.data("cacheLocal"),d=localStorage.getItem("handlebars_"+e)):c.data("cacheSession")&&(e=c.data("cacheSession"),d=sessionStorage.getItem("handlebars_"+e))}d?b[c.data("templateUrl")]=Handlebars.compile(d):a.get(c.data("templateUrl"),function(a,d,e){if("undefined"!=typeof Storage){var f;c.data("cacheLocal")?(f=c.data("cacheLocal"),localStorage.setItem("handlebars_"+f,e.responseText)):c.data("cacheSession")&&(f=c.data("cacheSession"),sessionStorage.setItem("handlebars_"+f,e.responseText))}b[c.data("templateUrl")]=Handlebars.compile(e.responseText)})}})},request_params:function(a,b,c){return(c.trigger.data("templateUrl")||c.trigger.data("template"))&&"object"==typeof Handlebars?(a.dataType="json",a):void 0},filter:function(c){return c.params.trigger.data("templateUrl")?"function"==typeof b[c.params.trigger.data("templateUrl")]&&(c.data=b[c.params.trigger.data("templateUrl")](c.data)):c.params.trigger.data("template")&&("function"==typeof b[c.params.trigger.data("template")]?c.data=b[c.params.trigger.data("template")](c.data):a(c.params.trigger.data("template"))&&(b[c.params.trigger.data("template")]=Handlebars.compile(a(c.params.trigger.data("template")).html()),c.data=b[c.params.trigger.data("template")](c.data))),c}})}(jQuery),function(a){var c=!1;a.fn.baldrick.registerhelper("wordpress_modal",{refresh:function(b){b.params.trigger.data("modalAutoclose")&&a("#"+b.params.trigger.data("modalAutoclose")+"_baldrickModalCloser").trigger("click")},event:function(b){var d=a(b),e="wm";if(d.data("modal")&&c===!1&&("true"!==d.data("modal")&&(e=d.data("modal")),!a("#"+e+"_baldrickModal").length)){var f=a("<div>",{id:e+"_baldrickModal",tabIndex:-1,"ariaLabelled-by":e+"_baldrickModalLable","class":"caldera-modal-wrap"}),g=a("<div>",{"class":"caldera-backdrop"});modalContent=a("<div>",{"class":"caldera-modal-body",id:e+"_baldrickModalBody"}),modalFooter=a("<div>",{"class":"caldera-modal-footer",id:e+"_baldrickModalFooter"}),modalHeader=a("<div>",{"class":"caldera-modal-title",id:e+"_baldrickModalTitle"}),modalCloser=a("<a>",{href:"#close","class":"caldera-modal-closer","data-dismiss":"modal","aria-hidden":"true",id:e+"_baldrickModalCloser"}).html("×"),modalTitle=a("<h3>",{"class":"modal-label",id:e+"_baldrickModalLable"}),modalHeader.append(modalCloser).append(modalTitle).appendTo(f),g.on("dismiss",function(b){b.preventDefault(),g.fadeOut(200),f.fadeOut(200,function(){a(this).remove(),g.remove()})}),modalCloser.on("click",function(b){b.preventDefault(),g.fadeOut(200),f.fadeOut(200,function(){a(this).remove(),g.remove()})}),modalContent.appendTo(f),modalFooter.appendTo(f),f.appendTo(a("body")).hide().fadeIn(200),g.insertBefore(f).hide().fadeIn(200)}},request_complete:function(b){if(b.params.trigger.data("modal")){var f,g,d="wm",e="loading";if("true"!==b.params.trigger.data("modal")&&(d=b.params.trigger.data("modal")),f=a("#"+d+"_baldrickModal"),g=a("#"+d+"_baldrickModalBody"),modalTitle=a("#"+d+"_baldrickModalTitle"),b.params.trigger.data("loadClass")&&(e=b.params.trigger.data("loadClass")),b.params.trigger.data("modalLife")){var h=parseFloat(b.params.trigger.data("modalLife"));h>0?setTimeout(function(){a("#"+d+"_baldrickModalCloser").trigger("click")},h):a("#"+d+"_baldrickModalCloser").trigger("click")}g.removeClass(e).show()}},after_filter:function(b){if(b.params.trigger.data("modal")&&b.params.trigger.data("targetInsert")){var c="wm";"true"!==b.params.trigger.data("modal")&&(c=b.params.trigger.data("modal"));var d=a(b.data).prop("id",c+"_baldrickModalBody");
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var baldrickTriggers, loop_loader;
|
2 |
+
|
3 |
+
jQuery(document).ready(function($){
|
4 |
+
|
5 |
+
// admin stuff!
|
6 |
+
// Baldrick Bindings
|
7 |
+
baldrickTriggers = function(){
|
8 |
+
$('.ajax-trigger').baldrick({
|
9 |
+
request : ajaxurl,
|
10 |
+
method : 'POST',
|
11 |
+
complete : function(){
|
12 |
+
// check for init function
|
13 |
+
$('.init_field_type[data-type]').each(function(k,v){
|
14 |
+
var ftype = $(v);
|
15 |
+
if( typeof window[ftype.data('type') + '_init'] === 'function' ){
|
16 |
+
window[ftype.data('type') + '_init'](ftype.prop('id'), ftype[0]);
|
17 |
+
}
|
18 |
+
});
|
19 |
+
}
|
20 |
+
});
|
21 |
+
};
|
22 |
+
|
23 |
+
// loop loader
|
24 |
+
loop_loader = function(params, ev){
|
25 |
+
var id = Math.round( ( Math.random() * 10000000 ) );
|
26 |
+
return { "__id__" : id };
|
27 |
+
};
|
28 |
+
|
29 |
+
baldrickTriggers();
|
30 |
+
|
31 |
+
|
32 |
+
// Profile TABS
|
33 |
+
$('body').on('click', '.modal-side-tab', function(e){
|
34 |
+
e.preventDefault();
|
35 |
+
var clicked = $(this),
|
36 |
+
parent = clicked.closest('.caldera-modal-body'),
|
37 |
+
panels = parent.find('.tab-detail-panel'),
|
38 |
+
panel = $(clicked.attr('href'));
|
39 |
+
|
40 |
+
parent.find('.modal-side-tab.active').removeClass('active');
|
41 |
+
clicked.addClass('active');
|
42 |
+
|
43 |
+
panels.hide();
|
44 |
+
panel.show();
|
45 |
+
});
|
46 |
+
|
47 |
+
// Profile Repeatable Group Remove
|
48 |
+
$('body').on('click', '.caldera-group-remover', function(e){
|
49 |
+
|
50 |
+
e.preventDefault();
|
51 |
+
|
52 |
+
var clicked = $(this),
|
53 |
+
parent = clicked.closest('.caldera-repeater-group');
|
54 |
+
|
55 |
+
parent.slideUp(200, function(){
|
56 |
+
parent.remove();
|
57 |
+
});
|
58 |
+
|
59 |
+
|
60 |
+
});
|
61 |
+
|
62 |
+
$('body').on('click', '.form-delete a.form-control', function(e){
|
63 |
+
var clicked = $(this);
|
64 |
+
if(confirm(clicked.data('confirm'))){
|
65 |
+
return;
|
66 |
+
}else{
|
67 |
+
e.preventDefault();
|
68 |
+
}
|
69 |
+
|
70 |
+
});
|
71 |
+
|
72 |
+
|
73 |
+
|
74 |
+
|
75 |
+
});
|
assets/js/conditionals.js
CHANGED
@@ -65,7 +65,7 @@
|
|
65 |
switch(lines[lid].compare) {
|
66 |
case 'is':
|
67 |
if(comparefield.length){
|
68 |
-
if(comparefield.indexOf(comparevalue) >= 0){
|
69 |
truelines[lid] = true;
|
70 |
}
|
71 |
}
|
65 |
switch(lines[lid].compare) {
|
66 |
case 'is':
|
67 |
if(comparefield.length){
|
68 |
+
if(comparefield.indexOf(comparevalue.toString()) >= 0){
|
69 |
truelines[lid] = true;
|
70 |
}
|
71 |
}
|
assets/js/conditionals.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(){function b(){for(var a in caldera_conditionals){var b=jQuery("#conditional_"+a);if(b.length){var c=caldera_conditionals[a].type,d=caldera_conditionals[a].group,e=[];for(var f in d){var g={},h=d[f];for(var i in h){var j=jQuery('[data-field="'+h[i].field+"_"+h[i].instance+'"]'),k=[],l="function"==typeof h[i].value?h[i].value():h[i].value;if(g[i]=!1,j.is(":radio,:checkbox")?j=j.filter(":checked"):j.is("div")&&(j=jQuery("<input>").val(j.html())),j.length)for(var m=0;m<j.length;m++)k.push(j[m].value);else k.push(h[i].field);switch(h[i].compare){case"is":k.length&&k.indexOf(l)>=0&&(g[i]=!0);break;case"isnot":k.length&&k.indexOf(l)<0&&(g[i]=!0);break;case">":parseFloat(k.reduce(function(a,b){return a+b}))>parseFloat(l)&&(g[i]=!0);break;case"<":parseFloat(k.reduce(function(a,b){return a+b}))<parseFloat(l)&&(g[i]=!0);break;case"startswith":for(var m=0;m<k.length;m++)k[m].toLowerCase().substr(0,l.toLowerCase().length)===l.toLowerCase()&&(g[i]=!0);break;case"endswith":for(var m=0;m<k.length;m++)k[m].toLowerCase().substr(k[m].toLowerCase().length-l.toLowerCase().length)===l.toLowerCase()&&(g[i]=!0);break;case"contains":for(var m=0;m<k.length;m++)k[m].toLowerCase().indexOf(l)>=0&&(g[i]=!0)}}istrue=!0;for(var n in g)if(g[n]===!1){istrue=!1;break}e.push(istrue)}var r,o=jQuery("#conditional-"+a+"-tmpl").html(),p=jQuery("#conditional_"+a),q=jQuery('[data-field="'+a+'"]');e.length&&e.indexOf(!0)>=0?"show"===c?r="show":"hide"===c?r="hide":"disable"===c&&(r="disable"):r="show"===c?"hide":"disable"===c?"enable":"show","show"===r?p.html().length||(p.html(o).trigger("cf.add"),jQuery(document).trigger("cf.add")):"hide"===r?p.html().length&&(q.val("").empty().prop("checked",!1),p.empty().trigger("cf.remove"),jQuery(document).trigger("cf.remove")):"enable"===r?p.html().length?q.prop("disabled",!1):(p.html(o).trigger("cf.add"),jQuery(document).trigger("cf.add")):"disable"===r&&(p.html().length?(q.prop("disabled","disabled"),jQuery(document).trigger("cf.disable")):(p.html(o).trigger("cf.add"),jQuery(document).trigger("cf.add"),jQuery('[data-field="'+a+'"]').prop("disabled","disabled")))}}}Array.prototype.indexOf||(Array.prototype.indexOf=function(a){var b=this.length>>>0,c=Number(arguments[1])||0;for(c=0>c?Math.ceil(c):Math.floor(c),0>c&&(c+=b);b>c;c++)if(c in this&&this[c]===a)return c;return-1}),"undefined"!=typeof caldera_conditionals&&(jQuery(".caldera_forms_form").on("change keyup","[data-field]",function(){b()}),b())}(jQuery);
|
1 |
+
!function(){function b(){for(var a in caldera_conditionals){var b=jQuery("#conditional_"+a);if(b.length){var c=caldera_conditionals[a].type,d=caldera_conditionals[a].group,e=[];for(var f in d){var g={},h=d[f];for(var i in h){var j=jQuery('[data-field="'+h[i].field+"_"+h[i].instance+'"]'),k=[],l="function"==typeof h[i].value?h[i].value():h[i].value;if(g[i]=!1,j.is(":radio,:checkbox")?j=j.filter(":checked"):j.is("div")&&(j=jQuery("<input>").val(j.html())),j.length)for(var m=0;m<j.length;m++)k.push(j[m].value);else k.push(h[i].field);switch(h[i].compare){case"is":k.length&&k.indexOf(l.toString())>=0&&(g[i]=!0);break;case"isnot":k.length&&k.indexOf(l)<0&&(g[i]=!0);break;case">":parseFloat(k.reduce(function(a,b){return a+b}))>parseFloat(l)&&(g[i]=!0);break;case"<":parseFloat(k.reduce(function(a,b){return a+b}))<parseFloat(l)&&(g[i]=!0);break;case"startswith":for(var m=0;m<k.length;m++)k[m].toLowerCase().substr(0,l.toLowerCase().length)===l.toLowerCase()&&(g[i]=!0);break;case"endswith":for(var m=0;m<k.length;m++)k[m].toLowerCase().substr(k[m].toLowerCase().length-l.toLowerCase().length)===l.toLowerCase()&&(g[i]=!0);break;case"contains":for(var m=0;m<k.length;m++)k[m].toLowerCase().indexOf(l)>=0&&(g[i]=!0)}}istrue=!0;for(var n in g)if(g[n]===!1){istrue=!1;break}e.push(istrue)}var r,o=jQuery("#conditional-"+a+"-tmpl").html(),p=jQuery("#conditional_"+a),q=jQuery('[data-field="'+a+'"]');e.length&&e.indexOf(!0)>=0?"show"===c?r="show":"hide"===c?r="hide":"disable"===c&&(r="disable"):r="show"===c?"hide":"disable"===c?"enable":"show","show"===r?p.html().length||(p.html(o).trigger("cf.add"),jQuery(document).trigger("cf.add")):"hide"===r?p.html().length&&(q.val("").empty().prop("checked",!1),p.empty().trigger("cf.remove"),jQuery(document).trigger("cf.remove")):"enable"===r?p.html().length?q.prop("disabled",!1):(p.html(o).trigger("cf.add"),jQuery(document).trigger("cf.add")):"disable"===r&&(p.html().length?(q.prop("disabled","disabled"),jQuery(document).trigger("cf.disable")):(p.html(o).trigger("cf.add"),jQuery(document).trigger("cf.add"),jQuery('[data-field="'+a+'"]').prop("disabled","disabled")))}}}Array.prototype.indexOf||(Array.prototype.indexOf=function(a){var b=this.length>>>0,c=Number(arguments[1])||0;for(c=0>c?Math.ceil(c):Math.floor(c),0>c&&(c+=b);b>c;c++)if(c in this&&this[c]===a)return c;return-1}),"undefined"!=typeof caldera_conditionals&&(jQuery(".caldera_forms_form").on("change keyup","[data-field]",function(){b()}),b())}(jQuery);
|
assets/js/edit.js
CHANGED
@@ -63,50 +63,15 @@ jQuery(document).ready(function($){
|
|
63 |
tinyMCE.triggerSave();
|
64 |
}
|
65 |
|
66 |
-
var
|
67 |
-
data_fields = $('.caldera-forms-options-form').find('input,radio,checkbox,select,textarea'),
|
68 |
-
objects = [],
|
69 |
-
arraynames = {};
|
70 |
-
|
71 |
-
//data_fields.each(function(k,v){
|
72 |
-
for( var v = 0; v < data_fields.length; v++){
|
73 |
-
if( data_fields[v].getAttribute('name') === null){
|
74 |
-
continue;
|
75 |
-
}
|
76 |
-
var field = $(data_fields[v]),
|
77 |
-
basename = field.prop('name').replace(/\[/gi,':').replace(/\]/gi,''),//.split('[' + id + ']')[1].substr(1),
|
78 |
-
name = basename.split(':'),
|
79 |
-
value = ( field.is(':checkbox,:radio') ? field.filter(':checked').val() : field.val() ),
|
80 |
-
lineconf = {};
|
81 |
-
|
82 |
-
for(var i = name.length-1; i >= 0; i--){
|
83 |
-
var nestname = name[i];
|
84 |
-
if(nestname.length === 0){
|
85 |
-
if( typeof arraynames[name[i-1]] === 'undefined'){
|
86 |
-
arraynames[name[i-1]] = 0;
|
87 |
-
}else{
|
88 |
-
arraynames[name[i-1]] += 1;
|
89 |
-
}
|
90 |
-
nestname = arraynames[name[i-1]];
|
91 |
-
}
|
92 |
-
if(i === name.length-1){
|
93 |
-
lineconf[nestname] = value;
|
94 |
-
}else{
|
95 |
-
var newobj = lineconf;
|
96 |
-
lineconf = {};
|
97 |
-
lineconf[nestname] = newobj;
|
98 |
-
}
|
99 |
-
}
|
100 |
-
|
101 |
-
$.extend(true, config, lineconf);
|
102 |
-
};
|
103 |
-
|
104 |
-
$(el).data('cf_edit_nonce', config.cf_edit_nonce);
|
105 |
-
$(el).data('_wp_http_referer', config._wp_http_referer);
|
106 |
-
$(el).data('sender', 'ajax');
|
107 |
-
$(el).data('config', JSON.stringify(config.config));
|
108 |
|
|
|
|
|
|
|
|
|
|
|
109 |
return true;
|
|
|
110 |
},
|
111 |
callback: function( obj ){
|
112 |
|
@@ -800,7 +765,7 @@ jQuery(document).ready(function($){
|
|
800 |
$('.caldera-editor-body').on('focus', '.caldera-field-bind', function(e){
|
801 |
var field = $(this),
|
802 |
value = this.value;
|
803 |
-
|
804 |
if(e.type && e.type === 'focusin'){
|
805 |
field.removeClass('bound_field').addClass('reload-binding');
|
806 |
rebind_field_bindings();
|
@@ -1297,7 +1262,7 @@ rebuild_field_binding = function(){
|
|
1297 |
};
|
1298 |
|
1299 |
// bind names
|
1300 |
-
jQuery('option.bound-field').trigger('change').each(function(k,v){
|
1301 |
var bind = jQuery(v);
|
1302 |
if(bind.prop('value').indexOf('{') !== 0){
|
1303 |
bind.text( jQuery('#' + bind.prop('value') + '_lable').val() + ' ['+jQuery('#' + bind.prop('value') + '_lable').val() +']');
|
@@ -1315,8 +1280,6 @@ rebuild_field_binding = function(){
|
|
1315 |
|
1316 |
rebind_field_bindings = function(){
|
1317 |
|
1318 |
-
//check_required_bindings();
|
1319 |
-
//console.log('- rebuild_field_binding');
|
1320 |
//return;
|
1321 |
var bindings = jQuery('.caldera-field-bind').not('.bound_field'),
|
1322 |
type_instances,
|
@@ -1325,8 +1288,8 @@ rebind_field_bindings = function(){
|
|
1325 |
|
1326 |
|
1327 |
if(!bindings.length){
|
1328 |
-
var bound = jQuery('.caldera-field-bind.bound_field');
|
1329 |
-
bound.trigger('change');
|
1330 |
return;
|
1331 |
}
|
1332 |
|
63 |
tinyMCE.triggerSave();
|
64 |
}
|
65 |
|
66 |
+
var data_fields = $('.caldera-forms-options-form').formJSON();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
+
$(el).data('cf_edit_nonce', data_fields.cf_edit_nonce);
|
69 |
+
$(el).data('_wp_http_referer', data_fields._wp_http_referer);
|
70 |
+
$(el).data('sender', 'ajax');
|
71 |
+
$(el).data('config', JSON.stringify(data_fields.config));
|
72 |
+
|
73 |
return true;
|
74 |
+
|
75 |
},
|
76 |
callback: function( obj ){
|
77 |
|
765 |
$('.caldera-editor-body').on('focus', '.caldera-field-bind', function(e){
|
766 |
var field = $(this),
|
767 |
value = this.value;
|
768 |
+
console.log( e.type );
|
769 |
if(e.type && e.type === 'focusin'){
|
770 |
field.removeClass('bound_field').addClass('reload-binding');
|
771 |
rebind_field_bindings();
|
1262 |
};
|
1263 |
|
1264 |
// bind names
|
1265 |
+
jQuery('option.bound-field').trigger('change').each(function(k,v){
|
1266 |
var bind = jQuery(v);
|
1267 |
if(bind.prop('value').indexOf('{') !== 0){
|
1268 |
bind.text( jQuery('#' + bind.prop('value') + '_lable').val() + ' ['+jQuery('#' + bind.prop('value') + '_lable').val() +']');
|
1280 |
|
1281 |
rebind_field_bindings = function(){
|
1282 |
|
|
|
|
|
1283 |
//return;
|
1284 |
var bindings = jQuery('.caldera-field-bind').not('.bound_field'),
|
1285 |
type_instances,
|
1288 |
|
1289 |
|
1290 |
if(!bindings.length){
|
1291 |
+
//var bound = jQuery('.caldera-field-bind.bound_field');
|
1292 |
+
//bound.trigger('change');
|
1293 |
return;
|
1294 |
}
|
1295 |
|
assets/js/edit.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
function new_conditional_group(a){var b=a.trigger.data("id"),c="cl"+Math.round(18746582734*Math.random()),d="rw"+Math.round(98347598345*Math.random()),e=[{id:d,type:a.trigger.data("type"),lines:[{id:c}]}];return{group:e,id:b}}function new_conditional_line(a){var b=a.trigger.data("id"),c=a.trigger.data("group"),d=a.trigger.data("type"),e="cl"+Math.round(18746582734*Math.random()),f={id:b,type:d,lineid:e,rowid:c,name:"config["+d+"]["+b+"][conditions][group]["+c+"]["+e+"]"};return f}function build_conditions_config(a){var b=JSON.parse(a.trigger.val());return b.id=a.trigger.data("id"),b}function setup_field_type(a){return{id:a.trigger.prop("id")}}function check_required_bindings(a){var b,d=(jQuery(".caldera-header-save-button"),jQuery(".layout-form-field")),e=jQuery(".caldera-processor-nav"),f=!0;b=a?jQuery(a):jQuery(".caldera-config-field .required"),b.removeClass("has-error"),d.removeClass("has-error"),e.removeClass("has-error"),jQuery(".error-tag").remove(),required_errors={},b.each(function(a,b){var c=jQuery(b),d=c.closest(".caldera-config-editor-panel");if(b.value.length){if(c.hasClass("field-slug"))for(var h=jQuery(".field-slug").not(c),i=0;i<h.length;i++)if(h[i].value===b.value){var c=jQuery(h[i]);required_errors[d.prop("id")]||(required_errors[d.prop("id")]=0);var e=c.closest(".caldera-editor-field-config-wrapper"),g=c.closest(".caldera-editor-processor-config-wrapper");e.length&&jQuery('.layout-form-field[data-config="'+e.prop("id")+'"]').addClass("has-error"),g.length&&jQuery("."+g.prop("id")).addClass("has-error"),required_errors[d.prop("id")]+=1,c.addClass("has-error");break}}else{required_errors[d.prop("id")]||(required_errors[d.prop("id")]=0);var e=c.closest(".caldera-editor-field-config-wrapper"),g=c.closest(".caldera-editor-processor-config-wrapper");e.length&&jQuery('.layout-form-field[data-config="'+e.prop("id")+'"]').addClass("has-error"),g.length&&jQuery("."+g.prop("id")).addClass("has-error"),required_errors[d.prop("id")]+=1,c.addClass("has-error"),f=!1}});for(var g in required_errors)jQuery(".caldera-forms-options-form").find('a[href="#'+g+'"]').append('<span class="error-tag">'+required_errors[g]+"</span>");return jQuery(".preview-caldera-config-group button:submit").length?(jQuery(".mailer-errors").hide(),jQuery(".mailer-control-panel").show()):(jQuery(".mailer-errors").show(),jQuery(".mailer-control-panel").hide()),jQuery(".caldera-conditional-field-set").trigger("change"),f}jQuery(document).ready(function(a){function b(b){var d=a(b),e=d.closest(".caldera-editor-field-config-wrapper"),f=e.find(".caldera-config-field-setup"),g=compiled_templates[d.val()+"_tmpl"]?compiled_templates[d.val()+"_tmpl"]:compiled_templates.noconfig_field_templ,h=e.find(".field_config_string").val(),i=d.data("type");if(e.find(".caldera-config-group").show(),d.addClass("field-initialized"),h=h.length&&i===d.val()?JSON.parse(h):fieldtype_defaults[d.val()+"_cfg"],h||(h={}),h._id=d.data("field"),h._name="config[fields]["+d.data("field")+"][config]",g=a("<div>").html(g(h)),f.html(g.html()),"function"==typeof window[d.val()+"_init"]&&window[d.val()+"_init"](d.data("field"),f),fieldtype_defaults[d.val()+"_nosupport"]&&(fieldtype_defaults[d.val()+"_nosupport"].indexOf("hide_label")>=0&&e.find(".hide-label-field").hide().find(".field-config").prop("checked",!1),fieldtype_defaults[d.val()+"_nosupport"].indexOf("caption")>=0&&e.find(".caption-field").hide().find(".field-config").val(""),fieldtype_defaults[d.val()+"_nosupport"].indexOf("caption")>=0&&e.find(".caption-field").hide().find(".field-config").val(""),fieldtype_defaults[d.val()+"_nosupport"].indexOf("custom_class")>=0&&e.find(".customclass-field").hide().find(".field-config").val(""),fieldtype_defaults[d.val()+"_nosupport"].indexOf("entry_list")>=0&&e.find(".entrylist-field").hide().find(".field-config").prop("checked",!1)),e.find(".toggle_show_values").trigger("change"),!a(".caldera-select-field-type").not(".field-initialized").length){if(core_form.hasClass("builder-loaded"))c(d.data("field"));else{for(var j=a(".caldera-select-field-type.field-initialized"),k=0;k<j.length;k++)c(a(j[k]).data("field"));core_form.addClass("builder-loaded")}rebuild_field_binding(),baldrickTriggers()}}function c(b){var c=a("#"+b),d=c.find(".caldera-select-field-type"),e=a('.layout-form-field[data-config="'+b+'"]'),f=e.find(".field_preview"),h=(a("#preview-"+d.val()+"_tmpl").html(),compiled_templates["preview-"+d.val()+"_tmpl"]),i={id:b},j=c.find(".field-config");j.each(function(c,d){for(var e=a(d),f=e.prop("name").split("["+b+"]")[1].substr(1),g=f.substr(0,f.length-1).split("]["),h=e.is(":checkbox,:radio")?e.filter(":checked").val():e.val(),j={},k=g.length-1;k>=0;k--)if(k===g.length-1)j[g[k]]=h;else{var l=j;j={},j[g[k]]=l}a.extend(!0,i,j)}),f.html(h(i)),e.removeClass("button"),a(".preview-field-config").prop("disabled",!0)}function d(b){var t,c=a(".caldera-editor-fields-panel"),e=(a(".caldera-editor-groups-panel"),a(".caldera-group-nav")),f=a('[data-group="'+b+'"]'),g=f.find(".caldera-config-group-name"),h=f.find(".caldera-config-group-slug"),i=f.find(".caldera-config-group-desc"),j=f.find(".caldera-config-group-admin"),k=a(".active-group-name"),l=a(".active-group-slug"),m=a(".active-group-desc"),n=a(".active-group-admin"),o=a(".caldera-editor-fields-list ul"),p=f.find(".caldera-config-group-repeat"),q=a(".repeat-config-button"),s=(a(".caldera-editor-group-settings"),a(".caldera-config-group-remove"));a(".new-group-input").remove(),a(".new-field-input").remove(),e.removeClass("active"),c.show(),o.hide(),o.removeClass("active").find("li.active").removeClass("active"),o.hide(),f.addClass("active"),t=a(".caldera-editor-fields-list ul.active li"),t.length?s.hide():s.show(),a(".caldera-editor-field-config-wrapper").hide(),f.show(),k.val(g.val()),l.val(h.val()),m.val(i.val()),"1"===j.val()?n.prop("checked",!0):n.prop("checked",!1),"1"===p.val()?q.addClass("field-edit-open"):q.removeClass("field-edit-open")}a(".caldera-header-save-button").baldrick({method:"POST",request:"admin.php?page=caldera-forms",before:function(b,c){if(c.preventDefault(),!check_required_bindings())return!1;a("#save_indicator").addClass("loading"),tinyMCE&&tinyMCE.triggerSave();for(var d={},e=a(".caldera-forms-options-form").find("input,radio,checkbox,select,textarea"),g={},h=0;h<e.length;h++)if(null!==e[h].getAttribute("name")){for(var i=a(e[h]),j=i.prop("name").replace(/\[/gi,":").replace(/\]/gi,""),k=j.split(":"),l=i.is(":checkbox,:radio")?i.filter(":checked").val():i.val(),m={},n=k.length-1;n>=0;n--){var o=k[n];if(0===o.length&&("undefined"==typeof g[k[n-1]]?g[k[n-1]]=0:g[k[n-1]]+=1,o=g[k[n-1]]),n===k.length-1)m[o]=l;else{var p=m;m={},m[o]=p}}a.extend(!0,d,m)}return a(b).data("cf_edit_nonce",d.cf_edit_nonce),a(b).data("_wp_http_referer",d._wp_http_referer),a(b).data("sender","ajax"),a(b).data("config",JSON.stringify(d.config)),!0},callback:function(b){if(!1===b.data){var c=a(".updated_notice_box");c.stop().animate({top:0},200,function(){setTimeout(function(){c.stop().animate({top:-75},200)},2e3)})}},complete:function(){a(".wrapper-instance-pane .field-config").prop("disabled",!1)}}),a("body").on("click",".toggle_option_tab > a",function(b){b.preventDefault();var c=a(this),d=a(c.attr("href")),e=c.parent().find("a"),f=c.closest(".caldera-editor-config-wrapper").find(".wrapper-instance-pane");e.removeClass("button-primary"),f.hide(),d.show(),c.addClass("button-primary"),a(".caldera-conditionals-usetype").trigger("change")}),a(".caldera-editor-body").on("change",".caldera-select-field-type",function(){b(this)}),a(".caldera-editor-body").on("click",".caldera-group-nav a",function(b){b.preventDefault(),d(a(this).attr("href").substr(1))}),a(".caldera-editor-body").on("click",".caldera-editor-fields-list a",function(b){b.preventDefault();var c=a(this),d=a(c.attr("href"));a(".new-group-input").remove(),a(".new-field-input").remove(),a(".caldera-editor-fields-list li.active").removeClass("active"),c.parent().addClass("active"),a(".caldera-editor-field-config-wrapper").hide(),d.show()}),a(".caldera-editor-body").on("click",".group-config-button",function(){var c=a(this),d=a(".caldera-editor-group-settings"),e=c.closest(".caldera-editor-fields-panel"),f=a(".caldera-config-group-remove");e.find(".caldera-field-line").length?f.hide():f.show(),c.hasClass("field-edit-open")?(d.slideUp(100),c.removeClass("field-edit-open")):(d.slideDown(100),c.addClass("field-edit-open"))}),a(".caldera-editor-body").on("keydown",".field-config",function(b){a(this).is("textarea")||13===b.which&&b.preventDefault()}),a(".caldera-editor-body").on("change",".field-label",function(b){var c=a(this).closest(".caldera-editor-field-config-wrapper").prop("id");field_line=a('[data-field="'+c+'"]'),field_title=a("#"+c+" .caldera-editor-field-title, .layout-form-field.field-edit-open .layout_field_name"),slug=a("#"+c+" .field-slug"),field_line.find("a").html('<i class="icn-field"></i> '+this.value),field_title.text(this.value),"change"===b.type&&slug.trigger("change"),rebuild_field_binding()}),a(".caldera-editor-body").on("change",".active-group-name",function(b){b.preventDefault();var c=a(".caldera-group-nav.active"),e=(c.data("group"),c.find(".caldera-config-group-name")),f=c.find("span");"focusout"!==b.type||this.value.length||(this.value="Group "+(parseInt(c.index())+1)),e.val(this.value),f.text(this.value)}),a(".caldera-editor-body").on("change",".active-group-slug",function(b){b.preventDefault();var c=a(".caldera-group-nav.active"),e=(c.data("group"),c.find(".caldera-config-group-name").val()),f=c.find(".caldera-config-group-slug"),h=(c.find("span"),this.value.replace(/[^a-z0-9]/gi,"_").toLowerCase());"focusout"!==b.type||this.value.length||(h=e.replace(/[^a-z0-9]/gi,"_").toLowerCase()),f.val(h),this.value=h}),a(".caldera-editor-body").on("change",".active-group-desc",function(b){b.preventDefault();var c=a(".caldera-group-nav.active"),e=(c.data("group"),c.find(".caldera-config-group-desc"));e.val(this.value)}),a(".caldera-editor-body").on("change",".active-group-admin",function(b){b.preventDefault();var c=a(".caldera-group-nav.active"),f=(c.data("group"),c.find(".caldera-config-group-name").val(),c.find(".caldera-config-group-admin"));c.find("span"),this.value.replace(/[^a-z0-9]/gi,"_").toLowerCase(),a(this).prop("checked")?(f.val(1),c.addClass("is-admin")):(f.val(0),c.removeClass("is-admin"))}),a(".caldera-editor-body").on("click",".repeat-config-button",function(b){b.preventDefault();var c=a(".caldera-group-nav.active"),e=(c.data("group"),c.find("a .group-type")),f=c.find(".caldera-config-group-repeat"),g=a(this);g.hasClass("field-edit-open")?(f.val("0"),e.removeClass("icn-repeat").addClass("icn-folder"),g.removeClass("field-edit-open")):(f.val("1"),e.addClass("icn-repeat").removeClass("icn-folder"),g.addClass("field-edit-open"))}),a(".caldera-editor-body").on("click",".delete-field",function(){var b=a(this),c=b.closest(".caldera-editor-field-config-wrapper").prop("id");confirm(b.data("confirm"))&&(a("#"+c).remove(),a('option[value="'+c+'"]').remove(),a('[data-bind="'+c+'"]').remove(),delete current_form_fields[c],a('[data-config="'+c+'"]').slideUp(200,function(){var b=a(this);b.remove(),rebuild_field_binding(),a(document).trigger("field.removed")}))}),a(".caldera-editor-body").on("click",".add-new-group,.add-field",function(){var b=a(this);if(a(".new-group-input").remove(),a(".new-field-input").remove(),b.hasClass("add-field")){var c=a('<input type="text" class="new-field-input block-input">');c.appendTo(a(".caldera-editor-fields-list ul.active")).focus()}else{var d=a('<input type="text" class="new-group-input block-input">');d.appendTo(a(".caldera-editor-groups-panel")).focus()}}),a(".caldera-editor-body").on("change keypress",".new-group-input",function(b){if("keypress"===b.type){if(13!==b.which)return;b.preventDefault()}var h,i,c=this.value,e=a(this),f=a(".caldera-editor-groups-panel ul"),g=a(".caldera-editor-fields-list");if(c.length){h=Handlebars.compile(a("#caldera_group_line_templ").html()),i={id:c.replace(/[^a-z0-9]/gi,"_").toLowerCase(),name:c},f.append(h(i));var j=a('<ul data-group="'+i.id+'">').hide();j.appendTo(g),e.remove(),d(i.id)}else e.remove()}),a(".caldera-editor-body").on("change keypress",".new-field-input",function(b){if("keypress"===b.type){if(13!==b.which)return;b.preventDefault()}var g,h,i,c=this.value,d=a(this),e=d.parent(),f=a(".caldera-editor-field-config"),j=a(".caldera-config-group-remove");if(c.length){j.hide(),g=Handlebars.compile(a("#caldera_field_line_templ").html()),h=Handlebars.compile(a("#caldera_field_config_wrapper_templ").html()),i={id:c.replace(/[^a-z0-9]/gi,"_").toLowerCase(),label:c,slug:c.replace(/[^a-z0-9]/gi,"_").toLowerCase(),group:a(".caldera-group-nav.active").data("group")};var k=a(g(i));k.appendTo(e),f.append(h(i)),k.find("a").trigger("click"),d.remove()}else d.remove()}),a(".caldera-editor-body").on("change",".field-slug",function(b){this.value.length?this.value=this.value.replace(/[^a-z0-9]/gi,"_").toLowerCase():"change"===b.type&&(this.value=a(this).closest(".caldera-editor-field-config-wrapper").find(".field-label").val().replace(/[^a-z0-9]/gi,"_").toLowerCase())}),a(".caldera-editor-body").on("click",".caldera-add-group",function(){var c=a(this),d=c.data("group"),e=a("#"+d+"_panel_tmpl").html();c.parent().parent().append(e)}),a(".caldera-editor-body").on("click",".caldera-config-group-remove",function(){var c=a(".active-group-slug").val();a('[data-group="'+c+'"]').hide(0,function(){a(this).remove();var b=a(".caldera-group-nav");b.length?b.first().find("a").trigger("click"):a(".caldera-editor-fields-panel").hide()})}),a("body").on("click",".set-current-field",function(b){b.preventDefault();var c=a(this);a("#"+c.data("field")+"_type").val(c.data("type")).trigger("change"),a("#"+c.data("field")+"_lable").focus(),a("#field_setup_baldrickModalCloser").trigger("click")}),a(".caldera-editor-body").on("change",".field-config",function(){var d=a(this),e=d.closest(".caldera-editor-field-config-wrapper");current_form_fields&&(d.prop("id")===e.prop("id")+"_lable"&&(current_form_fields[e.prop("id")].label=this.value),d.prop("id")===e.prop("id")+"_slug"&&(current_form_fields[e.prop("id")].slug=this.value),d.prop("id")===e.prop("id")+"_type"&&(current_form_fields[e.prop("id")].type=this.value),e.length&&c(e.prop("id")))}),a(".caldera-editor-body").on("focus",".caldera-field-bind",function(b){var c=a(this),d=this.value;return b.type&&"focusin"===b.type?(c.removeClass("bound_field").addClass("reload-binding"),rebind_field_bindings(),this.value=d,void 0):void 0}),a(".caldera-editor-body").on("change",".caldera-conditional-field-set",function(){var k,l,c=a(this),d=c.parent().find(".compare-type"),e=c.data("condition"),f=c.data("id"),g="config["+e+"]["+f+"][conditions][group]["+c.data("row")+"]["+c.data("line")+"]",h=c.data("line"),i=a("#"+h+"_value"),j=i.find(".caldera-conditional-value-field").first(),m=[],n=this.value;if("{"!==n.substr(0,1)&&(k=a("#"+n),l=k.find(".field-button-type"),m=k.find(".caldera-config-group-toggle-options")),c.hasClass(".bind_init")&&c.addClass("bound_triggered"),j.length&&j.val().length&&i.data("value",j.val()),d.show(),m.length){var o=m.find(".toggle_option_row"),p='<select name="'+g+'[value]" class="caldera-processor-value-bind caldera-conditional-value-field" data-field="'+n+'" style="max-width: 220px; width: 220px;">';p+='<option value=""></option>',o.each(function(b,c){var d=a(c).find(".toggle_label_field"),e=d.data("option"),f="";i.data("value")&&(i.data("value").toString()===e||i.data("value").toString()===a(c).find(".toggle_value_field").val())&&(f=' selected="selected"'),p+='<option value="'+e+'"'+f+">"+d.val()+"</option>"}),p+="</select>"}else l&&"button"==l.val()?(d.val("is").hide(),p='<select name="'+g+'[value]" class="caldera-processor-value-bind caldera-conditional-value-field" data-field="'+n+'" style="max-width: 220px; width: 220px;">',p+='<option value="click" '+("click"===i.data("value")?'selected="selected"':"")+">Click</option>",p+='<option value="dblclick" '+("dblclick"===i.data("value")?'selected="selected"':"")+">Double Click</option>",p+="</select>"):p='<input name="'+g+'[value]" type="text" class="caldera-conditional-value-field magic-tag-enabled" value="'+(i.data("value")?i.data("value"):"")+'" style="max-width: 205px;">';i.html(p),init_magic_tags()}),a(".caldera-editor-body").on("change",".caldera-conditionals-usetype",function(){var c=a(this);""!==this.value?(a("#"+c.data("id")+"_condition_group_add").show(),a("#"+c.data("id")+"_conditional_wrap").show()):(a("#"+c.data("id")+"_condition_group_add").hide(),a("#"+c.data("id")+"_conditional_wrap").hide())}),a(".caldera-editor-body").on("click",".remove-conditional-line",function(b){b.preventDefault();var c=a(this),d=c.closest(".caldera-condition-line"),e=c.closest(".caldera-condition-group");d.remove(),e.find(".caldera-condition-line").length||e.remove()}),a(".caldera-group-nav").first().find("a").trigger("click"),a(".caldera-editor-body").on("change",".toggle_show_values",function(){var c=a(this),d=c.closest(".caldera-config-group-toggle-options");values=d.find(".toggle_value_field"),lables=d.find(".toggle_label_field"),field_lables=d.find(".caldera-config-group-option-labels"),c.prop("checked")?(values.show().parent().show(),values.show().parent().parent().show(),lables.css("width",""),field_lables.show()):(values.hide().parent().hide(),lables.css("width",245),field_lables.hide()),lables.trigger("toggle.values"),init_magic_tags()}),a(".caldera-editor-body").on("change",".auto-populate-type",function(){a(this).closest(".wrapper-instance-pane").find(".auto-populate-options").trigger("change")}),a(".caldera-editor-body").on("change",".auto-populate-options",function(){var b=a(this),c=b.closest(".wrapper-instance-pane"),d=c.find(".caldera-config-group-toggle-options"),e=c.find(".caldera-config-group-auto-options"),f=e.find(".auto-populate-type");e.find(".auto-populate-type-panel").hide(),b.prop("checked")?(d.hide(),e.show()):(d.show(),e.hide()),e.find(".caldera-config-group-auto-"+f.val()).show()}),a("body").on("change",".pin-toggle-roles",function(){var b=a(this),c=a("#caldera-pin-rules");"1"===b.val()?c.show():c.hide()}),a("body").on("click",".magic-tag-init",function(){var c=a(this),d=c.prev();d.focus().trigger("init.magic")}),a("body").on("keyup blur focus select click init.magic",".magic-tag-enabled",function(b){init_magic_tags();var c=a(this),d=c.parent(),e=d.closest(".wrapper-instance-pane").find(".caldera-select-field-type").val()?d.closest(".wrapper-instance-pane").find(".caldera-select-field-type").val():"hidden",f=d.find(".magic-tags-autocomplete"),g=f.find("ul"),h=this.value,j=[],k="",l=this.selectionStart,m=this.selectionEnd;if(f.length&&f.data("focus"))return b.preventDefault(),void 0;if(c.data("tag",""),this.selectionEnd>this.selectionStart)k=this.value.substr(this.selectionStart,this.selectionEnd-this.selectionStart);else if(("select"===b.type||"keyup"===b.type)&&40!==b.which&&38!==b.which&&39!==b.which&&37!==b.which){for(l=this.selectionStart;l>0;l--){var n=h.substr(l-1,1);if(" "===n||"\n"===n||("%"===n||"}"===n)&&this.selectionStart===l)break}for(m=this.selectionStart;m<h.length;m++){var n=h.substr(m,1);if(" "===n||"\n"===n||("%"===n||"{"===n)&&this.selectionStart===m)break}k=h.substr(l,m-l)}if("focusout"!==b.type){if("init"!==b.type&&k.length<3)return f.length&&f.remove(),void 0;f.length||(f=a('<div class="magic-tags-autocomplete"></div>'),g=a("<ul></ul>"),g.appendTo(f),f.insertAfter(c),f.on("mouseenter",function(){a(this).data("focus",!0)}),f.on("mouseleave",function(){a(this).data("focus",!1),c.is(":focus")||c.trigger("focusout")})),g.empty();var o="system",p=!1;"hidden"===e||"dropdown"===e||"radio"===e||"toggle_switch"===e||"checkbox"===e?(p=!0,e="text",o="all"):("paragraph"===e||"html"===e)&&(e="text"),c.data("type")&&(e=c.data("type")),e=e.split(","),e.push("vars");for(var q=0;q<e.length;q++)for(var r in system_values)if("undefined"!=typeof system_values[r].tags[e[q]]){if(j=[r],"system"!==r&&"variable"!==r&&"field"!==r){var s=jQuery(".processor-"+r),t=c.closest(".caldera-editor-processor-config-wrapper"),u=t.prop("id");j=[];for(var v=0;v<s.length;v++)if(t.length||p!==!0){if(u===s[v].id)continue;jQuery("li."+s[v].id).index()<jQuery("li."+u).index()&&j.push(s[v].id)}else j.push(s[v].id)}for(var w=0;w<j.length;w++)if("all"===o||o===r||"variable"===r){var x=a('<li class="header">'+system_values[r].type+(w>0?" ["+(w+1)+"]":"")+"</li>"),y=0;x.appendTo(g);for(var z=0;z<system_values[r].tags[e[q]].length;z++)if(!c.data("parent")||"variable:"+c.data("parent")!==system_values[r].tags[e[q]][z]){var A=system_values[r].wrap[0]+system_values[r].tags[e[q]][z]+system_values[r].wrap[1];if(j[w]!==r&&j.length>1&&(A=system_values[r].wrap[0]+system_values[r].tags[e[q]][z]+":"+j[w]+system_values[r].wrap[1]),A.indexOf(k)>=0||"init"===b.type){y+=1;var B=A.replace(k,"<strong>"+k+"</strong>"),C=a('<li class="tag" data-tag="'+A+'">'+B+"</li>");C.on("click",function(){var b=a(this).data("tag");c.val(h.substr(0,l)+b+h.substr(m)).trigger("change").focus(),c[0].selectionStart=l+b.length-(b.indexOf("*")>0?2:0),c[0].selectionEnd=l+b.length-(b.indexOf("*")>0?1:0)}),C.appendTo(g)}}0===y&&x.remove()}}}g.children().length||f.remove(),"focusout"===b.type&&setTimeout(function(){f.remove()},200)});for(var e=a(".cf-editor-template"),f=0;f<e.length;f++)compiled_templates[e[f].id]=Handlebars.compile(e[f].innerHTML);a(".caldera-select-field-type").not(".field-initialized").each(function(a,c){b(c)})});var rebuild_field_binding,rebind_field_bindings,current_form_fields={},required_errors={},add_new_grid_page,add_page_grid,init_magic_tags,core_form,compiled_templates={};init_magic_tags=function(){var a=jQuery(".magic-tag-enabled");a.each(function(a,b){var c=jQuery(b);if(c.hasClass("magic-tag-init-bound")){var d=c.parent().find(".magic-tag-init");return c.is(":visible")?d.show():d.hide(),void 0}var e=jQuery('<span class="icn-code magic-tag-init"></span>'),f=jQuery('<span style="position:relative;display:inline-block; width:100%;"></span>');c.is("input")&&e.css("borderBottom","none"),c.hasClass("caldera-conditional-value-field")&&f.width("auto"),c.wrap(f),e.insertAfter(c),c.addClass("magic-tag-init-bound"),c.is(":visible")?e.show():e.hide()})},rebuild_field_binding=function(){if(core_form||(core_form=jQuery(".caldera-forms-options-form")),core_form.hasClass("builder-loaded")){var a=jQuery(".caldera-editor-field-config-wrapper");system_values.field={tags:{text:[]},type:"Fields",wrap:["%","%"]};for(var b=0;b<a.length;b++){var c=a[b].id,d=jQuery("#"+c+"_lable").val(),e=jQuery("#"+c+"_slug").val(),f=jQuery("#"+c+"_type").val();"undefined"==typeof system_values.field.tags[f]&&(system_values.field.tags[f]=[]),system_values.field.tags[f].push(e),"text"!==f&&system_values.field.tags.text.push(e),current_form_fields[c]={label:d,slug:e,type:f},jQuery("option.bound-field").trigger("change").each(function(a,b){var c=jQuery(b);0!==c.prop("value").indexOf("{")?c.text(jQuery("#"+c.prop("value")+"_lable").val()+" ["+jQuery("#"+c.prop("value")+"_lable").val()+"]"):c.text(c.prop("value").replace("{","").replace("}",""))}).removeClass("bound-field")}}},rebind_field_bindings=function(){var b,c,a=jQuery(".caldera-field-bind").not(".bound_field");if(!a.length){var d=jQuery(".caldera-field-bind.bound_field");return d.trigger("change"),void 0}a.addClass("bound_field");for(var e=0;e<a.length;e++){var f=jQuery(a[e]),g=f.val(),h=f.data("default"),i=f.data("exclude"),j=0,k=f.closest(".caldera-editor-processor-config-wrapper"),l=k.prop("id"),m="";if(h&&!f.hasClass("reload-binding")&&(g=h),f.is("select")){f.empty();var n=jQuery('<optgroup label="Fields">');for(var o in current_form_fields)f.data("type")&&f.data("type").split(",").indexOf(current_form_fields[o].type)<0||(f.data("id")!==o&&n.append('<option value="'+o+'"'+(g===o?'selected="selected"':"")+">"+current_form_fields[o].label+" ["+current_form_fields[o].slug+"]</option>"),j+=1);n.appendTo(f),0===j&&f.empty();for(var p in system_values)if(b=[],!(i&&i.split(",").indexOf(p)>=0)){if("system"!==p&&"variable"!==p)for(var q=jQuery(".processor-"+p),r=0;r<q.length;r++)l!==q[r].id&&(b.push(q[r].id),q.length>1&&(c=jQuery("li."+q[r].id+" .processor-line-number"))&&c.html("["+(r+1)+"]"));else b.push("__system__");var s=[];f.data("type")?(s=f.data("type").split(","),s.push("vars")):s=["text","vars"];for(var t=0;t<s.length;t++)if(system_values[p].tags[s[t]])for(var u=0;u<b.length;u++){jQuery("li."+b[u]).index()>jQuery("li."+l).index()&&"__system__"!==b[u]?f.closest(".caldera-editor-processors-panel-wrap").length&&(m=' disabled="disabled"'):m="";for(var n=jQuery('<optgroup label="'+system_values[p].type+("__system__"!==b[u]?" "+jQuery("li."+b[u]).find(".processor-line-number").html():"")+'"'+m+">"),v=0;v<system_values[p].tags[s[t]].length;v++){var w=system_values[p].tags[s[t]][v];"__system__"!==b[u]&&(w=w.replace(p,b[u])),n.append('<option value="{'+w+'}"'+(g==="{"+w+"}"?'selected="selected"':"")+m+">"+system_values[p].tags[s[t]][v]+"</option>"),j+=1}n.children().length&&n.appendTo(f)}}if(0===j){if(f.empty(),f.data("type")){f.append('<option value="">No '+f.data("type").split(",").join(" or ")+" in form</option>");var x=!0}}else f.prop("disabled",!1);f.hasClass("required")||"undefined"!=typeof x||f.prepend('<option value=""></option>'),f.val(g)}}init_magic_tags(),jQuery(document).trigger("bound.fields"),jQuery(".caldera-header-save-button").prop("disabled",!1)},jQuery(document).ready(function(a){function b(){var b=a(".layout-grid-panel"),c=0;b.each(function(b,d){var e=a(d),f=e.find(".layout-structure"),g=e.find(".row"),h=[];g.each(function(b,d){var e=a(d),f=e.children().not(".column-merge"),g=[];c+=1,f.each(function(b,d){span=a(d).attr("class").split("-"),g.push(span[2]);var e=a(d).find(".field-location");e.length&&e.each(function(d,e){var f=a(e);f.val(c+":"+(b+1)).removeAttr("disabled")})}),h.push(g.join(":"))}),f.val(h.join("|"))})}function c(b,c,e){var i,j,f="fld_"+Math.round(1e7*Math.random()),g=f,h=a("#field_config_panels");if(e){var k=a("#"+e).clone().wrap("<div>").parent().html().replace(new RegExp(e,"g"),"{{id}}");i=Handlebars.compile(k)}else i=Handlebars.compile(a("#caldera_field_config_wrapper_templ").html());j={id:g,label:"",slug:""},h.append(i(j)),b.removeClass("button-small").removeClass("button").removeClass("button-primary").removeClass("ui-draggable").removeClass("layout-new-form-field").addClass("layout-form-field").attr("data-config",f),b.find(".layout_field_name").remove(),b.find(".field-location").prop("name","config[layout_grid][fields]["+f+"]"),b.find(".settings-panel").show(),b.appendTo(c),d(),b.find(".icon-edit").trigger("click"),a("#"+f+"_lable").focus().select(),e&&(h.find(".field_config_string").val(""),h.find(".field-label").trigger("change")),rebuild_field_binding(),baldrickTriggers(),a("#"+f).trigger("field.drop"),a(document).trigger("field.added")}function d(){a(".toggle-options").sortable({handle:".dashicons-sort"}),a("#grid-pages-panel").sortable({placeholder:"row-drop-helper",handle:".sort-handle",items:".first-row-level",axis:"y",stop:function(){b()}}),a(".layout-column").sortable({connectWith:".layout-column",appendTo:"#grid-pages-panel",helper:"clone",items:".layout-form-field",handle:".drag-handle",cursor:"move",opacity:.7,cursorAt:{left:100,top:15},start:function(a,b){b.helper.css({width:"200px",height:"35px",paddingTop:"20px"})},stop:function(a,c){c.item.removeAttr("style"),b()}}),a("h3 .layout-new-form-field").draggable({helper:"clone",appendTo:"body"}),a(".page-toggle.button").droppable({accept:".layout-form-field",over:function(){a(this).trigger("click"),a(".layout-column").sortable("refresh")}}),a(".layout-column").droppable({greedy:!0,activeClass:"ui-state-dropper",hoverClass:"ui-state-hoverable",accept:".layout-new-form-field",drop:function(b,d){var e=d.draggable.clone(),f=a(this);c(e,f)}}),b()}add_new_grid_page=function(){return{page_no:"pg_"+Math.round(1e7*Math.random())}},add_page_grid=function(b){var c=a(".page-toggle").length+1,e=a('<button type="button" data-name="Page '+c+'" data-page="'+b.rawData.page_no+'" class="page-toggle button">'+b.params.trigger.data("addtitle")+" "+c+"</button> "),f=a("#page-toggles");e.appendTo(f),f.show(),d(),e.trigger("click"),1===c&&f.hide(),a(document).trigger("add.page")},a(document).on("remove.page add.page load.page",function(){var c=a(".page-toggle").length,d=a("#tab_pages");1>=c?d.hide():d.show()}),d(),a("#grid-pages-panel").on("click",".column-fieldinsert .dashicons-plus-alt",function(){var d=a(this).closest(".column-container"),e=a("#newfield-tool").clone();c(e,d)}),a("#grid-pages-panel").on("click",".column-fieldinsert .dashicons-admin-generic",function(){}),a("#grid-pages-panel").on("click",".column-split",function(){var c=a(this).parent().parent(),e=c.attr("class").split("-"),f=a("<div>").insertAfter(c),g=Math.ceil(e[2]/2),h=Math.floor(e[2]/2);e[2]=g,c.attr("class",e.join("-")),e[2]=h,f.addClass(e.join("-")).append('<div class="layout-column column-container">'),a(this).remove(),d(),jQuery(".column-tools").remove(),jQuery(".column-merge").remove()}),a("#grid-pages-panel").on("click",".column-remove",function(){var d=a(this).closest(".row"),e=d.find(".layout-form-field"),f=d.closest(".layout-grid-panel");if(e.length){if(!confirm(a("#row-remove-fields-message").text()))return;e.each(function(b,c){var d=a(c).data("config");a("#"+d).remove(),a('option[value="'+d+'"]').remove(),a('[data-bind="'+d+'"]').remove(),delete current_form_fields[d]})}d.slideUp(200,function(){if(a(this).remove(),b(),rebuild_field_binding(),!f.find(".row").length){f.remove();var c=a("#page-toggles .button-primary"),d=c.prev(),e=c.next();c.remove(),d.length?d.trigger("click"):e.trigger("click")}a(document).trigger("remove.page")}),jQuery(".column-tools").remove(),jQuery(".column-merge").remove()}),a(".caldera-config-editor-main-panel").on("click",".caldera-add-row",function(c){c.preventDefault();var e=a(".page-active");return e.length?(a(".page-active").append('<div class="first-row-level row"><div class="col-xs-12"><div class="layout-column column-container"></div></div></div>'),d(),b(),void 0):(a(".caldera-add-page").trigger("click"),void 0)}),a("#grid-pages-panel").on("click",".column-join",function(){var d=a(this).parent().parent().parent(),e=d.prev(),f=e.attr("class").split("-"),g=d.attr("class").split("-");f[2]=parseFloat(f[2])+parseFloat(g[2]),d.find(".layout-column").contents().appendTo(e.find(".layout-column")),e.attr("class",f.join("-")),d.remove(),b(),jQuery(".column-tools").remove(),jQuery(".column-merge").remove()}),a("#grid-pages-panel").on("mouseenter",".row",function(){var d=jQuery(this);jQuery(".column-tools,.column-merge").remove(),d.children().children().first().append('<div class="column-remove column-tools"><i class="icon-remove"></i></div>'),d.children().children().last().append('<div class="column-sort column-tools" style="text-align:right;"><i class="dashicons dashicons-menu drag-handle sort-handle"></i></div>'),d.children().children().not(":first").prepend('<div class="column-merge"><div class="column-join column-tools"><i class="icon-join"></i></div></div>');var e=d.parent().parent().parent().width()/12-1;d.children().children().each(function(b,c){var d=a(c),e=d.width()/2-5;d.prepend('<div class="column-fieldinsert column-tools"><i class="dashicons dashicons-plus-alt"></i></div>'),d.parent().hasClass("col-xs-1")||(d.prepend('<div class="column-split column-tools"><i class="dashicons dashicons-leftright"></i></div>'),d.find(".column-split").css("left",e))}),jQuery(".column-merge").draggable({axis:"x",helper:"clone",appendTo:d,grid:[e,0],drag:function(c,d){a(this).addClass("dragging"),a(".column-tools").remove(),a(".column-split").remove();var e=a(this).parent().parent(),f=d.helper,g=d.originalPosition.left>f.position().left?"left":"right",i=e.prev(),j=Math.round(e.parent().width()/12-10),k=Math.abs(d.originalPosition.left-f.position().left);if(e.parent().addClass("sizing"),k>=j){var l=i.attr("class").split("-"),m=e.attr("class").split("-");
|
2 |
-
|
1 |
+
function new_conditional_group(a){var b=a.trigger.data("id"),c="cl"+Math.round(18746582734*Math.random()),d="rw"+Math.round(98347598345*Math.random()),e=[{id:d,type:a.trigger.data("type"),lines:[{id:c}]}];return{group:e,id:b}}function new_conditional_line(a){var b=a.trigger.data("id"),c=a.trigger.data("group"),d=a.trigger.data("type"),e="cl"+Math.round(18746582734*Math.random()),f={id:b,type:d,lineid:e,rowid:c,name:"config["+d+"]["+b+"][conditions][group]["+c+"]["+e+"]"};return f}function build_conditions_config(a){var b=JSON.parse(a.trigger.val());return b.id=a.trigger.data("id"),b}function setup_field_type(a){return{id:a.trigger.prop("id")}}function check_required_bindings(a){var b,d=(jQuery(".caldera-header-save-button"),jQuery(".layout-form-field")),e=jQuery(".caldera-processor-nav"),f=!0;b=a?jQuery(a):jQuery(".caldera-config-field .required"),b.removeClass("has-error"),d.removeClass("has-error"),e.removeClass("has-error"),jQuery(".error-tag").remove(),required_errors={},b.each(function(a,b){var c=jQuery(b),d=c.closest(".caldera-config-editor-panel");if(b.value.length){if(c.hasClass("field-slug"))for(var h=jQuery(".field-slug").not(c),i=0;i<h.length;i++)if(h[i].value===b.value){var c=jQuery(h[i]);required_errors[d.prop("id")]||(required_errors[d.prop("id")]=0);var e=c.closest(".caldera-editor-field-config-wrapper"),g=c.closest(".caldera-editor-processor-config-wrapper");e.length&&jQuery('.layout-form-field[data-config="'+e.prop("id")+'"]').addClass("has-error"),g.length&&jQuery("."+g.prop("id")).addClass("has-error"),required_errors[d.prop("id")]+=1,c.addClass("has-error");break}}else{required_errors[d.prop("id")]||(required_errors[d.prop("id")]=0);var e=c.closest(".caldera-editor-field-config-wrapper"),g=c.closest(".caldera-editor-processor-config-wrapper");e.length&&jQuery('.layout-form-field[data-config="'+e.prop("id")+'"]').addClass("has-error"),g.length&&jQuery("."+g.prop("id")).addClass("has-error"),required_errors[d.prop("id")]+=1,c.addClass("has-error"),f=!1}});for(var g in required_errors)jQuery(".caldera-forms-options-form").find('a[href="#'+g+'"]').append('<span class="error-tag">'+required_errors[g]+"</span>");return jQuery(".preview-caldera-config-group button:submit").length?(jQuery(".mailer-errors").hide(),jQuery(".mailer-control-panel").show()):(jQuery(".mailer-errors").show(),jQuery(".mailer-control-panel").hide()),jQuery(".caldera-conditional-field-set").trigger("change"),f}jQuery(document).ready(function(a){function b(b){var d=a(b),e=d.closest(".caldera-editor-field-config-wrapper"),f=e.find(".caldera-config-field-setup"),g=compiled_templates[d.val()+"_tmpl"]?compiled_templates[d.val()+"_tmpl"]:compiled_templates.noconfig_field_templ,h=e.find(".field_config_string").val(),i=d.data("type");if(e.find(".caldera-config-group").show(),d.addClass("field-initialized"),h=h.length&&i===d.val()?JSON.parse(h):fieldtype_defaults[d.val()+"_cfg"],h||(h={}),h._id=d.data("field"),h._name="config[fields]["+d.data("field")+"][config]",g=a("<div>").html(g(h)),f.html(g.html()),"function"==typeof window[d.val()+"_init"]&&window[d.val()+"_init"](d.data("field"),f),fieldtype_defaults[d.val()+"_nosupport"]&&(fieldtype_defaults[d.val()+"_nosupport"].indexOf("hide_label")>=0&&e.find(".hide-label-field").hide().find(".field-config").prop("checked",!1),fieldtype_defaults[d.val()+"_nosupport"].indexOf("caption")>=0&&e.find(".caption-field").hide().find(".field-config").val(""),fieldtype_defaults[d.val()+"_nosupport"].indexOf("caption")>=0&&e.find(".caption-field").hide().find(".field-config").val(""),fieldtype_defaults[d.val()+"_nosupport"].indexOf("custom_class")>=0&&e.find(".customclass-field").hide().find(".field-config").val(""),fieldtype_defaults[d.val()+"_nosupport"].indexOf("entry_list")>=0&&e.find(".entrylist-field").hide().find(".field-config").prop("checked",!1)),e.find(".toggle_show_values").trigger("change"),!a(".caldera-select-field-type").not(".field-initialized").length){if(core_form.hasClass("builder-loaded"))c(d.data("field"));else{for(var j=a(".caldera-select-field-type.field-initialized"),k=0;k<j.length;k++)c(a(j[k]).data("field"));core_form.addClass("builder-loaded")}rebuild_field_binding(),baldrickTriggers()}}function c(b){var c=a("#"+b),d=c.find(".caldera-select-field-type"),e=a('.layout-form-field[data-config="'+b+'"]'),f=e.find(".field_preview"),h=(a("#preview-"+d.val()+"_tmpl").html(),compiled_templates["preview-"+d.val()+"_tmpl"]),i={id:b},j=c.find(".field-config");j.each(function(c,d){for(var e=a(d),f=e.prop("name").split("["+b+"]")[1].substr(1),g=f.substr(0,f.length-1).split("]["),h=e.is(":checkbox,:radio")?e.filter(":checked").val():e.val(),j={},k=g.length-1;k>=0;k--)if(k===g.length-1)j[g[k]]=h;else{var l=j;j={},j[g[k]]=l}a.extend(!0,i,j)}),f.html(h(i)),e.removeClass("button"),a(".preview-field-config").prop("disabled",!0)}function d(b){var t,c=a(".caldera-editor-fields-panel"),e=(a(".caldera-editor-groups-panel"),a(".caldera-group-nav")),f=a('[data-group="'+b+'"]'),g=f.find(".caldera-config-group-name"),h=f.find(".caldera-config-group-slug"),i=f.find(".caldera-config-group-desc"),j=f.find(".caldera-config-group-admin"),k=a(".active-group-name"),l=a(".active-group-slug"),m=a(".active-group-desc"),n=a(".active-group-admin"),o=a(".caldera-editor-fields-list ul"),p=f.find(".caldera-config-group-repeat"),q=a(".repeat-config-button"),s=(a(".caldera-editor-group-settings"),a(".caldera-config-group-remove"));a(".new-group-input").remove(),a(".new-field-input").remove(),e.removeClass("active"),c.show(),o.hide(),o.removeClass("active").find("li.active").removeClass("active"),o.hide(),f.addClass("active"),t=a(".caldera-editor-fields-list ul.active li"),t.length?s.hide():s.show(),a(".caldera-editor-field-config-wrapper").hide(),f.show(),k.val(g.val()),l.val(h.val()),m.val(i.val()),"1"===j.val()?n.prop("checked",!0):n.prop("checked",!1),"1"===p.val()?q.addClass("field-edit-open"):q.removeClass("field-edit-open")}a(".caldera-header-save-button").baldrick({method:"POST",request:"admin.php?page=caldera-forms",before:function(b,c){if(c.preventDefault(),!check_required_bindings())return!1;a("#save_indicator").addClass("loading"),tinyMCE&&tinyMCE.triggerSave();var d=a(".caldera-forms-options-form").formJSON();return a(b).data("cf_edit_nonce",d.cf_edit_nonce),a(b).data("_wp_http_referer",d._wp_http_referer),a(b).data("sender","ajax"),a(b).data("config",JSON.stringify(d.config)),!0},callback:function(b){if(!1===b.data){var c=a(".updated_notice_box");c.stop().animate({top:0},200,function(){setTimeout(function(){c.stop().animate({top:-75},200)},2e3)})}},complete:function(){a(".wrapper-instance-pane .field-config").prop("disabled",!1)}}),a("body").on("click",".toggle_option_tab > a",function(b){b.preventDefault();var c=a(this),d=a(c.attr("href")),e=c.parent().find("a"),f=c.closest(".caldera-editor-config-wrapper").find(".wrapper-instance-pane");e.removeClass("button-primary"),f.hide(),d.show(),c.addClass("button-primary"),a(".caldera-conditionals-usetype").trigger("change")}),a(".caldera-editor-body").on("change",".caldera-select-field-type",function(){b(this)}),a(".caldera-editor-body").on("click",".caldera-group-nav a",function(b){b.preventDefault(),d(a(this).attr("href").substr(1))}),a(".caldera-editor-body").on("click",".caldera-editor-fields-list a",function(b){b.preventDefault();var c=a(this),d=a(c.attr("href"));a(".new-group-input").remove(),a(".new-field-input").remove(),a(".caldera-editor-fields-list li.active").removeClass("active"),c.parent().addClass("active"),a(".caldera-editor-field-config-wrapper").hide(),d.show()}),a(".caldera-editor-body").on("click",".group-config-button",function(){var c=a(this),d=a(".caldera-editor-group-settings"),e=c.closest(".caldera-editor-fields-panel"),f=a(".caldera-config-group-remove");e.find(".caldera-field-line").length?f.hide():f.show(),c.hasClass("field-edit-open")?(d.slideUp(100),c.removeClass("field-edit-open")):(d.slideDown(100),c.addClass("field-edit-open"))}),a(".caldera-editor-body").on("keydown",".field-config",function(b){a(this).is("textarea")||13===b.which&&b.preventDefault()}),a(".caldera-editor-body").on("change",".field-label",function(b){var c=a(this).closest(".caldera-editor-field-config-wrapper").prop("id");field_line=a('[data-field="'+c+'"]'),field_title=a("#"+c+" .caldera-editor-field-title, .layout-form-field.field-edit-open .layout_field_name"),slug=a("#"+c+" .field-slug"),field_line.find("a").html('<i class="icn-field"></i> '+this.value),field_title.text(this.value),"change"===b.type&&slug.trigger("change"),rebuild_field_binding()}),a(".caldera-editor-body").on("change",".active-group-name",function(b){b.preventDefault();var c=a(".caldera-group-nav.active"),e=(c.data("group"),c.find(".caldera-config-group-name")),f=c.find("span");"focusout"!==b.type||this.value.length||(this.value="Group "+(parseInt(c.index())+1)),e.val(this.value),f.text(this.value)}),a(".caldera-editor-body").on("change",".active-group-slug",function(b){b.preventDefault();var c=a(".caldera-group-nav.active"),e=(c.data("group"),c.find(".caldera-config-group-name").val()),f=c.find(".caldera-config-group-slug"),h=(c.find("span"),this.value.replace(/[^a-z0-9]/gi,"_").toLowerCase());"focusout"!==b.type||this.value.length||(h=e.replace(/[^a-z0-9]/gi,"_").toLowerCase()),f.val(h),this.value=h}),a(".caldera-editor-body").on("change",".active-group-desc",function(b){b.preventDefault();var c=a(".caldera-group-nav.active"),e=(c.data("group"),c.find(".caldera-config-group-desc"));e.val(this.value)}),a(".caldera-editor-body").on("change",".active-group-admin",function(b){b.preventDefault();var c=a(".caldera-group-nav.active"),f=(c.data("group"),c.find(".caldera-config-group-name").val(),c.find(".caldera-config-group-admin"));c.find("span"),this.value.replace(/[^a-z0-9]/gi,"_").toLowerCase(),a(this).prop("checked")?(f.val(1),c.addClass("is-admin")):(f.val(0),c.removeClass("is-admin"))}),a(".caldera-editor-body").on("click",".repeat-config-button",function(b){b.preventDefault();var c=a(".caldera-group-nav.active"),e=(c.data("group"),c.find("a .group-type")),f=c.find(".caldera-config-group-repeat"),g=a(this);g.hasClass("field-edit-open")?(f.val("0"),e.removeClass("icn-repeat").addClass("icn-folder"),g.removeClass("field-edit-open")):(f.val("1"),e.addClass("icn-repeat").removeClass("icn-folder"),g.addClass("field-edit-open"))}),a(".caldera-editor-body").on("click",".delete-field",function(){var b=a(this),c=b.closest(".caldera-editor-field-config-wrapper").prop("id");confirm(b.data("confirm"))&&(a("#"+c).remove(),a('option[value="'+c+'"]').remove(),a('[data-bind="'+c+'"]').remove(),delete current_form_fields[c],a('[data-config="'+c+'"]').slideUp(200,function(){var b=a(this);b.remove(),rebuild_field_binding(),a(document).trigger("field.removed")}))}),a(".caldera-editor-body").on("click",".add-new-group,.add-field",function(){var b=a(this);if(a(".new-group-input").remove(),a(".new-field-input").remove(),b.hasClass("add-field")){var c=a('<input type="text" class="new-field-input block-input">');c.appendTo(a(".caldera-editor-fields-list ul.active")).focus()}else{var d=a('<input type="text" class="new-group-input block-input">');d.appendTo(a(".caldera-editor-groups-panel")).focus()}}),a(".caldera-editor-body").on("change keypress",".new-group-input",function(b){if("keypress"===b.type){if(13!==b.which)return;b.preventDefault()}var h,i,c=this.value,e=a(this),f=a(".caldera-editor-groups-panel ul"),g=a(".caldera-editor-fields-list");if(c.length){h=Handlebars.compile(a("#caldera_group_line_templ").html()),i={id:c.replace(/[^a-z0-9]/gi,"_").toLowerCase(),name:c},f.append(h(i));var j=a('<ul data-group="'+i.id+'">').hide();j.appendTo(g),e.remove(),d(i.id)}else e.remove()}),a(".caldera-editor-body").on("change keypress",".new-field-input",function(b){if("keypress"===b.type){if(13!==b.which)return;b.preventDefault()}var g,h,i,c=this.value,d=a(this),e=d.parent(),f=a(".caldera-editor-field-config"),j=a(".caldera-config-group-remove");if(c.length){j.hide(),g=Handlebars.compile(a("#caldera_field_line_templ").html()),h=Handlebars.compile(a("#caldera_field_config_wrapper_templ").html()),i={id:c.replace(/[^a-z0-9]/gi,"_").toLowerCase(),label:c,slug:c.replace(/[^a-z0-9]/gi,"_").toLowerCase(),group:a(".caldera-group-nav.active").data("group")};var k=a(g(i));k.appendTo(e),f.append(h(i)),k.find("a").trigger("click"),d.remove()}else d.remove()}),a(".caldera-editor-body").on("change",".field-slug",function(b){this.value.length?this.value=this.value.replace(/[^a-z0-9]/gi,"_").toLowerCase():"change"===b.type&&(this.value=a(this).closest(".caldera-editor-field-config-wrapper").find(".field-label").val().replace(/[^a-z0-9]/gi,"_").toLowerCase())}),a(".caldera-editor-body").on("click",".caldera-add-group",function(){var c=a(this),d=c.data("group"),e=a("#"+d+"_panel_tmpl").html();c.parent().parent().append(e)}),a(".caldera-editor-body").on("click",".caldera-config-group-remove",function(){var c=a(".active-group-slug").val();a('[data-group="'+c+'"]').hide(0,function(){a(this).remove();var b=a(".caldera-group-nav");b.length?b.first().find("a").trigger("click"):a(".caldera-editor-fields-panel").hide()})}),a("body").on("click",".set-current-field",function(b){b.preventDefault();var c=a(this);a("#"+c.data("field")+"_type").val(c.data("type")).trigger("change"),a("#"+c.data("field")+"_lable").focus(),a("#field_setup_baldrickModalCloser").trigger("click")}),a(".caldera-editor-body").on("change",".field-config",function(){var d=a(this),e=d.closest(".caldera-editor-field-config-wrapper");current_form_fields&&(d.prop("id")===e.prop("id")+"_lable"&&(current_form_fields[e.prop("id")].label=this.value),d.prop("id")===e.prop("id")+"_slug"&&(current_form_fields[e.prop("id")].slug=this.value),d.prop("id")===e.prop("id")+"_type"&&(current_form_fields[e.prop("id")].type=this.value),e.length&&c(e.prop("id")))}),a(".caldera-editor-body").on("focus",".caldera-field-bind",function(b){var c=a(this),d=this.value;return console.log(b.type),b.type&&"focusin"===b.type?(c.removeClass("bound_field").addClass("reload-binding"),rebind_field_bindings(),this.value=d,void 0):void 0}),a(".caldera-editor-body").on("change",".caldera-conditional-field-set",function(){var k,l,c=a(this),d=c.parent().find(".compare-type"),e=c.data("condition"),f=c.data("id"),g="config["+e+"]["+f+"][conditions][group]["+c.data("row")+"]["+c.data("line")+"]",h=c.data("line"),i=a("#"+h+"_value"),j=i.find(".caldera-conditional-value-field").first(),m=[],n=this.value;if("{"!==n.substr(0,1)&&(k=a("#"+n),l=k.find(".field-button-type"),m=k.find(".caldera-config-group-toggle-options")),c.hasClass(".bind_init")&&c.addClass("bound_triggered"),j.length&&j.val().length&&i.data("value",j.val()),d.show(),m.length){var o=m.find(".toggle_option_row"),p='<select name="'+g+'[value]" class="caldera-processor-value-bind caldera-conditional-value-field" data-field="'+n+'" style="max-width: 220px; width: 220px;">';p+='<option value=""></option>',o.each(function(b,c){var d=a(c).find(".toggle_label_field"),e=d.data("option"),f="";i.data("value")&&(i.data("value").toString()===e||i.data("value").toString()===a(c).find(".toggle_value_field").val())&&(f=' selected="selected"'),p+='<option value="'+e+'"'+f+">"+d.val()+"</option>"}),p+="</select>"}else l&&"button"==l.val()?(d.val("is").hide(),p='<select name="'+g+'[value]" class="caldera-processor-value-bind caldera-conditional-value-field" data-field="'+n+'" style="max-width: 220px; width: 220px;">',p+='<option value="click" '+("click"===i.data("value")?'selected="selected"':"")+">Click</option>",p+='<option value="dblclick" '+("dblclick"===i.data("value")?'selected="selected"':"")+">Double Click</option>",p+="</select>"):p='<input name="'+g+'[value]" type="text" class="caldera-conditional-value-field magic-tag-enabled" value="'+(i.data("value")?i.data("value"):"")+'" style="max-width: 205px;">';i.html(p),init_magic_tags()}),a(".caldera-editor-body").on("change",".caldera-conditionals-usetype",function(){var c=a(this);""!==this.value?(a("#"+c.data("id")+"_condition_group_add").show(),a("#"+c.data("id")+"_conditional_wrap").show()):(a("#"+c.data("id")+"_condition_group_add").hide(),a("#"+c.data("id")+"_conditional_wrap").hide())}),a(".caldera-editor-body").on("click",".remove-conditional-line",function(b){b.preventDefault();var c=a(this),d=c.closest(".caldera-condition-line"),e=c.closest(".caldera-condition-group");d.remove(),e.find(".caldera-condition-line").length||e.remove()}),a(".caldera-group-nav").first().find("a").trigger("click"),a(".caldera-editor-body").on("change",".toggle_show_values",function(){var c=a(this),d=c.closest(".caldera-config-group-toggle-options");values=d.find(".toggle_value_field"),lables=d.find(".toggle_label_field"),field_lables=d.find(".caldera-config-group-option-labels"),c.prop("checked")?(values.show().parent().show(),values.show().parent().parent().show(),lables.css("width",""),field_lables.show()):(values.hide().parent().hide(),lables.css("width",245),field_lables.hide()),lables.trigger("toggle.values"),init_magic_tags()}),a(".caldera-editor-body").on("change",".auto-populate-type",function(){a(this).closest(".wrapper-instance-pane").find(".auto-populate-options").trigger("change")}),a(".caldera-editor-body").on("change",".auto-populate-options",function(){var b=a(this),c=b.closest(".wrapper-instance-pane"),d=c.find(".caldera-config-group-toggle-options"),e=c.find(".caldera-config-group-auto-options"),f=e.find(".auto-populate-type");e.find(".auto-populate-type-panel").hide(),b.prop("checked")?(d.hide(),e.show()):(d.show(),e.hide()),e.find(".caldera-config-group-auto-"+f.val()).show()}),a("body").on("change",".pin-toggle-roles",function(){var b=a(this),c=a("#caldera-pin-rules");"1"===b.val()?c.show():c.hide()}),a("body").on("click",".magic-tag-init",function(){var c=a(this),d=c.prev();d.focus().trigger("init.magic")}),a("body").on("keyup blur focus select click init.magic",".magic-tag-enabled",function(b){init_magic_tags();var c=a(this),d=c.parent(),e=d.closest(".wrapper-instance-pane").find(".caldera-select-field-type").val()?d.closest(".wrapper-instance-pane").find(".caldera-select-field-type").val():"hidden",f=d.find(".magic-tags-autocomplete"),g=f.find("ul"),h=this.value,j=[],k="",l=this.selectionStart,m=this.selectionEnd;if(f.length&&f.data("focus"))return b.preventDefault(),void 0;if(c.data("tag",""),this.selectionEnd>this.selectionStart)k=this.value.substr(this.selectionStart,this.selectionEnd-this.selectionStart);else if(("select"===b.type||"keyup"===b.type)&&40!==b.which&&38!==b.which&&39!==b.which&&37!==b.which){for(l=this.selectionStart;l>0;l--){var n=h.substr(l-1,1);if(" "===n||"\n"===n||("%"===n||"}"===n)&&this.selectionStart===l)break}for(m=this.selectionStart;m<h.length;m++){var n=h.substr(m,1);if(" "===n||"\n"===n||("%"===n||"{"===n)&&this.selectionStart===m)break}k=h.substr(l,m-l)}if("focusout"!==b.type){if("init"!==b.type&&k.length<3)return f.length&&f.remove(),void 0;f.length||(f=a('<div class="magic-tags-autocomplete"></div>'),g=a("<ul></ul>"),g.appendTo(f),f.insertAfter(c),f.on("mouseenter",function(){a(this).data("focus",!0)}),f.on("mouseleave",function(){a(this).data("focus",!1),c.is(":focus")||c.trigger("focusout")})),g.empty();var o="system",p=!1;"hidden"===e||"dropdown"===e||"radio"===e||"toggle_switch"===e||"checkbox"===e?(p=!0,e="text",o="all"):("paragraph"===e||"html"===e)&&(e="text"),c.data("type")&&(e=c.data("type")),e=e.split(","),e.push("vars");for(var q=0;q<e.length;q++)for(var r in system_values)if("undefined"!=typeof system_values[r].tags[e[q]]){if(j=[r],"system"!==r&&"variable"!==r&&"field"!==r){var s=jQuery(".processor-"+r),t=c.closest(".caldera-editor-processor-config-wrapper"),u=t.prop("id");j=[];for(var v=0;v<s.length;v++)if(t.length||p!==!0){if(u===s[v].id)continue;jQuery("li."+s[v].id).index()<jQuery("li."+u).index()&&j.push(s[v].id)}else j.push(s[v].id)}for(var w=0;w<j.length;w++)if("all"===o||o===r||"variable"===r){var x=a('<li class="header">'+system_values[r].type+(w>0?" ["+(w+1)+"]":"")+"</li>"),y=0;x.appendTo(g);for(var z=0;z<system_values[r].tags[e[q]].length;z++)if(!c.data("parent")||"variable:"+c.data("parent")!==system_values[r].tags[e[q]][z]){var A=system_values[r].wrap[0]+system_values[r].tags[e[q]][z]+system_values[r].wrap[1];if(j[w]!==r&&j.length>1&&(A=system_values[r].wrap[0]+system_values[r].tags[e[q]][z]+":"+j[w]+system_values[r].wrap[1]),A.indexOf(k)>=0||"init"===b.type){y+=1;var B=A.replace(k,"<strong>"+k+"</strong>"),C=a('<li class="tag" data-tag="'+A+'">'+B+"</li>");C.on("click",function(){var b=a(this).data("tag");c.val(h.substr(0,l)+b+h.substr(m)).trigger("change").focus(),c[0].selectionStart=l+b.length-(b.indexOf("*")>0?2:0),c[0].selectionEnd=l+b.length-(b.indexOf("*")>0?1:0)}),C.appendTo(g)}}0===y&&x.remove()}}}g.children().length||f.remove(),"focusout"===b.type&&setTimeout(function(){f.remove()},200)});for(var e=a(".cf-editor-template"),f=0;f<e.length;f++)compiled_templates[e[f].id]=Handlebars.compile(e[f].innerHTML);a(".caldera-select-field-type").not(".field-initialized").each(function(a,c){b(c)})});var rebuild_field_binding,rebind_field_bindings,current_form_fields={},required_errors={},add_new_grid_page,add_page_grid,init_magic_tags,core_form,compiled_templates={};init_magic_tags=function(){var a=jQuery(".magic-tag-enabled");a.each(function(a,b){var c=jQuery(b);if(c.hasClass("magic-tag-init-bound")){var d=c.parent().find(".magic-tag-init");return c.is(":visible")?d.show():d.hide(),void 0}var e=jQuery('<span class="icn-code magic-tag-init"></span>'),f=jQuery('<span style="position:relative;display:inline-block; width:100%;"></span>');c.is("input")&&e.css("borderBottom","none"),c.hasClass("caldera-conditional-value-field")&&f.width("auto"),c.wrap(f),e.insertAfter(c),c.addClass("magic-tag-init-bound"),c.is(":visible")?e.show():e.hide()})},rebuild_field_binding=function(){if(core_form||(core_form=jQuery(".caldera-forms-options-form")),core_form.hasClass("builder-loaded")){var a=jQuery(".caldera-editor-field-config-wrapper");system_values.field={tags:{text:[]},type:"Fields",wrap:["%","%"]};for(var b=0;b<a.length;b++){var c=a[b].id,d=jQuery("#"+c+"_lable").val(),e=jQuery("#"+c+"_slug").val(),f=jQuery("#"+c+"_type").val();"undefined"==typeof system_values.field.tags[f]&&(system_values.field.tags[f]=[]),system_values.field.tags[f].push(e),"text"!==f&&system_values.field.tags.text.push(e),current_form_fields[c]={label:d,slug:e,type:f},jQuery("option.bound-field").trigger("change").each(function(a,b){var c=jQuery(b);0!==c.prop("value").indexOf("{")?c.text(jQuery("#"+c.prop("value")+"_lable").val()+" ["+jQuery("#"+c.prop("value")+"_lable").val()+"]"):c.text(c.prop("value").replace("{","").replace("}",""))}).removeClass("bound-field")}}},rebind_field_bindings=function(){var b,c,a=jQuery(".caldera-field-bind").not(".bound_field");if(a.length){a.addClass("bound_field");for(var d=0;d<a.length;d++){var e=jQuery(a[d]),f=e.val(),g=e.data("default"),h=e.data("exclude"),i=0,j=e.closest(".caldera-editor-processor-config-wrapper"),k=j.prop("id"),l="";if(g&&!e.hasClass("reload-binding")&&(f=g),e.is("select")){e.empty();var m=jQuery('<optgroup label="Fields">');for(var n in current_form_fields)e.data("type")&&e.data("type").split(",").indexOf(current_form_fields[n].type)<0||(e.data("id")!==n&&m.append('<option value="'+n+'"'+(f===n?'selected="selected"':"")+">"+current_form_fields[n].label+" ["+current_form_fields[n].slug+"]</option>"),i+=1);m.appendTo(e),0===i&&e.empty();for(var o in system_values)if(b=[],!(h&&h.split(",").indexOf(o)>=0)){if("system"!==o&&"variable"!==o)for(var p=jQuery(".processor-"+o),q=0;q<p.length;q++)k!==p[q].id&&(b.push(p[q].id),p.length>1&&(c=jQuery("li."+p[q].id+" .processor-line-number"))&&c.html("["+(q+1)+"]"));else b.push("__system__");var r=[];e.data("type")?(r=e.data("type").split(","),r.push("vars")):r=["text","vars"];for(var s=0;s<r.length;s++)if(system_values[o].tags[r[s]])for(var t=0;t<b.length;t++){jQuery("li."+b[t]).index()>jQuery("li."+k).index()&&"__system__"!==b[t]?e.closest(".caldera-editor-processors-panel-wrap").length&&(l=' disabled="disabled"'):l="";for(var m=jQuery('<optgroup label="'+system_values[o].type+("__system__"!==b[t]?" "+jQuery("li."+b[t]).find(".processor-line-number").html():"")+'"'+l+">"),u=0;u<system_values[o].tags[r[s]].length;u++){var v=system_values[o].tags[r[s]][u];"__system__"!==b[t]&&(v=v.replace(o,b[t])),m.append('<option value="{'+v+'}"'+(f==="{"+v+"}"?'selected="selected"':"")+l+">"+system_values[o].tags[r[s]][u]+"</option>"),i+=1}m.children().length&&m.appendTo(e)}}if(0===i){if(e.empty(),e.data("type")){e.append('<option value="">No '+e.data("type").split(",").join(" or ")+" in form</option>");var w=!0}}else e.prop("disabled",!1);e.hasClass("required")||"undefined"!=typeof w||e.prepend('<option value=""></option>'),e.val(f)}}init_magic_tags(),jQuery(document).trigger("bound.fields"),jQuery(".caldera-header-save-button").prop("disabled",!1)}},jQuery(document).ready(function(a){function b(){var b=a(".layout-grid-panel"),c=0;b.each(function(b,d){var e=a(d),f=e.find(".layout-structure"),g=e.find(".row"),h=[];g.each(function(b,d){var e=a(d),f=e.children().not(".column-merge"),g=[];c+=1,f.each(function(b,d){span=a(d).attr("class").split("-"),g.push(span[2]);var e=a(d).find(".field-location");e.length&&e.each(function(d,e){var f=a(e);f.val(c+":"+(b+1)).removeAttr("disabled")})}),h.push(g.join(":"))}),f.val(h.join("|"))})}function c(b,c,e){var i,j,f="fld_"+Math.round(1e7*Math.random()),g=f,h=a("#field_config_panels");if(e){var k=a("#"+e).clone().wrap("<div>").parent().html().replace(new RegExp(e,"g"),"{{id}}");i=Handlebars.compile(k)}else i=Handlebars.compile(a("#caldera_field_config_wrapper_templ").html());j={id:g,label:"",slug:""},h.append(i(j)),b.removeClass("button-small").removeClass("button").removeClass("button-primary").removeClass("ui-draggable").removeClass("layout-new-form-field").addClass("layout-form-field").attr("data-config",f),b.find(".layout_field_name").remove(),b.find(".field-location").prop("name","config[layout_grid][fields]["+f+"]"),b.find(".settings-panel").show(),b.appendTo(c),d(),b.find(".icon-edit").trigger("click"),a("#"+f+"_lable").focus().select(),e&&(h.find(".field_config_string").val(""),h.find(".field-label").trigger("change")),rebuild_field_binding(),baldrickTriggers(),a("#"+f).trigger("field.drop"),a(document).trigger("field.added")}function d(){a(".toggle-options").sortable({handle:".dashicons-sort"}),a("#grid-pages-panel").sortable({placeholder:"row-drop-helper",handle:".sort-handle",items:".first-row-level",axis:"y",stop:function(){b()}}),a(".layout-column").sortable({connectWith:".layout-column",appendTo:"#grid-pages-panel",helper:"clone",items:".layout-form-field",handle:".drag-handle",cursor:"move",opacity:.7,cursorAt:{left:100,top:15},start:function(a,b){b.helper.css({width:"200px",height:"35px",paddingTop:"20px"})},stop:function(a,c){c.item.removeAttr("style"),b()}}),a("h3 .layout-new-form-field").draggable({helper:"clone",appendTo:"body"}),a(".page-toggle.button").droppable({accept:".layout-form-field",over:function(){a(this).trigger("click"),a(".layout-column").sortable("refresh")}}),a(".layout-column").droppable({greedy:!0,activeClass:"ui-state-dropper",hoverClass:"ui-state-hoverable",accept:".layout-new-form-field",drop:function(b,d){var e=d.draggable.clone(),f=a(this);c(e,f)}}),b()}add_new_grid_page=function(){return{page_no:"pg_"+Math.round(1e7*Math.random())}},add_page_grid=function(b){var c=a(".page-toggle").length+1,e=a('<button type="button" data-name="Page '+c+'" data-page="'+b.rawData.page_no+'" class="page-toggle button">'+b.params.trigger.data("addtitle")+" "+c+"</button> "),f=a("#page-toggles");e.appendTo(f),f.show(),d(),e.trigger("click"),1===c&&f.hide(),a(document).trigger("add.page")},a(document).on("remove.page add.page load.page",function(){var c=a(".page-toggle").length,d=a("#tab_pages");1>=c?d.hide():d.show()}),d(),a("#grid-pages-panel").on("click",".column-fieldinsert .dashicons-plus-alt",function(){var d=a(this).closest(".column-container"),e=a("#newfield-tool").clone();c(e,d)}),a("#grid-pages-panel").on("click",".column-fieldinsert .dashicons-admin-generic",function(){}),a("#grid-pages-panel").on("click",".column-split",function(){var c=a(this).parent().parent(),e=c.attr("class").split("-"),f=a("<div>").insertAfter(c),g=Math.ceil(e[2]/2),h=Math.floor(e[2]/2);e[2]=g,c.attr("class",e.join("-")),e[2]=h,f.addClass(e.join("-")).append('<div class="layout-column column-container">'),a(this).remove(),d(),jQuery(".column-tools").remove(),jQuery(".column-merge").remove()}),a("#grid-pages-panel").on("click",".column-remove",function(){var d=a(this).closest(".row"),e=d.find(".layout-form-field"),f=d.closest(".layout-grid-panel");if(e.length){if(!confirm(a("#row-remove-fields-message").text()))return;e.each(function(b,c){var d=a(c).data("config");a("#"+d).remove(),a('option[value="'+d+'"]').remove(),a('[data-bind="'+d+'"]').remove(),delete current_form_fields[d]})}d.slideUp(200,function(){if(a(this).remove(),b(),rebuild_field_binding(),!f.find(".row").length){f.remove();var c=a("#page-toggles .button-primary"),d=c.prev(),e=c.next();c.remove(),d.length?d.trigger("click"):e.trigger("click")}a(document).trigger("remove.page")}),jQuery(".column-tools").remove(),jQuery(".column-merge").remove()}),a(".caldera-config-editor-main-panel").on("click",".caldera-add-row",function(c){c.preventDefault();var e=a(".page-active");return e.length?(a(".page-active").append('<div class="first-row-level row"><div class="col-xs-12"><div class="layout-column column-container"></div></div></div>'),d(),b(),void 0):(a(".caldera-add-page").trigger("click"),void 0)}),a("#grid-pages-panel").on("click",".column-join",function(){var d=a(this).parent().parent().parent(),e=d.prev(),f=e.attr("class").split("-"),g=d.attr("class").split("-");f[2]=parseFloat(f[2])+parseFloat(g[2]),d.find(".layout-column").contents().appendTo(e.find(".layout-column")),e.attr("class",f.join("-")),d.remove(),b(),jQuery(".column-tools").remove(),jQuery(".column-merge").remove()}),a("#grid-pages-panel").on("mouseenter",".row",function(){var d=jQuery(this);jQuery(".column-tools,.column-merge").remove(),d.children().children().first().append('<div class="column-remove column-tools"><i class="icon-remove"></i></div>'),d.children().children().last().append('<div class="column-sort column-tools" style="text-align:right;"><i class="dashicons dashicons-menu drag-handle sort-handle"></i></div>'),d.children().children().not(":first").prepend('<div class="column-merge"><div class="column-join column-tools"><i class="icon-join"></i></div></div>');var e=d.parent().parent().parent().width()/12-1;d.children().children().each(function(b,c){var d=a(c),e=d.width()/2-5;d.prepend('<div class="column-fieldinsert column-tools"><i class="dashicons dashicons-plus-alt"></i></div>'),d.parent().hasClass("col-xs-1")||(d.prepend('<div class="column-split column-tools"><i class="dashicons dashicons-leftright"></i></div>'),d.find(".column-split").css("left",e))}),jQuery(".column-merge").draggable({axis:"x",helper:"clone",appendTo:d,grid:[e,0],drag:function(c,d){a(this).addClass("dragging"),a(".column-tools").remove(),a(".column-split").remove();var e=a(this).parent().parent(),f=d.helper,g=d.originalPosition.left>f.position().left?"left":"right",i=e.prev(),j=Math.round(e.parent().width()/12-10),k=Math.abs(d.originalPosition.left-f.position().left);if(e.parent().addClass("sizing"),k>=j){var l=i.attr("class").split("-"),m=e.attr("class").split("-");l[2]=parseFloat(l[2]),m[2]=parseFloat(m[2]),"left"===g?(l[2]--,m[2]++,l[2]>0&&l[2]<l[2]+m[2]?(i.attr("class",l.join("-")),e.attr("class",m.join("-")),d.originalPosition.left=f.position().left):a(this).draggable("option","disabled",!0)):(l[2]++,m[2]--,m[2]>0&&m[2]<m[2]+m[2]?(i.attr("class",l.join("-")),e.attr("class",m.join("-")),d.originalPosition.left=f.position().left):a(this).draggable("option","disabled",!0)),b()}},stop:function(){a(this).removeClass("dragging").parent().parent().parent().removeClass("sizing")
|
2 |
+
}})}),a("#grid-pages-panel").on("mouseleave",".row",function(){jQuery(".column-tools").remove(),jQuery(".column-merge").remove()}),a("#grid-pages-panel").on("click",".layout-form-field .icon-remove",function(){var b=a(this),c=b.parent(),d=a("#"+c.data("config"));c.slideUp(100,function(){a(this).remove()}),d.slideUp(100,function(){a(this).remove()})}),a("#grid-pages-panel").on("click",".layout-form-field .icon-edit",function(){var b=a(this),c=b.parent(),d=a("#"+c.data("config")+"_type").val();a(".caldera-editor-field-config-wrapper").hide(),c.hasClass("field-edit-open")?c.removeClass("field-edit-open"):(a(".layout-form-field").removeClass("field-edit-open"),c.addClass("field-edit-open"),a("#"+c.data("config")).show()),a(document).trigger("show."+c.data("config")),("radio"===d||"checkbox"===d||"dropdown"===d||"toggle_switch"===d)&&a("#"+c.data("config")+"_auto").trigger("change")}),a("body").on("click",".layout-modal-edit-closer,.layout-modal-save-action",function(b){b.preventDefault();var c=a(this),d=a(".layout-form-field.edit-open"),e=c.closest(".layout-modal-container");settings=e.find(".settings-panel").first(),a(".edit-open").removeClass("edit-open"),settings.appendTo(d.find(".settings-wrapper")).hide(),e.hide()}),a(".layout-editor-body").on("change",".layout-core-pod-query",function(){a(this).parent().find(".settings-panel-row").remove(),a(".edit-open").find(".drag-handle .set-pod").html(" - "+a(this).val())}),a(".layout-editor-body").on("click",".remove-where",function(){a(this).closest(".settings-panel-row").remove()}),a(".layout-editor-body").on("click",".use-pod-container",function(){var b=a(this),c=b.prev(),d=c.val();if(d.length){a(".edit-open").find(".drag-handle .set-pod").html(" - "+c.val()),b.parent().parent().find(".spinner").css("display","inline-block");var f={action:"pq_loadpod",pod_reference:{pod:d}};a.post(ajaxurl,f,function(c){b.parent().find(".spinner").css("display","none");var d=a("#where-line-tmpl").html(),e="",f=b.closest(".settings-panel").data("container");for(var g in c)e+='<option value="'+c[g]+'">'+c[g]+"</option>";d=d.replace(/{{fields}}/g,e).replace(/{{container_id}}/g,f),b.parent().append(d)})}}),a(".caldera-editor-header").on("click",".column-sort .icon-edit",function(){}),a(".layout-editor-body").on("tray_loaded",".layout-template-tray",function(){d()}),a(".caldera-editor-header").on("click",".caldera-editor-header-nav a",function(b){b.preventDefault();var c=a(this);a(".caldera-editor-header-nav li").removeClass("active"),a(".caldera-editor-body").hide(),a(c.attr("href")).show(),c.parent().addClass("active"),rebind_field_bindings()}),a("body").on("change",".required",function(){check_required_bindings(this)}),a("body").on("submit",".caldera-forms-options-form",function(b){var c=a(".required.has-error");c.length&&b.preventDefault()}),a(".caldera-editor-body").on("click",".add-toggle-option",function(){var c=a(this);if(c.data("bulk"))return a(c.data("bulk")).toggle(),a(c.data("bulk")).find("textarea").focus(),void 0;var d=c.closest(".caldera-editor-field-config-wrapper"),e=d.find(".toggle-options"),f=a("#field-option-row-tmpl").html(),g=Handlebars.compile(f),h="opt"+parseInt(1048576*(Math.random()+1)),i={_name:"config[fields]["+d.prop("id")+"][config]",option:{}};if(c.data("options")){for(var j=a(c.data("options")),k=j.val().split("\n"),l=0;l<k.length;l++)i.option["opt"+parseInt(1048576*(Math.random()+l))]={value:k[l],label:k[l],"default":!1};a(c.data("options")).parent().hide(),j.val(""),e.empty()}else i.option[h]={value:"",label:"","default":!1};e.append(g(i)),d.find(".toggle_show_values").trigger("change"),a(".toggle-options").sortable({handle:".dashicons-sort"}),k||e.find(".toggle_label_field").last().focus()}),a(".caldera-editor-body").on("click",".toggle-remove-option",function(){var c=a(this).closest(".caldera-editor-field-config-wrapper").find(".field-config").first();a(this).parent().remove(),c.trigger("change")}),a(".caldera-editor-body").on("click",".page-toggle",function(){var c=a(this),d=c.parent(),e=d.find(".button");e.removeClass("button-primary"),a(".layout-grid-panel").hide().removeClass("page-active"),a("#"+c.data("page")).show().addClass("page-active"),c.addClass("button-primary"),e.each(function(b,c){a(c).html(d.data("title")+" "+(b+1))}),1===e.length&&d.hide()}),a(".caldera-editor-body").on("blur toggle.values",".toggle_label_field",function(){var c=a(this),d=c.prev();d.val().length||d.val(c.val())}),rebuild_field_binding(),a(document).trigger("load.page")}),Handlebars.registerHelper("_options_config",function(){}),jQuery(document).ready(function(a){function b(){a(".caldera-editor-processors-panel ul").sortable({update:function(){rebuild_field_binding()}})}function c(b){var c=a(b),d=a("#"+c.val()+"-tmpl").length?a("#"+c.val()+"-tmpl").html():"",e=c.closest(".caldera-editor-processor-config-wrapper"),f=e.find(".caldera-config-processor-setup"),g=Handlebars.compile(d),h=e.find(".processor_config_string").val(),i=c.data("type");h=h.length&&i===c.val()?JSON.parse(h):processor_defaults[c.val()+"_cfg"],h||(h={}),h._id=e.prop("id"),h._name="config[processors]["+e.prop("id")+"][config]",g=a("<div>").html(g(h)),f.html(g.html()),"function"==typeof window[c.val()+"_init"]&&window[c.val()+"_init"](e.prop("id"),f),e.find(".no-conditions").length&&e.find(".toggle_option_tab").remove(),rebuild_field_binding(),baldrickTriggers()}a("body").on("click",".caldera-processor-nav a",function(b){b.preventDefault();var c=a(this);a(".caldera-processor-nav").removeClass("active"),a(".caldera-editor-processor-config-wrapper").hide(),a(c.attr("href")).show(),c.parent().addClass("active")}),a("body").on("click",".add-new-processor",function(){var d=a(this),e=Handlebars.compile(a("#processor-wrapper-tmpl").html());wrap=a(".active-processors-list"),process_conf=a(".caldera-editor-processor-config"),processid=Math.round(1e8*Math.random()),new_templ=Handlebars.compile(a("#processor-line-tmpl").html()),new_proc={id:"fp_"+processid,type:d.data("type")},wrap.append(new_templ(new_proc)),process_conf.append(e(new_proc)),a("#form_processor_baldrickModalCloser").trigger("click"),a(".caldera-processor-nav a").last().trigger("click"),a("#fp_"+processid+"_type").val(d.data("type")).trigger("change"),b(),baldrickTriggers()}),a("body").on("click",".delete-processor",function(){var c=a(this),d=c.closest(".caldera-editor-processor-config-wrapper");d.data("type"),confirm(c.data("confirm"))&&(a("."+d.prop("id")).remove(),d.remove(),a(".caldera-processor-nav a").first().trigger("click"),rebuild_field_binding())}),a("body").on("change",".caldera-select-processor-type",function(){var d=a(this),e=d.closest(".caldera-editor-processor-config-wrapper"),f=d.find('option[value="'+d.val()+'"]').text(),g=e.find(".caldera-editor-processor-title"),h=a(".caldera-processor-nav.active a");""===f&&(f=g.data("title")),g.html(f),h.html(f+' <span class="processor-line-number"></span>').parent().addClass("processor_type_"+d.val()),c(this),rebuild_field_binding()}),rebuild_field_binding(),a(".caldera-select-processor-type").each(function(a,b){c(b)}),b()}),Handlebars.registerHelper("_field",function(a){var b=this,c="",d="",e="",f=this[a.hash.slug]?' data-default="'+this[a.hash.slug]+'"':"";a.hash.required&&(c=" required"),a.hash.exclude&&(e='data-exclude="'+a.hash.exclude+'"'),a.hash.array&&(d="[]","true"!==a.hash.array&&(f='value="'+a.hash.array+'"')),out="<select "+(a.hash.type?'data-type="'+a.hash.type+'"':"")+f+" "+e+' name="'+this._name+"["+a.hash.slug+"]"+d+'" id="'+this._id+"_"+a.hash.slug+'" class="block-input field-config caldera-field-bind'+c+'">',this[a.hash.slug]?out+='<option class="bound-field" value="'+this[a.hash.slug]+'" class="bound-field"></option>':a.hash.required||(out+='<option value=""></option>');for(var g in current_form_fields){var h="";a.hash.type&¤t_form_fields[g].type!==a.hash.type||(b[a.hash.slug]&&b[a.hash.slug]===g&&(h=' selected="selected"'),out+='<option value="'+g+'"'+h+">"+current_form_fields[g].label+" ["+current_form_fields[g].slug+"]</option>")}return out+="</select>",a.hash.required&&(out+='<input class="field-config" name="'+this._name+'[_required_bounds][]" type="hidden" value="'+a.hash.slug+'">'),out}),Handlebars.registerHelper("console",function(){console.log(this)});
|
assets/js/shortcode-insert.js
CHANGED
@@ -32,7 +32,7 @@ jQuery(function($){
|
|
32 |
$('.caldera-modal-closer').trigger('click');
|
33 |
|
34 |
});
|
35 |
-
|
36 |
if( typeof wp !== 'undefined' && typeof wp.media !== 'undefined' ){
|
37 |
|
38 |
var media = wp.media;
|
@@ -90,6 +90,6 @@ jQuery(function($){
|
|
90 |
}
|
91 |
} );
|
92 |
}
|
93 |
-
}
|
94 |
|
95 |
});//
|
32 |
$('.caldera-modal-closer').trigger('click');
|
33 |
|
34 |
});
|
35 |
+
/*
|
36 |
if( typeof wp !== 'undefined' && typeof wp.media !== 'undefined' ){
|
37 |
|
38 |
var media = wp.media;
|
90 |
}
|
91 |
} );
|
92 |
}
|
93 |
+
}*/
|
94 |
|
95 |
});//
|
assets/js/shortcode-insert.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(function(a){
|
1 |
+
jQuery(function(a){a("body").on("click","#caldera-forms-form-insert,#wp_fs_caldera-forms",function(b){b.preventDefault();var c=a(".caldera-forms-insert-modal");c.fadeIn(100)}),a("body").on("click",".caldera-modal-closer",function(b){b.preventDefault();var c=a(".caldera-forms-insert-modal");c.fadeOut(100)}),a("body").on("click",".caldera-form-shortcode-insert",function(b){b.preventDefault();var d,c=a(".selected-form-shortcode:checked");c.length&&(d='[caldera_form id="'+c.val()+'"]',c.prop("checked",!1),window.send_to_editor(d),a(".caldera-modal-closer").trigger("click"))})});
|
assets/js/wp-baldrick-full.js
ADDED
@@ -0,0 +1,4961 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
|
3 |
+
handlebars v3.0.0
|
4 |
+
|
5 |
+
Copyright (C) 2011-2014 by Yehuda Katz
|
6 |
+
|
7 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
8 |
+
of this software and associated documentation files (the "Software"), to deal
|
9 |
+
in the Software without restriction, including without limitation the rights
|
10 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11 |
+
copies of the Software, and to permit persons to whom the Software is
|
12 |
+
furnished to do so, subject to the following conditions:
|
13 |
+
|
14 |
+
The above copyright notice and this permission notice shall be included in
|
15 |
+
all copies or substantial portions of the Software.
|
16 |
+
|
17 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23 |
+
THE SOFTWARE.
|
24 |
+
|
25 |
+
@license
|
26 |
+
*/
|
27 |
+
/* exported Handlebars */
|
28 |
+
(function (root, factory) {
|
29 |
+
if (typeof define === 'function' && define.amd) {
|
30 |
+
define([], factory);
|
31 |
+
} else if (typeof exports === 'object') {
|
32 |
+
module.exports = factory();
|
33 |
+
} else {
|
34 |
+
root.Handlebars = factory();
|
35 |
+
}
|
36 |
+
}(this, function () {
|
37 |
+
// handlebars/utils.js
|
38 |
+
var __module3__ = (function() {
|
39 |
+
"use strict";
|
40 |
+
var __exports__ = {};
|
41 |
+
/*jshint -W004 */
|
42 |
+
var escape = {
|
43 |
+
"&": "&",
|
44 |
+
"<": "<",
|
45 |
+
">": ">",
|
46 |
+
'"': """,
|
47 |
+
"'": "'",
|
48 |
+
"`": "`"
|
49 |
+
};
|
50 |
+
|
51 |
+
var badChars = /[&<>"'`]/g;
|
52 |
+
var possible = /[&<>"'`]/;
|
53 |
+
|
54 |
+
function escapeChar(chr) {
|
55 |
+
return escape[chr];
|
56 |
+
}
|
57 |
+
|
58 |
+
function extend(obj /* , ...source */) {
|
59 |
+
for (var i = 1; i < arguments.length; i++) {
|
60 |
+
for (var key in arguments[i]) {
|
61 |
+
if (Object.prototype.hasOwnProperty.call(arguments[i], key)) {
|
62 |
+
obj[key] = arguments[i][key];
|
63 |
+
}
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
return obj;
|
68 |
+
}
|
69 |
+
|
70 |
+
__exports__.extend = extend;var toString = Object.prototype.toString;
|
71 |
+
__exports__.toString = toString;
|
72 |
+
// Sourced from lodash
|
73 |
+
// https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
|
74 |
+
var isFunction = function(value) {
|
75 |
+
return typeof value === 'function';
|
76 |
+
};
|
77 |
+
// fallback for older versions of Chrome and Safari
|
78 |
+
/* istanbul ignore next */
|
79 |
+
if (isFunction(/x/)) {
|
80 |
+
isFunction = function(value) {
|
81 |
+
return typeof value === 'function' && toString.call(value) === '[object Function]';
|
82 |
+
};
|
83 |
+
}
|
84 |
+
var isFunction;
|
85 |
+
__exports__.isFunction = isFunction;
|
86 |
+
/* istanbul ignore next */
|
87 |
+
var isArray = Array.isArray || function(value) {
|
88 |
+
return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false;
|
89 |
+
};
|
90 |
+
__exports__.isArray = isArray;
|
91 |
+
// Older IE versions do not directly support indexOf so we must implement our own, sadly.
|
92 |
+
function indexOf(array, value) {
|
93 |
+
for (var i = 0, len = array.length; i < len; i++) {
|
94 |
+
if (array[i] === value) {
|
95 |
+
return i;
|
96 |
+
}
|
97 |
+
}
|
98 |
+
return -1;
|
99 |
+
}
|
100 |
+
|
101 |
+
__exports__.indexOf = indexOf;
|
102 |
+
function escapeExpression(string) {
|
103 |
+
// don't escape SafeStrings, since they're already safe
|
104 |
+
if (string && string.toHTML) {
|
105 |
+
return string.toHTML();
|
106 |
+
} else if (string == null) {
|
107 |
+
return "";
|
108 |
+
} else if (!string) {
|
109 |
+
return string + '';
|
110 |
+
}
|
111 |
+
|
112 |
+
// Force a string conversion as this will be done by the append regardless and
|
113 |
+
// the regex test will do this transparently behind the scenes, causing issues if
|
114 |
+
// an object's to string has escaped characters in it.
|
115 |
+
string = "" + string;
|
116 |
+
|
117 |
+
if(!possible.test(string)) { return string; }
|
118 |
+
return string.replace(badChars, escapeChar);
|
119 |
+
}
|
120 |
+
|
121 |
+
__exports__.escapeExpression = escapeExpression;function isEmpty(value) {
|
122 |
+
if (!value && value !== 0) {
|
123 |
+
return true;
|
124 |
+
} else if (isArray(value) && value.length === 0) {
|
125 |
+
return true;
|
126 |
+
} else {
|
127 |
+
return false;
|
128 |
+
}
|
129 |
+
}
|
130 |
+
|
131 |
+
__exports__.isEmpty = isEmpty;function blockParams(params, ids) {
|
132 |
+
params.path = ids;
|
133 |
+
return params;
|
134 |
+
}
|
135 |
+
|
136 |
+
__exports__.blockParams = blockParams;function appendContextPath(contextPath, id) {
|
137 |
+
return (contextPath ? contextPath + '.' : '') + id;
|
138 |
+
}
|
139 |
+
|
140 |
+
__exports__.appendContextPath = appendContextPath;
|
141 |
+
return __exports__;
|
142 |
+
})();
|
143 |
+
|
144 |
+
// handlebars/exception.js
|
145 |
+
var __module4__ = (function() {
|
146 |
+
"use strict";
|
147 |
+
var __exports__;
|
148 |
+
|
149 |
+
var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
|
150 |
+
|
151 |
+
function Exception(message, node) {
|
152 |
+
var loc = node && node.loc,
|
153 |
+
line,
|
154 |
+
column;
|
155 |
+
if (loc) {
|
156 |
+
line = loc.start.line;
|
157 |
+
column = loc.start.column;
|
158 |
+
|
159 |
+
message += ' - ' + line + ':' + column;
|
160 |
+
}
|
161 |
+
|
162 |
+
var tmp = Error.prototype.constructor.call(this, message);
|
163 |
+
|
164 |
+
// Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
|
165 |
+
for (var idx = 0; idx < errorProps.length; idx++) {
|
166 |
+
this[errorProps[idx]] = tmp[errorProps[idx]];
|
167 |
+
}
|
168 |
+
|
169 |
+
if (loc) {
|
170 |
+
this.lineNumber = line;
|
171 |
+
this.column = column;
|
172 |
+
}
|
173 |
+
}
|
174 |
+
|
175 |
+
Exception.prototype = new Error();
|
176 |
+
|
177 |
+
__exports__ = Exception;
|
178 |
+
return __exports__;
|
179 |
+
})();
|
180 |
+
|
181 |
+
// handlebars/base.js
|
182 |
+
var __module2__ = (function(__dependency1__, __dependency2__) {
|
183 |
+
"use strict";
|
184 |
+
var __exports__ = {};
|
185 |
+
var Utils = __dependency1__;
|
186 |
+
var Exception = __dependency2__;
|
187 |
+
|
188 |
+
var VERSION = "3.0.0";
|
189 |
+
__exports__.VERSION = VERSION;var COMPILER_REVISION = 6;
|
190 |
+
__exports__.COMPILER_REVISION = COMPILER_REVISION;
|
191 |
+
var REVISION_CHANGES = {
|
192 |
+
1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it
|
193 |
+
2: '== 1.0.0-rc.3',
|
194 |
+
3: '== 1.0.0-rc.4',
|
195 |
+
4: '== 1.x.x',
|
196 |
+
5: '== 2.0.0-alpha.x',
|
197 |
+
6: '>= 2.0.0-beta.1'
|
198 |
+
};
|
199 |
+
__exports__.REVISION_CHANGES = REVISION_CHANGES;
|
200 |
+
var isArray = Utils.isArray,
|
201 |
+
isFunction = Utils.isFunction,
|
202 |
+
toString = Utils.toString,
|
203 |
+
objectType = '[object Object]';
|
204 |
+
|
205 |
+
function HandlebarsEnvironment(helpers, partials) {
|
206 |
+
this.helpers = helpers || {};
|
207 |
+
this.partials = partials || {};
|
208 |
+
|
209 |
+
registerDefaultHelpers(this);
|
210 |
+
}
|
211 |
+
|
212 |
+
__exports__.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = {
|
213 |
+
constructor: HandlebarsEnvironment,
|
214 |
+
|
215 |
+
logger: logger,
|
216 |
+
log: log,
|
217 |
+
|
218 |
+
registerHelper: function(name, fn) {
|
219 |
+
if (toString.call(name) === objectType) {
|
220 |
+
if (fn) { throw new Exception('Arg not supported with multiple helpers'); }
|
221 |
+
Utils.extend(this.helpers, name);
|
222 |
+
} else {
|
223 |
+
this.helpers[name] = fn;
|
224 |
+
}
|
225 |
+
},
|
226 |
+
unregisterHelper: function(name) {
|
227 |
+
delete this.helpers[name];
|
228 |
+
},
|
229 |
+
|
230 |
+
registerPartial: function(name, partial) {
|
231 |
+
if (toString.call(name) === objectType) {
|
232 |
+
Utils.extend(this.partials, name);
|
233 |
+
} else {
|
234 |
+
if (typeof partial === 'undefined') {
|
235 |
+
throw new Exception('Attempting to register a partial as undefined');
|
236 |
+
}
|
237 |
+
this.partials[name] = partial;
|
238 |
+
}
|
239 |
+
},
|
240 |
+
unregisterPartial: function(name) {
|
241 |
+
delete this.partials[name];
|
242 |
+
}
|
243 |
+
};
|
244 |
+
|
245 |
+
function registerDefaultHelpers(instance) {
|
246 |
+
instance.registerHelper('helperMissing', function(/* [args, ]options */) {
|
247 |
+
if(arguments.length === 1) {
|
248 |
+
// A missing field in a {{foo}} constuct.
|
249 |
+
return undefined;
|
250 |
+
} else {
|
251 |
+
// Someone is actually trying to call something, blow up.
|
252 |
+
throw new Exception("Missing helper: '" + arguments[arguments.length-1].name + "'");
|
253 |
+
}
|
254 |
+
});
|
255 |
+
|
256 |
+
instance.registerHelper('blockHelperMissing', function(context, options) {
|
257 |
+
var inverse = options.inverse,
|
258 |
+
fn = options.fn;
|
259 |
+
|
260 |
+
if(context === true) {
|
261 |
+
return fn(this);
|
262 |
+
} else if(context === false || context == null) {
|
263 |
+
return inverse(this);
|
264 |
+
} else if (isArray(context)) {
|
265 |
+
if(context.length > 0) {
|
266 |
+
if (options.ids) {
|
267 |
+
options.ids = [options.name];
|
268 |
+
}
|
269 |
+
|
270 |
+
return instance.helpers.each(context, options);
|
271 |
+
} else {
|
272 |
+
return inverse(this);
|
273 |
+
}
|
274 |
+
} else {
|
275 |
+
if (options.data && options.ids) {
|
276 |
+
var data = createFrame(options.data);
|
277 |
+
data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name);
|
278 |
+
options = {data: data};
|
279 |
+
}
|
280 |
+
|
281 |
+
return fn(context, options);
|
282 |
+
}
|
283 |
+
});
|
284 |
+
|
285 |
+
instance.registerHelper('each', function(context, options) {
|
286 |
+
if (!options) {
|
287 |
+
throw new Exception('Must pass iterator to #each');
|
288 |
+
}
|
289 |
+
|
290 |
+
var fn = options.fn, inverse = options.inverse;
|
291 |
+
var i = 0, ret = "", data;
|
292 |
+
|
293 |
+
var contextPath;
|
294 |
+
if (options.data && options.ids) {
|
295 |
+
contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.';
|
296 |
+
}
|
297 |
+
|
298 |
+
if (isFunction(context)) { context = context.call(this); }
|
299 |
+
|
300 |
+
if (options.data) {
|
301 |
+
data = createFrame(options.data);
|
302 |
+
}
|
303 |
+
|
304 |
+
function execIteration(key, i, last) {
|
305 |
+
if (data) {
|
306 |
+
data.key = key;
|
307 |
+
data.index = i;
|
308 |
+
data.first = i === 0;
|
309 |
+
data.last = !!last;
|
310 |
+
|
311 |
+
if (contextPath) {
|
312 |
+
data.contextPath = contextPath + key;
|
313 |
+
}
|
314 |
+
}
|
315 |
+
|
316 |
+
ret = ret + fn(context[key], {
|
317 |
+
data: data,
|
318 |
+
blockParams: Utils.blockParams([context[key], key], [contextPath + key, null])
|
319 |
+
});
|
320 |
+
}
|
321 |
+
|
322 |
+
if(context && typeof context === 'object') {
|
323 |
+
if (isArray(context)) {
|
324 |
+
for(var j = context.length; i<j; i++) {
|
325 |
+
execIteration(i, i, i === context.length-1);
|
326 |
+
}
|
327 |
+
} else {
|
328 |
+
var priorKey;
|
329 |
+
|
330 |
+
for(var key in context) {
|
331 |
+
if(context.hasOwnProperty(key)) {
|
332 |
+
// We're running the iterations one step out of sync so we can detect
|
333 |
+
// the last iteration without have to scan the object twice and create
|
334 |
+
// an itermediate keys array.
|
335 |
+
if (priorKey) {
|
336 |
+
execIteration(priorKey, i-1);
|
337 |
+
}
|
338 |
+
priorKey = key;
|
339 |
+
i++;
|
340 |
+
}
|
341 |
+
}
|
342 |
+
if (priorKey) {
|
343 |
+
execIteration(priorKey, i-1, true);
|
344 |
+
}
|
345 |
+
}
|
346 |
+
}
|
347 |
+
|
348 |
+
if(i === 0){
|
349 |
+
ret = inverse(this);
|
350 |
+
}
|
351 |
+
|
352 |
+
return ret;
|
353 |
+
});
|
354 |
+
|
355 |
+
instance.registerHelper('if', function(conditional, options) {
|
356 |
+
if (isFunction(conditional)) { conditional = conditional.call(this); }
|
357 |
+
|
358 |
+
// Default behavior is to render the positive path if the value is truthy and not empty.
|
359 |
+
// The `includeZero` option may be set to treat the condtional as purely not empty based on the
|
360 |
+
// behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
|
361 |
+
if ((!options.hash.includeZero && !conditional) || Utils.isEmpty(conditional)) {
|
362 |
+
return options.inverse(this);
|
363 |
+
} else {
|
364 |
+
return options.fn(this);
|
365 |
+
}
|
366 |
+
});
|
367 |
+
|
368 |
+
instance.registerHelper('unless', function(conditional, options) {
|
369 |
+
return instance.helpers['if'].call(this, conditional, {fn: options.inverse, inverse: options.fn, hash: options.hash});
|
370 |
+
});
|
371 |
+
|
372 |
+
instance.registerHelper('with', function(context, options) {
|
373 |
+
if (isFunction(context)) { context = context.call(this); }
|
374 |
+
|
375 |
+
var fn = options.fn;
|
376 |
+
|
377 |
+
if (!Utils.isEmpty(context)) {
|
378 |
+
if (options.data && options.ids) {
|
379 |
+
var data = createFrame(options.data);
|
380 |
+
data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]);
|
381 |
+
options = {data:data};
|
382 |
+
}
|
383 |
+
|
384 |
+
return fn(context, options);
|
385 |
+
} else {
|
386 |
+
return options.inverse(this);
|
387 |
+
}
|
388 |
+
});
|
389 |
+
|
390 |
+
instance.registerHelper('log', function(message, options) {
|
391 |
+
var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
|
392 |
+
instance.log(level, message);
|
393 |
+
});
|
394 |
+
|
395 |
+
instance.registerHelper('lookup', function(obj, field) {
|
396 |
+
return obj && obj[field];
|
397 |
+
});
|
398 |
+
}
|
399 |
+
|
400 |
+
var logger = {
|
401 |
+
methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' },
|
402 |
+
|
403 |
+
// State enum
|
404 |
+
DEBUG: 0,
|
405 |
+
INFO: 1,
|
406 |
+
WARN: 2,
|
407 |
+
ERROR: 3,
|
408 |
+
level: 1,
|
409 |
+
|
410 |
+
// Can be overridden in the host environment
|
411 |
+
log: function(level, message) {
|
412 |
+
if (typeof console !== 'undefined' && logger.level <= level) {
|
413 |
+
var method = logger.methodMap[level];
|
414 |
+
(console[method] || console.log).call(console, message);
|
415 |
+
}
|
416 |
+
}
|
417 |
+
};
|
418 |
+
__exports__.logger = logger;
|
419 |
+
var log = logger.log;
|
420 |
+
__exports__.log = log;
|
421 |
+
var createFrame = function(object) {
|
422 |
+
var frame = Utils.extend({}, object);
|
423 |
+
frame._parent = object;
|
424 |
+
return frame;
|
425 |
+
};
|
426 |
+
__exports__.createFrame = createFrame;
|
427 |
+
return __exports__;
|
428 |
+
})(__module3__, __module4__);
|
429 |
+
|
430 |
+
// handlebars/safe-string.js
|
431 |
+
var __module5__ = (function() {
|
432 |
+
"use strict";
|
433 |
+
var __exports__;
|
434 |
+
// Build out our basic SafeString type
|
435 |
+
function SafeString(string) {
|
436 |
+
this.string = string;
|
437 |
+
}
|
438 |
+
|
439 |
+
SafeString.prototype.toString = SafeString.prototype.toHTML = function() {
|
440 |
+
return "" + this.string;
|
441 |
+
};
|
442 |
+
|
443 |
+
__exports__ = SafeString;
|
444 |
+
return __exports__;
|
445 |
+
})();
|
446 |
+
|
447 |
+
// handlebars/runtime.js
|
448 |
+
var __module6__ = (function(__dependency1__, __dependency2__, __dependency3__) {
|
449 |
+
"use strict";
|
450 |
+
var __exports__ = {};
|
451 |
+
var Utils = __dependency1__;
|
452 |
+
var Exception = __dependency2__;
|
453 |
+
var COMPILER_REVISION = __dependency3__.COMPILER_REVISION;
|
454 |
+
var REVISION_CHANGES = __dependency3__.REVISION_CHANGES;
|
455 |
+
var createFrame = __dependency3__.createFrame;
|
456 |
+
|
457 |
+
function checkRevision(compilerInfo) {
|
458 |
+
var compilerRevision = compilerInfo && compilerInfo[0] || 1,
|
459 |
+
currentRevision = COMPILER_REVISION;
|
460 |
+
|
461 |
+
if (compilerRevision !== currentRevision) {
|
462 |
+
if (compilerRevision < currentRevision) {
|
463 |
+
var runtimeVersions = REVISION_CHANGES[currentRevision],
|
464 |
+
compilerVersions = REVISION_CHANGES[compilerRevision];
|
465 |
+
throw new Exception("Template was precompiled with an older version of Handlebars than the current runtime. "+
|
466 |
+
"Please update your precompiler to a newer version ("+runtimeVersions+") or downgrade your runtime to an older version ("+compilerVersions+").");
|
467 |
+
} else {
|
468 |
+
// Use the embedded version info since the runtime doesn't know about this revision yet
|
469 |
+
throw new Exception("Template was precompiled with a newer version of Handlebars than the current runtime. "+
|
470 |
+
"Please update your runtime to a newer version ("+compilerInfo[1]+").");
|
471 |
+
}
|
472 |
+
}
|
473 |
+
}
|
474 |
+
|
475 |
+
__exports__.checkRevision = checkRevision;// TODO: Remove this line and break up compilePartial
|
476 |
+
|
477 |
+
function template(templateSpec, env) {
|
478 |
+
/* istanbul ignore next */
|
479 |
+
if (!env) {
|
480 |
+
throw new Exception("No environment passed to template");
|
481 |
+
}
|
482 |
+
if (!templateSpec || !templateSpec.main) {
|
483 |
+
throw new Exception('Unknown template object: ' + typeof templateSpec);
|
484 |
+
}
|
485 |
+
|
486 |
+
// Note: Using env.VM references rather than local var references throughout this section to allow
|
487 |
+
// for external users to override these as psuedo-supported APIs.
|
488 |
+
env.VM.checkRevision(templateSpec.compiler);
|
489 |
+
|
490 |
+
var invokePartialWrapper = function(partial, context, options) {
|
491 |
+
if (options.hash) {
|
492 |
+
context = Utils.extend({}, context, options.hash);
|
493 |
+
}
|
494 |
+
|
495 |
+
partial = env.VM.resolvePartial.call(this, partial, context, options);
|
496 |
+
var result = env.VM.invokePartial.call(this, partial, context, options);
|
497 |
+
|
498 |
+
if (result == null && env.compile) {
|
499 |
+
options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env);
|
500 |
+
result = options.partials[options.name](context, options);
|
501 |
+
}
|
502 |
+
if (result != null) {
|
503 |
+
if (options.indent) {
|
504 |
+
var lines = result.split('\n');
|
505 |
+
for (var i = 0, l = lines.length; i < l; i++) {
|
506 |
+
if (!lines[i] && i + 1 === l) {
|
507 |
+
break;
|
508 |
+
}
|
509 |
+
|
510 |
+
lines[i] = options.indent + lines[i];
|
511 |
+
}
|
512 |
+
result = lines.join('\n');
|
513 |
+
}
|
514 |
+
return result;
|
515 |
+
} else {
|
516 |
+
throw new Exception("The partial " + options.name + " could not be compiled when running in runtime-only mode");
|
517 |
+
}
|
518 |
+
};
|
519 |
+
|
520 |
+
// Just add water
|
521 |
+
var container = {
|
522 |
+
strict: function(obj, name) {
|
523 |
+
if (!(name in obj)) {
|
524 |
+
throw new Exception('"' + name + '" not defined in ' + obj);
|
525 |
+
}
|
526 |
+
return obj[name];
|
527 |
+
},
|
528 |
+
lookup: function(depths, name) {
|
529 |
+
var len = depths.length;
|
530 |
+
for (var i = 0; i < len; i++) {
|
531 |
+
if (depths[i] && depths[i][name] != null) {
|
532 |
+
return depths[i][name];
|
533 |
+
}
|
534 |
+
}
|
535 |
+
},
|
536 |
+
lambda: function(current, context) {
|
537 |
+
return typeof current === 'function' ? current.call(context) : current;
|
538 |
+
},
|
539 |
+
|
540 |
+
escapeExpression: Utils.escapeExpression,
|
541 |
+
invokePartial: invokePartialWrapper,
|
542 |
+
|
543 |
+
fn: function(i) {
|
544 |
+
return templateSpec[i];
|
545 |
+
},
|
546 |
+
|
547 |
+
programs: [],
|
548 |
+
program: function(i, data, declaredBlockParams, blockParams, depths) {
|
549 |
+
var programWrapper = this.programs[i],
|
550 |
+
fn = this.fn(i);
|
551 |
+
if (data || depths || blockParams || declaredBlockParams) {
|
552 |
+
programWrapper = program(this, i, fn, data, declaredBlockParams, blockParams, depths);
|
553 |
+
} else if (!programWrapper) {
|
554 |
+
programWrapper = this.programs[i] = program(this, i, fn);
|
555 |
+
}
|
556 |
+
return programWrapper;
|
557 |
+
},
|
558 |
+
|
559 |
+
data: function(data, depth) {
|
560 |
+
while (data && depth--) {
|
561 |
+
data = data._parent;
|
562 |
+
}
|
563 |
+
return data;
|
564 |
+
},
|
565 |
+
merge: function(param, common) {
|
566 |
+
var ret = param || common;
|
567 |
+
|
568 |
+
if (param && common && (param !== common)) {
|
569 |
+
ret = Utils.extend({}, common, param);
|
570 |
+
}
|
571 |
+
|
572 |
+
return ret;
|
573 |
+
},
|
574 |
+
|
575 |
+
noop: env.VM.noop,
|
576 |
+
compilerInfo: templateSpec.compiler
|
577 |
+
};
|
578 |
+
|
579 |
+
var ret = function(context, options) {
|
580 |
+
options = options || {};
|
581 |
+
var data = options.data;
|
582 |
+
|
583 |
+
ret._setup(options);
|
584 |
+
if (!options.partial && templateSpec.useData) {
|
585 |
+
data = initData(context, data);
|
586 |
+
}
|
587 |
+
var depths,
|
588 |
+
blockParams = templateSpec.useBlockParams ? [] : undefined;
|
589 |
+
if (templateSpec.useDepths) {
|
590 |
+
depths = options.depths ? [context].concat(options.depths) : [context];
|
591 |
+
}
|
592 |
+
|
593 |
+
return templateSpec.main.call(container, context, container.helpers, container.partials, data, blockParams, depths);
|
594 |
+
};
|
595 |
+
ret.isTop = true;
|
596 |
+
|
597 |
+
ret._setup = function(options) {
|
598 |
+
if (!options.partial) {
|
599 |
+
container.helpers = container.merge(options.helpers, env.helpers);
|
600 |
+
|
601 |
+
if (templateSpec.usePartial) {
|
602 |
+
container.partials = container.merge(options.partials, env.partials);
|
603 |
+
}
|
604 |
+
} else {
|
605 |
+
container.helpers = options.helpers;
|
606 |
+
container.partials = options.partials;
|
607 |
+
}
|
608 |
+
};
|
609 |
+
|
610 |
+
ret._child = function(i, data, blockParams, depths) {
|
611 |
+
if (templateSpec.useBlockParams && !blockParams) {
|
612 |
+
throw new Exception('must pass block params');
|
613 |
+
}
|
614 |
+
if (templateSpec.useDepths && !depths) {
|
615 |
+
throw new Exception('must pass parent depths');
|
616 |
+
}
|
617 |
+
|
618 |
+
return program(container, i, templateSpec[i], data, 0, blockParams, depths);
|
619 |
+
};
|
620 |
+
return ret;
|
621 |
+
}
|
622 |
+
|
623 |
+
__exports__.template = template;function program(container, i, fn, data, declaredBlockParams, blockParams, depths) {
|
624 |
+
var prog = function(context, options) {
|
625 |
+
options = options || {};
|
626 |
+
|
627 |
+
return fn.call(container,
|
628 |
+
context,
|
629 |
+
container.helpers, container.partials,
|
630 |
+
options.data || data,
|
631 |
+
blockParams && [options.blockParams].concat(blockParams),
|
632 |
+
depths && [context].concat(depths));
|
633 |
+
};
|
634 |
+
prog.program = i;
|
635 |
+
prog.depth = depths ? depths.length : 0;
|
636 |
+
prog.blockParams = declaredBlockParams || 0;
|
637 |
+
return prog;
|
638 |
+
}
|
639 |
+
|
640 |
+
__exports__.program = program;function resolvePartial(partial, context, options) {
|
641 |
+
if (!partial) {
|
642 |
+
partial = options.partials[options.name];
|
643 |
+
} else if (!partial.call && !options.name) {
|
644 |
+
// This is a dynamic partial that returned a string
|
645 |
+
options.name = partial;
|
646 |
+
partial = options.partials[partial];
|
647 |
+
}
|
648 |
+
return partial;
|
649 |
+
}
|
650 |
+
|
651 |
+
__exports__.resolvePartial = resolvePartial;function invokePartial(partial, context, options) {
|
652 |
+
options.partial = true;
|
653 |
+
|
654 |
+
if(partial === undefined) {
|
655 |
+
throw new Exception("The partial " + options.name + " could not be found");
|
656 |
+
} else if(partial instanceof Function) {
|
657 |
+
return partial(context, options);
|
658 |
+
}
|
659 |
+
}
|
660 |
+
|
661 |
+
__exports__.invokePartial = invokePartial;function noop() { return ""; }
|
662 |
+
|
663 |
+
__exports__.noop = noop;function initData(context, data) {
|
664 |
+
if (!data || !('root' in data)) {
|
665 |
+
data = data ? createFrame(data) : {};
|
666 |
+
data.root = context;
|
667 |
+
}
|
668 |
+
return data;
|
669 |
+
}
|
670 |
+
return __exports__;
|
671 |
+
})(__module3__, __module4__, __module2__);
|
672 |
+
|
673 |
+
// handlebars.runtime.js
|
674 |
+
var __module1__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) {
|
675 |
+
"use strict";
|
676 |
+
var __exports__;
|
677 |
+
/*globals Handlebars: true */
|
678 |
+
var base = __dependency1__;
|
679 |
+
|
680 |
+
// Each of these augment the Handlebars object. No need to setup here.
|
681 |
+
// (This is done to easily share code between commonjs and browse envs)
|
682 |
+
var SafeString = __dependency2__;
|
683 |
+
var Exception = __dependency3__;
|
684 |
+
var Utils = __dependency4__;
|
685 |
+
var runtime = __dependency5__;
|
686 |
+
|
687 |
+
// For compatibility and usage outside of module systems, make the Handlebars object a namespace
|
688 |
+
var create = function() {
|
689 |
+
var hb = new base.HandlebarsEnvironment();
|
690 |
+
|
691 |
+
Utils.extend(hb, base);
|
692 |
+
hb.SafeString = SafeString;
|
693 |
+
hb.Exception = Exception;
|
694 |
+
hb.Utils = Utils;
|
695 |
+
hb.escapeExpression = Utils.escapeExpression;
|
696 |
+
|
697 |
+
hb.VM = runtime;
|
698 |
+
hb.template = function(spec) {
|
699 |
+
return runtime.template(spec, hb);
|
700 |
+
};
|
701 |
+
|
702 |
+
return hb;
|
703 |
+
};
|
704 |
+
|
705 |
+
var Handlebars = create();
|
706 |
+
Handlebars.create = create;
|
707 |
+
|
708 |
+
/*jshint -W040 */
|
709 |
+
/* istanbul ignore next */
|
710 |
+
var root = typeof global !== 'undefined' ? global : window,
|
711 |
+
$Handlebars = root.Handlebars;
|
712 |
+
/* istanbul ignore next */
|
713 |
+
Handlebars.noConflict = function() {
|
714 |
+
if (root.Handlebars === Handlebars) {
|
715 |
+
root.Handlebars = $Handlebars;
|
716 |
+
}
|
717 |
+
};
|
718 |
+
|
719 |
+
Handlebars['default'] = Handlebars;
|
720 |
+
|
721 |
+
__exports__ = Handlebars;
|
722 |
+
return __exports__;
|
723 |
+
})(__module2__, __module5__, __module4__, __module3__, __module6__);
|
724 |
+
|
725 |
+
// handlebars/compiler/ast.js
|
726 |
+
var __module7__ = (function() {
|
727 |
+
"use strict";
|
728 |
+
var __exports__;
|
729 |
+
var AST = {
|
730 |
+
Program: function(statements, blockParams, strip, locInfo) {
|
731 |
+
this.loc = locInfo;
|
732 |
+
this.type = 'Program';
|
733 |
+
this.body = statements;
|
734 |
+
|
735 |
+
this.blockParams = blockParams;
|
736 |
+
this.strip = strip;
|
737 |
+
},
|
738 |
+
|
739 |
+
MustacheStatement: function(path, params, hash, escaped, strip, locInfo) {
|
740 |
+
this.loc = locInfo;
|
741 |
+
this.type = 'MustacheStatement';
|
742 |
+
|
743 |
+
this.path = path;
|
744 |
+
this.params = params || [];
|
745 |
+
this.hash = hash;
|
746 |
+
this.escaped = escaped;
|
747 |
+
|
748 |
+
this.strip = strip;
|
749 |
+
},
|
750 |
+
|
751 |
+
BlockStatement: function(path, params, hash, program, inverse, openStrip, inverseStrip, closeStrip, locInfo) {
|
752 |
+
this.loc = locInfo;
|
753 |
+
this.type = 'BlockStatement';
|
754 |
+
|
755 |
+
this.path = path;
|
756 |
+
this.params = params || [];
|
757 |
+
this.hash = hash;
|
758 |
+
this.program = program;
|
759 |
+
this.inverse = inverse;
|
760 |
+
|
761 |
+
this.openStrip = openStrip;
|
762 |
+
this.inverseStrip = inverseStrip;
|
763 |
+
this.closeStrip = closeStrip;
|
764 |
+
},
|
765 |
+
|
766 |
+
PartialStatement: function(name, params, hash, strip, locInfo) {
|
767 |
+
this.loc = locInfo;
|
768 |
+
this.type = 'PartialStatement';
|
769 |
+
|
770 |
+
this.name = name;
|
771 |
+
this.params = params || [];
|
772 |
+
this.hash = hash;
|
773 |
+
|
774 |
+
this.indent = '';
|
775 |
+
this.strip = strip;
|
776 |
+
},
|
777 |
+
|
778 |
+
ContentStatement: function(string, locInfo) {
|
779 |
+
this.loc = locInfo;
|
780 |
+
this.type = 'ContentStatement';
|
781 |
+
this.original = this.value = string;
|
782 |
+
},
|
783 |
+
|
784 |
+
CommentStatement: function(comment, strip, locInfo) {
|
785 |
+
this.loc = locInfo;
|
786 |
+
this.type = 'CommentStatement';
|
787 |
+
this.value = comment;
|
788 |
+
|
789 |
+
this.strip = strip;
|
790 |
+
},
|
791 |
+
|
792 |
+
SubExpression: function(path, params, hash, locInfo) {
|
793 |
+
this.loc = locInfo;
|
794 |
+
|
795 |
+
this.type = 'SubExpression';
|
796 |
+
this.path = path;
|
797 |
+
this.params = params || [];
|
798 |
+
this.hash = hash;
|
799 |
+
},
|
800 |
+
|
801 |
+
PathExpression: function(data, depth, parts, original, locInfo) {
|
802 |
+
this.loc = locInfo;
|
803 |
+
this.type = 'PathExpression';
|
804 |
+
|
805 |
+
this.data = data;
|
806 |
+
this.original = original;
|
807 |
+
this.parts = parts;
|
808 |
+
this.depth = depth;
|
809 |
+
},
|
810 |
+
|
811 |
+
StringLiteral: function(string, locInfo) {
|
812 |
+
this.loc = locInfo;
|
813 |
+
this.type = 'StringLiteral';
|
814 |
+
this.original =
|
815 |
+
this.value = string;
|
816 |
+
},
|
817 |
+
|
818 |
+
NumberLiteral: function(number, locInfo) {
|
819 |
+
this.loc = locInfo;
|
820 |
+
this.type = 'NumberLiteral';
|
821 |
+
this.original =
|
822 |
+
this.value = Number(number);
|
823 |
+
},
|
824 |
+
|
825 |
+
BooleanLiteral: function(bool, locInfo) {
|
826 |
+
this.loc = locInfo;
|
827 |
+
this.type = 'BooleanLiteral';
|
828 |
+
this.original =
|
829 |
+
this.value = bool === 'true';
|
830 |
+
},
|
831 |
+
|
832 |
+
Hash: function(pairs, locInfo) {
|
833 |
+
this.loc = locInfo;
|
834 |
+
this.type = 'Hash';
|
835 |
+
this.pairs = pairs;
|
836 |
+
},
|
837 |
+
HashPair: function(key, value, locInfo) {
|
838 |
+
this.loc = locInfo;
|
839 |
+
this.type = 'HashPair';
|
840 |
+
this.key = key;
|
841 |
+
this.value = value;
|
842 |
+
},
|
843 |
+
|
844 |
+
// Public API used to evaluate derived attributes regarding AST nodes
|
845 |
+
helpers: {
|
846 |
+
// a mustache is definitely a helper if:
|
847 |
+
// * it is an eligible helper, and
|
848 |
+
// * it has at least one parameter or hash segment
|
849 |
+
// TODO: Make these public utility methods
|
850 |
+
helperExpression: function(node) {
|
851 |
+
return !!(node.type === 'SubExpression' || node.params.length || node.hash);
|
852 |
+
},
|
853 |
+
|
854 |
+
scopedId: function(path) {
|
855 |
+
return (/^\.|this\b/).test(path.original);
|
856 |
+
},
|
857 |
+
|
858 |
+
// an ID is simple if it only has one part, and that part is not
|
859 |
+
// `..` or `this`.
|
860 |
+
simpleId: function(path) {
|
861 |
+
return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth;
|
862 |
+
}
|
863 |
+
}
|
864 |
+
};
|
865 |
+
|
866 |
+
|
867 |
+
// Must be exported as an object rather than the root of the module as the jison lexer
|
868 |
+
// must modify the object to operate properly.
|
869 |
+
__exports__ = AST;
|
870 |
+
return __exports__;
|
871 |
+
})();
|
872 |
+
|
873 |
+
// handlebars/compiler/parser.js
|
874 |
+
var __module9__ = (function() {
|
875 |
+
"use strict";
|
876 |
+
var __exports__;
|
877 |
+
/* jshint ignore:start */
|
878 |
+
/* istanbul ignore next */
|
879 |
+
/* Jison generated parser */
|
880 |
+
var handlebars = (function(){
|
881 |
+
var parser = {trace: function trace() { },
|
882 |
+
yy: {},
|
883 |
+
symbols_: {"error":2,"root":3,"program":4,"EOF":5,"program_repetition0":6,"statement":7,"mustache":8,"block":9,"rawBlock":10,"partial":11,"content":12,"COMMENT":13,"CONTENT":14,"openRawBlock":15,"END_RAW_BLOCK":16,"OPEN_RAW_BLOCK":17,"helperName":18,"openRawBlock_repetition0":19,"openRawBlock_option0":20,"CLOSE_RAW_BLOCK":21,"openBlock":22,"block_option0":23,"closeBlock":24,"openInverse":25,"block_option1":26,"OPEN_BLOCK":27,"openBlock_repetition0":28,"openBlock_option0":29,"openBlock_option1":30,"CLOSE":31,"OPEN_INVERSE":32,"openInverse_repetition0":33,"openInverse_option0":34,"openInverse_option1":35,"openInverseChain":36,"OPEN_INVERSE_CHAIN":37,"openInverseChain_repetition0":38,"openInverseChain_option0":39,"openInverseChain_option1":40,"inverseAndProgram":41,"INVERSE":42,"inverseChain":43,"inverseChain_option0":44,"OPEN_ENDBLOCK":45,"OPEN":46,"mustache_repetition0":47,"mustache_option0":48,"OPEN_UNESCAPED":49,"mustache_repetition1":50,"mustache_option1":51,"CLOSE_UNESCAPED":52,"OPEN_PARTIAL":53,"partialName":54,"partial_repetition0":55,"partial_option0":56,"param":57,"sexpr":58,"OPEN_SEXPR":59,"sexpr_repetition0":60,"sexpr_option0":61,"CLOSE_SEXPR":62,"hash":63,"hash_repetition_plus0":64,"hashSegment":65,"ID":66,"EQUALS":67,"blockParams":68,"OPEN_BLOCK_PARAMS":69,"blockParams_repetition_plus0":70,"CLOSE_BLOCK_PARAMS":71,"path":72,"dataName":73,"STRING":74,"NUMBER":75,"BOOLEAN":76,"DATA":77,"pathSegments":78,"SEP":79,"$accept":0,"$end":1},
|
884 |
+
terminals_: {2:"error",5:"EOF",13:"COMMENT",14:"CONTENT",16:"END_RAW_BLOCK",17:"OPEN_RAW_BLOCK",21:"CLOSE_RAW_BLOCK",27:"OPEN_BLOCK",31:"CLOSE",32:"OPEN_INVERSE",37:"OPEN_INVERSE_CHAIN",42:"INVERSE",45:"OPEN_ENDBLOCK",46:"OPEN",49:"OPEN_UNESCAPED",52:"CLOSE_UNESCAPED",53:"OPEN_PARTIAL",59:"OPEN_SEXPR",62:"CLOSE_SEXPR",66:"ID",67:"EQUALS",69:"OPEN_BLOCK_PARAMS",71:"CLOSE_BLOCK_PARAMS",74:"STRING",75:"NUMBER",76:"BOOLEAN",77:"DATA",79:"SEP"},
|
885 |
+
productions_: [0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[12,1],[10,3],[15,5],[9,4],[9,4],[22,6],[25,6],[36,6],[41,2],[43,3],[43,1],[24,3],[8,5],[8,5],[11,5],[57,1],[57,1],[58,5],[63,1],[65,3],[68,3],[18,1],[18,1],[18,1],[18,1],[18,1],[54,1],[54,1],[73,2],[72,1],[78,3],[78,1],[6,0],[6,2],[19,0],[19,2],[20,0],[20,1],[23,0],[23,1],[26,0],[26,1],[28,0],[28,2],[29,0],[29,1],[30,0],[30,1],[33,0],[33,2],[34,0],[34,1],[35,0],[35,1],[38,0],[38,2],[39,0],[39,1],[40,0],[40,1],[44,0],[44,1],[47,0],[47,2],[48,0],[48,1],[50,0],[50,2],[51,0],[51,1],[55,0],[55,2],[56,0],[56,1],[60,0],[60,2],[61,0],[61,1],[64,1],[64,2],[70,1],[70,2]],
|
886 |
+
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
|
887 |
+
|
888 |
+
var $0 = $$.length - 1;
|
889 |
+
switch (yystate) {
|
890 |
+
case 1: return $$[$0-1];
|
891 |
+
break;
|
892 |
+
case 2:this.$ = new yy.Program($$[$0], null, {}, yy.locInfo(this._$));
|
893 |
+
break;
|
894 |
+
case 3:this.$ = $$[$0];
|
895 |
+
break;
|
896 |
+
case 4:this.$ = $$[$0];
|
897 |
+
break;
|
898 |
+
case 5:this.$ = $$[$0];
|
899 |
+
break;
|
900 |
+
case 6:this.$ = $$[$0];
|
901 |
+
break;
|
902 |
+
case 7:this.$ = $$[$0];
|
903 |
+
break;
|
904 |
+
case 8:this.$ = new yy.CommentStatement(yy.stripComment($$[$0]), yy.stripFlags($$[$0], $$[$0]), yy.locInfo(this._$));
|
905 |
+
break;
|
906 |
+
case 9:this.$ = new yy.ContentStatement($$[$0], yy.locInfo(this._$));
|
907 |
+
break;
|
908 |
+
case 10:this.$ = yy.prepareRawBlock($$[$0-2], $$[$0-1], $$[$0], this._$);
|
909 |
+
break;
|
910 |
+
case 11:this.$ = { path: $$[$0-3], params: $$[$0-2], hash: $$[$0-1] };
|
911 |
+
break;
|
912 |
+
case 12:this.$ = yy.prepareBlock($$[$0-3], $$[$0-2], $$[$0-1], $$[$0], false, this._$);
|
913 |
+
break;
|
914 |
+
case 13:this.$ = yy.prepareBlock($$[$0-3], $$[$0-2], $$[$0-1], $$[$0], true, this._$);
|
915 |
+
break;
|
916 |
+
case 14:this.$ = { path: $$[$0-4], params: $$[$0-3], hash: $$[$0-2], blockParams: $$[$0-1], strip: yy.stripFlags($$[$0-5], $$[$0]) };
|
917 |
+
break;
|
918 |
+
case 15:this.$ = { path: $$[$0-4], params: $$[$0-3], hash: $$[$0-2], blockParams: $$[$0-1], strip: yy.stripFlags($$[$0-5], $$[$0]) };
|
919 |
+
break;
|
920 |
+
case 16:this.$ = { path: $$[$0-4], params: $$[$0-3], hash: $$[$0-2], blockParams: $$[$0-1], strip: yy.stripFlags($$[$0-5], $$[$0]) };
|
921 |
+
break;
|
922 |
+
case 17:this.$ = { strip: yy.stripFlags($$[$0-1], $$[$0-1]), program: $$[$0] };
|
923 |
+
break;
|
924 |
+
case 18:
|
925 |
+
var inverse = yy.prepareBlock($$[$0-2], $$[$0-1], $$[$0], $$[$0], false, this._$),
|
926 |
+
program = new yy.Program([inverse], null, {}, yy.locInfo(this._$));
|
927 |
+
program.chained = true;
|
928 |
+
|
929 |
+
this.$ = { strip: $$[$0-2].strip, program: program, chain: true };
|
930 |
+
|
931 |
+
break;
|
932 |
+
case 19:this.$ = $$[$0];
|
933 |
+
break;
|
934 |
+
case 20:this.$ = {path: $$[$0-1], strip: yy.stripFlags($$[$0-2], $$[$0])};
|
935 |
+
break;
|
936 |
+
case 21:this.$ = yy.prepareMustache($$[$0-3], $$[$0-2], $$[$0-1], $$[$0-4], yy.stripFlags($$[$0-4], $$[$0]), this._$);
|
937 |
+
break;
|
938 |
+
case 22:this.$ = yy.prepareMustache($$[$0-3], $$[$0-2], $$[$0-1], $$[$0-4], yy.stripFlags($$[$0-4], $$[$0]), this._$);
|
939 |
+
break;
|
940 |
+
case 23:this.$ = new yy.PartialStatement($$[$0-3], $$[$0-2], $$[$0-1], yy.stripFlags($$[$0-4], $$[$0]), yy.locInfo(this._$));
|
941 |
+
break;
|
942 |
+
case 24:this.$ = $$[$0];
|
943 |
+
break;
|
944 |
+
case 25:this.$ = $$[$0];
|
945 |
+
break;
|
946 |
+
case 26:this.$ = new yy.SubExpression($$[$0-3], $$[$0-2], $$[$0-1], yy.locInfo(this._$));
|
947 |
+
break;
|
948 |
+
case 27:this.$ = new yy.Hash($$[$0], yy.locInfo(this._$));
|
949 |
+
break;
|
950 |
+
case 28:this.$ = new yy.HashPair($$[$0-2], $$[$0], yy.locInfo(this._$));
|
951 |
+
break;
|
952 |
+
case 29:this.$ = $$[$0-1];
|
953 |
+
break;
|
954 |
+
case 30:this.$ = $$[$0];
|
955 |
+
break;
|
956 |
+
case 31:this.$ = $$[$0];
|
957 |
+
break;
|
958 |
+
case 32:this.$ = new yy.StringLiteral($$[$0], yy.locInfo(this._$));
|
959 |
+
break;
|
960 |
+
case 33:this.$ = new yy.NumberLiteral($$[$0], yy.locInfo(this._$));
|
961 |
+
break;
|
962 |
+
case 34:this.$ = new yy.BooleanLiteral($$[$0], yy.locInfo(this._$));
|
963 |
+
break;
|
964 |
+
case 35:this.$ = $$[$0];
|
965 |
+
break;
|
966 |
+
case 36:this.$ = $$[$0];
|
967 |
+
break;
|
968 |
+
case 37:this.$ = yy.preparePath(true, $$[$0], this._$);
|
969 |
+
break;
|
970 |
+
case 38:this.$ = yy.preparePath(false, $$[$0], this._$);
|
971 |
+
break;
|
972 |
+
case 39: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2];
|
973 |
+
break;
|
974 |
+
case 40:this.$ = [{part: $$[$0]}];
|
975 |
+
break;
|
976 |
+
case 41:this.$ = [];
|
977 |
+
break;
|
978 |
+
case 42:$$[$0-1].push($$[$0]);
|
979 |
+
break;
|
980 |
+
case 43:this.$ = [];
|
981 |
+
break;
|
982 |
+
case 44:$$[$0-1].push($$[$0]);
|
983 |
+
break;
|
984 |
+
case 51:this.$ = [];
|
985 |
+
break;
|
986 |
+
case 52:$$[$0-1].push($$[$0]);
|
987 |
+
break;
|
988 |
+
case 57:this.$ = [];
|
989 |
+
break;
|
990 |
+
case 58:$$[$0-1].push($$[$0]);
|
991 |
+
break;
|
992 |
+
case 63:this.$ = [];
|
993 |
+
break;
|
994 |
+
case 64:$$[$0-1].push($$[$0]);
|
995 |
+
break;
|
996 |
+
case 71:this.$ = [];
|
997 |
+
break;
|
998 |
+
case 72:$$[$0-1].push($$[$0]);
|
999 |
+
break;
|
1000 |
+
case 75:this.$ = [];
|
1001 |
+
break;
|
1002 |
+
case 76:$$[$0-1].push($$[$0]);
|
1003 |
+
break;
|
1004 |
+
case 79:this.$ = [];
|
1005 |
+
break;
|
1006 |
+
case 80:$$[$0-1].push($$[$0]);
|
1007 |
+
break;
|
1008 |
+
case 83:this.$ = [];
|
1009 |
+
break;
|
1010 |
+
case 84:$$[$0-1].push($$[$0]);
|
1011 |
+
break;
|
1012 |
+
case 87:this.$ = [$$[$0]];
|
1013 |
+
break;
|
1014 |
+
case 88:$$[$0-1].push($$[$0]);
|
1015 |
+
break;
|
1016 |
+
case 89:this.$ = [$$[$0]];
|
1017 |
+
break;
|
1018 |
+
case 90:$$[$0-1].push($$[$0]);
|
1019 |
+
break;
|
1020 |
+
}
|
1021 |
+
},
|
1022 |
+
table: [{3:1,4:2,5:[2,41],6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],46:[2,41],49:[2,41],53:[2,41]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:10,13:[1,11],14:[1,18],15:16,17:[1,21],22:14,25:15,27:[1,19],32:[1,20],37:[2,2],42:[2,2],45:[2,2],46:[1,12],49:[1,13],53:[1,17]},{1:[2,1]},{5:[2,42],13:[2,42],14:[2,42],17:[2,42],27:[2,42],32:[2,42],37:[2,42],42:[2,42],45:[2,42],46:[2,42],49:[2,42],53:[2,42]},{5:[2,3],13:[2,3],14:[2,3],17:[2,3],27:[2,3],32:[2,3],37:[2,3],42:[2,3],45:[2,3],46:[2,3],49:[2,3],53:[2,3]},{5:[2,4],13:[2,4],14:[2,4],17:[2,4],27:[2,4],32:[2,4],37:[2,4],42:[2,4],45:[2,4],46:[2,4],49:[2,4],53:[2,4]},{5:[2,5],13:[2,5],14:[2,5],17:[2,5],27:[2,5],32:[2,5],37:[2,5],42:[2,5],45:[2,5],46:[2,5],49:[2,5],53:[2,5]},{5:[2,6],13:[2,6],14:[2,6],17:[2,6],27:[2,6],32:[2,6],37:[2,6],42:[2,6],45:[2,6],46:[2,6],49:[2,6],53:[2,6]},{5:[2,7],13:[2,7],14:[2,7],17:[2,7],27:[2,7],32:[2,7],37:[2,7],42:[2,7],45:[2,7],46:[2,7],49:[2,7],53:[2,7]},{5:[2,8],13:[2,8],14:[2,8],17:[2,8],27:[2,8],32:[2,8],37:[2,8],42:[2,8],45:[2,8],46:[2,8],49:[2,8],53:[2,8]},{18:22,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:31,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{4:32,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],37:[2,41],42:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{4:33,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],42:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{12:34,14:[1,18]},{18:36,54:35,58:37,59:[1,38],66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{5:[2,9],13:[2,9],14:[2,9],16:[2,9],17:[2,9],27:[2,9],32:[2,9],37:[2,9],42:[2,9],45:[2,9],46:[2,9],49:[2,9],53:[2,9]},{18:39,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:40,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:41,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{31:[2,71],47:42,59:[2,71],66:[2,71],74:[2,71],75:[2,71],76:[2,71],77:[2,71]},{21:[2,30],31:[2,30],52:[2,30],59:[2,30],62:[2,30],66:[2,30],69:[2,30],74:[2,30],75:[2,30],76:[2,30],77:[2,30]},{21:[2,31],31:[2,31],52:[2,31],59:[2,31],62:[2,31],66:[2,31],69:[2,31],74:[2,31],75:[2,31],76:[2,31],77:[2,31]},{21:[2,32],31:[2,32],52:[2,32],59:[2,32],62:[2,32],66:[2,32],69:[2,32],74:[2,32],75:[2,32],76:[2,32],77:[2,32]},{21:[2,33],31:[2,33],52:[2,33],59:[2,33],62:[2,33],66:[2,33],69:[2,33],74:[2,33],75:[2,33],76:[2,33],77:[2,33]},{21:[2,34],31:[2,34],52:[2,34],59:[2,34],62:[2,34],66:[2,34],69:[2,34],74:[2,34],75:[2,34],76:[2,34],77:[2,34]},{21:[2,38],31:[2,38],52:[2,38],59:[2,38],62:[2,38],66:[2,38],69:[2,38],74:[2,38],75:[2,38],76:[2,38],77:[2,38],79:[1,43]},{66:[1,30],78:44},{21:[2,40],31:[2,40],52:[2,40],59:[2,40],62:[2,40],66:[2,40],69:[2,40],74:[2,40],75:[2,40],76:[2,40],77:[2,40],79:[2,40]},{50:45,52:[2,75],59:[2,75],66:[2,75],74:[2,75],75:[2,75],76:[2,75],77:[2,75]},{23:46,36:48,37:[1,50],41:49,42:[1,51],43:47,45:[2,47]},{26:52,41:53,42:[1,51],45:[2,49]},{16:[1,54]},{31:[2,79],55:55,59:[2,79],66:[2,79],74:[2,79],75:[2,79],76:[2,79],77:[2,79]},{31:[2,35],59:[2,35],66:[2,35],74:[2,35],75:[2,35],76:[2,35],77:[2,35]},{31:[2,36],59:[2,36],66:[2,36],74:[2,36],75:[2,36],76:[2,36],77:[2,36]},{18:56,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{28:57,31:[2,51],59:[2,51],66:[2,51],69:[2,51],74:[2,51],75:[2,51],76:[2,51],77:[2,51]},{31:[2,57],33:58,59:[2,57],66:[2,57],69:[2,57],74:[2,57],75:[2,57],76:[2,57],77:[2,57]},{19:59,21:[2,43],59:[2,43],66:[2,43],74:[2,43],75:[2,43],76:[2,43],77:[2,43]},{18:63,31:[2,73],48:60,57:61,58:64,59:[1,38],63:62,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{66:[1,68]},{21:[2,37],31:[2,37],52:[2,37],59:[2,37],62:[2,37],66:[2,37],69:[2,37],74:[2,37],75:[2,37],76:[2,37],77:[2,37],79:[1,43]},{18:63,51:69,52:[2,77],57:70,58:64,59:[1,38],63:71,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{24:72,45:[1,73]},{45:[2,48]},{4:74,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],37:[2,41],42:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{45:[2,19]},{18:75,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{4:76,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{24:77,45:[1,73]},{45:[2,50]},{5:[2,10],13:[2,10],14:[2,10],17:[2,10],27:[2,10],32:[2,10],37:[2,10],42:[2,10],45:[2,10],46:[2,10],49:[2,10],53:[2,10]},{18:63,31:[2,81],56:78,57:79,58:64,59:[1,38],63:80,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{59:[2,83],60:81,62:[2,83],66:[2,83],74:[2,83],75:[2,83],76:[2,83],77:[2,83]},{18:63,29:82,31:[2,53],57:83,58:64,59:[1,38],63:84,64:65,65:66,66:[1,67],69:[2,53],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:63,31:[2,59],34:85,57:86,58:64,59:[1,38],63:87,64:65,65:66,66:[1,67],69:[2,59],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:63,20:88,21:[2,45],57:89,58:64,59:[1,38],63:90,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{31:[1,91]},{31:[2,72],59:[2,72],66:[2,72],74:[2,72],75:[2,72],76:[2,72],77:[2,72]},{31:[2,74]},{21:[2,24],31:[2,24],52:[2,24],59:[2,24],62:[2,24],66:[2,24],69:[2,24],74:[2,24],75:[2,24],76:[2,24],77:[2,24]},{21:[2,25],31:[2,25],52:[2,25],59:[2,25],62:[2,25],66:[2,25],69:[2,25],74:[2,25],75:[2,25],76:[2,25],77:[2,25]},{21:[2,27],31:[2,27],52:[2,27],62:[2,27],65:92,66:[1,93],69:[2,27]},{21:[2,87],31:[2,87],52:[2,87],62:[2,87],66:[2,87],69:[2,87]},{21:[2,40],31:[2,40],52:[2,40],59:[2,40],62:[2,40],66:[2,40],67:[1,94],69:[2,40],74:[2,40],75:[2,40],76:[2,40],77:[2,40],79:[2,40]},{21:[2,39],31:[2,39],52:[2,39],59:[2,39],62:[2,39],66:[2,39],69:[2,39],74:[2,39],75:[2,39],76:[2,39],77:[2,39],79:[2,39]},{52:[1,95]},{52:[2,76],59:[2,76],66:[2,76],74:[2,76],75:[2,76],76:[2,76],77:[2,76]},{52:[2,78]},{5:[2,12],13:[2,12],14:[2,12],17:[2,12],27:[2,12],32:[2,12],37:[2,12],42:[2,12],45:[2,12],46:[2,12],49:[2,12],53:[2,12]},{18:96,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{36:48,37:[1,50],41:49,42:[1,51],43:98,44:97,45:[2,69]},{31:[2,63],38:99,59:[2,63],66:[2,63],69:[2,63],74:[2,63],75:[2,63],76:[2,63],77:[2,63]},{45:[2,17]},{5:[2,13],13:[2,13],14:[2,13],17:[2,13],27:[2,13],32:[2,13],37:[2,13],42:[2,13],45:[2,13],46:[2,13],49:[2,13],53:[2,13]},{31:[1,100]},{31:[2,80],59:[2,80],66:[2,80],74:[2,80],75:[2,80],76:[2,80],77:[2,80]},{31:[2,82]},{18:63,57:102,58:64,59:[1,38],61:101,62:[2,85],63:103,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{30:104,31:[2,55],68:105,69:[1,106]},{31:[2,52],59:[2,52],66:[2,52],69:[2,52],74:[2,52],75:[2,52],76:[2,52],77:[2,52]},{31:[2,54],69:[2,54]},{31:[2,61],35:107,68:108,69:[1,106]},{31:[2,58],59:[2,58],66:[2,58],69:[2,58],74:[2,58],75:[2,58],76:[2,58],77:[2,58]},{31:[2,60],69:[2,60]},{21:[1,109]},{21:[2,44],59:[2,44],66:[2,44],74:[2,44],75:[2,44],76:[2,44],77:[2,44]},{21:[2,46]},{5:[2,21],13:[2,21],14:[2,21],17:[2,21],27:[2,21],32:[2,21],37:[2,21],42:[2,21],45:[2,21],46:[2,21],49:[2,21],53:[2,21]},{21:[2,88],31:[2,88],52:[2,88],62:[2,88],66:[2,88],69:[2,88]},{67:[1,94]},{18:63,57:110,58:64,59:[1,38],66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{5:[2,22],13:[2,22],14:[2,22],17:[2,22],27:[2,22],32:[2,22],37:[2,22],42:[2,22],45:[2,22],46:[2,22],49:[2,22],53:[2,22]},{31:[1,111]},{45:[2,18]},{45:[2,70]},{18:63,31:[2,65],39:112,57:113,58:64,59:[1,38],63:114,64:65,65:66,66:[1,67],69:[2,65],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{5:[2,23],13:[2,23],14:[2,23],17:[2,23],27:[2,23],32:[2,23],37:[2,23],42:[2,23],45:[2,23],46:[2,23],49:[2,23],53:[2,23]},{62:[1,115]},{59:[2,84],62:[2,84],66:[2,84],74:[2,84],75:[2,84],76:[2,84],77:[2,84]},{62:[2,86]},{31:[1,116]},{31:[2,56]},{66:[1,118],70:117},{31:[1,119]},{31:[2,62]},{14:[2,11]},{21:[2,28],31:[2,28],52:[2,28],62:[2,28],66:[2,28],69:[2,28]},{5:[2,20],13:[2,20],14:[2,20],17:[2,20],27:[2,20],32:[2,20],37:[2,20],42:[2,20],45:[2,20],46:[2,20],49:[2,20],53:[2,20]},{31:[2,67],40:120,68:121,69:[1,106]},{31:[2,64],59:[2,64],66:[2,64],69:[2,64],74:[2,64],75:[2,64],76:[2,64],77:[2,64]},{31:[2,66],69:[2,66]},{21:[2,26],31:[2,26],52:[2,26],59:[2,26],62:[2,26],66:[2,26],69:[2,26],74:[2,26],75:[2,26],76:[2,26],77:[2,26]},{13:[2,14],14:[2,14],17:[2,14],27:[2,14],32:[2,14],37:[2,14],42:[2,14],45:[2,14],46:[2,14],49:[2,14],53:[2,14]},{66:[1,123],71:[1,122]},{66:[2,89],71:[2,89]},{13:[2,15],14:[2,15],17:[2,15],27:[2,15],32:[2,15],42:[2,15],45:[2,15],46:[2,15],49:[2,15],53:[2,15]},{31:[1,124]},{31:[2,68]},{31:[2,29]},{66:[2,90],71:[2,90]},{13:[2,16],14:[2,16],17:[2,16],27:[2,16],32:[2,16],37:[2,16],42:[2,16],45:[2,16],46:[2,16],49:[2,16],53:[2,16]}],
|
1023 |
+
defaultActions: {4:[2,1],47:[2,48],49:[2,19],53:[2,50],62:[2,74],71:[2,78],76:[2,17],80:[2,82],90:[2,46],97:[2,18],98:[2,70],103:[2,86],105:[2,56],108:[2,62],109:[2,11],121:[2,68],122:[2,29]},
|
1024 |
+
parseError: function parseError(str, hash) {
|
1025 |
+
throw new Error(str);
|
1026 |
+
},
|
1027 |
+
parse: function parse(input) {
|
1028 |
+
var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
1029 |
+
this.lexer.setInput(input);
|
1030 |
+
this.lexer.yy = this.yy;
|
1031 |
+
this.yy.lexer = this.lexer;
|
1032 |
+
this.yy.parser = this;
|
1033 |
+
if (typeof this.lexer.yylloc == "undefined")
|
1034 |
+
this.lexer.yylloc = {};
|
1035 |
+
var yyloc = this.lexer.yylloc;
|
1036 |
+
lstack.push(yyloc);
|
1037 |
+
var ranges = this.lexer.options && this.lexer.options.ranges;
|
1038 |
+
if (typeof this.yy.parseError === "function")
|
1039 |
+
this.parseError = this.yy.parseError;
|
1040 |
+
function popStack(n) {
|
1041 |
+
stack.length = stack.length - 2 * n;
|
1042 |
+
vstack.length = vstack.length - n;
|
1043 |
+
lstack.length = lstack.length - n;
|
1044 |
+
}
|
1045 |
+
function lex() {
|
1046 |
+
var token;
|
1047 |
+
token = self.lexer.lex() || 1;
|
1048 |
+
if (typeof token !== "number") {
|
1049 |
+
token = self.symbols_[token] || token;
|
1050 |
+
}
|
1051 |
+
return token;
|
1052 |
+
}
|
1053 |
+
var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
1054 |
+
while (true) {
|
1055 |
+
state = stack[stack.length - 1];
|
1056 |
+
if (this.defaultActions[state]) {
|
1057 |
+
action = this.defaultActions[state];
|
1058 |
+
} else {
|
1059 |
+
if (symbol === null || typeof symbol == "undefined") {
|
1060 |
+
symbol = lex();
|
1061 |
+
}
|
1062 |
+
action = table[state] && table[state][symbol];
|
1063 |
+
}
|
1064 |
+
if (typeof action === "undefined" || !action.length || !action[0]) {
|
1065 |
+
var errStr = "";
|
1066 |
+
if (!recovering) {
|
1067 |
+
expected = [];
|
1068 |
+
for (p in table[state])
|
1069 |
+
if (this.terminals_[p] && p > 2) {
|
1070 |
+
expected.push("'" + this.terminals_[p] + "'");
|
1071 |
+
}
|
1072 |
+
if (this.lexer.showPosition) {
|
1073 |
+
errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
|
1074 |
+
} else {
|
1075 |
+
errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'");
|
1076 |
+
}
|
1077 |
+
this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});
|
1078 |
+
}
|
1079 |
+
}
|
1080 |
+
if (action[0] instanceof Array && action.length > 1) {
|
1081 |
+
throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
|
1082 |
+
}
|
1083 |
+
switch (action[0]) {
|
1084 |
+
case 1:
|
1085 |
+
stack.push(symbol);
|
1086 |
+
vstack.push(this.lexer.yytext);
|
1087 |
+
lstack.push(this.lexer.yylloc);
|
1088 |
+
stack.push(action[1]);
|
1089 |
+
symbol = null;
|
1090 |
+
if (!preErrorSymbol) {
|
1091 |
+
yyleng = this.lexer.yyleng;
|
1092 |
+
yytext = this.lexer.yytext;
|
1093 |
+
yylineno = this.lexer.yylineno;
|
1094 |
+
yyloc = this.lexer.yylloc;
|
1095 |
+
if (recovering > 0)
|
1096 |
+
recovering--;
|
1097 |
+
} else {
|
1098 |
+
symbol = preErrorSymbol;
|
1099 |
+
preErrorSymbol = null;
|
1100 |
+
}
|
1101 |
+
break;
|
1102 |
+
case 2:
|
1103 |
+
len = this.productions_[action[1]][1];
|
1104 |
+
yyval.$ = vstack[vstack.length - len];
|
1105 |
+
yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column};
|
1106 |
+
if (ranges) {
|
1107 |
+
yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]];
|
1108 |
+
}
|
1109 |
+
r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
|
1110 |
+
if (typeof r !== "undefined") {
|
1111 |
+
return r;
|
1112 |
+
}
|
1113 |
+
if (len) {
|
1114 |
+
stack = stack.slice(0, -1 * len * 2);
|
1115 |
+
vstack = vstack.slice(0, -1 * len);
|
1116 |
+
lstack = lstack.slice(0, -1 * len);
|
1117 |
+
}
|
1118 |
+
stack.push(this.productions_[action[1]][0]);
|
1119 |
+
vstack.push(yyval.$);
|
1120 |
+
lstack.push(yyval._$);
|
1121 |
+
newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
1122 |
+
stack.push(newState);
|
1123 |
+
break;
|
1124 |
+
case 3:
|
1125 |
+
return true;
|
1126 |
+
}
|
1127 |
+
}
|
1128 |
+
return true;
|
1129 |
+
}
|
1130 |
+
};
|
1131 |
+
/* Jison generated lexer */
|
1132 |
+
var lexer = (function(){
|
1133 |
+
var lexer = ({EOF:1,
|
1134 |
+
parseError:function parseError(str, hash) {
|
1135 |
+
if (this.yy.parser) {
|
1136 |
+
this.yy.parser.parseError(str, hash);
|
1137 |
+
} else {
|
1138 |
+
throw new Error(str);
|
1139 |
+
}
|
1140 |
+
},
|
1141 |
+
setInput:function (input) {
|
1142 |
+
this._input = input;
|
1143 |
+
this._more = this._less = this.done = false;
|
1144 |
+
this.yylineno = this.yyleng = 0;
|
1145 |
+
this.yytext = this.matched = this.match = '';
|
1146 |
+
this.conditionStack = ['INITIAL'];
|
1147 |
+
this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0};
|
1148 |
+
if (this.options.ranges) this.yylloc.range = [0,0];
|
1149 |
+
this.offset = 0;
|
1150 |
+
return this;
|
1151 |
+
},
|
1152 |
+
input:function () {
|
1153 |
+
var ch = this._input[0];
|
1154 |
+
this.yytext += ch;
|
1155 |
+
this.yyleng++;
|
1156 |
+
this.offset++;
|
1157 |
+
this.match += ch;
|
1158 |
+
this.matched += ch;
|
1159 |
+
var lines = ch.match(/(?:\r\n?|\n).*/g);
|
1160 |
+
if (lines) {
|
1161 |
+
this.yylineno++;
|
1162 |
+
this.yylloc.last_line++;
|
1163 |
+
} else {
|
1164 |
+
this.yylloc.last_column++;
|
1165 |
+
}
|
1166 |
+
if (this.options.ranges) this.yylloc.range[1]++;
|
1167 |
+
|
1168 |
+
this._input = this._input.slice(1);
|
1169 |
+
return ch;
|
1170 |
+
},
|
1171 |
+
unput:function (ch) {
|
1172 |
+
var len = ch.length;
|
1173 |
+
var lines = ch.split(/(?:\r\n?|\n)/g);
|
1174 |
+
|
1175 |
+
this._input = ch + this._input;
|
1176 |
+
this.yytext = this.yytext.substr(0, this.yytext.length-len-1);
|
1177 |
+
//this.yyleng -= len;
|
1178 |
+
this.offset -= len;
|
1179 |
+
var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
1180 |
+
this.match = this.match.substr(0, this.match.length-1);
|
1181 |
+
this.matched = this.matched.substr(0, this.matched.length-1);
|
1182 |
+
|
1183 |
+
if (lines.length-1) this.yylineno -= lines.length-1;
|
1184 |
+
var r = this.yylloc.range;
|
1185 |
+
|
1186 |
+
this.yylloc = {first_line: this.yylloc.first_line,
|
1187 |
+
last_line: this.yylineno+1,
|
1188 |
+
first_column: this.yylloc.first_column,
|
1189 |
+
last_column: lines ?
|
1190 |
+
(lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length:
|
1191 |
+
this.yylloc.first_column - len
|
1192 |
+
};
|
1193 |
+
|
1194 |
+
if (this.options.ranges) {
|
1195 |
+
this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
1196 |
+
}
|
1197 |
+
return this;
|
1198 |
+
},
|
1199 |
+
more:function () {
|
1200 |
+
this._more = true;
|
1201 |
+
return this;
|
1202 |
+
},
|
1203 |
+
less:function (n) {
|
1204 |
+
this.unput(this.match.slice(n));
|
1205 |
+
},
|
1206 |
+
pastInput:function () {
|
1207 |
+
var past = this.matched.substr(0, this.matched.length - this.match.length);
|
1208 |
+
return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
|
1209 |
+
},
|
1210 |
+
upcomingInput:function () {
|
1211 |
+
var next = this.match;
|
1212 |
+
if (next.length < 20) {
|
1213 |
+
next += this._input.substr(0, 20-next.length);
|
1214 |
+
}
|
1215 |
+
return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, "");
|
1216 |
+
},
|
1217 |
+
showPosition:function () {
|
1218 |
+
var pre = this.pastInput();
|
1219 |
+
var c = new Array(pre.length + 1).join("-");
|
1220 |
+
return pre + this.upcomingInput() + "\n" + c+"^";
|
1221 |
+
},
|
1222 |
+
next:function () {
|
1223 |
+
if (this.done) {
|
1224 |
+
return this.EOF;
|
1225 |
+
}
|
1226 |
+
if (!this._input) this.done = true;
|
1227 |
+
|
1228 |
+
var token,
|
1229 |
+
match,
|
1230 |
+
tempMatch,
|
1231 |
+
index,
|
1232 |
+
col,
|
1233 |
+
lines;
|
1234 |
+
if (!this._more) {
|
1235 |
+
this.yytext = '';
|
1236 |
+
this.match = '';
|
1237 |
+
}
|
1238 |
+
var rules = this._currentRules();
|
1239 |
+
for (var i=0;i < rules.length; i++) {
|
1240 |
+
tempMatch = this._input.match(this.rules[rules[i]]);
|
1241 |
+
if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
1242 |
+
match = tempMatch;
|
1243 |
+
index = i;
|
1244 |
+
if (!this.options.flex) break;
|
1245 |
+
}
|
1246 |
+
}
|
1247 |
+
if (match) {
|
1248 |
+
lines = match[0].match(/(?:\r\n?|\n).*/g);
|
1249 |
+
if (lines) this.yylineno += lines.length;
|
1250 |
+
this.yylloc = {first_line: this.yylloc.last_line,
|
1251 |
+
last_line: this.yylineno+1,
|
1252 |
+
first_column: this.yylloc.last_column,
|
1253 |
+
last_column: lines ? lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length};
|
1254 |
+
this.yytext += match[0];
|
1255 |
+
this.match += match[0];
|
1256 |
+
this.matches = match;
|
1257 |
+
this.yyleng = this.yytext.length;
|
1258 |
+
if (this.options.ranges) {
|
1259 |
+
this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
1260 |
+
}
|
1261 |
+
this._more = false;
|
1262 |
+
this._input = this._input.slice(match[0].length);
|
1263 |
+
this.matched += match[0];
|
1264 |
+
token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]);
|
1265 |
+
if (this.done && this._input) this.done = false;
|
1266 |
+
if (token) return token;
|
1267 |
+
else return;
|
1268 |
+
}
|
1269 |
+
if (this._input === "") {
|
1270 |
+
return this.EOF;
|
1271 |
+
} else {
|
1272 |
+
return this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),
|
1273 |
+
{text: "", token: null, line: this.yylineno});
|
1274 |
+
}
|
1275 |
+
},
|
1276 |
+
lex:function lex() {
|
1277 |
+
var r = this.next();
|
1278 |
+
if (typeof r !== 'undefined') {
|
1279 |
+
return r;
|
1280 |
+
} else {
|
1281 |
+
return this.lex();
|
1282 |
+
}
|
1283 |
+
},
|
1284 |
+
begin:function begin(condition) {
|
1285 |
+
this.conditionStack.push(condition);
|
1286 |
+
},
|
1287 |
+
popState:function popState() {
|
1288 |
+
return this.conditionStack.pop();
|
1289 |
+
},
|
1290 |
+
_currentRules:function _currentRules() {
|
1291 |
+
return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;
|
1292 |
+
},
|
1293 |
+
topState:function () {
|
1294 |
+
return this.conditionStack[this.conditionStack.length-2];
|
1295 |
+
},
|
1296 |
+
pushState:function begin(condition) {
|
1297 |
+
this.begin(condition);
|
1298 |
+
}});
|
1299 |
+
lexer.options = {};
|
1300 |
+
lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
|
1301 |
+
|
1302 |
+
|
1303 |
+
function strip(start, end) {
|
1304 |
+
return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng-end);
|
1305 |
+
}
|
1306 |
+
|
1307 |
+
|
1308 |
+
var YYSTATE=YY_START
|
1309 |
+
switch($avoiding_name_collisions) {
|
1310 |
+
case 0:
|
1311 |
+
if(yy_.yytext.slice(-2) === "\\\\") {
|
1312 |
+
strip(0,1);
|
1313 |
+
this.begin("mu");
|
1314 |
+
} else if(yy_.yytext.slice(-1) === "\\") {
|
1315 |
+
strip(0,1);
|
1316 |
+
this.begin("emu");
|
1317 |
+
} else {
|
1318 |
+
this.begin("mu");
|
1319 |
+
}
|
1320 |
+
if(yy_.yytext) return 14;
|
1321 |
+
|
1322 |
+
break;
|
1323 |
+
case 1:return 14;
|
1324 |
+
break;
|
1325 |
+
case 2:
|
1326 |
+
this.popState();
|
1327 |
+
return 14;
|
1328 |
+
|
1329 |
+
break;
|
1330 |
+
case 3:
|
1331 |
+
yy_.yytext = yy_.yytext.substr(5, yy_.yyleng-9);
|
1332 |
+
this.popState();
|
1333 |
+
return 16;
|
1334 |
+
|
1335 |
+
break;
|
1336 |
+
case 4: return 14;
|
1337 |
+
break;
|
1338 |
+
case 5:
|
1339 |
+
this.popState();
|
1340 |
+
return 13;
|
1341 |
+
|
1342 |
+
break;
|
1343 |
+
case 6:return 59;
|
1344 |
+
break;
|
1345 |
+
case 7:return 62;
|
1346 |
+
break;
|
1347 |
+
case 8: return 17;
|
1348 |
+
break;
|
1349 |
+
case 9:
|
1350 |
+
this.popState();
|
1351 |
+
this.begin('raw');
|
1352 |
+
return 21;
|
1353 |
+
|
1354 |
+
break;
|
1355 |
+
case 10:return 53;
|
1356 |
+
break;
|
1357 |
+
case 11:return 27;
|
1358 |
+
break;
|
1359 |
+
case 12:return 45;
|
1360 |
+
break;
|
1361 |
+
case 13:this.popState(); return 42;
|
1362 |
+
break;
|
1363 |
+
case 14:this.popState(); return 42;
|
1364 |
+
break;
|
1365 |
+
case 15:return 32;
|
1366 |
+
break;
|
1367 |
+
case 16:return 37;
|
1368 |
+
break;
|
1369 |
+
case 17:return 49;
|
1370 |
+
break;
|
1371 |
+
case 18:return 46;
|
1372 |
+
break;
|
1373 |
+
case 19:
|
1374 |
+
this.unput(yy_.yytext);
|
1375 |
+
this.popState();
|
1376 |
+
this.begin('com');
|
1377 |
+
|
1378 |
+
break;
|
1379 |
+
case 20:
|
1380 |
+
this.popState();
|
1381 |
+
return 13;
|
1382 |
+
|
1383 |
+
break;
|
1384 |
+
case 21:return 46;
|
1385 |
+
break;
|
1386 |
+
case 22:return 67;
|
1387 |
+
break;
|
1388 |
+
case 23:return 66;
|
1389 |
+
break;
|
1390 |
+
case 24:return 66;
|
1391 |
+
break;
|
1392 |
+
case 25:return 79;
|
1393 |
+
break;
|
1394 |
+
case 26:// ignore whitespace
|
1395 |
+
break;
|
1396 |
+
case 27:this.popState(); return 52;
|
1397 |
+
break;
|
1398 |
+
case 28:this.popState(); return 31;
|
1399 |
+
break;
|
1400 |
+
case 29:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 74;
|
1401 |
+
break;
|
1402 |
+
case 30:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 74;
|
1403 |
+
break;
|
1404 |
+
case 31:return 77;
|
1405 |
+
break;
|
1406 |
+
case 32:return 76;
|
1407 |
+
break;
|
1408 |
+
case 33:return 76;
|
1409 |
+
break;
|
1410 |
+
case 34:return 75;
|
1411 |
+
break;
|
1412 |
+
case 35:return 69;
|
1413 |
+
break;
|
1414 |
+
case 36:return 71;
|
1415 |
+
break;
|
1416 |
+
case 37:return 66;
|
1417 |
+
break;
|
1418 |
+
case 38:yy_.yytext = strip(1,2); return 66;
|
1419 |
+
break;
|
1420 |
+
case 39:return 'INVALID';
|
1421 |
+
break;
|
1422 |
+
case 40:return 5;
|
1423 |
+
break;
|
1424 |
+
}
|
1425 |
+
};
|
1426 |
+
lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{\/)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/];
|
1427 |
+
lexer.conditions = {"mu":{"rules":[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[5],"inclusive":false},"raw":{"rules":[3,4],"inclusive":false},"INITIAL":{"rules":[0,1,40],"inclusive":true}};
|
1428 |
+
return lexer;})()
|
1429 |
+
parser.lexer = lexer;
|
1430 |
+
function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser;
|
1431 |
+
return new Parser;
|
1432 |
+
})();__exports__ = handlebars;
|
1433 |
+
/* jshint ignore:end */
|
1434 |
+
return __exports__;
|
1435 |
+
})();
|
1436 |
+
|
1437 |
+
// handlebars/compiler/visitor.js
|
1438 |
+
var __module11__ = (function(__dependency1__, __dependency2__) {
|
1439 |
+
"use strict";
|
1440 |
+
var __exports__;
|
1441 |
+
var Exception = __dependency1__;
|
1442 |
+
var AST = __dependency2__;
|
1443 |
+
|
1444 |
+
function Visitor() {
|
1445 |
+
this.parents = [];
|
1446 |
+
}
|
1447 |
+
|
1448 |
+
Visitor.prototype = {
|
1449 |
+
constructor: Visitor,
|
1450 |
+
mutating: false,
|
1451 |
+
|
1452 |
+
// Visits a given value. If mutating, will replace the value if necessary.
|
1453 |
+
acceptKey: function(node, name) {
|
1454 |
+
var value = this.accept(node[name]);
|
1455 |
+
if (this.mutating) {
|
1456 |
+
// Hacky sanity check:
|
1457 |
+
if (value && (!value.type || !AST[value.type])) {
|
1458 |
+
throw new Exception('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type);
|
1459 |
+
}
|
1460 |
+
node[name] = value;
|
1461 |
+
}
|
1462 |
+
},
|
1463 |
+
|
1464 |
+
// Performs an accept operation with added sanity check to ensure
|
1465 |
+
// required keys are not removed.
|
1466 |
+
acceptRequired: function(node, name) {
|
1467 |
+
this.acceptKey(node, name);
|
1468 |
+
|
1469 |
+
if (!node[name]) {
|
1470 |
+
throw new Exception(node.type + ' requires ' + name);
|
1471 |
+
}
|
1472 |
+
},
|
1473 |
+
|
1474 |
+
// Traverses a given array. If mutating, empty respnses will be removed
|
1475 |
+
// for child elements.
|
1476 |
+
acceptArray: function(array) {
|
1477 |
+
for (var i = 0, l = array.length; i < l; i++) {
|
1478 |
+
this.acceptKey(array, i);
|
1479 |
+
|
1480 |
+
if (!array[i]) {
|
1481 |
+
array.splice(i, 1);
|
1482 |
+
i--;
|
1483 |
+
l--;
|
1484 |
+
}
|
1485 |
+
}
|
1486 |
+
},
|
1487 |
+
|
1488 |
+
accept: function(object) {
|
1489 |
+
if (!object) {
|
1490 |
+
return;
|
1491 |
+
}
|
1492 |
+
|
1493 |
+
if (this.current) {
|
1494 |
+
this.parents.unshift(this.current);
|
1495 |
+
}
|
1496 |
+
this.current = object;
|
1497 |
+
|
1498 |
+
var ret = this[object.type](object);
|
1499 |
+
|
1500 |
+
this.current = this.parents.shift();
|
1501 |
+
|
1502 |
+
if (!this.mutating || ret) {
|
1503 |
+
return ret;
|
1504 |
+
} else if (ret !== false) {
|
1505 |
+
return object;
|
1506 |
+
}
|
1507 |
+
},
|
1508 |
+
|
1509 |
+
Program: function(program) {
|
1510 |
+
this.acceptArray(program.body);
|
1511 |
+
},
|
1512 |
+
|
1513 |
+
MustacheStatement: function(mustache) {
|
1514 |
+
this.acceptRequired(mustache, 'path');
|
1515 |
+
this.acceptArray(mustache.params);
|
1516 |
+
this.acceptKey(mustache, 'hash');
|
1517 |
+
},
|
1518 |
+
|
1519 |
+
BlockStatement: function(block) {
|
1520 |
+
this.acceptRequired(block, 'path');
|
1521 |
+
this.acceptArray(block.params);
|
1522 |
+
this.acceptKey(block, 'hash');
|
1523 |
+
|
1524 |
+
this.acceptKey(block, 'program');
|
1525 |
+
this.acceptKey(block, 'inverse');
|
1526 |
+
},
|
1527 |
+
|
1528 |
+
PartialStatement: function(partial) {
|
1529 |
+
this.acceptRequired(partial, 'name');
|
1530 |
+
this.acceptArray(partial.params);
|
1531 |
+
this.acceptKey(partial, 'hash');
|
1532 |
+
},
|
1533 |
+
|
1534 |
+
ContentStatement: function(/* content */) {},
|
1535 |
+
CommentStatement: function(/* comment */) {},
|
1536 |
+
|
1537 |
+
SubExpression: function(sexpr) {
|
1538 |
+
this.acceptRequired(sexpr, 'path');
|
1539 |
+
this.acceptArray(sexpr.params);
|
1540 |
+
this.acceptKey(sexpr, 'hash');
|
1541 |
+
},
|
1542 |
+
PartialExpression: function(partial) {
|
1543 |
+
this.acceptRequired(partial, 'name');
|
1544 |
+
this.acceptArray(partial.params);
|
1545 |
+
this.acceptKey(partial, 'hash');
|
1546 |
+
},
|
1547 |
+
|
1548 |
+
PathExpression: function(/* path */) {},
|
1549 |
+
|
1550 |
+
StringLiteral: function(/* string */) {},
|
1551 |
+
NumberLiteral: function(/* number */) {},
|
1552 |
+
BooleanLiteral: function(/* bool */) {},
|
1553 |
+
|
1554 |
+
Hash: function(hash) {
|
1555 |
+
this.acceptArray(hash.pairs);
|
1556 |
+
},
|
1557 |
+
HashPair: function(pair) {
|
1558 |
+
this.acceptRequired(pair, 'value');
|
1559 |
+
}
|
1560 |
+
};
|
1561 |
+
|
1562 |
+
__exports__ = Visitor;
|
1563 |
+
return __exports__;
|
1564 |
+
})(__module4__, __module7__);
|
1565 |
+
|
1566 |
+
// handlebars/compiler/whitespace-control.js
|
1567 |
+
var __module10__ = (function(__dependency1__) {
|
1568 |
+
"use strict";
|
1569 |
+
var __exports__;
|
1570 |
+
var Visitor = __dependency1__;
|
1571 |
+
|
1572 |
+
function WhitespaceControl() {
|
1573 |
+
}
|
1574 |
+
WhitespaceControl.prototype = new Visitor();
|
1575 |
+
|
1576 |
+
WhitespaceControl.prototype.Program = function(program) {
|
1577 |
+
var isRoot = !this.isRootSeen;
|
1578 |
+
this.isRootSeen = true;
|
1579 |
+
|
1580 |
+
var body = program.body;
|
1581 |
+
for (var i = 0, l = body.length; i < l; i++) {
|
1582 |
+
var current = body[i],
|
1583 |
+
strip = this.accept(current);
|
1584 |
+
|
1585 |
+
if (!strip) {
|
1586 |
+
continue;
|
1587 |
+
}
|
1588 |
+
|
1589 |
+
var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot),
|
1590 |
+
_isNextWhitespace = isNextWhitespace(body, i, isRoot),
|
1591 |
+
|
1592 |
+
openStandalone = strip.openStandalone && _isPrevWhitespace,
|
1593 |
+
closeStandalone = strip.closeStandalone && _isNextWhitespace,
|
1594 |
+
inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace;
|
1595 |
+
|
1596 |
+
if (strip.close) {
|
1597 |
+
omitRight(body, i, true);
|
1598 |
+
}
|
1599 |
+
if (strip.open) {
|
1600 |
+
omitLeft(body, i, true);
|
1601 |
+
}
|
1602 |
+
|
1603 |
+
if (inlineStandalone) {
|
1604 |
+
omitRight(body, i);
|
1605 |
+
|
1606 |
+
if (omitLeft(body, i)) {
|
1607 |
+
// If we are on a standalone node, save the indent info for partials
|
1608 |
+
if (current.type === 'PartialStatement') {
|
1609 |
+
// Pull out the whitespace from the final line
|
1610 |
+
current.indent = (/([ \t]+$)/).exec(body[i-1].original)[1];
|
1611 |
+
}
|
1612 |
+
}
|
1613 |
+
}
|
1614 |
+
if (openStandalone) {
|
1615 |
+
omitRight((current.program || current.inverse).body);
|
1616 |
+
|
1617 |
+
// Strip out the previous content node if it's whitespace only
|
1618 |
+
omitLeft(body, i);
|
1619 |
+
}
|
1620 |
+
if (closeStandalone) {
|
1621 |
+
// Always strip the next node
|
1622 |
+
omitRight(body, i);
|
1623 |
+
|
1624 |
+
omitLeft((current.inverse || current.program).body);
|
1625 |
+
}
|
1626 |
+
}
|
1627 |
+
|
1628 |
+
return program;
|
1629 |
+
};
|
1630 |
+
WhitespaceControl.prototype.BlockStatement = function(block) {
|
1631 |
+
this.accept(block.program);
|
1632 |
+
this.accept(block.inverse);
|
1633 |
+
|
1634 |
+
// Find the inverse program that is involed with whitespace stripping.
|
1635 |
+
var program = block.program || block.inverse,
|
1636 |
+
inverse = block.program && block.inverse,
|
1637 |
+
firstInverse = inverse,
|
1638 |
+
lastInverse = inverse;
|
1639 |
+
|
1640 |
+
if (inverse && inverse.chained) {
|
1641 |
+
firstInverse = inverse.body[0].program;
|
1642 |
+
|
1643 |
+
// Walk the inverse chain to find the last inverse that is actually in the chain.
|
1644 |
+
while (lastInverse.chained) {
|
1645 |
+
lastInverse = lastInverse.body[lastInverse.body.length-1].program;
|
1646 |
+
}
|
1647 |
+
}
|
1648 |
+
|
1649 |
+
var strip = {
|
1650 |
+
open: block.openStrip.open,
|
1651 |
+
close: block.closeStrip.close,
|
1652 |
+
|
1653 |
+
// Determine the standalone candiacy. Basically flag our content as being possibly standalone
|
1654 |
+
// so our parent can determine if we actually are standalone
|
1655 |
+
openStandalone: isNextWhitespace(program.body),
|
1656 |
+
closeStandalone: isPrevWhitespace((firstInverse || program).body)
|
1657 |
+
};
|
1658 |
+
|
1659 |
+
if (block.openStrip.close) {
|
1660 |
+
omitRight(program.body, null, true);
|
1661 |
+
}
|
1662 |
+
|
1663 |
+
if (inverse) {
|
1664 |
+
var inverseStrip = block.inverseStrip;
|
1665 |
+
|
1666 |
+
if (inverseStrip.open) {
|
1667 |
+
omitLeft(program.body, null, true);
|
1668 |
+
}
|
1669 |
+
|
1670 |
+
if (inverseStrip.close) {
|
1671 |
+
omitRight(firstInverse.body, null, true);
|
1672 |
+
}
|
1673 |
+
if (block.closeStrip.open) {
|
1674 |
+
omitLeft(lastInverse.body, null, true);
|
1675 |
+
}
|
1676 |
+
|
1677 |
+
// Find standalone else statments
|
1678 |
+
if (isPrevWhitespace(program.body)
|
1679 |
+
&& isNextWhitespace(firstInverse.body)) {
|
1680 |
+
|
1681 |
+
omitLeft(program.body);
|
1682 |
+
omitRight(firstInverse.body);
|
1683 |
+
}
|
1684 |
+
} else {
|
1685 |
+
if (block.closeStrip.open) {
|
1686 |
+
omitLeft(program.body, null, true);
|
1687 |
+
}
|
1688 |
+
}
|
1689 |
+
|
1690 |
+
return strip;
|
1691 |
+
};
|
1692 |
+
|
1693 |
+
WhitespaceControl.prototype.MustacheStatement = function(mustache) {
|
1694 |
+
return mustache.strip;
|
1695 |
+
};
|
1696 |
+
|
1697 |
+
WhitespaceControl.prototype.PartialStatement =
|
1698 |
+
WhitespaceControl.prototype.CommentStatement = function(node) {
|
1699 |
+
/* istanbul ignore next */
|
1700 |
+
var strip = node.strip || {};
|
1701 |
+
return {
|
1702 |
+
inlineStandalone: true,
|
1703 |
+
open: strip.open,
|
1704 |
+
close: strip.close
|
1705 |
+
};
|
1706 |
+
};
|
1707 |
+
|
1708 |
+
|
1709 |
+
function isPrevWhitespace(body, i, isRoot) {
|
1710 |
+
if (i === undefined) {
|
1711 |
+
i = body.length;
|
1712 |
+
}
|
1713 |
+
|
1714 |
+
// Nodes that end with newlines are considered whitespace (but are special
|
1715 |
+
// cased for strip operations)
|
1716 |
+
var prev = body[i-1],
|
1717 |
+
sibling = body[i-2];
|
1718 |
+
if (!prev) {
|
1719 |
+
return isRoot;
|
1720 |
+
}
|
1721 |
+
|
1722 |
+
if (prev.type === 'ContentStatement') {
|
1723 |
+
return (sibling || !isRoot ? (/\r?\n\s*?$/) : (/(^|\r?\n)\s*?$/)).test(prev.original);
|
1724 |
+
}
|
1725 |
+
}
|
1726 |
+
function isNextWhitespace(body, i, isRoot) {
|
1727 |
+
if (i === undefined) {
|
1728 |
+
i = -1;
|
1729 |
+
}
|
1730 |
+
|
1731 |
+
var next = body[i+1],
|
1732 |
+
sibling = body[i+2];
|
1733 |
+
if (!next) {
|
1734 |
+
return isRoot;
|
1735 |
+
}
|
1736 |
+
|
1737 |
+
if (next.type === 'ContentStatement') {
|
1738 |
+
return (sibling || !isRoot ? (/^\s*?\r?\n/) : (/^\s*?(\r?\n|$)/)).test(next.original);
|
1739 |
+
}
|
1740 |
+
}
|
1741 |
+
|
1742 |
+
// Marks the node to the right of the position as omitted.
|
1743 |
+
// I.e. {{foo}}' ' will mark the ' ' node as omitted.
|
1744 |
+
//
|
1745 |
+
// If i is undefined, then the first child will be marked as such.
|
1746 |
+
//
|
1747 |
+
// If mulitple is truthy then all whitespace will be stripped out until non-whitespace
|
1748 |
+
// content is met.
|
1749 |
+
function omitRight(body, i, multiple) {
|
1750 |
+
var current = body[i == null ? 0 : i + 1];
|
1751 |
+
if (!current || current.type !== 'ContentStatement' || (!multiple && current.rightStripped)) {
|
1752 |
+
return;
|
1753 |
+
}
|
1754 |
+
|
1755 |
+
var original = current.value;
|
1756 |
+
current.value = current.value.replace(multiple ? (/^\s+/) : (/^[ \t]*\r?\n?/), '');
|
1757 |
+
current.rightStripped = current.value !== original;
|
1758 |
+
}
|
1759 |
+
|
1760 |
+
// Marks the node to the left of the position as omitted.
|
1761 |
+
// I.e. ' '{{foo}} will mark the ' ' node as omitted.
|
1762 |
+
//
|
1763 |
+
// If i is undefined then the last child will be marked as such.
|
1764 |
+
//
|
1765 |
+
// If mulitple is truthy then all whitespace will be stripped out until non-whitespace
|
1766 |
+
// content is met.
|
1767 |
+
function omitLeft(body, i, multiple) {
|
1768 |
+
var current = body[i == null ? body.length - 1 : i - 1];
|
1769 |
+
if (!current || current.type !== 'ContentStatement' || (!multiple && current.leftStripped)) {
|
1770 |
+
return;
|
1771 |
+
}
|
1772 |
+
|
1773 |
+
// We omit the last node if it's whitespace only and not preceeded by a non-content node.
|
1774 |
+
var original = current.value;
|
1775 |
+
current.value = current.value.replace(multiple ? (/\s+$/) : (/[ \t]+$/), '');
|
1776 |
+
current.leftStripped = current.value !== original;
|
1777 |
+
return current.leftStripped;
|
1778 |
+
}
|
1779 |
+
|
1780 |
+
__exports__ = WhitespaceControl;
|
1781 |
+
return __exports__;
|
1782 |
+
})(__module11__);
|
1783 |
+
|
1784 |
+
// handlebars/compiler/helpers.js
|
1785 |
+
var __module12__ = (function(__dependency1__) {
|
1786 |
+
"use strict";
|
1787 |
+
var __exports__ = {};
|
1788 |
+
var Exception = __dependency1__;
|
1789 |
+
|
1790 |
+
function SourceLocation(source, locInfo) {
|
1791 |
+
this.source = source;
|
1792 |
+
this.start = {
|
1793 |
+
line: locInfo.first_line,
|
1794 |
+
column: locInfo.first_column
|
1795 |
+
};
|
1796 |
+
this.end = {
|
1797 |
+
line: locInfo.last_line,
|
1798 |
+
column: locInfo.last_column
|
1799 |
+
};
|
1800 |
+
}
|
1801 |
+
|
1802 |
+
__exports__.SourceLocation = SourceLocation;function stripFlags(open, close) {
|
1803 |
+
return {
|
1804 |
+
open: open.charAt(2) === '~',
|
1805 |
+
close: close.charAt(close.length-3) === '~'
|
1806 |
+
};
|
1807 |
+
}
|
1808 |
+
|
1809 |
+
__exports__.stripFlags = stripFlags;function stripComment(comment) {
|
1810 |
+
return comment.replace(/^\{\{~?\!-?-?/, '')
|
1811 |
+
.replace(/-?-?~?\}\}$/, '');
|
1812 |
+
}
|
1813 |
+
|
1814 |
+
__exports__.stripComment = stripComment;function preparePath(data, parts, locInfo) {
|
1815 |
+
/*jshint -W040 */
|
1816 |
+
locInfo = this.locInfo(locInfo);
|
1817 |
+
|
1818 |
+
var original = data ? '@' : '',
|
1819 |
+
dig = [],
|
1820 |
+
depth = 0,
|
1821 |
+
depthString = '';
|
1822 |
+
|
1823 |
+
for(var i=0,l=parts.length; i<l; i++) {
|
1824 |
+
var part = parts[i].part;
|
1825 |
+
original += (parts[i].separator || '') + part;
|
1826 |
+
|
1827 |
+
if (part === '..' || part === '.' || part === 'this') {
|
1828 |
+
if (dig.length > 0) {
|
1829 |
+
throw new Exception('Invalid path: ' + original, {loc: locInfo});
|
1830 |
+
} else if (part === '..') {
|
1831 |
+
depth++;
|
1832 |
+
depthString += '../';
|
1833 |
+
}
|
1834 |
+
} else {
|
1835 |
+
dig.push(part);
|
1836 |
+
}
|
1837 |
+
}
|
1838 |
+
|
1839 |
+
return new this.PathExpression(data, depth, dig, original, locInfo);
|
1840 |
+
}
|
1841 |
+
|
1842 |
+
__exports__.preparePath = preparePath;function prepareMustache(path, params, hash, open, strip, locInfo) {
|
1843 |
+
/*jshint -W040 */
|
1844 |
+
// Must use charAt to support IE pre-10
|
1845 |
+
var escapeFlag = open.charAt(3) || open.charAt(2),
|
1846 |
+
escaped = escapeFlag !== '{' && escapeFlag !== '&';
|
1847 |
+
|
1848 |
+
return new this.MustacheStatement(path, params, hash, escaped, strip, this.locInfo(locInfo));
|
1849 |
+
}
|
1850 |
+
|
1851 |
+
__exports__.prepareMustache = prepareMustache;function prepareRawBlock(openRawBlock, content, close, locInfo) {
|
1852 |
+
/*jshint -W040 */
|
1853 |
+
if (openRawBlock.path.original !== close) {
|
1854 |
+
var errorNode = {loc: openRawBlock.path.loc};
|
1855 |
+
|
1856 |
+
throw new Exception(openRawBlock.path.original + " doesn't match " + close, errorNode);
|
1857 |
+
}
|
1858 |
+
|
1859 |
+
locInfo = this.locInfo(locInfo);
|
1860 |
+
var program = new this.Program([content], null, {}, locInfo);
|
1861 |
+
|
1862 |
+
return new this.BlockStatement(
|
1863 |
+
openRawBlock.path, openRawBlock.params, openRawBlock.hash,
|
1864 |
+
program, undefined,
|
1865 |
+
{}, {}, {},
|
1866 |
+
locInfo);
|
1867 |
+
}
|
1868 |
+
|
1869 |
+
__exports__.prepareRawBlock = prepareRawBlock;function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) {
|
1870 |
+
/*jshint -W040 */
|
1871 |
+
// When we are chaining inverse calls, we will not have a close path
|
1872 |
+
if (close && close.path && openBlock.path.original !== close.path.original) {
|
1873 |
+
var errorNode = {loc: openBlock.path.loc};
|
1874 |
+
|
1875 |
+
throw new Exception(openBlock.path.original + ' doesn\'t match ' + close.path.original, errorNode);
|
1876 |
+
}
|
1877 |
+
|
1878 |
+
program.blockParams = openBlock.blockParams;
|
1879 |
+
|
1880 |
+
var inverse,
|
1881 |
+
inverseStrip;
|
1882 |
+
|
1883 |
+
if (inverseAndProgram) {
|
1884 |
+
if (inverseAndProgram.chain) {
|
1885 |
+
inverseAndProgram.program.body[0].closeStrip = close.strip;
|
1886 |
+
}
|
1887 |
+
|
1888 |
+
inverseStrip = inverseAndProgram.strip;
|
1889 |
+
inverse = inverseAndProgram.program;
|
1890 |
+
}
|
1891 |
+
|
1892 |
+
if (inverted) {
|
1893 |
+
inverted = inverse;
|
1894 |
+
inverse = program;
|
1895 |
+
program = inverted;
|
1896 |
+
}
|
1897 |
+
|
1898 |
+
return new this.BlockStatement(
|
1899 |
+
openBlock.path, openBlock.params, openBlock.hash,
|
1900 |
+
program, inverse,
|
1901 |
+
openBlock.strip, inverseStrip, close && close.strip,
|
1902 |
+
this.locInfo(locInfo));
|
1903 |
+
}
|
1904 |
+
|
1905 |
+
__exports__.prepareBlock = prepareBlock;
|
1906 |
+
return __exports__;
|
1907 |
+
})(__module4__);
|
1908 |
+
|
1909 |
+
// handlebars/compiler/base.js
|
1910 |
+
var __module8__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) {
|
1911 |
+
"use strict";
|
1912 |
+
var __exports__ = {};
|
1913 |
+
var parser = __dependency1__;
|
1914 |
+
var AST = __dependency2__;
|
1915 |
+
var WhitespaceControl = __dependency3__;
|
1916 |
+
var Helpers = __dependency4__;
|
1917 |
+
var extend = __dependency5__.extend;
|
1918 |
+
|
1919 |
+
__exports__.parser = parser;
|
1920 |
+
|
1921 |
+
var yy = {};
|
1922 |
+
extend(yy, Helpers, AST);
|
1923 |
+
|
1924 |
+
function parse(input, options) {
|
1925 |
+
// Just return if an already-compiled AST was passed in.
|
1926 |
+
if (input.type === 'Program') { return input; }
|
1927 |
+
|
1928 |
+
parser.yy = yy;
|
1929 |
+
|
1930 |
+
// Altering the shared object here, but this is ok as parser is a sync operation
|
1931 |
+
yy.locInfo = function(locInfo) {
|
1932 |
+
return new yy.SourceLocation(options && options.srcName, locInfo);
|
1933 |
+
};
|
1934 |
+
|
1935 |
+
var strip = new WhitespaceControl();
|
1936 |
+
return strip.accept(parser.parse(input));
|
1937 |
+
}
|
1938 |
+
|
1939 |
+
__exports__.parse = parse;
|
1940 |
+
return __exports__;
|
1941 |
+
})(__module9__, __module7__, __module10__, __module12__, __module3__);
|
1942 |
+
|
1943 |
+
// handlebars/compiler/compiler.js
|
1944 |
+
var __module13__ = (function(__dependency1__, __dependency2__, __dependency3__) {
|
1945 |
+
"use strict";
|
1946 |
+
var __exports__ = {};
|
1947 |
+
var Exception = __dependency1__;
|
1948 |
+
var isArray = __dependency2__.isArray;
|
1949 |
+
var indexOf = __dependency2__.indexOf;
|
1950 |
+
var AST = __dependency3__;
|
1951 |
+
|
1952 |
+
var slice = [].slice;
|
1953 |
+
|
1954 |
+
|
1955 |
+
function Compiler() {}
|
1956 |
+
|
1957 |
+
__exports__.Compiler = Compiler;// the foundHelper register will disambiguate helper lookup from finding a
|
1958 |
+
// function in a context. This is necessary for mustache compatibility, which
|
1959 |
+
// requires that context functions in blocks are evaluated by blockHelperMissing,
|
1960 |
+
// and then proceed as if the resulting value was provided to blockHelperMissing.
|
1961 |
+
|
1962 |
+
Compiler.prototype = {
|
1963 |
+
compiler: Compiler,
|
1964 |
+
|
1965 |
+
equals: function(other) {
|
1966 |
+
var len = this.opcodes.length;
|
1967 |
+
if (other.opcodes.length !== len) {
|
1968 |
+
return false;
|
1969 |
+
}
|
1970 |
+
|
1971 |
+
for (var i = 0; i < len; i++) {
|
1972 |
+
var opcode = this.opcodes[i],
|
1973 |
+
otherOpcode = other.opcodes[i];
|
1974 |
+
if (opcode.opcode !== otherOpcode.opcode || !argEquals(opcode.args, otherOpcode.args)) {
|
1975 |
+
return false;
|
1976 |
+
}
|
1977 |
+
}
|
1978 |
+
|
1979 |
+
// We know that length is the same between the two arrays because they are directly tied
|
1980 |
+
// to the opcode behavior above.
|
1981 |
+
len = this.children.length;
|
1982 |
+
for (i = 0; i < len; i++) {
|
1983 |
+
if (!this.children[i].equals(other.children[i])) {
|
1984 |
+
return false;
|
1985 |
+
}
|
1986 |
+
}
|
1987 |
+
|
1988 |
+
return true;
|
1989 |
+
},
|
1990 |
+
|
1991 |
+
guid: 0,
|
1992 |
+
|
1993 |
+
compile: function(program, options) {
|
1994 |
+
this.sourceNode = [];
|
1995 |
+
this.opcodes = [];
|
1996 |
+
this.children = [];
|
1997 |
+
this.options = options;
|
1998 |
+
this.stringParams = options.stringParams;
|
1999 |
+
this.trackIds = options.trackIds;
|
2000 |
+
|
2001 |
+
options.blockParams = options.blockParams || [];
|
2002 |
+
|
2003 |
+
// These changes will propagate to the other compiler components
|
2004 |
+
var knownHelpers = options.knownHelpers;
|
2005 |
+
options.knownHelpers = {
|
2006 |
+
'helperMissing': true,
|
2007 |
+
'blockHelperMissing': true,
|
2008 |
+
'each': true,
|
2009 |
+
'if': true,
|
2010 |
+
'unless': true,
|
2011 |
+
'with': true,
|
2012 |
+
'log': true,
|
2013 |
+
'lookup': true
|
2014 |
+
};
|
2015 |
+
if (knownHelpers) {
|
2016 |
+
for (var name in knownHelpers) {
|
2017 |
+
options.knownHelpers[name] = knownHelpers[name];
|
2018 |
+
}
|
2019 |
+
}
|
2020 |
+
|
2021 |
+
return this.accept(program);
|
2022 |
+
},
|
2023 |
+
|
2024 |
+
compileProgram: function(program) {
|
2025 |
+
var result = new this.compiler().compile(program, this.options);
|
2026 |
+
var guid = this.guid++;
|
2027 |
+
|
2028 |
+
this.usePartial = this.usePartial || result.usePartial;
|
2029 |
+
|
2030 |
+
this.children[guid] = result;
|
2031 |
+
this.useDepths = this.useDepths || result.useDepths;
|
2032 |
+
|
2033 |
+
return guid;
|
2034 |
+
},
|
2035 |
+
|
2036 |
+
accept: function(node) {
|
2037 |
+
this.sourceNode.unshift(node);
|
2038 |
+
var ret = this[node.type](node);
|
2039 |
+
this.sourceNode.shift();
|
2040 |
+
return ret;
|
2041 |
+
},
|
2042 |
+
|
2043 |
+
Program: function(program) {
|
2044 |
+
this.options.blockParams.unshift(program.blockParams);
|
2045 |
+
|
2046 |
+
var body = program.body;
|
2047 |
+
for(var i=0, l=body.length; i<l; i++) {
|
2048 |
+
this.accept(body[i]);
|
2049 |
+
}
|
2050 |
+
|
2051 |
+
this.options.blockParams.shift();
|
2052 |
+
|
2053 |
+
this.isSimple = l === 1;
|
2054 |
+
this.blockParams = program.blockParams ? program.blockParams.length : 0;
|
2055 |
+
|
2056 |
+
return this;
|
2057 |
+
},
|
2058 |
+
|
2059 |
+
BlockStatement: function(block) {
|
2060 |
+
transformLiteralToPath(block);
|
2061 |
+
|
2062 |
+
var program = block.program,
|
2063 |
+
inverse = block.inverse;
|
2064 |
+
|
2065 |
+
program = program && this.compileProgram(program);
|
2066 |
+
inverse = inverse && this.compileProgram(inverse);
|
2067 |
+
|
2068 |
+
var type = this.classifySexpr(block);
|
2069 |
+
|
2070 |
+
if (type === 'helper') {
|
2071 |
+
this.helperSexpr(block, program, inverse);
|
2072 |
+
} else if (type === 'simple') {
|
2073 |
+
this.simpleSexpr(block);
|
2074 |
+
|
2075 |
+
// now that the simple mustache is resolved, we need to
|
2076 |
+
// evaluate it by executing `blockHelperMissing`
|
2077 |
+
this.opcode('pushProgram', program);
|
2078 |
+
this.opcode('pushProgram', inverse);
|
2079 |
+
this.opcode('emptyHash');
|
2080 |
+
this.opcode('blockValue', block.path.original);
|
2081 |
+
} else {
|
2082 |
+
this.ambiguousSexpr(block, program, inverse);
|
2083 |
+
|
2084 |
+
// now that the simple mustache is resolved, we need to
|
2085 |
+
// evaluate it by executing `blockHelperMissing`
|
2086 |
+
this.opcode('pushProgram', program);
|
2087 |
+
this.opcode('pushProgram', inverse);
|
2088 |
+
this.opcode('emptyHash');
|
2089 |
+
this.opcode('ambiguousBlockValue');
|
2090 |
+
}
|
2091 |
+
|
2092 |
+
this.opcode('append');
|
2093 |
+
},
|
2094 |
+
|
2095 |
+
PartialStatement: function(partial) {
|
2096 |
+
this.usePartial = true;
|
2097 |
+
|
2098 |
+
var params = partial.params;
|
2099 |
+
if (params.length > 1) {
|
2100 |
+
throw new Exception('Unsupported number of partial arguments: ' + params.length, partial);
|
2101 |
+
} else if (!params.length) {
|
2102 |
+
params.push({type: 'PathExpression', parts: [], depth: 0});
|
2103 |
+
}
|
2104 |
+
|
2105 |
+
var partialName = partial.name.original,
|
2106 |
+
isDynamic = partial.name.type === 'SubExpression';
|
2107 |
+
if (isDynamic) {
|
2108 |
+
this.accept(partial.name);
|
2109 |
+
}
|
2110 |
+
|
2111 |
+
this.setupFullMustacheParams(partial, undefined, undefined, true);
|
2112 |
+
|
2113 |
+
var indent = partial.indent || '';
|
2114 |
+
if (this.options.preventIndent && indent) {
|
2115 |
+
this.opcode('appendContent', indent);
|
2116 |
+
indent = '';
|
2117 |
+
}
|
2118 |
+
|
2119 |
+
this.opcode('invokePartial', isDynamic, partialName, indent);
|
2120 |
+
this.opcode('append');
|
2121 |
+
},
|
2122 |
+
|
2123 |
+
MustacheStatement: function(mustache) {
|
2124 |
+
this.SubExpression(mustache);
|
2125 |
+
|
2126 |
+
if(mustache.escaped && !this.options.noEscape) {
|
2127 |
+
this.opcode('appendEscaped');
|
2128 |
+
} else {
|
2129 |
+
this.opcode('append');
|
2130 |
+
}
|
2131 |
+
},
|
2132 |
+
|
2133 |
+
ContentStatement: function(content) {
|
2134 |
+
if (content.value) {
|
2135 |
+
this.opcode('appendContent', content.value);
|
2136 |
+
}
|
2137 |
+
},
|
2138 |
+
|
2139 |
+
CommentStatement: function() {},
|
2140 |
+
|
2141 |
+
SubExpression: function(sexpr) {
|
2142 |
+
transformLiteralToPath(sexpr);
|
2143 |
+
var type = this.classifySexpr(sexpr);
|
2144 |
+
|
2145 |
+
if (type === 'simple') {
|
2146 |
+
this.simpleSexpr(sexpr);
|
2147 |
+
} else if (type === 'helper') {
|
2148 |
+
this.helperSexpr(sexpr);
|
2149 |
+
} else {
|
2150 |
+
this.ambiguousSexpr(sexpr);
|
2151 |
+
}
|
2152 |
+
},
|
2153 |
+
ambiguousSexpr: function(sexpr, program, inverse) {
|
2154 |
+
var path = sexpr.path,
|
2155 |
+
name = path.parts[0],
|
2156 |
+
isBlock = program != null || inverse != null;
|
2157 |
+
|
2158 |
+
this.opcode('getContext', path.depth);
|
2159 |
+
|
2160 |
+
this.opcode('pushProgram', program);
|
2161 |
+
this.opcode('pushProgram', inverse);
|
2162 |
+
|
2163 |
+
this.accept(path);
|
2164 |
+
|
2165 |
+
this.opcode('invokeAmbiguous', name, isBlock);
|
2166 |
+
},
|
2167 |
+
|
2168 |
+
simpleSexpr: function(sexpr) {
|
2169 |
+
this.accept(sexpr.path);
|
2170 |
+
this.opcode('resolvePossibleLambda');
|
2171 |
+
},
|
2172 |
+
|
2173 |
+
helperSexpr: function(sexpr, program, inverse) {
|
2174 |
+
var params = this.setupFullMustacheParams(sexpr, program, inverse),
|
2175 |
+
path = sexpr.path,
|
2176 |
+
name = path.parts[0];
|
2177 |
+
|
2178 |
+
if (this.options.knownHelpers[name]) {
|
2179 |
+
this.opcode('invokeKnownHelper', params.length, name);
|
2180 |
+
} else if (this.options.knownHelpersOnly) {
|
2181 |
+
throw new Exception("You specified knownHelpersOnly, but used the unknown helper " + name, sexpr);
|
2182 |
+
} else {
|
2183 |
+
path.falsy = true;
|
2184 |
+
|
2185 |
+
this.accept(path);
|
2186 |
+
this.opcode('invokeHelper', params.length, path.original, AST.helpers.simpleId(path));
|
2187 |
+
}
|
2188 |
+
},
|
2189 |
+
|
2190 |
+
PathExpression: function(path) {
|
2191 |
+
this.addDepth(path.depth);
|
2192 |
+
this.opcode('getContext', path.depth);
|
2193 |
+
|
2194 |
+
var name = path.parts[0],
|
2195 |
+
scoped = AST.helpers.scopedId(path),
|
2196 |
+
blockParamId = !path.depth && !scoped && this.blockParamIndex(name);
|
2197 |
+
|
2198 |
+
if (blockParamId) {
|
2199 |
+
this.opcode('lookupBlockParam', blockParamId, path.parts);
|
2200 |
+
} else if (!name) {
|
2201 |
+
// Context reference, i.e. `{{foo .}}` or `{{foo ..}}`
|
2202 |
+
this.opcode('pushContext');
|
2203 |
+
} else if (path.data) {
|
2204 |
+
this.options.data = true;
|
2205 |
+
this.opcode('lookupData', path.depth, path.parts);
|
2206 |
+
} else {
|
2207 |
+
this.opcode('lookupOnContext', path.parts, path.falsy, scoped);
|
2208 |
+
}
|
2209 |
+
},
|
2210 |
+
|
2211 |
+
StringLiteral: function(string) {
|
2212 |
+
this.opcode('pushString', string.value);
|
2213 |
+
},
|
2214 |
+
|
2215 |
+
NumberLiteral: function(number) {
|
2216 |
+
this.opcode('pushLiteral', number.value);
|
2217 |
+
},
|
2218 |
+
|
2219 |
+
BooleanLiteral: function(bool) {
|
2220 |
+
this.opcode('pushLiteral', bool.value);
|
2221 |
+
},
|
2222 |
+
|
2223 |
+
Hash: function(hash) {
|
2224 |
+
var pairs = hash.pairs, i, l;
|
2225 |
+
|
2226 |
+
this.opcode('pushHash');
|
2227 |
+
|
2228 |
+
for (i=0, l=pairs.length; i<l; i++) {
|
2229 |
+
this.pushParam(pairs[i].value);
|
2230 |
+
}
|
2231 |
+
while (i--) {
|
2232 |
+
this.opcode('assignToHash', pairs[i].key);
|
2233 |
+
}
|
2234 |
+
this.opcode('popHash');
|
2235 |
+
},
|
2236 |
+
|
2237 |
+
// HELPERS
|
2238 |
+
opcode: function(name) {
|
2239 |
+
this.opcodes.push({ opcode: name, args: slice.call(arguments, 1), loc: this.sourceNode[0].loc });
|
2240 |
+
},
|
2241 |
+
|
2242 |
+
addDepth: function(depth) {
|
2243 |
+
if (!depth) {
|
2244 |
+
return;
|
2245 |
+
}
|
2246 |
+
|
2247 |
+
this.useDepths = true;
|
2248 |
+
},
|
2249 |
+
|
2250 |
+
classifySexpr: function(sexpr) {
|
2251 |
+
var isSimple = AST.helpers.simpleId(sexpr.path);
|
2252 |
+
|
2253 |
+
var isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]);
|
2254 |
+
|
2255 |
+
// a mustache is an eligible helper if:
|
2256 |
+
// * its id is simple (a single part, not `this` or `..`)
|
2257 |
+
var isHelper = !isBlockParam && AST.helpers.helperExpression(sexpr);
|
2258 |
+
|
2259 |
+
// if a mustache is an eligible helper but not a definite
|
2260 |
+
// helper, it is ambiguous, and will be resolved in a later
|
2261 |
+
// pass or at runtime.
|
2262 |
+
var isEligible = !isBlockParam && (isHelper || isSimple);
|
2263 |
+
|
2264 |
+
var options = this.options;
|
2265 |
+
|
2266 |
+
// if ambiguous, we can possibly resolve the ambiguity now
|
2267 |
+
// An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc.
|
2268 |
+
if (isEligible && !isHelper) {
|
2269 |
+
var name = sexpr.path.parts[0];
|
2270 |
+
|
2271 |
+
if (options.knownHelpers[name]) {
|
2272 |
+
isHelper = true;
|
2273 |
+
} else if (options.knownHelpersOnly) {
|
2274 |
+
isEligible = false;
|
2275 |
+
}
|
2276 |
+
}
|
2277 |
+
|
2278 |
+
if (isHelper) { return 'helper'; }
|
2279 |
+
else if (isEligible) { return 'ambiguous'; }
|
2280 |
+
else { return 'simple'; }
|
2281 |
+
},
|
2282 |
+
|
2283 |
+
pushParams: function(params) {
|
2284 |
+
for(var i=0, l=params.length; i<l; i++) {
|
2285 |
+
this.pushParam(params[i]);
|
2286 |
+
}
|
2287 |
+
},
|
2288 |
+
|
2289 |
+
pushParam: function(val) {
|
2290 |
+
var value = val.value != null ? val.value : val.original || '';
|
2291 |
+
|
2292 |
+
if (this.stringParams) {
|
2293 |
+
if (value.replace) {
|
2294 |
+
value = value
|
2295 |
+
.replace(/^(\.?\.\/)*/g, '')
|
2296 |
+
.replace(/\//g, '.');
|
2297 |
+
}
|
2298 |
+
|
2299 |
+
if(val.depth) {
|
2300 |
+
this.addDepth(val.depth);
|
2301 |
+
}
|
2302 |
+
this.opcode('getContext', val.depth || 0);
|
2303 |
+
this.opcode('pushStringParam', value, val.type);
|
2304 |
+
|
2305 |
+
if (val.type === 'SubExpression') {
|
2306 |
+
// SubExpressions get evaluated and passed in
|
2307 |
+
// in string params mode.
|
2308 |
+
this.accept(val);
|
2309 |
+
}
|
2310 |
+
} else {
|
2311 |
+
if (this.trackIds) {
|
2312 |
+
var blockParamIndex;
|
2313 |
+
if (val.parts && !AST.helpers.scopedId(val) && !val.depth) {
|
2314 |
+
blockParamIndex = this.blockParamIndex(val.parts[0]);
|
2315 |
+
}
|
2316 |
+
if (blockParamIndex) {
|
2317 |
+
var blockParamChild = val.parts.slice(1).join('.');
|
2318 |
+
this.opcode('pushId', 'BlockParam', blockParamIndex, blockParamChild);
|
2319 |
+
} else {
|
2320 |
+
value = val.original || value;
|
2321 |
+
if (value.replace) {
|
2322 |
+
value = value
|
2323 |
+
.replace(/^\.\//g, '')
|
2324 |
+
.replace(/^\.$/g, '');
|
2325 |
+
}
|
2326 |
+
|
2327 |
+
this.opcode('pushId', val.type, value);
|
2328 |
+
}
|
2329 |
+
}
|
2330 |
+
this.accept(val);
|
2331 |
+
}
|
2332 |
+
},
|
2333 |
+
|
2334 |
+
setupFullMustacheParams: function(sexpr, program, inverse, omitEmpty) {
|
2335 |
+
var params = sexpr.params;
|
2336 |
+
this.pushParams(params);
|
2337 |
+
|
2338 |
+
this.opcode('pushProgram', program);
|
2339 |
+
this.opcode('pushProgram', inverse);
|
2340 |
+
|
2341 |
+
if (sexpr.hash) {
|
2342 |
+
this.accept(sexpr.hash);
|
2343 |
+
} else {
|
2344 |
+
this.opcode('emptyHash', omitEmpty);
|
2345 |
+
}
|
2346 |
+
|
2347 |
+
return params;
|
2348 |
+
},
|
2349 |
+
|
2350 |
+
blockParamIndex: function(name) {
|
2351 |
+
for (var depth = 0, len = this.options.blockParams.length; depth < len; depth++) {
|
2352 |
+
var blockParams = this.options.blockParams[depth],
|
2353 |
+
param = blockParams && indexOf(blockParams, name);
|
2354 |
+
if (blockParams && param >= 0) {
|
2355 |
+
return [depth, param];
|
2356 |
+
}
|
2357 |
+
}
|
2358 |
+
}
|
2359 |
+
};
|
2360 |
+
|
2361 |
+
function precompile(input, options, env) {
|
2362 |
+
if (input == null || (typeof input !== 'string' && input.type !== 'Program')) {
|
2363 |
+
throw new Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed " + input);
|
2364 |
+
}
|
2365 |
+
|
2366 |
+
options = options || {};
|
2367 |
+
if (!('data' in options)) {
|
2368 |
+
options.data = true;
|
2369 |
+
}
|
2370 |
+
if (options.compat) {
|
2371 |
+
options.useDepths = true;
|
2372 |
+
}
|
2373 |
+
|
2374 |
+
var ast = env.parse(input, options);
|
2375 |
+
var environment = new env.Compiler().compile(ast, options);
|
2376 |
+
return new env.JavaScriptCompiler().compile(environment, options);
|
2377 |
+
}
|
2378 |
+
|
2379 |
+
__exports__.precompile = precompile;function compile(input, options, env) {
|
2380 |
+
if (input == null || (typeof input !== 'string' && input.type !== 'Program')) {
|
2381 |
+
throw new Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed " + input);
|
2382 |
+
}
|
2383 |
+
|
2384 |
+
options = options || {};
|
2385 |
+
|
2386 |
+
if (!('data' in options)) {
|
2387 |
+
options.data = true;
|
2388 |
+
}
|
2389 |
+
if (options.compat) {
|
2390 |
+
options.useDepths = true;
|
2391 |
+
}
|
2392 |
+
|
2393 |
+
var compiled;
|
2394 |
+
|
2395 |
+
function compileInput() {
|
2396 |
+
var ast = env.parse(input, options);
|
2397 |
+
var environment = new env.Compiler().compile(ast, options);
|
2398 |
+
var templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true);
|
2399 |
+
return env.template(templateSpec);
|
2400 |
+
}
|
2401 |
+
|
2402 |
+
// Template is only compiled on first use and cached after that point.
|
2403 |
+
var ret = function(context, options) {
|
2404 |
+
if (!compiled) {
|
2405 |
+
compiled = compileInput();
|
2406 |
+
}
|
2407 |
+
return compiled.call(this, context, options);
|
2408 |
+
};
|
2409 |
+
ret._setup = function(options) {
|
2410 |
+
if (!compiled) {
|
2411 |
+
compiled = compileInput();
|
2412 |
+
}
|
2413 |
+
return compiled._setup(options);
|
2414 |
+
};
|
2415 |
+
ret._child = function(i, data, blockParams, depths) {
|
2416 |
+
if (!compiled) {
|
2417 |
+
compiled = compileInput();
|
2418 |
+
}
|
2419 |
+
return compiled._child(i, data, blockParams, depths);
|
2420 |
+
};
|
2421 |
+
return ret;
|
2422 |
+
}
|
2423 |
+
|
2424 |
+
__exports__.compile = compile;function argEquals(a, b) {
|
2425 |
+
if (a === b) {
|
2426 |
+
return true;
|
2427 |
+
}
|
2428 |
+
|
2429 |
+
if (isArray(a) && isArray(b) && a.length === b.length) {
|
2430 |
+
for (var i = 0; i < a.length; i++) {
|
2431 |
+
if (!argEquals(a[i], b[i])) {
|
2432 |
+
return false;
|
2433 |
+
}
|
2434 |
+
}
|
2435 |
+
return true;
|
2436 |
+
}
|
2437 |
+
}
|
2438 |
+
|
2439 |
+
function transformLiteralToPath(sexpr) {
|
2440 |
+
if (!sexpr.path.parts) {
|
2441 |
+
var literal = sexpr.path;
|
2442 |
+
// Casting to string here to make false and 0 literal values play nicely with the rest
|
2443 |
+
// of the system.
|
2444 |
+
sexpr.path = new AST.PathExpression(false, 0, [literal.original+''], literal.original+'', literal.log);
|
2445 |
+
}
|
2446 |
+
}
|
2447 |
+
return __exports__;
|
2448 |
+
})(__module4__, __module3__, __module7__);
|
2449 |
+
|
2450 |
+
// handlebars/compiler/code-gen.js
|
2451 |
+
var __module15__ = (function(__dependency1__) {
|
2452 |
+
"use strict";
|
2453 |
+
var __exports__;
|
2454 |
+
var isArray = __dependency1__.isArray;
|
2455 |
+
|
2456 |
+
try {
|
2457 |
+
var SourceMap = require('source-map'),
|
2458 |
+
SourceNode = SourceMap.SourceNode;
|
2459 |
+
} catch (err) {
|
2460 |
+
/* istanbul ignore next: tested but not covered in istanbul due to dist build */
|
2461 |
+
SourceNode = function(line, column, srcFile, chunks) {
|
2462 |
+
this.src = '';
|
2463 |
+
if (chunks) {
|
2464 |
+
this.add(chunks);
|
2465 |
+
}
|
2466 |
+
};
|
2467 |
+
/* istanbul ignore next */
|
2468 |
+
SourceNode.prototype = {
|
2469 |
+
add: function(chunks) {
|
2470 |
+
if (isArray(chunks)) {
|
2471 |
+
chunks = chunks.join('');
|
2472 |
+
}
|
2473 |
+
this.src += chunks;
|
2474 |
+
},
|
2475 |
+
prepend: function(chunks) {
|
2476 |
+
if (isArray(chunks)) {
|
2477 |
+
chunks = chunks.join('');
|
2478 |
+
}
|
2479 |
+
this.src = chunks + this.src;
|
2480 |
+
},
|
2481 |
+
toStringWithSourceMap: function() {
|
2482 |
+
return {code: this.toString()};
|
2483 |
+
},
|
2484 |
+
toString: function() {
|
2485 |
+
return this.src;
|
2486 |
+
}
|
2487 |
+
};
|
2488 |
+
}
|
2489 |
+
|
2490 |
+
|
2491 |
+
function castChunk(chunk, codeGen, loc) {
|
2492 |
+
if (isArray(chunk)) {
|
2493 |
+
var ret = [];
|
2494 |
+
|
2495 |
+
for (var i = 0, len = chunk.length; i < len; i++) {
|
2496 |
+
ret.push(codeGen.wrap(chunk[i], loc));
|
2497 |
+
}
|
2498 |
+
return ret;
|
2499 |
+
} else if (typeof chunk === 'boolean' || typeof chunk === 'number') {
|
2500 |
+
// Handle primitives that the SourceNode will throw up on
|
2501 |
+
return chunk+'';
|
2502 |
+
}
|
2503 |
+
return chunk;
|
2504 |
+
}
|
2505 |
+
|
2506 |
+
|
2507 |
+
function CodeGen(srcFile) {
|
2508 |
+
this.srcFile = srcFile;
|
2509 |
+
this.source = [];
|
2510 |
+
}
|
2511 |
+
|
2512 |
+
CodeGen.prototype = {
|
2513 |
+
prepend: function(source, loc) {
|
2514 |
+
this.source.unshift(this.wrap(source, loc));
|
2515 |
+
},
|
2516 |
+
push: function(source, loc) {
|
2517 |
+
this.source.push(this.wrap(source, loc));
|
2518 |
+
},
|
2519 |
+
|
2520 |
+
merge: function() {
|
2521 |
+
var source = this.empty();
|
2522 |
+
this.each(function(line) {
|
2523 |
+
source.add([' ', line, '\n']);
|
2524 |
+
});
|
2525 |
+
return source;
|
2526 |
+
},
|
2527 |
+
|
2528 |
+
each: function(iter) {
|
2529 |
+
for (var i = 0, len = this.source.length; i < len; i++) {
|
2530 |
+
iter(this.source[i]);
|
2531 |
+
}
|
2532 |
+
},
|
2533 |
+
|
2534 |
+
empty: function(loc) {
|
2535 |
+
loc = loc || this.currentLocation || {start:{}};
|
2536 |
+
return new SourceNode(loc.start.line, loc.start.column, this.srcFile);
|
2537 |
+
},
|
2538 |
+
wrap: function(chunk, loc) {
|
2539 |
+
if (chunk instanceof SourceNode) {
|
2540 |
+
return chunk;
|
2541 |
+
}
|
2542 |
+
|
2543 |
+
loc = loc || this.currentLocation || {start:{}};
|
2544 |
+
chunk = castChunk(chunk, this, loc);
|
2545 |
+
|
2546 |
+
return new SourceNode(loc.start.line, loc.start.column, this.srcFile, chunk);
|
2547 |
+
},
|
2548 |
+
|
2549 |
+
functionCall: function(fn, type, params) {
|
2550 |
+
params = this.generateList(params);
|
2551 |
+
return this.wrap([fn, type ? '.' + type + '(' : '(', params, ')']);
|
2552 |
+
},
|
2553 |
+
|
2554 |
+
quotedString: function(str) {
|
2555 |
+
return '"' + (str + '')
|
2556 |
+
.replace(/\\/g, '\\\\')
|
2557 |
+
.replace(/"/g, '\\"')
|
2558 |
+
.replace(/\n/g, '\\n')
|
2559 |
+
.replace(/\r/g, '\\r')
|
2560 |
+
.replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4
|
2561 |
+
.replace(/\u2029/g, '\\u2029') + '"';
|
2562 |
+
},
|
2563 |
+
|
2564 |
+
objectLiteral: function(obj) {
|
2565 |
+
var pairs = [];
|
2566 |
+
|
2567 |
+
for (var key in obj) {
|
2568 |
+
if (obj.hasOwnProperty(key)) {
|
2569 |
+
var value = castChunk(obj[key], this);
|
2570 |
+
if (value !== 'undefined') {
|
2571 |
+
pairs.push([this.quotedString(key), ':', value]);
|
2572 |
+
}
|
2573 |
+
}
|
2574 |
+
}
|
2575 |
+
|
2576 |
+
var ret = this.generateList(pairs);
|
2577 |
+
ret.prepend('{');
|
2578 |
+
ret.add('}');
|
2579 |
+
return ret;
|
2580 |
+
},
|
2581 |
+
|
2582 |
+
|
2583 |
+
generateList: function(entries, loc) {
|
2584 |
+
var ret = this.empty(loc);
|
2585 |
+
|
2586 |
+
for (var i = 0, len = entries.length; i < len; i++) {
|
2587 |
+
if (i) {
|
2588 |
+
ret.add(',');
|
2589 |
+
}
|
2590 |
+
|
2591 |
+
ret.add(castChunk(entries[i], this, loc));
|
2592 |
+
}
|
2593 |
+
|
2594 |
+
return ret;
|
2595 |
+
},
|
2596 |
+
|
2597 |
+
generateArray: function(entries, loc) {
|
2598 |
+
var ret = this.generateList(entries, loc);
|
2599 |
+
ret.prepend('[');
|
2600 |
+
ret.add(']');
|
2601 |
+
|
2602 |
+
return ret;
|
2603 |
+
}
|
2604 |
+
};
|
2605 |
+
|
2606 |
+
__exports__ = CodeGen;
|
2607 |
+
return __exports__;
|
2608 |
+
})(__module3__);
|
2609 |
+
|
2610 |
+
// handlebars/compiler/javascript-compiler.js
|
2611 |
+
var __module14__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__) {
|
2612 |
+
"use strict";
|
2613 |
+
var __exports__;
|
2614 |
+
var COMPILER_REVISION = __dependency1__.COMPILER_REVISION;
|
2615 |
+
var REVISION_CHANGES = __dependency1__.REVISION_CHANGES;
|
2616 |
+
var Exception = __dependency2__;
|
2617 |
+
var isArray = __dependency3__.isArray;
|
2618 |
+
var CodeGen = __dependency4__;
|
2619 |
+
|
2620 |
+
function Literal(value) {
|
2621 |
+
this.value = value;
|
2622 |
+
}
|
2623 |
+
|
2624 |
+
function JavaScriptCompiler() {}
|
2625 |
+
|
2626 |
+
JavaScriptCompiler.prototype = {
|
2627 |
+
// PUBLIC API: You can override these methods in a subclass to provide
|
2628 |
+
// alternative compiled forms for name lookup and buffering semantics
|
2629 |
+
nameLookup: function(parent, name /* , type*/) {
|
2630 |
+
if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) {
|
2631 |
+
return [parent, ".", name];
|
2632 |
+
} else {
|
2633 |
+
return [parent, "['", name, "']"];
|
2634 |
+
}
|
2635 |
+
},
|
2636 |
+
depthedLookup: function(name) {
|
2637 |
+
return [this.aliasable('this.lookup'), '(depths, "', name, '")'];
|
2638 |
+
},
|
2639 |
+
|
2640 |
+
compilerInfo: function() {
|
2641 |
+
var revision = COMPILER_REVISION,
|
2642 |
+
versions = REVISION_CHANGES[revision];
|
2643 |
+
return [revision, versions];
|
2644 |
+
},
|
2645 |
+
|
2646 |
+
appendToBuffer: function(source, location, explicit) {
|
2647 |
+
// Force a source as this simplifies the merge logic.
|
2648 |
+
if (!isArray(source)) {
|
2649 |
+
source = [source];
|
2650 |
+
}
|
2651 |
+
source = this.source.wrap(source, location);
|
2652 |
+
|
2653 |
+
if (this.environment.isSimple) {
|
2654 |
+
return ['return ', source, ';'];
|
2655 |
+
} else if (explicit) {
|
2656 |
+
// This is a case where the buffer operation occurs as a child of another
|
2657 |
+
// construct, generally braces. We have to explicitly output these buffer
|
2658 |
+
// operations to ensure that the emitted code goes in the correct location.
|
2659 |
+
return ['buffer += ', source, ';'];
|
2660 |
+
} else {
|
2661 |
+
source.appendToBuffer = true;
|
2662 |
+
return source;
|
2663 |
+
}
|
2664 |
+
},
|
2665 |
+
|
2666 |
+
initializeBuffer: function() {
|
2667 |
+
return this.quotedString("");
|
2668 |
+
},
|
2669 |
+
// END PUBLIC API
|
2670 |
+
|
2671 |
+
compile: function(environment, options, context, asObject) {
|
2672 |
+
this.environment = environment;
|
2673 |
+
this.options = options;
|
2674 |
+
this.stringParams = this.options.stringParams;
|
2675 |
+
this.trackIds = this.options.trackIds;
|
2676 |
+
this.precompile = !asObject;
|
2677 |
+
|
2678 |
+
this.name = this.environment.name;
|
2679 |
+
this.isChild = !!context;
|
2680 |
+
this.context = context || {
|
2681 |
+
programs: [],
|
2682 |
+
environments: []
|
2683 |
+
};
|
2684 |
+
|
2685 |
+
this.preamble();
|
2686 |
+
|
2687 |
+
this.stackSlot = 0;
|
2688 |
+
this.stackVars = [];
|
2689 |
+
this.aliases = {};
|
2690 |
+
this.registers = { list: [] };
|
2691 |
+
this.hashes = [];
|
2692 |
+
this.compileStack = [];
|
2693 |
+
this.inlineStack = [];
|
2694 |
+
this.blockParams = [];
|
2695 |
+
|
2696 |
+
this.compileChildren(environment, options);
|
2697 |
+
|
2698 |
+
this.useDepths = this.useDepths || environment.useDepths || this.options.compat;
|
2699 |
+
this.useBlockParams = this.useBlockParams || environment.useBlockParams;
|
2700 |
+
|
2701 |
+
var opcodes = environment.opcodes,
|
2702 |
+
opcode,
|
2703 |
+
firstLoc,
|
2704 |
+
i,
|
2705 |
+
l;
|
2706 |
+
|
2707 |
+
for (i = 0, l = opcodes.length; i < l; i++) {
|
2708 |
+
opcode = opcodes[i];
|
2709 |
+
|
2710 |
+
this.source.currentLocation = opcode.loc;
|
2711 |
+
firstLoc = firstLoc || opcode.loc;
|
2712 |
+
this[opcode.opcode].apply(this, opcode.args);
|
2713 |
+
}
|
2714 |
+
|
2715 |
+
// Flush any trailing content that might be pending.
|
2716 |
+
this.source.currentLocation = firstLoc;
|
2717 |
+
this.pushSource('');
|
2718 |
+
|
2719 |
+
/* istanbul ignore next */
|
2720 |
+
if (this.stackSlot || this.inlineStack.length || this.compileStack.length) {
|
2721 |
+
throw new Exception('Compile completed with content left on stack');
|
2722 |
+
}
|
2723 |
+
|
2724 |
+
var fn = this.createFunctionContext(asObject);
|
2725 |
+
if (!this.isChild) {
|
2726 |
+
var ret = {
|
2727 |
+
compiler: this.compilerInfo(),
|
2728 |
+
main: fn
|
2729 |
+
};
|
2730 |
+
var programs = this.context.programs;
|
2731 |
+
for (i = 0, l = programs.length; i < l; i++) {
|
2732 |
+
if (programs[i]) {
|
2733 |
+
ret[i] = programs[i];
|
2734 |
+
}
|
2735 |
+
}
|
2736 |
+
|
2737 |
+
if (this.environment.usePartial) {
|
2738 |
+
ret.usePartial = true;
|
2739 |
+
}
|
2740 |
+
if (this.options.data) {
|
2741 |
+
ret.useData = true;
|
2742 |
+
}
|
2743 |
+
if (this.useDepths) {
|
2744 |
+
ret.useDepths = true;
|
2745 |
+
}
|
2746 |
+
if (this.useBlockParams) {
|
2747 |
+
ret.useBlockParams = true;
|
2748 |
+
}
|
2749 |
+
if (this.options.compat) {
|
2750 |
+
ret.compat = true;
|
2751 |
+
}
|
2752 |
+
|
2753 |
+
if (!asObject) {
|
2754 |
+
ret.compiler = JSON.stringify(ret.compiler);
|
2755 |
+
|
2756 |
+
this.source.currentLocation = {start: {line: 1, column: 0}};
|
2757 |
+
ret = this.objectLiteral(ret);
|
2758 |
+
|
2759 |
+
if (options.srcName) {
|
2760 |
+
ret = ret.toStringWithSourceMap({file: options.destName});
|
2761 |
+
ret.map = ret.map && ret.map.toString();
|
2762 |
+
} else {
|
2763 |
+
ret = ret.toString();
|
2764 |
+
}
|
2765 |
+
} else {
|
2766 |
+
ret.compilerOptions = this.options;
|
2767 |
+
}
|
2768 |
+
|
2769 |
+
return ret;
|
2770 |
+
} else {
|
2771 |
+
return fn;
|
2772 |
+
}
|
2773 |
+
},
|
2774 |
+
|
2775 |
+
preamble: function() {
|
2776 |
+
// track the last context pushed into place to allow skipping the
|
2777 |
+
// getContext opcode when it would be a noop
|
2778 |
+
this.lastContext = 0;
|
2779 |
+
this.source = new CodeGen(this.options.srcName);
|
2780 |
+
},
|
2781 |
+
|
2782 |
+
createFunctionContext: function(asObject) {
|
2783 |
+
var varDeclarations = '';
|
2784 |
+
|
2785 |
+
var locals = this.stackVars.concat(this.registers.list);
|
2786 |
+
if(locals.length > 0) {
|
2787 |
+
varDeclarations += ", " + locals.join(", ");
|
2788 |
+
}
|
2789 |
+
|
2790 |
+
// Generate minimizer alias mappings
|
2791 |
+
//
|
2792 |
+
// When using true SourceNodes, this will update all references to the given alias
|
2793 |
+
// as the source nodes are reused in situ. For the non-source node compilation mode,
|
2794 |
+
// aliases will not be used, but this case is already being run on the client and
|
2795 |
+
// we aren't concern about minimizing the template size.
|
2796 |
+
var aliasCount = 0;
|
2797 |
+
for (var alias in this.aliases) {
|
2798 |
+
var node = this.aliases[alias];
|
2799 |
+
|
2800 |
+
if (this.aliases.hasOwnProperty(alias) && node.children && node.referenceCount > 1) {
|
2801 |
+
varDeclarations += ', alias' + (++aliasCount) + '=' + alias;
|
2802 |
+
node.children[0] = 'alias' + aliasCount;
|
2803 |
+
}
|
2804 |
+
}
|
2805 |
+
|
2806 |
+
var params = ["depth0", "helpers", "partials", "data"];
|
2807 |
+
|
2808 |
+
if (this.useBlockParams || this.useDepths) {
|
2809 |
+
params.push('blockParams');
|
2810 |
+
}
|
2811 |
+
if (this.useDepths) {
|
2812 |
+
params.push('depths');
|
2813 |
+
}
|
2814 |
+
|
2815 |
+
// Perform a second pass over the output to merge content when possible
|
2816 |
+
var source = this.mergeSource(varDeclarations);
|
2817 |
+
|
2818 |
+
if (asObject) {
|
2819 |
+
params.push(source);
|
2820 |
+
|
2821 |
+
return Function.apply(this, params);
|
2822 |
+
} else {
|
2823 |
+
return this.source.wrap(['function(', params.join(','), ') {\n ', source, '}']);
|
2824 |
+
}
|
2825 |
+
},
|
2826 |
+
mergeSource: function(varDeclarations) {
|
2827 |
+
var isSimple = this.environment.isSimple,
|
2828 |
+
appendOnly = !this.forceBuffer,
|
2829 |
+
appendFirst,
|
2830 |
+
|
2831 |
+
sourceSeen,
|
2832 |
+
bufferStart,
|
2833 |
+
bufferEnd;
|
2834 |
+
this.source.each(function(line) {
|
2835 |
+
if (line.appendToBuffer) {
|
2836 |
+
if (bufferStart) {
|
2837 |
+
line.prepend(' + ');
|
2838 |
+
} else {
|
2839 |
+
bufferStart = line;
|
2840 |
+
}
|
2841 |
+
bufferEnd = line;
|
2842 |
+
} else {
|
2843 |
+
if (bufferStart) {
|
2844 |
+
if (!sourceSeen) {
|
2845 |
+
appendFirst = true;
|
2846 |
+
} else {
|
2847 |
+
bufferStart.prepend('buffer += ');
|
2848 |
+
}
|
2849 |
+
bufferEnd.add(';');
|
2850 |
+
bufferStart = bufferEnd = undefined;
|
2851 |
+
}
|
2852 |
+
|
2853 |
+
sourceSeen = true;
|
2854 |
+
if (!isSimple) {
|
2855 |
+
appendOnly = false;
|
2856 |
+
}
|
2857 |
+
}
|
2858 |
+
});
|
2859 |
+
|
2860 |
+
|
2861 |
+
if (appendOnly) {
|
2862 |
+
if (bufferStart) {
|
2863 |
+
bufferStart.prepend('return ');
|
2864 |
+
bufferEnd.add(';');
|
2865 |
+
} else if (!sourceSeen) {
|
2866 |
+
this.source.push('return "";');
|
2867 |
+
}
|
2868 |
+
} else {
|
2869 |
+
varDeclarations += ", buffer = " + (appendFirst ? '' : this.initializeBuffer());
|
2870 |
+
|
2871 |
+
if (bufferStart) {
|
2872 |
+
bufferStart.prepend('return buffer + ');
|
2873 |
+
bufferEnd.add(';');
|
2874 |
+
} else {
|
2875 |
+
this.source.push('return buffer;');
|
2876 |
+
}
|
2877 |
+
}
|
2878 |
+
|
2879 |
+
if (varDeclarations) {
|
2880 |
+
this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n'));
|
2881 |
+
}
|
2882 |
+
|
2883 |
+
return this.source.merge();
|
2884 |
+
},
|
2885 |
+
|
2886 |
+
// [blockValue]
|
2887 |
+
//
|
2888 |
+
// On stack, before: hash, inverse, program, value
|
2889 |
+
// On stack, after: return value of blockHelperMissing
|
2890 |
+
//
|
2891 |
+
// The purpose of this opcode is to take a block of the form
|
2892 |
+
// `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and
|
2893 |
+
// replace it on the stack with the result of properly
|
2894 |
+
// invoking blockHelperMissing.
|
2895 |
+
blockValue: function(name) {
|
2896 |
+
var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'),
|
2897 |
+
params = [this.contextName(0)];
|
2898 |
+
this.setupHelperArgs(name, 0, params);
|
2899 |
+
|
2900 |
+
var blockName = this.popStack();
|
2901 |
+
params.splice(1, 0, blockName);
|
2902 |
+
|
2903 |
+
this.push(this.source.functionCall(blockHelperMissing, 'call', params));
|
2904 |
+
},
|
2905 |
+
|
2906 |
+
// [ambiguousBlockValue]
|
2907 |
+
//
|
2908 |
+
// On stack, before: hash, inverse, program, value
|
2909 |
+
// Compiler value, before: lastHelper=value of last found helper, if any
|
2910 |
+
// On stack, after, if no lastHelper: same as [blockValue]
|
2911 |
+
// On stack, after, if lastHelper: value
|
2912 |
+
ambiguousBlockValue: function() {
|
2913 |
+
// We're being a bit cheeky and reusing the options value from the prior exec
|
2914 |
+
var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'),
|
2915 |
+
params = [this.contextName(0)];
|
2916 |
+
this.setupHelperArgs('', 0, params, true);
|
2917 |
+
|
2918 |
+
this.flushInline();
|
2919 |
+
|
2920 |
+
var current = this.topStack();
|
2921 |
+
params.splice(1, 0, current);
|
2922 |
+
|
2923 |
+
this.pushSource([
|
2924 |
+
'if (!', this.lastHelper, ') { ',
|
2925 |
+
current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params),
|
2926 |
+
'}']);
|
2927 |
+
},
|
2928 |
+
|
2929 |
+
// [appendContent]
|
2930 |
+
//
|
2931 |
+
// On stack, before: ...
|
2932 |
+
// On stack, after: ...
|
2933 |
+
//
|
2934 |
+
// Appends the string value of `content` to the current buffer
|
2935 |
+
appendContent: function(content) {
|
2936 |
+
if (this.pendingContent) {
|
2937 |
+
content = this.pendingContent + content;
|
2938 |
+
} else {
|
2939 |
+
this.pendingLocation = this.source.currentLocation;
|
2940 |
+
}
|
2941 |
+
|
2942 |
+
this.pendingContent = content;
|
2943 |
+
},
|
2944 |
+
|
2945 |
+
// [append]
|
2946 |
+
//
|
2947 |
+
// On stack, before: value, ...
|
2948 |
+
// On stack, after: ...
|
2949 |
+
//
|
2950 |
+
// Coerces `value` to a String and appends it to the current buffer.
|
2951 |
+
//
|
2952 |
+
// If `value` is truthy, or 0, it is coerced into a string and appended
|
2953 |
+
// Otherwise, the empty string is appended
|
2954 |
+
append: function() {
|
2955 |
+
if (this.isInline()) {
|
2956 |
+
this.replaceStack(function(current) {
|
2957 |
+
return [' != null ? ', current, ' : ""'];
|
2958 |
+
});
|
2959 |
+
|
2960 |
+
this.pushSource(this.appendToBuffer(this.popStack()));
|
2961 |
+
} else {
|
2962 |
+
var local = this.popStack();
|
2963 |
+
this.pushSource(['if (', local, ' != null) { ', this.appendToBuffer(local, undefined, true), ' }']);
|
2964 |
+
if (this.environment.isSimple) {
|
2965 |
+
this.pushSource(['else { ', this.appendToBuffer("''", undefined, true), ' }']);
|
2966 |
+
}
|
2967 |
+
}
|
2968 |
+
},
|
2969 |
+
|
2970 |
+
// [appendEscaped]
|
2971 |
+
//
|
2972 |
+
// On stack, before: value, ...
|
2973 |
+
// On stack, after: ...
|
2974 |
+
//
|
2975 |
+
// Escape `value` and append it to the buffer
|
2976 |
+
appendEscaped: function() {
|
2977 |
+
this.pushSource(this.appendToBuffer(
|
2978 |
+
[this.aliasable('this.escapeExpression'), '(', this.popStack(), ')']));
|
2979 |
+
},
|
2980 |
+
|
2981 |
+
// [getContext]
|
2982 |
+
//
|
2983 |
+
// On stack, before: ...
|
2984 |
+
// On stack, after: ...
|
2985 |
+
// Compiler value, after: lastContext=depth
|
2986 |
+
//
|
2987 |
+
// Set the value of the `lastContext` compiler value to the depth
|
2988 |
+
getContext: function(depth) {
|
2989 |
+
this.lastContext = depth;
|
2990 |
+
},
|
2991 |
+
|
2992 |
+
// [pushContext]
|
2993 |
+
//
|
2994 |
+
// On stack, before: ...
|
2995 |
+
// On stack, after: currentContext, ...
|
2996 |
+
//
|
2997 |
+
// Pushes the value of the current context onto the stack.
|
2998 |
+
pushContext: function() {
|
2999 |
+
this.pushStackLiteral(this.contextName(this.lastContext));
|
3000 |
+
},
|
3001 |
+
|
3002 |
+
// [lookupOnContext]
|
3003 |
+
//
|
3004 |
+
// On stack, before: ...
|
3005 |
+
// On stack, after: currentContext[name], ...
|
3006 |
+
//
|
3007 |
+
// Looks up the value of `name` on the current context and pushes
|
3008 |
+
// it onto the stack.
|
3009 |
+
lookupOnContext: function(parts, falsy, scoped) {
|
3010 |
+
var i = 0;
|
3011 |
+
|
3012 |
+
if (!scoped && this.options.compat && !this.lastContext) {
|
3013 |
+
// The depthed query is expected to handle the undefined logic for the root level that
|
3014 |
+
// is implemented below, so we evaluate that directly in compat mode
|
3015 |
+
this.push(this.depthedLookup(parts[i++]));
|
3016 |
+
} else {
|
3017 |
+
this.pushContext();
|
3018 |
+
}
|
3019 |
+
|
3020 |
+
this.resolvePath('context', parts, i, falsy);
|
3021 |
+
},
|
3022 |
+
|
3023 |
+
// [lookupBlockParam]
|
3024 |
+
//
|
3025 |
+
// On stack, before: ...
|
3026 |
+
// On stack, after: blockParam[name], ...
|
3027 |
+
//
|
3028 |
+
// Looks up the value of `parts` on the given block param and pushes
|
3029 |
+
// it onto the stack.
|
3030 |
+
lookupBlockParam: function(blockParamId, parts) {
|
3031 |
+
this.useBlockParams = true;
|
3032 |
+
|
3033 |
+
this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']);
|
3034 |
+
this.resolvePath('context', parts, 1);
|
3035 |
+
},
|
3036 |
+
|
3037 |
+
// [lookupData]
|
3038 |
+
//
|
3039 |
+
// On stack, before: ...
|
3040 |
+
// On stack, after: data, ...
|
3041 |
+
//
|
3042 |
+
// Push the data lookup operator
|
3043 |
+
lookupData: function(depth, parts) {
|
3044 |
+
/*jshint -W083 */
|
3045 |
+
if (!depth) {
|
3046 |
+
this.pushStackLiteral('data');
|
3047 |
+
} else {
|
3048 |
+
this.pushStackLiteral('this.data(data, ' + depth + ')');
|
3049 |
+
}
|
3050 |
+
|
3051 |
+
this.resolvePath('data', parts, 0, true);
|
3052 |
+
},
|
3053 |
+
|
3054 |
+
resolvePath: function(type, parts, i, falsy) {
|
3055 |
+
/*jshint -W083 */
|
3056 |
+
if (this.options.strict || this.options.assumeObjects) {
|
3057 |
+
this.push(strictLookup(this.options.strict, this, parts, type));
|
3058 |
+
return;
|
3059 |
+
}
|
3060 |
+
|
3061 |
+
var len = parts.length;
|
3062 |
+
for (; i < len; i++) {
|
3063 |
+
this.replaceStack(function(current) {
|
3064 |
+
var lookup = this.nameLookup(current, parts[i], type);
|
3065 |
+
// We want to ensure that zero and false are handled properly if the context (falsy flag)
|
3066 |
+
// needs to have the special handling for these values.
|
3067 |
+
if (!falsy) {
|
3068 |
+
return [' != null ? ', lookup, ' : ', current];
|
3069 |
+
} else {
|
3070 |
+
// Otherwise we can use generic falsy handling
|
3071 |
+
return [' && ', lookup];
|
3072 |
+
}
|
3073 |
+
});
|
3074 |
+
}
|
3075 |
+
},
|
3076 |
+
|
3077 |
+
// [resolvePossibleLambda]
|
3078 |
+
//
|
3079 |
+
// On stack, before: value, ...
|
3080 |
+
// On stack, after: resolved value, ...
|
3081 |
+
//
|
3082 |
+
// If the `value` is a lambda, replace it on the stack by
|
3083 |
+
// the return value of the lambda
|
3084 |
+
resolvePossibleLambda: function() {
|
3085 |
+
this.push([this.aliasable('this.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']);
|
3086 |
+
},
|
3087 |
+
|
3088 |
+
// [pushStringParam]
|
3089 |
+
//
|
3090 |
+
// On stack, before: ...
|
3091 |
+
// On stack, after: string, currentContext, ...
|
3092 |
+
//
|
3093 |
+
// This opcode is designed for use in string mode, which
|
3094 |
+
// provides the string value of a parameter along with its
|
3095 |
+
// depth rather than resolving it immediately.
|
3096 |
+
pushStringParam: function(string, type) {
|
3097 |
+
this.pushContext();
|
3098 |
+
this.pushString(type);
|
3099 |
+
|
3100 |
+
// If it's a subexpression, the string result
|
3101 |
+
// will be pushed after this opcode.
|
3102 |
+
if (type !== 'SubExpression') {
|
3103 |
+
if (typeof string === 'string') {
|
3104 |
+
this.pushString(string);
|
3105 |
+
} else {
|
3106 |
+
this.pushStackLiteral(string);
|
3107 |
+
}
|
3108 |
+
}
|
3109 |
+
},
|
3110 |
+
|
3111 |
+
emptyHash: function(omitEmpty) {
|
3112 |
+
if (this.trackIds) {
|
3113 |
+
this.push('{}'); // hashIds
|
3114 |
+
}
|
3115 |
+
if (this.stringParams) {
|
3116 |
+
this.push('{}'); // hashContexts
|
3117 |
+
this.push('{}'); // hashTypes
|
3118 |
+
}
|
3119 |
+
this.pushStackLiteral(omitEmpty ? 'undefined' : '{}');
|
3120 |
+
},
|
3121 |
+
pushHash: function() {
|
3122 |
+
if (this.hash) {
|
3123 |
+
this.hashes.push(this.hash);
|
3124 |
+
}
|
3125 |
+
this.hash = {values: [], types: [], contexts: [], ids: []};
|
3126 |
+
},
|
3127 |
+
popHash: function() {
|
3128 |
+
var hash = this.hash;
|
3129 |
+
this.hash = this.hashes.pop();
|
3130 |
+
|
3131 |
+
if (this.trackIds) {
|
3132 |
+
this.push(this.objectLiteral(hash.ids));
|
3133 |
+
}
|
3134 |
+
if (this.stringParams) {
|
3135 |
+
this.push(this.objectLiteral(hash.contexts));
|
3136 |
+
this.push(this.objectLiteral(hash.types));
|
3137 |
+
}
|
3138 |
+
|
3139 |
+
this.push(this.objectLiteral(hash.values));
|
3140 |
+
},
|
3141 |
+
|
3142 |
+
// [pushString]
|
3143 |
+
//
|
3144 |
+
// On stack, before: ...
|
3145 |
+
// On stack, after: quotedString(string), ...
|
3146 |
+
//
|
3147 |
+
// Push a quoted version of `string` onto the stack
|
3148 |
+
pushString: function(string) {
|
3149 |
+
this.pushStackLiteral(this.quotedString(string));
|
3150 |
+
},
|
3151 |
+
|
3152 |
+
// [pushLiteral]
|
3153 |
+
//
|
3154 |
+
// On stack, before: ...
|
3155 |
+
// On stack, after: value, ...
|
3156 |
+
//
|
3157 |
+
// Pushes a value onto the stack. This operation prevents
|
3158 |
+
// the compiler from creating a temporary variable to hold
|
3159 |
+
// it.
|
3160 |
+
pushLiteral: function(value) {
|
3161 |
+
this.pushStackLiteral(value);
|
3162 |
+
},
|
3163 |
+
|
3164 |
+
// [pushProgram]
|
3165 |
+
//
|
3166 |
+
// On stack, before: ...
|
3167 |
+
// On stack, after: program(guid), ...
|
3168 |
+
//
|
3169 |
+
// Push a program expression onto the stack. This takes
|
3170 |
+
// a compile-time guid and converts it into a runtime-accessible
|
3171 |
+
// expression.
|
3172 |
+
pushProgram: function(guid) {
|
3173 |
+
if (guid != null) {
|
3174 |
+
this.pushStackLiteral(this.programExpression(guid));
|
3175 |
+
} else {
|
3176 |
+
this.pushStackLiteral(null);
|
3177 |
+
}
|
3178 |
+
},
|
3179 |
+
|
3180 |
+
// [invokeHelper]
|
3181 |
+
//
|
3182 |
+
// On stack, before: hash, inverse, program, params..., ...
|
3183 |
+
// On stack, after: result of helper invocation
|
3184 |
+
//
|
3185 |
+
// Pops off the helper's parameters, invokes the helper,
|
3186 |
+
// and pushes the helper's return value onto the stack.
|
3187 |
+
//
|
3188 |
+
// If the helper is not found, `helperMissing` is called.
|
3189 |
+
invokeHelper: function(paramSize, name, isSimple) {
|
3190 |
+
var nonHelper = this.popStack();
|
3191 |
+
var helper = this.setupHelper(paramSize, name);
|
3192 |
+
var simple = isSimple ? [helper.name, ' || '] : '';
|
3193 |
+
|
3194 |
+
var lookup = ['('].concat(simple, nonHelper);
|
3195 |
+
if (!this.options.strict) {
|
3196 |
+
lookup.push(' || ', this.aliasable('helpers.helperMissing'));
|
3197 |
+
}
|
3198 |
+
lookup.push(')');
|
3199 |
+
|
3200 |
+
this.push(this.source.functionCall(lookup, 'call', helper.callParams));
|
3201 |
+
},
|
3202 |
+
|
3203 |
+
// [invokeKnownHelper]
|
3204 |
+
//
|
3205 |
+
// On stack, before: hash, inverse, program, params..., ...
|
3206 |
+
// On stack, after: result of helper invocation
|
3207 |
+
//
|
3208 |
+
// This operation is used when the helper is known to exist,
|
3209 |
+
// so a `helperMissing` fallback is not required.
|
3210 |
+
invokeKnownHelper: function(paramSize, name) {
|
3211 |
+
var helper = this.setupHelper(paramSize, name);
|
3212 |
+
this.push(this.source.functionCall(helper.name, 'call', helper.callParams));
|
3213 |
+
},
|
3214 |
+
|
3215 |
+
// [invokeAmbiguous]
|
3216 |
+
//
|
3217 |
+
// On stack, before: hash, inverse, program, params..., ...
|
3218 |
+
// On stack, after: result of disambiguation
|
3219 |
+
//
|
3220 |
+
// This operation is used when an expression like `{{foo}}`
|
3221 |
+
// is provided, but we don't know at compile-time whether it
|
3222 |
+
// is a helper or a path.
|
3223 |
+
//
|
3224 |
+
// This operation emits more code than the other options,
|
3225 |
+
// and can be avoided by passing the `knownHelpers` and
|
3226 |
+
// `knownHelpersOnly` flags at compile-time.
|
3227 |
+
invokeAmbiguous: function(name, helperCall) {
|
3228 |
+
this.useRegister('helper');
|
3229 |
+
|
3230 |
+
var nonHelper = this.popStack();
|
3231 |
+
|
3232 |
+
this.emptyHash();
|
3233 |
+
var helper = this.setupHelper(0, name, helperCall);
|
3234 |
+
|
3235 |
+
var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper');
|
3236 |
+
|
3237 |
+
var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')'];
|
3238 |
+
if (!this.options.strict) {
|
3239 |
+
lookup[0] = '(helper = ';
|
3240 |
+
lookup.push(
|
3241 |
+
' != null ? helper : ',
|
3242 |
+
this.aliasable('helpers.helperMissing')
|
3243 |
+
);
|
3244 |
+
}
|
3245 |
+
|
3246 |
+
this.push([
|
3247 |
+
'(', lookup,
|
3248 |
+
(helper.paramsInit ? ['),(', helper.paramsInit] : []), '),',
|
3249 |
+
'(typeof helper === ', this.aliasable('"function"'), ' ? ',
|
3250 |
+
this.source.functionCall('helper','call', helper.callParams), ' : helper))'
|
3251 |
+
]);
|
3252 |
+
},
|
3253 |
+
|
3254 |
+
// [invokePartial]
|
3255 |
+
//
|
3256 |
+
// On stack, before: context, ...
|
3257 |
+
// On stack after: result of partial invocation
|
3258 |
+
//
|
3259 |
+
// This operation pops off a context, invokes a partial with that context,
|
3260 |
+
// and pushes the result of the invocation back.
|
3261 |
+
invokePartial: function(isDynamic, name, indent) {
|
3262 |
+
var params = [],
|
3263 |
+
options = this.setupParams(name, 1, params, false);
|
3264 |
+
|
3265 |
+
if (isDynamic) {
|
3266 |
+
name = this.popStack();
|
3267 |
+
delete options.name;
|
3268 |
+
}
|
3269 |
+
|
3270 |
+
if (indent) {
|
3271 |
+
options.indent = JSON.stringify(indent);
|
3272 |
+
}
|
3273 |
+
options.helpers = 'helpers';
|
3274 |
+
options.partials = 'partials';
|
3275 |
+
|
3276 |
+
if (!isDynamic) {
|
3277 |
+
params.unshift(this.nameLookup('partials', name, 'partial'));
|
3278 |
+
} else {
|
3279 |
+
params.unshift(name);
|
3280 |
+
}
|
3281 |
+
|
3282 |
+
if (this.options.compat) {
|
3283 |
+
options.depths = 'depths';
|
3284 |
+
}
|
3285 |
+
options = this.objectLiteral(options);
|
3286 |
+
params.push(options);
|
3287 |
+
|
3288 |
+
this.push(this.source.functionCall('this.invokePartial', '', params));
|
3289 |
+
},
|
3290 |
+
|
3291 |
+
// [assignToHash]
|
3292 |
+
//
|
3293 |
+
// On stack, before: value, ..., hash, ...
|
3294 |
+
// On stack, after: ..., hash, ...
|
3295 |
+
//
|
3296 |
+
// Pops a value off the stack and assigns it to the current hash
|
3297 |
+
assignToHash: function(key) {
|
3298 |
+
var value = this.popStack(),
|
3299 |
+
context,
|
3300 |
+
type,
|
3301 |
+
id;
|
3302 |
+
|
3303 |
+
if (this.trackIds) {
|
3304 |
+
id = this.popStack();
|
3305 |
+
}
|
3306 |
+
if (this.stringParams) {
|
3307 |
+
type = this.popStack();
|
3308 |
+
context = this.popStack();
|
3309 |
+
}
|
3310 |
+
|
3311 |
+
var hash = this.hash;
|
3312 |
+
if (context) {
|
3313 |
+
hash.contexts[key] = context;
|
3314 |
+
}
|
3315 |
+
if (type) {
|
3316 |
+
hash.types[key] = type;
|
3317 |
+
}
|
3318 |
+
if (id) {
|
3319 |
+
hash.ids[key] = id;
|
3320 |
+
}
|
3321 |
+
hash.values[key] = value;
|
3322 |
+
},
|
3323 |
+
|
3324 |
+
pushId: function(type, name, child) {
|
3325 |
+
if (type === 'BlockParam') {
|
3326 |
+
this.pushStackLiteral(
|
3327 |
+
'blockParams[' + name[0] + '].path[' + name[1] + ']'
|
3328 |
+
+ (child ? ' + ' + JSON.stringify('.' + child) : ''));
|
3329 |
+
} else if (type === 'PathExpression') {
|
3330 |
+
this.pushString(name);
|
3331 |
+
} else if (type === 'SubExpression') {
|
3332 |
+
this.pushStackLiteral('true');
|
3333 |
+
} else {
|
3334 |
+
this.pushStackLiteral('null');
|
3335 |
+
}
|
3336 |
+
},
|
3337 |
+
|
3338 |
+
// HELPERS
|
3339 |
+
|
3340 |
+
compiler: JavaScriptCompiler,
|
3341 |
+
|
3342 |
+
compileChildren: function(environment, options) {
|
3343 |
+
var children = environment.children, child, compiler;
|
3344 |
+
|
3345 |
+
for(var i=0, l=children.length; i<l; i++) {
|
3346 |
+
child = children[i];
|
3347 |
+
compiler = new this.compiler();
|
3348 |
+
|
3349 |
+
var index = this.matchExistingProgram(child);
|
3350 |
+
|
3351 |
+
if (index == null) {
|
3352 |
+
this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children
|
3353 |
+
index = this.context.programs.length;
|
3354 |
+
child.index = index;
|
3355 |
+
child.name = 'program' + index;
|
3356 |
+
this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile);
|
3357 |
+
this.context.environments[index] = child;
|
3358 |
+
|
3359 |
+
this.useDepths = this.useDepths || compiler.useDepths;
|
3360 |
+
this.useBlockParams = this.useBlockParams || compiler.useBlockParams;
|
3361 |
+
} else {
|
3362 |
+
child.index = index;
|
3363 |
+
child.name = 'program' + index;
|
3364 |
+
|
3365 |
+
this.useDepths = this.useDepths || child.useDepths;
|
3366 |
+
this.useBlockParams = this.useBlockParams || child.useBlockParams;
|
3367 |
+
}
|
3368 |
+
}
|
3369 |
+
},
|
3370 |
+
matchExistingProgram: function(child) {
|
3371 |
+
for (var i = 0, len = this.context.environments.length; i < len; i++) {
|
3372 |
+
var environment = this.context.environments[i];
|
3373 |
+
if (environment && environment.equals(child)) {
|
3374 |
+
return i;
|
3375 |
+
}
|
3376 |
+
}
|
3377 |
+
},
|
3378 |
+
|
3379 |
+
programExpression: function(guid) {
|
3380 |
+
var child = this.environment.children[guid],
|
3381 |
+
programParams = [child.index, 'data', child.blockParams];
|
3382 |
+
|
3383 |
+
if (this.useBlockParams || this.useDepths) {
|
3384 |
+
programParams.push('blockParams');
|
3385 |
+
}
|
3386 |
+
if (this.useDepths) {
|
3387 |
+
programParams.push('depths');
|
3388 |
+
}
|
3389 |
+
|
3390 |
+
return 'this.program(' + programParams.join(', ') + ')';
|
3391 |
+
},
|
3392 |
+
|
3393 |
+
useRegister: function(name) {
|
3394 |
+
if(!this.registers[name]) {
|
3395 |
+
this.registers[name] = true;
|
3396 |
+
this.registers.list.push(name);
|
3397 |
+
}
|
3398 |
+
},
|
3399 |
+
|
3400 |
+
push: function(expr) {
|
3401 |
+
if (!(expr instanceof Literal)) {
|
3402 |
+
expr = this.source.wrap(expr);
|
3403 |
+
}
|
3404 |
+
|
3405 |
+
this.inlineStack.push(expr);
|
3406 |
+
return expr;
|
3407 |
+
},
|
3408 |
+
|
3409 |
+
pushStackLiteral: function(item) {
|
3410 |
+
this.push(new Literal(item));
|
3411 |
+
},
|
3412 |
+
|
3413 |
+
pushSource: function(source) {
|
3414 |
+
if (this.pendingContent) {
|
3415 |
+
this.source.push(
|
3416 |
+
this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation));
|
3417 |
+
this.pendingContent = undefined;
|
3418 |
+
}
|
3419 |
+
|
3420 |
+
if (source) {
|
3421 |
+
this.source.push(source);
|
3422 |
+
}
|
3423 |
+
},
|
3424 |
+
|
3425 |
+
replaceStack: function(callback) {
|
3426 |
+
var prefix = ['('],
|
3427 |
+
stack,
|
3428 |
+
createdStack,
|
3429 |
+
usedLiteral;
|
3430 |
+
|
3431 |
+
/* istanbul ignore next */
|
3432 |
+
if (!this.isInline()) {
|
3433 |
+
throw new Exception('replaceStack on non-inline');
|
3434 |
+
}
|
3435 |
+
|
3436 |
+
// We want to merge the inline statement into the replacement statement via ','
|
3437 |
+
var top = this.popStack(true);
|
3438 |
+
|
3439 |
+
if (top instanceof Literal) {
|
3440 |
+
// Literals do not need to be inlined
|
3441 |
+
stack = [top.value];
|
3442 |
+
prefix = ['(', stack];
|
3443 |
+
usedLiteral = true;
|
3444 |
+
} else {
|
3445 |
+
// Get or create the current stack name for use by the inline
|
3446 |
+
createdStack = true;
|
3447 |
+
var name = this.incrStack();
|
3448 |
+
|
3449 |
+
prefix = ['((', this.push(name), ' = ', top, ')'];
|
3450 |
+
stack = this.topStack();
|
3451 |
+
}
|
3452 |
+
|
3453 |
+
var item = callback.call(this, stack);
|
3454 |
+
|
3455 |
+
if (!usedLiteral) {
|
3456 |
+
this.popStack();
|
3457 |
+
}
|
3458 |
+
if (createdStack) {
|
3459 |
+
this.stackSlot--;
|
3460 |
+
}
|
3461 |
+
this.push(prefix.concat(item, ')'));
|
3462 |
+
},
|
3463 |
+
|
3464 |
+
incrStack: function() {
|
3465 |
+
this.stackSlot++;
|
3466 |
+
if(this.stackSlot > this.stackVars.length) { this.stackVars.push("stack" + this.stackSlot); }
|
3467 |
+
return this.topStackName();
|
3468 |
+
},
|
3469 |
+
topStackName: function() {
|
3470 |
+
return "stack" + this.stackSlot;
|
3471 |
+
},
|
3472 |
+
flushInline: function() {
|
3473 |
+
var inlineStack = this.inlineStack;
|
3474 |
+
this.inlineStack = [];
|
3475 |
+
for (var i = 0, len = inlineStack.length; i < len; i++) {
|
3476 |
+
var entry = inlineStack[i];
|
3477 |
+
/* istanbul ignore if */
|
3478 |
+
if (entry instanceof Literal) {
|
3479 |
+
this.compileStack.push(entry);
|
3480 |
+
} else {
|
3481 |
+
var stack = this.incrStack();
|
3482 |
+
this.pushSource([stack, ' = ', entry, ';']);
|
3483 |
+
this.compileStack.push(stack);
|
3484 |
+
}
|
3485 |
+
}
|
3486 |
+
},
|
3487 |
+
isInline: function() {
|
3488 |
+
return this.inlineStack.length;
|
3489 |
+
},
|
3490 |
+
|
3491 |
+
popStack: function(wrapped) {
|
3492 |
+
var inline = this.isInline(),
|
3493 |
+
item = (inline ? this.inlineStack : this.compileStack).pop();
|
3494 |
+
|
3495 |
+
if (!wrapped && (item instanceof Literal)) {
|
3496 |
+
return item.value;
|
3497 |
+
} else {
|
3498 |
+
if (!inline) {
|
3499 |
+
/* istanbul ignore next */
|
3500 |
+
if (!this.stackSlot) {
|
3501 |
+
throw new Exception('Invalid stack pop');
|
3502 |
+
}
|
3503 |
+
this.stackSlot--;
|
3504 |
+
}
|
3505 |
+
return item;
|
3506 |
+
}
|
3507 |
+
},
|
3508 |
+
|
3509 |
+
topStack: function() {
|
3510 |
+
var stack = (this.isInline() ? this.inlineStack : this.compileStack),
|
3511 |
+
item = stack[stack.length - 1];
|
3512 |
+
|
3513 |
+
/* istanbul ignore if */
|
3514 |
+
if (item instanceof Literal) {
|
3515 |
+
return item.value;
|
3516 |
+
} else {
|
3517 |
+
return item;
|
3518 |
+
}
|
3519 |
+
},
|
3520 |
+
|
3521 |
+
contextName: function(context) {
|
3522 |
+
if (this.useDepths && context) {
|
3523 |
+
return 'depths[' + context + ']';
|
3524 |
+
} else {
|
3525 |
+
return 'depth' + context;
|
3526 |
+
}
|
3527 |
+
},
|
3528 |
+
|
3529 |
+
quotedString: function(str) {
|
3530 |
+
return this.source.quotedString(str);
|
3531 |
+
},
|
3532 |
+
|
3533 |
+
objectLiteral: function(obj) {
|
3534 |
+
return this.source.objectLiteral(obj);
|
3535 |
+
},
|
3536 |
+
|
3537 |
+
aliasable: function(name) {
|
3538 |
+
var ret = this.aliases[name];
|
3539 |
+
if (ret) {
|
3540 |
+
ret.referenceCount++;
|
3541 |
+
return ret;
|
3542 |
+
}
|
3543 |
+
|
3544 |
+
ret = this.aliases[name] = this.source.wrap(name);
|
3545 |
+
ret.aliasable = true;
|
3546 |
+
ret.referenceCount = 1;
|
3547 |
+
|
3548 |
+
return ret;
|
3549 |
+
},
|
3550 |
+
|
3551 |
+
setupHelper: function(paramSize, name, blockHelper) {
|
3552 |
+
var params = [],
|
3553 |
+
paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper);
|
3554 |
+
var foundHelper = this.nameLookup('helpers', name, 'helper');
|
3555 |
+
|
3556 |
+
return {
|
3557 |
+
params: params,
|
3558 |
+
paramsInit: paramsInit,
|
3559 |
+
name: foundHelper,
|
3560 |
+
callParams: [this.contextName(0)].concat(params)
|
3561 |
+
};
|
3562 |
+
},
|
3563 |
+
|
3564 |
+
setupParams: function(helper, paramSize, params) {
|
3565 |
+
var options = {}, contexts = [], types = [], ids = [], param;
|
3566 |
+
|
3567 |
+
options.name = this.quotedString(helper);
|
3568 |
+
options.hash = this.popStack();
|
3569 |
+
|
3570 |
+
if (this.trackIds) {
|
3571 |
+
options.hashIds = this.popStack();
|
3572 |
+
}
|
3573 |
+
if (this.stringParams) {
|
3574 |
+
options.hashTypes = this.popStack();
|
3575 |
+
options.hashContexts = this.popStack();
|
3576 |
+
}
|
3577 |
+
|
3578 |
+
var inverse = this.popStack(),
|
3579 |
+
program = this.popStack();
|
3580 |
+
|
3581 |
+
// Avoid setting fn and inverse if neither are set. This allows
|
3582 |
+
// helpers to do a check for `if (options.fn)`
|
3583 |
+
if (program || inverse) {
|
3584 |
+
options.fn = program || 'this.noop';
|
3585 |
+
options.inverse = inverse || 'this.noop';
|
3586 |
+
}
|
3587 |
+
|
3588 |
+
// The parameters go on to the stack in order (making sure that they are evaluated in order)
|
3589 |
+
// so we need to pop them off the stack in reverse order
|
3590 |
+
var i = paramSize;
|
3591 |
+
while (i--) {
|
3592 |
+
param = this.popStack();
|
3593 |
+
params[i] = param;
|
3594 |
+
|
3595 |
+
if (this.trackIds) {
|
3596 |
+
ids[i] = this.popStack();
|
3597 |
+
}
|
3598 |
+
if (this.stringParams) {
|
3599 |
+
types[i] = this.popStack();
|
3600 |
+
contexts[i] = this.popStack();
|
3601 |
+
}
|
3602 |
+
}
|
3603 |
+
|
3604 |
+
if (this.trackIds) {
|
3605 |
+
options.ids = this.source.generateArray(ids);
|
3606 |
+
}
|
3607 |
+
if (this.stringParams) {
|
3608 |
+
options.types = this.source.generateArray(types);
|
3609 |
+
options.contexts = this.source.generateArray(contexts);
|
3610 |
+
}
|
3611 |
+
|
3612 |
+
if (this.options.data) {
|
3613 |
+
options.data = 'data';
|
3614 |
+
}
|
3615 |
+
if (this.useBlockParams) {
|
3616 |
+
options.blockParams = 'blockParams';
|
3617 |
+
}
|
3618 |
+
return options;
|
3619 |
+
},
|
3620 |
+
|
3621 |
+
setupHelperArgs: function(helper, paramSize, params, useRegister) {
|
3622 |
+
var options = this.setupParams(helper, paramSize, params, true);
|
3623 |
+
options = this.objectLiteral(options);
|
3624 |
+
if (useRegister) {
|
3625 |
+
this.useRegister('options');
|
3626 |
+
params.push('options');
|
3627 |
+
return ['options=', options];
|
3628 |
+
} else {
|
3629 |
+
params.push(options);
|
3630 |
+
return '';
|
3631 |
+
}
|
3632 |
+
}
|
3633 |
+
};
|
3634 |
+
|
3635 |
+
|
3636 |
+
var reservedWords = (
|
3637 |
+
"break else new var" +
|
3638 |
+
" case finally return void" +
|
3639 |
+
" catch for switch while" +
|
3640 |
+
" continue function this with" +
|
3641 |
+
" default if throw" +
|
3642 |
+
" delete in try" +
|
3643 |
+
" do instanceof typeof" +
|
3644 |
+
" abstract enum int short" +
|
3645 |
+
" boolean export interface static" +
|
3646 |
+
" byte extends long super" +
|
3647 |
+
" char final native synchronized" +
|
3648 |
+
" class float package throws" +
|
3649 |
+
" const goto private transient" +
|
3650 |
+
" debugger implements protected volatile" +
|
3651 |
+
" double import public let yield await" +
|
3652 |
+
" null true false"
|
3653 |
+
).split(" ");
|
3654 |
+
|
3655 |
+
var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {};
|
3656 |
+
|
3657 |
+
for(var i=0, l=reservedWords.length; i<l; i++) {
|
3658 |
+
compilerWords[reservedWords[i]] = true;
|
3659 |
+
}
|
3660 |
+
|
3661 |
+
JavaScriptCompiler.isValidJavaScriptVariableName = function(name) {
|
3662 |
+
return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name);
|
3663 |
+
};
|
3664 |
+
|
3665 |
+
function strictLookup(requireTerminal, compiler, parts, type) {
|
3666 |
+
var stack = compiler.popStack();
|
3667 |
+
|
3668 |
+
var i = 0,
|
3669 |
+
len = parts.length;
|
3670 |
+
if (requireTerminal) {
|
3671 |
+
len--;
|
3672 |
+
}
|
3673 |
+
|
3674 |
+
for (; i < len; i++) {
|
3675 |
+
stack = compiler.nameLookup(stack, parts[i], type);
|
3676 |
+
}
|
3677 |
+
|
3678 |
+
if (requireTerminal) {
|
3679 |
+
return [compiler.aliasable('this.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ')'];
|
3680 |
+
} else {
|
3681 |
+
return stack;
|
3682 |
+
}
|
3683 |
+
}
|
3684 |
+
|
3685 |
+
__exports__ = JavaScriptCompiler;
|
3686 |
+
return __exports__;
|
3687 |
+
})(__module2__, __module4__, __module3__, __module15__);
|
3688 |
+
|
3689 |
+
// handlebars.js
|
3690 |
+
var __module0__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) {
|
3691 |
+
"use strict";
|
3692 |
+
var __exports__;
|
3693 |
+
/*globals Handlebars: true */
|
3694 |
+
var Handlebars = __dependency1__;
|
3695 |
+
|
3696 |
+
// Compiler imports
|
3697 |
+
var AST = __dependency2__;
|
3698 |
+
var Parser = __dependency3__.parser;
|
3699 |
+
var parse = __dependency3__.parse;
|
3700 |
+
var Compiler = __dependency4__.Compiler;
|
3701 |
+
var compile = __dependency4__.compile;
|
3702 |
+
var precompile = __dependency4__.precompile;
|
3703 |
+
var JavaScriptCompiler = __dependency5__;
|
3704 |
+
|
3705 |
+
var _create = Handlebars.create;
|
3706 |
+
var create = function() {
|
3707 |
+
var hb = _create();
|
3708 |
+
|
3709 |
+
hb.compile = function(input, options) {
|
3710 |
+
return compile(input, options, hb);
|
3711 |
+
};
|
3712 |
+
hb.precompile = function (input, options) {
|
3713 |
+
return precompile(input, options, hb);
|
3714 |
+
};
|
3715 |
+
|
3716 |
+
hb.AST = AST;
|
3717 |
+
hb.Compiler = Compiler;
|
3718 |
+
hb.JavaScriptCompiler = JavaScriptCompiler;
|
3719 |
+
hb.Parser = Parser;
|
3720 |
+
hb.parse = parse;
|
3721 |
+
|
3722 |
+
return hb;
|
3723 |
+
};
|
3724 |
+
|
3725 |
+
Handlebars = create();
|
3726 |
+
Handlebars.create = create;
|
3727 |
+
|
3728 |
+
/*jshint -W040 */
|
3729 |
+
/* istanbul ignore next */
|
3730 |
+
var root = typeof global !== 'undefined' ? global : window,
|
3731 |
+
$Handlebars = root.Handlebars;
|
3732 |
+
/* istanbul ignore next */
|
3733 |
+
Handlebars.noConflict = function() {
|
3734 |
+
if (root.Handlebars === Handlebars) {
|
3735 |
+
root.Handlebars = $Handlebars;
|
3736 |
+
}
|
3737 |
+
};
|
3738 |
+
|
3739 |
+
Handlebars['default'] = Handlebars;
|
3740 |
+
|
3741 |
+
__exports__ = Handlebars;
|
3742 |
+
return __exports__;
|
3743 |
+
})(__module1__, __module7__, __module8__, __module13__, __module14__);
|
3744 |
+
|
3745 |
+
return __module0__;
|
3746 |
+
}));
|
3747 |
+
|
3748 |
+
|
3749 |
+
|
3750 |
+
/* custom helpers */
|
3751 |
+
Handlebars.registerHelper('find', function(obj, field, options) {
|
3752 |
+
if( typeof obj === 'undefined' || typeof obj[field] === 'undefined' ){
|
3753 |
+
|
3754 |
+
// check a nother level
|
3755 |
+
for( var part in obj ){
|
3756 |
+
|
3757 |
+
if( typeof obj[part] !== 'undefined' && typeof obj[part][field] !== 'undefined' ){
|
3758 |
+
if( typeof obj[part][field] === 'string' && ( obj[part][field] === '' || obj[part][field] === null || obj[part][field] === false ) ){
|
3759 |
+
return options.inverse(this)
|
3760 |
+
}
|
3761 |
+
return options.fn(obj[part]);
|
3762 |
+
}
|
3763 |
+
if( obj[part] === field ){
|
3764 |
+
return options.fn(obj[part]);
|
3765 |
+
}
|
3766 |
+
}
|
3767 |
+
return options.inverse(this)
|
3768 |
+
}else{
|
3769 |
+
|
3770 |
+
return options.fn(obj[field]);
|
3771 |
+
}
|
3772 |
+
|
3773 |
+
});
|
3774 |
+
Handlebars.registerHelper("is_single", function(value, options) {
|
3775 |
+
if(Object.keys(value).length !== 1){
|
3776 |
+
return false;
|
3777 |
+
}else{
|
3778 |
+
return options.fn(this);
|
3779 |
+
}
|
3780 |
+
});
|
3781 |
+
Handlebars.registerHelper("script", function(options) {
|
3782 |
+
var atts = [];
|
3783 |
+
for( var att in options.hash ){
|
3784 |
+
atts.push( att + '="' + options.hash[att] + '"' );
|
3785 |
+
}
|
3786 |
+
|
3787 |
+
return '<script ' + atts.join(' ') + '>' + options.fn(this) + '</script>';
|
3788 |
+
});
|
3789 |
+
Handlebars.registerHelper("is", function(value, options) {
|
3790 |
+
|
3791 |
+
if( options.hash.value ){
|
3792 |
+
if(options.hash.value === '@key'){
|
3793 |
+
options.hash.value = options.data.key;
|
3794 |
+
}
|
3795 |
+
if(options.hash.value === value){
|
3796 |
+
return options.fn(this);
|
3797 |
+
}else{
|
3798 |
+
if(this[options.hash.value]){
|
3799 |
+
if(this[options.hash.value] === value){
|
3800 |
+
return options.fn(this);
|
3801 |
+
}
|
3802 |
+
}
|
3803 |
+
return options.inverse(this);
|
3804 |
+
}
|
3805 |
+
}
|
3806 |
+
if( options.hash.not ){
|
3807 |
+
if(options.hash.not === '@key'){
|
3808 |
+
options.hash.not = options.data.key;
|
3809 |
+
}
|
3810 |
+
if(options.hash.not !== value){
|
3811 |
+
return options.fn(this);
|
3812 |
+
}else{
|
3813 |
+
if(this[options.hash.not]){
|
3814 |
+
if(this[options.hash.not] !== value){
|
3815 |
+
return options.fn(this);
|
3816 |
+
}
|
3817 |
+
}
|
3818 |
+
return options.inverse(this);
|
3819 |
+
}
|
3820 |
+
}
|
3821 |
+
|
3822 |
+
});
|
3823 |
+
|
3824 |
+
|
3825 |
+
/* -- BaldrickJS V2.3 | (C) David Cramer - 2013 | MIT License */
|
3826 |
+
(function($){
|
3827 |
+
// try not load again
|
3828 |
+
if( baldrickCache ){
|
3829 |
+
return;
|
3830 |
+
}
|
3831 |
+
|
3832 |
+
$.fn.formJSON = function(){
|
3833 |
+
|
3834 |
+
var form = $(this);
|
3835 |
+
if( !form.is('form') ){
|
3836 |
+
form = $('<form>').append( form.clone() );
|
3837 |
+
}
|
3838 |
+
|
3839 |
+
var fields = form.serializeArray(),
|
3840 |
+
json = {},
|
3841 |
+
arraynames = {};
|
3842 |
+
for( var v = 0; v < fields.length; v++){
|
3843 |
+
var field = fields[v],
|
3844 |
+
field_el = form.find('[name="' + field.name + '"]'),
|
3845 |
+
name = field.name.replace(/\]/gi,'').split('['),
|
3846 |
+
value = field.value,
|
3847 |
+
lineconf = {};
|
3848 |
+
|
3849 |
+
/*if( field_el.prop('required') && field_el.is(':visible') ){
|
3850 |
+
if( field_el[0].checkValidity ){
|
3851 |
+
if( field_el[0].checkValidity() ){
|
3852 |
+
field_el.removeClass('invalid');
|
3853 |
+
}else{
|
3854 |
+
field_el.focus().addClass('invalid');
|
3855 |
+
return false;
|
3856 |
+
}
|
3857 |
+
}
|
3858 |
+
}*/
|
3859 |
+
for(var i = name.length-1; i >= 0; i--){
|
3860 |
+
var nestname = name[i];
|
3861 |
+
if(nestname.length === 0){
|
3862 |
+
lineconf = [];
|
3863 |
+
if( typeof arraynames[name[i-1]] === 'undefined'){
|
3864 |
+
arraynames[name[i-1]] = 0;
|
3865 |
+
}else{
|
3866 |
+
arraynames[name[i-1]] += 1;
|
3867 |
+
}
|
3868 |
+
nestname = arraynames[name[i-1]];
|
3869 |
+
}
|
3870 |
+
if(i === name.length-1){
|
3871 |
+
if( value === 'true' ){
|
3872 |
+
value = true;
|
3873 |
+
}else if( value === 'false' ){
|
3874 |
+
value = false;
|
3875 |
+
}else if( !isNaN( parseFloat( value ) ) && parseFloat( value ).toString() === value ){
|
3876 |
+
value = parseFloat( value );
|
3877 |
+
}else if( value.substr(0,1) === '{' || value.substr(0,1) === '[' ){
|
3878 |
+
try {
|
3879 |
+
value = JSON.parse( value );
|
3880 |
+
|
3881 |
+
} catch (e) {
|
3882 |
+
//console.log( e );
|
3883 |
+
}
|
3884 |
+
}
|
3885 |
+
lineconf[nestname] = value;
|
3886 |
+
}else{
|
3887 |
+
var newobj = lineconf;
|
3888 |
+
lineconf = {};
|
3889 |
+
lineconf[nestname] = newobj;
|
3890 |
+
}
|
3891 |
+
}
|
3892 |
+
$.extend(true, json, lineconf);
|
3893 |
+
};
|
3894 |
+
return json;
|
3895 |
+
}
|
3896 |
+
|
3897 |
+
var baldrickCache = {},
|
3898 |
+
baldrickRequests = {},
|
3899 |
+
baldrickhelpers = {
|
3900 |
+
_plugins : {},
|
3901 |
+
load : {},
|
3902 |
+
bind : {},
|
3903 |
+
event : function(el,e){
|
3904 |
+
return el;
|
3905 |
+
},
|
3906 |
+
pre_filter : function(opts){
|
3907 |
+
return opts.data;
|
3908 |
+
},
|
3909 |
+
filter : function(opts){
|
3910 |
+
return opts;
|
3911 |
+
},
|
3912 |
+
target : function(opts){
|
3913 |
+
if(typeof opts.params.success === 'string'){
|
3914 |
+
if(typeof window[opts.params.success] === 'function'){
|
3915 |
+
window[opts.params.success](opts);
|
3916 |
+
}
|
3917 |
+
}else if(typeof opts.params.success === 'function'){
|
3918 |
+
opts.params.success(opts);
|
3919 |
+
}
|
3920 |
+
|
3921 |
+
if(opts.params.target){
|
3922 |
+
|
3923 |
+
if(opts.params.target.is('textarea,input') && typeof opts.data === 'object'){
|
3924 |
+
opts.params.target.val( JSON.stringify(opts.data) ).trigger('change');
|
3925 |
+
}else{
|
3926 |
+
opts.params.target[opts.params.targetInsert](opts.data);
|
3927 |
+
}
|
3928 |
+
if(typeof opts.params.callback === 'string'){
|
3929 |
+
if(typeof window[opts.params.callback] === 'function'){
|
3930 |
+
return window[opts.params.callback](opts);
|
3931 |
+
}
|
3932 |
+
}else if(typeof opts.params.callback === 'function'){
|
3933 |
+
return opts.params.callback(opts);
|
3934 |
+
}
|
3935 |
+
}
|
3936 |
+
},
|
3937 |
+
request_data : function(obj){
|
3938 |
+
return obj.data;
|
3939 |
+
},
|
3940 |
+
request : function(opts){
|
3941 |
+
|
3942 |
+
if( ( opts.params.trigger.data('cacheLocal') || opts.params.trigger.data('cacheSession') ) && !opts.params.trigger.data('cachePurge') ){
|
3943 |
+
|
3944 |
+
var key;
|
3945 |
+
|
3946 |
+
if( opts.params.trigger.data('cacheLocal') ){
|
3947 |
+
key = opts.params.trigger.data('cacheLocal');
|
3948 |
+
}else if(opts.params.trigger.data('cacheSession')){
|
3949 |
+
key = opts.params.trigger.data('cacheSession');
|
3950 |
+
}
|
3951 |
+
|
3952 |
+
// check for a recent object
|
3953 |
+
if(typeof baldrickCache[key] !== 'undefined'){
|
3954 |
+
return {data: baldrickCache[key]};
|
3955 |
+
}
|
3956 |
+
|
3957 |
+
// check if there is a stored obejct to be loaded
|
3958 |
+
if(typeof(Storage)!=="undefined"){
|
3959 |
+
|
3960 |
+
var cache;
|
3961 |
+
|
3962 |
+
// load storage
|
3963 |
+
if( opts.params.trigger.data('cacheLocal') ){
|
3964 |
+
cache = localStorage.getItem( key );
|
3965 |
+
}else if(opts.params.trigger.data('cacheSession')){
|
3966 |
+
cache = sessionStorage.getItem( key );
|
3967 |
+
}
|
3968 |
+
if(cache){
|
3969 |
+
try {
|
3970 |
+
//baldrickCache[key] = JSON.parse(cache);
|
3971 |
+
cache = JSON.parse(cache);
|
3972 |
+
} catch (e) {
|
3973 |
+
//baldrickCache[key] = cache;
|
3974 |
+
cache = cache;
|
3975 |
+
}
|
3976 |
+
return {data: cache};
|
3977 |
+
}
|
3978 |
+
|
3979 |
+
}
|
3980 |
+
|
3981 |
+
}
|
3982 |
+
if( baldrickRequests[opts.params.trigger.prop('id')] ){
|
3983 |
+
baldrickRequests[opts.params.trigger.prop('id')].abort();
|
3984 |
+
}
|
3985 |
+
baldrickRequests[opts.params.trigger.prop('id')] = $.ajax(opts.request);
|
3986 |
+
return baldrickRequests[opts.params.trigger.prop('id')];
|
3987 |
+
},
|
3988 |
+
request_complete: function(opts){
|
3989 |
+
opts.params.complete(opts);
|
3990 |
+
opts.params.loadElement.removeClass(opts.params.loadClass);
|
3991 |
+
if( baldrickRequests[opts.params.trigger.prop('id')] ){
|
3992 |
+
delete baldrickRequests[opts.params.trigger.prop('id')];
|
3993 |
+
}
|
3994 |
+
},
|
3995 |
+
request_error : function(opts){
|
3996 |
+
opts.params.error(opts);
|
3997 |
+
opts.params.complete(opts.jqxhr,opts.textStatus);
|
3998 |
+
},
|
3999 |
+
refresh : function(opts, defaults){
|
4000 |
+
$(defaults.triggerClass).baldrick(defaults);
|
4001 |
+
}
|
4002 |
+
};
|
4003 |
+
|
4004 |
+
$.fn.baldrick = function(opts){
|
4005 |
+
|
4006 |
+
var do_helper = function(h, input, ev){
|
4007 |
+
var out;
|
4008 |
+
// pull in plugins before
|
4009 |
+
for(var before in defaults.helpers._plugins){
|
4010 |
+
if(typeof defaults.helpers._plugins[before][h] === 'function'){
|
4011 |
+
out = defaults.helpers._plugins[before][h](input, defaults, ev);
|
4012 |
+
if(typeof out !== 'undefined'){ input = out;}
|
4013 |
+
if(input === false){return false;}
|
4014 |
+
}
|
4015 |
+
}
|
4016 |
+
if(typeof defaults.helpers[h] === 'function'){
|
4017 |
+
out = defaults.helpers[h](input, defaults, ev);
|
4018 |
+
if(typeof out !== 'undefined'){ input = out;}
|
4019 |
+
if(!input){return false;}
|
4020 |
+
}
|
4021 |
+
// pull in plugins after
|
4022 |
+
for(var after in defaults.helpers._plugins){
|
4023 |
+
if(typeof defaults.helpers._plugins[after]['after_' + h] === 'function'){
|
4024 |
+
out = defaults.helpers._plugins[after]['after_' + h](input, defaults, ev);
|
4025 |
+
if(typeof out !== 'undefined'){ input = out;}
|
4026 |
+
if(input === false){return false;}
|
4027 |
+
}
|
4028 |
+
}
|
4029 |
+
return input;
|
4030 |
+
},
|
4031 |
+
serialize_form = function(form){
|
4032 |
+
|
4033 |
+
var config = {},
|
4034 |
+
data_fields = form.find('input,radio,checkbox,select,textarea,file'),
|
4035 |
+
objects = [],
|
4036 |
+
arraynames = {};
|
4037 |
+
|
4038 |
+
// no fields - exit
|
4039 |
+
if(!data_fields.length){
|
4040 |
+
return;
|
4041 |
+
}
|
4042 |
+
|
4043 |
+
for( var v = 0; v < data_fields.length; v++){
|
4044 |
+
if( data_fields[v].getAttribute('name') === null){
|
4045 |
+
continue;
|
4046 |
+
}
|
4047 |
+
var field = $(data_fields[v]),
|
4048 |
+
basename = field.prop('name').replace(/\[/gi,':').replace(/\]/gi,''),//.split('[' + id + ']')[1].substr(1),
|
4049 |
+
name = basename.split(':'),
|
4050 |
+
value = ( field.is(':checkbox,:radio') ? field.filter(':checked').val() : field.val() ),
|
4051 |
+
lineconf = {};
|
4052 |
+
|
4053 |
+
for(var i = name.length-1; i >= 0; i--){
|
4054 |
+
var nestname = name[i];
|
4055 |
+
if(nestname.length === 0){
|
4056 |
+
if( typeof arraynames[name[i-1]] === 'undefined'){
|
4057 |
+
arraynames[name[i-1]] = 0;
|
4058 |
+
}else{
|
4059 |
+
arraynames[name[i-1]] += 1;
|
4060 |
+
}
|
4061 |
+
nestname = arraynames[name[i-1]];
|
4062 |
+
}
|
4063 |
+
if(i === name.length-1){
|
4064 |
+
lineconf[nestname] = value;
|
4065 |
+
}else{
|
4066 |
+
var newobj = lineconf;
|
4067 |
+
lineconf = {};
|
4068 |
+
lineconf[nestname] = newobj;
|
4069 |
+
}
|
4070 |
+
}
|
4071 |
+
|
4072 |
+
$.extend(true, config, lineconf);
|
4073 |
+
};
|
4074 |
+
// give json object to trigger
|
4075 |
+
//params.data = JSON.stringify(config);
|
4076 |
+
//params.data = config;
|
4077 |
+
return config;
|
4078 |
+
},
|
4079 |
+
triggerClass = this.selector,
|
4080 |
+
inst = this.not('._tisBound');
|
4081 |
+
|
4082 |
+
inst.addClass('_tisBound');
|
4083 |
+
if(typeof opts !== 'undefined'){
|
4084 |
+
if(typeof opts.helper === 'object'){
|
4085 |
+
baldrickhelpers._plugins._params_helpers_ = opts.helper;
|
4086 |
+
}
|
4087 |
+
}
|
4088 |
+
var defaults = $.extend(true, opts, { helpers : baldrickhelpers}, {triggerClass:triggerClass}),
|
4089 |
+
ncb = function(){return true;},
|
4090 |
+
callbacks = {
|
4091 |
+
"before" : ncb,
|
4092 |
+
"callback" : false,
|
4093 |
+
"success" : false,
|
4094 |
+
"complete" : ncb,
|
4095 |
+
"error" : ncb
|
4096 |
+
},
|
4097 |
+
output;
|
4098 |
+
|
4099 |
+
for(var c in callbacks){
|
4100 |
+
if(typeof defaults[c] === 'string'){
|
4101 |
+
callbacks[c] = (typeof window[defaults[c]] === 'function' ? window[defaults[c]] : ncb);
|
4102 |
+
}else if(typeof defaults[c] === 'function'){
|
4103 |
+
callbacks[c] = defaults[c];
|
4104 |
+
}
|
4105 |
+
}
|
4106 |
+
|
4107 |
+
inst = do_helper('bind', inst);
|
4108 |
+
if(inst === false){return this;}
|
4109 |
+
return do_helper('ready', inst.each(function(key){
|
4110 |
+
if(!this.id){
|
4111 |
+
this.id = "baldrick_trigger_" + (new Date().getTime() + key);
|
4112 |
+
}
|
4113 |
+
var el = $(this), ev = (el.data('event') ? el.data('event') : (defaults.event ? defaults.event : ( el.is('form') ? 'submit' : 'click' )));
|
4114 |
+
el.on(ev, function(e){
|
4115 |
+
|
4116 |
+
var tr = $(do_helper('event', this, e));
|
4117 |
+
|
4118 |
+
if(tr.data('for')){
|
4119 |
+
var fort = $(tr.data('for')),
|
4120 |
+
datamerge = $.extend({}, fort.data(), tr.data());
|
4121 |
+
delete datamerge['for'];
|
4122 |
+
fort.data(datamerge);
|
4123 |
+
if( fort.is('form') ){
|
4124 |
+
fort.submit();
|
4125 |
+
return this;
|
4126 |
+
}else{
|
4127 |
+
return fort.trigger((fort.data('event') ? fort.data('event') : ev));
|
4128 |
+
}
|
4129 |
+
}
|
4130 |
+
if(tr.is('form') && !tr.data('request') && tr.attr('action')){
|
4131 |
+
tr.data('request', tr.attr('action'));
|
4132 |
+
}
|
4133 |
+
if(tr.is('a') && !tr.data('request') && tr.attr('href')){
|
4134 |
+
if(tr.attr('href').indexOf('#') < 0){
|
4135 |
+
tr.data('request', tr.attr('href'));
|
4136 |
+
}else{
|
4137 |
+
tr.data('href', tr.attr('href'));
|
4138 |
+
}
|
4139 |
+
}
|
4140 |
+
|
4141 |
+
if((tr.data('before') ? (typeof window[tr.data('before')] === 'function' ? window[tr.data('before')](this, e) : callbacks.before(this, e)) : callbacks.before(this, e)) === false){return;}
|
4142 |
+
|
4143 |
+
var params = {
|
4144 |
+
trigger: tr,
|
4145 |
+
callback : (tr.data('callback') ? ((typeof window[tr.data('callback')] === 'function') ? window[tr.data('callback')] : tr.data('callback')) : callbacks.callback),
|
4146 |
+
success : (tr.data('success') ? ((typeof window[tr.data('success')] === 'function') ? window[tr.data('success')] : tr.data('success')) : callbacks.success),
|
4147 |
+
method : (tr.data('method') ? tr.data('method') : (tr.attr('method') ? tr.attr('method') :(defaults.method ? defaults.method : 'GET'))),
|
4148 |
+
dataType : (tr.data('type') ? tr.data('type') : (defaults.dataType ? defaults.dataType : false)),
|
4149 |
+
timeout : (tr.data('timeout') ? tr.data('timeout') : 120000),
|
4150 |
+
target : (tr.data('target') ? ( tr.data('target') === '_parent' ? tr.parent() : ( tr.data('target') === '_self' ? $(tr) : $(tr.data('target')) ) ) : (defaults.target ? $(defaults.target) : $('<html>'))),
|
4151 |
+
targetInsert : (tr.data('targetInsert') ? (tr.data('targetInsert') === 'replace' ? 'replaceWith' : tr.data('targetInsert')) : (defaults.targetInsert ? (defaults.targetInsert === 'replace' ? 'replaceWith': defaults.targetInsert) : 'html')),
|
4152 |
+
loadClass : (tr.data('loadClass') ? tr.data('loadClass') : (defaults.loadClass ? defaults.loadClass : 'loading')),
|
4153 |
+
activeClass : (tr.data('activeClass') ? tr.data('activeClass') : (defaults.activeClass ? defaults.activeClass : 'active')),
|
4154 |
+
activeElement : (tr.data('activeElement') ? (tr.data('activeElement') === '_parent' ? tr.parent() :$(tr.data('activeElement'))) : (defaults.activeElement ? (defaults.activeElement === '_parent' ? tr.parent() : $(defaults.activeElement)) : tr)),
|
4155 |
+
cache : (tr.data('cache') ? tr.data('cache') : (defaults.cache ? defaults.cache : false)),
|
4156 |
+
complete : (tr.data('complete') ? (typeof window[tr.data('complete')] === 'function' ? window[tr.data('complete')] : callbacks.complete ) : callbacks.complete),
|
4157 |
+
error : (tr.data('error') ? (typeof window[tr.data('error')] === 'function' ? window[tr.data('error')] : callbacks.error ) : callbacks.error),
|
4158 |
+
resultSelector : false,
|
4159 |
+
event : ev
|
4160 |
+
};
|
4161 |
+
params.url = (tr.data('request') ? ( tr.data('request') ) : (defaults.request ? defaults.request : params.callback));
|
4162 |
+
params.loadElement = (tr.data('loadElement') ? (tr.data('loadElement') === '_parent' ? tr.parent() :$(tr.data('loadElement'))) : (defaults.loadElement ? ($(defaults.loadElement) ? $(defaults.loadElement) : params.target) : params.target));
|
4163 |
+
|
4164 |
+
params = do_helper('params', params);
|
4165 |
+
if(params === false){return false;}
|
4166 |
+
|
4167 |
+
// check if request is a function
|
4168 |
+
e.preventDefault();
|
4169 |
+
if(typeof window[params.url] === 'function'){
|
4170 |
+
|
4171 |
+
var dt = window[params.url](params, ev);
|
4172 |
+
dt = do_helper('pre_filter', {data:dt, params: params});
|
4173 |
+
dt = do_helper('filter', {data:dt, rawData: dt, params: params});
|
4174 |
+
do_helper('target', dt);
|
4175 |
+
do_helper('refresh', {params:params});
|
4176 |
+
do_helper('request_complete', {jqxhr:null, textStatus:'complete', request:request, params:params});
|
4177 |
+
|
4178 |
+
return this;
|
4179 |
+
}else{
|
4180 |
+
|
4181 |
+
try{
|
4182 |
+
if( $(params.url).length ){
|
4183 |
+
var dt = $(params.url).is('input,select,radio,checkbox,file,textarea') ? $(params.url).val() : ( $(params.url).is('form') ? serialize_form( $(params.url) ) : $(params.url).html() );
|
4184 |
+
}
|
4185 |
+
}catch (e){}
|
4186 |
+
|
4187 |
+
if(typeof dt !== 'undefined'){
|
4188 |
+
|
4189 |
+
if(params.dataType === 'json'){
|
4190 |
+
try{
|
4191 |
+
dt = JSON.parse(dt);
|
4192 |
+
}catch (e){}
|
4193 |
+
}
|
4194 |
+
|
4195 |
+
dt = do_helper('pre_filter', {data:dt, params: params});
|
4196 |
+
dt = do_helper('filter', {data:dt, rawData: dt, params: params});
|
4197 |
+
do_helper('target', dt);
|
4198 |
+
do_helper('refresh', {params:params});
|
4199 |
+
do_helper('request_complete', {jqxhr:null, textStatus:'complete', request:request, params:params});
|
4200 |
+
|
4201 |
+
var dt_enabled = true;
|
4202 |
+
return this;
|
4203 |
+
}
|
4204 |
+
}
|
4205 |
+
switch (typeof params.url){
|
4206 |
+
case 'function' : return params.url(this, e);
|
4207 |
+
case 'boolean' :
|
4208 |
+
case 'object': return;
|
4209 |
+
case 'string' :
|
4210 |
+
if(params.url.indexOf(' ') > -1){
|
4211 |
+
var rp = params.url.split(' ');
|
4212 |
+
params.url = rp[0];
|
4213 |
+
params.resultSelector = rp[1];
|
4214 |
+
}
|
4215 |
+
}
|
4216 |
+
|
4217 |
+
var active = (tr.data('group') ? $('._tisBound[data-group="'+tr.data('group')+'"]').each(function(){
|
4218 |
+
var or = $(this),
|
4219 |
+
tel = (or.data('activeElement') ? (or.data('activeElement') === '_parent' ? or.parent() :$(or.data('activeElement'))) : (defaults.activeElement ? (defaults.activeElement === '_parent' ? tr.parent() : $(defaults.activeElement)) : or) );
|
4220 |
+
tel.removeClass((or.data('activeClass') ? or.data('activeClass') : (defaults.activeClass ? defaults.activeClass : params.activeClass)));}
|
4221 |
+
) : $('._tisBound:not([data-group])').each(function(){
|
4222 |
+
var or = $(this),
|
4223 |
+
tel = (or.data('activeElement') ? (or.data('activeElement') === '_parent' ? or.parent() :$(or.data('activeElement'))) : (defaults.activeElement ? (defaults.activeElement === '_parent' ? tr.parent() : $(defaults.activeElement)) : or) );
|
4224 |
+
tel.removeClass((or.data('activeClass') ? or.data('activeClass') : (defaults.activeClass ? defaults.activeClass : params.activeClass)));}
|
4225 |
+
));
|
4226 |
+
|
4227 |
+
params.activeElement.addClass(params.activeClass);
|
4228 |
+
params.loadElement.addClass(params.loadClass);
|
4229 |
+
var data;
|
4230 |
+
if(FormData && ( tr.is('input:file') || params.method === 'POST') ){
|
4231 |
+
|
4232 |
+
params.method = 'POST';
|
4233 |
+
params.contentType = false;
|
4234 |
+
params.processData = false;
|
4235 |
+
params.cache = false;
|
4236 |
+
params.xhrFields = {
|
4237 |
+
onprogress: function (e) {
|
4238 |
+
if (e.lengthComputable) {
|
4239 |
+
//console.log('Loaded '+ (e.loaded / e.total * 100) + '%');
|
4240 |
+
} else {
|
4241 |
+
//console.log('Length not computable.');
|
4242 |
+
}
|
4243 |
+
}
|
4244 |
+
};
|
4245 |
+
|
4246 |
+
if(tr.is('form')){
|
4247 |
+
data = new FormData(tr[0]);
|
4248 |
+
}else{
|
4249 |
+
|
4250 |
+
data = new FormData();
|
4251 |
+
}
|
4252 |
+
|
4253 |
+
if(tr.is('input,select,textarea')){
|
4254 |
+
// add value as _value for each access
|
4255 |
+
tr.data('_value', tr.val());
|
4256 |
+
}
|
4257 |
+
// make field vars
|
4258 |
+
for(var att in params.trigger.data()){
|
4259 |
+
data.append(att, params.trigger.data(att));
|
4260 |
+
}
|
4261 |
+
// convert param.data to json
|
4262 |
+
if(params.data){
|
4263 |
+
data.append('data', JSON.stringify(params.data));
|
4264 |
+
}
|
4265 |
+
// use input
|
4266 |
+
if(tr.is('input,select,textarea')){
|
4267 |
+
|
4268 |
+
if(tr.is('input:file')){
|
4269 |
+
if(tr[0].files.length > 1){
|
4270 |
+
for( var file = 0; file < tr[0].files.length; file++){
|
4271 |
+
data.append(tr.prop('name'), tr[0].files[file]);
|
4272 |
+
}
|
4273 |
+
}else{
|
4274 |
+
data.append(tr.prop('name'), tr[0].files[0]);
|
4275 |
+
}
|
4276 |
+
|
4277 |
+
}else if(tr.is('input:checkbox') || tr.is('input:radio')){
|
4278 |
+
if(tr.prop('checked')){
|
4279 |
+
data.append(tr.prop('name'), tr.val());
|
4280 |
+
}
|
4281 |
+
}else{
|
4282 |
+
data.append(tr.prop('name'), tr.val());
|
4283 |
+
}
|
4284 |
+
}
|
4285 |
+
}else{
|
4286 |
+
|
4287 |
+
var sd = tr.serializeArray(), atts = params.trigger.data(), param = [];
|
4288 |
+
//console.log(atts);
|
4289 |
+
// insert user set params
|
4290 |
+
if(defaults.data){
|
4291 |
+
atts = $.extend(defaults.data, atts);
|
4292 |
+
}
|
4293 |
+
|
4294 |
+
if(sd.length){
|
4295 |
+
$.each( sd, function(k,v) {
|
4296 |
+
param.push(v);
|
4297 |
+
});
|
4298 |
+
params.requestData = serialize_form(tr);
|
4299 |
+
}
|
4300 |
+
// convert param.data to json
|
4301 |
+
if(params.data){
|
4302 |
+
atts = $.extend(atts, params.data);
|
4303 |
+
}
|
4304 |
+
data = atts;
|
4305 |
+
params.requestData = $.extend(tr.data(), params.requestData);
|
4306 |
+
}
|
4307 |
+
|
4308 |
+
var request = {
|
4309 |
+
url : params.url,
|
4310 |
+
data : do_helper('request_data', {data:data, params: params }),
|
4311 |
+
cache : params.cache,
|
4312 |
+
timeout : params.timeout,
|
4313 |
+
type : params.method,
|
4314 |
+
success : function(dt, ts, xhr){
|
4315 |
+
if(params.resultSelector){
|
4316 |
+
if(typeof dt === 'object'){
|
4317 |
+
var traverse = params.resultSelector.replace(/\[/g,'.').replace(/\]/g,'').split('.'),
|
4318 |
+
data_object = dt;
|
4319 |
+
for(var i=0; i<traverse.length; i++){
|
4320 |
+
data_object = data_object[traverse[i]];
|
4321 |
+
}
|
4322 |
+
dt = data_object;
|
4323 |
+
}else if (typeof dt === 'string'){
|
4324 |
+
var tmp = $(params.resultSelector, $('<html>').html(dt));
|
4325 |
+
if(tmp.length === 1){
|
4326 |
+
dt = $('<html>').html(tmp).html();
|
4327 |
+
}else{
|
4328 |
+
dt = $('<html>');
|
4329 |
+
tmp.each(function(){
|
4330 |
+
dt.append(this);
|
4331 |
+
});
|
4332 |
+
dt = dt.html();
|
4333 |
+
}
|
4334 |
+
}
|
4335 |
+
}
|
4336 |
+
var rawdata = dt;
|
4337 |
+
if(params.trigger.data('cacheLocal') || params.trigger.data('cacheSession')){
|
4338 |
+
|
4339 |
+
|
4340 |
+
var key;
|
4341 |
+
|
4342 |
+
if( params.trigger.data('cacheLocal') ){
|
4343 |
+
key = params.trigger.data('cacheLocal');
|
4344 |
+
}else if(params.trigger.data('cacheSession')){
|
4345 |
+
key = params.trigger.data('cacheSession');
|
4346 |
+
}
|
4347 |
+
|
4348 |
+
// add to local storage for later
|
4349 |
+
if(typeof(Storage)!=="undefined"){
|
4350 |
+
if( params.trigger.data('cacheLocal') ){
|
4351 |
+
try{
|
4352 |
+
localStorage.setItem( key, xhr.responseText );
|
4353 |
+
} catch (e) {
|
4354 |
+
console.log(e);
|
4355 |
+
}
|
4356 |
+
}else if( params.trigger.data('cacheSession') ){
|
4357 |
+
try{
|
4358 |
+
sessionStorage.setItem( key, xhr.responseText );
|
4359 |
+
} catch (e) {
|
4360 |
+
console.log(e);
|
4361 |
+
}
|
4362 |
+
|
4363 |
+
}
|
4364 |
+
}
|
4365 |
+
|
4366 |
+
// add to current cache object
|
4367 |
+
//baldrickCache[key] = dt;
|
4368 |
+
$(window).trigger('baldrick.cache', key);
|
4369 |
+
}
|
4370 |
+
|
4371 |
+
dt = do_helper('pre_filter', {data:dt, request: request, params: params, xhr: xhr});
|
4372 |
+
dt = do_helper('filter', {data:dt, rawData: rawdata, request: request, params: params, xhr: xhr});
|
4373 |
+
do_helper('target', dt);
|
4374 |
+
},
|
4375 |
+
complete: function(xhr,ts){
|
4376 |
+
|
4377 |
+
do_helper('request_complete', {jqxhr:xhr, textStatus:ts, request:request, params:params});
|
4378 |
+
|
4379 |
+
do_helper('refresh', {jqxhr:xhr, textStatus:ts, request:request, params:params});
|
4380 |
+
|
4381 |
+
if(tr.data('once')){
|
4382 |
+
tr.off(ev).removeClass('_tisBound');
|
4383 |
+
}
|
4384 |
+
},
|
4385 |
+
error: function(xhr,ts,ex){
|
4386 |
+
do_helper('request_error', {jqxhr:xhr, textStatus:ts, error:ex, request:request, params:params});
|
4387 |
+
}
|
4388 |
+
};
|
4389 |
+
if(params.dataType){
|
4390 |
+
request.dataType = params.dataType;
|
4391 |
+
}
|
4392 |
+
if(typeof params.contentType !== 'undefined'){
|
4393 |
+
request.contentType = params.contentType;
|
4394 |
+
}
|
4395 |
+
if(typeof params.processData !== 'undefined'){
|
4396 |
+
request.processData = params.processData;
|
4397 |
+
}
|
4398 |
+
if(typeof params.xhrFields !== 'undefined'){
|
4399 |
+
request.xhrFields = params.xhrFields;
|
4400 |
+
}
|
4401 |
+
|
4402 |
+
request = do_helper('request_params', request, params);
|
4403 |
+
if(request === false){return inst;}
|
4404 |
+
|
4405 |
+
var request_result = do_helper('request', {request: request, params: params});
|
4406 |
+
|
4407 |
+
// A Request helper returns a completed object, if it contains data, push to the rest.
|
4408 |
+
if(request_result.data){
|
4409 |
+
|
4410 |
+
var dt = request_result.data,
|
4411 |
+
rawdata = dt;
|
4412 |
+
|
4413 |
+
do_helper('target' ,
|
4414 |
+
do_helper('filter' ,
|
4415 |
+
do_helper('pre_filter' , {data:dt, request: request, params: params})
|
4416 |
+
)
|
4417 |
+
);
|
4418 |
+
do_helper('request_complete', {jqxhr:false, textStatus:true, request:request, params:params});
|
4419 |
+
do_helper('refresh' , {jqxhr:false, textStatus:true, request:request, params:params});
|
4420 |
+
|
4421 |
+
|
4422 |
+
}
|
4423 |
+
});
|
4424 |
+
if(el.data('autoload') || el.data('poll')){
|
4425 |
+
if(el.data('delay')){
|
4426 |
+
setTimeout(function(el, ev){
|
4427 |
+
return el.trigger(ev);
|
4428 |
+
}, el.data('delay'), el, ev);
|
4429 |
+
}else{
|
4430 |
+
el.trigger(ev);
|
4431 |
+
}
|
4432 |
+
}
|
4433 |
+
|
4434 |
+
if(el.data('poll')){
|
4435 |
+
if(el.data('delay')){
|
4436 |
+
setTimeout(function(el, ev){
|
4437 |
+
return setInterval(function(el, ev){
|
4438 |
+
return el.trigger(ev);
|
4439 |
+
}, el.data('poll'), el, ev);
|
4440 |
+
}, el.data('delay'));
|
4441 |
+
}else{
|
4442 |
+
setInterval(function(el, ev){
|
4443 |
+
return el.trigger(ev);
|
4444 |
+
}, el.data('poll'), el, ev);
|
4445 |
+
}
|
4446 |
+
}
|
4447 |
+
return this;
|
4448 |
+
}));
|
4449 |
+
};
|
4450 |
+
$.fn.baldrick.cacheObject = function(id, object){
|
4451 |
+
baldrickCache[id] = object;
|
4452 |
+
};
|
4453 |
+
$.fn.baldrick.registerhelper = function(slug, helper, callback){
|
4454 |
+
var newhelper = {};
|
4455 |
+
if(typeof helper === 'object'){
|
4456 |
+
newhelper[slug] = helper;
|
4457 |
+
baldrickhelpers._plugins = $.extend(true, newhelper, baldrickhelpers._plugins);
|
4458 |
+
}else if(typeof helper === 'string' && typeof slug === 'string' && typeof callback === 'function'){
|
4459 |
+
newhelper[helper] = {};
|
4460 |
+
newhelper[helper][slug] = callback;
|
4461 |
+
baldrickhelpers._plugins = $.extend(true, newhelper, baldrickhelpers._plugins);
|
4462 |
+
}
|
4463 |
+
|
4464 |
+
};
|
4465 |
+
|
4466 |
+
})(jQuery);
|
4467 |
+
|
4468 |
+
/* custom helpers */
|
4469 |
+
var handlebarsVariables = {};
|
4470 |
+
|
4471 |
+
Handlebars.registerHelper("even", function(options) {
|
4472 |
+
var intval = options.data.index / 2;
|
4473 |
+
if( intval === Math.ceil( intval ) ){
|
4474 |
+
return options.fn(this);
|
4475 |
+
}else{
|
4476 |
+
return false;
|
4477 |
+
}
|
4478 |
+
|
4479 |
+
});
|
4480 |
+
Handlebars.registerHelper("odd", function(options) {
|
4481 |
+
var intval = options.data.index / 2;
|
4482 |
+
if( intval === Math.ceil( intval ) ){
|
4483 |
+
return false;
|
4484 |
+
}else{
|
4485 |
+
return options.fn(this);
|
4486 |
+
}
|
4487 |
+
});
|
4488 |
+
Handlebars.registerHelper("json", function(context) {
|
4489 |
+
return JSON.stringify( context );
|
4490 |
+
});
|
4491 |
+
Handlebars.registerHelper(":node_point", function(context) {
|
4492 |
+
|
4493 |
+
if( this._node_point ){
|
4494 |
+
var nodes = this._node_point.split('.'),
|
4495 |
+
node_point_record = nodes.join('][') + ']',
|
4496 |
+
node_path = node_point_record.replace( nodes[0] + ']', nodes[0] );
|
4497 |
+
|
4498 |
+
return new Handlebars.SafeString( '<input type="hidden" name="' + node_path + '[_id]" value="' + nodes[nodes.length-1] + '"><input type="hidden" name="' + node_path + '[_node_point]" value="' + this._node_point + '">' );
|
4499 |
+
}
|
4500 |
+
|
4501 |
+
});
|
4502 |
+
Handlebars.registerHelper(":name", function(context) {
|
4503 |
+
|
4504 |
+
if( this._node_point ){
|
4505 |
+
var nodes = this._node_point.split('.'),
|
4506 |
+
node_point_record = nodes.join('][') + ']',
|
4507 |
+
node_path = node_point_record.replace( nodes[0] + ']', nodes[0] );
|
4508 |
+
|
4509 |
+
return node_path;
|
4510 |
+
}
|
4511 |
+
|
4512 |
+
});
|
4513 |
+
|
4514 |
+
|
4515 |
+
/* Baldrick handlebars.js templating plugin */
|
4516 |
+
(function($){
|
4517 |
+
var compiledTemplates = {};
|
4518 |
+
$.fn.baldrick.registerhelper('handlebars', {
|
4519 |
+
bind : function(triggers, defaults){
|
4520 |
+
var templates = triggers.filter("[data-template-url]");
|
4521 |
+
if(templates.length){
|
4522 |
+
templates.each(function(){
|
4523 |
+
var trigger = $(this);
|
4524 |
+
//console.log(trigger.data());
|
4525 |
+
if(typeof compiledTemplates[trigger.data('templateUrl')] === 'undefined'){
|
4526 |
+
compiledTemplates[trigger.data('templateUrl')] = true;
|
4527 |
+
|
4528 |
+
if(typeof(Storage)!=="undefined"){
|
4529 |
+
|
4530 |
+
var cache, key;
|
4531 |
+
|
4532 |
+
if(trigger.data('cacheLocal')){
|
4533 |
+
|
4534 |
+
key = trigger.data('cacheLocal');
|
4535 |
+
|
4536 |
+
cache = localStorage.getItem( 'handlebars_' + key );
|
4537 |
+
|
4538 |
+
}else if(trigger.data('cacheSession')){
|
4539 |
+
|
4540 |
+
key = trigger.data('cacheSession');
|
4541 |
+
|
4542 |
+
cache = sessionStorage.getItem( 'handlebars_' + key );
|
4543 |
+
}
|
4544 |
+
|
4545 |
+
}
|
4546 |
+
|
4547 |
+
if(cache){
|
4548 |
+
compiledTemplates[trigger.data('templateUrl')] = Handlebars.compile(cache);
|
4549 |
+
}else{
|
4550 |
+
$.get(trigger.data('templateUrl'), function(data, ts, xhr){
|
4551 |
+
|
4552 |
+
if(typeof(Storage)!=="undefined"){
|
4553 |
+
|
4554 |
+
var key;
|
4555 |
+
|
4556 |
+
if(trigger.data('cacheLocal')){
|
4557 |
+
|
4558 |
+
key = trigger.data('cacheLocal');
|
4559 |
+
|
4560 |
+
localStorage.setItem( 'handlebars_' + key, xhr.responseText );
|
4561 |
+
|
4562 |
+
}else if(trigger.data('cacheSession')){
|
4563 |
+
|
4564 |
+
key = trigger.data('cacheSession');
|
4565 |
+
|
4566 |
+
sessionStorage.setItem( 'handlebars_' + key, xhr.responseText );
|
4567 |
+
}
|
4568 |
+
}
|
4569 |
+
|
4570 |
+
compiledTemplates[trigger.data('templateUrl')] = Handlebars.compile(xhr.responseText);
|
4571 |
+
});
|
4572 |
+
}
|
4573 |
+
}
|
4574 |
+
});
|
4575 |
+
}
|
4576 |
+
|
4577 |
+
},
|
4578 |
+
request_params : function(request, defaults, params){
|
4579 |
+
if((params.trigger.data('templateUrl') || params.trigger.data('template')) && typeof Handlebars === 'object'){
|
4580 |
+
request.dataType = 'json';
|
4581 |
+
return request;
|
4582 |
+
}
|
4583 |
+
},
|
4584 |
+
filter : function(opts, defaults){
|
4585 |
+
|
4586 |
+
if(opts.params.trigger.data('templateUrl')){
|
4587 |
+
if( typeof compiledTemplates[opts.params.trigger.data('templateUrl')] === 'function' ){
|
4588 |
+
opts.data = compiledTemplates[opts.params.trigger.data('templateUrl')](opts.data);
|
4589 |
+
}
|
4590 |
+
}else if(opts.params.trigger.data('template')){
|
4591 |
+
if( typeof compiledTemplates[opts.params.trigger.data('template')] === 'function' ){
|
4592 |
+
opts.data = compiledTemplates[opts.params.trigger.data('template')](opts.data);
|
4593 |
+
}else{
|
4594 |
+
if($(opts.params.trigger.data('template'))){
|
4595 |
+
compiledTemplates[opts.params.trigger.data('template')] = Handlebars.compile($(opts.params.trigger.data('template')).html());
|
4596 |
+
opts.data = compiledTemplates[opts.params.trigger.data('template')](opts.data);
|
4597 |
+
}
|
4598 |
+
}
|
4599 |
+
}
|
4600 |
+
|
4601 |
+
return opts;
|
4602 |
+
}
|
4603 |
+
});
|
4604 |
+
|
4605 |
+
})(jQuery);
|
4606 |
+
|
4607 |
+
|
4608 |
+
/* Baldrick modals.js templating plugin */
|
4609 |
+
(function($){
|
4610 |
+
|
4611 |
+
var wm_hasModal = false;
|
4612 |
+
|
4613 |
+
$.fn.baldrick.registerhelper('baldrick_modal', {
|
4614 |
+
close_modal: function(modal, modalBackdrop, trigger, size_cycle, ev){
|
4615 |
+
$('body').css('overflow', '');
|
4616 |
+
ev.preventDefault();
|
4617 |
+
modalBackdrop.fadeOut(200);
|
4618 |
+
modal.fadeOut(200, function(){
|
4619 |
+
modal.remove();
|
4620 |
+
modalBackdrop.remove();
|
4621 |
+
if( size_cycle ){
|
4622 |
+
clearTimeout( size_cycle );
|
4623 |
+
}
|
4624 |
+
trigger.removeClass( ( trigger.data('activeClass') ? trigger.data('activeClass') : 'active' ) );
|
4625 |
+
$('.baldrick-modal-wrap').css('zIndex' , '');
|
4626 |
+
});
|
4627 |
+
},
|
4628 |
+
resize_modal: function(modal, trigger){
|
4629 |
+
|
4630 |
+
$('body').css('overflow', 'hidden');
|
4631 |
+
|
4632 |
+
var windowWidth = $(window).width(),
|
4633 |
+
windowHeight = $(window).height(),
|
4634 |
+
modalHeight = ( modal.data('height') ? modal.data('height') : ( trigger.data('modalHeight') ? trigger.data('modalHeight') : 350 ) ),
|
4635 |
+
modalWidth = ( modal.data('width') ? modal.data('width') : ( trigger.data('modalWidth') ? trigger.data('modalWidth') : 450 ) ),
|
4636 |
+
body = modal.find('.baldrick-modal-body')
|
4637 |
+
footer = modal.find('.baldrick-modal-footer'),
|
4638 |
+
title = modal.find('.baldrick-modal-title'),
|
4639 |
+
current_size = '';
|
4640 |
+
|
4641 |
+
if( windowWidth <= 700 && windowWidth > 600 ){
|
4642 |
+
modalHeight = windowHeight - 30;
|
4643 |
+
modalWidth = windowWidth - 30;
|
4644 |
+
}else if( windowWidth <= 600 ){
|
4645 |
+
modalHeight = windowHeight;
|
4646 |
+
modalWidth = windowWidth;
|
4647 |
+
}
|
4648 |
+
|
4649 |
+
var modalTop = ( windowHeight / 2) - ( modalHeight / 2 ),
|
4650 |
+
modalLeft = ( windowWidth / 2) - ( modalWidth / 2 );
|
4651 |
+
|
4652 |
+
current_size = {
|
4653 |
+
top: ( modalHeight < windowHeight ? ( modalTop / 3 * 2 ) : 0 ),
|
4654 |
+
left: ( modalWidth < windowWidth ? modalLeft : 0 ),
|
4655 |
+
width: ( modalWidth < windowWidth ? modalWidth : windowWidth ),
|
4656 |
+
height: ( modalHeight < windowHeight ? modalHeight : windowHeight )
|
4657 |
+
};
|
4658 |
+
|
4659 |
+
modal.css( current_size );
|
4660 |
+
|
4661 |
+
},
|
4662 |
+
refresh: function(obj){
|
4663 |
+
if(obj.params.trigger.data('modalAutoclose')){
|
4664 |
+
$('#' + obj.params.trigger.data('modalAutoclose') + '_baldrickModalCloser').trigger('click');
|
4665 |
+
}
|
4666 |
+
// inject tabs
|
4667 |
+
var navtabs = obj.params.target.find('[data-tab]'),
|
4668 |
+
avatar = obj.params.target.find('.user-avatar');
|
4669 |
+
|
4670 |
+
if( navtabs.length ){
|
4671 |
+
var tabs = $('<ul>', { "class" : "navtabs" } ),
|
4672 |
+
hasSelection = false;
|
4673 |
+
|
4674 |
+
navtabs.each( function(k,v){
|
4675 |
+
var tab = $(this),
|
4676 |
+
element = $('<li>'),
|
4677 |
+
link = $('<a>', { "href": '#'});
|
4678 |
+
|
4679 |
+
tab.addClass('hidden');
|
4680 |
+
link.html( tab.data('tab') ).attr('title', tab.data('tab') );
|
4681 |
+
element.append( link );
|
4682 |
+
if( tab.data('selected') && false === hasSelection ){
|
4683 |
+
element.addClass('selected');
|
4684 |
+
hasSelection = true;
|
4685 |
+
tab.show();
|
4686 |
+
}
|
4687 |
+
link.on('click', function(e){
|
4688 |
+
e.preventDefault();
|
4689 |
+
var clicked = $(this);
|
4690 |
+
navtabs.hide();
|
4691 |
+
tab.show();
|
4692 |
+
tabs.children().removeClass('selected');
|
4693 |
+
clicked.parent().addClass('selected');
|
4694 |
+
$(window).trigger('modaltabchange');
|
4695 |
+
});
|
4696 |
+
tabs.append(element);
|
4697 |
+
|
4698 |
+
} );
|
4699 |
+
|
4700 |
+
if( false === hasSelection ){
|
4701 |
+
tabs.children().first().addClass('selected');
|
4702 |
+
navtabs.first().show();
|
4703 |
+
}
|
4704 |
+
|
4705 |
+
tabs.css('top', obj.params.target.parent().find('.baldrick-modal-title').outerHeight() );
|
4706 |
+
tabs.css('bottom', obj.params.target.parent().find('.baldrick-modal-footer').outerHeight() );
|
4707 |
+
|
4708 |
+
obj.params.target.before( tabs ).addClass('has-tabs');
|
4709 |
+
|
4710 |
+
if( avatar.length ){
|
4711 |
+
tabs.before( avatar );
|
4712 |
+
tabs.css('top', obj.params.target.parent().find('.baldrick-modal-title').outerHeight() + 149 );
|
4713 |
+
tabs.css('padding-top', 0 );
|
4714 |
+
}
|
4715 |
+
|
4716 |
+
}
|
4717 |
+
|
4718 |
+
},
|
4719 |
+
event : function(el, obj){
|
4720 |
+
var trigger = $(el), modal_id = 'wm';
|
4721 |
+
if(trigger.data('modal') && wm_hasModal === false){
|
4722 |
+
if(trigger.data('modal') !== 'true'){
|
4723 |
+
modal_id = trigger.data('modal');
|
4724 |
+
}
|
4725 |
+
if(!$('#' + modal_id + '_baldrickModal').length){
|
4726 |
+
$('.baldrick-modal-wrap').css('zIndex' , '100099');
|
4727 |
+
//wm_hasModal = true;
|
4728 |
+
// write out a template wrapper.
|
4729 |
+
var modal_element = trigger.data('modalElement') ? trigger.data('modalElement') : 'form',
|
4730 |
+
modal = $('<' + modal_element + '>', {
|
4731 |
+
id : modal_id + '_baldrickModal',
|
4732 |
+
tabIndex : -1,
|
4733 |
+
"ariaLabelled-by" : modal_id + '_baldrickModalLable',
|
4734 |
+
"class" : "baldrick-modal-wrap ",
|
4735 |
+
"method" : "POST"
|
4736 |
+
}),
|
4737 |
+
//modalDialog = $('<div>', {"class" : "modal-dialog"});
|
4738 |
+
//modalBackdrop = $('.baldrick-backdrop').length ? $('.baldrick-backdrop') : $('<div>', {"class" : "baldrick-backdrop"});
|
4739 |
+
modalBackdrop = $('.baldrick-backdrop').length ? $('<div>', {"class" : "baldrick-backdrop-invisible"}) : $('<div>', {"class" : "baldrick-backdrop"});
|
4740 |
+
modalContent = $('<div>', {"class" : "baldrick-modal-body",id: modal_id + '_baldrickModalBody'});
|
4741 |
+
modalFooter = $('<div>', {"class" : "baldrick-modal-footer",id: modal_id + '_baldrickModalFooter'});
|
4742 |
+
modalHeader = $('<div>', {"class" : "baldrick-modal-title", id : modal_id + '_baldrickModalTitle'});
|
4743 |
+
modalCloser = $('<a>', { "href" : "#close", "class":"baldrick-modal-closer", "data-dismiss":"modal", "aria-hidden":"true",id: modal_id + '_baldrickModalCloser'}).html('×');
|
4744 |
+
modalTitle = $('<h3>', {"class" : "modal-label", id : modal_id + '_baldrickModalLable'});
|
4745 |
+
|
4746 |
+
modalHeader.append(modalCloser).appendTo(modal);
|
4747 |
+
|
4748 |
+
if(trigger.data('modalTitle')){
|
4749 |
+
modalHeader.append(modalTitle);
|
4750 |
+
}else{
|
4751 |
+
modalHeader.height(0).hide();
|
4752 |
+
}
|
4753 |
+
if(!trigger.data('modalButtons')){
|
4754 |
+
modalFooter.height(0).hide();
|
4755 |
+
}
|
4756 |
+
if(trigger.data('modalClass')){
|
4757 |
+
modal.addClass(trigger.data('modalClass'));
|
4758 |
+
}
|
4759 |
+
|
4760 |
+
var resize_modal = this.resize_modal,size_cycle = null,
|
4761 |
+
//size_cycle = setInterval(function(){
|
4762 |
+
// resize_modal( modal, trigger );
|
4763 |
+
//}, 400),
|
4764 |
+
|
4765 |
+
// RESET SIZE
|
4766 |
+
resize_modal = this.resize_modal,
|
4767 |
+
resize_action = function(){
|
4768 |
+
resize_modal( modal, trigger );
|
4769 |
+
},
|
4770 |
+
close_modal = this.close_modal,
|
4771 |
+
modal_closer = function(e){
|
4772 |
+
if(e.type === 'keypress'){
|
4773 |
+
if(e.keyCode !== 27){
|
4774 |
+
return;
|
4775 |
+
}
|
4776 |
+
}
|
4777 |
+
$(window).off('keypress', modal_closer );
|
4778 |
+
$(window).off('resize', resize_action);
|
4779 |
+
close_modal(modal, modalBackdrop, trigger, size_cycle, e);
|
4780 |
+
};
|
4781 |
+
|
4782 |
+
$(window).on('resize', resize_action);
|
4783 |
+
|
4784 |
+
modalBackdrop.on('click', modal_closer );
|
4785 |
+
modalCloser.on('click', modal_closer );
|
4786 |
+
$(window).on('keypress', modal_closer )
|
4787 |
+
|
4788 |
+
modal.on('keyup', 'select,input,checkbox,radio,textarea', function(){
|
4789 |
+
$(window).off('keypress', modal_closer );
|
4790 |
+
})
|
4791 |
+
|
4792 |
+
modalContent.appendTo(modal);
|
4793 |
+
modalFooter.appendTo(modal);
|
4794 |
+
|
4795 |
+
modal.appendTo($('body')).hide().fadeIn(200);
|
4796 |
+
if( trigger.data('modalFloat') ){
|
4797 |
+
modalBackdrop.css({'background': 'transparent'});
|
4798 |
+
}
|
4799 |
+
modalBackdrop.insertBefore(modal).hide().fadeIn(200);
|
4800 |
+
|
4801 |
+
|
4802 |
+
}
|
4803 |
+
}
|
4804 |
+
},
|
4805 |
+
request_complete : function(obj, params){
|
4806 |
+
if(obj.params.trigger.data('modal')){
|
4807 |
+
var modal_id = 'wm',loadClass = 'spinner', modal, modalBody;
|
4808 |
+
if(obj.params.trigger.data('modal') !== 'true'){
|
4809 |
+
modal_id = obj.params.trigger.data('modal');
|
4810 |
+
}
|
4811 |
+
|
4812 |
+
modal = $('#' + modal_id + '_baldrickModal');
|
4813 |
+
modalBody = $('#' + modal_id + '_baldrickModalBody');
|
4814 |
+
modalTitle = $('#' + modal_id + '_baldrickModalTitle');
|
4815 |
+
modalButtons= $('#' + modal_id + '_baldrickModalFooter button');
|
4816 |
+
modalButtons.prop('disabled', false);
|
4817 |
+
|
4818 |
+
if(obj.params.trigger.data('loadClass')){
|
4819 |
+
loadClass = obj.params.trigger.data('loadClass');
|
4820 |
+
}
|
4821 |
+
|
4822 |
+
if(obj.params.trigger.data('modalLife')){
|
4823 |
+
var delay = parseFloat(obj.params.trigger.data('modalLife'));
|
4824 |
+
if(delay > 0){
|
4825 |
+
setTimeout(function(){
|
4826 |
+
$('#' + modal_id + '_baldrickModalCloser').trigger('click');
|
4827 |
+
}, delay);
|
4828 |
+
}else{
|
4829 |
+
$('#' + modal_id + '_baldrickModalCloser').trigger('click');
|
4830 |
+
}
|
4831 |
+
}
|
4832 |
+
//$('#' + modal_id + '_baldrickModalLoader').hide();
|
4833 |
+
modalBody.removeClass(loadClass).show();
|
4834 |
+
|
4835 |
+
//if(obj.params.trigger.data('modalCenter')){
|
4836 |
+
modal = this.resize_modal( modal, obj.params.trigger );
|
4837 |
+
//}
|
4838 |
+
|
4839 |
+
}
|
4840 |
+
},
|
4841 |
+
after_filter : function(obj){
|
4842 |
+
if(obj.params.trigger.data('modal')){
|
4843 |
+
if(obj.params.trigger.data('targetInsert')){
|
4844 |
+
var modal_id = 'wm';
|
4845 |
+
if(obj.params.trigger.data('modal') !== 'true'){
|
4846 |
+
modal_id = obj.params.trigger.data('modal');
|
4847 |
+
}
|
4848 |
+
var data = $(obj.data).prop('id', modal_id + '_baldrickModalBody');
|
4849 |
+
obj.data = data;
|
4850 |
+
}
|
4851 |
+
}
|
4852 |
+
return obj;
|
4853 |
+
},
|
4854 |
+
params : function(params,defaults){
|
4855 |
+
|
4856 |
+
var trigger = params.trigger, modal_id = 'wm', loadClass = 'spinner';
|
4857 |
+
if(params.trigger.data('modal') !== 'true'){
|
4858 |
+
modal_id = params.trigger.data('modal');
|
4859 |
+
}
|
4860 |
+
if(params.trigger.data('loadClass')){
|
4861 |
+
loadClass = params.trigger.data('loadClass');
|
4862 |
+
}
|
4863 |
+
|
4864 |
+
if(trigger.data('modal') && (params.url || trigger.data('modalContent'))){
|
4865 |
+
var modal;
|
4866 |
+
|
4867 |
+
if(params.url){
|
4868 |
+
params.target = $('#' + modal_id + '_baldrickModalBody');
|
4869 |
+
params.loadElement = $('#' + modal_id + '_baldrickModalLoader');
|
4870 |
+
params.target.empty();
|
4871 |
+
}
|
4872 |
+
|
4873 |
+
if(trigger.data('modalTemplate')){
|
4874 |
+
modal = $(trigger.data('modalTemplate'));
|
4875 |
+
}else{
|
4876 |
+
modal = $('#' + modal_id + '_baldrickModal');
|
4877 |
+
}
|
4878 |
+
// close if already open
|
4879 |
+
if($('.modal-backdrop').length){
|
4880 |
+
//modal.modal('hide');
|
4881 |
+
}
|
4882 |
+
|
4883 |
+
// get options.
|
4884 |
+
var label = $('#' + modal_id + '_baldrickModalLable'),
|
4885 |
+
//loader = $('#' + modal_id + '_baldrickModalLoader'),
|
4886 |
+
title = $('#' + modal_id + '_baldrickModalTitle'),
|
4887 |
+
body = $('#' + modal_id + '_baldrickModalBody'),
|
4888 |
+
footer = $('#' + modal_id + '_baldrickModalFooter');
|
4889 |
+
|
4890 |
+
// reset modal
|
4891 |
+
//modal.removeClass('fade');
|
4892 |
+
|
4893 |
+
label.empty().parent().hide();
|
4894 |
+
body.addClass(loadClass);
|
4895 |
+
|
4896 |
+
footer.empty().hide();
|
4897 |
+
if(trigger.data('modalTitle')){
|
4898 |
+
label.html(trigger.data('modalTitle')).parent().show();
|
4899 |
+
}
|
4900 |
+
if(trigger.data('modalButtons')){
|
4901 |
+
var buttons = $.trim(trigger.data('modalButtons')).split(';'),
|
4902 |
+
button_list = [];
|
4903 |
+
|
4904 |
+
body.addClass('has-buttons');
|
4905 |
+
|
4906 |
+
if(buttons.length){
|
4907 |
+
footer.height('auto');
|
4908 |
+
for(b=0; b<buttons.length;b++){
|
4909 |
+
var options = buttons[b].split('|'),
|
4910 |
+
buttonLabel = options[0],
|
4911 |
+
callback = options[1].trim(),
|
4912 |
+
atts = $.extend({}, {"type": "button", "class":'button '}, ( callback.substr(0,1) === '{' ? jQuery.parseJSON(callback) : {"data-callback" : callback} ) ),
|
4913 |
+
button = $('<button>', atts);
|
4914 |
+
if(options[2]){
|
4915 |
+
button.addClass(options[2]);
|
4916 |
+
}
|
4917 |
+
if(atts['data-modal-close']){
|
4918 |
+
button.data('callback', function(){
|
4919 |
+
$('#' + modal_id + '_baldrickModalCloser').trigger('click');
|
4920 |
+
});
|
4921 |
+
}
|
4922 |
+
if(callback === 'dismiss'){
|
4923 |
+
button.on('click', function(){
|
4924 |
+
$('#' + modal_id + '_baldrickModalCloser').trigger('click');
|
4925 |
+
})
|
4926 |
+
}else{
|
4927 |
+
button.addClass(defaults.triggerClass.substr(1));
|
4928 |
+
}
|
4929 |
+
button.prop('disabled', true);
|
4930 |
+
|
4931 |
+
footer.append(button.html(buttonLabel));
|
4932 |
+
if(b<buttons.length){
|
4933 |
+
footer.append(' ');
|
4934 |
+
}
|
4935 |
+
}
|
4936 |
+
footer.show();
|
4937 |
+
}
|
4938 |
+
|
4939 |
+
}
|
4940 |
+
|
4941 |
+
|
4942 |
+
|
4943 |
+
//optional content
|
4944 |
+
if(trigger.data('modalContent')){
|
4945 |
+
body.html($(trigger.data('modalContent')).html());
|
4946 |
+
loader.hide();
|
4947 |
+
body.show();
|
4948 |
+
$(defaults.triggerClass).baldrick(defaults);
|
4949 |
+
}
|
4950 |
+
|
4951 |
+
$(window).trigger('resize');
|
4952 |
+
// launch
|
4953 |
+
/*modal.modal('show').on('hidden.bs.modal', function (e) {
|
4954 |
+
wm_hasModal = false;
|
4955 |
+
$(this).remove();
|
4956 |
+
});*/
|
4957 |
+
}
|
4958 |
+
}
|
4959 |
+
});
|
4960 |
+
|
4961 |
+
})(jQuery);
|
caldera-core.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin URI: http://digilab.co.za
|
5 |
Description: Easy to use, grid based responsive form builder for creating simple to complex forms.
|
6 |
Author: David Cramer
|
7 |
-
Version: 1.
|
8 |
Author URI: http://digilab.co.za
|
9 |
*/
|
10 |
|
@@ -17,7 +17,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
17 |
|
18 |
define('CFCORE_PATH', plugin_dir_path(__FILE__));
|
19 |
define('CFCORE_URL', plugin_dir_url(__FILE__));
|
20 |
-
define('CFCORE_VER', '1.
|
21 |
define('CFCORE_EXTEND_URL', 'https://api.calderaforms.com/1.0/');
|
22 |
|
23 |
include_once CFCORE_PATH . 'classes/core.php';
|
4 |
Plugin URI: http://digilab.co.za
|
5 |
Description: Easy to use, grid based responsive form builder for creating simple to complex forms.
|
6 |
Author: David Cramer
|
7 |
+
Version: 1.2.0
|
8 |
Author URI: http://digilab.co.za
|
9 |
*/
|
10 |
|
17 |
|
18 |
define('CFCORE_PATH', plugin_dir_path(__FILE__));
|
19 |
define('CFCORE_URL', plugin_dir_url(__FILE__));
|
20 |
+
define('CFCORE_VER', '1.2.0');
|
21 |
define('CFCORE_EXTEND_URL', 'https://api.calderaforms.com/1.0/');
|
22 |
|
23 |
include_once CFCORE_PATH . 'classes/core.php';
|
classes/admin.php
CHANGED
@@ -304,7 +304,7 @@ class Caldera_Forms_Admin {
|
|
304 |
$viewer_buttons = 'data-modal-buttons=\'' . implode(';', $viewer_buttons) . '\'';
|
305 |
}
|
306 |
|
307 |
-
echo '{{#if ../../is_active}}<button class="button button-small ajax-trigger view-entry-btn" data-active-class="none" data-load-class="spinner" ' . $viewer_buttons . ' data-group="viewentry" data-entry="{{_entry_id}}" data-form="{{../../form}}" data-action="get_entry" data-modal="view_entry" data-modal-width="700" data-modal-title="' . __('Entry', 'caldera-forms') . ' # {{_entry_id}}" data-template="#view-entry-tmpl" type="button">' . __('View') . '</button> {{/if}}';
|
308 |
if( current_user_can( 'delete_others_posts' ) ){
|
309 |
echo '<button type="button" class="button button-small ajax-trigger" data-load-class="active" data-panel="{{#if ../../is_trash}}trash{{/if}}{{#if ../../is_active}}active{{/if}}" data-do="{{#if ../../is_trash}}active{{/if}}{{#if ../../is_active}}trash{{/if}}" data-callback="cf_refresh_view" data-form="{{../../form}}" data-active-class="disabled" data-group="row{{_entry_id}}" data-load-element="#entry_row_{{_entry_id}}" data-action="cf_bulk_action" data-items="{{_entry_id}}">{{#if ../../is_trash}}' . __('Restore', 'caldera-forms') . '{{/if}}{{#if ../../is_active}}' . __('Trash') . '{{/if}}</button>';
|
310 |
}
|
@@ -743,7 +743,8 @@ class Caldera_Forms_Admin {
|
|
743 |
wp_enqueue_script( $this->plugin_slug .'-baldrick-modals', CFCORE_URL . 'assets/js/modals.baldrick.js', array($this->plugin_slug .'-baldrick'), self::VERSION );
|
744 |
wp_enqueue_script( $this->plugin_slug .'-baldrick', CFCORE_URL . 'assets/js/jquery.baldrick.js', array('jquery'), self::VERSION );
|
745 |
*/
|
746 |
-
wp_enqueue_script( $this->plugin_slug .'-
|
|
|
747 |
|
748 |
if(!empty($_GET['edit'])){
|
749 |
|
@@ -1173,8 +1174,6 @@ class Caldera_Forms_Admin {
|
|
1173 |
}
|
1174 |
$headers[$entry->slug] = $label;
|
1175 |
}*/
|
1176 |
-
|
1177 |
-
|
1178 |
|
1179 |
header("Pragma: public");
|
1180 |
header("Expires: 0");
|
@@ -1182,7 +1181,7 @@ class Caldera_Forms_Admin {
|
|
1182 |
header("Cache-Control: private",false);
|
1183 |
header("Content-Type: text/csv charset=utf-8;");
|
1184 |
header("Content-Disposition: attachment; filename=\"" . sanitize_file_name( $form['name'] ) . ".csv\";" );
|
1185 |
-
header("Content-Transfer-Encoding: binary");
|
1186 |
$df = fopen("php://output", 'w');
|
1187 |
fputcsv($df, $headers);
|
1188 |
foreach($data as $row){
|
@@ -1190,7 +1189,24 @@ class Caldera_Forms_Admin {
|
|
1190 |
foreach($headers as $key=>$label){
|
1191 |
if(!isset($row[$key])){
|
1192 |
$row[$key] = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1193 |
}
|
|
|
1194 |
$csvrow[] = $row[$key];
|
1195 |
}
|
1196 |
fputcsv($df, $row);
|
304 |
$viewer_buttons = 'data-modal-buttons=\'' . implode(';', $viewer_buttons) . '\'';
|
305 |
}
|
306 |
|
307 |
+
echo '{{#if ../../is_active}}<button class="button button-small ajax-trigger view-entry-btn" data-active-class="none" data-load-class="spinner" ' . $viewer_buttons . ' data-group="viewentry" data-entry="{{_entry_id}}" data-form="{{../../form}}" data-action="get_entry" data-modal="view_entry" data-modal-width="700" data-modal-height="700" data-modal-title="' . __('Entry', 'caldera-forms') . ' # {{_entry_id}}" data-template="#view-entry-tmpl" type="button">' . __('View') . '</button> {{/if}}';
|
308 |
if( current_user_can( 'delete_others_posts' ) ){
|
309 |
echo '<button type="button" class="button button-small ajax-trigger" data-load-class="active" data-panel="{{#if ../../is_trash}}trash{{/if}}{{#if ../../is_active}}active{{/if}}" data-do="{{#if ../../is_trash}}active{{/if}}{{#if ../../is_active}}trash{{/if}}" data-callback="cf_refresh_view" data-form="{{../../form}}" data-active-class="disabled" data-group="row{{_entry_id}}" data-load-element="#entry_row_{{_entry_id}}" data-action="cf_bulk_action" data-items="{{_entry_id}}">{{#if ../../is_trash}}' . __('Restore', 'caldera-forms') . '{{/if}}{{#if ../../is_active}}' . __('Trash') . '{{/if}}</button>';
|
310 |
}
|
743 |
wp_enqueue_script( $this->plugin_slug .'-baldrick-modals', CFCORE_URL . 'assets/js/modals.baldrick.js', array($this->plugin_slug .'-baldrick'), self::VERSION );
|
744 |
wp_enqueue_script( $this->plugin_slug .'-baldrick', CFCORE_URL . 'assets/js/jquery.baldrick.js', array('jquery'), self::VERSION );
|
745 |
*/
|
746 |
+
wp_enqueue_script( $this->plugin_slug .'-baldrick', CFCORE_URL . 'assets/js/wp-baldrick-full.js', array('jquery'), self::VERSION );
|
747 |
+
wp_enqueue_script( $this->plugin_slug .'-admin-scripts', CFCORE_URL . 'assets/js/admin.min.js', array( $this->plugin_slug .'-baldrick' ), self::VERSION );
|
748 |
|
749 |
if(!empty($_GET['edit'])){
|
750 |
|
1174 |
}
|
1175 |
$headers[$entry->slug] = $label;
|
1176 |
}*/
|
|
|
|
|
1177 |
|
1178 |
header("Pragma: public");
|
1179 |
header("Expires: 0");
|
1181 |
header("Cache-Control: private",false);
|
1182 |
header("Content-Type: text/csv charset=utf-8;");
|
1183 |
header("Content-Disposition: attachment; filename=\"" . sanitize_file_name( $form['name'] ) . ".csv\";" );
|
1184 |
+
header("Content-Transfer-Encoding: binary");
|
1185 |
$df = fopen("php://output", 'w');
|
1186 |
fputcsv($df, $headers);
|
1187 |
foreach($data as $row){
|
1189 |
foreach($headers as $key=>$label){
|
1190 |
if(!isset($row[$key])){
|
1191 |
$row[$key] = null;
|
1192 |
+
}else{
|
1193 |
+
if( is_array( $row[$key] ) && isset( $row[$key]['label'] ) ){
|
1194 |
+
$row[$key] = $row[$key]['value'];
|
1195 |
+
}elseif( is_array( $row[$key] ) && count( $row[$key] ) === 1 ){
|
1196 |
+
$row[$key] = $row[$key][0];
|
1197 |
+
}elseif( is_array( $row[$key] ) ){
|
1198 |
+
$subs = array();
|
1199 |
+
foreach( $row[$key] as $row_part ){
|
1200 |
+
if( is_array( $row_part ) && isset( $row_part['label'] ) ){
|
1201 |
+
$subs[] = $row_part['value'];
|
1202 |
+
}else{
|
1203 |
+
$subs[] = $row_part;
|
1204 |
+
}
|
1205 |
+
}
|
1206 |
+
$row[$key] = implode(', ', $subs );
|
1207 |
+
}
|
1208 |
}
|
1209 |
+
|
1210 |
$csvrow[] = $row[$key];
|
1211 |
}
|
1212 |
fputcsv($df, $row);
|
classes/core.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Caldera Forms.
|
4 |
*
|
@@ -1536,8 +1537,9 @@ class Caldera_Forms {
|
|
1536 |
continue;
|
1537 |
}
|
1538 |
// auto
|
1539 |
-
if(!empty($field_conf['config'])){
|
1540 |
-
|
|
|
1541 |
foreach($field['config']['option'] as $option_id=>$option){
|
1542 |
if(is_array($value)){
|
1543 |
if( in_array( $option['value'], $value) ){
|
@@ -2026,6 +2028,9 @@ class Caldera_Forms {
|
|
2026 |
$out = array();
|
2027 |
foreach($form['fields'] as $field_id=>$field){
|
2028 |
|
|
|
|
|
|
|
2029 |
// filter the field to get field data
|
2030 |
$field = apply_filters( 'caldera_forms_render_get_field', $field, $form);
|
2031 |
$field = apply_filters( 'caldera_forms_render_get_field_type-' . $field['type'], $field, $form);
|
@@ -2034,32 +2039,33 @@ class Caldera_Forms {
|
|
2034 |
$field_values = (array) self::get_field_data($field_id, $form);
|
2035 |
|
2036 |
if( isset( $field_values['label'] ) ){
|
2037 |
-
$
|
2038 |
-
if( $pre_field_values != $field_values['label'] ){
|
2039 |
-
//$pre_field_values = $field_values['label'] .' (' . $pre_field_values . ')';
|
2040 |
-
}
|
2041 |
-
$field_values = $pre_field_values;
|
2042 |
}else{
|
2043 |
-
foreach( $field_values as
|
2044 |
-
if(
|
2045 |
-
$
|
2046 |
-
if( $pre_field_value != $field_value['label'] ){
|
2047 |
-
$pre_field_value = $field_value['label'] .' (' . $field_value . ')';
|
2048 |
-
}
|
2049 |
-
$field_value = $pre_field_value;
|
2050 |
-
}else{
|
2051 |
-
//$field_value = apply_filters( 'caldera_forms_view_field_' . $field['type'], $field_value, $field, $form);
|
2052 |
}
|
2053 |
|
2054 |
}
|
2055 |
}
|
2056 |
|
2057 |
$field_value = implode(', ', (array) $field_values);
|
|
|
|
|
2058 |
|
2059 |
if($field_value !== null && strlen($field_value) > 0){
|
2060 |
$out[] = $field['label'].': '.$field_value;
|
2061 |
}
|
2062 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2063 |
if(!empty($out)){
|
2064 |
$magic_tag = implode("\r\n", $out);
|
2065 |
}
|
@@ -2117,7 +2123,8 @@ class Caldera_Forms {
|
|
2117 |
}
|
2118 |
|
2119 |
// fields
|
2120 |
-
$regex = "/%([a-zA-Z0-9_]*)%/";
|
|
|
2121 |
preg_match_all($regex, $value, $matches);
|
2122 |
if(!empty($matches[1])){
|
2123 |
foreach($matches[1] as $key=>$tag){
|
@@ -2129,37 +2136,42 @@ class Caldera_Forms {
|
|
2129 |
$entry = self::get_slug_data($tag, $form, $entry_id);
|
2130 |
|
2131 |
if($entry !== null){
|
2132 |
-
|
2133 |
-
|
2134 |
-
if( isset( $entry[$part_tags[1]] ) ){
|
2135 |
-
$entry = (array) $entry[$part_tags[1]];
|
2136 |
-
}elseif( isset( $entry['value'] ) ){
|
2137 |
-
$entry = (array) $entry['value'];
|
2138 |
-
}
|
2139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2140 |
}
|
|
|
|
|
2141 |
|
2142 |
-
|
2143 |
-
|
2144 |
-
|
2145 |
-
|
2146 |
-
|
2147 |
-
|
2148 |
-
|
2149 |
-
|
2150 |
-
|
2151 |
-
|
|
|
2152 |
}
|
2153 |
-
$value = str_replace($matches[0][$key], $entry, $value);
|
2154 |
-
}else{
|
2155 |
-
$value = str_replace($matches[0][$key], null, $value);
|
2156 |
}
|
|
|
|
|
2157 |
}
|
2158 |
}
|
2159 |
-
|
2160 |
-
if( $input_value != $value && empty( $value ) ){
|
2161 |
-
return $input_value;
|
2162 |
-
}
|
2163 |
|
2164 |
return $value;
|
2165 |
}
|
@@ -2390,14 +2402,14 @@ class Caldera_Forms {
|
|
2390 |
if(!empty($field['config']['option'])){
|
2391 |
foreach($field['config']['option'] as $option){
|
2392 |
if($option['value'] == $entry){
|
2393 |
-
$processed_data[$indexkey][$field_id] =
|
2394 |
break;
|
2395 |
}
|
2396 |
}
|
2397 |
}
|
2398 |
}
|
2399 |
}else{
|
2400 |
-
$processed_data[$indexkey][$field_id] =
|
2401 |
}
|
2402 |
}else{
|
2403 |
// dynamic
|
@@ -2418,6 +2430,20 @@ class Caldera_Forms {
|
|
2418 |
|
2419 |
return null;
|
2420 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2421 |
static public function get_slug_data($slug, $form, $entry_id = false){
|
2422 |
|
2423 |
|
@@ -3499,14 +3525,14 @@ class Caldera_Forms {
|
|
3499 |
$field = apply_filters( 'caldera_forms_render_get_field_type-' . $field['type'], $field, $form);
|
3500 |
$field = apply_filters( 'caldera_forms_render_get_field_slug-' . $field['slug'], $field, $form);
|
3501 |
|
3502 |
-
// maybe json?
|
3503 |
-
$is_json = json_decode( $field_value, ARRAY_A );
|
3504 |
-
if( !empty( $is_json ) ){
|
3505 |
-
$field_value = $is_json;
|
3506 |
-
}
|
3507 |
-
|
3508 |
if( is_string( $field_value ) ){
|
3509 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
3510 |
}
|
3511 |
|
3512 |
$data['data'][$field_id] = array(
|
@@ -3840,7 +3866,7 @@ class Caldera_Forms {
|
|
3840 |
|
3841 |
// check for prev post
|
3842 |
$prev_data = apply_filters( 'caldera_forms_render_pre_get_entry', array(), $form, $entry_id);
|
3843 |
-
|
3844 |
// load requested data
|
3845 |
if(!empty($entry_id)){
|
3846 |
$prev_entry = self::get_entry($entry_id, $form);
|
@@ -3852,7 +3878,6 @@ class Caldera_Forms {
|
|
3852 |
$prev_data = apply_filters( 'caldera_forms_render_get_entry', $prev_data, $form, $entry_id);
|
3853 |
}
|
3854 |
|
3855 |
-
|
3856 |
if(!empty($_GET['cf_er'])){
|
3857 |
$prev_post = get_transient( $_GET['cf_er'] );
|
3858 |
if(!empty($prev_post['transient'])){
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Caldera Forms.
|
5 |
*
|
1537 |
continue;
|
1538 |
}
|
1539 |
// auto
|
1540 |
+
if(!empty($field_conf['config'])){
|
1541 |
+
$binddown = json_encode( $field_conf['config']['config'] );
|
1542 |
+
if( false !== strpos($binddown, $field['ID']) || false !== strpos($field_conf['config']['manual_formula'], $field['ID']) ){
|
1543 |
foreach($field['config']['option'] as $option_id=>$option){
|
1544 |
if(is_array($value)){
|
1545 |
if( in_array( $option['value'], $value) ){
|
2028 |
$out = array();
|
2029 |
foreach($form['fields'] as $field_id=>$field){
|
2030 |
|
2031 |
+
if( in_array( $field['type'], array('button', 'recaptcha', 'html' ) ) ){
|
2032 |
+
continue;
|
2033 |
+
}
|
2034 |
// filter the field to get field data
|
2035 |
$field = apply_filters( 'caldera_forms_render_get_field', $field, $form);
|
2036 |
$field = apply_filters( 'caldera_forms_render_get_field_type-' . $field['type'], $field, $form);
|
2039 |
$field_values = (array) self::get_field_data($field_id, $form);
|
2040 |
|
2041 |
if( isset( $field_values['label'] ) ){
|
2042 |
+
$field_values = $field_values['value'];
|
|
|
|
|
|
|
|
|
2043 |
}else{
|
2044 |
+
foreach( $field_values as $field_key=>$field_value ){
|
2045 |
+
if( isset( $field_value['label'] ) && isset( $field_value['value'] ) ){
|
2046 |
+
$field_value[$field_key] = $field_value['value'];
|
|
|
|
|
|
|
|
|
|
|
|
|
2047 |
}
|
2048 |
|
2049 |
}
|
2050 |
}
|
2051 |
|
2052 |
$field_value = implode(', ', (array) $field_values);
|
2053 |
+
|
2054 |
+
|
2055 |
|
2056 |
if($field_value !== null && strlen($field_value) > 0){
|
2057 |
$out[] = $field['label'].': '.$field_value;
|
2058 |
}
|
2059 |
}
|
2060 |
+
// vars
|
2061 |
+
if( !empty( $form['variables'] ) ){
|
2062 |
+
foreach( $form['variables']['keys'] as $var_key=>$var_label ){
|
2063 |
+
if( $form['variables']['types'][ $var_key ] == 'entryitem' ){
|
2064 |
+
$label = ucfirst( str_replace('_', ' ', $var_label ) );
|
2065 |
+
$out[] = $label . ': ' . $form['variables']['values'][ $var_key ];
|
2066 |
+
}
|
2067 |
+
}
|
2068 |
+
}
|
2069 |
if(!empty($out)){
|
2070 |
$magic_tag = implode("\r\n", $out);
|
2071 |
}
|
2123 |
}
|
2124 |
|
2125 |
// fields
|
2126 |
+
$regex = "/%([a-zA-Z0-9_:]*)%/";
|
2127 |
+
|
2128 |
preg_match_all($regex, $value, $matches);
|
2129 |
if(!empty($matches[1])){
|
2130 |
foreach($matches[1] as $key=>$tag){
|
2136 |
$entry = self::get_slug_data($tag, $form, $entry_id);
|
2137 |
|
2138 |
if($entry !== null){
|
2139 |
+
$field = self::get_field_by_slug( $tag, $form );
|
2140 |
+
}
|
|
|
|
|
|
|
|
|
|
|
2141 |
|
2142 |
+
|
2143 |
+
if( !empty( $field ) && !empty( $part_tags[1] ) && $part_tags[1] == 'label' ){
|
2144 |
+
if( !is_array( $entry ) ){
|
2145 |
+
$entry = (array) $entry;
|
2146 |
+
}
|
2147 |
+
foreach( (array) $entry as $entry_key=>$entry_line ){
|
2148 |
+
if( !empty( $field['config']['option'] ) ){
|
2149 |
+
foreach( $field['config']['option'] as $option ){
|
2150 |
+
if( $option['value'] == $entry_line ){
|
2151 |
+
$entry[$entry_key] = $option['label'];
|
2152 |
+
}
|
2153 |
+
}
|
2154 |
}
|
2155 |
+
}
|
2156 |
+
}
|
2157 |
|
2158 |
+
if(is_array($entry)){
|
2159 |
+
|
2160 |
+
if(count($entry) === 1){
|
2161 |
+
$entry = array_shift($entry);
|
2162 |
+
}elseif(count($entry) === 2){
|
2163 |
+
$entry = implode(', ', $entry);
|
2164 |
+
}elseif(count($entry) > 2){
|
2165 |
+
$last = array_pop($entry);
|
2166 |
+
$entry = implode(', ', $entry).', '.$last;
|
2167 |
+
}else{
|
2168 |
+
$entry = null;
|
2169 |
}
|
|
|
|
|
|
|
2170 |
}
|
2171 |
+
|
2172 |
+
$value = str_replace($matches[0][$key], $entry, $value);
|
2173 |
}
|
2174 |
}
|
|
|
|
|
|
|
|
|
2175 |
|
2176 |
return $value;
|
2177 |
}
|
2402 |
if(!empty($field['config']['option'])){
|
2403 |
foreach($field['config']['option'] as $option){
|
2404 |
if($option['value'] == $entry){
|
2405 |
+
$processed_data[$indexkey][$field_id] = self::do_magic_tags($entry);
|
2406 |
break;
|
2407 |
}
|
2408 |
}
|
2409 |
}
|
2410 |
}
|
2411 |
}else{
|
2412 |
+
$processed_data[$indexkey][$field_id] = self::do_magic_tags($field['config']['default']);
|
2413 |
}
|
2414 |
}else{
|
2415 |
// dynamic
|
2430 |
|
2431 |
return null;
|
2432 |
}
|
2433 |
+
static public function get_field_by_slug($slug, $form){
|
2434 |
+
|
2435 |
+
foreach($form['fields'] as $field_id=>$field){
|
2436 |
+
|
2437 |
+
if($field['slug'] == $slug){
|
2438 |
+
|
2439 |
+
return apply_filters( 'caldera_forms_render_get_field', $field, $form );
|
2440 |
+
|
2441 |
+
}
|
2442 |
+
}
|
2443 |
+
|
2444 |
+
return false;
|
2445 |
+
|
2446 |
+
}
|
2447 |
static public function get_slug_data($slug, $form, $entry_id = false){
|
2448 |
|
2449 |
|
3525 |
$field = apply_filters( 'caldera_forms_render_get_field_type-' . $field['type'], $field, $form);
|
3526 |
$field = apply_filters( 'caldera_forms_render_get_field_slug-' . $field['slug'], $field, $form);
|
3527 |
|
|
|
|
|
|
|
|
|
|
|
|
|
3528 |
if( is_string( $field_value ) ){
|
3529 |
+
// maybe json?
|
3530 |
+
$is_json = json_decode( $field_value, ARRAY_A );
|
3531 |
+
if( !empty( $is_json ) ){
|
3532 |
+
$field_value = $is_json;
|
3533 |
+
}else{
|
3534 |
+
$field_value = esc_html( stripslashes_deep( $field_value ) );
|
3535 |
+
}
|
3536 |
}
|
3537 |
|
3538 |
$data['data'][$field_id] = array(
|
3866 |
|
3867 |
// check for prev post
|
3868 |
$prev_data = apply_filters( 'caldera_forms_render_pre_get_entry', array(), $form, $entry_id);
|
3869 |
+
|
3870 |
// load requested data
|
3871 |
if(!empty($entry_id)){
|
3872 |
$prev_entry = self::get_entry($entry_id, $form);
|
3878 |
$prev_data = apply_filters( 'caldera_forms_render_get_entry', $prev_data, $form, $entry_id);
|
3879 |
}
|
3880 |
|
|
|
3881 |
if(!empty($_GET['cf_er'])){
|
3882 |
$prev_post = get_transient( $_GET['cf_er'] );
|
3883 |
if(!empty($prev_post['transient'])){
|
fields/calculation/config.php
CHANGED
@@ -56,7 +56,7 @@
|
|
56 |
<br>
|
57 |
<div id="{{_id}}_operator_groups" class="calculation-groups-wrap"></div>
|
58 |
<input type="hidden" class="block-input field-config calculation-formular" name="{{_name}}[formular]" id="{{_id}}_formular" value="{{formular}}">
|
59 |
-
<input type="hidden" class="block-input field-config ajax-trigger" data-request="build_calc_structure" data-callback="{{_id}}_build_formula" data-init="{{_id}}_build_formula" data-event="none" data-autoload="true" data-template="#calculator-group-tmpl" data-target="#{{_id}}_operator_groups" name="{{_name}}[config]" id="{{_id}}_config" value="{{config}}">
|
60 |
</div>
|
61 |
<div id="{{_id}}_manualbox" style="display:none;">
|
62 |
<textarea name="{{_name}}[manual_formula]" class="field-config block-input">{{manual_formula}}</textarea>
|
@@ -68,9 +68,8 @@
|
|
68 |
|
69 |
|
70 |
function {{_id}}_build_formula(obj){
|
71 |
-
|
72 |
build_calculations_formular('{{_id}}', obj);
|
73 |
-
|
74 |
};
|
75 |
|
76 |
jQuery('#{{_id}}_operator_groups').on('change', 'select', function(e){
|
56 |
<br>
|
57 |
<div id="{{_id}}_operator_groups" class="calculation-groups-wrap"></div>
|
58 |
<input type="hidden" class="block-input field-config calculation-formular" name="{{_name}}[formular]" id="{{_id}}_formular" value="{{formular}}">
|
59 |
+
<input type="hidden" class="block-input field-config ajax-trigger" data-request="build_calc_structure" data-callback="{{_id}}_build_formula" data-init="{{_id}}_build_formula" data-event="none" data-autoload="true" data-type="json" data-template="#calculator-group-tmpl" data-target="#{{_id}}_operator_groups" name="{{_name}}[config]" id="{{_id}}_config" value="{{#if config/group}}{{json config}}{{else}}{{config}}{{/if}}">
|
60 |
</div>
|
61 |
<div id="{{_id}}_manualbox" style="display:none;">
|
62 |
<textarea name="{{_name}}[manual_formula]" class="field-config block-input">{{manual_formula}}</textarea>
|
68 |
|
69 |
|
70 |
function {{_id}}_build_formula(obj){
|
|
|
71 |
build_calculations_formular('{{_id}}', obj);
|
72 |
+
rebind_field_bindings();
|
73 |
};
|
74 |
|
75 |
jQuery('#{{_id}}_operator_groups').on('change', 'select', function(e){
|
fields/calculation/line-templates.php
CHANGED
@@ -43,6 +43,7 @@ function build_calc_structure(obj){
|
|
43 |
if(obj.trigger.val().length){
|
44 |
config = JSON.parse(obj.trigger.val());
|
45 |
config.init = obj.trigger.data('init');
|
|
|
46 |
}
|
47 |
return config;
|
48 |
}
|
@@ -135,7 +136,7 @@ function build_calculations_formular(id, obj){
|
|
135 |
if(typeof obj === 'undefined'){
|
136 |
formular_input.val(formula);
|
137 |
config_input.val(JSON.stringify(config));
|
138 |
-
}
|
139 |
}
|
140 |
jQuery(function($){
|
141 |
$('body').on('click', '.calculation-add-line', function(e){
|
43 |
if(obj.trigger.val().length){
|
44 |
config = JSON.parse(obj.trigger.val());
|
45 |
config.init = obj.trigger.data('init');
|
46 |
+
console.log( config );
|
47 |
}
|
48 |
return config;
|
49 |
}
|
136 |
if(typeof obj === 'undefined'){
|
137 |
formular_input.val(formula);
|
138 |
config_input.val(JSON.stringify(config));
|
139 |
+
}
|
140 |
}
|
141 |
jQuery(function($){
|
142 |
$('body').on('click', '.calculation-add-line', function(e){
|
fields/phone/config.php
CHANGED
@@ -14,9 +14,9 @@
|
|
14 |
<label><?php _e('Style'); ?></label>
|
15 |
<div class="caldera-config-field">
|
16 |
<label><input type="radio" class="field-config {{_id}}_type local" name="{{_name}}[type]" value="local" {{#is type value="local"}}checked="checked"{{/is}}> <?php _e('Local', 'caldera-forms'); ?></label>
|
17 |
-
<p class="description">(999)999
|
18 |
<label><input type="radio" class="field-config {{_id}}_type international" name="{{_name}}[type]" value="international" {{#is type value="international"}}checked="checked"{{/is}}> <?php _e('International', 'caldera-forms'); ?></label>
|
19 |
-
<p class="description">+99
|
20 |
<label><input type="radio" class="field-config {{_id}}_type custom" name="{{_name}}[type]" value="custom" {{#is type value="custom"}}checked="checked"{{/is}}> <?php _e('Custom'); ?></label>
|
21 |
<p class="description"><input type="text" id="{{_id}}_custom" class="field-config" name="{{_name}}[custom]" value="{{custom}}"></p>
|
22 |
<p class="description"><?php echo __('Use the digit 9 to indicate a number', 'caldera-forms'); ?></p>
|
@@ -29,9 +29,9 @@
|
|
29 |
$('.{{_id}}_type').change(function(){
|
30 |
|
31 |
if(this.value === 'local'){
|
32 |
-
$('#{{_id}}_default').inputmask("(999)999
|
33 |
}else if(this.value === 'international'){
|
34 |
-
$('#{{_id}}_default').inputmask("+99
|
35 |
}else if(this.value === 'custom'){
|
36 |
$('#{{_id}}_default').inputmask( $('#{{_id}}_custom').val() );
|
37 |
}
|
14 |
<label><?php _e('Style'); ?></label>
|
15 |
<div class="caldera-config-field">
|
16 |
<label><input type="radio" class="field-config {{_id}}_type local" name="{{_name}}[type]" value="local" {{#is type value="local"}}checked="checked"{{/is}}> <?php _e('Local', 'caldera-forms'); ?></label>
|
17 |
+
<p class="description">(999) 999 9999</p>
|
18 |
<label><input type="radio" class="field-config {{_id}}_type international" name="{{_name}}[type]" value="international" {{#is type value="international"}}checked="checked"{{/is}}> <?php _e('International', 'caldera-forms'); ?></label>
|
19 |
+
<p class="description">+99 99 999 9999</p>
|
20 |
<label><input type="radio" class="field-config {{_id}}_type custom" name="{{_name}}[type]" value="custom" {{#is type value="custom"}}checked="checked"{{/is}}> <?php _e('Custom'); ?></label>
|
21 |
<p class="description"><input type="text" id="{{_id}}_custom" class="field-config" name="{{_name}}[custom]" value="{{custom}}"></p>
|
22 |
<p class="description"><?php echo __('Use the digit 9 to indicate a number', 'caldera-forms'); ?></p>
|
29 |
$('.{{_id}}_type').change(function(){
|
30 |
|
31 |
if(this.value === 'local'){
|
32 |
+
$('#{{_id}}_default').inputmask("(999) 999 9999");
|
33 |
}else if(this.value === 'international'){
|
34 |
+
$('#{{_id}}_default').inputmask("+99 99 999 9999");
|
35 |
}else if(this.value === 'custom'){
|
36 |
$('#{{_id}}_default').inputmask( $('#{{_id}}_custom').val() );
|
37 |
}
|
fields/phone/field.php
CHANGED
@@ -5,7 +5,7 @@ if(!empty($field['config']['placeholder'])){
|
|
5 |
|
6 |
$mask = '(999)999-9999';
|
7 |
if($field['config']['type'] == 'international'){
|
8 |
-
$mask = '+99
|
9 |
}
|
10 |
|
11 |
?><?php echo $wrapper_before; ?>
|
5 |
|
6 |
$mask = '(999)999-9999';
|
7 |
if($field['config']['type'] == 'international'){
|
8 |
+
$mask = '+99 99 999 9999';
|
9 |
}
|
10 |
|
11 |
?><?php echo $wrapper_before; ?>
|
readme.txt
CHANGED
@@ -3,44 +3,61 @@ Contributors: Desertsnowman, Shelob9
|
|
3 |
Tags: forms, formbuilder, form builder, contact form, contact, custom form, custom forms, forms creator, caldera forms
|
4 |
Requires at least: 3.9
|
5 |
Tested up to: 4.2
|
6 |
-
Stable tag: 1.
|
7 |
License: GPLv2
|
8 |
|
9 |
-
|
10 |
|
11 |
== Description ==
|
12 |
-
|
13 |
|
14 |
-
Easy enough for everyday users to create forms, and powerful enough for
|
15 |
|
16 |
A free plugin by <a href="https://CalderaWP.com" title="CalderaWP: Transform Your WordPress Experience">CalderaWP</a>.
|
17 |
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
20 |
* [Documentation](http://docs.calderaforms.com/)
|
21 |
-
* [Report Issues](https://github.com/Desertsnowman/Caldera-Forms)
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
= A Few Feature Highlights =
|
30 |
-
*
|
31 |
-
*
|
32 |
-
*
|
|
|
33 |
* Export and Import forms across installations
|
34 |
-
* Ajax or Page reload
|
35 |
* Multi-page forms
|
36 |
-
*
|
37 |
-
*
|
38 |
* File Uploads
|
39 |
|
40 |
= Auto Values & Magic Tags =
|
41 |
-
Capture system values,
|
42 |
|
43 |
-
= Current Available Fields
|
44 |
* Calculation
|
45 |
* Range Slider
|
46 |
* Star Rating
|
@@ -64,7 +81,6 @@ Everything can be extended. For developers, there are enough hooks and filters t
|
|
64 |
|
65 |
For issues and updates - Caldera Forms is on [GitHub](https://github.com/Desertsnowman/Caldera-Forms)
|
66 |
|
67 |
-
|
68 |
== Installation ==
|
69 |
|
70 |
Upload the caldera-forms folder to /wp-content/plugins/
|
@@ -78,17 +94,37 @@ none yet.
|
|
78 |
|
79 |
== Screenshots ==
|
80 |
1. **Layout Builder** - Easy to use Drag & Drop grid based layout.
|
81 |
-
2. **
|
82 |
-
3. **
|
|
|
83 |
|
84 |
== Changelog ==
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
= 1.1.9.10 ( April, 2015) =
|
87 |
* error on checkboxes and array tag showing
|
88 |
|
89 |
= 1.1.9.9 ( April, 2015) =
|
90 |
|
91 |
-
= Critical Bug
|
92 |
* on php 5.3 widget forms and function render forms gave "permission denied" error. solved.
|
93 |
|
94 |
= 1.1.9.8 ( April, 2015) =
|
3 |
Tags: forms, formbuilder, form builder, contact form, contact, custom form, custom forms, forms creator, caldera forms
|
4 |
Requires at least: 3.9
|
5 |
Tested up to: 4.2
|
6 |
+
Stable tag: 1.2.0
|
7 |
License: GPLv2
|
8 |
|
9 |
+
Create beautiful, responsive forms with a simple drag and drop editor.
|
10 |
|
11 |
== Description ==
|
12 |
+
A diffent kind of WordPress form builder. With an intuitive drag and drop interface -– based on a responsive grid -- and a wide range of add-ons, it’s never been easier to create forms for your WordPress site that look great on any device, thanks to Caldera Forms. This free plugin includes all of the form types you want, mail and redirect processors, entry logging and AJAX submissions.
|
13 |
|
14 |
+
Easy enough for everyday users to create forms, and powerful enough for PHP experts to extend.
|
15 |
|
16 |
A free plugin by <a href="https://CalderaWP.com" title="CalderaWP: Transform Your WordPress Experience">CalderaWP</a>.
|
17 |
|
18 |
+
Pippin Williamson of Easy Digital Downloads, Restrict Content Pro and AffiliateWP gives Caldera Forms a 5 star rating!
|
19 |
+
|
20 |
+
John Teague of Theme Surgeons includes Caldera Forms in his list of WordPress plugin recommendations I don’t get paid for.
|
21 |
+
|
22 |
+
= Docs & More Information =
|
23 |
+
* [More Information](https://calderawp.com/downloads/caldera-forms/)
|
24 |
* [Documentation](http://docs.calderaforms.com/)
|
|
|
25 |
|
26 |
+
|
27 |
+
= Addons =
|
28 |
+
[All Add-ons](https://calderawp.com/caldera-forms-add-ons/)
|
29 |
+
|
30 |
+
= Free Add-ons =
|
31 |
+
* [Verify Email for Caldera Forms](https://calderawp.com/downloads/verify-email-for-caldera-forms/) - Send an email with a validate link to verify the email address before completing the form submission.
|
32 |
+
* [Form as Metabox - Custom Fields](https://calderawp.com/downloads/caldera-form-metabox/) - Use a Caldera Form as a metabox in the post editor to save custom field values.
|
33 |
+
* [Slack Integration for Caldera Forms](https://calderawp.com/downloads/caldera-forms-slack-integration/) - Get notifications in Slack whenever a Caldera Form is submitted.
|
34 |
+
* [Run Action](https://calderawp.com/downloads/caldera-forms-run-action/) - Trigger a WordPress action with your form submission.
|
35 |
+
* [Sprout Invoices Integration](https://wordpress.org/plugins/caldera-forms-sprout-invoices-integration/) - Use Caldera Forms for [Sprout Invoice](https://sproutapps.co/sprout-invoices/) forms.
|
36 |
+
* [Conditional Fail](https://wordpress.org/plugins/conditional-fail-for-caldera-forms/) - Set conditions to cause that if met will allow or prevent form submssion.
|
37 |
+
|
38 |
+
= Premium Add-Ons =
|
39 |
+
* [MailChimp](https://calderawp.com/downloads/caldera-forms-mailchimp-add-on/) - Seamlessly integrate MailChimp optins into your forms
|
40 |
+
* [Stripe](https://calderawp.com/downloads/caldera-forms-stripe-add-on/) - Accept credit card payments via Stripe.
|
41 |
+
* [PayPal Express](https://calderawp.com/downloads/caldera-forms-paypal-express-add-on/) - Accept payments via Paypal Express.
|
42 |
+
* [Users](https://calderawp.com/downloads/caldera-forms-users-add/) - Register or login users from your form.
|
43 |
+
* [Geolocation](https://calderawp.com/downloads/geolocation-field-for-caldera-forms/) - Make a text field a geolocation auto-complete field and recorded geocoded data.
|
44 |
+
* [Mark Viewed](https://calderawp.com/downloads/caldera-forms-mark-viewed/) - Let users track what content they have viewed.
|
45 |
|
46 |
= A Few Feature Highlights =
|
47 |
+
* Drag and drop responsive form builder.
|
48 |
+
* Responsive grid is based on Bootstrap 3
|
49 |
+
* Process forms without a page load using AJAX
|
50 |
+
* Advanced conditional logic for hidding and showing fields.
|
51 |
* Export and Import forms across installations
|
|
|
52 |
* Multi-page forms
|
53 |
+
* Emails sent on form submission are easily customized and can include a CSV file of entry data.
|
54 |
+
* Configurable auto-responder and redirections.
|
55 |
* File Uploads
|
56 |
|
57 |
= Auto Values & Magic Tags =
|
58 |
+
Capture system values, form data, user data and use it populate form fields values, variables, or in response emails.
|
59 |
|
60 |
+
= Current Available Fields =
|
61 |
* Calculation
|
62 |
* Range Slider
|
63 |
* Star Rating
|
81 |
|
82 |
For issues and updates - Caldera Forms is on [GitHub](https://github.com/Desertsnowman/Caldera-Forms)
|
83 |
|
|
|
84 |
== Installation ==
|
85 |
|
86 |
Upload the caldera-forms folder to /wp-content/plugins/
|
94 |
|
95 |
== Screenshots ==
|
96 |
1. **Layout Builder** - Easy to use Drag & Drop grid based layout.
|
97 |
+
2. **Form Processors** - With many processors available and more coming, each form can handle submissions in very unique and powerful ways.
|
98 |
+
3. **Stackable, condition based Form Processors** - Add as many form processors as needed and add conditions for each to create specific processing flow based on user input.
|
99 |
+
4. **Great Looking Forms** - Create great looking forms.
|
100 |
|
101 |
== Changelog ==
|
102 |
|
103 |
+
= 1.2.0 ( April, 2015) =
|
104 |
+
|
105 |
+
= Bugs Fixed =
|
106 |
+
* Exports on checkboxes caused issues
|
107 |
+
* calculation caused problems
|
108 |
+
* Fixed the slug:label magic tag...again.
|
109 |
+
|
110 |
+
= Improvements =
|
111 |
+
* Updated the visual styles
|
112 |
+
* Added additional actions and filters
|
113 |
+
* imroved saving speed
|
114 |
+
|
115 |
+
|
116 |
+
= 1.1.10 ( April, 2015) =
|
117 |
+
|
118 |
+
= Bugs Fixed =
|
119 |
+
* deleting entries in bulk, disabled form. - fixed.
|
120 |
+
* viewing entries occationally gave a blank modal.
|
121 |
+
|
122 |
= 1.1.9.10 ( April, 2015) =
|
123 |
* error on checkboxes and array tag showing
|
124 |
|
125 |
= 1.1.9.9 ( April, 2015) =
|
126 |
|
127 |
+
= Critical Bug fix =
|
128 |
* on php 5.3 widget forms and function render forms gave "permission denied" error. solved.
|
129 |
|
130 |
= 1.1.9.8 ( April, 2015) =
|
screenshot-1.png
CHANGED
Binary file
|
screenshot-2.png
CHANGED
Binary file
|
screenshot-3.png
CHANGED
Binary file
|
screenshot-4.png
ADDED
Binary file
|
ui/admin.php
CHANGED
@@ -38,7 +38,7 @@ $modal_new_form = __('Create Form', 'caldera-forms').'|{"data-action" : "create_
|
|
38 |
<a class="button ajax-trigger" data-request="start_new_form" data-modal-buttons='<?php echo $modal_new_form; ?>' data-modal-width="600" data-modal-height="400" data-load-class="none" data-modal="new_form" data-modal-title="<?php echo __('Create New Form', 'caldera-forms'); ?>" data-template="#new-form-tmpl"><?php echo __('New Form', 'caldera-forms'); ?></a>
|
39 |
</li>
|
40 |
<li class="caldera-forms-toolbar-item">
|
41 |
-
<a class="button ajax-trigger" data-request="start_new_form" data-modal-width="400" data-modal-height="192" data-load-class="none" data-modal="new_form" data-template="#import-form-tmpl" data-modal-title="<?php echo __('Import Form', 'caldera-forms'); ?>" ><?php echo __('Import', 'caldera-forms'); ?></a>
|
42 |
</li>
|
43 |
<li class="caldera-forms-toolbar-item">
|
44 |
|
@@ -95,7 +95,7 @@ $modal_new_form = __('Create Form', 'caldera-forms').'|{"data-action" : "create_
|
|
95 |
|
96 |
<div class="row-actions">
|
97 |
<span class="edit"><a class="form-control" href="admin.php?page=caldera-forms&edit=<?php echo $form_id; ?>"><?php echo __('Edit'); ?></a> | </span>
|
98 |
-
<span class="edit"><a class="form-control
|
99 |
data-load-element="#form_row_<?php echo $form_id; ?>"
|
100 |
data-action="toggle_form_state"
|
101 |
data-active-element="#form_row_<?php echo $form_id; ?>"
|
@@ -177,7 +177,7 @@ function new_form_redirect(obj){
|
|
177 |
function serialize_modal_form(el){
|
178 |
|
179 |
var clicked = jQuery(el),
|
180 |
-
data =
|
181 |
name = data.find('.new-form-name');
|
182 |
|
183 |
//verify name is set
|
38 |
<a class="button ajax-trigger" data-request="start_new_form" data-modal-buttons='<?php echo $modal_new_form; ?>' data-modal-width="600" data-modal-height="400" data-load-class="none" data-modal="new_form" data-modal-title="<?php echo __('Create New Form', 'caldera-forms'); ?>" data-template="#new-form-tmpl"><?php echo __('New Form', 'caldera-forms'); ?></a>
|
39 |
</li>
|
40 |
<li class="caldera-forms-toolbar-item">
|
41 |
+
<a class="button ajax-trigger" data-request="start_new_form" data-modal-width="400" data-modal-height="192" data-modal-element="div" data-load-class="none" data-modal="new_form" data-template="#import-form-tmpl" data-modal-title="<?php echo __('Import Form', 'caldera-forms'); ?>" ><?php echo __('Import', 'caldera-forms'); ?></a>
|
42 |
</li>
|
43 |
<li class="caldera-forms-toolbar-item">
|
44 |
|
95 |
|
96 |
<div class="row-actions">
|
97 |
<span class="edit"><a class="form-control" href="admin.php?page=caldera-forms&edit=<?php echo $form_id; ?>"><?php echo __('Edit'); ?></a> | </span>
|
98 |
+
<span class="edit"><a class="form-control ajax-trigger" href="#entres"
|
99 |
data-load-element="#form_row_<?php echo $form_id; ?>"
|
100 |
data-action="toggle_form_state"
|
101 |
data-active-element="#form_row_<?php echo $form_id; ?>"
|
177 |
function serialize_modal_form(el){
|
178 |
|
179 |
var clicked = jQuery(el),
|
180 |
+
data = jQuery('#new_form_baldrickModal'),
|
181 |
name = data.find('.new-form-name');
|
182 |
|
183 |
//verify name is set
|
ui/admin_templates.php
CHANGED
@@ -28,7 +28,7 @@
|
|
28 |
</div>
|
29 |
</div>
|
30 |
|
31 |
-
<div class="
|
32 |
|
33 |
<button type="submit" class="button button-primary" style="float:right;"><?php echo __('Import Form', 'caldera-forms'); ?></button>
|
34 |
|
@@ -41,7 +41,6 @@
|
|
41 |
</form>
|
42 |
</script>
|
43 |
<script type="text/html" id="new-form-tmpl">
|
44 |
-
<form class="new-form-form ajax-trigger" data-action="create_form" data-active-class="disabled" data-load-class="disabled" data-callback="new_form_redirect" data-before="serialize_modal_form" data-modal-autoclose="new_form">
|
45 |
<?php
|
46 |
do_action('caldera_forms_new_form_template_start');
|
47 |
?>
|
@@ -61,7 +60,6 @@
|
|
61 |
<?php
|
62 |
do_action('caldera_forms_new_form_template_end');
|
63 |
?>
|
64 |
-
</form>
|
65 |
</script>
|
66 |
<script type="text/html" id="forms-list-alt-tmpl">
|
67 |
|
@@ -104,36 +102,26 @@
|
|
104 |
</script>
|
105 |
<script type="text/html" id="view-entry-tmpl">
|
106 |
{{#if user}}
|
107 |
-
<div class="
|
108 |
-
<span class="user-avatar user-avatar-{{user/ID}}"{{#if user/name}} title="{{user/name}}"{{/if}}>
|
109 |
{{{user/avatar}}}
|
110 |
-
</
|
111 |
-
{{#if meta}}
|
112 |
-
<ul class="modal-side-tabs">
|
113 |
-
<li><a href="#main-entry-panel" class="modal-side-tab active"><?php echo __('Entry', 'caldera-forms'); ?></a></li>
|
114 |
-
{{#each meta}}
|
115 |
-
<li><a href="#meta-{{@key}}" class="modal-side-tab">{{name}}</a></li>
|
116 |
-
{{/each}}
|
117 |
-
</ul>
|
118 |
-
{{/if}}
|
119 |
-
</div>
|
120 |
{{/if}}
|
121 |
-
|
122 |
-
<div id="main-entry-panel" class="tab-detail-panel">
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
</div>
|
132 |
|
133 |
|
134 |
{{#if meta}}
|
135 |
{{#each meta}}
|
136 |
-
<div id="meta-{{@key}}" class="tab-detail-panel"
|
137 |
<h4>{{name}}</h4>
|
138 |
<hr>
|
139 |
{{#unless template}}
|
@@ -153,7 +141,7 @@
|
|
153 |
</div>
|
154 |
{{/each}}
|
155 |
{{/if}}
|
156 |
-
|
157 |
</script>
|
158 |
<script type="text/javascript">
|
159 |
|
28 |
</div>
|
29 |
</div>
|
30 |
|
31 |
+
<div class="baldrick-modal-footer" style="display: block; clear: both; position: relative; height: 27px; width: 100%; margin: 0px -12px;">
|
32 |
|
33 |
<button type="submit" class="button button-primary" style="float:right;"><?php echo __('Import Form', 'caldera-forms'); ?></button>
|
34 |
|
41 |
</form>
|
42 |
</script>
|
43 |
<script type="text/html" id="new-form-tmpl">
|
|
|
44 |
<?php
|
45 |
do_action('caldera_forms_new_form_template_start');
|
46 |
?>
|
60 |
<?php
|
61 |
do_action('caldera_forms_new_form_template_end');
|
62 |
?>
|
|
|
63 |
</script>
|
64 |
<script type="text/html" id="forms-list-alt-tmpl">
|
65 |
|
102 |
</script>
|
103 |
<script type="text/html" id="view-entry-tmpl">
|
104 |
{{#if user}}
|
105 |
+
<div class="user-avatar user-avatar-{{user/ID}}"{{#if user/name}} title="{{user/name}}"{{/if}} style="margin-top:-1px;">
|
|
|
106 |
{{{user/avatar}}}
|
107 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
{{/if}}
|
109 |
+
|
110 |
+
<div id="main-entry-panel" class="tab-detail-panel" data-tab="<?php _e('Entry', 'caldera-forms'); ?>">
|
111 |
+
<h4><?php echo __('Submitted', 'caldera-forms'); ?> <small class="description">{{date}}</small></h4>
|
112 |
+
<hr>
|
113 |
+
{{#each data}}
|
114 |
+
<div class="entry-line">
|
115 |
+
<label>{{label}}</label>
|
116 |
+
<div>{{#if view/label}}{{view/value}}{{else}}{{{view}}}{{/if}} </div>
|
117 |
+
</div>
|
118 |
+
{{/each}}
|
119 |
+
</div>
|
120 |
|
121 |
|
122 |
{{#if meta}}
|
123 |
{{#each meta}}
|
124 |
+
<div id="meta-{{@key}}" data-tab="{{name}}" class="tab-detail-panel">
|
125 |
<h4>{{name}}</h4>
|
126 |
<hr>
|
127 |
{{#unless template}}
|
141 |
</div>
|
142 |
{{/each}}
|
143 |
{{/if}}
|
144 |
+
|
145 |
</script>
|
146 |
<script type="text/javascript">
|
147 |
|
ui/edit.php
CHANGED
@@ -111,9 +111,10 @@ $field_options_template = "
|
|
111 |
</select>
|
112 |
|
113 |
</div>
|
114 |
-
</div>
|
115 |
-
|
116 |
-
|
|
|
117 |
|
118 |
</div>
|
119 |
<div class=\"caldera-config-group-toggle-options\">
|
@@ -295,7 +296,9 @@ function field_wrapper_template($id = '{{id}}', $label = '{{label}}', $slug = '{
|
|
295 |
data-modal="field_setup"
|
296 |
data-modal-title="<?php echo __('Elements', 'caldera-forms'); ?>"
|
297 |
data-template="#form-fields-selector-tmpl"
|
298 |
-
data-modal-width="
|
|
|
|
|
299 |
id="<?php echo $id; ?>" style="display:none;">
|
300 |
|
301 |
<div class="toggle_option_tab">
|
@@ -792,7 +795,7 @@ do_action('caldera_forms_edit_end', $element);
|
|
792 |
}
|
793 |
}
|
794 |
ksort($sorted_field_types);
|
795 |
-
echo '<div class="modal-side-bar">';
|
796 |
echo '<ul class="modal-side-tabs">';
|
797 |
foreach($sorted_field_types as $cat=>$template){
|
798 |
|
@@ -803,13 +806,13 @@ do_action('caldera_forms_edit_end', $element);
|
|
803 |
$cat_class = '';
|
804 |
}
|
805 |
echo "</ul>\r\n";
|
806 |
-
echo "</div>\r\n"
|
807 |
$cat_show = false;
|
808 |
foreach($sorted_field_types as $cat=>$template){
|
809 |
if(!empty($cat_show)){
|
810 |
$cat_show = 'style="display: none;"';
|
811 |
}
|
812 |
-
echo '<div id="modal-category-'. sanitize_key( $cat ) .'" class="tab-detail-panel" '.$cat_show.'>';
|
813 |
echo $template;
|
814 |
echo '</div>';
|
815 |
$cat_show = true;
|
111 |
</select>
|
112 |
|
113 |
</div>
|
114 |
+
</div>";
|
115 |
+
ob_start();
|
116 |
+
do_action( 'caldera_forms_autopopulate_type_config' );
|
117 |
+
$field_options_template .= ob_get_clean() . "
|
118 |
|
119 |
</div>
|
120 |
<div class=\"caldera-config-group-toggle-options\">
|
296 |
data-modal="field_setup"
|
297 |
data-modal-title="<?php echo __('Elements', 'caldera-forms'); ?>"
|
298 |
data-template="#form-fields-selector-tmpl"
|
299 |
+
data-modal-width="700"
|
300 |
+
data-modal-height="680"
|
301 |
+
|
302 |
id="<?php echo $id; ?>" style="display:none;">
|
303 |
|
304 |
<div class="toggle_option_tab">
|
795 |
}
|
796 |
}
|
797 |
ksort($sorted_field_types);
|
798 |
+
/*echo '<div class="modal-side-bar">';
|
799 |
echo '<ul class="modal-side-tabs">';
|
800 |
foreach($sorted_field_types as $cat=>$template){
|
801 |
|
806 |
$cat_class = '';
|
807 |
}
|
808 |
echo "</ul>\r\n";
|
809 |
+
echo "</div>\r\n";*/
|
810 |
$cat_show = false;
|
811 |
foreach($sorted_field_types as $cat=>$template){
|
812 |
if(!empty($cat_show)){
|
813 |
$cat_show = 'style="display: none;"';
|
814 |
}
|
815 |
+
echo '<div id="modal-category-'. sanitize_key( $cat ) .'" data-tab="' . esc_attr( $cat ) . '" class="tab-detail-panel" '.$cat_show.'>';
|
816 |
echo $template;
|
817 |
echo '</div>';
|
818 |
$cat_show = true;
|
ui/panels/emailer.php
CHANGED
@@ -117,6 +117,8 @@ if(!isset($element['mailer']['enable_mailer'])){
|
|
117 |
</div>
|
118 |
</div>
|
119 |
|
|
|
|
|
120 |
</div>
|
121 |
</div>
|
122 |
<div class="mailer-errors" style="display:none;">
|
117 |
</div>
|
118 |
</div>
|
119 |
|
120 |
+
<?php do_action( 'caldera_forms_mailer_config', $element ); ?>
|
121 |
+
|
122 |
</div>
|
123 |
</div>
|
124 |
<div class="mailer-errors" style="display:none;">
|
ui/panels/layout.php
CHANGED
@@ -103,7 +103,7 @@ foreach( (array) $element['layout_grid']['structure'] as $page_key=>$page_struct
|
|
103 |
</div>
|
104 |
<?php } ?>
|
105 |
</div>
|
106 |
-
|
107 |
<script type="text/html" id="grid-page-tmpl">
|
108 |
<div class="layout-grid-panel layout-grid" data-page="{{page_no}}" data-name="<?php echo __('Page', 'caldera-forms'); ?> {{count}}" style="display:none;" id="{{page_no}}">
|
109 |
<div class="first-row-level row">
|
103 |
</div>
|
104 |
<?php } ?>
|
105 |
</div>
|
106 |
+
<?php do_action( 'caldera_forms_layout_config', $element ); ?>
|
107 |
<script type="text/html" id="grid-page-tmpl">
|
108 |
<div class="layout-grid-panel layout-grid" data-page="{{page_no}}" data-name="<?php echo __('Page', 'caldera-forms'); ?> {{count}}" style="display:none;" id="{{page_no}}">
|
109 |
<div class="first-row-level row">
|
ui/panels/layout_side.php
CHANGED
@@ -7,4 +7,5 @@ if(!empty($field_config_panels)){
|
|
7 |
echo implode("\r\n", $field_config_panels);
|
8 |
}
|
9 |
|
10 |
-
?></div>
|
|
7 |
echo implode("\r\n", $field_config_panels);
|
8 |
}
|
9 |
|
10 |
+
?></div>
|
11 |
+
<?php do_action( 'caldera_forms_layout_sidebar', $element ); ?>
|
ui/panels/pages.php
CHANGED
@@ -8,6 +8,7 @@
|
|
8 |
<div id="page_name_bind">
|
9 |
|
10 |
</div>
|
|
|
11 |
<script type="text/html" id="page-name-tmpl">
|
12 |
<div class="caldera-config-group">
|
13 |
<label><?php echo __('Page', 'caldera-forms'); ?> {{page_no}}</label>
|
8 |
<div id="page_name_bind">
|
9 |
|
10 |
</div>
|
11 |
+
<?php do_action( 'caldera_forms_pages_config', $element ); ?>
|
12 |
<script type="text/html" id="page-name-tmpl">
|
13 |
<div class="caldera-config-group">
|
14 |
<label><?php echo __('Page', 'caldera-forms'); ?> {{page_no}}</label>
|
ui/panels/processors.php
CHANGED
@@ -164,7 +164,8 @@ function build_processor_types($default = null){
|
|
164 |
data-modal="form_processor"
|
165 |
data-load-class="none"
|
166 |
data-modal-title="<?php echo __('Form Processors', 'caldera-forms'); ?>"
|
167 |
-
data-modal-height="
|
|
|
168 |
data-template="#form-processors-tmpl"
|
169 |
data-callback="hide_single_processors"
|
170 |
><?php echo __('Add Processor', 'caldera-forms'); ?></button>
|
164 |
data-modal="form_processor"
|
165 |
data-load-class="none"
|
166 |
data-modal-title="<?php echo __('Form Processors', 'caldera-forms'); ?>"
|
167 |
+
data-modal-height="700"
|
168 |
+
data-modal-width="600"
|
169 |
data-template="#form-processors-tmpl"
|
170 |
data-callback="hide_single_processors"
|
171 |
><?php echo __('Add Processor', 'caldera-forms'); ?></button>
|
ui/panels/variables.php
CHANGED
@@ -38,6 +38,7 @@ if(!isset($element['variables'])){
|
|
38 |
|
39 |
?>
|
40 |
</div>
|
|
|
41 |
<script type="text/html" id="variable-fields-tmpl">
|
42 |
<div class="caldera-config-group">
|
43 |
<label style="padding:2px 0;"><input type="text" class="block-input field-config set-system-variable" name="config[variables][keys][]" value=""></label>
|
38 |
|
39 |
?>
|
40 |
</div>
|
41 |
+
<?php do_action( 'caldera_forms_variables_config', $element ); ?>
|
42 |
<script type="text/html" id="variable-fields-tmpl">
|
43 |
<div class="caldera-config-group">
|
44 |
<label style="padding:2px 0;"><input type="text" class="block-input field-config set-system-variable" name="config[variables][keys][]" value=""></label>
|