/* Licensed under the MIT license * jQuery.my 1.2.14, (c) 2017 ermouth * Requires jQuery 2.0+, SugarJS 1.3.9-1.4.x * More details at jquerymy.com */ !function(a){function b(){window.console&&console.error.apply(console,arguments)}function c(){window.console&&console.log.apply(console,arguments)}function d(a,b){return"hasOwnProperty"!=b?a.hasOwnProperty(b):!!("hasOwnProperty"in a)}function e(b){return a.contains(document.documentElement,b[0])}function f(a,b){return Array.prototype.slice.call(a,b||0)}function g(a,b,c){var d=0,e=a.length,f=!0;if(a===b)return"===";if("==="==c)return"";if(e!=b.length)return"";for(;e>d&&f;d++)f=a[d]===b[d];if(f)return"==";if("=="==c)return"";for(f=!0;e>d&&f;d++)f=Object.equal(a[d],b[d]);return f?"=":""}function h(a,b){return(ib(b)?b.split("."):gb(b)?b:[""]).reduce(function(a,b){if(null!=a){if(/=/.test(b)){var c=b.split("=",2);return jb(a)?Object.values(a).find(function(a){return jb(a)||gb(a)?a[c[0]]==c[1]:!1}):gb(a)?a.find(function(a){return jb(a)||gb(a)?a[c[0]]==c[1]:!1}):void 0}if(null!=a&&null!=a[b])return a[b]}return void 0},a)}function i(a){var b=a.my();return b?b.root?b.root.my():b:null}function j(a){var b,c={},d=function(){return null};if(ib(a))a.split(/[,\s]+/).compact(!0).unique().map(function(a){c[a]=d});else if(gb(a))a.compact(!0).unique().map(function(a){c[a]=d});else if(jb(a))for(b in a)c[b]=mb(a[b])?a[b]:function(){return a[b]};return c}function k(a){var b,c=a,d={};if(ib(c)&&(c=c.split(/[,\s]+/)),gb(c)){for(c=c.compact(!0),b=0;b$/.test(y.list)?f=y.list:i=y.list||i,!f){var l=">*"==i?a(d[0].children):p(d,i,!0);f="
",l.length&&(f=a(f).append(l.eq(0).clone(!0)).html(),l.eq(0).remove())}d.data("formlist")||d.data("formlist",{}),d.data("formlist").generator={manifest:t,delay:(y.delay||w.delay||10)/1.3,template:f,selector:i,parent:B,bind:y.bind,merge:mb(y.merge)?y.merge.bind(B):y.merge?n:!1,hash:mb(y.hash)?y.hash.bind(B):ib(y.hash)?k.fill(void 0,y.hash):gb(y.hash)?m.fill(void 0,y.hash.slice(0)):null,id:mb(y.id)?y.id.bind(B):ib(y.id)?k.fill(void 0,y.id):gb(y.id)?m.fill(void 0,y.id.slice(0)):null,ext:!(!y.id&&!y.hash),stamp:0},d.on("insert.my",function(b,c){b.stopPropagation();var d={what:void 0,where:0};null==c?d.where=1e6:jb(c)?qb(d,c):(ib(c)||kb(c))&&(d.where=c),a(b.target).my("insert",d.where,d.what)}),d.on("remove.my",function(b){b.stopPropagation(),a(b.target).my("remove")})}else try{b=K.call(d,r(B,t),jb(e)?e:void 0)}catch(q){j("$.my subform init of "+g+" failed: "+q.message,q.stack)}}nb(b)?b.then(o,function(a,b){j("Init of subform "+g+" failed with error: "+a,b)}):o()}function j(a,c){b(a,c),z&&z.reject(a,c)}function k(a,b){var c=h(a,b)||"";return"string"==typeof c?c:l(c)}function m(a,b){return l(D(a,b))}function o(){d.each(function(){var b,c,h,i=a(this),j=i[0].nodeName,k=!1;if("TEXTAREA"==j&&(h=i[0].nextSibling,c=h&&h.CodeMirror?h.CodeMirror:null,c&&i.addClass("my-codemirror")),b=y.events||N(i,Cb.events),i.hasClass("my-form")?tb(i.data("my"),{dui:y,root:e,selector:g,dparams:w,devents:b,ddata:v.data,container:w.container(i),derrors:v.errors,single:!0}):(i.data("my",{events:b,selector:g,initial:s,previous:s,root:e,container:w.container(i),id:v.id,ui:y,data:v.data,params:w,errors:v.errors,single:1==C}),f._update=y.delay?O.debounce(y.delay):wb,k=!0),k)if(i.cleditor&&i.parent().hasClass("cleditorMain")){var l=i.cleditor()[0];if(l&&l.$frame&&l.$frame[0]){i.addClass("my-cleditor"),tb(i.data("my"),{container:w.container(i)});var m,n=function(a){i.val(a).trigger(eb)},o=Number.random(1e5,1e6-1);a(l.$frame[0]).attr("id","cleditCool"+o),m=document.frames?document.frames["cleditCool"+o].document:a("#cleditCool"+o)[0].contentWindow.document;var p=a(m).find("body");a(m).on("keyup.my",function(){n(a(this).find("body").html())}),i.parent().find("div.cleditorToolbar").on("click.my mouseup.my",function(){n(p.html())}),a("body").on("click","div.cleditorPopup",function(){n(p.html())})}}else if("TEXTAREA"==j&&i.parent().hasClass("redactor_box")){var q,r="my-redactor-9";try{q=i.getEditor(),r="my-redactor-8"}catch(t){q=i.redactor("getEditor")}q&&(i.addClass(r),q.on("input.my keyup.my blur.my",function(a){a.trigger("redactor")}.fill(i)))}else i.hasClass("ace_editor")?ace.edit(d[0]).on(eb,function(a){a.trigger("ace")}.fill(i)):c&&c.on(eb,function(a){a.trigger("codemirror")}.fill(i));i.my()._changed=x.debounce(u),i.my()._recalc=I.debounce(u),i.on(b,function(a){a.type==eb&&a.stopPropagation(),k&&(v.locktill=Ab()+f.delay),i.my()._changed(i,e,f,w)}),/check(\.my)?/.test(b+"")||i.on("check.my",function(){return i.my()._changed(i,e,f,w,!0),!1}),k||i.off("redraw.my"),i.on("recalc.my, redraw.my",function(a){a.stopPropagation(),i.my()._recalc(i,e,f,w)})}),z&&z.resolve()}var q,s,t,u,v=e.my(),w=(v||{}).params,y=f,z=null,A=0,B=v.manifest,C=0|d.length;return v?(u=f.delay,C?(y.init!=wb&&(q=H(B,y.init,d,v)),nb(q)?(A+=1,z=ub(),q.then(i,function(a,b){j("Init of "+g+" failed: "+a,b)})):i()):c("Not found "+g+" selector.",e),z):(b("Failed to find $root building "+g+" selector."),null)}function w(c,d){jb(d)&&d.channel&&d.message&&p(c,".my-listen-"+l(d.channel),!0).each(function(){var c,e=a(this),f=e.data("my"),g=void 0;if(f&&f.ui.listen&&mb(f.ui.listen[d.channel])){c=f.ui.listen[d.channel];try{g=c.call(f.manifest||f.root.my().manifest,f.data,d.message,e)}catch(h){b("Listener failed",h.message,h.stack)}void 0!==g&&(null===g?e.trigger("check"):g&&e.trigger("recalc"))}})}function x(a,b,c,d,e){{var f,g=a.data("my");b.data("my")}g&&(g.disabled?g.ddata||O(a,wb,c.recalcDepth||d.recalcDepth):(B(g.ddata||g.data,g.dparams||g.params),e||(f=g.single?a:p(b,g.selector)),O(a,e?wb:A(f,wb),c.recalcDepth||d.recalcDepth),d.change&&d.change.call(a)))}function y(b,c,d){var e=d.compact(),f=e.replace(/:disabled/g,""),g=f!==e,h="self:"===f.to(5);return h&&(f=f.replace(/^self:/g,"")),c.each(function(){var d=a(this),e=d.my(),i=!h&&e?e.container:d;i.toggleClass(f,!!b),g&&void 0!==e&&!!b!=!!e.disabled&&(d.my().disabled=!!b,e._disable||(d.my()._disable=N(c,Cb.offon).fill(void 0,c)),e._disable(!!b))}),c}function z(a,b,c){return a[b](c?"disable":"enable")}function A(a,b){var c,d,e=a.data("myval");return e||(d=N(a,Cb.vals),mb(d)&&(c=d(a,wb),void 0===c?a.data("myval",function(a,b){return wb!=b&&d(a,b),a.val()}.fill(a,void 0)):a.data("myval",d.fill(a,void 0))),e=a.data("myval")),mb(e)?(c=e(),(c!==b&&(0==b||0==c)||c!=b||jb(b))&&(c=e(b)),c):wb}function B(a,b,c,d){var e,f,g,h,i,j,k,l,m,n=b;if(!jb(n)||isNaN(h=n.remember)||!jb(e=n.history))return wb;if(jb(a)&&h){if(j=rb(a,!0),k=Ab(),g=sb(e).sort(),g.length&&(k-g.last()=2*h){for(m={},f=h;2*h>f;f++)m[g[f]]=e[g[f]];b.history=m}return d||n.form.trigger(eb),n.history[g.last()]}if(!isNaN(a)||a===wb){if(i=parseInt(a)||0,0>i)return wb;if(g=sb(e).sort(),i>=g.length&&(i=g.length-1),l=rb(n.history[g[g.length-i-1]],!0),c){for(m={},f=0;f=i;i++)if(i===h){if(d)return wb!=b?e[f[i]]=b:void 0===e[f[i]]&&(e[f[i]]=wb),e[f[i]];e[f[i]]=b}else 0===i?(e=a[f[0]],g=a):(g=g[f[i-1]],e=e[f[i]]),(null==e||!jb(e)&&(gb(e)&&!isNaN(f[i+1])&&+f[i]>-1))&&(e=g[f[i]]={});return a}function G(a,b,c){var e=jb(b)?b:null;return Object.each(a,function(b,c){var d=typeof c;/^str|^fu/.test(d)&&(a[b]={bind:c})}),Object.each(a,function(b,f){var g,i,k,l=[],m=[],n=/\s?[,;]\s?/;f.recalc&&(ib(f.recalc)?l=f.recalc.split(n):gb(f.recalc)&&(l=f.recalc),l=l.compact(!0).unique()),l.length&&(a[b].recalc=l),null==f.bind&&(f.bind=function(){});var o;if(f.listen&&(o=j(f.listen),f.listen=Object.size(o)?o:void 0),d(f,"events")&&(f.events=(f.events+"").replace(/,\s*|\s+/g," ")),d(f,"watch"))for(ib(f.watch)?m=f.watch.split(n):gb(f.watch)&&(m=f.watch.slice(0)),m=m.compact(!0).unique(),k=0;ki&&h.resolve()}var d,e,f,g=!1,h=ub(),i=a.length;for(e=0;i>e;e++)d=a[e],f=ib(d.ajax)?w.loader:yb,f(d.ajax).then(function(a,d){fb.test(d.ref)&&(null!=a?tb(!0,b,E(a,d.ref.from(5))):(g=!0,v.push("Invalid data for ‘"+d.ref+"’ resource."))),c()}.fill(void 0,d)).fail(function(a,b){v.push("Failed to load ‘"+b.ref+"’ resource."),g=!0,c()}.fill(void 0,d));return h.promise()}function i(a){var c=!1;return fb.test(a)?null!=h(b,a.from(5))&&(c=!0):null!=h(window,a)&&(c=!0),c}function j(a){for(var b in a)a[b]===!1&&(a[b]=i(b));return a}var k,l,m,n,o,p,q,r,s=ub(),t=[],u={},v=[],w=tb(!0,{ajaxTimeout:1e4,loader:Cb.params.loader},c||{}),x={ref:null,ajax:{type:"GET",async:!0,timeout:w.ajaxTimeout}};if(jb(b))if(gb(b.require)){for(n=b.require,k=0;k'+f+""}!_.style||b&&!sb.is(":visible")||(S=L(sb,_),S&&S[0].length&&!b&&(V=a("style#"+T),V.length||(V=a(c(S[0],T)).appendTo(a("body"))),V.data("count",1*V.data("count")+1),sb.data("my").style=V),S&&S[1].length&&(Z=a("style#"+U),Z.length?b&&(a(c(S[1],U)).replaceAll(Z),Z=a("style#"+U)):(Z=a(c(S[1],U)).appendTo(a("body")),Q.restyle>-1&&!pb[J]&&(pb[J]=function(){q(!0)}.debounce(Q.restyle)),sb.data("my").restyle=q.fill(!0).debounce(0)),sb.data("my").localStyle=Z,b||sb.addClass("my-restyle")))}function r(){var a,b,c=!0;if(b=t(_),ib(b))B("Error decoding base64 to local Blob/URL",b),c=!1;else{if(W)for(a=0;a*").clone();try{$=H(_,R.init,sb,R)}catch(b){return B(ib(b)?b:b.message,b.stack),sb}}if(nb($)?$.then(function(){x()},function(a,b){B(a,b)}):x(),!hb){if(!sb.my())return B("Internal error initializing controls.",""),sb;sb.data("my").initial=tb(!0,{},bb),a.mobile&&a.mobile.changePage(a.mobile.activePage)}}function x(){function a(a){hb||(b[a]=A(p(sb,a),wb),d-=1,.5>d&&y(b))}var b={},c=Object.keys(O),d=c.length;0===d?z():(sb.addClass(lb),c.forEach(function(b){if(!hb){var c=p(sb,b),d=v(c,sb,O[b],b);rb[b]=c,nb(d)?d.then(a.fill(b)).fail(function(a,c){B("Error building "+b+", "+a,c)}):hb||a(b)}}))}function y(a){var c,d,e,f,g;for(g in O){if(hb)return;if(c=O[g],e=rb[g],f=e.length){c.listen&&(eb[g]=e.eq(0));try{d=u(bb,wb,c,e),d==wb&&a[g]!=wb&&void 0!==d&&u(bb,a[g],c,e)}catch(h){b("Transient fail linking "+g+" of form $('.my-form-"+J+"')",h.message,h.stack)}try{d!=wb&&A(e,d),e.eq(0).trigger("check.my")}catch(h){B("Error linking "+g,h.message,h.stack)}}}z()}function z(){sb.removeClass(lb),sb.on("recalc.my, redraw.my",function(a){a.stopPropagation(),sb.my("redraw")}),qb=null,fb.resolve(bb)}function B(a,c){var d;if(hb=!0,b("Form "+I+" failed to initialize.",a,c),Object.keys(rb).forEach(function(a){delete rb[a]}),sb.removeClass(lb),d=kb(a,c),ib(d)||jb(d)&&d.jquery?sb.html(d):d===!0&&sb.html(qb),Q.silent)fb.resolve(bb);else{if(!sb.my().ddata){if(sb.removeData("my"),sb.removeClass("my-form"),V)if("1"==V.data("count"))try{V.remove()}catch(e){}else V.data("count",V.data("count")-1);if(Z)try{delete pb[J],Z.remove()}catch(e){}}fb.reject("Form "+I+" failed to initialize: "+a,c)}}var D,F,I,J,K,N,O,Q,R,S,T,U,V,Z,$,_={},bb={},cb=null,db=[],eb={},fb=ub(),hb=!1,kb=function(){},lb="my-form-init",ob="std",qb="",rb={};if(ib(d)){if(D=zb(d),!D)return fb.reject("No manifest with id "+d+" found in repo."),fb.promise();jb(f)&&jb(e)?(D=tb(D,e),F=f):F=e,ob="repo"}else D=d,F=e;if(!D)return this;R=jb(F)&&"repo"!=ob?tb(!0,{},D):D;var sb=this.eq(0),vb=sb.my();return jb(vb)&&vb.id&&vb.ui?(c("jQuery.my is already bound.",sb),sb.my("ui",R.ui),sb.my(ab,R.data),fb.resolve(sb.my(ab)).promise()):(Q=R.params||{},Q.strict||mb(R.init)||(Q=tb(!0,{},Q),P(Q)),Q=tb(!0,{},Cb.params,Q),fb.fail(function(){sb.removeClass(U+" "+T)}),tb(sb,fb.promise()),jb(F)?(bb=m(F,R.data||{}),R.data=bb):bb=R.data||{},_.data=bb,sb.data("my",{data:bb,params:Q,promise:fb.promise(),locktill:0}),sb.addClass(lb),R.inherit&&i(R),gb(R.require)?Bb(R,Q).then(g).fail(function(a){o(),B("Linker of the ‘require’ property failed.",a)}):g(),fb.then(n),sb)}function L(a,b){function c(e,f,g,h){var i,j,k,l,m,n=e,o=/@/.test(f),p=f.split("@")[0],q=mb(n);if(o&&(q?h:g).push("@"+f.split("@")[1].trim()+" {"),ib(n)&&(/[\r\n]/.test(n)||n.split("}",3).length>2?n=Db.css2json(n):g.push(p+(/\{/.test(n)?n:"{"+n+"}"))),gb(n)&&n.length)for(i=0;ie)return d=i,e=g,void 0;j==_&&c(a,i,g+1)}wb!=b[""]&&typeof b[""]!=_&&g>e&&(d=b[""],e=g)}var d=wb,e=0,f="";return c(a,b,1),d}function O(a,c,d){var e,f,g,h,i,j,k,l,m,n,o,q,r=!1,s=!1,t=a,v=t.my(),w="";if(v){if(m=v.selector,n=v.root,n.hasClass("my-form-init"))return{};if(o=p(n,m),q=n.my().ui,r=a.hasClass("my-form"),r?(f=a,g=v.ddata,h=v.dui,i=v.dparams):(f=v.container,g=v.data,h=v.ui,i=v.params),h.bind!=wb){if(j=xb(c)?c:A(o,u(g,wb,h,o)),wb!=h.check){w="Unknown error";try{w=U(g,j,h,o)}catch(x){b("Error "+x.message+" in .check validator for "+m,n,x.stack)}}var z=i.errorCss,B="ui-state-error";try{wb!=c&&(j=A(o,u(g,c,h,o)))}catch(x){w=i.messages.formError||"Error"}if(wb!=h.check)if(s=a.hasClass("my-form-list"),""==w&&(r||f.hasClass(z)))r?v.derrors[m]="":v.errors[m]="",f.removeClass(z),f.attr("title")&&f.attr("title",""),r||s||i.effect(p(f,i.errorTip),!1,i.animate/2),t.removeClass(B),p(t,".ui-widget").removeClass(B);else if(w){if(r)v.derrors[m]=w;else if(s)v.errors[m]=w;else{f.addClass(z),v.errors[m]=w;var C=p(f,i.errorTip);C.length?i.effect(C.addClass(z).html(ib(w)?w:"Error"),!0,i.animate):f.attr("title",(ib(w)?w:"Error").stripTags())}t.hasClass("hasDatepicker")&&(t.is("input")?t.addClass(B):p(t,".ui-widget").addClass(B)),t.hasClass("ui-slider")&&t.addClass(B)}}var D=c==wb?j:c;if(h.css)for(k in h.css)l=h.css[k],lb(l)?y(l.test(D),o,k):mb(l)&&y(l.call(n.my().manifest,g,D,o),o,k);var e,E,F=h.recalc,G=[],H={};if(d&&h.recalc&&n.my()){for(q=n.my().ui,e=0;e-1?"":o;case"s":return c==k?"":o;case"o":return k[c]?"":o;case"b":return e.hasClass("my-form-list")?(h=e.data("listSrc")||e.data("my").listSrc||">*",j={},l=0,(">*"==h?a(e[0].children):p(e,h,!0)).each(function(){var b=a(this);b.hasClass("ui-sortable-placeholder")||(b.data("my")&&!b.my("valid")&&(j[l]=b.my("errors")),l+=1)}),j):e.hasClass("my-form")&&k?e.my("valid")?"":e.my("errors"):""}return m.formError||"Error"}return""}var V="1.2.14",W=window.URL||window.webkitURL,X=!document.addEventListener,Y=((window.navigator.language||window.navigator.userLanguage||"en")+"").split("-")[0].toLowerCase(),Z="{yyyy}-{MM}-{dd}",$="{HH}:{mm}",_="object",ab="data",bb="array",cb="string",db="function",eb="change",fb=/^this\./,gb=Object.isArray,hb=Object.isBoolean,ib=Object.isString,jb=Object.isObject,kb=Object.isNumber,lb=Object.isRegExp,mb=Object.isFunction,nb=function(a){return null!=a&&typeof a==_&&mb(a.then)},ob=h(a,"my.f.repo")?a.my.f.repo():{_src:{},_name:"Default manifest cache"},pb=h(a,"my.f.restyles")?a.my.f.restyles():{},qb=Object.merge,rb=Object.clone,sb=Object.keys,tb=a.extend,ub=a.Deferred,vb=a.type,wb=null,xb=function(a){return null!==a&&void 0!==a},yb=a.ajax,zb=q,Ab=Date.now,Bb=J,Cb={vals:{".my-form":function(a,b){if(a&&a.my){var c=a.my(ab);return Object.equal(c,b)?c:a.my(ab,b,!0)}return b||wb},".hasDatepicker":function(a,b){xb(b)&&a.datepicker("setDate",""==b?b:Date.create(b));var c=a.datepicker("getDate");return c?c.format(Z):""},".my-tags":function(a,b){return xb(b)&&(ib(b)||kb(b)?a.tags(ab,[b+""]):gb(b)&&a.tags(ab,b)),a.tags(ab)},".ui-draggable":function(a,b){if(xb(b)&&jb(b)){var c={};isNaN(b.left)||(c.left=Number(b.left).ceil(2)+"px"),isNaN(b.top)||(c.top=Number(b.top).ceil(2)+"px"),(c.left||c.top)&&a.css(c)}var d=a.position();return{left:b&&!isNaN(b.left)?(1*b.left).ceil(2):d.left.ceil(2),top:b&&!isNaN(b.top)?(1*b.top).ceil(2):d.top.ceil(2)}},".my-form-list":function(b,c){function e(){var c,d,e=a(this),f=e.data("my");f&&(c=e.data("formlist"),d=c.index,c.hash=w(f.data,d)+"",c.oid=x!==w?x(f.data,d)+"":c.hash),b.trigger("check.my")}function f(a){a.data("my").locktill+z/1.3.my-form",t=!!q.merge,u=q.template||"
",v=/\{/.test(u),w=q.hash||l,x=q.id||l,y=q.ext,z=q.delay||50,A="ui-sortable",B="."+A+"-placeholder",C=b.is("."+A),D=!!b.children(B).length,E=[],F=[],G=Ab(),H=b.find(C?b.sortable("option","items"):s);if(xb(c)&&gb(c)){if(D)return c;if(i=[],j={},H.each(function(){var b,c=a(this),d=c.data("my");d&&(i.push(d.data),!t&&(b=c.data("formlist"))&&(j[b.oid]=d.data))}),m=g(i,c,"=="),!m){var I=[],J=[],L={},M={};for(F=[],h=0;h1.4*z||G-q.stamp>100||!q.stashed||q.stashed.length!==H.length-(D?1:0)){D&&(o=b.find(">."+A+"-helper"));var N=0;for(H.each(function(b,c){var d,e,f,g=a(c),h=!1;D&&g.hasClass(A+"-helper")||(D&&g.hasClass(A+"-placeholder")&&(g=o),d=g.data("my"),e=g.data("formlist"),d&&e&&(E.push(d.data),N!=e.index&&(e.index=N,h=!0),y&&(f=w(d.data,N)+"",f!==e.hash&&(e.hash=f,h=!0)),N+=1,h&&F.push(g)))}),h=0;h-1){var f=b.eq(d);f.is(":checked")||(f.prop("checked",!0),e&&f.checkboxradio("refresh"))}else e||b.each(function(){a(this).prop("checked",!1)})}if(-1==d)for(var g=0;gForm init failed

',ru:'

Ошибка инициализации формы

'},badInput:{en:"Invalid input",ru:"Неверное значение"},patternMismatch:{en:"Pattern mismatch",ru:"Не соответствует шаблону"},rangeOverflow:{en:"Over maximum",ru:"Больше максимума"},rangeUnderflow:{en:"Under minimum",ru:"Меньше минимума"},stepMismatch:{en:"Step mismatch",ru:"Не кратно шагу"},tooLong:{en:"Too long",ru:"Слишком длинно"},typeMismatch:{en:"Invalid type",ru:"Неверный тип"},valueMissing:{en:"Required",ru:"Обязательное поле"}},events:{".hasDatepicker":"change.my check.my",".my-form,.my-tags":"change.my check.my",".ui-slider":"slide.my check.my","div.redactor_box textarea":"redactor.my check.my",".my-codemirror":"codemirror.my check.my",".ace_editor":"ace.my check.my",".my-form-list":"sortupdate.my check.my",".ui-sortable":"sortchange.my sortupdate.my check.my",".ui-draggable":"drag.my dragstop.my check.my","a, .pseudolink, input[type=button], button":"click.my","img, :radio, :checkbox":"click.my check.my","div.select2-container+input,div.select2-container+select":"change.my check.my input.my",".ui-buttonset,input, select, textarea":"blur.my change.my check.my"+("Micro"===navigator.appName.to(5)?" keyup.my":" input.my"),"":"check.my"},containers:{"*[data-role='fieldcontain'] *":{"input,textarea,select,button,:radio":function(a){return a.parents('[data-role="fieldcontain"]').eq(0)}},"div.redactor_box textarea":function(a){return a.parents("div.redactor_box").eq(0).parent()},".my-tags,.hasDatepicker,.ui-widget,input,textarea,select,button":{".my-cleditor":function(a){return a.parents("div.cleditorMain").eq(0).parent()},"":function(b){var c=b[0].parentNode,d=c.nodeName;return/^(div|span|a|p|form|fieldset|li|ul|td|th|h\d)$/i.test(d)?a(c):b.parents("div,span,a,p,form,fieldset,li,ul,td,th,h1,h2,h3,h4,h5,h6").eq(0)}},"":function(a){return a}},offon:{".ace_editor":function(a,b){ace.edit(b[0]).setReadOnly(a)},".ui-selectable":function(a,b){z(b,"selectable",a)},".ui-slider":function(a,b){z(b,"slider",a)},".ui-draggable":function(a,b){z(b,"draggable",a)},".ui-buttonset":function(a,b){z(b,"buttonset",a)},".hasDatepicker":function(a,b){z(b,"datepicker",a)},".my-form":function(a,b){b.my("disabled",!!a)},"div.select2-container+input,div.select2-container+select":function(a,b){z(b,"select2",a)},".my-cleditor":function(a,b){b.cleditor()[0].disable(!!a)},"":function(a,b){b.attr("disabled",!!a)}},destroy:{".hasDatepicker":function(a){a.datepicker("destroy")},".ui-slider":function(a){a.slider("destroy")},".ui-sortable":{".my-form-list":function(b){b.find(">.my-form").each(function(){a(this).my("remove")}),b.removeClass("my-form-list"),b.sortable("destroy")},"":function(a){a.sortable("destroy")}},".my-form-list":function(b){b.find(">.my-form").each(function(){a(this).my("remove")})},".ui-draggable":function(a){a.draggable("destroy")},".my-redactor-8":function(a){a.destroyEditor(),a.removeClass("my-redactor-8")},"div.select2-container+input,div.select2-container+select":function(a){a.select2("destroy")},".my-form":function(a){a.my("remove")},textarea:{".my-codemirror":function(a){a[0].nextSibling.CodeMirror.toTextArea(),a.removeClass("my-codemirror")}}}};Cb.params={container:function(a){return N(a,Cb.containers)(a)},change:wb,recalcDepth:2,delay:0,strict:!1,restyle:-1,locale:Y,messages:Object.map(Cb.msg,function(a,b){return b[Y]||b.en}),errorTip:".my-error-tip",errorCss:"my-error",animate:0,effect:function(a,b,c){return b?a.fadeIn(c):(a.fadeOut(c),void 0)},remember:0,silent:!1,history:{},historyDelay:100,loader:function(a){var b=ub(),c=zb(a+"");return c?b.resolve(c):b.reject(null),b.promise()},ajaxTimeout:1e4};var Db={con:c,clone:function(a){return a.clone?a.clone():a},indom:e,jquix:z,overlap:n,patch:m,kickoff:o,sdbmCode:l,tojson:function(){function a(a){return 10>a?"0"+a:a}function b(a,f,g){var h,i,j,k,l=0,m=f||0,n=d;switch(g&&ib(g)&&(l=String(g).length,n=String(g).repeat(10)),(typeof a).substr(0,3)){case"str":return e(a).replace(/<\/scri/gi,"<\\u002fscri");case"num":return isFinite(a)?""+String(a):"null";case"boo":case"nul":return String(a);case"fun":return e(c(a.toString()).replace(/<\/scri/gi,"<\\u002fscri"));case"obj":if(!a)return"null";if(typeof a.toJSON===db)return b(a.toJSON(),m+(g?1:0),g);if(h=[],gb(a)){for(i=0;ii;i++)h[i]=e.charCodeAt(i);return d=new Blob([h],{type:c||"application/octet-stream"}),mb(b)?(b(d),void 0):d},base64:function(b,c,d){var e=null,f=ib(b)?b:a.my.tojson(b),g=ib(d)?"data:"+d+";base64,":"";if(c){try{e=decodeURIComponent(escape(window.atob(f)))}catch(h){e=null}if(null!==e&&/(^".*"$)|(^\[.*\]$)|(^\{.*\}$)/.test(e))try{e=Db.fromjson(e)}catch(h){e=null}return e}return g+window.btoa((d===!0?"":"")+unescape(encodeURIComponent(f)))},_s2css:L,css2json:function(a){var b="",c=(a+"").replace(/\/\*[\s\S]+\*\//gm,"").replace(/@charset[^;]+;/gim,"").replace(/[\n\t\s]+/g," ").replace(/\s*@media[^{]*\{/g,function(a){return a.to(-1).trim()+"ᴥ"}).replace(/\}/g,"}ᴥ").replace(/^\n+/g,"").replace(/[\n\s]+$/g,"").split("ᴥ").compact(!0).reduce(function(a,c){var d,e,f,g=c.trim();return"}"==g?b="":/^[^{]+\{[^\}]+\}$/.test(g)?(d=g.to(-1).split("{"),e=" "+d[0].trim(),f=d[1].trim(),";"!=f.last()&&(f+=";"),b?a[b][e]=(a[b][e]||"")+f:a[e]=(a[e]||"")+f):/^@media/.test(g)&&(a[g]={},b=g),a},{});return c}},Eb={container:function(a){return N(a,Cb.containers)(a)},data:function(a,b){var c=this;return jb(a)&&(c.my().data=n(c.my().data,a),this.my("redraw",b)),c.my().data},disabled:function(a){var b,c,d,e,f=this,g=f.my();if(!g)return void 0;if(a==wb)return g.disabled;if(a){for(c in g.ui)b=p(f,c),d=b.my(),d&&(d.predisabled=d.disabled),y(!0,b,":disabled");f.addClass("my-disabled")}else{for(c in g.ui)b=p(f,c),d=b.my(),e=!1,d&&d.predisabled&&(e=!0),y(e,b,":disabled");f.removeClass("my-disabled"),f.my("redraw")}},errors:function(){var b=a(this).my().errors,c={};for(var d in b)b[d]&&ib(b[d])&&(c[d]=b[d]),jb(b[d])&&sb(b[d]).length&&(c[d]=b[d]);return c},find:function(a){var b=this,c=b.my();return c&&c.root&&(b=c.root),b.find(a)},history:function(a,b){return B(a,this.my().params,b)},id:function(a,b){if(ib(a))return zb(a,b);var c=this.my();return c&&c.id?c.id:wb},index:function(){var a=this.my().root&&!this.my().ddata?this.my().root:this;return(a.data("formlist")||{}).index},indom:function(){return e(this)},init:K,insert:function(a,b){var c,d,e=this.hasClass("my-form-list")?this:this.my().root||this,f=e.hasClass("my-form-list")?e:e.parent(".my-form-list"),g=(e.data("formlist")||{}).index,i=b,j=f.data("formlist").generator;if(null==g&&(g=0),c=fb.test(j.bind)?h(f.my().manifest,j.bind.replace(fb,"")):h(f.my().data,j.bind),!jb(i))if(jb(j.manifest))i=rb(j.manifest.data,!0)||{};else{if(f===e)throw"No data to insert, cannot guess when manifest is a function.";i=rb(e.my().manifest.data,!0)}if("before"===a)d=g;else if("after"===a)d=g+1;else{if(isNaN(a))throw"Invalid position for insertion";d=(1*a).clamp(0,c.length)}c.add(i,d),f.trigger("redraw")},manifest:function(a){return"json"==a?Db.tojson(this.my().manifest):this.my().manifest},promise:function(a){return mb(a)&&this.my().promise.then(a),this.my().promise},radio:function(a,b){this.trigger("radio",ib(a)?{channel:a,message:b}:a)},redraw:function(a,b){var c=this,d=c.my(),e=2;return d&&jb(d.ui)&&(e=d.params.recalcDepth,Object.keys(d.ui).forEach(function(b){var d=p(c,b);O(d,a?wb:void 0,e),a||(d.hasClass("my-form")&&d.my("redraw"),d.trigger(d.hasClass("my-form-list")?"redraw":"check.my"))}),!b&&a&&c.trigger(eb)),c},remove:function(a){var b,c,d,e,f,g,h,i,j=this;if(!this.my())return wb;if(this.my().root&&!this.my().ddata&&(j=this.my().root),d=j.my(),f=d.data,h=d.cid,i=d.mid,j.unbind(".my"),jb(d)&&d.manifest&&mb(d.manifest.die))try{d.manifest.die.call(d.manifest,j,d.manifest)}catch(k){}if(b=d.style)if("1"==b.data("count"))try{b.remove()}catch(k){}else b.data("count",b.data("count")-1);if(c=d.localStyle)try{delete pb[h],c.remove()}catch(k){}if(window.URL&&(e=d.locFiles)&&e.length)for(var l=0;lg?wb:(d.params.errors&&d.params.errors.values().compact(!0).length?Object.equal(d.data,d.lastCorrect)||(g+=1):Object.equal(e[f.last()],d.data)&&(g+=1),b=B(g,d.params,!0),b&&(o(c.my().data,b),c.my("redraw")),c.my().data)},val:function(a){return A(this,a)},valid:function(){var b=a(this).my().errors,c=0;for(var d in b)b[d]&&ib(b[d])?c++:jb(b[d])&&sb(b[d]).length&&c++;return!c},version:function(){return V}},Fb=Object.keys(Eb);a.my||(a.my={}),tb(a.my,{f:a.extend({},Db),tojson:Db.tojson,fromjson:Db.fromjson,radio:function(b,c){w(a(document),ib(b)?{channel:b,message:c}:b)},rules:Cb,locale:function(a){return ib(a)?(Y=a.toLowerCase(),Cb.params.locale=Y,void 0):Y},ajax:function(a){return mb(a)?yb=a:yb.apply(this,f(arguments,0))},cache:function(a,b){return mb(a)?zb=a:zb(a,b)},now:function(a){return mb(a)?(Ab=a,void 0):Ab()},require:function(a){return mb(a)?Bb=a:Bb.apply(this,f(arguments,0))},chain:function(){function a(){if(d.length&&e){var b,c=d.shift(),f=function(){a.delay(c[1])}.once();try{b=c[0]()}catch(g){f()}nb(b)?(b.then(f,f),f.delay(c[1])):f()}}var b=1,c=1e3,d=[],e=!1,f=function(e,f,g){d.push([e,f||b,g||c]),a()};return f.delay=function(a){return isNaN(a)||(b=(a-0).clamp(0,1e6)),b},f.timeout=function(a){return isNaN(a)||(c=(a-0).clamp(1,1e6)),c},f.start=function(){e=!0,a()},f.stop=function(){e=!1},f}(),version:function(){return V}}),a.my.version.toString=function(){return V},a.fn.my=function(b){var c;if(void 0===b)return this.data("my");if(ib(b)&&"{"==b.substr(0,1)){try{c=JSON.parse(b)}catch(d){}if(c)return Eb.init.apply(this,[c].add(f(arguments,1)))}return ib(b)&&Eb[b]?Eb[b].apply(this,f(arguments,1)):ib(b)&&zb(b,"exist")?Eb.init.apply(this,arguments):typeof b!==_&&b?(a.error("Method "+b+" does not exist on jQuery.my"),void 0):Eb.init.apply(this,arguments)},a(window).off(".my").on("radio.my",function(b,c){b.stopPropagation(),w(a(document),c)}).on("resize.my",function(){for(var a in pb)try{pb[a]()}catch(b){}}.debounce(67))}(jQuery),function(a){function b(a,b,c){if(i(b))return a+b;if(j(b))return c=e(!0,c,b),a;if(h(b)&&b.length>1&&i(b[1])){for(var d,k,m,n,o,p,q,r,s=b[0],t="",u=1;u'+(s?"<"+c.labelTag+' class="'+c.labelCss+'" '+(c.label?'style="display:inline-block;width:'+c.label+";margin-left:-"+c.label+'" ':"")+">"+s+"":"")+t+""),a+t}return a}function c(a){var b=a;if(i(b)&&(b=b.split(/[\s,]/).compact(!0)),h(b)){for(var c={},d=0;d',inp:k+'text" {ext}/>',sli:k+'range" {ext}/>',dat:k+'date" {ext}/>',btn:k+'button" {ext}/>',pwd:k+'password" {ext}/>',but:"",div:"
{txt}
",spn:"{txt}",sel:"",mul:'',txt:"",err:' {txt}',msg:'
{txt}
',val:function(a){if(!h(a.vals))return"";var b=e({style:"",css:""},a);return b.txt=a.vals.reduce(function(a,b){return a+""+b+" "}," "),'{txt}'.assign(b)},"":"<{_tag} {ext}>{txt}"},txt:{sel:function(a){if(!a.vals)return"";var b=c(a.vals);return Object.keys(b).reduce(function(a,c){return a+'"},"")}},params:{styles:{num:"width:30%;",dat:"width:30%;",inp:"width:100%",pwd:"width:100%",but:"width:30%",txt:"width:100%;max-width:100%;min-height:1px;word-break:break-word;",err:"display:none",msg:"display:none"},alias:{number:"num",date:"dat",slider:"sli",textarea:"txt",input:"inp",span:"spn",select:"select",vals:"val"},row:"",rowTag:"div",rowCss:"my-row",label:"",labelTag:"span",labelCss:"my-label"},defaults:{id:"","class":"",style:"",placeholder:"",value:"",rows:1},attnames:{css:"class",plc:"placeholder",val:"value",txt:"",vals:"",tip:"title"}},m={init:function(b,c){return a(this).html(d(b,c))}};a.my||(a.my={}),a.my.formgen=d,a.fn.formgen=function(b){return i(b)&&m[b]?m[b].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof b&&b?(a.error("Method "+b+" does not exist on jQuery.formgen"),void 0):m.init.apply(this,arguments)}}(jQuery),function(a){function b(b,c,d,e){var f,g,i,j,k,n,o;if("object"==typeof c&&c.jquery)c.is("img")&&(n=c,k=c.attr("alt")||c.attr("title")||c.data("text")||"",g=n[0].naturalWidth||n[0].width,f=n[0].naturalHeight||n[0].height,1>f&&(f=1),1>g&&(g=1),j=a(window).width()-90,i=a(window).height()-90,f>i&&(g=g*(i/f)|0,f=i),g>j&&(g=j,f=f*(j/g)|0),o=300>g?300:g,h(b,{source:"image",manifest:{init:function(a){a.html(this.HTML),a.on("click.my","img:eq(0)",function(){a.trigger("cancel")})},HTML:'

',ui:{"img:eq(0)":"img",h4:{bind:"text",css:{hide:function(a,b){return!b}}}}},data:{img:n.attr("src"),text:k},esc:!0,screen:!0,width:e||o,focus:!1,global:!0,z:"1995"},d));else if(m(c)&&c.manifest)h(b,c,d);else{if(!l(c))return null;h(b,{source:"html",manifest:{init:function(a){a.html(this.HTML)},HTML:c,ui:{"div:eq(0)":function(){}}},data:{},esc:!0,focus:!1,width:e},d)}return b}var c,d,e={},f="body",g=!1,h=a.extend,i={},j=a.my.f.indom,k=(Object.isArray,Object.isBoolean),l=Object.isString,m=Object.isObject,n=Object.isNumber,o=(Object.isRegExp,Object.isFunction);if(a.fn.modal&&o(a().emulateTransitionEnd)&&(d=a.fn.modal),a(document).off(".modal"),a(document).on("keydown.modal",function(a){var b,c,d=a.keyCode;if(!1!==g&&(13===d||27===d)){if(c=g.data("modal"),b=c.form,27==d&&(c.esc||Object.equal(b.data("my").initial,b.my("data"))))return g.modal(!0),!1;if(13==d&&c.enter)return function(a){a.modal()}.fill(g).delay(50),!1}}),o(a.my.f.getref(a,"my.modal.parent"))){var p=a.my.f.getref(a,"my.modal.parent")().attr("id");p&&(f="#"+p)}e.modal=function(c,d,e){var h,i={},j=a(f),l=j.find(">.my-modal-proxy"),m={global:!0,screen:!0,done:o(d)?d:void 0,z:"1995"};return k(c)||null==c?l.modal(c):(h=a.Deferred(),b(i,c,m,e)?g?h.reject("Locked").promise():(l.length||(l=a('
').prependTo(j),l.css({position:"absolute",top:"0",left:"0",margin:"0",padding:"0",width:"1px",height:"0"})),l.modal(i)):h.reject("Invalid data").promise())},e.modal.loading=function(b){a(f).find(">.my-modal").toggleClass("my-modal-loading",!!b)},e.modal.parent=function(b){return b&&a(b).length?(f=b,void 0):a(f)},e.modal.parentBack=function(b){return b&&a(b).length?(c=b,void 0):a(c||f)},e.modal.visible=function(){return!!g},a.my||(a.my={}),a.my.modal=e.modal,a.fn.modal=function(e,p,q){function r(a){if(x=K.form,z=K.bg,y=K.root,I=K.done,B=x.my("data"),C=!1,a){try{I.call(x.my("manifest"),null,null)}catch(b){}try{j(x)?u():""}catch(b){}if(j(F)&&F.removeData("modal"),i[K.cid])try{i[K.cid].reject("Cancelled")}catch(b){}delete i[K.cid],K=null}else{try{C=I.call(x.my("manifest"),x.my("valid")?null:x.my("errors"),B)}catch(b){}if(!C){try{j(x)?u():""}catch(b){}j(F)&&F.removeData("modal"),function(){if(i[K.cid])try{i[K.cid].resolve(B)}catch(a){}delete i[K.cid],K=null}.delay(0)}}}function s(){var b,c,d=window,e=!!K.global,f=y.offset(),g=F.offset(),h=y.scrollTop();K.pos={px:f.left,py:f.top,pw:y.outerWidth(),ph:y.outerHeight(),ox:g.left,oy:g.top,ow:F.outerWidth(),oh:F.outerHeight(),ww:c,wh:b};var i=1*(K.x.match(/\-?\d+(\.\d+)?/)||[0])[0],j=1*(K.y.match(/\-?\d+(\.\d+)?/)||[0])[0],k=K.x.has("left")?-1:K.x.has("right")?1:0,l=K.y.has("top")?-1:K.y.has("bottom")?1:0,m=K.pos.ox+K.pos.ow/2-K.pos.px,o=K.pos.oy+K.pos.oh/2-K.pos.py;if(e&&(K.pos.wh=b=d.innerHeight||a(d).height(),K.pos.ww=c=d.innerWidth||a(d).width(),m=c/2,o=b/2.5),i=K.x.has("%")?K.pos.ow/100*i:i,j=K.y.has("%")?K.pos.oh/100*j:j,K.pos.pix=m,K.pos.piy=o,m=m+k*(K.pos.ow/2)+i*(k>0?-1:1)-(K.width+G)*(k+1)/2,e?(o=(b-K.height-20)/3,10>o&&(o=10)):o=o+l*(K.pos.oh/2)+j*(l>0?-1:1)-(K.height||0)*(l+1)/2,m=m.round(1),o=(o+h).round(1),K.pos.vx=m,K.pos.vy=o,K.bound!==!1&&!K.global){var p=(n(K.bound)?K.bound:0).clamp(-100,100);K.pos.pw-2*pK.pos.pw-p?K.pos.vx=K.pos.pw-p-K.width-G:K.pos.vxK.pos.ph-p?K.pos.vy=K.pos.ph-p-K.height:K.pos.vy');var c="",d=a("style#my-modal-style-"+K.cid);"top"==K.nose||"bottom"==K.nose?(c+="div.my-modal-"+K.cid+".nose-"+K.nose+":before {left:"+(K.pos.ox-K.pos.px+K.pos.ow/2-K.pos.vx)+"px!important;}",d.text(c)):("left"==K.nose||"right"==K.nose)&&(c+="div.my-modal-"+K.cid+".nose-"+K.nose+":before {top:"+(K.pos.oy-K.pos.py+K.pos.oh/2-K.pos.vy)+"px!important;}",d.text(c))}K.screen?K.global?(z.css({top:0,left:0,width:"100%",height:"100%",display:"block",position:"fixed","z-index":K.z-1}),z.css(l(K.screen)?{background:K.screen?K.screen:"rgba(18,41,72,0.88)"}:{background:K.screen?"rgba(18,41,72,0.88)":""})):z.css({top:0,left:0,position:"absolute",width:z.parent().outerWidth()+"px",height:z.parent().outerHeight()+"px",display:"block",background:l(K.screen)?K.screen:"rgba(255,255,255,0.6)","z-index":K.z-1}):z.length&&z.hide(),K.height>K.pos.wh?(w.height(K.pos.wh-30),x.css({"overflow-y":"scroll"})):x.css({"overflow-y":""}),w.animate({top:K.pos.vy+"px",opacity:"1"},K.animate)}function u(){try{x.my("remove")}catch(b){}try{y.data("modals")[K.cid]=null}catch(b){}x.parent().off(".my").remove(),j(z)&&z.off(".my"+K.cid),K.screen&&j(z)&&function(a){a&&g||z.hide(),a&&!g&&z.css({background:"rgba(18,41,72,0.88)"})}.delay(50,K.global),K.global&&(g=!1,a(document.body).css({overflow:""}))}function v(a){try{I(null,null)}catch(b){}(function(){D.reject(a)}).delay(0)}if(d){if(void 0===e&&void 0===p&&void 0===q)return d.call(this);if(m(e)&&(e.hasOwnProperty("backdrop")||e.hasOwnProperty("keyborad")||e.hasOwnProperty("show")))return d.call(this,e,p);if(l(e)&&/^(toggle|show|hide|handleUpdate)$/.test(e))return d.call(this,e,p)}var w,x,y,z,A,B,C,D=a.Deferred(),E={},F=this,G=0,H=0,I=o(p)?p:function(){return!1},J=m(e)?e:{},K=F.data("modal");if(h(F,D.promise()),K){if(null==e||k(e))return r(e),F;if(J)return v("Locked"),F}return F.is(":visible")?(J=b(E,e,{}))?J.global&&g?(v("Locked"),F):(K=h({type:"DOM",source:"manifest",form:null,modal:null,root:null,bgroot:null,caller:F,manifest:{},data:{},global:!1,screen:!1,drag:!1,focus:!0,close:!0,silent:!0,esc:!1,enter:!1,bound:!1,hardClose:!0,nose:"",width:q||300,height:null,x:"0",y:"0",z:"1901",background:"white",css:"",animate:200},J,{promise:D.promise(),cid:Number.random(268435456,4294967295).toString(16)}),K.done=o(K.done)?K.done:I,l(K.align)&&K.align&&(K.x=(K.align.match(/(left|right):\-?\d+(\.\d+)?(%|px)?/g)||["0"])[0],K.y=(K.align.match(/(top|bottom):\-?\d+(\.\d+)?(%|px)?/g)||["0"])[0]),K.width=1*(a.my.f.getref(l(K.manifest)?a.my.cache(K.manifest):K.manifest,"params.width")||K.width),K.type="DOM",F.hasClass("my-form")?(K.type="form",K.root=K.root||F):F.data("my")?(K.type="control",K.root=K.root||F.my().root):(K.root=K.root||F.parents(".my-form").eq(0),K.root.length||(K.root=a(f))),K.global?(K.root=a(f),K.bgroot=a(c||f)):K.bgroot=K.bgroot?a(K.bgroot):K.root,y=K.root,y.data("modals")||y.data("modals",{}),s(),w=a('
'),K.root.find(">.my-modal").length?w.insertAfter(K.root.find(">.my-modal").last()):w.prependTo(K.root),w.addClass("my-modal-"+K.cid),G=w.outerWidth(),H=w.outerHeight(),w.hide(),w.html('
'),x=w.find(".my-modal-form"),K.close&&(A=a(l(K.close)?K.close:'
×
').prependTo(w).on("click.my",function(){r(K.hardClose)}),A.css({"z-index":("+"===(K.z+"").to(1)?"+":"")+(1*K.z+1)})),z=K.bgroot.find(">.my-modal-screen"),K.screen&&(z.length||(z=a('').prependTo(K.bgroot)),K.esc&&z.on("click.my"+K.cid,function(){F.modal(!0)}),z.toggleClass("my-modal-screen-global",!!K.global)),F.data("modal",K),K.silent&&w.on("change.my",function(){return!1}),w.css({display:"block",height:"none",opacity:"0.005","z-index":K.z,width:"auto"}),w.css(K.global?{position:"fixed",left:"50%",top:K.pos.vy+"px",display:"block",height:"none",opacity:"0.005","z-index":K.z,width:"auto","margin-left":"-"+((K.width+G)/2).round(0)+"px"}:{position:"absolute",left:K.pos.vx+"px",top:K.pos.vy+"px",display:"block",height:"none",opacity:"0.005","z-index":K.z,width:"auto"}),x.my(K.manifest,K.data).then(function(){var b,c,d,e,f;if(h(K,{form:x,bg:z,cancel:function(){r(!0)},commit:function(){r()}}),w.data("modal",K),K.height=w.outerHeight(),"manifest"!==K.source&&(K.width=w.width()),s(),w.css({top:K.pos.vy+"px"}),t(!0),w.removeClass("my-modal-init"),y.data("modals")[K.cid]=K,i[K.cid]=D,x.on("commit.my",function(){return K.commit.delay(30),!1}).on("cancel.my",function(){return K.cancel.delay(30),!1}),w.on("layout.my",function(){t()}.debounce(30)),K.global&&(g=F,a(document.body).css({overflow:"hidden"})),K.global||!K.esc&&!K.enter||x.on("keydown.my",function(b){var c=b.keyCode;return 27==c&&K.esc?(K.cancel(),!1):13==c&&K.enter&&!a(b.target).is("textarea")?(K.commit.delay(50),!1):void 0}),K.focus===!0){e=!1,f=K.manifest.ui;for(d in f)e||(c=x.find(d),c.length&&c.is("input, textarea","button")&&(e=!0,c.focus()))}else l(K.focus)&&x.find(K.focus).focus();if(b=x.find("img").filter(function(){return""!=a(this).attr("src")}),b.length){var j=function(){"manifest"!==K.source&&w.css({width:"auto"}),t()}.after(b.length);b.each(function(){a(this).bind("load",j)})}K.drag&&a.fn.draggable&&(l(K.drag)?w.draggable({handle:K.drag}):w.draggable(),K.nose&&w.on("dragstart.my",function(){w.removeClass("nose-"+K.nose)})),w.on("mousedown.my",function(b){var c,d=[],e=a(b.currentTarget),f=e.parent(),g=+e.css("z-index"),h=g;f.length&&(c=f.find(">.my-modal").each(function(c,e){var f=+a(e).css("z-index");e!=b.currentTarget&&f>=g&&d.push([f,a(e)]),f>h&&(h=f)}),d.forEach(function(a){a[1].css("z-index",a[0]-1+"")}),e.css("z-index",h+""))}),D.notify("Ready")}).fail(function(a){try{u()}catch(b){}F.data("modal",null),D.reject(a)}),F):(v("Invalid data"),F):(v("Object must be visible"),F)}}(jQuery);