Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

smartphoto

Package Overview
Dependencies
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smartphoto - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3

examples/multiple.html

12

js/jquery-smartphoto.min.js

@@ -9,3 +9,3 @@ /**

* homepage: http://developer.a-blogcms.jp
* version: 0.3.1
* version: 0.3.2
*

@@ -21,8 +21,2 @@ * a-template:

*
* keyboard-js:
* license: MIT (http://opensource.org/licenses/MIT)
* author: creamidea
* homepage: https://github.com/creamidea/keyboard-js#readme
* version: 1.1.4
*
* morphdom:

@@ -35,3 +29,3 @@ * license: MIT (http://opensource.org/licenses/MIT)

*/
!function t(e,a,o){function i(n,s){if(!a[n]){if(!e[n]){var h="function"==typeof require&&require;if(!s&&h)return h(n,!0);if(r)return r(n,!0);var c=new Error("Cannot find module '"+n+"'");throw c.code="MODULE_NOT_FOUND",c}var d=a[n]={exports:{}};e[n][0].call(d.exports,function(t){var a=e[n][1][t];return i(a||t)},d,d.exports,t,e,a,o)}return a[n].exports}for(var r="function"==typeof require&&require,n=0;n<o.length;n++)i(o[n]);return i}({1:[function(t,e,a){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var a=0;a<e.length;a++){var o=e[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,a,o){return a&&t(e.prototype,a),o&&t(e,o),e}}(),r=t("morphdom"),n=t("delegate"),s=[],h="input paste copy click change keydown keyup contextmenu mouseup mousedown mousemove touchstart touchend touchmove compositionstart compositionend",c=h.replace(/([a-z]+)/g,"[data-action-$1],")+"[data-action]";Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e=Object(this),a=e.length>>>0,o=arguments[1],i=void 0,r=0;r<a;r++)if(i=e[r],t.call(o,i,r,e))return i}),Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){for(var e=(this.document||this.ownerDocument).querySelectorAll(t),a=e.length;--a>=0&&e.item(a)!==this;);return a>-1});var d=function(t){return document.querySelector(t)},l=function(t){for(var e=0,a=s.length;e<a;e++)for(var o=s[e],i=o.templates,r=0,n=i.length;r<n;r++)if(i[r]==t)return o;return null},u=function(t,e){if("function"==typeof t.closest)return t.closest(e)||null;for(;t;){if(t.matches(e))return t;t=t.parentElement}return null},p=function(t,e,a,o){a.split(" ").forEach(function(a){n(t,e,a,o)})};"undefined"!=typeof document&&(p(document,"[data-bind]","input change click",function(t){var e=t.delegateTarget,a=e.getAttribute("data-bind"),o=e.getAttribute("href"),i=u(e,"[data-id]").getAttribute("data-id"),r=e.value;if(o&&(r=r.replace("#","")),i){var n=l(i);"radio"===e.getAttribute("type")||("checkbox"===e.getAttribute("type")?function(){var t=[],e=document.querySelectorAll('[data-bind="'+a+'"]');[].forEach.call(e,function(e){e.checked&&t.push(e.value)})}():n.updateDataByString(a,r))}}),p(document,c,h,function(t){var e=t.delegateTarget;if(!("click"===t.type&&"select"===e.tagName||"input"===t.type&&"button"===e.getAttribute("type"))){var a=h.split(" "),o="action";a.forEach(function(a){e.getAttribute("data-action-"+a)&&t.type===a&&(o+="-"+a)});var i=e.getAttribute("data-"+o);if(i){var r=i.replace(/\(.*?\);?/,""),n=i.replace(/(.*?)\((.*?)\);?/,"$2"),s=n.split(","),c=u(e,"[data-id]").getAttribute("data-id");if(c){var d=l(c);d.e=t,d.method&&d.method[r]?d.method[r].apply(d,s):d[r]&&d[r].apply(d,s)}}}}));var f=function(){function t(e){o(this,t),this.atemplate=[],s.push(this);for(var a in e)this[a]=e[a];this.data||(this.data={}),this.templates||(this.templates=[]);for(var i=this.templates,r=i.length,n=0,h=r;n<h;n++){var c=this.templates[n],l=d("#"+c).innerHTML;this.atemplate.push({id:c,html:l})}this.setId()}return i(t,[{key:"addTemplate",value:function(t,e){this.atemplate.push({id:t,html:e}),this.templates.push(t)}},{key:"loadHtml",value:function(){var t=this.templates,e=[];return t.forEach(function(t){var a=new $.Deferred;e.push(a);var o=d("#"+t).getAttribute("src");$.ajax({url:o,type:"GET",dataType:"text"}).success(function(e){d("#"+t).innerHTML=e,a.resolve()})}),$.when.apply($,e)}},{key:"getData",value:function(){return JSON.parse(JSON.stringify(this.data))}},{key:"saveData",value:function(t){var e=JSON.stringify(this.data);localStorage.setItem(t,e)}},{key:"setData",value:function(t){for(var e in t)"function"!=typeof t[e]&&(this.data[e]=t[e])}},{key:"loadData",value:function(t){var e=JSON.parse(localStorage.getItem(t));if(e)for(var a in e)"function"!=typeof e[a]&&(this.data[a]=e[a])}},{key:"getRand",value:function(t,e){return~~(Math.random()*(e-t+1))+t}},{key:"getRandText",value:function(t){for(var e="",a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o=a.length,i=0;i<t;i++)e+=a.charAt(Math.floor(this.getRand(0,o)));return e}},{key:"setId",value:function(){for(var e=void 0,a=(t.ids,!1);;){e=this.getRandText(10);for(var o=0,i=t.ids;o<i;o++)t.ids[o]===e&&(a=!0);if(!1===a)break}this.data.aTemplate_id=e}},{key:"getDataFromObj",value:function(t,e){t=t.replace(/\[([a-zA-Z0-9._-]+)\]/g,".$1"),t=t.replace(/^\./,"");for(var a=t.split(".");a.length;){var o=a.shift();if(!(o in e))return;e=e[o]}return e}},{key:"getDataByString",value:function(t){var e=this.data;return this.getDataFromObj(t,e)}},{key:"updateDataByString",value:function(t,e){for(var a=this.data,o=t.split(".");o.length>1;)a=a[o.shift()];a[o.shift()]=e}},{key:"removeDataByString",value:function(t){for(var e=this.data,a=t.split(".");a.length>1;)e=e[a.shift()];var o=a.shift();o.match(/^\d+$/)?e.splice(Number(o),1):delete e[o]}},{key:"resolveBlock",value:function(t,e,a){var o=this,i=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):touch#([a-zA-Z0-9._-]+) -->/g),r=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):touchnot#([a-zA-Z0-9._-]+) -->/g),n=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):exist -->/g),s=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):empty -->/g);if(i)for(var h=0,c=i.length;h<c;h++){var d=i[h];d=d.replace(/([a-zA-Z0-9._-]+):touch#([a-zA-Z0-9._-]+)/,"($1):touch#($2)");var l=d.replace(/BEGIN/,"END"),u=new RegExp(d+"(([\\n\\r\\t]|.)*?)"+l,"g");t=t.replace(u,function(t,a,i,r){return("function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e))==i?r:""})}if(r)for(var p=0,f=r.length;p<f;p++){var m=r[p];m=m.replace(/([a-zA-Z0-9._-]+):touchnot#([a-zA-Z0-9._-]+)/,"($1):touchnot#($2)");var v=m.replace(/BEGIN/,"END"),g=new RegExp(m+"(([\\n\\r\\t]|.)*?)"+v,"g");t=t.replace(g,function(t,a,i,r){return("function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e))!=i?r:""})}if(n)for(var y=0,x=n.length;y<x;y++){var w=n[y];w=w.replace(/([a-zA-Z0-9._-]+):exist/,"($1):exist");var P=w.replace(/BEGIN/,"END"),E=new RegExp(w+"(([\\n\\r\\t]|.)*?)"+P,"g");t=t.replace(E,function(t,a,i){var r="function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e);return r||0===r?i:""})}if(s)for(var b=0,S=s.length;b<S;b++){var N=s[b];N=N.replace(/([a-zA-Z0-9._-]+):empty/,"($1):empty");var _=N.replace(/BEGIN/,"END"),I=new RegExp(N+"(([\\n\\r\\t]|.)*?)"+_,"g");t=t.replace(I,function(t,a,i){var r="function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e);return r||0===r?"":i})}return t=t.replace(/{([a-zA-Z0-9._-]+)}(\[([a-zA-Z0-9._-]+)\])*/g,function(t,i,r,n){var s=void 0;if("i"==i)s=a;else{if(!e[i]&&0!==e[i])return n&&o.convert&&o.convert[n]?o.convert[n].call(o,""):"";s="function"==typeof e[i]?e[i].apply(o):e[i]}return n&&o.convert&&o.convert[n]?o.convert[n].call(o,s):s})}},{key:"resolveAbsBlock",value:function(t){var e=this;return t=t.replace(/{(.*?)}/g,function(t,a){var o=e.getDataByString(a);return void 0!==o?"function"==typeof o?o.apply(e):o:t})}},{key:"resolveInclude",value:function(t){return t=t.replace(/<!-- #include id="(.*?)" -->/g,function(t,e){return d("#"+e).innerHTML})}},{key:"resolveWith",value:function(t){return t=t.replace(/<!-- BEGIN ([a-zA-Z0-9._-]+):with -->(([\n\r\t]|.)*?)<!-- END ([a-zA-Z0-9._-]+):with -->/g,function(t,e,a){return t=t.replace(/data\-bind=['"](.*?)['"]/g,"data-bind='"+e+".$1'")})}},{key:"resolveLoop",value:function(t){var e=this;return t=t.replace(/<!-- BEGIN (.+?):loop -->(([\n\r\t]|.)*?)<!-- END (.+?):loop -->/g,function(t,a,o){var i=e.getDataByString(a),r=[];r="function"==typeof i?i.apply(e):i;var n="";if(r instanceof Array)for(var s=0,h=r.length;s<h;s++)n+=e.resolveBlock(o,r[s],s);return n=n.replace(/\\([^\\])/g,"$1")})}},{key:"removeData",value:function(t){var e=this.data;for(var a in e)for(var o=0,i=t.length;o<i;o++)a===t[o]&&delete e[a];return this}},{key:"hasLoop",value:function(t){return!!t.match(/<!-- BEGIN (.+?):loop -->(([\n\r\t]|.)*?)<!-- END (.+?):loop -->/g)}},{key:"getHtml",value:function(t,e){var a=this.atemplate.find(function(e){return e.id===t}),o="";if(a&&a.html&&(o=a.html),e&&(o=t),!o)return"";var i=this.data;for(o=this.resolveInclude(o),o=this.resolveWith(o);this.hasLoop(o);)o=this.resolveLoop(o);return o=this.resolveBlock(o,i),o=o.replace(/\\([^\\])/g,"$1"),o=this.resolveAbsBlock(o),o.replace(/^([\t ])*\n/gm,"")}},{key:"update",value:function(t,e){var a=(this.getHtml(),this.templates),o=t||"html";this.beforeUpdated&&this.beforeUpdated();for(var i=0,n=a.length;i<n;i++){var s=a[i],h="#"+s,c=this.getHtml(s),l=d("[data-id='"+s+"']");if((!e||e==s)&&(l?"text"===o?l.innerText=c:r(l,"<div data-id='"+s+"'>"+c+"</div>"):(d(h).insertAdjacentHTML("afterend",'<div data-id="'+s+'"></div>'),"text"===o?d("[data-id='"+s+"']").innerText=c:d("[data-id='"+s+"']").innerHTML=c),e))break}return this.updateBindingData(e),this.onUpdated&&this.onUpdated(e),this}},{key:"updateBindingData",value:function(t){for(var e=this,a=this.templates,o=0,i=a.length;o<i;o++){var r=a[o];if(!t||t==r){var n=d("[data-id='"+r+"']"),s=n.querySelectorAll("[data-bind]");if([].forEach.call(s,function(t){var a=e.getDataByString(t.getAttribute("data-bind"));"checkbox"===t.getAttribute("type")||"radio"===t.getAttribute("type")?a==t.value&&(t.checked=!0):t.value=a}),t)break}}return this}},{key:"applyMethod",value:function(t){var e=[].splice.call(arguments,0);return e.shift(),this.method[t].apply(this,e)}},{key:"getComputedProp",value:function(t){return this.data[t].apply(this)}},{key:"remove",value:function(t){for(var e=this.data,a=t.split(".");a.length>1;)e=e[a.shift()];var o=a.shift();return o.match(/^\d+$/)?e.splice(Number(o),1):delete e[o],this}}]),t}();e.exports=f},{delegate:3,morphdom:5}],2:[function(t,e,a){function o(t,e){for(;t&&t.nodeType!==i;){if(t.matches(e))return t;t=t.parentNode}}var i=9;if("undefined"!=typeof Element&&!Element.prototype.matches){var r=Element.prototype;r.matches=r.matchesSelector||r.mozMatchesSelector||r.msMatchesSelector||r.oMatchesSelector||r.webkitMatchesSelector}e.exports=o},{}],3:[function(t,e,a){function o(t,e,a,o,r){var n=i.apply(this,arguments);return t.addEventListener(a,n,r),{destroy:function(){t.removeEventListener(a,n,r)}}}function i(t,e,a,o){return function(a){a.delegateTarget=r(a.target,e),a.delegateTarget&&o.call(t,a)}}var r=t("./closest");e.exports=o},{"./closest":2}],4:[function(t,e,a){"use strict";var o=function(){function t(){this.keys={},this.register_list={},this.state={},this.statistic={},this.specialKeyString={altKey:"Alt",ctrlKey:"Control",metaKey:"Meta",shiftKey:"Shift"}}t.prototype.listen=function(t,e){var a=this.option,o=document;a.element&&"function"==typeof a.element.addEventListener&&(o=a.element),o.addEventListener("keydown",function(e){this.keydown(e,t)}.bind(this),!1),o.addEventListener("keyup",function(t){this.keyup(t,e)}.bind(this),!1)},t.prototype.unlisten=function(){var t=this.option,e=document;t.element&&"function"==typeof t.element.removeEventListener&&(e=t.element),e.removeEventListener("keydown",function(){}),e.removeEventListener("keyup",function(){})},t.prototype.test=function(t){return this.testRegisters(t)},t.prototype.testRegisters=function(t){for(var e=this.register_list,a=Object.getOwnPropertySymbols(e),o=this.testKeys.bind(this),i={},r=0,n=a.length;r<n;r++){var s=a[r],h=e[s],c=h[0],d=h[1];if(o(c))return d&&"function"==typeof d&&(t.clearKeys=this.clearKeys.bind(this),d(t)),i[s]=!0,i}return i},t.prototype.testKeys=function(t){for(var e=[],a=!1,o=0,i=t.length;o<i;o++){var r=t[o],n=Object.keys(this.keys),s=[],h=0;if(n.forEach(function(t,e){this.keys[t]&&s.push(t)}.bind(this)),!0===this.option.DEBUG){var c=s.map(function(t,e){return" "===t?"Space":t}).join(" ");console.log("["+Date.now()+"] You hit key: %c"+c,"color: #ea4335; font-size: 16px")}if(s.length!==r.length)h=!1;else{for(var d=0,l=r.length;d<l;d++)if(s.indexOf(r[d])<0){h=!1;break}d===r.length&&!1!==h&&(h=!0)}e.push(h)}return e.forEach(function(t,e){!0===t&&(a=!0)}),a},t.prototype.keydown=function(t,e){var a=t.key,o={},i=!0;Array.prototype.map;return this.keys[a]="keydown"===t.type,o=this.test(t),Object.keys(o).forEach(function(t,e){!0===o[t]&&(i=!1)}),this.state=o,i||(t.preventDefault(),t.stopPropagation()),this.collect(t.key,t.type,t.timeStamp),"function"==typeof e&&e(t),i},t.prototype.keyup=function(t,e){var a=t.key;return this.keys[a]=!1,this.collect(t.key,t.type,t.timeStamp),"function"==typeof e&&e(t),!0},t.prototype.collect=function(t,e,a){var o=this.statistic[t],i=window.CustomEvent?new CustomEvent("test").timeStamp:document.createEvent("KeyboardEvent").timeStamp;void 0===o&&(o=this.statistic[t]={count:0,total:0,average:0}),"keydown"===e?o.downTimeStamp=a||i:"keyup"===e&&(o.count=o.count+1,o.upTimeStamp=a||i,o.total=o.upTimeStamp-o.downTimeStamp+o.total,o.total=+o.total.toFixed(2)||0,o.average=o.total/o.count)},t.prototype.register=function(t,e){if("string"!=typeof t)throw new Error("[from keyboard-js] Please input a register name.");var a;if(a="undefined"!=typeof Symbol?Symbol.for(t):t,this.register_list[a])throw new Error("[from keyboard-js] The Register["+t+"] has existed!");var o=Array.prototype.slice.call(arguments,2);o[0]instanceof Array||(o=[o]),this.register_list[a]=[o,e]},t.prototype.clearRegister=function(t){delete this.register_list[t]},t.prototype.clearRegisterAll=function(){this.register_list={}},t.prototype.clearKeys=function(){this.keys={}};var e=new t,a={start:function(t,a){e.listen(t,a)},end:function(){e.unlisten(),e.clearRegisterAll(),e.clearKeys()},register:function(){e.register.apply(e,arguments)},unregister:function(){e.clearRegister.apply(e,arguments)},getStatistic:function(){return e.statistic},__keydown:function(){e.keydown.apply(e,arguments)},__keyup:function(){e.keyup.apply(e,arguments)}};return function(t){return e.option=t||{},"object"==typeof window&&window.addEventListener("focus",function(){e.keys={}},!1),a}}();if(void 0!==a)a.Keyboard=o;else if("function"==typeof define)define("Keyboard",[],function(){return o});else{if(void 0!==window.Keyboard)throw new Error("Library Keyboard has existed! Loaded failed.");window.Keyboard=o}},{}],5:[function(t,e,a){"use strict";function o(t){!l&&f.createRange&&(l=f.createRange(),l.selectNode(f.body));var e;return l&&l.createContextualFragment?e=l.createContextualFragment(t):(e=f.createElement("body"),e.innerHTML=t),e.childNodes[0]}function i(t,e){var a=t.nodeName,o=e.nodeName;return a===o||!!(e.actualize&&a.charCodeAt(0)<91&&o.charCodeAt(0)>90)&&a===o.toUpperCase()}function r(t,e){return e&&e!==p?f.createElementNS(e,t):f.createElement(t)}function n(t,e){for(var a=t.firstChild;a;){var o=a.nextSibling;e.appendChild(a),a=o}return e}function s(t,e){var a,o,i,r,n,s=e.attributes;for(a=s.length-1;a>=0;--a)o=s[a],i=o.name,r=o.namespaceURI,n=o.value,r?(i=o.localName||i,t.getAttributeNS(r,i)!==n&&t.setAttributeNS(r,i,n)):t.getAttribute(i)!==n&&t.setAttribute(i,n);for(s=t.attributes,a=s.length-1;a>=0;--a)o=s[a],!1!==o.specified&&(i=o.name,r=o.namespaceURI,r?(i=o.localName||i,v(e,r,i)||t.removeAttributeNS(r,i)):v(e,null,i)||t.removeAttribute(i))}function h(t,e,a){t[a]!==e[a]&&(t[a]=e[a],t[a]?t.setAttribute(a,""):t.removeAttribute(a,""))}function c(){}function d(t){return t.id}var l,u,p="http://www.w3.org/1999/xhtml",f="undefined"==typeof document?void 0:document,m=f?f.body||f.createElement("div"):{};u=m.hasAttributeNS?function(t,e,a){return t.hasAttributeNS(e,a)}:m.hasAttribute?function(t,e,a){return t.hasAttribute(a)}:function(t,e,a){return null!=t.getAttributeNode(e,a)};var v=u,g={OPTION:function(t,e){h(t,e,"selected")},INPUT:function(t,e){h(t,e,"checked"),h(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),v(e,null,"value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var a=e.value;if(t.value!==a&&(t.value=a),t.firstChild){if(""===a&&t.firstChild.nodeValue===t.placeholder)return;t.firstChild.nodeValue=a}},SELECT:function(t,e){if(!v(e,null,"multiple")){for(var a=0,o=e.firstChild;o;){var i=o.nodeName;if(i&&"OPTION"===i.toUpperCase()){if(v(o,null,"selected")){a;break}a++}o=o.nextSibling}t.selectedIndex=a}}},y=1,x=3,w=8,P=function(t){return function(e,a,s){function h(t){E?E.push(t):E=[t]}function l(t,e){if(t.nodeType===y)for(var a=t.firstChild;a;){var o=void 0;e&&(o=b(a))?h(o):(A(a),a.firstChild&&l(a,e)),a=a.nextSibling}}function u(t,e,a){!1!==k(t)&&(e&&e.removeChild(t),A(t),l(t,a))}function p(t){if(t.nodeType===y)for(var e=t.firstChild;e;){var a=b(e);a&&(C[a]=e),p(e),e=e.nextSibling}}function m(t){N(t);for(var e=t.firstChild;e;){var a=e.nextSibling,o=b(e);if(o){var r=C[o];r&&i(e,r)&&(e.parentNode.replaceChild(r,e),v(r,e))}m(e),e=a}}function v(o,r,n){var s,c=b(r);if(c&&delete C[c],!a.isSameNode||!a.isSameNode(e)){if(!n){if(!1===_(o,r))return;if(t(o,r),I(o),!1===D(o,r))return}if("TEXTAREA"!==o.nodeName){var d,l,p,P,E=r.firstChild,N=o.firstChild;t:for(;E;){for(p=E.nextSibling,d=b(E);N;){if(l=N.nextSibling,E.isSameNode&&E.isSameNode(N)){E=p,N=l;continue t}s=b(N);var k=N.nodeType,A=void 0;if(k===E.nodeType&&(k===y?(d?d!==s&&((P=C[d])?N.nextSibling===P?A=!1:(o.insertBefore(P,N),l=N.nextSibling,s?h(s):u(N,o,!0),N=P):A=!1):s&&(A=!1),(A=!1!==A&&i(N,E))&&v(N,E)):k!==x&&k!=w||(A=!0,N.nodeValue=E.nodeValue)),A){E=p,N=l;continue t}s?h(s):u(N,o,!0),N=l}if(d&&(P=C[d])&&i(P,E))o.appendChild(P),v(P,E);else{var B=S(E);!1!==B&&(B&&(E=B),E.actualize&&(E=E.actualize(o.ownerDocument||f)),o.appendChild(E),m(E))}E=p,N=l}for(;N;)l=N.nextSibling,(s=b(N))?h(s):u(N,o,!0),N=l}var z=g[o.nodeName];z&&z(o,r)}}if(s||(s={}),"string"==typeof a)if("#document"===e.nodeName||"HTML"===e.nodeName){var P=a;a=f.createElement("html"),a.innerHTML=P}else a=o(a);var E,b=s.getNodeKey||d,S=s.onBeforeNodeAdded||c,N=s.onNodeAdded||c,_=s.onBeforeElUpdated||c,I=s.onElUpdated||c,k=s.onBeforeNodeDiscarded||c,A=s.onNodeDiscarded||c,D=s.onBeforeElChildrenUpdated||c,B=!0===s.childrenOnly,C={};p(e);var z=e,T=z.nodeType,G=a.nodeType;if(!B)if(T===y)G===y?i(e,a)||(A(e),z=n(e,r(a.nodeName,a.namespaceURI))):z=a;else if(T===x||T===w){if(G===T)return z.nodeValue=a.nodeValue,z;z=a}if(z===a)A(e);else if(v(z,a,B),E)for(var O=0,L=E.length;O<L;O++){var M=C[E[O]];M&&u(M,M.parentNode,!1)}return!B&&z!==e&&e.parentNode&&(z.actualize&&(z=z.actualize(e.ownerDocument||f)),e.parentNode.replaceChild(z,e)),z}}(s);e.exports=P},{}],6:[function(t,e,a){"use strict";var o=t("../index"),i=function(t){t.fn.smartPhoto=function(t){return"strings"==typeof t||new o(this.selector,t),this}};if("function"==typeof define&&define.amd)define(["jquery"],i);else{var r=window.jQuery?window.jQuery:window.$;void 0!==r&&i(r)}e.exports=i},{"../index":8}],7:[function(t,e,a){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var n=function(){function t(t,e){for(var a=0;a<e.length;a++){var o=e[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,a,o){return a&&t(e.prototype,a),o&&t(e,o),e}}(),s=t("a-template"),h=function(t){return t&&t.__esModule?t:{default:t}}(s),c='<div class="\\{classNames.smartPhoto\\}"\x3c!-- BEGIN hide:exist --\x3e style="display:none;"\x3c!-- END hide:exist --\x3e>\n\t<div class="\\{classNames.smartPhotoBody\\}">\n\t\t<div class="\\{classNames.smartPhotoInner\\}">\n\t\t\t <div class="\\{classNames.smartPhotoHeader\\}">\n\t\t\t\t\t<span class="\\{classNames.smartPhotoCount\\}">{currentIndex}[increment]/{total}</span>\n\t\t\t\t\t<span class="\\{classNames.smartPhotoCaption\\}">\x3c!-- BEGIN groupItems:loop --\x3e\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3e{caption}\x3c!-- \\END currentIndex:touch#{index} --\x3e\x3c!-- END groupItems:loop --\x3e</span>\n\t\t\t\t\t<button class="\\{classNames.smartPhotoDismiss\\}" data-action-click="hidePhoto()"></button>\n\t\t\t\t</div>\n\t\t\t\t<div class="\\{classNames.smartPhotoContent\\}"\x3c!-- BEGIN isSmartPhone:exist --\x3e data-action-touchstart="beforeDrag" data-action-touchmove="onDrag" data-action-touchend="afterDrag(false)"\x3c!-- END isSmartPhone:exist --\x3e>\n\t\t\t\t</div>\n\t\t\t\t<ul style="transform:translate({translateX}px,{translateY}px);" class="\\{classNames.smartPhotoList\\}\x3c!-- BEGIN onMoveClass:exist --\x3e \\{classNames.smartPhotoListOnMove\\}\x3c!-- END onMoveClass:exist --\x3e">\n\t\t\t\t\t\x3c!-- BEGIN groupItems:loop --\x3e\n\t\t\t\t\t<li style="transform:translate({translateX}px,{translateY}px);" class="\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3ecurrent\x3c!-- \\END currentIndex:touch#{index} --\x3e">\n\t\t\t\t\t\t\x3c!-- BEGIN loaded:exist --\x3e\n\t\t\t\t\t\t<div style="transform:translate({x}px,{y}px) scale({scale});" class="\\\\{classNames.smartPhotoImgWrap\\\\}"\x3c!-- \\BEGIN isSmartPhone:empty --\x3e data-action-mousemove="onDrag" data-action-mousedown="beforeDrag" data-action-mouseup="afterDrag"\x3c!-- \\END isSmartPhone:empty --\x3e\x3c!-- \\BEGIN isSmartPhone:exist --\x3e data-action-touchstart="beforeDrag" data-action-touchmove="onDrag" data-action-touchend="afterDrag"\x3c!-- \\END isSmartPhone:exist --\x3e>\n\t\t\t\t\t\t\t<img style="\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3etransform:translate(\\{photoPosX\\}[virtualPos]px,\\{photoPosY\\}[virtualPos]px) scale(\\{scaleSize\\});\x3c!-- \\END currentIndex:touch#{index} --\x3e" src="{src}" class="\\\\{classNames.smartPhotoImg\\\\}\x3c!-- \\BEGIN scale:exist --\x3e \\\\{classNames.smartPhotoImgOnMove\\\\}\x3c!-- \\END scale:exist --\x3e\x3c!-- \\BEGIN elastic:exist --\x3e \\\\{classNames.smartPhotoImgElasticMove\\\\}\x3c!-- \\END elastic:exist --\x3e\x3c!-- \\BEGIN appear:exist --\x3e active\x3c!-- \\END appear:exist --\x3e" ondragstart="return false;">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\x3c!-- END loaded:exist --\x3e\n\t\t\t\t\t\t\x3c!-- BEGIN loaded:empty --\x3e\n\t\t\t\t\t\t<div class="\\\\{classNames.smartPhotoLoaderWrap\\\\}">\n\t\t\t\t\t\t\t<span class="\\\\{classNames.smartPhotoLoader\\\\}"></span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\x3c!-- END loaded:empty --\x3e\n\t\t\t\t\t</li>\n\t\t\t\t\t\x3c!-- END groupItems:loop --\x3e\n\t\t\t\t</ul>\n\t\t\t\t\x3c!-- BEGIN arrows:exist --\x3e\n\t\t\t\t<ul class="\\{classNames.smartPhotoArrows\\}\x3c!-- BEGIN hideUi:exist --\x3e hide\x3c!-- END hideUi:exist --\x3e">\n\t\t\t\t\t<li class="\\{classNames.smartPhotoArrowLeft\\}\x3c!-- BEGIN showPrevArrow:exist --\x3e show\x3c!-- END showPrevArrow:exist --\x3e" data-action-click="gotoSlide({prev})"></li>\n\t\t\t\t\t<li class="\\{classNames.smartPhotoArrowRight\\}\x3c!-- BEGIN showNextArrow:exist --\x3e show\x3c!-- END showNextArrow:exist --\x3e" data-action-click="gotoSlide({next})"></li>\n\t\t\t\t</ul>\n\t\t\t\t\x3c!-- END arrows:exist --\x3e\n\t\t\t\t\x3c!-- BEGIN nav:exist --\x3e\n\t\t\t\t<nav class="\\{classNames.smartPhotoNav\\}\x3c!-- BEGIN hideUi:exist --\x3e hide\x3c!-- END hideUi:exist --\x3e">\n\t\t\t\t\t<ul >\n\t\t\t\t\t\t\x3c!-- BEGIN groupItems:loop --\x3e\n\t\t\t\t\t\t<li data-action-click="gotoSlide({index})" class="\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3ecurrent\x3c!-- \\END currentIndex:touch#{index} --\x3e" style="background-image:url({src});"></li>\n\t\t\t\t\t\t\x3c!-- END groupItems:loop --\x3e\n\t\t\t\t\t</ul>\n\t\t\t\t</nav>\n\t\t\t\t\x3c!-- END nav:exist --\x3e\n\t\t</div>\n\t\t\x3c!-- BEGIN appearEffect:exist --\x3e\n\t\t<img src=\\{appearEffect.img\\}\n\t\tclass="\\{classNames.smartPhotoImgClone\\}"\n\t\tstyle="width:\\{appearEffect.width\\}px;height:\\{appearEffect.height\\}px;transform:translate(\\{appearEffect.left\\}px,\\{appearEffect.top\\}px) scale(1)" />\n\t\t\x3c!-- END appearEffect:exist --\x3e\n\t</div>\n</div>\n',d=t("../lib/util"),l=t("keyboard-js").Keyboard,u={classNames:{smartPhoto:"smartphoto",smartPhotoClose:"smartphoto-close",smartPhotoBody:"smartphoto-body",smartPhotoInner:"smartphoto-inner",smartPhotoContent:"smartphoto-content",smartPhotoImg:"smartphoto-img",smartPhotoImgOnMove:"smartphoto-img-onmove",smartPhotoImgElasticMove:"smartphoto-img-elasticmove",smartPhotoImgWrap:"smartphoto-img-wrap",smartPhotoArrows:"smartphoto-arrows",smartPhotoNav:"smartphoto-nav",smartPhotoArrowRight:"smartphoto-arrow-right",smartPhotoArrowLeft:"smartphoto-arrow-left",smartPhotoImgLeft:"smartphoto-img-left",smartPhotoImgRight:"smartphoto-img-right",smartPhotoList:"smartphoto-list",smartPhotoListOnMove:"smartphoto-list-onmove",smartPhotoHeader:"smartphoto-header",smartPhotoCount:"smartphoto-count",smartPhotoCaption:"smartphoto-caption",smartPhotoDismiss:"smartphoto-dismiss",smartPhotoLoader:"smartphoto-loader",smartPhotoLoaderWrap:"smartphoto-loader-wrap",smartPhotoImgClone:"smartphoto-img-clone"},arrows:!0,nav:!0,animationSpeed:300,swipeOffset:100,maxWidth:940,headerHeight:60,footerHeight:60,forceInterval:10,registance:.5,resizeStyle:"fill",verticalGravity:!1,useOrientationApi:!0},p=function(t){function e(t,a){o(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));r.data=d.extend({},u,a),r.data.currentIndex=0,r.data.hide=!0,r.data.group={},r.data.scaleSize=1,r.data.scale=!1,r.pos={x:0,y:0},r.data.photoPosX=0,r.data.photoPosY=0,r.convert={increment:r.increment,virtualPos:r.virtualPos},r.data.groupItems=r.groupItems,r.elements=document.querySelectorAll(t);var n=new Date;r.tapSecond=n.getTime(),r.onListMove=!1,r.id=r._getUniqId(),r.vx=0,r.vy=0,r.data.appearEffect=null,r.addTemplate(r.id,c),r.data.isSmartPhone=r._isSmartPhone();var s=document.querySelector("body");d.append(s,"<div data-id='"+r.id+"'></div>"),[].forEach.call(r.elements,function(t,e){r.addNewItem(t)});var h=r._getCurrentItemByHash();return h&&d.triggerEvent(h.element,"click"),r.data.isSmartPhone||r._setKeyboard(),r._getEachImageSize(),setInterval(function(){r._doAnim()},r.data.forceInterval),r.data.isSmartPhone||window.addEventListener("resize",function(t){r._resetTranslate(),r._setPosByCurrentIndex(),r._setSizeByScreen(),r.update()}),window.addEventListener("orientationchange",function(t){r._resetTranslate(),r._setPosByCurrentIndex(),r._setHashByCurrentIndex(),r._setSizeByScreen(),r.update()}),r.data.isSmartPhone&&r.data.useOrientationApi?(window.addEventListener("deviceorientation",function(t){var e=window.orientation;t&&t.gamma&&!r.data.appearEffect&&(r.isBeingZoomed||r.photoSwipable||r.data.elastic||!r.data.scale||(0===e?r._calcGravity(t.gamma,t.beta):90===e?r._calcGravity(t.beta,t.gamma):-90===e?r._calcGravity(-t.beta,-t.gamma):180===e&&r._calcGravity(-t.gamma,-t.beta)))}),r):i(r)}return r(e,t),n(e,[{key:"increment",value:function(t){return t+1}},{key:"virtualPos",value:function(t){return(t=parseInt(t))/this._getSelectedItem().scale/this.data.scaleSize}},{key:"groupItems",value:function(){return this.data.group[this.data.currentGroup]}},{key:"_setKeyboard",value:function(){var t=this,e=new l;e.register("slideRight",function(){!0!==t.data.hide&&t.gotoSlide(t.data.next)},["ArrowRight"]),e.register("slideLeft",function(){!0!==t.data.hide&&t.gotoSlide(t.data.prev)},["ArrowLeft"]),e.register("hidePhoto",function(){!0!==t.data.hide&&t.hidePhoto()},["Escape"]),e.start()}},{key:"_getEachImageSize",value:function(){var t=[],e=this.data.group;for(var a in e)e.hasOwnProperty(a)&&e[a].forEach(function(e){var a=new Promise(function(t,a){var o=new Image;o.onload=function(){e.width=o.width,e.height=o.height,e.loaded=!0,t()},o.onerror=function(){t()},o.src=e.src});t.push(a)});return Promise.all(t)}},{key:"_resetTranslate",value:function(){this.groupItems().forEach(function(t,e){t.translateX=window.innerWidth*e})}},{key:"addNewItem",value:function(t){var e=this,a=t.getAttribute("data-group")||"nogroup",o=this.data.group;"nogroup"===a&&t.setAttribute("data-group","nogroup"),o[a]||(o[a]=[]);var i=o[a].length,r={src:t.getAttribute("href"),caption:t.getAttribute("data-caption"),groupId:a,translateX:window.innerWidth*i,index:i,translateY:0,width:50,height:50,id:t.getAttribute("data-id")||i,loaded:!1,element:t};o[a].push(r),this.data.currentGroup=a,t.getAttribute("data-id")||t.setAttribute("data-id",i),t.setAttribute("data-index",i),t.addEventListener("click",function(a){a.preventDefault(),e.data.currentGroup=t.getAttribute("data-group"),e.data.currentIndex=parseInt(t.getAttribute("data-index")),e._setHashByCurrentIndex();var o=e._getSelectedItem();o.loaded?(e._initPhoto(),e.addAppearEffect(t),e.update()):e._loadItem(o).then(function(){e.data.appear=!0,e._initPhoto(),e.update()})})}},{key:"_initPhoto",value:function(){this.data.total=this.groupItems().length,this.data.hide=!1,this.data.photoPosX=0,this.data.photoPosY=0,this._setPosByCurrentIndex(),this._setSizeByScreen(),this.setArrow(),"fill"===this.data.resizeStyle&&this.data.isSmartPhone&&(this.data.scale=!0,this.data.hideUi=!0,this.data.scaleSize=this._getScaleBoarder())}},{key:"onUpdated",value:function(){var t=this;this.data.appearEffect&&this.data.appearEffect.once&&(this.data.appearEffect.once=!1,this.execEffect().then(function(){t.replaceEffectWithImg()}))}},{key:"execEffect",value:function(){var t=this.data.appearEffect,e=this.data.classNames,a=document.querySelector('[data-id="'+this.id+'"] .'+e.smartPhotoImgClone);return new Promise(function(e,o){setTimeout(function(){a.style.transition="all .3s ease-out",a.style.transform="translate("+t.afterX+"px, "+t.afterY+"px) scale("+t.scale+")",e()},30)})}},{key:"replaceEffectWithImg",value:function(){var t=this;this.data.classNames;setTimeout(function(){t.data.appearEffect=null,t.data.appear=!0,t.update()},300)}},{key:"addAppearEffect",value:function(t){var e=t.querySelector("img"),a=(e.cloneNode(!0),d.getViewPos(e)),o={},i=1;o.width=e.offsetWidth,o.height=e.offsetHeight,o.top=a.top,o.left=a.left,o.once=!0,o.img=e.getAttribute("src");var r=window.innerWidth,n=window.innerHeight,s=n-this.data.headerHeight-this.data.footerHeight;"fill"===this.data.resizeStyle&&this.data.isSmartPhone?i=e.offsetWidth>e.offsetHeight?n/e.offsetHeight:r/e.offsetWidth:(i=s/e.offsetHeight)*e.offsetWidth>r&&(i=r/e.offsetWidth);var h=(i-1)/2*e.offsetWidth+(r-e.offsetWidth*i)/2,c=(i-1)/2*e.offsetHeight+(n-e.offsetHeight*i)/2;o.afterX=h,o.afterY=c,o.scale=i,this.data.appearEffect=o}},{key:"hidePhoto",value:function(){var t=this;this.data.hide=!0,this.data.appear=!1,this.data.appearEffect=null;var e=window.scrollX,a=window.scrollY;location.hash&&(location.hash=""),window.scroll(e,a),this._doHideEffect().then(function(){t.update()})}},{key:"_doHideEffect",value:function(){var t=this;return new Promise(function(e,a){var o=t.data.classNames,i=t._getElementByClass(o.smartPhoto),r=t._getElementByQuery(".current ."+o.smartPhotoImg),n=window.innerHeight,s=function t(){i.removeEventListener("transitionend",t,!0),e()};i.style.opacity=0,r.style.transform="translateY("+n+"px)",i.addEventListener("transitionend",s,!0)})}},{key:"_getElementByClass",value:function(t){return document.querySelector('[data-id="'+this.id+'"] .'+t)}},{key:"_getElementByQuery",value:function(t){return document.querySelector('[data-id="'+this.id+'"] '+t)}},{key:"_getTouchPos",value:function(t){var e=0,a=0;if(void 0===o)var o=this.e;return this._isTouched(o)?(e=o.touches[0].pageX,a=o.touches[0].pageY):this._isTouched(this.e)?(e=this.e.touches[0].pageX,a=this.e.touches[0].pageY):o.pageX&&(e=o.pageX,a=o.pageY),{x:e,y:a}}},{key:"_getGesturePos",value:function(t){var e=t.touches;return[{x:e[0].pageX,y:e[0].pageY},{x:e[1].pageX,y:e[1].pageY}]}},{key:"_setPosByCurrentIndex",
value:function(){var t=this,e=this.groupItems(),a=-1*e[this.data.currentIndex].translateX;this.pos.x=a,setTimeout(function(){t.data.translateX=a,t.data.translateY=0,t._listUpdate()},1)}},{key:"_setHashByCurrentIndex",value:function(){var t=window.scrollX,e=window.scrollY,a=this.groupItems(),o=a[this.data.currentIndex].id,i=this.data.currentGroup,r="group="+i+"&photo="+o;location.hash=r,window.scroll(t,e)}},{key:"_getCurrentItemByHash",value:function(){var t=this.data.group,e=location.hash.substr(1),a=d.parseQuery(e),o=null;for(var i in t)t.hasOwnProperty(i)&&t[i].forEach(function(t){a.group===t.groupId&&a.photo===t.id&&(o=t)});return o}},{key:"_loadItem",value:function(t){return new Promise(function(e,a){var o=new Image;o.onload=function(){t.width=o.width,t.height=o.height,t.loaded=!0,e()},o.onerror=function(){e()},o.src=t.src})}},{key:"_setSizeByScreen",value:function(){var t=window.innerWidth,e=window.innerHeight,a=this.data.headerHeight,o=this.data.footerHeight,i=e-(a+o);this.groupItems().forEach(function(a){a.scale=i/a.height,a.x=(a.scale-1)/2*a.width+(t-a.width*a.scale)/2,a.y=(a.scale-1)/2*a.height+(e-a.height*a.scale)/2,a.width*a.scale>t&&(a.scale=t/a.width,a.x=(a.scale-1)/2*a.width)})}},{key:"_slideList",value:function(){var t=this;this.data.onMoveClass=!0,this._setPosByCurrentIndex(),this._setHashByCurrentIndex(),this._setSizeByScreen(),setTimeout(function(){t.data.onMoveClass=!1,t.setArrow(),t.update()},200)}},{key:"gotoSlide",value:function(t){this.data.currentIndex=parseInt(t),this.data.currentIndex||(this.data.currentIndex=0),this._slideList()}},{key:"setArrow",value:function(){var t=this.groupItems(),e=t.length,a=this.data.currentIndex+1,o=this.data.currentIndex-1;this.data.showNextArrow=!1,this.data.showPrevArrow=!1,a!==e&&(this.data.next=a,this.data.showNextArrow=!0),-1!==o&&(this.data.prev=o,this.data.showPrevArrow=!0)}},{key:"beforeDrag",value:function(){if(this._isGestured(this.e))return void this.beforeGesture();if(this.data.scale)return void this.beforePhotoDrag();var t=this._getTouchPos(this.e);this.isSwipable=!0,this.dragStart=!0,this.firstPos=t,this.oldPos=t}},{key:"afterDrag",value:function(t){var e=this.groupItems(),a=new Date,o=a.getTime(),i=this.tapSecond-o,r=0,n=0;return this.isSwipable=!1,this.onListMove=!1,this.oldPos&&(r=this.oldPos.x-this.firstPos.x,n=this.oldPos.y-this.firstPos.y),this.isBeingZoomed?void this.afterGesture():this.data.scale?void this.afterPhotoDrag():d.isSmartPhone()||0!==r||0!==n?Math.abs(i)<=500&&0===r&&0===n?(this.e.preventDefault(),void this.zoomPhoto()):(this.tapSecond=o,"horizontal"===this.moveDir&&(r>=this.data.swipeOffset&&0!==this.data.currentIndex?this.data.currentIndex--:r<=-this.data.swipeOffset&&this.data.currentIndex!=e.length-1&&this.data.currentIndex++,this._slideList()),void("vertical"===this.moveDir&&(n>=this.data.swipeOffset?this.hidePhoto():(this.data.translateY=0,this._slideList())))):void this.zoomPhoto()}},{key:"onDrag",value:function(){if(this.e.preventDefault(),this._isGestured(this.e)&&!1===this.onListMove)return void this.onGesture();if(!this.isBeingZoomed){if(this.data.scale)return void this.onPhotoDrag();if(this.isSwipable){var t=this._getTouchPos(this.e),e=t.x-this.oldPos.x,a=t.y-this.firstPos.y;this.dragStart&&(this.dragStart=!1,Math.abs(e)>Math.abs(a)?this.moveDir="horizontal":this.moveDir="vertical"),"horizontal"===this.moveDir?(this.pos.x+=e,this.data.translateX=this.pos.x):this.data.translateY=a,this.onListMove=!0,this.oldPos=t,this._listUpdate()}}}},{key:"zoomPhoto",value:function(){var t=this;this.data.hideUi=!0,this.data.scaleSize=this._getScaleBoarder(),this.data.photoPosX=0,this.data.photoPosY=0,this._photoUpdate(),setTimeout(function(){t.data.scale=!0,t._photoUpdate()},300)}},{key:"zoomOutPhoto",value:function(){this.data.scaleSize=1,this.isBeingZoomed=!1,this.data.hideUi=!1,this.data.scale=!1,this.data.photoPosX=0,this.data.photoPosY=0,this._photoUpdate()}},{key:"beforePhotoDrag",value:function(){var t=this._getTouchPos(this.e);this.photoSwipable=!0,this.data.photoPosX||(this.data.photoPosX=0),this.data.photoPosY||(this.data.photoPosY=0),this.oldPhotoPos=t,this.firstPhotoPos=t}},{key:"onPhotoDrag",value:function(){if(this.photoSwipable){this.e.preventDefault();var t=this._getTouchPos(this.e),e=t.x-this.oldPhotoPos.x,a=t.y-this.oldPhotoPos.y,o=this._round(this.data.scaleSize*e,6),i=this._round(this.data.scaleSize*a,6);"number"==typeof o&&(this.data.photoPosX+=o,this.photoVX=o),"number"==typeof i&&(this.data.photoPosY+=i,this.photoVY=i),this.oldPhotoPos=t,this._photoUpdate()}}},{key:"afterPhotoDrag",value:function(){if(this.oldPhotoPos.x===this.firstPhotoPos.x&&this.photoSwipable)this.zoomOutPhoto();else{var t=this._getSelectedItem(),e=this._makeBound(t),a=0,o=0;this.data.photoPosX>e.maxX?a=-1:this.data.photoPosX<e.minX&&(a=1),this.data.photoPosY>e.maxY?o=-1:this.data.photoPosY<e.minY&&(o=1),0===a&&0===o?(this.vx=this.photoVX/5,this.vy=this.photoVY/5):this._registerElasticForce(a,o)}this.photoSwipable=!1}},{key:"beforeGesture",value:function(){var t=this._getGesturePos(this.e),e=this._getDistance(t[0],t[1]);this.isBeingZoomed=!0,this.oldDistance=e,this.data.scale=!0,this.e.preventDefault()}},{key:"onGesture",value:function(){var t=this._getGesturePos(this.e),e=this._getDistance(t[0],t[1]),a=(e-this.oldDistance)/100,o=this.data.scaleSize,i=this.data.photoPosX,r=this.data.photoPosY;this._getSelectedItem();this.data.scaleSize+=this._round(a,6),this.data.scaleSize<.2&&(this.data.scaleSize=.2),this.data.scaleSize<o&&(this.data.photoPosX=(1+this.data.scaleSize-o)*i,this.data.photoPosY=(1+this.data.scaleSize-o)*r),this.data.scaleSize<1||this.data.scaleSize>this._getScaleBoarder()?this.data.hideUi=!0:this.data.hideUi=!1,this.oldDistance=e,this.e.preventDefault(),this._photoUpdate()}},{key:"afterGesture",value:function(){this.isBeingZoomed=!1,this.data.scaleSize>this._getScaleBoarder()||(this.data.photoPosX=0,this.data.photoPosY=0,this.data.scale=!1,this.data.scaleSize=1,this.data.hideUi=!1,this._photoUpdate())}},{key:"_getForceAndTheta",value:function(t,e){return{force:Math.sqrt(t*t+e*e),theta:Math.atan2(e,t)}}},{key:"_getScaleBoarder",value:function(){var t=this._getSelectedItem();return d.isSmartPhone()?t.width>t.height?window.innerHeight/(t.height*t.scale):window.innerWidth/(t.width*t.scale):1/t.scale}},{key:"_makeBound",value:function(t){var e=t.width*t.scale*this.data.scaleSize,a=t.height*t.scale*this.data.scaleSize,o=void 0,i=void 0,r=void 0,n=void 0;return window.innerWidth>e?(r=(window.innerWidth-e)/2,o=-1*r):(r=(e-window.innerWidth)/2,o=-1*r),window.innerHeight>a?(n=(window.innerHeight-a)/2,i=-1*n):(n=(a-window.innerHeight)/2,i=-1*n),{minX:this._round(o,6)*this.data.scaleSize,minY:this._round(i,6)*this.data.scaleSize,maxX:this._round(r,6)*this.data.scaleSize,maxY:this._round(n,6)*this.data.scaleSize}}},{key:"_registerElasticForce",value:function(t,e){var a=this,o=this._getSelectedItem(),i=this._makeBound(o);this.data.elastic=!0,1===t?this.data.photoPosX=i.minX:-1===t&&(this.data.photoPosX=i.maxX),1===e?this.data.photoPosY=i.minY:-1===e&&(this.data.photoPosY=i.maxY),this._photoUpdate(),setTimeout(function(){a.data.elastic=!1,a._photoUpdate()},300)}},{key:"_getSelectedItem",value:function(){var t=this.data,e=t.currentIndex;return t.group[t.currentGroup][e]}},{key:"_getUniqId",value:function(){return(Date.now().toString(36)+Math.random().toString(36).substr(2,5)).toUpperCase()}},{key:"_getDistance",value:function(t,e){var a=t.x-e.x,o=t.y-e.y;return Math.sqrt(a*a+o*o)}},{key:"_round",value:function(t,e){var a=Math.pow(10,e);return t*=a,t=Math.round(t),t/=a}},{key:"_isTouched",value:function(t){return!(!t||!t.touches)}},{key:"_isGestured",value:function(t){return!!(t&&t.touches&&t.touches.length>1)}},{key:"_isSmartPhone",value:function(){var t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0}},{key:"_calcGravity",value:function(t,e){(t>5||t<-5)&&(this.vx+=.05*t),!1!==this.data.verticalGravity&&(e>5||e<-5)&&(this.vy+=.05*e)}},{key:"_photoUpdate",value:function(){var t=this.data.classNames,e=this._getElementByQuery(".current"),a=e.querySelector("."+t.smartPhotoImg),o=this._getElementByQuery("."+t.smartPhotoNav),i=this._getElementByQuery("."+t.smartPhotoArrows),r=this.virtualPos(this.data.photoPosX),n=this.virtualPos(this.data.photoPosY),s=this.data.scaleSize,h="translate("+r+"px,"+n+"px) scale("+s+")";a.style.transform=h,this.data.scale?d.addClass(a,t.smartPhotoImgOnMove):d.removeClass(a,t.smartPhotoImgOnMove),this.data.elastic?d.addClass(a,t.smartPhotoImgElasticMove):d.removeClass(a,t.smartPhotoImgElasticMove),this.data.hideUi?(d.addClass(o,"hide"),d.addClass(i,"hide"),setTimeout(function(){d.addClass(o,"none"),d.addClass(i,"none")},100)):(d.removeClass(o,"none"),d.removeClass(i,"none"),setTimeout(function(){d.removeClass(o,"hide"),d.removeClass(i,"hide")},10))}},{key:"_listUpdate",value:function(){var t=this.data.classNames,e=this._getElementByQuery("."+t.smartPhotoList),a="translate("+this.data.translateX+"px,"+this.data.translateY+"px)";e.style.transform=a,this.data.onMoveClass?d.addClass(e,t.smartPhotoListOnMove):d.removeClass(e,t.smartPhotoListOnMove)}},{key:"_doAnim",value:function(){if(!(this.isBeingZoomed||this.isSwipable||this.photoSwipable||this.data.elastic)&&this.data.scale){this.data.photoPosX+=this.vx,this.data.photoPosY+=this.vy;var t=this._getSelectedItem(),e=this._makeBound(t);this.data.photoPosX<e.minX?(this.data.photoPosX=e.minX,this.vx*=-.2):this.data.photoPosX>e.maxX&&(this.data.photoPosX=e.maxX,this.vx*=-.2),this.data.photoPosY<e.minY?(this.data.photoPosY=e.minY,this.vy*=-.2):this.data.photoPosY>e.maxY&&(this.data.photoPosY=e.maxY,this.vy*=-.2);var a=this._getForceAndTheta(this.vx,this.vy),o=a.force,i=a.theta;o-=this.data.registance,Math.abs(o)<.5||(this.vx=Math.cos(i)*o,this.vy=Math.sin(i)*o,this._photoUpdate())}}}]),e}(h.default);e.exports=p},{"../lib/util":9,"a-template":1,"keyboard-js":4}],8:[function(t,e,a){"use strict";e.exports=t("./core/")},{"./core/":7}],9:[function(t,e,a){"use strict";function o(t){t=t||{};for(var e=1;e<arguments.length;e++){var a=arguments[e];if(a)for(var r in a)a.hasOwnProperty(r)&&("object"===i(a[r])?t[r]=o(t[r],a[r]):t[r]=a[r])}return t}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.exports.isSmartPhone=function(){var t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0},e.exports.extend=o,e.exports.triggerEvent=function(t,e,a){var o=void 0;window.CustomEvent?o=new CustomEvent(e,{cancelable:!0}):(o=document.createEvent("CustomEvent"),o.initCustomEvent(e,!1,!1,a)),t.dispatchEvent(o)},e.exports.parseQuery=function(t){for(var e,a,o,i=t.split("&"),r={},n=0,s=i.length;n<s;n++)e=i[n].split("="),void 0!==e[0]&&(a=e[0],o=void 0!==e[1]?e.slice(1).join("="):a,r[a]=decodeURIComponent(o));return r},e.exports.getViewPos=function(t){return{left:t.getBoundingClientRect().left,top:t.getBoundingClientRect().top}},e.exports.removeElement=function(t){t&&t.parentNode&&t.parentNode.removeChild(t)},e.exports.append=function(t,e){var a=new DOMParser,o=a.parseFromString(e,"text/html");t.appendChild(o.querySelector("body").childNodes[0])},e.exports.addClass=function(t,e){t.classList?t.classList.add(e):t.className+=" "+e},e.exports.removeClass=function(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\b)"+e.split(" ").join("|")+"(\\b|$)","gi")," ")}},{}]},{},[6]);
!function t(e,a,o){function i(n,s){if(!a[n]){if(!e[n]){var h="function"==typeof require&&require;if(!s&&h)return h(n,!0);if(r)return r(n,!0);var d=new Error("Cannot find module '"+n+"'");throw d.code="MODULE_NOT_FOUND",d}var c=a[n]={exports:{}};e[n][0].call(c.exports,function(t){var a=e[n][1][t];return i(a||t)},c,c.exports,t,e,a,o)}return a[n].exports}for(var r="function"==typeof require&&require,n=0;n<o.length;n++)i(o[n]);return i}({1:[function(t,e,a){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var a=0;a<e.length;a++){var o=e[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,a,o){return a&&t(e.prototype,a),o&&t(e,o),e}}(),r=t("morphdom"),n=t("delegate"),s=[],h="input paste copy click change keydown keyup contextmenu mouseup mousedown mousemove touchstart touchend touchmove compositionstart compositionend",d=h.replace(/([a-z]+)/g,"[data-action-$1],")+"[data-action]";Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e=Object(this),a=e.length>>>0,o=arguments[1],i=void 0,r=0;r<a;r++)if(i=e[r],t.call(o,i,r,e))return i}),Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){for(var e=(this.document||this.ownerDocument).querySelectorAll(t),a=e.length;--a>=0&&e.item(a)!==this;);return a>-1});var c=function(t){return document.querySelector(t)},l=function(t){for(var e=0,a=s.length;e<a;e++)for(var o=s[e],i=o.templates,r=0,n=i.length;r<n;r++)if(i[r]==t)return o;return null},u=function(t,e){if("function"==typeof t.closest)return t.closest(e)||null;for(;t;){if(t.matches(e))return t;t=t.parentElement}return null},p=function(t,e,a,o){a.split(" ").forEach(function(a){n(t,e,a,o)})};"undefined"!=typeof document&&(p(document,"[data-bind]","input change click",function(t){var e=t.delegateTarget,a=e.getAttribute("data-bind"),o=e.getAttribute("href"),i=u(e,"[data-id]").getAttribute("data-id"),r=e.value;if(o&&(r=r.replace("#","")),i){var n=l(i);"radio"===e.getAttribute("type")||("checkbox"===e.getAttribute("type")?function(){var t=[],e=document.querySelectorAll('[data-bind="'+a+'"]');[].forEach.call(e,function(e){e.checked&&t.push(e.value)})}():n.updateDataByString(a,r))}}),p(document,d,h,function(t){var e=t.delegateTarget;if(!("click"===t.type&&"select"===e.tagName||"input"===t.type&&"button"===e.getAttribute("type"))){var a=h.split(" "),o="action";a.forEach(function(a){e.getAttribute("data-action-"+a)&&t.type===a&&(o+="-"+a)});var i=e.getAttribute("data-"+o);if(i){var r=i.replace(/\(.*?\);?/,""),n=i.replace(/(.*?)\((.*?)\);?/,"$2"),s=n.split(","),d=u(e,"[data-id]").getAttribute("data-id");if(d){var c=l(d);c.e=t,c.method&&c.method[r]?c.method[r].apply(c,s):c[r]&&c[r].apply(c,s)}}}}));var f=function(){function t(e){o(this,t),this.atemplate=[],s.push(this);for(var a in e)this[a]=e[a];this.data||(this.data={}),this.templates||(this.templates=[]);for(var i=this.templates,r=i.length,n=0,h=r;n<h;n++){var d=this.templates[n],l=c("#"+d).innerHTML;this.atemplate.push({id:d,html:l})}this.setId()}return i(t,[{key:"addTemplate",value:function(t,e){this.atemplate.push({id:t,html:e}),this.templates.push(t)}},{key:"loadHtml",value:function(){var t=this.templates,e=[];return t.forEach(function(t){var a=new $.Deferred;e.push(a);var o=c("#"+t).getAttribute("src");$.ajax({url:o,type:"GET",dataType:"text"}).success(function(e){c("#"+t).innerHTML=e,a.resolve()})}),$.when.apply($,e)}},{key:"getData",value:function(){return JSON.parse(JSON.stringify(this.data))}},{key:"saveData",value:function(t){var e=JSON.stringify(this.data);localStorage.setItem(t,e)}},{key:"setData",value:function(t){for(var e in t)"function"!=typeof t[e]&&(this.data[e]=t[e])}},{key:"loadData",value:function(t){var e=JSON.parse(localStorage.getItem(t));if(e)for(var a in e)"function"!=typeof e[a]&&(this.data[a]=e[a])}},{key:"getRand",value:function(t,e){return~~(Math.random()*(e-t+1))+t}},{key:"getRandText",value:function(t){for(var e="",a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o=a.length,i=0;i<t;i++)e+=a.charAt(Math.floor(this.getRand(0,o)));return e}},{key:"setId",value:function(){for(var e=void 0,a=(t.ids,!1);;){e=this.getRandText(10);for(var o=0,i=t.ids;o<i;o++)t.ids[o]===e&&(a=!0);if(!1===a)break}this.data.aTemplate_id=e}},{key:"getDataFromObj",value:function(t,e){t=t.replace(/\[([a-zA-Z0-9._-]+)\]/g,".$1"),t=t.replace(/^\./,"");for(var a=t.split(".");a.length;){var o=a.shift();if(!(o in e))return;e=e[o]}return e}},{key:"getDataByString",value:function(t){var e=this.data;return this.getDataFromObj(t,e)}},{key:"updateDataByString",value:function(t,e){for(var a=this.data,o=t.split(".");o.length>1;)a=a[o.shift()];a[o.shift()]=e}},{key:"removeDataByString",value:function(t){for(var e=this.data,a=t.split(".");a.length>1;)e=e[a.shift()];var o=a.shift();o.match(/^\d+$/)?e.splice(Number(o),1):delete e[o]}},{key:"resolveBlock",value:function(t,e,a){var o=this,i=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):touch#([a-zA-Z0-9._-]+) -->/g),r=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):touchnot#([a-zA-Z0-9._-]+) -->/g),n=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):exist -->/g),s=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):empty -->/g);if(i)for(var h=0,d=i.length;h<d;h++){var c=i[h];c=c.replace(/([a-zA-Z0-9._-]+):touch#([a-zA-Z0-9._-]+)/,"($1):touch#($2)");var l=c.replace(/BEGIN/,"END"),u=new RegExp(c+"(([\\n\\r\\t]|.)*?)"+l,"g");t=t.replace(u,function(t,a,i,r){return("function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e))==i?r:""})}if(r)for(var p=0,f=r.length;p<f;p++){var m=r[p];m=m.replace(/([a-zA-Z0-9._-]+):touchnot#([a-zA-Z0-9._-]+)/,"($1):touchnot#($2)");var v=m.replace(/BEGIN/,"END"),g=new RegExp(m+"(([\\n\\r\\t]|.)*?)"+v,"g");t=t.replace(g,function(t,a,i,r){return("function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e))!=i?r:""})}if(n)for(var y=0,x=n.length;y<x;y++){var P=n[y];P=P.replace(/([a-zA-Z0-9._-]+):exist/,"($1):exist");var w=P.replace(/BEGIN/,"END"),E=new RegExp(P+"(([\\n\\r\\t]|.)*?)"+w,"g");t=t.replace(E,function(t,a,i){var r="function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e);return r||0===r?i:""})}if(s)for(var S=0,b=s.length;S<b;S++){var N=s[S];N=N.replace(/([a-zA-Z0-9._-]+):empty/,"($1):empty");var I=N.replace(/BEGIN/,"END"),_=new RegExp(N+"(([\\n\\r\\t]|.)*?)"+I,"g");t=t.replace(_,function(t,a,i){var r="function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e);return r||0===r?"":i})}return t=t.replace(/{([a-zA-Z0-9._-]+)}(\[([a-zA-Z0-9._-]+)\])*/g,function(t,i,r,n){var s=void 0;if("i"==i)s=a;else{if(!e[i]&&0!==e[i])return n&&o.convert&&o.convert[n]?o.convert[n].call(o,""):"";s="function"==typeof e[i]?e[i].apply(o):e[i]}return n&&o.convert&&o.convert[n]?o.convert[n].call(o,s):s})}},{key:"resolveAbsBlock",value:function(t){var e=this;return t=t.replace(/{(.*?)}/g,function(t,a){var o=e.getDataByString(a);return void 0!==o?"function"==typeof o?o.apply(e):o:t})}},{key:"resolveInclude",value:function(t){return t=t.replace(/<!-- #include id="(.*?)" -->/g,function(t,e){return c("#"+e).innerHTML})}},{key:"resolveWith",value:function(t){return t=t.replace(/<!-- BEGIN ([a-zA-Z0-9._-]+):with -->(([\n\r\t]|.)*?)<!-- END ([a-zA-Z0-9._-]+):with -->/g,function(t,e,a){return t=t.replace(/data\-bind=['"](.*?)['"]/g,"data-bind='"+e+".$1'")})}},{key:"resolveLoop",value:function(t){var e=this;return t=t.replace(/<!-- BEGIN (.+?):loop -->(([\n\r\t]|.)*?)<!-- END (.+?):loop -->/g,function(t,a,o){var i=e.getDataByString(a),r=[];r="function"==typeof i?i.apply(e):i;var n="";if(r instanceof Array)for(var s=0,h=r.length;s<h;s++)n+=e.resolveBlock(o,r[s],s);return n=n.replace(/\\([^\\])/g,"$1")})}},{key:"removeData",value:function(t){var e=this.data;for(var a in e)for(var o=0,i=t.length;o<i;o++)a===t[o]&&delete e[a];return this}},{key:"hasLoop",value:function(t){return!!t.match(/<!-- BEGIN (.+?):loop -->(([\n\r\t]|.)*?)<!-- END (.+?):loop -->/g)}},{key:"getHtml",value:function(t,e){var a=this.atemplate.find(function(e){return e.id===t}),o="";if(a&&a.html&&(o=a.html),e&&(o=t),!o)return"";var i=this.data;for(o=this.resolveInclude(o),o=this.resolveWith(o);this.hasLoop(o);)o=this.resolveLoop(o);return o=this.resolveBlock(o,i),o=o.replace(/\\([^\\])/g,"$1"),o=this.resolveAbsBlock(o),o.replace(/^([\t ])*\n/gm,"")}},{key:"update",value:function(t,e){var a=(this.getHtml(),this.templates),o=t||"html";this.beforeUpdated&&this.beforeUpdated();for(var i=0,n=a.length;i<n;i++){var s=a[i],h="#"+s,d=this.getHtml(s),l=c("[data-id='"+s+"']");if((!e||e==s)&&(l?"text"===o?l.innerText=d:r(l,"<div data-id='"+s+"'>"+d+"</div>"):(c(h).insertAdjacentHTML("afterend",'<div data-id="'+s+'"></div>'),"text"===o?c("[data-id='"+s+"']").innerText=d:c("[data-id='"+s+"']").innerHTML=d),e))break}return this.updateBindingData(e),this.onUpdated&&this.onUpdated(e),this}},{key:"updateBindingData",value:function(t){for(var e=this,a=this.templates,o=0,i=a.length;o<i;o++){var r=a[o];if(!t||t==r){var n=c("[data-id='"+r+"']"),s=n.querySelectorAll("[data-bind]");if([].forEach.call(s,function(t){var a=e.getDataByString(t.getAttribute("data-bind"));"checkbox"===t.getAttribute("type")||"radio"===t.getAttribute("type")?a==t.value&&(t.checked=!0):t.value=a}),t)break}}return this}},{key:"applyMethod",value:function(t){var e=[].splice.call(arguments,0);return e.shift(),this.method[t].apply(this,e)}},{key:"getComputedProp",value:function(t){return this.data[t].apply(this)}},{key:"remove",value:function(t){for(var e=this.data,a=t.split(".");a.length>1;)e=e[a.shift()];var o=a.shift();return o.match(/^\d+$/)?e.splice(Number(o),1):delete e[o],this}}]),t}();e.exports=f},{delegate:3,morphdom:4}],2:[function(t,e,a){function o(t,e){for(;t&&t.nodeType!==i;){if(t.matches(e))return t;t=t.parentNode}}var i=9;if("undefined"!=typeof Element&&!Element.prototype.matches){var r=Element.prototype;r.matches=r.matchesSelector||r.mozMatchesSelector||r.msMatchesSelector||r.oMatchesSelector||r.webkitMatchesSelector}e.exports=o},{}],3:[function(t,e,a){function o(t,e,a,o,r){var n=i.apply(this,arguments);return t.addEventListener(a,n,r),{destroy:function(){t.removeEventListener(a,n,r)}}}function i(t,e,a,o){return function(a){a.delegateTarget=r(a.target,e),a.delegateTarget&&o.call(t,a)}}var r=t("./closest");e.exports=o},{"./closest":2}],4:[function(t,e,a){"use strict";function o(t){!l&&f.createRange&&(l=f.createRange(),l.selectNode(f.body));var e;return l&&l.createContextualFragment?e=l.createContextualFragment(t):(e=f.createElement("body"),e.innerHTML=t),e.childNodes[0]}function i(t,e){var a=t.nodeName,o=e.nodeName;return a===o||!!(e.actualize&&a.charCodeAt(0)<91&&o.charCodeAt(0)>90)&&a===o.toUpperCase()}function r(t,e){return e&&e!==p?f.createElementNS(e,t):f.createElement(t)}function n(t,e){for(var a=t.firstChild;a;){var o=a.nextSibling;e.appendChild(a),a=o}return e}function s(t,e){var a,o,i,r,n,s=e.attributes;for(a=s.length-1;a>=0;--a)o=s[a],i=o.name,r=o.namespaceURI,n=o.value,r?(i=o.localName||i,t.getAttributeNS(r,i)!==n&&t.setAttributeNS(r,i,n)):t.getAttribute(i)!==n&&t.setAttribute(i,n);for(s=t.attributes,a=s.length-1;a>=0;--a)o=s[a],!1!==o.specified&&(i=o.name,r=o.namespaceURI,r?(i=o.localName||i,v(e,r,i)||t.removeAttributeNS(r,i)):v(e,null,i)||t.removeAttribute(i))}function h(t,e,a){t[a]!==e[a]&&(t[a]=e[a],t[a]?t.setAttribute(a,""):t.removeAttribute(a,""))}function d(){}function c(t){return t.id}var l,u,p="http://www.w3.org/1999/xhtml",f="undefined"==typeof document?void 0:document,m=f?f.body||f.createElement("div"):{};u=m.hasAttributeNS?function(t,e,a){return t.hasAttributeNS(e,a)}:m.hasAttribute?function(t,e,a){return t.hasAttribute(a)}:function(t,e,a){return null!=t.getAttributeNode(e,a)};var v=u,g={OPTION:function(t,e){h(t,e,"selected")},INPUT:function(t,e){h(t,e,"checked"),h(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),v(e,null,"value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var a=e.value;if(t.value!==a&&(t.value=a),t.firstChild){if(""===a&&t.firstChild.nodeValue===t.placeholder)return;t.firstChild.nodeValue=a}},SELECT:function(t,e){if(!v(e,null,"multiple")){for(var a=0,o=e.firstChild;o;){var i=o.nodeName;if(i&&"OPTION"===i.toUpperCase()){if(v(o,null,"selected")){a;break}a++}o=o.nextSibling}t.selectedIndex=a}}},y=1,x=3,P=8,w=function(t){return function(e,a,s){function h(t){E?E.push(t):E=[t]}function l(t,e){if(t.nodeType===y)for(var a=t.firstChild;a;){var o=void 0;e&&(o=S(a))?h(o):(A(a),a.firstChild&&l(a,e)),a=a.nextSibling}}function u(t,e,a){!1!==k(t)&&(e&&e.removeChild(t),A(t),l(t,a))}function p(t){if(t.nodeType===y)for(var e=t.firstChild;e;){var a=S(e);a&&(C[a]=e),p(e),e=e.nextSibling}}function m(t){N(t);for(var e=t.firstChild;e;){var a=e.nextSibling,o=S(e);if(o){var r=C[o];r&&i(e,r)&&(e.parentNode.replaceChild(r,e),v(r,e))}m(e),e=a}}function v(o,r,n){var s,d=S(r);if(d&&delete C[d],!a.isSameNode||!a.isSameNode(e)){if(!n){if(!1===I(o,r))return;if(t(o,r),_(o),!1===D(o,r))return}if("TEXTAREA"!==o.nodeName){var c,l,p,w,E=r.firstChild,N=o.firstChild;t:for(;E;){for(p=E.nextSibling,c=S(E);N;){if(l=N.nextSibling,E.isSameNode&&E.isSameNode(N)){E=p,N=l;continue t}s=S(N);var k=N.nodeType,A=void 0;if(k===E.nodeType&&(k===y?(c?c!==s&&((w=C[c])?N.nextSibling===w?A=!1:(o.insertBefore(w,N),l=N.nextSibling,s?h(s):u(N,o,!0),N=w):A=!1):s&&(A=!1),(A=!1!==A&&i(N,E))&&v(N,E)):k!==x&&k!=P||(A=!0,N.nodeValue=E.nodeValue)),A){E=p,N=l;continue t}s?h(s):u(N,o,!0),N=l}if(c&&(w=C[c])&&i(w,E))o.appendChild(w),v(w,E);else{var B=b(E);!1!==B&&(B&&(E=B),E.actualize&&(E=E.actualize(o.ownerDocument||f)),o.appendChild(E),m(E))}E=p,N=l}for(;N;)l=N.nextSibling,(s=S(N))?h(s):u(N,o,!0),N=l}var z=g[o.nodeName];z&&z(o,r)}}if(s||(s={}),"string"==typeof a)if("#document"===e.nodeName||"HTML"===e.nodeName){var w=a;a=f.createElement("html"),a.innerHTML=w}else a=o(a);var E,S=s.getNodeKey||c,b=s.onBeforeNodeAdded||d,N=s.onNodeAdded||d,I=s.onBeforeElUpdated||d,_=s.onElUpdated||d,k=s.onBeforeNodeDiscarded||d,A=s.onNodeDiscarded||d,D=s.onBeforeElChildrenUpdated||d,B=!0===s.childrenOnly,C={};p(e);var z=e,T=z.nodeType,G=a.nodeType;if(!B)if(T===y)G===y?i(e,a)||(A(e),z=n(e,r(a.nodeName,a.namespaceURI))):z=a;else if(T===x||T===P){if(G===T)return z.nodeValue=a.nodeValue,z;z=a}if(z===a)A(e);else if(v(z,a,B),E)for(var O=0,M=E.length;O<M;O++){var X=C[E[O]];X&&u(X,X.parentNode,!1)}return!B&&z!==e&&e.parentNode&&(z.actualize&&(z=z.actualize(e.ownerDocument||f)),e.parentNode.replaceChild(z,e)),z}}(s);e.exports=w},{}],5:[function(t,e,a){"use strict";var o=t("../index"),i=function(t){t.fn.smartPhoto=function(t){return"strings"==typeof t||new o(this.selector,t),this}};if("function"==typeof define&&define.amd)define(["jquery"],i);else{var r=window.jQuery?window.jQuery:window.$;void 0!==r&&i(r)}e.exports=i},{"../index":7}],6:[function(t,e,a){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var n=function(){function t(t,e){for(var a=0;a<e.length;a++){var o=e[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,a,o){return a&&t(e.prototype,a),o&&t(e,o),e}}(),s=t("a-template"),h=function(t){return t&&t.__esModule?t:{default:t}}(s),d='<div class="\\{classNames.smartPhoto\\}"\x3c!-- BEGIN hide:exist --\x3e style="display:none;"\x3c!-- END hide:exist --\x3e>\n\t<div class="\\{classNames.smartPhotoBody\\}">\n\t\t<div class="\\{classNames.smartPhotoInner\\}">\n\t\t\t <div class="\\{classNames.smartPhotoHeader\\}">\n\t\t\t\t\t<span class="\\{classNames.smartPhotoCount\\}">{currentIndex}[increment]/{total}</span>\n\t\t\t\t\t<span class="\\{classNames.smartPhotoCaption\\}">\x3c!-- BEGIN groupItems:loop --\x3e\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3e{caption}\x3c!-- \\END currentIndex:touch#{index} --\x3e\x3c!-- END groupItems:loop --\x3e</span>\n\t\t\t\t\t<button class="\\{classNames.smartPhotoDismiss\\}" data-action-click="hidePhoto()"></button>\n\t\t\t\t</div>\n\t\t\t\t<div class="\\{classNames.smartPhotoContent\\}"\x3c!-- BEGIN isSmartPhone:exist --\x3e data-action-touchstart="beforeDrag" data-action-touchmove="onDrag" data-action-touchend="afterDrag(false)"\x3c!-- END isSmartPhone:exist --\x3e>\n\t\t\t\t</div>\n\t\t\t\t<ul style="transform:translate({translateX}px,{translateY}px);" class="\\{classNames.smartPhotoList\\}\x3c!-- BEGIN onMoveClass:exist --\x3e \\{classNames.smartPhotoListOnMove\\}\x3c!-- END onMoveClass:exist --\x3e">\n\t\t\t\t\t\x3c!-- BEGIN groupItems:loop --\x3e\n\t\t\t\t\t<li style="transform:translate({translateX}px,{translateY}px);" class="\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3ecurrent\x3c!-- \\END currentIndex:touch#{index} --\x3e">\n\t\t\t\t\t\t\x3c!-- BEGIN loaded:exist --\x3e\n\t\t\t\t\t\t<div style="transform:translate({x}px,{y}px) scale({scale});" class="\\\\{classNames.smartPhotoImgWrap\\\\}"\x3c!-- \\BEGIN isSmartPhone:empty --\x3e data-action-mousemove="onDrag" data-action-mousedown="beforeDrag" data-action-mouseup="afterDrag"\x3c!-- \\END isSmartPhone:empty --\x3e\x3c!-- \\BEGIN isSmartPhone:exist --\x3e data-action-touchstart="beforeDrag" data-action-touchmove="onDrag" data-action-touchend="afterDrag"\x3c!-- \\END isSmartPhone:exist --\x3e>\n\t\t\t\t\t\t\t<img style="\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3etransform:translate(\\{photoPosX\\}[virtualPos]px,\\{photoPosY\\}[virtualPos]px) scale(\\{scaleSize\\});\x3c!-- \\END currentIndex:touch#{index} --\x3e" src="{src}" class="\\\\{classNames.smartPhotoImg\\\\}\x3c!-- \\BEGIN scale:exist --\x3e \\\\{classNames.smartPhotoImgOnMove\\\\}\x3c!-- \\END scale:exist --\x3e\x3c!-- \\BEGIN elastic:exist --\x3e \\\\{classNames.smartPhotoImgElasticMove\\\\}\x3c!-- \\END elastic:exist --\x3e\x3c!-- \\BEGIN appear:exist --\x3e active\x3c!-- \\END appear:exist --\x3e" ondragstart="return false;">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\x3c!-- END loaded:exist --\x3e\n\t\t\t\t\t\t\x3c!-- BEGIN loaded:empty --\x3e\n\t\t\t\t\t\t<div class="\\\\{classNames.smartPhotoLoaderWrap\\\\}">\n\t\t\t\t\t\t\t<span class="\\\\{classNames.smartPhotoLoader\\\\}"></span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\x3c!-- END loaded:empty --\x3e\n\t\t\t\t\t</li>\n\t\t\t\t\t\x3c!-- END groupItems:loop --\x3e\n\t\t\t\t</ul>\n\t\t\t\t\x3c!-- BEGIN arrows:exist --\x3e\n\t\t\t\t<ul class="\\{classNames.smartPhotoArrows\\}\x3c!-- BEGIN hideUi:exist --\x3e hide\x3c!-- END hideUi:exist --\x3e">\n\t\t\t\t\t<li class="\\{classNames.smartPhotoArrowLeft\\}\x3c!-- BEGIN showPrevArrow:exist --\x3e show\x3c!-- END showPrevArrow:exist --\x3e" data-action-click="gotoSlide({prev})"></li>\n\t\t\t\t\t<li class="\\{classNames.smartPhotoArrowRight\\}\x3c!-- BEGIN showNextArrow:exist --\x3e show\x3c!-- END showNextArrow:exist --\x3e" data-action-click="gotoSlide({next})"></li>\n\t\t\t\t</ul>\n\t\t\t\t\x3c!-- END arrows:exist --\x3e\n\t\t\t\t\x3c!-- BEGIN nav:exist --\x3e\n\t\t\t\t<nav class="\\{classNames.smartPhotoNav\\}\x3c!-- BEGIN hideUi:exist --\x3e hide\x3c!-- END hideUi:exist --\x3e">\n\t\t\t\t\t<ul >\n\t\t\t\t\t\t\x3c!-- BEGIN groupItems:loop --\x3e\n\t\t\t\t\t\t<li data-action-click="gotoSlide({index})" class="\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3ecurrent\x3c!-- \\END currentIndex:touch#{index} --\x3e" style="background-image:url({src});"></li>\n\t\t\t\t\t\t\x3c!-- END groupItems:loop --\x3e\n\t\t\t\t\t</ul>\n\t\t\t\t</nav>\n\t\t\t\t\x3c!-- END nav:exist --\x3e\n\t\t</div>\n\t\t\x3c!-- BEGIN appearEffect:exist --\x3e\n\t\t<img src=\\{appearEffect.img\\}\n\t\tclass="\\{classNames.smartPhotoImgClone\\}"\n\t\tstyle="width:\\{appearEffect.width\\}px;height:\\{appearEffect.height\\}px;transform:translate(\\{appearEffect.left\\}px,\\{appearEffect.top\\}px) scale(1)" />\n\t\t\x3c!-- END appearEffect:exist --\x3e\n\t</div>\n</div>\n',c=t("../lib/util"),l={classNames:{smartPhoto:"smartphoto",smartPhotoClose:"smartphoto-close",smartPhotoBody:"smartphoto-body",smartPhotoInner:"smartphoto-inner",smartPhotoContent:"smartphoto-content",smartPhotoImg:"smartphoto-img",smartPhotoImgOnMove:"smartphoto-img-onmove",smartPhotoImgElasticMove:"smartphoto-img-elasticmove",smartPhotoImgWrap:"smartphoto-img-wrap",smartPhotoArrows:"smartphoto-arrows",smartPhotoNav:"smartphoto-nav",smartPhotoArrowRight:"smartphoto-arrow-right",smartPhotoArrowLeft:"smartphoto-arrow-left",smartPhotoImgLeft:"smartphoto-img-left",smartPhotoImgRight:"smartphoto-img-right",smartPhotoList:"smartphoto-list",smartPhotoListOnMove:"smartphoto-list-onmove",smartPhotoHeader:"smartphoto-header",smartPhotoCount:"smartphoto-count",smartPhotoCaption:"smartphoto-caption",smartPhotoDismiss:"smartphoto-dismiss",smartPhotoLoader:"smartphoto-loader",smartPhotoLoaderWrap:"smartphoto-loader-wrap",smartPhotoImgClone:"smartphoto-img-clone"},arrows:!0,nav:!0,animationSpeed:300,swipeOffset:100,maxWidth:940,headerHeight:60,footerHeight:60,forceInterval:10,registance:.5,resizeStyle:"fill",verticalGravity:!1,useOrientationApi:!0},u=function(t){function e(t,a){o(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));r.data=c.extend({},l,a),r.data.currentIndex=0,r.data.hide=!0,r.data.group={},r.data.scaleSize=1,r.data.scale=!1,r.pos={x:0,y:0},r.data.photoPosX=0,r.data.photoPosY=0,r.convert={increment:r.increment,virtualPos:r.virtualPos},r.data.groupItems=r.groupItems,r.elements=document.querySelectorAll(t);var n=new Date;r.tapSecond=n.getTime(),r.onListMove=!1,r.id=r._getUniqId(),r.vx=0,r.vy=0,r.data.appearEffect=null,r.addTemplate(r.id,d),r.data.isSmartPhone=r._isSmartPhone();var s=document.querySelector("body");c.append(s,"<div data-id='"+r.id+"'></div>"),[].forEach.call(r.elements,function(t,e){r.addNewItem(t)});var h=r._getCurrentItemByHash();return h&&c.triggerEvent(h.element,"click"),r._getEachImageSize(),setInterval(function(){r._doAnim()},r.data.forceInterval),r.data.isSmartPhone?(window.addEventListener("orientationchange",function(t){r._resetTranslate(),r._setPosByCurrentIndex(),r._setHashByCurrentIndex(),r._setSizeByScreen(),r.update()}),r.data.useOrientationApi?(window.addEventListener("deviceorientation",function(t){var e=window.orientation;t&&t.gamma&&!r.data.appearEffect&&(r.isBeingZoomed||r.photoSwipable||r.data.elastic||!r.data.scale||(0===e?r._calcGravity(t.gamma,t.beta):90===e?r._calcGravity(t.beta,t.gamma):-90===e?r._calcGravity(-t.beta,-t.gamma):180===e&&r._calcGravity(-t.gamma,-t.beta)))}),r):i(r)):(window.addEventListener("resize",function(t){r._resetTranslate(),r._setPosByCurrentIndex(),r._setSizeByScreen(),r.update()}),window.addEventListener("keydown",function(t){var e=t.keyCode||t.which;!0!==r.data.hide&&(37===e?r.gotoSlide(r.data.prev):39===e?r.gotoSlide(r.data.next):27===e&&r.hidePhoto())}),i(r))}return r(e,t),n(e,[{key:"increment",value:function(t){return t+1}},{key:"virtualPos",value:function(t){return(t=parseInt(t))/this._getSelectedItem().scale/this.data.scaleSize}},{key:"groupItems",value:function(){return this.data.group[this.data.currentGroup]}},{key:"_getEachImageSize",value:function(){var t=[],e=this.data.group;for(var a in e)e.hasOwnProperty(a)&&e[a].forEach(function(e){var a=new Promise(function(t,a){var o=new Image;o.onload=function(){e.width=o.width,e.height=o.height,e.loaded=!0,t()},o.onerror=function(){t()},o.src=e.src});t.push(a)});return Promise.all(t)}},{key:"_resetTranslate",value:function(){this.groupItems().forEach(function(t,e){t.translateX=window.innerWidth*e})}},{key:"addNewItem",value:function(t){var e=this,a=t.getAttribute("data-group")||"nogroup",o=this.data.group;"nogroup"===a&&t.setAttribute("data-group","nogroup"),o[a]||(o[a]=[]);var i=o[a].length,r={src:t.getAttribute("href"),caption:t.getAttribute("data-caption"),groupId:a,translateX:window.innerWidth*i,index:i,translateY:0,width:50,height:50,id:t.getAttribute("data-id")||i,loaded:!1,element:t};o[a].push(r),this.data.currentGroup=a,t.getAttribute("data-id")||t.setAttribute("data-id",i),t.setAttribute("data-index",i),t.addEventListener("click",function(a){a.preventDefault(),e.data.currentGroup=t.getAttribute("data-group"),e.data.currentIndex=parseInt(t.getAttribute("data-index")),e._setHashByCurrentIndex();var o=e._getSelectedItem();o.loaded?(e._initPhoto(),e.addAppearEffect(t),e.update()):e._loadItem(o).then(function(){e.data.appear=!0,e._initPhoto(),e.update()})})}},{key:"_initPhoto",value:function(){this.data.total=this.groupItems().length,this.data.hide=!1,this.data.photoPosX=0,this.data.photoPosY=0,this._setPosByCurrentIndex(),this._setSizeByScreen(),this.setArrow(),"fill"===this.data.resizeStyle&&this.data.isSmartPhone&&(this.data.scale=!0,this.data.hideUi=!0,this.data.scaleSize=this._getScaleBoarder())}},{key:"onUpdated",value:function(){var t=this;this.data.appearEffect&&this.data.appearEffect.once&&(this.data.appearEffect.once=!1,this.execEffect().then(function(){t.replaceEffectWithImg()}))}},{key:"execEffect",value:function(){var t=this.data.appearEffect,e=this.data.classNames,a=document.querySelector('[data-id="'+this.id+'"] .'+e.smartPhotoImgClone);return new Promise(function(e,o){setTimeout(function(){a.style.transition="all .3s ease-out",a.style.transform="translate("+t.afterX+"px, "+t.afterY+"px) scale("+t.scale+")",e()},30)})}},{key:"replaceEffectWithImg",value:function(){var t=this;this.data.classNames;setTimeout(function(){t.data.appearEffect=null,t.data.appear=!0,t.update()},300)}},{key:"addAppearEffect",value:function(t){var e=t.querySelector("img"),a=(e.cloneNode(!0),c.getViewPos(e)),o={},i=1;o.width=e.offsetWidth,o.height=e.offsetHeight,o.top=a.top,o.left=a.left,o.once=!0,o.img=e.getAttribute("src");var r=window.innerWidth,n=window.innerHeight,s=n-this.data.headerHeight-this.data.footerHeight;"fill"===this.data.resizeStyle&&this.data.isSmartPhone?i=e.offsetWidth>e.offsetHeight?n/e.offsetHeight:r/e.offsetWidth:(i=s/e.offsetHeight)*e.offsetWidth>r&&(i=r/e.offsetWidth);var h=(i-1)/2*e.offsetWidth+(r-e.offsetWidth*i)/2,d=(i-1)/2*e.offsetHeight+(n-e.offsetHeight*i)/2;o.afterX=h,o.afterY=d,o.scale=i,this.data.appearEffect=o}},{key:"hidePhoto",value:function(){var t=this;this.data.hide=!0,this.data.appear=!1,this.data.appearEffect=null;var e=window.scrollX,a=window.scrollY;location.hash&&(location.hash=""),window.scroll(e,a),this._doHideEffect().then(function(){t.update()})}},{key:"_doHideEffect",value:function(){var t=this;return new Promise(function(e,a){var o=t.data.classNames,i=t._getElementByClass(o.smartPhoto),r=t._getElementByQuery(".current ."+o.smartPhotoImg),n=window.innerHeight,s=function t(){i.removeEventListener("transitionend",t,!0),e()};i.style.opacity=0,r.style.transform="translateY("+n+"px)",i.addEventListener("transitionend",s,!0)})}},{key:"_getElementByClass",value:function(t){return document.querySelector('[data-id="'+this.id+'"] .'+t)}},{key:"_getElementByQuery",value:function(t){return document.querySelector('[data-id="'+this.id+'"] '+t)}},{key:"_getTouchPos",value:function(t){var e=0,a=0;if(void 0===o)var o=this.e;return this._isTouched(o)?(e=o.touches[0].pageX,a=o.touches[0].pageY):this._isTouched(this.e)?(e=this.e.touches[0].pageX,a=this.e.touches[0].pageY):o.pageX&&(e=o.pageX,a=o.pageY),{x:e,y:a}}},{key:"_getGesturePos",value:function(t){var e=t.touches;return[{x:e[0].pageX,y:e[0].pageY},{x:e[1].pageX,y:e[1].pageY}]}},{key:"_setPosByCurrentIndex",value:function(){var t=this,e=this.groupItems(),a=-1*e[this.data.currentIndex].translateX;this.pos.x=a,setTimeout(function(){t.data.translateX=a,t.data.translateY=0,t._listUpdate()},1)}},{key:"_setHashByCurrentIndex",value:function(){var t=window.scrollX,e=window.scrollY,a=this.groupItems(),o=a[this.data.currentIndex].id,i=this.data.currentGroup,r="group="+i+"&photo="+o;location.hash=r,window.scroll(t,e)}},{key:"_getCurrentItemByHash",value:function(){var t=this.data.group,e=location.hash.substr(1),a=c.parseQuery(e),o=null;for(var i in t)t.hasOwnProperty(i)&&t[i].forEach(function(t){a.group===t.groupId&&a.photo===t.id&&(o=t)});return o}},{key:"_loadItem",value:function(t){return new Promise(function(e,a){var o=new Image;o.onload=function(){t.width=o.width,t.height=o.height,t.loaded=!0,e()},o.onerror=function(){e()},o.src=t.src})}},{key:"_setSizeByScreen",value:function(){var t=window.innerWidth,e=window.innerHeight,a=this.data.headerHeight,o=this.data.footerHeight,i=e-(a+o);this.groupItems().forEach(function(a){a.scale=i/a.height,a.x=(a.scale-1)/2*a.width+(t-a.width*a.scale)/2,a.y=(a.scale-1)/2*a.height+(e-a.height*a.scale)/2,a.width*a.scale>t&&(a.scale=t/a.width,a.x=(a.scale-1)/2*a.width)})}},{key:"_slideList",value:function(){var t=this;this.data.onMoveClass=!0,this._setPosByCurrentIndex(),this._setHashByCurrentIndex(),this._setSizeByScreen(),setTimeout(function(){t.data.onMoveClass=!1,t.setArrow(),t.update()},200)}},{key:"gotoSlide",value:function(t){this.data.currentIndex=parseInt(t),this.data.currentIndex||(this.data.currentIndex=0),this._slideList()}},{key:"setArrow",value:function(){var t=this.groupItems(),e=t.length,a=this.data.currentIndex+1,o=this.data.currentIndex-1;this.data.showNextArrow=!1,this.data.showPrevArrow=!1,a!==e&&(this.data.next=a,this.data.showNextArrow=!0),-1!==o&&(this.data.prev=o,this.data.showPrevArrow=!0)}},{key:"beforeDrag",value:function(){if(this._isGestured(this.e))return void this.beforeGesture();if(this.data.scale)return void this.beforePhotoDrag();var t=this._getTouchPos(this.e);this.isSwipable=!0,this.dragStart=!0,this.firstPos=t,this.oldPos=t}},{key:"afterDrag",value:function(t){var e=this.groupItems(),a=new Date,o=a.getTime(),i=this.tapSecond-o,r=0,n=0;return this.isSwipable=!1,this.onListMove=!1,this.oldPos&&(r=this.oldPos.x-this.firstPos.x,n=this.oldPos.y-this.firstPos.y),this.isBeingZoomed?void this.afterGesture():this.data.scale?void this.afterPhotoDrag():c.isSmartPhone()||0!==r||0!==n?Math.abs(i)<=500&&0===r&&0===n?(this.e.preventDefault(),void this.zoomPhoto()):(this.tapSecond=o,"horizontal"===this.moveDir&&(r>=this.data.swipeOffset&&0!==this.data.currentIndex?this.data.currentIndex--:r<=-this.data.swipeOffset&&this.data.currentIndex!=e.length-1&&this.data.currentIndex++,this._slideList()),void("vertical"===this.moveDir&&(n>=this.data.swipeOffset?this.hidePhoto():(this.data.translateY=0,this._slideList())))):void this.zoomPhoto()}},{key:"onDrag",value:function(){if(this.e.preventDefault(),this._isGestured(this.e)&&!1===this.onListMove)return void this.onGesture();if(!this.isBeingZoomed){if(this.data.scale)return void this.onPhotoDrag();if(this.isSwipable){var t=this._getTouchPos(this.e),e=t.x-this.oldPos.x,a=t.y-this.firstPos.y;this.dragStart&&(this.dragStart=!1,Math.abs(e)>Math.abs(a)?this.moveDir="horizontal":this.moveDir="vertical"),"horizontal"===this.moveDir?(this.pos.x+=e,this.data.translateX=this.pos.x):this.data.translateY=a,this.onListMove=!0,this.oldPos=t,this._listUpdate()}}}},{key:"zoomPhoto",value:function(){var t=this;this.data.hideUi=!0,this.data.scaleSize=this._getScaleBoarder(),this.data.photoPosX=0,this.data.photoPosY=0,this._photoUpdate(),setTimeout(function(){t.data.scale=!0,t._photoUpdate()},300)}},{key:"zoomOutPhoto",value:function(){this.data.scaleSize=1,this.isBeingZoomed=!1,this.data.hideUi=!1,this.data.scale=!1,this.data.photoPosX=0,this.data.photoPosY=0,this._photoUpdate()}},{key:"beforePhotoDrag",value:function(){var t=this._getTouchPos(this.e)
;this.photoSwipable=!0,this.data.photoPosX||(this.data.photoPosX=0),this.data.photoPosY||(this.data.photoPosY=0),this.oldPhotoPos=t,this.firstPhotoPos=t}},{key:"onPhotoDrag",value:function(){if(this.photoSwipable){this.e.preventDefault();var t=this._getTouchPos(this.e),e=t.x-this.oldPhotoPos.x,a=t.y-this.oldPhotoPos.y,o=this._round(this.data.scaleSize*e,6),i=this._round(this.data.scaleSize*a,6);"number"==typeof o&&(this.data.photoPosX+=o,this.photoVX=o),"number"==typeof i&&(this.data.photoPosY+=i,this.photoVY=i),this.oldPhotoPos=t,this._photoUpdate()}}},{key:"afterPhotoDrag",value:function(){if(this.oldPhotoPos.x===this.firstPhotoPos.x&&this.photoSwipable)this.zoomOutPhoto();else{var t=this._getSelectedItem(),e=this._makeBound(t),a=0,o=0;this.data.photoPosX>e.maxX?a=-1:this.data.photoPosX<e.minX&&(a=1),this.data.photoPosY>e.maxY?o=-1:this.data.photoPosY<e.minY&&(o=1),0===a&&0===o?(this.vx=this.photoVX/5,this.vy=this.photoVY/5):this._registerElasticForce(a,o)}this.photoSwipable=!1}},{key:"beforeGesture",value:function(){var t=this._getGesturePos(this.e),e=this._getDistance(t[0],t[1]);this.isBeingZoomed=!0,this.oldDistance=e,this.data.scale=!0,this.e.preventDefault()}},{key:"onGesture",value:function(){var t=this._getGesturePos(this.e),e=this._getDistance(t[0],t[1]),a=(e-this.oldDistance)/100,o=this.data.scaleSize,i=this.data.photoPosX,r=this.data.photoPosY;this._getSelectedItem();this.data.scaleSize+=this._round(a,6),this.data.scaleSize<.2&&(this.data.scaleSize=.2),this.data.scaleSize<o&&(this.data.photoPosX=(1+this.data.scaleSize-o)*i,this.data.photoPosY=(1+this.data.scaleSize-o)*r),this.data.scaleSize<1||this.data.scaleSize>this._getScaleBoarder()?this.data.hideUi=!0:this.data.hideUi=!1,this.oldDistance=e,this.e.preventDefault(),this._photoUpdate()}},{key:"afterGesture",value:function(){this.isBeingZoomed=!1,this.data.scaleSize>this._getScaleBoarder()||(this.data.photoPosX=0,this.data.photoPosY=0,this.data.scale=!1,this.data.scaleSize=1,this.data.hideUi=!1,this._photoUpdate())}},{key:"_getForceAndTheta",value:function(t,e){return{force:Math.sqrt(t*t+e*e),theta:Math.atan2(e,t)}}},{key:"_getScaleBoarder",value:function(){var t=this._getSelectedItem();return c.isSmartPhone()?t.width>t.height?window.innerHeight/(t.height*t.scale):window.innerWidth/(t.width*t.scale):1/t.scale}},{key:"_makeBound",value:function(t){var e=t.width*t.scale*this.data.scaleSize,a=t.height*t.scale*this.data.scaleSize,o=void 0,i=void 0,r=void 0,n=void 0;return window.innerWidth>e?(r=(window.innerWidth-e)/2,o=-1*r):(r=(e-window.innerWidth)/2,o=-1*r),window.innerHeight>a?(n=(window.innerHeight-a)/2,i=-1*n):(n=(a-window.innerHeight)/2,i=-1*n),{minX:this._round(o,6)*this.data.scaleSize,minY:this._round(i,6)*this.data.scaleSize,maxX:this._round(r,6)*this.data.scaleSize,maxY:this._round(n,6)*this.data.scaleSize}}},{key:"_registerElasticForce",value:function(t,e){var a=this,o=this._getSelectedItem(),i=this._makeBound(o);this.data.elastic=!0,1===t?this.data.photoPosX=i.minX:-1===t&&(this.data.photoPosX=i.maxX),1===e?this.data.photoPosY=i.minY:-1===e&&(this.data.photoPosY=i.maxY),this._photoUpdate(),setTimeout(function(){a.data.elastic=!1,a._photoUpdate()},300)}},{key:"_getSelectedItem",value:function(){var t=this.data,e=t.currentIndex;return t.group[t.currentGroup][e]}},{key:"_getUniqId",value:function(){return(Date.now().toString(36)+Math.random().toString(36).substr(2,5)).toUpperCase()}},{key:"_getDistance",value:function(t,e){var a=t.x-e.x,o=t.y-e.y;return Math.sqrt(a*a+o*o)}},{key:"_round",value:function(t,e){var a=Math.pow(10,e);return t*=a,t=Math.round(t),t/=a}},{key:"_isTouched",value:function(t){return!(!t||!t.touches)}},{key:"_isGestured",value:function(t){return!!(t&&t.touches&&t.touches.length>1)}},{key:"_isSmartPhone",value:function(){var t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0}},{key:"_calcGravity",value:function(t,e){(t>5||t<-5)&&(this.vx+=.05*t),!1!==this.data.verticalGravity&&(e>5||e<-5)&&(this.vy+=.05*e)}},{key:"_photoUpdate",value:function(){var t=this.data.classNames,e=this._getElementByQuery(".current"),a=e.querySelector("."+t.smartPhotoImg),o=this._getElementByQuery("."+t.smartPhotoNav),i=this._getElementByQuery("."+t.smartPhotoArrows),r=this.virtualPos(this.data.photoPosX),n=this.virtualPos(this.data.photoPosY),s=this.data.scaleSize,h="translate("+r+"px,"+n+"px) scale("+s+")";a.style.transform=h,this.data.scale?c.addClass(a,t.smartPhotoImgOnMove):c.removeClass(a,t.smartPhotoImgOnMove),this.data.elastic?c.addClass(a,t.smartPhotoImgElasticMove):c.removeClass(a,t.smartPhotoImgElasticMove),this.data.hideUi?(c.addClass(o,"hide"),c.addClass(i,"hide"),setTimeout(function(){c.addClass(o,"none"),c.addClass(i,"none")},100)):(c.removeClass(o,"none"),c.removeClass(i,"none"),setTimeout(function(){c.removeClass(o,"hide"),c.removeClass(i,"hide")},10))}},{key:"_listUpdate",value:function(){var t=this.data.classNames,e=this._getElementByQuery("."+t.smartPhotoList),a="translate("+this.data.translateX+"px,"+this.data.translateY+"px)";e.style.transform=a,this.data.onMoveClass?c.addClass(e,t.smartPhotoListOnMove):c.removeClass(e,t.smartPhotoListOnMove)}},{key:"_doAnim",value:function(){if(!(this.isBeingZoomed||this.isSwipable||this.photoSwipable||this.data.elastic)&&this.data.scale){this.data.photoPosX+=this.vx,this.data.photoPosY+=this.vy;var t=this._getSelectedItem(),e=this._makeBound(t);this.data.photoPosX<e.minX?(this.data.photoPosX=e.minX,this.vx*=-.2):this.data.photoPosX>e.maxX&&(this.data.photoPosX=e.maxX,this.vx*=-.2),this.data.photoPosY<e.minY?(this.data.photoPosY=e.minY,this.vy*=-.2):this.data.photoPosY>e.maxY&&(this.data.photoPosY=e.maxY,this.vy*=-.2);var a=this._getForceAndTheta(this.vx,this.vy),o=a.force,i=a.theta;o-=this.data.registance,Math.abs(o)<.5||(this.vx=Math.cos(i)*o,this.vy=Math.sin(i)*o,this._photoUpdate())}}}]),e}(h.default);e.exports=u},{"../lib/util":8,"a-template":1}],7:[function(t,e,a){"use strict";e.exports=t("./core/")},{"./core/":6}],8:[function(t,e,a){"use strict";function o(t){t=t||{};for(var e=1;e<arguments.length;e++){var a=arguments[e];if(a)for(var r in a)a.hasOwnProperty(r)&&("object"===i(a[r])?t[r]=o(t[r],a[r]):t[r]=a[r])}return t}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.exports.isSmartPhone=function(){var t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0},e.exports.extend=o,e.exports.triggerEvent=function(t,e,a){var o=void 0;window.CustomEvent?o=new CustomEvent(e,{cancelable:!0}):(o=document.createEvent("CustomEvent"),o.initCustomEvent(e,!1,!1,a)),t.dispatchEvent(o)},e.exports.parseQuery=function(t){for(var e,a,o,i=t.split("&"),r={},n=0,s=i.length;n<s;n++)e=i[n].split("="),void 0!==e[0]&&(a=e[0],o=void 0!==e[1]?e.slice(1).join("="):a,r[a]=decodeURIComponent(o));return r},e.exports.getViewPos=function(t){return{left:t.getBoundingClientRect().left,top:t.getBoundingClientRect().top}},e.exports.removeElement=function(t){t&&t.parentNode&&t.parentNode.removeChild(t)},e.exports.append=function(t,e){var a=new DOMParser,o=a.parseFromString(e,"text/html");t.appendChild(o.querySelector("body").childNodes[0])},e.exports.addClass=function(t,e){t.classList?t.classList.add(e):t.className+=" "+e},e.exports.removeClass=function(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\b)"+e.split(" ").join("|")+"(\\b|$)","gi")," ")}},{}]},{},[5]);

@@ -9,3 +9,3 @@ /**

* homepage: http://developer.a-blogcms.jp
* version: 0.3.1
* version: 0.3.2
*

@@ -21,8 +21,2 @@ * a-template:

*
* keyboard-js:
* license: MIT (http://opensource.org/licenses/MIT)
* author: creamidea
* homepage: https://github.com/creamidea/keyboard-js#readme
* version: 1.1.4
*
* morphdom:

@@ -35,3 +29,3 @@ * license: MIT (http://opensource.org/licenses/MIT)

*/
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.smartPhoto=t()}}(function(){var t;return function t(e,a,o){function i(n,s){if(!a[n]){if(!e[n]){var h="function"==typeof require&&require;if(!s&&h)return h(n,!0);if(r)return r(n,!0);var c=new Error("Cannot find module '"+n+"'");throw c.code="MODULE_NOT_FOUND",c}var d=a[n]={exports:{}};e[n][0].call(d.exports,function(t){var a=e[n][1][t];return i(a||t)},d,d.exports,t,e,a,o)}return a[n].exports}for(var r="function"==typeof require&&require,n=0;n<o.length;n++)i(o[n]);return i}({1:[function(t,e,a){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var a=0;a<e.length;a++){var o=e[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,a,o){return a&&t(e.prototype,a),o&&t(e,o),e}}(),r=t("morphdom"),n=t("delegate"),s=[],h="input paste copy click change keydown keyup contextmenu mouseup mousedown mousemove touchstart touchend touchmove compositionstart compositionend",c=h.replace(/([a-z]+)/g,"[data-action-$1],")+"[data-action]";Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e=Object(this),a=e.length>>>0,o=arguments[1],i=void 0,r=0;r<a;r++)if(i=e[r],t.call(o,i,r,e))return i}),Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){for(var e=(this.document||this.ownerDocument).querySelectorAll(t),a=e.length;--a>=0&&e.item(a)!==this;);return a>-1});var d=function(t){return document.querySelector(t)},l=function(t){for(var e=0,a=s.length;e<a;e++)for(var o=s[e],i=o.templates,r=0,n=i.length;r<n;r++)if(i[r]==t)return o;return null},u=function(t,e){if("function"==typeof t.closest)return t.closest(e)||null;for(;t;){if(t.matches(e))return t;t=t.parentElement}return null},p=function(t,e,a,o){a.split(" ").forEach(function(a){n(t,e,a,o)})};"undefined"!=typeof document&&(p(document,"[data-bind]","input change click",function(t){var e=t.delegateTarget,a=e.getAttribute("data-bind"),o=e.getAttribute("href"),i=u(e,"[data-id]").getAttribute("data-id"),r=e.value;if(o&&(r=r.replace("#","")),i){var n=l(i);"radio"===e.getAttribute("type")||("checkbox"===e.getAttribute("type")?function(){var t=[],e=document.querySelectorAll('[data-bind="'+a+'"]');[].forEach.call(e,function(e){e.checked&&t.push(e.value)})}():n.updateDataByString(a,r))}}),p(document,c,h,function(t){var e=t.delegateTarget;if(!("click"===t.type&&"select"===e.tagName||"input"===t.type&&"button"===e.getAttribute("type"))){var a=h.split(" "),o="action";a.forEach(function(a){e.getAttribute("data-action-"+a)&&t.type===a&&(o+="-"+a)});var i=e.getAttribute("data-"+o);if(i){var r=i.replace(/\(.*?\);?/,""),n=i.replace(/(.*?)\((.*?)\);?/,"$2"),s=n.split(","),c=u(e,"[data-id]").getAttribute("data-id");if(c){var d=l(c);d.e=t,d.method&&d.method[r]?d.method[r].apply(d,s):d[r]&&d[r].apply(d,s)}}}}));var f=function(){function t(e){o(this,t),this.atemplate=[],s.push(this);for(var a in e)this[a]=e[a];this.data||(this.data={}),this.templates||(this.templates=[]);for(var i=this.templates,r=i.length,n=0,h=r;n<h;n++){var c=this.templates[n],l=d("#"+c).innerHTML;this.atemplate.push({id:c,html:l})}this.setId()}return i(t,[{key:"addTemplate",value:function(t,e){this.atemplate.push({id:t,html:e}),this.templates.push(t)}},{key:"loadHtml",value:function(){var t=this.templates,e=[];return t.forEach(function(t){var a=new $.Deferred;e.push(a);var o=d("#"+t).getAttribute("src");$.ajax({url:o,type:"GET",dataType:"text"}).success(function(e){d("#"+t).innerHTML=e,a.resolve()})}),$.when.apply($,e)}},{key:"getData",value:function(){return JSON.parse(JSON.stringify(this.data))}},{key:"saveData",value:function(t){var e=JSON.stringify(this.data);localStorage.setItem(t,e)}},{key:"setData",value:function(t){for(var e in t)"function"!=typeof t[e]&&(this.data[e]=t[e])}},{key:"loadData",value:function(t){var e=JSON.parse(localStorage.getItem(t));if(e)for(var a in e)"function"!=typeof e[a]&&(this.data[a]=e[a])}},{key:"getRand",value:function(t,e){return~~(Math.random()*(e-t+1))+t}},{key:"getRandText",value:function(t){for(var e="",a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o=a.length,i=0;i<t;i++)e+=a.charAt(Math.floor(this.getRand(0,o)));return e}},{key:"setId",value:function(){for(var e=void 0,a=(t.ids,!1);;){e=this.getRandText(10);for(var o=0,i=t.ids;o<i;o++)t.ids[o]===e&&(a=!0);if(!1===a)break}this.data.aTemplate_id=e}},{key:"getDataFromObj",value:function(t,e){t=t.replace(/\[([a-zA-Z0-9._-]+)\]/g,".$1"),t=t.replace(/^\./,"");for(var a=t.split(".");a.length;){var o=a.shift();if(!(o in e))return;e=e[o]}return e}},{key:"getDataByString",value:function(t){var e=this.data;return this.getDataFromObj(t,e)}},{key:"updateDataByString",value:function(t,e){for(var a=this.data,o=t.split(".");o.length>1;)a=a[o.shift()];a[o.shift()]=e}},{key:"removeDataByString",value:function(t){for(var e=this.data,a=t.split(".");a.length>1;)e=e[a.shift()];var o=a.shift();o.match(/^\d+$/)?e.splice(Number(o),1):delete e[o]}},{key:"resolveBlock",value:function(t,e,a){var o=this,i=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):touch#([a-zA-Z0-9._-]+) -->/g),r=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):touchnot#([a-zA-Z0-9._-]+) -->/g),n=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):exist -->/g),s=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):empty -->/g);if(i)for(var h=0,c=i.length;h<c;h++){var d=i[h];d=d.replace(/([a-zA-Z0-9._-]+):touch#([a-zA-Z0-9._-]+)/,"($1):touch#($2)");var l=d.replace(/BEGIN/,"END"),u=new RegExp(d+"(([\\n\\r\\t]|.)*?)"+l,"g");t=t.replace(u,function(t,a,i,r){return("function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e))==i?r:""})}if(r)for(var p=0,f=r.length;p<f;p++){var m=r[p];m=m.replace(/([a-zA-Z0-9._-]+):touchnot#([a-zA-Z0-9._-]+)/,"($1):touchnot#($2)");var v=m.replace(/BEGIN/,"END"),g=new RegExp(m+"(([\\n\\r\\t]|.)*?)"+v,"g");t=t.replace(g,function(t,a,i,r){return("function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e))!=i?r:""})}if(n)for(var y=0,x=n.length;y<x;y++){var w=n[y];w=w.replace(/([a-zA-Z0-9._-]+):exist/,"($1):exist");var P=w.replace(/BEGIN/,"END"),E=new RegExp(w+"(([\\n\\r\\t]|.)*?)"+P,"g");t=t.replace(E,function(t,a,i){var r="function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e);return r||0===r?i:""})}if(s)for(var b=0,S=s.length;b<S;b++){var N=s[b];N=N.replace(/([a-zA-Z0-9._-]+):empty/,"($1):empty");var _=N.replace(/BEGIN/,"END"),I=new RegExp(N+"(([\\n\\r\\t]|.)*?)"+_,"g");t=t.replace(I,function(t,a,i){var r="function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e);return r||0===r?"":i})}return t=t.replace(/{([a-zA-Z0-9._-]+)}(\[([a-zA-Z0-9._-]+)\])*/g,function(t,i,r,n){var s=void 0;if("i"==i)s=a;else{if(!e[i]&&0!==e[i])return n&&o.convert&&o.convert[n]?o.convert[n].call(o,""):"";s="function"==typeof e[i]?e[i].apply(o):e[i]}return n&&o.convert&&o.convert[n]?o.convert[n].call(o,s):s})}},{key:"resolveAbsBlock",value:function(t){var e=this;return t=t.replace(/{(.*?)}/g,function(t,a){var o=e.getDataByString(a);return void 0!==o?"function"==typeof o?o.apply(e):o:t})}},{key:"resolveInclude",value:function(t){return t=t.replace(/<!-- #include id="(.*?)" -->/g,function(t,e){return d("#"+e).innerHTML})}},{key:"resolveWith",value:function(t){return t=t.replace(/<!-- BEGIN ([a-zA-Z0-9._-]+):with -->(([\n\r\t]|.)*?)<!-- END ([a-zA-Z0-9._-]+):with -->/g,function(t,e,a){return t=t.replace(/data\-bind=['"](.*?)['"]/g,"data-bind='"+e+".$1'")})}},{key:"resolveLoop",value:function(t){var e=this;return t=t.replace(/<!-- BEGIN (.+?):loop -->(([\n\r\t]|.)*?)<!-- END (.+?):loop -->/g,function(t,a,o){var i=e.getDataByString(a),r=[];r="function"==typeof i?i.apply(e):i;var n="";if(r instanceof Array)for(var s=0,h=r.length;s<h;s++)n+=e.resolveBlock(o,r[s],s);return n=n.replace(/\\([^\\])/g,"$1")})}},{key:"removeData",value:function(t){var e=this.data;for(var a in e)for(var o=0,i=t.length;o<i;o++)a===t[o]&&delete e[a];return this}},{key:"hasLoop",value:function(t){return!!t.match(/<!-- BEGIN (.+?):loop -->(([\n\r\t]|.)*?)<!-- END (.+?):loop -->/g)}},{key:"getHtml",value:function(t,e){var a=this.atemplate.find(function(e){return e.id===t}),o="";if(a&&a.html&&(o=a.html),e&&(o=t),!o)return"";var i=this.data;for(o=this.resolveInclude(o),o=this.resolveWith(o);this.hasLoop(o);)o=this.resolveLoop(o);return o=this.resolveBlock(o,i),o=o.replace(/\\([^\\])/g,"$1"),o=this.resolveAbsBlock(o),o.replace(/^([\t ])*\n/gm,"")}},{key:"update",value:function(t,e){var a=(this.getHtml(),this.templates),o=t||"html";this.beforeUpdated&&this.beforeUpdated();for(var i=0,n=a.length;i<n;i++){var s=a[i],h="#"+s,c=this.getHtml(s),l=d("[data-id='"+s+"']");if((!e||e==s)&&(l?"text"===o?l.innerText=c:r(l,"<div data-id='"+s+"'>"+c+"</div>"):(d(h).insertAdjacentHTML("afterend",'<div data-id="'+s+'"></div>'),"text"===o?d("[data-id='"+s+"']").innerText=c:d("[data-id='"+s+"']").innerHTML=c),e))break}return this.updateBindingData(e),this.onUpdated&&this.onUpdated(e),this}},{key:"updateBindingData",value:function(t){for(var e=this,a=this.templates,o=0,i=a.length;o<i;o++){var r=a[o];if(!t||t==r){var n=d("[data-id='"+r+"']"),s=n.querySelectorAll("[data-bind]");if([].forEach.call(s,function(t){var a=e.getDataByString(t.getAttribute("data-bind"));"checkbox"===t.getAttribute("type")||"radio"===t.getAttribute("type")?a==t.value&&(t.checked=!0):t.value=a}),t)break}}return this}},{key:"applyMethod",value:function(t){var e=[].splice.call(arguments,0);return e.shift(),this.method[t].apply(this,e)}},{key:"getComputedProp",value:function(t){return this.data[t].apply(this)}},{key:"remove",value:function(t){for(var e=this.data,a=t.split(".");a.length>1;)e=e[a.shift()];var o=a.shift();return o.match(/^\d+$/)?e.splice(Number(o),1):delete e[o],this}}]),t}();e.exports=f},{delegate:3,morphdom:5}],2:[function(t,e,a){function o(t,e){for(;t&&t.nodeType!==i;){if(t.matches(e))return t;t=t.parentNode}}var i=9;if("undefined"!=typeof Element&&!Element.prototype.matches){var r=Element.prototype;r.matches=r.matchesSelector||r.mozMatchesSelector||r.msMatchesSelector||r.oMatchesSelector||r.webkitMatchesSelector}e.exports=o},{}],3:[function(t,e,a){function o(t,e,a,o,r){var n=i.apply(this,arguments);return t.addEventListener(a,n,r),{destroy:function(){t.removeEventListener(a,n,r)}}}function i(t,e,a,o){return function(a){a.delegateTarget=r(a.target,e),a.delegateTarget&&o.call(t,a)}}var r=t("./closest");e.exports=o},{"./closest":2}],4:[function(e,a,o){"use strict";var i=function(){function t(){this.keys={},this.register_list={},this.state={},this.statistic={},this.specialKeyString={altKey:"Alt",ctrlKey:"Control",metaKey:"Meta",shiftKey:"Shift"}}t.prototype.listen=function(t,e){var a=this.option,o=document;a.element&&"function"==typeof a.element.addEventListener&&(o=a.element),o.addEventListener("keydown",function(e){this.keydown(e,t)}.bind(this),!1),o.addEventListener("keyup",function(t){this.keyup(t,e)}.bind(this),!1)},t.prototype.unlisten=function(){var t=this.option,e=document;t.element&&"function"==typeof t.element.removeEventListener&&(e=t.element),e.removeEventListener("keydown",function(){}),e.removeEventListener("keyup",function(){})},t.prototype.test=function(t){return this.testRegisters(t)},t.prototype.testRegisters=function(t){for(var e=this.register_list,a=Object.getOwnPropertySymbols(e),o=this.testKeys.bind(this),i={},r=0,n=a.length;r<n;r++){var s=a[r],h=e[s],c=h[0],d=h[1];if(o(c))return d&&"function"==typeof d&&(t.clearKeys=this.clearKeys.bind(this),d(t)),i[s]=!0,i}return i},t.prototype.testKeys=function(t){for(var e=[],a=!1,o=0,i=t.length;o<i;o++){var r=t[o],n=Object.keys(this.keys),s=[],h=0;if(n.forEach(function(t,e){this.keys[t]&&s.push(t)}.bind(this)),!0===this.option.DEBUG){var c=s.map(function(t,e){return" "===t?"Space":t}).join(" ");console.log("["+Date.now()+"] You hit key: %c"+c,"color: #ea4335; font-size: 16px")}if(s.length!==r.length)h=!1;else{for(var d=0,l=r.length;d<l;d++)if(s.indexOf(r[d])<0){h=!1;break}d===r.length&&!1!==h&&(h=!0)}e.push(h)}return e.forEach(function(t,e){!0===t&&(a=!0)}),a},t.prototype.keydown=function(t,e){var a=t.key,o={},i=!0;Array.prototype.map;return this.keys[a]="keydown"===t.type,o=this.test(t),Object.keys(o).forEach(function(t,e){!0===o[t]&&(i=!1)}),this.state=o,i||(t.preventDefault(),t.stopPropagation()),this.collect(t.key,t.type,t.timeStamp),"function"==typeof e&&e(t),i},t.prototype.keyup=function(t,e){var a=t.key;return this.keys[a]=!1,this.collect(t.key,t.type,t.timeStamp),"function"==typeof e&&e(t),!0},t.prototype.collect=function(t,e,a){var o=this.statistic[t],i=window.CustomEvent?new CustomEvent("test").timeStamp:document.createEvent("KeyboardEvent").timeStamp;void 0===o&&(o=this.statistic[t]={count:0,total:0,average:0}),"keydown"===e?o.downTimeStamp=a||i:"keyup"===e&&(o.count=o.count+1,o.upTimeStamp=a||i,o.total=o.upTimeStamp-o.downTimeStamp+o.total,o.total=+o.total.toFixed(2)||0,o.average=o.total/o.count)},t.prototype.register=function(t,e){if("string"!=typeof t)throw new Error("[from keyboard-js] Please input a register name.");var a;if(a="undefined"!=typeof Symbol?Symbol.for(t):t,this.register_list[a])throw new Error("[from keyboard-js] The Register["+t+"] has existed!");var o=Array.prototype.slice.call(arguments,2);o[0]instanceof Array||(o=[o]),this.register_list[a]=[o,e]},t.prototype.clearRegister=function(t){delete this.register_list[t]},t.prototype.clearRegisterAll=function(){this.register_list={}},t.prototype.clearKeys=function(){this.keys={}};var e=new t,a={start:function(t,a){e.listen(t,a)},end:function(){e.unlisten(),e.clearRegisterAll(),e.clearKeys()},register:function(){e.register.apply(e,arguments)},unregister:function(){e.clearRegister.apply(e,arguments)},getStatistic:function(){return e.statistic},__keydown:function(){e.keydown.apply(e,arguments)},__keyup:function(){e.keyup.apply(e,arguments)}};return function(t){return e.option=t||{},"object"==typeof window&&window.addEventListener("focus",function(){e.keys={}},!1),a}}();if(void 0!==o)o.Keyboard=i;else if("function"==typeof t)t("Keyboard",[],function(){return i});else{if(void 0!==window.Keyboard)throw new Error("Library Keyboard has existed! Loaded failed.");window.Keyboard=i}},{}],5:[function(t,e,a){"use strict";function o(t){!l&&f.createRange&&(l=f.createRange(),l.selectNode(f.body));var e;return l&&l.createContextualFragment?e=l.createContextualFragment(t):(e=f.createElement("body"),e.innerHTML=t),e.childNodes[0]}function i(t,e){var a=t.nodeName,o=e.nodeName;return a===o||!!(e.actualize&&a.charCodeAt(0)<91&&o.charCodeAt(0)>90)&&a===o.toUpperCase()}function r(t,e){return e&&e!==p?f.createElementNS(e,t):f.createElement(t)}function n(t,e){for(var a=t.firstChild;a;){var o=a.nextSibling;e.appendChild(a),a=o}return e}function s(t,e){var a,o,i,r,n,s=e.attributes;for(a=s.length-1;a>=0;--a)o=s[a],i=o.name,r=o.namespaceURI,n=o.value,r?(i=o.localName||i,t.getAttributeNS(r,i)!==n&&t.setAttributeNS(r,i,n)):t.getAttribute(i)!==n&&t.setAttribute(i,n);for(s=t.attributes,a=s.length-1;a>=0;--a)o=s[a],!1!==o.specified&&(i=o.name,r=o.namespaceURI,r?(i=o.localName||i,v(e,r,i)||t.removeAttributeNS(r,i)):v(e,null,i)||t.removeAttribute(i))}function h(t,e,a){t[a]!==e[a]&&(t[a]=e[a],t[a]?t.setAttribute(a,""):t.removeAttribute(a,""))}function c(){}function d(t){return t.id}var l,u,p="http://www.w3.org/1999/xhtml",f="undefined"==typeof document?void 0:document,m=f?f.body||f.createElement("div"):{};u=m.hasAttributeNS?function(t,e,a){return t.hasAttributeNS(e,a)}:m.hasAttribute?function(t,e,a){return t.hasAttribute(a)}:function(t,e,a){return null!=t.getAttributeNode(e,a)};var v=u,g={OPTION:function(t,e){h(t,e,"selected")},INPUT:function(t,e){h(t,e,"checked"),h(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),v(e,null,"value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var a=e.value;if(t.value!==a&&(t.value=a),t.firstChild){if(""===a&&t.firstChild.nodeValue===t.placeholder)return;t.firstChild.nodeValue=a}},SELECT:function(t,e){if(!v(e,null,"multiple")){for(var a=0,o=e.firstChild;o;){var i=o.nodeName;if(i&&"OPTION"===i.toUpperCase()){if(v(o,null,"selected")){a;break}a++}o=o.nextSibling}t.selectedIndex=a}}},y=1,x=3,w=8,P=function(t){return function(e,a,s){function h(t){E?E.push(t):E=[t]}function l(t,e){if(t.nodeType===y)for(var a=t.firstChild;a;){var o=void 0;e&&(o=b(a))?h(o):(A(a),a.firstChild&&l(a,e)),a=a.nextSibling}}function u(t,e,a){!1!==k(t)&&(e&&e.removeChild(t),A(t),l(t,a))}function p(t){if(t.nodeType===y)for(var e=t.firstChild;e;){var a=b(e);a&&(C[a]=e),p(e),e=e.nextSibling}}function m(t){N(t);for(var e=t.firstChild;e;){var a=e.nextSibling,o=b(e);if(o){var r=C[o];r&&i(e,r)&&(e.parentNode.replaceChild(r,e),v(r,e))}m(e),e=a}}function v(o,r,n){var s,c=b(r);if(c&&delete C[c],!a.isSameNode||!a.isSameNode(e)){if(!n){if(!1===_(o,r))return;if(t(o,r),I(o),!1===D(o,r))return}if("TEXTAREA"!==o.nodeName){var d,l,p,P,E=r.firstChild,N=o.firstChild;t:for(;E;){for(p=E.nextSibling,d=b(E);N;){if(l=N.nextSibling,E.isSameNode&&E.isSameNode(N)){E=p,N=l;continue t}s=b(N);var k=N.nodeType,A=void 0;if(k===E.nodeType&&(k===y?(d?d!==s&&((P=C[d])?N.nextSibling===P?A=!1:(o.insertBefore(P,N),l=N.nextSibling,s?h(s):u(N,o,!0),N=P):A=!1):s&&(A=!1),(A=!1!==A&&i(N,E))&&v(N,E)):k!==x&&k!=w||(A=!0,N.nodeValue=E.nodeValue)),A){E=p,N=l;continue t}s?h(s):u(N,o,!0),N=l}if(d&&(P=C[d])&&i(P,E))o.appendChild(P),v(P,E);else{var B=S(E);!1!==B&&(B&&(E=B),E.actualize&&(E=E.actualize(o.ownerDocument||f)),o.appendChild(E),m(E))}E=p,N=l}for(;N;)l=N.nextSibling,(s=b(N))?h(s):u(N,o,!0),N=l}var z=g[o.nodeName];z&&z(o,r)}}if(s||(s={}),"string"==typeof a)if("#document"===e.nodeName||"HTML"===e.nodeName){var P=a;a=f.createElement("html"),a.innerHTML=P}else a=o(a);var E,b=s.getNodeKey||d,S=s.onBeforeNodeAdded||c,N=s.onNodeAdded||c,_=s.onBeforeElUpdated||c,I=s.onElUpdated||c,k=s.onBeforeNodeDiscarded||c,A=s.onNodeDiscarded||c,D=s.onBeforeElChildrenUpdated||c,B=!0===s.childrenOnly,C={};p(e);var z=e,T=z.nodeType,G=a.nodeType;if(!B)if(T===y)G===y?i(e,a)||(A(e),z=n(e,r(a.nodeName,a.namespaceURI))):z=a;else if(T===x||T===w){if(G===T)return z.nodeValue=a.nodeValue,z;z=a}if(z===a)A(e);else if(v(z,a,B),E)for(var O=0,L=E.length;O<L;O++){var M=C[E[O]];M&&u(M,M.parentNode,!1)}return!B&&z!==e&&e.parentNode&&(z.actualize&&(z=z.actualize(e.ownerDocument||f)),e.parentNode.replaceChild(z,e)),z}}(s);e.exports=P},{}],6:[function(t,e,a){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var n=function(){function t(t,e){for(var a=0;a<e.length;a++){var o=e[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,a,o){return a&&t(e.prototype,a),o&&t(e,o),e}}(),s=t("a-template"),h=function(t){return t&&t.__esModule?t:{default:t}}(s),c='<div class="\\{classNames.smartPhoto\\}"\x3c!-- BEGIN hide:exist --\x3e style="display:none;"\x3c!-- END hide:exist --\x3e>\n\t<div class="\\{classNames.smartPhotoBody\\}">\n\t\t<div class="\\{classNames.smartPhotoInner\\}">\n\t\t\t <div class="\\{classNames.smartPhotoHeader\\}">\n\t\t\t\t\t<span class="\\{classNames.smartPhotoCount\\}">{currentIndex}[increment]/{total}</span>\n\t\t\t\t\t<span class="\\{classNames.smartPhotoCaption\\}">\x3c!-- BEGIN groupItems:loop --\x3e\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3e{caption}\x3c!-- \\END currentIndex:touch#{index} --\x3e\x3c!-- END groupItems:loop --\x3e</span>\n\t\t\t\t\t<button class="\\{classNames.smartPhotoDismiss\\}" data-action-click="hidePhoto()"></button>\n\t\t\t\t</div>\n\t\t\t\t<div class="\\{classNames.smartPhotoContent\\}"\x3c!-- BEGIN isSmartPhone:exist --\x3e data-action-touchstart="beforeDrag" data-action-touchmove="onDrag" data-action-touchend="afterDrag(false)"\x3c!-- END isSmartPhone:exist --\x3e>\n\t\t\t\t</div>\n\t\t\t\t<ul style="transform:translate({translateX}px,{translateY}px);" class="\\{classNames.smartPhotoList\\}\x3c!-- BEGIN onMoveClass:exist --\x3e \\{classNames.smartPhotoListOnMove\\}\x3c!-- END onMoveClass:exist --\x3e">\n\t\t\t\t\t\x3c!-- BEGIN groupItems:loop --\x3e\n\t\t\t\t\t<li style="transform:translate({translateX}px,{translateY}px);" class="\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3ecurrent\x3c!-- \\END currentIndex:touch#{index} --\x3e">\n\t\t\t\t\t\t\x3c!-- BEGIN loaded:exist --\x3e\n\t\t\t\t\t\t<div style="transform:translate({x}px,{y}px) scale({scale});" class="\\\\{classNames.smartPhotoImgWrap\\\\}"\x3c!-- \\BEGIN isSmartPhone:empty --\x3e data-action-mousemove="onDrag" data-action-mousedown="beforeDrag" data-action-mouseup="afterDrag"\x3c!-- \\END isSmartPhone:empty --\x3e\x3c!-- \\BEGIN isSmartPhone:exist --\x3e data-action-touchstart="beforeDrag" data-action-touchmove="onDrag" data-action-touchend="afterDrag"\x3c!-- \\END isSmartPhone:exist --\x3e>\n\t\t\t\t\t\t\t<img style="\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3etransform:translate(\\{photoPosX\\}[virtualPos]px,\\{photoPosY\\}[virtualPos]px) scale(\\{scaleSize\\});\x3c!-- \\END currentIndex:touch#{index} --\x3e" src="{src}" class="\\\\{classNames.smartPhotoImg\\\\}\x3c!-- \\BEGIN scale:exist --\x3e \\\\{classNames.smartPhotoImgOnMove\\\\}\x3c!-- \\END scale:exist --\x3e\x3c!-- \\BEGIN elastic:exist --\x3e \\\\{classNames.smartPhotoImgElasticMove\\\\}\x3c!-- \\END elastic:exist --\x3e\x3c!-- \\BEGIN appear:exist --\x3e active\x3c!-- \\END appear:exist --\x3e" ondragstart="return false;">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\x3c!-- END loaded:exist --\x3e\n\t\t\t\t\t\t\x3c!-- BEGIN loaded:empty --\x3e\n\t\t\t\t\t\t<div class="\\\\{classNames.smartPhotoLoaderWrap\\\\}">\n\t\t\t\t\t\t\t<span class="\\\\{classNames.smartPhotoLoader\\\\}"></span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\x3c!-- END loaded:empty --\x3e\n\t\t\t\t\t</li>\n\t\t\t\t\t\x3c!-- END groupItems:loop --\x3e\n\t\t\t\t</ul>\n\t\t\t\t\x3c!-- BEGIN arrows:exist --\x3e\n\t\t\t\t<ul class="\\{classNames.smartPhotoArrows\\}\x3c!-- BEGIN hideUi:exist --\x3e hide\x3c!-- END hideUi:exist --\x3e">\n\t\t\t\t\t<li class="\\{classNames.smartPhotoArrowLeft\\}\x3c!-- BEGIN showPrevArrow:exist --\x3e show\x3c!-- END showPrevArrow:exist --\x3e" data-action-click="gotoSlide({prev})"></li>\n\t\t\t\t\t<li class="\\{classNames.smartPhotoArrowRight\\}\x3c!-- BEGIN showNextArrow:exist --\x3e show\x3c!-- END showNextArrow:exist --\x3e" data-action-click="gotoSlide({next})"></li>\n\t\t\t\t</ul>\n\t\t\t\t\x3c!-- END arrows:exist --\x3e\n\t\t\t\t\x3c!-- BEGIN nav:exist --\x3e\n\t\t\t\t<nav class="\\{classNames.smartPhotoNav\\}\x3c!-- BEGIN hideUi:exist --\x3e hide\x3c!-- END hideUi:exist --\x3e">\n\t\t\t\t\t<ul >\n\t\t\t\t\t\t\x3c!-- BEGIN groupItems:loop --\x3e\n\t\t\t\t\t\t<li data-action-click="gotoSlide({index})" class="\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3ecurrent\x3c!-- \\END currentIndex:touch#{index} --\x3e" style="background-image:url({src});"></li>\n\t\t\t\t\t\t\x3c!-- END groupItems:loop --\x3e\n\t\t\t\t\t</ul>\n\t\t\t\t</nav>\n\t\t\t\t\x3c!-- END nav:exist --\x3e\n\t\t</div>\n\t\t\x3c!-- BEGIN appearEffect:exist --\x3e\n\t\t<img src=\\{appearEffect.img\\}\n\t\tclass="\\{classNames.smartPhotoImgClone\\}"\n\t\tstyle="width:\\{appearEffect.width\\}px;height:\\{appearEffect.height\\}px;transform:translate(\\{appearEffect.left\\}px,\\{appearEffect.top\\}px) scale(1)" />\n\t\t\x3c!-- END appearEffect:exist --\x3e\n\t</div>\n</div>\n',d=t("../lib/util"),l=t("keyboard-js").Keyboard,u={classNames:{smartPhoto:"smartphoto",smartPhotoClose:"smartphoto-close",smartPhotoBody:"smartphoto-body",smartPhotoInner:"smartphoto-inner",smartPhotoContent:"smartphoto-content",smartPhotoImg:"smartphoto-img",smartPhotoImgOnMove:"smartphoto-img-onmove",smartPhotoImgElasticMove:"smartphoto-img-elasticmove",smartPhotoImgWrap:"smartphoto-img-wrap",smartPhotoArrows:"smartphoto-arrows",smartPhotoNav:"smartphoto-nav",smartPhotoArrowRight:"smartphoto-arrow-right",smartPhotoArrowLeft:"smartphoto-arrow-left",smartPhotoImgLeft:"smartphoto-img-left",smartPhotoImgRight:"smartphoto-img-right",smartPhotoList:"smartphoto-list",smartPhotoListOnMove:"smartphoto-list-onmove",smartPhotoHeader:"smartphoto-header",smartPhotoCount:"smartphoto-count",smartPhotoCaption:"smartphoto-caption",smartPhotoDismiss:"smartphoto-dismiss",smartPhotoLoader:"smartphoto-loader",smartPhotoLoaderWrap:"smartphoto-loader-wrap",smartPhotoImgClone:"smartphoto-img-clone"},arrows:!0,nav:!0,animationSpeed:300,swipeOffset:100,maxWidth:940,headerHeight:60,footerHeight:60,forceInterval:10,registance:.5,resizeStyle:"fill",verticalGravity:!1,useOrientationApi:!0},p=function(t){function e(t,a){o(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));r.data=d.extend({},u,a),r.data.currentIndex=0,r.data.hide=!0,r.data.group={},r.data.scaleSize=1,r.data.scale=!1,r.pos={x:0,y:0},r.data.photoPosX=0,r.data.photoPosY=0,r.convert={increment:r.increment,virtualPos:r.virtualPos},r.data.groupItems=r.groupItems,r.elements=document.querySelectorAll(t);var n=new Date;r.tapSecond=n.getTime(),r.onListMove=!1,r.id=r._getUniqId(),r.vx=0,r.vy=0,r.data.appearEffect=null,r.addTemplate(r.id,c),r.data.isSmartPhone=r._isSmartPhone();var s=document.querySelector("body");d.append(s,"<div data-id='"+r.id+"'></div>"),[].forEach.call(r.elements,function(t,e){r.addNewItem(t)});var h=r._getCurrentItemByHash();return h&&d.triggerEvent(h.element,"click"),r.data.isSmartPhone||r._setKeyboard(),r._getEachImageSize(),setInterval(function(){r._doAnim()},r.data.forceInterval),r.data.isSmartPhone||window.addEventListener("resize",function(t){r._resetTranslate(),r._setPosByCurrentIndex(),r._setSizeByScreen(),r.update()}),window.addEventListener("orientationchange",function(t){r._resetTranslate(),r._setPosByCurrentIndex(),r._setHashByCurrentIndex(),r._setSizeByScreen(),r.update()}),r.data.isSmartPhone&&r.data.useOrientationApi?(window.addEventListener("deviceorientation",function(t){var e=window.orientation;t&&t.gamma&&!r.data.appearEffect&&(r.isBeingZoomed||r.photoSwipable||r.data.elastic||!r.data.scale||(0===e?r._calcGravity(t.gamma,t.beta):90===e?r._calcGravity(t.beta,t.gamma):-90===e?r._calcGravity(-t.beta,-t.gamma):180===e&&r._calcGravity(-t.gamma,-t.beta)))}),r):i(r)}return r(e,t),n(e,[{key:"increment",value:function(t){return t+1}},{key:"virtualPos",value:function(t){return(t=parseInt(t))/this._getSelectedItem().scale/this.data.scaleSize}},{key:"groupItems",value:function(){return this.data.group[this.data.currentGroup]}},{key:"_setKeyboard",value:function(){var t=this,e=new l;e.register("slideRight",function(){!0!==t.data.hide&&t.gotoSlide(t.data.next)},["ArrowRight"]),e.register("slideLeft",function(){!0!==t.data.hide&&t.gotoSlide(t.data.prev)},["ArrowLeft"]),e.register("hidePhoto",function(){!0!==t.data.hide&&t.hidePhoto()},["Escape"]),e.start()}},{key:"_getEachImageSize",value:function(){var t=[],e=this.data.group;for(var a in e)e.hasOwnProperty(a)&&e[a].forEach(function(e){var a=new Promise(function(t,a){var o=new Image;o.onload=function(){e.width=o.width,e.height=o.height,e.loaded=!0,t()},o.onerror=function(){t()},o.src=e.src});t.push(a)});return Promise.all(t)}},{key:"_resetTranslate",value:function(){this.groupItems().forEach(function(t,e){t.translateX=window.innerWidth*e})}},{key:"addNewItem",value:function(t){var e=this,a=t.getAttribute("data-group")||"nogroup",o=this.data.group;"nogroup"===a&&t.setAttribute("data-group","nogroup"),o[a]||(o[a]=[]);var i=o[a].length,r={src:t.getAttribute("href"),caption:t.getAttribute("data-caption"),groupId:a,translateX:window.innerWidth*i,index:i,translateY:0,width:50,height:50,id:t.getAttribute("data-id")||i,loaded:!1,element:t};o[a].push(r),this.data.currentGroup=a,t.getAttribute("data-id")||t.setAttribute("data-id",i),t.setAttribute("data-index",i),t.addEventListener("click",function(a){a.preventDefault(),e.data.currentGroup=t.getAttribute("data-group"),e.data.currentIndex=parseInt(t.getAttribute("data-index")),e._setHashByCurrentIndex();var o=e._getSelectedItem();o.loaded?(e._initPhoto(),e.addAppearEffect(t),e.update()):e._loadItem(o).then(function(){e.data.appear=!0,e._initPhoto(),e.update()})})}},{key:"_initPhoto",value:function(){this.data.total=this.groupItems().length,this.data.hide=!1,this.data.photoPosX=0,this.data.photoPosY=0,this._setPosByCurrentIndex(),this._setSizeByScreen(),this.setArrow(),"fill"===this.data.resizeStyle&&this.data.isSmartPhone&&(this.data.scale=!0,this.data.hideUi=!0,this.data.scaleSize=this._getScaleBoarder())}},{key:"onUpdated",value:function(){var t=this;this.data.appearEffect&&this.data.appearEffect.once&&(this.data.appearEffect.once=!1,this.execEffect().then(function(){t.replaceEffectWithImg()}))}},{key:"execEffect",value:function(){var t=this.data.appearEffect,e=this.data.classNames,a=document.querySelector('[data-id="'+this.id+'"] .'+e.smartPhotoImgClone);return new Promise(function(e,o){setTimeout(function(){a.style.transition="all .3s ease-out",a.style.transform="translate("+t.afterX+"px, "+t.afterY+"px) scale("+t.scale+")",e()},30)})}},{key:"replaceEffectWithImg",value:function(){var t=this;this.data.classNames;setTimeout(function(){t.data.appearEffect=null,t.data.appear=!0,t.update()},300)}},{key:"addAppearEffect",value:function(t){var e=t.querySelector("img"),a=(e.cloneNode(!0),d.getViewPos(e)),o={},i=1;o.width=e.offsetWidth,o.height=e.offsetHeight,o.top=a.top,o.left=a.left,o.once=!0,o.img=e.getAttribute("src");var r=window.innerWidth,n=window.innerHeight,s=n-this.data.headerHeight-this.data.footerHeight;"fill"===this.data.resizeStyle&&this.data.isSmartPhone?i=e.offsetWidth>e.offsetHeight?n/e.offsetHeight:r/e.offsetWidth:(i=s/e.offsetHeight)*e.offsetWidth>r&&(i=r/e.offsetWidth);var h=(i-1)/2*e.offsetWidth+(r-e.offsetWidth*i)/2,c=(i-1)/2*e.offsetHeight+(n-e.offsetHeight*i)/2;o.afterX=h,o.afterY=c,o.scale=i,this.data.appearEffect=o}},{key:"hidePhoto",value:function(){var t=this;this.data.hide=!0,this.data.appear=!1,this.data.appearEffect=null;var e=window.scrollX,a=window.scrollY;location.hash&&(location.hash=""),window.scroll(e,a),this._doHideEffect().then(function(){t.update()})}},{key:"_doHideEffect",value:function(){var t=this;return new Promise(function(e,a){var o=t.data.classNames,i=t._getElementByClass(o.smartPhoto),r=t._getElementByQuery(".current ."+o.smartPhotoImg),n=window.innerHeight,s=function t(){i.removeEventListener("transitionend",t,!0),e()};i.style.opacity=0,r.style.transform="translateY("+n+"px)",i.addEventListener("transitionend",s,!0)})}},{key:"_getElementByClass",value:function(t){return document.querySelector('[data-id="'+this.id+'"] .'+t)}},{key:"_getElementByQuery",value:function(t){return document.querySelector('[data-id="'+this.id+'"] '+t)}},{key:"_getTouchPos",value:function(t){var e=0,a=0;if(void 0===o)var o=this.e;return this._isTouched(o)?(e=o.touches[0].pageX,a=o.touches[0].pageY):this._isTouched(this.e)?(e=this.e.touches[0].pageX,a=this.e.touches[0].pageY):o.pageX&&(e=o.pageX,a=o.pageY),{x:e,y:a}}},{key:"_getGesturePos",value:function(t){var e=t.touches;return[{x:e[0].pageX,y:e[0].pageY},{x:e[1].pageX,y:e[1].pageY}]}},{key:"_setPosByCurrentIndex",value:function(){
var t=this,e=this.groupItems(),a=-1*e[this.data.currentIndex].translateX;this.pos.x=a,setTimeout(function(){t.data.translateX=a,t.data.translateY=0,t._listUpdate()},1)}},{key:"_setHashByCurrentIndex",value:function(){var t=window.scrollX,e=window.scrollY,a=this.groupItems(),o=a[this.data.currentIndex].id,i=this.data.currentGroup,r="group="+i+"&photo="+o;location.hash=r,window.scroll(t,e)}},{key:"_getCurrentItemByHash",value:function(){var t=this.data.group,e=location.hash.substr(1),a=d.parseQuery(e),o=null;for(var i in t)t.hasOwnProperty(i)&&t[i].forEach(function(t){a.group===t.groupId&&a.photo===t.id&&(o=t)});return o}},{key:"_loadItem",value:function(t){return new Promise(function(e,a){var o=new Image;o.onload=function(){t.width=o.width,t.height=o.height,t.loaded=!0,e()},o.onerror=function(){e()},o.src=t.src})}},{key:"_setSizeByScreen",value:function(){var t=window.innerWidth,e=window.innerHeight,a=this.data.headerHeight,o=this.data.footerHeight,i=e-(a+o);this.groupItems().forEach(function(a){a.scale=i/a.height,a.x=(a.scale-1)/2*a.width+(t-a.width*a.scale)/2,a.y=(a.scale-1)/2*a.height+(e-a.height*a.scale)/2,a.width*a.scale>t&&(a.scale=t/a.width,a.x=(a.scale-1)/2*a.width)})}},{key:"_slideList",value:function(){var t=this;this.data.onMoveClass=!0,this._setPosByCurrentIndex(),this._setHashByCurrentIndex(),this._setSizeByScreen(),setTimeout(function(){t.data.onMoveClass=!1,t.setArrow(),t.update()},200)}},{key:"gotoSlide",value:function(t){this.data.currentIndex=parseInt(t),this.data.currentIndex||(this.data.currentIndex=0),this._slideList()}},{key:"setArrow",value:function(){var t=this.groupItems(),e=t.length,a=this.data.currentIndex+1,o=this.data.currentIndex-1;this.data.showNextArrow=!1,this.data.showPrevArrow=!1,a!==e&&(this.data.next=a,this.data.showNextArrow=!0),-1!==o&&(this.data.prev=o,this.data.showPrevArrow=!0)}},{key:"beforeDrag",value:function(){if(this._isGestured(this.e))return void this.beforeGesture();if(this.data.scale)return void this.beforePhotoDrag();var t=this._getTouchPos(this.e);this.isSwipable=!0,this.dragStart=!0,this.firstPos=t,this.oldPos=t}},{key:"afterDrag",value:function(t){var e=this.groupItems(),a=new Date,o=a.getTime(),i=this.tapSecond-o,r=0,n=0;return this.isSwipable=!1,this.onListMove=!1,this.oldPos&&(r=this.oldPos.x-this.firstPos.x,n=this.oldPos.y-this.firstPos.y),this.isBeingZoomed?void this.afterGesture():this.data.scale?void this.afterPhotoDrag():d.isSmartPhone()||0!==r||0!==n?Math.abs(i)<=500&&0===r&&0===n?(this.e.preventDefault(),void this.zoomPhoto()):(this.tapSecond=o,"horizontal"===this.moveDir&&(r>=this.data.swipeOffset&&0!==this.data.currentIndex?this.data.currentIndex--:r<=-this.data.swipeOffset&&this.data.currentIndex!=e.length-1&&this.data.currentIndex++,this._slideList()),void("vertical"===this.moveDir&&(n>=this.data.swipeOffset?this.hidePhoto():(this.data.translateY=0,this._slideList())))):void this.zoomPhoto()}},{key:"onDrag",value:function(){if(this.e.preventDefault(),this._isGestured(this.e)&&!1===this.onListMove)return void this.onGesture();if(!this.isBeingZoomed){if(this.data.scale)return void this.onPhotoDrag();if(this.isSwipable){var t=this._getTouchPos(this.e),e=t.x-this.oldPos.x,a=t.y-this.firstPos.y;this.dragStart&&(this.dragStart=!1,Math.abs(e)>Math.abs(a)?this.moveDir="horizontal":this.moveDir="vertical"),"horizontal"===this.moveDir?(this.pos.x+=e,this.data.translateX=this.pos.x):this.data.translateY=a,this.onListMove=!0,this.oldPos=t,this._listUpdate()}}}},{key:"zoomPhoto",value:function(){var t=this;this.data.hideUi=!0,this.data.scaleSize=this._getScaleBoarder(),this.data.photoPosX=0,this.data.photoPosY=0,this._photoUpdate(),setTimeout(function(){t.data.scale=!0,t._photoUpdate()},300)}},{key:"zoomOutPhoto",value:function(){this.data.scaleSize=1,this.isBeingZoomed=!1,this.data.hideUi=!1,this.data.scale=!1,this.data.photoPosX=0,this.data.photoPosY=0,this._photoUpdate()}},{key:"beforePhotoDrag",value:function(){var t=this._getTouchPos(this.e);this.photoSwipable=!0,this.data.photoPosX||(this.data.photoPosX=0),this.data.photoPosY||(this.data.photoPosY=0),this.oldPhotoPos=t,this.firstPhotoPos=t}},{key:"onPhotoDrag",value:function(){if(this.photoSwipable){this.e.preventDefault();var t=this._getTouchPos(this.e),e=t.x-this.oldPhotoPos.x,a=t.y-this.oldPhotoPos.y,o=this._round(this.data.scaleSize*e,6),i=this._round(this.data.scaleSize*a,6);"number"==typeof o&&(this.data.photoPosX+=o,this.photoVX=o),"number"==typeof i&&(this.data.photoPosY+=i,this.photoVY=i),this.oldPhotoPos=t,this._photoUpdate()}}},{key:"afterPhotoDrag",value:function(){if(this.oldPhotoPos.x===this.firstPhotoPos.x&&this.photoSwipable)this.zoomOutPhoto();else{var t=this._getSelectedItem(),e=this._makeBound(t),a=0,o=0;this.data.photoPosX>e.maxX?a=-1:this.data.photoPosX<e.minX&&(a=1),this.data.photoPosY>e.maxY?o=-1:this.data.photoPosY<e.minY&&(o=1),0===a&&0===o?(this.vx=this.photoVX/5,this.vy=this.photoVY/5):this._registerElasticForce(a,o)}this.photoSwipable=!1}},{key:"beforeGesture",value:function(){var t=this._getGesturePos(this.e),e=this._getDistance(t[0],t[1]);this.isBeingZoomed=!0,this.oldDistance=e,this.data.scale=!0,this.e.preventDefault()}},{key:"onGesture",value:function(){var t=this._getGesturePos(this.e),e=this._getDistance(t[0],t[1]),a=(e-this.oldDistance)/100,o=this.data.scaleSize,i=this.data.photoPosX,r=this.data.photoPosY;this._getSelectedItem();this.data.scaleSize+=this._round(a,6),this.data.scaleSize<.2&&(this.data.scaleSize=.2),this.data.scaleSize<o&&(this.data.photoPosX=(1+this.data.scaleSize-o)*i,this.data.photoPosY=(1+this.data.scaleSize-o)*r),this.data.scaleSize<1||this.data.scaleSize>this._getScaleBoarder()?this.data.hideUi=!0:this.data.hideUi=!1,this.oldDistance=e,this.e.preventDefault(),this._photoUpdate()}},{key:"afterGesture",value:function(){this.isBeingZoomed=!1,this.data.scaleSize>this._getScaleBoarder()||(this.data.photoPosX=0,this.data.photoPosY=0,this.data.scale=!1,this.data.scaleSize=1,this.data.hideUi=!1,this._photoUpdate())}},{key:"_getForceAndTheta",value:function(t,e){return{force:Math.sqrt(t*t+e*e),theta:Math.atan2(e,t)}}},{key:"_getScaleBoarder",value:function(){var t=this._getSelectedItem();return d.isSmartPhone()?t.width>t.height?window.innerHeight/(t.height*t.scale):window.innerWidth/(t.width*t.scale):1/t.scale}},{key:"_makeBound",value:function(t){var e=t.width*t.scale*this.data.scaleSize,a=t.height*t.scale*this.data.scaleSize,o=void 0,i=void 0,r=void 0,n=void 0;return window.innerWidth>e?(r=(window.innerWidth-e)/2,o=-1*r):(r=(e-window.innerWidth)/2,o=-1*r),window.innerHeight>a?(n=(window.innerHeight-a)/2,i=-1*n):(n=(a-window.innerHeight)/2,i=-1*n),{minX:this._round(o,6)*this.data.scaleSize,minY:this._round(i,6)*this.data.scaleSize,maxX:this._round(r,6)*this.data.scaleSize,maxY:this._round(n,6)*this.data.scaleSize}}},{key:"_registerElasticForce",value:function(t,e){var a=this,o=this._getSelectedItem(),i=this._makeBound(o);this.data.elastic=!0,1===t?this.data.photoPosX=i.minX:-1===t&&(this.data.photoPosX=i.maxX),1===e?this.data.photoPosY=i.minY:-1===e&&(this.data.photoPosY=i.maxY),this._photoUpdate(),setTimeout(function(){a.data.elastic=!1,a._photoUpdate()},300)}},{key:"_getSelectedItem",value:function(){var t=this.data,e=t.currentIndex;return t.group[t.currentGroup][e]}},{key:"_getUniqId",value:function(){return(Date.now().toString(36)+Math.random().toString(36).substr(2,5)).toUpperCase()}},{key:"_getDistance",value:function(t,e){var a=t.x-e.x,o=t.y-e.y;return Math.sqrt(a*a+o*o)}},{key:"_round",value:function(t,e){var a=Math.pow(10,e);return t*=a,t=Math.round(t),t/=a}},{key:"_isTouched",value:function(t){return!(!t||!t.touches)}},{key:"_isGestured",value:function(t){return!!(t&&t.touches&&t.touches.length>1)}},{key:"_isSmartPhone",value:function(){var t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0}},{key:"_calcGravity",value:function(t,e){(t>5||t<-5)&&(this.vx+=.05*t),!1!==this.data.verticalGravity&&(e>5||e<-5)&&(this.vy+=.05*e)}},{key:"_photoUpdate",value:function(){var t=this.data.classNames,e=this._getElementByQuery(".current"),a=e.querySelector("."+t.smartPhotoImg),o=this._getElementByQuery("."+t.smartPhotoNav),i=this._getElementByQuery("."+t.smartPhotoArrows),r=this.virtualPos(this.data.photoPosX),n=this.virtualPos(this.data.photoPosY),s=this.data.scaleSize,h="translate("+r+"px,"+n+"px) scale("+s+")";a.style.transform=h,this.data.scale?d.addClass(a,t.smartPhotoImgOnMove):d.removeClass(a,t.smartPhotoImgOnMove),this.data.elastic?d.addClass(a,t.smartPhotoImgElasticMove):d.removeClass(a,t.smartPhotoImgElasticMove),this.data.hideUi?(d.addClass(o,"hide"),d.addClass(i,"hide"),setTimeout(function(){d.addClass(o,"none"),d.addClass(i,"none")},100)):(d.removeClass(o,"none"),d.removeClass(i,"none"),setTimeout(function(){d.removeClass(o,"hide"),d.removeClass(i,"hide")},10))}},{key:"_listUpdate",value:function(){var t=this.data.classNames,e=this._getElementByQuery("."+t.smartPhotoList),a="translate("+this.data.translateX+"px,"+this.data.translateY+"px)";e.style.transform=a,this.data.onMoveClass?d.addClass(e,t.smartPhotoListOnMove):d.removeClass(e,t.smartPhotoListOnMove)}},{key:"_doAnim",value:function(){if(!(this.isBeingZoomed||this.isSwipable||this.photoSwipable||this.data.elastic)&&this.data.scale){this.data.photoPosX+=this.vx,this.data.photoPosY+=this.vy;var t=this._getSelectedItem(),e=this._makeBound(t);this.data.photoPosX<e.minX?(this.data.photoPosX=e.minX,this.vx*=-.2):this.data.photoPosX>e.maxX&&(this.data.photoPosX=e.maxX,this.vx*=-.2),this.data.photoPosY<e.minY?(this.data.photoPosY=e.minY,this.vy*=-.2):this.data.photoPosY>e.maxY&&(this.data.photoPosY=e.maxY,this.vy*=-.2);var a=this._getForceAndTheta(this.vx,this.vy),o=a.force,i=a.theta;o-=this.data.registance,Math.abs(o)<.5||(this.vx=Math.cos(i)*o,this.vy=Math.sin(i)*o,this._photoUpdate())}}}]),e}(h.default);e.exports=p},{"../lib/util":8,"a-template":1,"keyboard-js":4}],7:[function(t,e,a){"use strict";e.exports=t("./core/")},{"./core/":6}],8:[function(t,e,a){"use strict";function o(t){t=t||{};for(var e=1;e<arguments.length;e++){var a=arguments[e];if(a)for(var r in a)a.hasOwnProperty(r)&&("object"===i(a[r])?t[r]=o(t[r],a[r]):t[r]=a[r])}return t}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.exports.isSmartPhone=function(){var t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0},e.exports.extend=o,e.exports.triggerEvent=function(t,e,a){var o=void 0;window.CustomEvent?o=new CustomEvent(e,{cancelable:!0}):(o=document.createEvent("CustomEvent"),o.initCustomEvent(e,!1,!1,a)),t.dispatchEvent(o)},e.exports.parseQuery=function(t){for(var e,a,o,i=t.split("&"),r={},n=0,s=i.length;n<s;n++)e=i[n].split("="),void 0!==e[0]&&(a=e[0],o=void 0!==e[1]?e.slice(1).join("="):a,r[a]=decodeURIComponent(o));return r},e.exports.getViewPos=function(t){return{left:t.getBoundingClientRect().left,top:t.getBoundingClientRect().top}},e.exports.removeElement=function(t){t&&t.parentNode&&t.parentNode.removeChild(t)},e.exports.append=function(t,e){var a=new DOMParser,o=a.parseFromString(e,"text/html");t.appendChild(o.querySelector("body").childNodes[0])},e.exports.addClass=function(t,e){t.classList?t.classList.add(e):t.className+=" "+e},e.exports.removeClass=function(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\b)"+e.split(" ").join("|")+"(\\b|$)","gi")," ")}},{}]},{},[7])(7)});
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.smartPhoto=t()}}(function(){return function t(e,a,o){function i(n,s){if(!a[n]){if(!e[n]){var h="function"==typeof require&&require;if(!s&&h)return h(n,!0);if(r)return r(n,!0);var d=new Error("Cannot find module '"+n+"'");throw d.code="MODULE_NOT_FOUND",d}var c=a[n]={exports:{}};e[n][0].call(c.exports,function(t){var a=e[n][1][t];return i(a||t)},c,c.exports,t,e,a,o)}return a[n].exports}for(var r="function"==typeof require&&require,n=0;n<o.length;n++)i(o[n]);return i}({1:[function(t,e,a){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var a=0;a<e.length;a++){var o=e[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,a,o){return a&&t(e.prototype,a),o&&t(e,o),e}}(),r=t("morphdom"),n=t("delegate"),s=[],h="input paste copy click change keydown keyup contextmenu mouseup mousedown mousemove touchstart touchend touchmove compositionstart compositionend",d=h.replace(/([a-z]+)/g,"[data-action-$1],")+"[data-action]";Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e=Object(this),a=e.length>>>0,o=arguments[1],i=void 0,r=0;r<a;r++)if(i=e[r],t.call(o,i,r,e))return i}),Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(t){for(var e=(this.document||this.ownerDocument).querySelectorAll(t),a=e.length;--a>=0&&e.item(a)!==this;);return a>-1});var c=function(t){return document.querySelector(t)},l=function(t){for(var e=0,a=s.length;e<a;e++)for(var o=s[e],i=o.templates,r=0,n=i.length;r<n;r++)if(i[r]==t)return o;return null},u=function(t,e){if("function"==typeof t.closest)return t.closest(e)||null;for(;t;){if(t.matches(e))return t;t=t.parentElement}return null},p=function(t,e,a,o){a.split(" ").forEach(function(a){n(t,e,a,o)})};"undefined"!=typeof document&&(p(document,"[data-bind]","input change click",function(t){var e=t.delegateTarget,a=e.getAttribute("data-bind"),o=e.getAttribute("href"),i=u(e,"[data-id]").getAttribute("data-id"),r=e.value;if(o&&(r=r.replace("#","")),i){var n=l(i);"radio"===e.getAttribute("type")||("checkbox"===e.getAttribute("type")?function(){var t=[],e=document.querySelectorAll('[data-bind="'+a+'"]');[].forEach.call(e,function(e){e.checked&&t.push(e.value)})}():n.updateDataByString(a,r))}}),p(document,d,h,function(t){var e=t.delegateTarget;if(!("click"===t.type&&"select"===e.tagName||"input"===t.type&&"button"===e.getAttribute("type"))){var a=h.split(" "),o="action";a.forEach(function(a){e.getAttribute("data-action-"+a)&&t.type===a&&(o+="-"+a)});var i=e.getAttribute("data-"+o);if(i){var r=i.replace(/\(.*?\);?/,""),n=i.replace(/(.*?)\((.*?)\);?/,"$2"),s=n.split(","),d=u(e,"[data-id]").getAttribute("data-id");if(d){var c=l(d);c.e=t,c.method&&c.method[r]?c.method[r].apply(c,s):c[r]&&c[r].apply(c,s)}}}}));var f=function(){function t(e){o(this,t),this.atemplate=[],s.push(this);for(var a in e)this[a]=e[a];this.data||(this.data={}),this.templates||(this.templates=[]);for(var i=this.templates,r=i.length,n=0,h=r;n<h;n++){var d=this.templates[n],l=c("#"+d).innerHTML;this.atemplate.push({id:d,html:l})}this.setId()}return i(t,[{key:"addTemplate",value:function(t,e){this.atemplate.push({id:t,html:e}),this.templates.push(t)}},{key:"loadHtml",value:function(){var t=this.templates,e=[];return t.forEach(function(t){var a=new $.Deferred;e.push(a);var o=c("#"+t).getAttribute("src");$.ajax({url:o,type:"GET",dataType:"text"}).success(function(e){c("#"+t).innerHTML=e,a.resolve()})}),$.when.apply($,e)}},{key:"getData",value:function(){return JSON.parse(JSON.stringify(this.data))}},{key:"saveData",value:function(t){var e=JSON.stringify(this.data);localStorage.setItem(t,e)}},{key:"setData",value:function(t){for(var e in t)"function"!=typeof t[e]&&(this.data[e]=t[e])}},{key:"loadData",value:function(t){var e=JSON.parse(localStorage.getItem(t));if(e)for(var a in e)"function"!=typeof e[a]&&(this.data[a]=e[a])}},{key:"getRand",value:function(t,e){return~~(Math.random()*(e-t+1))+t}},{key:"getRandText",value:function(t){for(var e="",a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o=a.length,i=0;i<t;i++)e+=a.charAt(Math.floor(this.getRand(0,o)));return e}},{key:"setId",value:function(){for(var e=void 0,a=(t.ids,!1);;){e=this.getRandText(10);for(var o=0,i=t.ids;o<i;o++)t.ids[o]===e&&(a=!0);if(!1===a)break}this.data.aTemplate_id=e}},{key:"getDataFromObj",value:function(t,e){t=t.replace(/\[([a-zA-Z0-9._-]+)\]/g,".$1"),t=t.replace(/^\./,"");for(var a=t.split(".");a.length;){var o=a.shift();if(!(o in e))return;e=e[o]}return e}},{key:"getDataByString",value:function(t){var e=this.data;return this.getDataFromObj(t,e)}},{key:"updateDataByString",value:function(t,e){for(var a=this.data,o=t.split(".");o.length>1;)a=a[o.shift()];a[o.shift()]=e}},{key:"removeDataByString",value:function(t){for(var e=this.data,a=t.split(".");a.length>1;)e=e[a.shift()];var o=a.shift();o.match(/^\d+$/)?e.splice(Number(o),1):delete e[o]}},{key:"resolveBlock",value:function(t,e,a){var o=this,i=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):touch#([a-zA-Z0-9._-]+) -->/g),r=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):touchnot#([a-zA-Z0-9._-]+) -->/g),n=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):exist -->/g),s=t.match(/<!-- BEGIN ([a-zA-Z0-9._-]+):empty -->/g);if(i)for(var h=0,d=i.length;h<d;h++){var c=i[h];c=c.replace(/([a-zA-Z0-9._-]+):touch#([a-zA-Z0-9._-]+)/,"($1):touch#($2)");var l=c.replace(/BEGIN/,"END"),u=new RegExp(c+"(([\\n\\r\\t]|.)*?)"+l,"g");t=t.replace(u,function(t,a,i,r){return("function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e))==i?r:""})}if(r)for(var p=0,f=r.length;p<f;p++){var m=r[p];m=m.replace(/([a-zA-Z0-9._-]+):touchnot#([a-zA-Z0-9._-]+)/,"($1):touchnot#($2)");var v=m.replace(/BEGIN/,"END"),g=new RegExp(m+"(([\\n\\r\\t]|.)*?)"+v,"g");t=t.replace(g,function(t,a,i,r){return("function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e))!=i?r:""})}if(n)for(var y=0,x=n.length;y<x;y++){var P=n[y];P=P.replace(/([a-zA-Z0-9._-]+):exist/,"($1):exist");var w=P.replace(/BEGIN/,"END"),E=new RegExp(P+"(([\\n\\r\\t]|.)*?)"+w,"g");t=t.replace(E,function(t,a,i){var r="function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e);return r||0===r?i:""})}if(s)for(var b=0,S=s.length;b<S;b++){var N=s[b];N=N.replace(/([a-zA-Z0-9._-]+):empty/,"($1):empty");var I=N.replace(/BEGIN/,"END"),_=new RegExp(N+"(([\\n\\r\\t]|.)*?)"+I,"g");t=t.replace(_,function(t,a,i){var r="function"==typeof e[a]?e[a].apply(o):o.getDataFromObj(a,e);return r||0===r?"":i})}return t=t.replace(/{([a-zA-Z0-9._-]+)}(\[([a-zA-Z0-9._-]+)\])*/g,function(t,i,r,n){var s=void 0;if("i"==i)s=a;else{if(!e[i]&&0!==e[i])return n&&o.convert&&o.convert[n]?o.convert[n].call(o,""):"";s="function"==typeof e[i]?e[i].apply(o):e[i]}return n&&o.convert&&o.convert[n]?o.convert[n].call(o,s):s})}},{key:"resolveAbsBlock",value:function(t){var e=this;return t=t.replace(/{(.*?)}/g,function(t,a){var o=e.getDataByString(a);return void 0!==o?"function"==typeof o?o.apply(e):o:t})}},{key:"resolveInclude",value:function(t){return t=t.replace(/<!-- #include id="(.*?)" -->/g,function(t,e){return c("#"+e).innerHTML})}},{key:"resolveWith",value:function(t){return t=t.replace(/<!-- BEGIN ([a-zA-Z0-9._-]+):with -->(([\n\r\t]|.)*?)<!-- END ([a-zA-Z0-9._-]+):with -->/g,function(t,e,a){return t=t.replace(/data\-bind=['"](.*?)['"]/g,"data-bind='"+e+".$1'")})}},{key:"resolveLoop",value:function(t){var e=this;return t=t.replace(/<!-- BEGIN (.+?):loop -->(([\n\r\t]|.)*?)<!-- END (.+?):loop -->/g,function(t,a,o){var i=e.getDataByString(a),r=[];r="function"==typeof i?i.apply(e):i;var n="";if(r instanceof Array)for(var s=0,h=r.length;s<h;s++)n+=e.resolveBlock(o,r[s],s);return n=n.replace(/\\([^\\])/g,"$1")})}},{key:"removeData",value:function(t){var e=this.data;for(var a in e)for(var o=0,i=t.length;o<i;o++)a===t[o]&&delete e[a];return this}},{key:"hasLoop",value:function(t){return!!t.match(/<!-- BEGIN (.+?):loop -->(([\n\r\t]|.)*?)<!-- END (.+?):loop -->/g)}},{key:"getHtml",value:function(t,e){var a=this.atemplate.find(function(e){return e.id===t}),o="";if(a&&a.html&&(o=a.html),e&&(o=t),!o)return"";var i=this.data;for(o=this.resolveInclude(o),o=this.resolveWith(o);this.hasLoop(o);)o=this.resolveLoop(o);return o=this.resolveBlock(o,i),o=o.replace(/\\([^\\])/g,"$1"),o=this.resolveAbsBlock(o),o.replace(/^([\t ])*\n/gm,"")}},{key:"update",value:function(t,e){var a=(this.getHtml(),this.templates),o=t||"html";this.beforeUpdated&&this.beforeUpdated();for(var i=0,n=a.length;i<n;i++){var s=a[i],h="#"+s,d=this.getHtml(s),l=c("[data-id='"+s+"']");if((!e||e==s)&&(l?"text"===o?l.innerText=d:r(l,"<div data-id='"+s+"'>"+d+"</div>"):(c(h).insertAdjacentHTML("afterend",'<div data-id="'+s+'"></div>'),"text"===o?c("[data-id='"+s+"']").innerText=d:c("[data-id='"+s+"']").innerHTML=d),e))break}return this.updateBindingData(e),this.onUpdated&&this.onUpdated(e),this}},{key:"updateBindingData",value:function(t){for(var e=this,a=this.templates,o=0,i=a.length;o<i;o++){var r=a[o];if(!t||t==r){var n=c("[data-id='"+r+"']"),s=n.querySelectorAll("[data-bind]");if([].forEach.call(s,function(t){var a=e.getDataByString(t.getAttribute("data-bind"));"checkbox"===t.getAttribute("type")||"radio"===t.getAttribute("type")?a==t.value&&(t.checked=!0):t.value=a}),t)break}}return this}},{key:"applyMethod",value:function(t){var e=[].splice.call(arguments,0);return e.shift(),this.method[t].apply(this,e)}},{key:"getComputedProp",value:function(t){return this.data[t].apply(this)}},{key:"remove",value:function(t){for(var e=this.data,a=t.split(".");a.length>1;)e=e[a.shift()];var o=a.shift();return o.match(/^\d+$/)?e.splice(Number(o),1):delete e[o],this}}]),t}();e.exports=f},{delegate:3,morphdom:4}],2:[function(t,e,a){function o(t,e){for(;t&&t.nodeType!==i;){if(t.matches(e))return t;t=t.parentNode}}var i=9;if("undefined"!=typeof Element&&!Element.prototype.matches){var r=Element.prototype;r.matches=r.matchesSelector||r.mozMatchesSelector||r.msMatchesSelector||r.oMatchesSelector||r.webkitMatchesSelector}e.exports=o},{}],3:[function(t,e,a){function o(t,e,a,o,r){var n=i.apply(this,arguments);return t.addEventListener(a,n,r),{destroy:function(){t.removeEventListener(a,n,r)}}}function i(t,e,a,o){return function(a){a.delegateTarget=r(a.target,e),a.delegateTarget&&o.call(t,a)}}var r=t("./closest");e.exports=o},{"./closest":2}],4:[function(t,e,a){"use strict";function o(t){!l&&f.createRange&&(l=f.createRange(),l.selectNode(f.body));var e;return l&&l.createContextualFragment?e=l.createContextualFragment(t):(e=f.createElement("body"),e.innerHTML=t),e.childNodes[0]}function i(t,e){var a=t.nodeName,o=e.nodeName;return a===o||!!(e.actualize&&a.charCodeAt(0)<91&&o.charCodeAt(0)>90)&&a===o.toUpperCase()}function r(t,e){return e&&e!==p?f.createElementNS(e,t):f.createElement(t)}function n(t,e){for(var a=t.firstChild;a;){var o=a.nextSibling;e.appendChild(a),a=o}return e}function s(t,e){var a,o,i,r,n,s=e.attributes;for(a=s.length-1;a>=0;--a)o=s[a],i=o.name,r=o.namespaceURI,n=o.value,r?(i=o.localName||i,t.getAttributeNS(r,i)!==n&&t.setAttributeNS(r,i,n)):t.getAttribute(i)!==n&&t.setAttribute(i,n);for(s=t.attributes,a=s.length-1;a>=0;--a)o=s[a],!1!==o.specified&&(i=o.name,r=o.namespaceURI,r?(i=o.localName||i,v(e,r,i)||t.removeAttributeNS(r,i)):v(e,null,i)||t.removeAttribute(i))}function h(t,e,a){t[a]!==e[a]&&(t[a]=e[a],t[a]?t.setAttribute(a,""):t.removeAttribute(a,""))}function d(){}function c(t){return t.id}var l,u,p="http://www.w3.org/1999/xhtml",f="undefined"==typeof document?void 0:document,m=f?f.body||f.createElement("div"):{};u=m.hasAttributeNS?function(t,e,a){return t.hasAttributeNS(e,a)}:m.hasAttribute?function(t,e,a){return t.hasAttribute(a)}:function(t,e,a){return null!=t.getAttributeNode(e,a)};var v=u,g={OPTION:function(t,e){h(t,e,"selected")},INPUT:function(t,e){h(t,e,"checked"),h(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),v(e,null,"value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var a=e.value;if(t.value!==a&&(t.value=a),t.firstChild){if(""===a&&t.firstChild.nodeValue===t.placeholder)return;t.firstChild.nodeValue=a}},SELECT:function(t,e){if(!v(e,null,"multiple")){for(var a=0,o=e.firstChild;o;){var i=o.nodeName;if(i&&"OPTION"===i.toUpperCase()){if(v(o,null,"selected")){a;break}a++}o=o.nextSibling}t.selectedIndex=a}}},y=1,x=3,P=8,w=function(t){return function(e,a,s){function h(t){E?E.push(t):E=[t]}function l(t,e){if(t.nodeType===y)for(var a=t.firstChild;a;){var o=void 0;e&&(o=b(a))?h(o):(A(a),a.firstChild&&l(a,e)),a=a.nextSibling}}function u(t,e,a){!1!==k(t)&&(e&&e.removeChild(t),A(t),l(t,a))}function p(t){if(t.nodeType===y)for(var e=t.firstChild;e;){var a=b(e);a&&(C[a]=e),p(e),e=e.nextSibling}}function m(t){N(t);for(var e=t.firstChild;e;){var a=e.nextSibling,o=b(e);if(o){var r=C[o];r&&i(e,r)&&(e.parentNode.replaceChild(r,e),v(r,e))}m(e),e=a}}function v(o,r,n){var s,d=b(r);if(d&&delete C[d],!a.isSameNode||!a.isSameNode(e)){if(!n){if(!1===I(o,r))return;if(t(o,r),_(o),!1===D(o,r))return}if("TEXTAREA"!==o.nodeName){var c,l,p,w,E=r.firstChild,N=o.firstChild;t:for(;E;){for(p=E.nextSibling,c=b(E);N;){if(l=N.nextSibling,E.isSameNode&&E.isSameNode(N)){E=p,N=l;continue t}s=b(N);var k=N.nodeType,A=void 0;if(k===E.nodeType&&(k===y?(c?c!==s&&((w=C[c])?N.nextSibling===w?A=!1:(o.insertBefore(w,N),l=N.nextSibling,s?h(s):u(N,o,!0),N=w):A=!1):s&&(A=!1),(A=!1!==A&&i(N,E))&&v(N,E)):k!==x&&k!=P||(A=!0,N.nodeValue=E.nodeValue)),A){E=p,N=l;continue t}s?h(s):u(N,o,!0),N=l}if(c&&(w=C[c])&&i(w,E))o.appendChild(w),v(w,E);else{var B=S(E);!1!==B&&(B&&(E=B),E.actualize&&(E=E.actualize(o.ownerDocument||f)),o.appendChild(E),m(E))}E=p,N=l}for(;N;)l=N.nextSibling,(s=b(N))?h(s):u(N,o,!0),N=l}var z=g[o.nodeName];z&&z(o,r)}}if(s||(s={}),"string"==typeof a)if("#document"===e.nodeName||"HTML"===e.nodeName){var w=a;a=f.createElement("html"),a.innerHTML=w}else a=o(a);var E,b=s.getNodeKey||c,S=s.onBeforeNodeAdded||d,N=s.onNodeAdded||d,I=s.onBeforeElUpdated||d,_=s.onElUpdated||d,k=s.onBeforeNodeDiscarded||d,A=s.onNodeDiscarded||d,D=s.onBeforeElChildrenUpdated||d,B=!0===s.childrenOnly,C={};p(e);var z=e,T=z.nodeType,G=a.nodeType;if(!B)if(T===y)G===y?i(e,a)||(A(e),z=n(e,r(a.nodeName,a.namespaceURI))):z=a;else if(T===x||T===P){if(G===T)return z.nodeValue=a.nodeValue,z;z=a}if(z===a)A(e);else if(v(z,a,B),E)for(var O=0,M=E.length;O<M;O++){var X=C[E[O]];X&&u(X,X.parentNode,!1)}return!B&&z!==e&&e.parentNode&&(z.actualize&&(z=z.actualize(e.ownerDocument||f)),e.parentNode.replaceChild(z,e)),z}}(s);e.exports=w},{}],5:[function(t,e,a){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var n=function(){function t(t,e){for(var a=0;a<e.length;a++){var o=e[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,a,o){return a&&t(e.prototype,a),o&&t(e,o),e}}(),s=t("a-template"),h=function(t){return t&&t.__esModule?t:{default:t}}(s),d='<div class="\\{classNames.smartPhoto\\}"\x3c!-- BEGIN hide:exist --\x3e style="display:none;"\x3c!-- END hide:exist --\x3e>\n\t<div class="\\{classNames.smartPhotoBody\\}">\n\t\t<div class="\\{classNames.smartPhotoInner\\}">\n\t\t\t <div class="\\{classNames.smartPhotoHeader\\}">\n\t\t\t\t\t<span class="\\{classNames.smartPhotoCount\\}">{currentIndex}[increment]/{total}</span>\n\t\t\t\t\t<span class="\\{classNames.smartPhotoCaption\\}">\x3c!-- BEGIN groupItems:loop --\x3e\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3e{caption}\x3c!-- \\END currentIndex:touch#{index} --\x3e\x3c!-- END groupItems:loop --\x3e</span>\n\t\t\t\t\t<button class="\\{classNames.smartPhotoDismiss\\}" data-action-click="hidePhoto()"></button>\n\t\t\t\t</div>\n\t\t\t\t<div class="\\{classNames.smartPhotoContent\\}"\x3c!-- BEGIN isSmartPhone:exist --\x3e data-action-touchstart="beforeDrag" data-action-touchmove="onDrag" data-action-touchend="afterDrag(false)"\x3c!-- END isSmartPhone:exist --\x3e>\n\t\t\t\t</div>\n\t\t\t\t<ul style="transform:translate({translateX}px,{translateY}px);" class="\\{classNames.smartPhotoList\\}\x3c!-- BEGIN onMoveClass:exist --\x3e \\{classNames.smartPhotoListOnMove\\}\x3c!-- END onMoveClass:exist --\x3e">\n\t\t\t\t\t\x3c!-- BEGIN groupItems:loop --\x3e\n\t\t\t\t\t<li style="transform:translate({translateX}px,{translateY}px);" class="\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3ecurrent\x3c!-- \\END currentIndex:touch#{index} --\x3e">\n\t\t\t\t\t\t\x3c!-- BEGIN loaded:exist --\x3e\n\t\t\t\t\t\t<div style="transform:translate({x}px,{y}px) scale({scale});" class="\\\\{classNames.smartPhotoImgWrap\\\\}"\x3c!-- \\BEGIN isSmartPhone:empty --\x3e data-action-mousemove="onDrag" data-action-mousedown="beforeDrag" data-action-mouseup="afterDrag"\x3c!-- \\END isSmartPhone:empty --\x3e\x3c!-- \\BEGIN isSmartPhone:exist --\x3e data-action-touchstart="beforeDrag" data-action-touchmove="onDrag" data-action-touchend="afterDrag"\x3c!-- \\END isSmartPhone:exist --\x3e>\n\t\t\t\t\t\t\t<img style="\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3etransform:translate(\\{photoPosX\\}[virtualPos]px,\\{photoPosY\\}[virtualPos]px) scale(\\{scaleSize\\});\x3c!-- \\END currentIndex:touch#{index} --\x3e" src="{src}" class="\\\\{classNames.smartPhotoImg\\\\}\x3c!-- \\BEGIN scale:exist --\x3e \\\\{classNames.smartPhotoImgOnMove\\\\}\x3c!-- \\END scale:exist --\x3e\x3c!-- \\BEGIN elastic:exist --\x3e \\\\{classNames.smartPhotoImgElasticMove\\\\}\x3c!-- \\END elastic:exist --\x3e\x3c!-- \\BEGIN appear:exist --\x3e active\x3c!-- \\END appear:exist --\x3e" ondragstart="return false;">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\x3c!-- END loaded:exist --\x3e\n\t\t\t\t\t\t\x3c!-- BEGIN loaded:empty --\x3e\n\t\t\t\t\t\t<div class="\\\\{classNames.smartPhotoLoaderWrap\\\\}">\n\t\t\t\t\t\t\t<span class="\\\\{classNames.smartPhotoLoader\\\\}"></span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\x3c!-- END loaded:empty --\x3e\n\t\t\t\t\t</li>\n\t\t\t\t\t\x3c!-- END groupItems:loop --\x3e\n\t\t\t\t</ul>\n\t\t\t\t\x3c!-- BEGIN arrows:exist --\x3e\n\t\t\t\t<ul class="\\{classNames.smartPhotoArrows\\}\x3c!-- BEGIN hideUi:exist --\x3e hide\x3c!-- END hideUi:exist --\x3e">\n\t\t\t\t\t<li class="\\{classNames.smartPhotoArrowLeft\\}\x3c!-- BEGIN showPrevArrow:exist --\x3e show\x3c!-- END showPrevArrow:exist --\x3e" data-action-click="gotoSlide({prev})"></li>\n\t\t\t\t\t<li class="\\{classNames.smartPhotoArrowRight\\}\x3c!-- BEGIN showNextArrow:exist --\x3e show\x3c!-- END showNextArrow:exist --\x3e" data-action-click="gotoSlide({next})"></li>\n\t\t\t\t</ul>\n\t\t\t\t\x3c!-- END arrows:exist --\x3e\n\t\t\t\t\x3c!-- BEGIN nav:exist --\x3e\n\t\t\t\t<nav class="\\{classNames.smartPhotoNav\\}\x3c!-- BEGIN hideUi:exist --\x3e hide\x3c!-- END hideUi:exist --\x3e">\n\t\t\t\t\t<ul >\n\t\t\t\t\t\t\x3c!-- BEGIN groupItems:loop --\x3e\n\t\t\t\t\t\t<li data-action-click="gotoSlide({index})" class="\x3c!-- \\BEGIN currentIndex:touch#{index} --\x3ecurrent\x3c!-- \\END currentIndex:touch#{index} --\x3e" style="background-image:url({src});"></li>\n\t\t\t\t\t\t\x3c!-- END groupItems:loop --\x3e\n\t\t\t\t\t</ul>\n\t\t\t\t</nav>\n\t\t\t\t\x3c!-- END nav:exist --\x3e\n\t\t</div>\n\t\t\x3c!-- BEGIN appearEffect:exist --\x3e\n\t\t<img src=\\{appearEffect.img\\}\n\t\tclass="\\{classNames.smartPhotoImgClone\\}"\n\t\tstyle="width:\\{appearEffect.width\\}px;height:\\{appearEffect.height\\}px;transform:translate(\\{appearEffect.left\\}px,\\{appearEffect.top\\}px) scale(1)" />\n\t\t\x3c!-- END appearEffect:exist --\x3e\n\t</div>\n</div>\n',c=t("../lib/util"),l={classNames:{smartPhoto:"smartphoto",smartPhotoClose:"smartphoto-close",smartPhotoBody:"smartphoto-body",smartPhotoInner:"smartphoto-inner",smartPhotoContent:"smartphoto-content",smartPhotoImg:"smartphoto-img",smartPhotoImgOnMove:"smartphoto-img-onmove",smartPhotoImgElasticMove:"smartphoto-img-elasticmove",smartPhotoImgWrap:"smartphoto-img-wrap",smartPhotoArrows:"smartphoto-arrows",smartPhotoNav:"smartphoto-nav",smartPhotoArrowRight:"smartphoto-arrow-right",smartPhotoArrowLeft:"smartphoto-arrow-left",smartPhotoImgLeft:"smartphoto-img-left",smartPhotoImgRight:"smartphoto-img-right",smartPhotoList:"smartphoto-list",smartPhotoListOnMove:"smartphoto-list-onmove",smartPhotoHeader:"smartphoto-header",smartPhotoCount:"smartphoto-count",smartPhotoCaption:"smartphoto-caption",smartPhotoDismiss:"smartphoto-dismiss",smartPhotoLoader:"smartphoto-loader",smartPhotoLoaderWrap:"smartphoto-loader-wrap",smartPhotoImgClone:"smartphoto-img-clone"},arrows:!0,nav:!0,animationSpeed:300,swipeOffset:100,maxWidth:940,headerHeight:60,footerHeight:60,forceInterval:10,registance:.5,resizeStyle:"fill",verticalGravity:!1,useOrientationApi:!0},u=function(t){function e(t,a){o(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));r.data=c.extend({},l,a),r.data.currentIndex=0,r.data.hide=!0,r.data.group={},r.data.scaleSize=1,r.data.scale=!1,r.pos={x:0,y:0},r.data.photoPosX=0,r.data.photoPosY=0,r.convert={increment:r.increment,virtualPos:r.virtualPos},r.data.groupItems=r.groupItems,r.elements=document.querySelectorAll(t);var n=new Date;r.tapSecond=n.getTime(),r.onListMove=!1,r.id=r._getUniqId(),r.vx=0,r.vy=0,r.data.appearEffect=null,r.addTemplate(r.id,d),r.data.isSmartPhone=r._isSmartPhone();var s=document.querySelector("body");c.append(s,"<div data-id='"+r.id+"'></div>"),[].forEach.call(r.elements,function(t,e){r.addNewItem(t)});var h=r._getCurrentItemByHash();return h&&c.triggerEvent(h.element,"click"),r._getEachImageSize(),setInterval(function(){r._doAnim()},r.data.forceInterval),r.data.isSmartPhone?(window.addEventListener("orientationchange",function(t){r._resetTranslate(),r._setPosByCurrentIndex(),r._setHashByCurrentIndex(),r._setSizeByScreen(),r.update()}),r.data.useOrientationApi?(window.addEventListener("deviceorientation",function(t){var e=window.orientation;t&&t.gamma&&!r.data.appearEffect&&(r.isBeingZoomed||r.photoSwipable||r.data.elastic||!r.data.scale||(0===e?r._calcGravity(t.gamma,t.beta):90===e?r._calcGravity(t.beta,t.gamma):-90===e?r._calcGravity(-t.beta,-t.gamma):180===e&&r._calcGravity(-t.gamma,-t.beta)))}),r):i(r)):(window.addEventListener("resize",function(t){r._resetTranslate(),r._setPosByCurrentIndex(),r._setSizeByScreen(),r.update()}),window.addEventListener("keydown",function(t){var e=t.keyCode||t.which;!0!==r.data.hide&&(37===e?r.gotoSlide(r.data.prev):39===e?r.gotoSlide(r.data.next):27===e&&r.hidePhoto())}),i(r))}return r(e,t),n(e,[{key:"increment",value:function(t){return t+1}},{key:"virtualPos",value:function(t){return(t=parseInt(t))/this._getSelectedItem().scale/this.data.scaleSize}},{key:"groupItems",value:function(){return this.data.group[this.data.currentGroup]}},{key:"_getEachImageSize",value:function(){var t=[],e=this.data.group;for(var a in e)e.hasOwnProperty(a)&&e[a].forEach(function(e){var a=new Promise(function(t,a){var o=new Image;o.onload=function(){e.width=o.width,e.height=o.height,e.loaded=!0,t()},o.onerror=function(){t()},o.src=e.src});t.push(a)});return Promise.all(t)}},{key:"_resetTranslate",value:function(){this.groupItems().forEach(function(t,e){t.translateX=window.innerWidth*e})}},{key:"addNewItem",value:function(t){var e=this,a=t.getAttribute("data-group")||"nogroup",o=this.data.group;"nogroup"===a&&t.setAttribute("data-group","nogroup"),o[a]||(o[a]=[]);var i=o[a].length,r={src:t.getAttribute("href"),caption:t.getAttribute("data-caption"),groupId:a,translateX:window.innerWidth*i,index:i,translateY:0,width:50,height:50,id:t.getAttribute("data-id")||i,loaded:!1,element:t};o[a].push(r),this.data.currentGroup=a,t.getAttribute("data-id")||t.setAttribute("data-id",i),t.setAttribute("data-index",i),t.addEventListener("click",function(a){a.preventDefault(),e.data.currentGroup=t.getAttribute("data-group"),e.data.currentIndex=parseInt(t.getAttribute("data-index")),e._setHashByCurrentIndex();var o=e._getSelectedItem();o.loaded?(e._initPhoto(),e.addAppearEffect(t),e.update()):e._loadItem(o).then(function(){e.data.appear=!0,e._initPhoto(),e.update()})})}},{key:"_initPhoto",value:function(){this.data.total=this.groupItems().length,this.data.hide=!1,this.data.photoPosX=0,this.data.photoPosY=0,this._setPosByCurrentIndex(),this._setSizeByScreen(),this.setArrow(),"fill"===this.data.resizeStyle&&this.data.isSmartPhone&&(this.data.scale=!0,this.data.hideUi=!0,this.data.scaleSize=this._getScaleBoarder())}},{key:"onUpdated",value:function(){var t=this;this.data.appearEffect&&this.data.appearEffect.once&&(this.data.appearEffect.once=!1,this.execEffect().then(function(){t.replaceEffectWithImg()}))}},{key:"execEffect",value:function(){var t=this.data.appearEffect,e=this.data.classNames,a=document.querySelector('[data-id="'+this.id+'"] .'+e.smartPhotoImgClone);return new Promise(function(e,o){setTimeout(function(){a.style.transition="all .3s ease-out",a.style.transform="translate("+t.afterX+"px, "+t.afterY+"px) scale("+t.scale+")",e()},30)})}},{key:"replaceEffectWithImg",value:function(){var t=this;this.data.classNames;setTimeout(function(){t.data.appearEffect=null,t.data.appear=!0,t.update()},300)}},{key:"addAppearEffect",value:function(t){var e=t.querySelector("img"),a=(e.cloneNode(!0),c.getViewPos(e)),o={},i=1;o.width=e.offsetWidth,o.height=e.offsetHeight,o.top=a.top,o.left=a.left,o.once=!0,o.img=e.getAttribute("src");var r=window.innerWidth,n=window.innerHeight,s=n-this.data.headerHeight-this.data.footerHeight;"fill"===this.data.resizeStyle&&this.data.isSmartPhone?i=e.offsetWidth>e.offsetHeight?n/e.offsetHeight:r/e.offsetWidth:(i=s/e.offsetHeight)*e.offsetWidth>r&&(i=r/e.offsetWidth);var h=(i-1)/2*e.offsetWidth+(r-e.offsetWidth*i)/2,d=(i-1)/2*e.offsetHeight+(n-e.offsetHeight*i)/2;o.afterX=h,o.afterY=d,o.scale=i,this.data.appearEffect=o}},{key:"hidePhoto",value:function(){var t=this;this.data.hide=!0,this.data.appear=!1,this.data.appearEffect=null;var e=window.scrollX,a=window.scrollY;location.hash&&(location.hash=""),window.scroll(e,a),this._doHideEffect().then(function(){t.update()})}},{key:"_doHideEffect",value:function(){var t=this;return new Promise(function(e,a){var o=t.data.classNames,i=t._getElementByClass(o.smartPhoto),r=t._getElementByQuery(".current ."+o.smartPhotoImg),n=window.innerHeight,s=function t(){i.removeEventListener("transitionend",t,!0),e()};i.style.opacity=0,r.style.transform="translateY("+n+"px)",i.addEventListener("transitionend",s,!0)})}},{key:"_getElementByClass",value:function(t){return document.querySelector('[data-id="'+this.id+'"] .'+t)}},{key:"_getElementByQuery",value:function(t){return document.querySelector('[data-id="'+this.id+'"] '+t)}},{key:"_getTouchPos",value:function(t){var e=0,a=0;if(void 0===o)var o=this.e;return this._isTouched(o)?(e=o.touches[0].pageX,a=o.touches[0].pageY):this._isTouched(this.e)?(e=this.e.touches[0].pageX,a=this.e.touches[0].pageY):o.pageX&&(e=o.pageX,a=o.pageY),{x:e,y:a}}},{key:"_getGesturePos",value:function(t){var e=t.touches;return[{x:e[0].pageX,y:e[0].pageY},{x:e[1].pageX,y:e[1].pageY}]}},{key:"_setPosByCurrentIndex",value:function(){var t=this,e=this.groupItems(),a=-1*e[this.data.currentIndex].translateX;this.pos.x=a,setTimeout(function(){t.data.translateX=a,t.data.translateY=0,t._listUpdate()},1)}},{key:"_setHashByCurrentIndex",value:function(){var t=window.scrollX,e=window.scrollY,a=this.groupItems(),o=a[this.data.currentIndex].id,i=this.data.currentGroup,r="group="+i+"&photo="+o;location.hash=r,window.scroll(t,e)}},{key:"_getCurrentItemByHash",value:function(){var t=this.data.group,e=location.hash.substr(1),a=c.parseQuery(e),o=null;for(var i in t)t.hasOwnProperty(i)&&t[i].forEach(function(t){a.group===t.groupId&&a.photo===t.id&&(o=t)});return o}},{key:"_loadItem",value:function(t){return new Promise(function(e,a){var o=new Image;o.onload=function(){t.width=o.width,t.height=o.height,t.loaded=!0,e()},o.onerror=function(){e()},o.src=t.src})}},{key:"_setSizeByScreen",value:function(){var t=window.innerWidth,e=window.innerHeight,a=this.data.headerHeight,o=this.data.footerHeight,i=e-(a+o);this.groupItems().forEach(function(a){a.scale=i/a.height,a.x=(a.scale-1)/2*a.width+(t-a.width*a.scale)/2,a.y=(a.scale-1)/2*a.height+(e-a.height*a.scale)/2,a.width*a.scale>t&&(a.scale=t/a.width,a.x=(a.scale-1)/2*a.width)})}},{key:"_slideList",value:function(){var t=this;this.data.onMoveClass=!0,this._setPosByCurrentIndex(),this._setHashByCurrentIndex(),this._setSizeByScreen(),setTimeout(function(){t.data.onMoveClass=!1,t.setArrow(),t.update()},200)}},{key:"gotoSlide",value:function(t){this.data.currentIndex=parseInt(t),this.data.currentIndex||(this.data.currentIndex=0),this._slideList()}},{key:"setArrow",value:function(){var t=this.groupItems(),e=t.length,a=this.data.currentIndex+1,o=this.data.currentIndex-1;this.data.showNextArrow=!1,this.data.showPrevArrow=!1,a!==e&&(this.data.next=a,this.data.showNextArrow=!0),-1!==o&&(this.data.prev=o,this.data.showPrevArrow=!0)}},{key:"beforeDrag",value:function(){if(this._isGestured(this.e))return void this.beforeGesture();if(this.data.scale)return void this.beforePhotoDrag();var t=this._getTouchPos(this.e);this.isSwipable=!0,this.dragStart=!0,this.firstPos=t,this.oldPos=t}},{key:"afterDrag",value:function(t){var e=this.groupItems(),a=new Date,o=a.getTime(),i=this.tapSecond-o,r=0,n=0;return this.isSwipable=!1,this.onListMove=!1,this.oldPos&&(r=this.oldPos.x-this.firstPos.x,n=this.oldPos.y-this.firstPos.y),this.isBeingZoomed?void this.afterGesture():this.data.scale?void this.afterPhotoDrag():c.isSmartPhone()||0!==r||0!==n?Math.abs(i)<=500&&0===r&&0===n?(this.e.preventDefault(),void this.zoomPhoto()):(this.tapSecond=o,"horizontal"===this.moveDir&&(r>=this.data.swipeOffset&&0!==this.data.currentIndex?this.data.currentIndex--:r<=-this.data.swipeOffset&&this.data.currentIndex!=e.length-1&&this.data.currentIndex++,this._slideList()),void("vertical"===this.moveDir&&(n>=this.data.swipeOffset?this.hidePhoto():(this.data.translateY=0,this._slideList())))):void this.zoomPhoto()}},{key:"onDrag",value:function(){if(this.e.preventDefault(),this._isGestured(this.e)&&!1===this.onListMove)return void this.onGesture();if(!this.isBeingZoomed){if(this.data.scale)return void this.onPhotoDrag();if(this.isSwipable){var t=this._getTouchPos(this.e),e=t.x-this.oldPos.x,a=t.y-this.firstPos.y;this.dragStart&&(this.dragStart=!1,Math.abs(e)>Math.abs(a)?this.moveDir="horizontal":this.moveDir="vertical"),"horizontal"===this.moveDir?(this.pos.x+=e,this.data.translateX=this.pos.x):this.data.translateY=a,this.onListMove=!0,this.oldPos=t,this._listUpdate()}}}},{key:"zoomPhoto",value:function(){var t=this;this.data.hideUi=!0,this.data.scaleSize=this._getScaleBoarder(),this.data.photoPosX=0,this.data.photoPosY=0,this._photoUpdate(),setTimeout(function(){t.data.scale=!0,t._photoUpdate()},300)}},{key:"zoomOutPhoto",value:function(){this.data.scaleSize=1,this.isBeingZoomed=!1,this.data.hideUi=!1,this.data.scale=!1,this.data.photoPosX=0,this.data.photoPosY=0,this._photoUpdate()}},{key:"beforePhotoDrag",value:function(){var t=this._getTouchPos(this.e)
;this.photoSwipable=!0,this.data.photoPosX||(this.data.photoPosX=0),this.data.photoPosY||(this.data.photoPosY=0),this.oldPhotoPos=t,this.firstPhotoPos=t}},{key:"onPhotoDrag",value:function(){if(this.photoSwipable){this.e.preventDefault();var t=this._getTouchPos(this.e),e=t.x-this.oldPhotoPos.x,a=t.y-this.oldPhotoPos.y,o=this._round(this.data.scaleSize*e,6),i=this._round(this.data.scaleSize*a,6);"number"==typeof o&&(this.data.photoPosX+=o,this.photoVX=o),"number"==typeof i&&(this.data.photoPosY+=i,this.photoVY=i),this.oldPhotoPos=t,this._photoUpdate()}}},{key:"afterPhotoDrag",value:function(){if(this.oldPhotoPos.x===this.firstPhotoPos.x&&this.photoSwipable)this.zoomOutPhoto();else{var t=this._getSelectedItem(),e=this._makeBound(t),a=0,o=0;this.data.photoPosX>e.maxX?a=-1:this.data.photoPosX<e.minX&&(a=1),this.data.photoPosY>e.maxY?o=-1:this.data.photoPosY<e.minY&&(o=1),0===a&&0===o?(this.vx=this.photoVX/5,this.vy=this.photoVY/5):this._registerElasticForce(a,o)}this.photoSwipable=!1}},{key:"beforeGesture",value:function(){var t=this._getGesturePos(this.e),e=this._getDistance(t[0],t[1]);this.isBeingZoomed=!0,this.oldDistance=e,this.data.scale=!0,this.e.preventDefault()}},{key:"onGesture",value:function(){var t=this._getGesturePos(this.e),e=this._getDistance(t[0],t[1]),a=(e-this.oldDistance)/100,o=this.data.scaleSize,i=this.data.photoPosX,r=this.data.photoPosY;this._getSelectedItem();this.data.scaleSize+=this._round(a,6),this.data.scaleSize<.2&&(this.data.scaleSize=.2),this.data.scaleSize<o&&(this.data.photoPosX=(1+this.data.scaleSize-o)*i,this.data.photoPosY=(1+this.data.scaleSize-o)*r),this.data.scaleSize<1||this.data.scaleSize>this._getScaleBoarder()?this.data.hideUi=!0:this.data.hideUi=!1,this.oldDistance=e,this.e.preventDefault(),this._photoUpdate()}},{key:"afterGesture",value:function(){this.isBeingZoomed=!1,this.data.scaleSize>this._getScaleBoarder()||(this.data.photoPosX=0,this.data.photoPosY=0,this.data.scale=!1,this.data.scaleSize=1,this.data.hideUi=!1,this._photoUpdate())}},{key:"_getForceAndTheta",value:function(t,e){return{force:Math.sqrt(t*t+e*e),theta:Math.atan2(e,t)}}},{key:"_getScaleBoarder",value:function(){var t=this._getSelectedItem();return c.isSmartPhone()?t.width>t.height?window.innerHeight/(t.height*t.scale):window.innerWidth/(t.width*t.scale):1/t.scale}},{key:"_makeBound",value:function(t){var e=t.width*t.scale*this.data.scaleSize,a=t.height*t.scale*this.data.scaleSize,o=void 0,i=void 0,r=void 0,n=void 0;return window.innerWidth>e?(r=(window.innerWidth-e)/2,o=-1*r):(r=(e-window.innerWidth)/2,o=-1*r),window.innerHeight>a?(n=(window.innerHeight-a)/2,i=-1*n):(n=(a-window.innerHeight)/2,i=-1*n),{minX:this._round(o,6)*this.data.scaleSize,minY:this._round(i,6)*this.data.scaleSize,maxX:this._round(r,6)*this.data.scaleSize,maxY:this._round(n,6)*this.data.scaleSize}}},{key:"_registerElasticForce",value:function(t,e){var a=this,o=this._getSelectedItem(),i=this._makeBound(o);this.data.elastic=!0,1===t?this.data.photoPosX=i.minX:-1===t&&(this.data.photoPosX=i.maxX),1===e?this.data.photoPosY=i.minY:-1===e&&(this.data.photoPosY=i.maxY),this._photoUpdate(),setTimeout(function(){a.data.elastic=!1,a._photoUpdate()},300)}},{key:"_getSelectedItem",value:function(){var t=this.data,e=t.currentIndex;return t.group[t.currentGroup][e]}},{key:"_getUniqId",value:function(){return(Date.now().toString(36)+Math.random().toString(36).substr(2,5)).toUpperCase()}},{key:"_getDistance",value:function(t,e){var a=t.x-e.x,o=t.y-e.y;return Math.sqrt(a*a+o*o)}},{key:"_round",value:function(t,e){var a=Math.pow(10,e);return t*=a,t=Math.round(t),t/=a}},{key:"_isTouched",value:function(t){return!(!t||!t.touches)}},{key:"_isGestured",value:function(t){return!!(t&&t.touches&&t.touches.length>1)}},{key:"_isSmartPhone",value:function(){var t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0}},{key:"_calcGravity",value:function(t,e){(t>5||t<-5)&&(this.vx+=.05*t),!1!==this.data.verticalGravity&&(e>5||e<-5)&&(this.vy+=.05*e)}},{key:"_photoUpdate",value:function(){var t=this.data.classNames,e=this._getElementByQuery(".current"),a=e.querySelector("."+t.smartPhotoImg),o=this._getElementByQuery("."+t.smartPhotoNav),i=this._getElementByQuery("."+t.smartPhotoArrows),r=this.virtualPos(this.data.photoPosX),n=this.virtualPos(this.data.photoPosY),s=this.data.scaleSize,h="translate("+r+"px,"+n+"px) scale("+s+")";a.style.transform=h,this.data.scale?c.addClass(a,t.smartPhotoImgOnMove):c.removeClass(a,t.smartPhotoImgOnMove),this.data.elastic?c.addClass(a,t.smartPhotoImgElasticMove):c.removeClass(a,t.smartPhotoImgElasticMove),this.data.hideUi?(c.addClass(o,"hide"),c.addClass(i,"hide"),setTimeout(function(){c.addClass(o,"none"),c.addClass(i,"none")},100)):(c.removeClass(o,"none"),c.removeClass(i,"none"),setTimeout(function(){c.removeClass(o,"hide"),c.removeClass(i,"hide")},10))}},{key:"_listUpdate",value:function(){var t=this.data.classNames,e=this._getElementByQuery("."+t.smartPhotoList),a="translate("+this.data.translateX+"px,"+this.data.translateY+"px)";e.style.transform=a,this.data.onMoveClass?c.addClass(e,t.smartPhotoListOnMove):c.removeClass(e,t.smartPhotoListOnMove)}},{key:"_doAnim",value:function(){if(!(this.isBeingZoomed||this.isSwipable||this.photoSwipable||this.data.elastic)&&this.data.scale){this.data.photoPosX+=this.vx,this.data.photoPosY+=this.vy;var t=this._getSelectedItem(),e=this._makeBound(t);this.data.photoPosX<e.minX?(this.data.photoPosX=e.minX,this.vx*=-.2):this.data.photoPosX>e.maxX&&(this.data.photoPosX=e.maxX,this.vx*=-.2),this.data.photoPosY<e.minY?(this.data.photoPosY=e.minY,this.vy*=-.2):this.data.photoPosY>e.maxY&&(this.data.photoPosY=e.maxY,this.vy*=-.2);var a=this._getForceAndTheta(this.vx,this.vy),o=a.force,i=a.theta;o-=this.data.registance,Math.abs(o)<.5||(this.vx=Math.cos(i)*o,this.vy=Math.sin(i)*o,this._photoUpdate())}}}]),e}(h.default);e.exports=u},{"../lib/util":7,"a-template":1}],6:[function(t,e,a){"use strict";e.exports=t("./core/")},{"./core/":5}],7:[function(t,e,a){"use strict";function o(t){t=t||{};for(var e=1;e<arguments.length;e++){var a=arguments[e];if(a)for(var r in a)a.hasOwnProperty(r)&&("object"===i(a[r])?t[r]=o(t[r],a[r]):t[r]=a[r])}return t}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.exports.isSmartPhone=function(){var t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0},e.exports.extend=o,e.exports.triggerEvent=function(t,e,a){var o=void 0;window.CustomEvent?o=new CustomEvent(e,{cancelable:!0}):(o=document.createEvent("CustomEvent"),o.initCustomEvent(e,!1,!1,a)),t.dispatchEvent(o)},e.exports.parseQuery=function(t){for(var e,a,o,i=t.split("&"),r={},n=0,s=i.length;n<s;n++)e=i[n].split("="),void 0!==e[0]&&(a=e[0],o=void 0!==e[1]?e.slice(1).join("="):a,r[a]=decodeURIComponent(o));return r},e.exports.getViewPos=function(t){return{left:t.getBoundingClientRect().left,top:t.getBoundingClientRect().top}},e.exports.removeElement=function(t){t&&t.parentNode&&t.parentNode.removeChild(t)},e.exports.append=function(t,e){var a=new DOMParser,o=a.parseFromString(e,"text/html");t.appendChild(o.querySelector("body").childNodes[0])},e.exports.addClass=function(t,e){t.classList?t.classList.add(e):t.className+=" "+e},e.exports.removeClass=function(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\b)"+e.split(" ").join("|")+"(\\b|$)","gi")," ")}},{}]},{},[6])(6)});

@@ -19,5 +19,3 @@ 'use strict';

var util = require('../lib/util');
var Keyboard = require('keyboard-js').Keyboard;

@@ -108,6 +106,2 @@ var defaults = {

if (!_this.data.isSmartPhone) {
_this._setKeyboard();
}
_this._getEachImageSize();

@@ -126,2 +120,17 @@

});
window.addEventListener('keydown', function (e) {
var code = e.keyCode || e.which;
if (_this.data.hide === true) {
return;
}
if (code === 37) {
_this.gotoSlide(_this.data.prev);
} else if (code === 39) {
_this.gotoSlide(_this.data.next);
} else if (code === 27) {
_this.hidePhoto();
}
});
return _possibleConstructorReturn(_this);
}

@@ -137,3 +146,3 @@

if (!_this.data.isSmartPhone || !_this.data.useOrientationApi) {
if (!_this.data.useOrientationApi) {
return _possibleConstructorReturn(_this);

@@ -180,28 +189,2 @@ }

}, {
key: '_setKeyboard',
value: function _setKeyboard() {
var _this2 = this;
var keyboard = new Keyboard();
keyboard.register('slideRight', function () {
if (_this2.data.hide === true) {
return;
}
_this2.gotoSlide(_this2.data.next);
}, ['ArrowRight']);
keyboard.register('slideLeft', function () {
if (_this2.data.hide === true) {
return;
}
_this2.gotoSlide(_this2.data.prev);
}, ['ArrowLeft']);
keyboard.register('hidePhoto', function () {
if (_this2.data.hide === true) {
return;
}
_this2.hidePhoto();
}, ['Escape']);
keyboard.start();
}
}, {
key: '_getEachImageSize',

@@ -245,3 +228,3 @@ value: function _getEachImageSize() {

value: function addNewItem(element) {
var _this3 = this;
var _this2 = this;

@@ -279,15 +262,15 @@ var groupId = element.getAttribute('data-group') || "nogroup";

event.preventDefault();
_this3.data.currentGroup = element.getAttribute('data-group');
_this3.data.currentIndex = parseInt(element.getAttribute('data-index'));
_this3._setHashByCurrentIndex();
var currentItem = _this3._getSelectedItem();
_this2.data.currentGroup = element.getAttribute('data-group');
_this2.data.currentIndex = parseInt(element.getAttribute('data-index'));
_this2._setHashByCurrentIndex();
var currentItem = _this2._getSelectedItem();
if (currentItem.loaded) {
_this3._initPhoto();
_this3.addAppearEffect(element);
_this3.update();
_this2._initPhoto();
_this2.addAppearEffect(element);
_this2.update();
} else {
_this3._loadItem(currentItem).then(function () {
_this3.data.appear = true;
_this3._initPhoto();
_this3.update();
_this2._loadItem(currentItem).then(function () {
_this2.data.appear = true;
_this2._initPhoto();
_this2.update();
});

@@ -316,3 +299,3 @@ }

value: function onUpdated() {
var _this4 = this;
var _this3 = this;

@@ -322,3 +305,3 @@ if (this.data.appearEffect && this.data.appearEffect.once) {

this.execEffect().then(function () {
_this4.replaceEffectWithImg();
_this3.replaceEffectWithImg();
});

@@ -344,9 +327,9 @@ }

value: function replaceEffectWithImg() {
var _this5 = this;
var _this4 = this;
var classNames = this.data.classNames;
setTimeout(function () {
_this5.data.appearEffect = null;
_this5.data.appear = true;
_this5.update();
_this4.data.appearEffect = null;
_this4.data.appear = true;
_this4.update();
}, 300);

@@ -393,3 +376,3 @@ }

value: function hidePhoto() {
var _this6 = this;
var _this5 = this;

@@ -406,3 +389,3 @@ this.data.hide = true;

this._doHideEffect().then(function () {
_this6.update();
_this5.update();
});

@@ -413,8 +396,8 @@ }

value: function _doHideEffect() {
var _this7 = this;
var _this6 = this;
return new Promise(function (resolve, reject) {
var classNames = _this7.data.classNames;
var photo = _this7._getElementByClass(classNames.smartPhoto);
var img = _this7._getElementByQuery('.current .' + classNames.smartPhotoImg);
var classNames = _this6.data.classNames;
var photo = _this6._getElementByClass(classNames.smartPhoto);
var img = _this6._getElementByQuery('.current .' + classNames.smartPhotoImg);
var height = window.innerHeight;

@@ -469,3 +452,3 @@ var handler = function handler() {

value: function _setPosByCurrentIndex() {
var _this8 = this;
var _this7 = this;

@@ -476,5 +459,5 @@ var items = this.groupItems();

setTimeout(function () {
_this8.data.translateX = moveX;
_this8.data.translateY = 0;
_this8._listUpdate();
_this7.data.translateX = moveX;
_this7.data.translateY = 0;
_this7._listUpdate();
}, 1);

@@ -552,3 +535,3 @@ }

value: function _slideList() {
var _this9 = this;
var _this8 = this;

@@ -560,5 +543,5 @@ this.data.onMoveClass = true;

setTimeout(function () {
_this9.data.onMoveClass = false;
_this9.setArrow();
_this9.update();
_this8.data.onMoveClass = false;
_this8.setArrow();
_this8.update();
}, 200);

@@ -705,3 +688,3 @@ }

value: function zoomPhoto() {
var _this10 = this;
var _this9 = this;

@@ -714,4 +697,4 @@ this.data.hideUi = true;

setTimeout(function () {
_this10.data.scale = true;
_this10._photoUpdate();
_this9.data.scale = true;
_this9._photoUpdate();
}, 300);

@@ -904,3 +887,3 @@ }

value: function _registerElasticForce(x, y) {
var _this11 = this;
var _this10 = this;

@@ -922,4 +905,4 @@ var item = this._getSelectedItem();

setTimeout(function () {
_this11.data.elastic = false;
_this11._photoUpdate();
_this10.data.elastic = false;
_this10._photoUpdate();
}, 300);

@@ -926,0 +909,0 @@ }

{
"name": "smartphoto",
"version": "0.3.2",
"version": "0.3.3",
"description": "smartphoto",

@@ -5,0 +5,0 @@ "homepage": "http://developer.a-blogcms.jp",

import aTemplate from 'a-template';
import template from './viwer.html';
const util = require('../lib/util');
const Keyboard = require('keyboard-js').Keyboard;

@@ -88,6 +86,2 @@ const defaults = {

if(!this.data.isSmartPhone) {
this._setKeyboard();
}
this._getEachImageSize();

@@ -106,2 +100,17 @@

});
window.addEventListener('keydown', (e) => {
const code = e.keyCode || e.which;
if(this.data.hide === true) {
return;
}
if(code === 37) {
this.gotoSlide(this.data.prev);
} else if (code === 39) {
this.gotoSlide(this.data.next);
} else if (code === 27) {
this.hidePhoto();
}
});
return;
}

@@ -117,3 +126,3 @@

if(!this.data.isSmartPhone || !this.data.useOrientationApi){
if(!this.data.useOrientationApi){
return;

@@ -155,25 +164,2 @@ }

_setKeyboard () {
const keyboard = new Keyboard();
keyboard.register('slideRight', () => {
if(this.data.hide === true) {
return;
}
this.gotoSlide(this.data.next);
},['ArrowRight']);
keyboard.register('slideLeft', () => {
if(this.data.hide === true) {
return;
}
this.gotoSlide(this.data.prev);
},['ArrowLeft']);
keyboard.register('hidePhoto', () => {
if(this.data.hide === true) {
return;
}
this.hidePhoto();
},['Escape'])
keyboard.start();
}
_getEachImageSize () {

@@ -180,0 +166,0 @@ const arr = [];

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc