UNPKG

16.5 kBJavaScriptView Raw
1!function(t){var e={};function i(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)i.d(n,s,function(e){return t[e]}.bind(null,s));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=4)}([function(t,e){t.exports={on:function(t,e){var i=this.events=this.events||{};return i[t]=this.events[t]||[],i[t].push(e),this},off:function(t){return this.events&&this.events[t]&&delete this.events[t],this},trigger:function(t){var e=this.events||{};if(!1===e.hasOwnProperty(t))return this;for(var i=0,n=e[t].length;i<n;i++)this.events[t][i].apply(this,arguments);return this}}},function(t,e){t.exports={closest:function(t,e){if("closest"in t)return t.closest(e);for(var i,n=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector;t;)if(n.bind(t)(e)?i=t:t=t.parentElement,i)return t;return null}}},function(t,e){t.exports={DIRECTIONS:{UP:0,RIGHT:1,DOWN:-1,LEFT:-2},NO_OP_FUNCTION:function(){},PREFIXES:{PAGE:"p-",TEMPLATE:"t-",ORGANISM:"o-",MOLECULE:"m-",ATOM:"a-"},TYPES:{PAGE:1,TEMPLATE:2,ORGANISM:3,MOLECULE:4,ATOM:5},UNDEFINED:void 0}},function(t,e,i){var n=i(7),s=i(2).TYPES,r=n.extend({TYPE:s.ORGANISM,CHILD_TYPES:[s.MOLECULE,s.ATOM]});t.exports=r},function(t,e,i){t.exports=i(5)},function(t,e,i){var n=i(6),s=i(14);n.init(),s.init()},function(t,e,i){var n=i(1).closest,s=i(0),r=i(3),o=i(12),a=r.extend({ui:{base:".o-expandable",target:".o-expandable_target",content:".o-expandable_content",header:".o-expandable_header",label:".o-expandable_label"},classes:{targetExpanded:"o-expandable_target__expanded",targetCollapsed:"o-expandable_target__collapsed",group:"o-expandable-group",groupAccordion:"o-expandable-group__accordion"},events:{"click .o-expandable_target":"expandableClickHandler"},transition:null,isAccordionGroup:!1,activeAccordion:!1,initialize:function(){var t=new o(this.ui.content);this.transition=t.init(),this.ui.content.classList.contains(o.CLASSES.EXPANDED)?this.ui.target.classList.add(this.classes.targetExpanded):this.ui.target.classList.add(this.classes.targetCollapsed);var e=n(this.ui.target,"."+this.classes.group);this.isAccordionGroup=null!==e&&e.classList.contains(this.classes.groupAccordion),this.isAccordionGroup&&s.on("accordionActivated",function(){this.activeAccordion&&(this.transition.toggleExpandable(),this.toggleTargetState(this.ui.target),this.activeAccordion=!1)}.bind(this))},expandableClickHandler:function(){this.transition.toggleExpandable(),this.toggleTargetState(this.ui.target),this.isAccordionGroup&&(this.activeAccordion?this.activeAccordion=!1:(s.trigger("accordionActivated",{target:this}),this.activeAccordion=!0))},toggleTargetState:function(t){t.classList.contains(this.classes.targetExpanded)?(this.ui.target.classList.add(this.classes.targetCollapsed),this.ui.target.classList.remove(this.classes.targetExpanded)):(this.ui.target.classList.add(this.classes.targetExpanded),this.ui.target.classList.remove(this.classes.targetCollapsed))},getLabelText:function(){return this.ui.label.textContent.trim()}});t.exports=a},function(t,e,i){var n=i(8).assign,s=i(9).Delegate,r=i(0),o=i(11).isFunction;function a(t,e){this.element=t,this.initializers=[],this.uId=this.uniqueId("ac"),n(this,e),this.processModifiers(),this.ensureElement(),this.setCachedElements(),this.initializers.push(this.initialize),this.initializers.forEach(function(t){o(t)&&t.apply(this,arguments)},this),this.trigger("component:initialized")}n(a.prototype,r,{tagName:"div",processModifiers:function(){this.modifiers&&this.modifiers.forEach(function(t){var e=t.ui.base.substring(1);this.element.classList.contains(e)&&(t.initialize&&(this.initializers.push(t.initialize),delete t.initialize),n(this,t))},this)},render:function(){return this},ensureElement:function(){if(this.element)this.setElement(this.element);else{var t=n({},this.attributes);t.id=this.id||this.u_id,this.className&&(t.class=this.className),this.setElement(document.createElement(this.tagName)),this.setElementAttributes(t)}this.element.setAttribute("data-bound",!0)},setElement:function(t){return this.element&&this.undelegateEvents(),this.element=t,this.delegateEvents(),this},setCachedElements:function(){var t,e,i=n({},this.ui);for(t in i)i.hasOwnProperty(t)&&(1===(e=this.element.querySelectorAll(i[t])).length?i[t]=e[0]:e.length>1?i[t]=e:i[t]=null);return this.ui=i,i},destroy:function(){return this.element&&(this.element.parentNode.removeChild(this.element),this.element.view&&delete this.element.view,delete this.element),this.undelegateEvents(),this.trigger("component:destroyed"),!0},setElementAttributes:function(t){var e;for(e in t)t.hasOwnProperty(e)&&this.element.setAttribute(e,t[e])},delegateEvents:function(t){var e,i,n,r=/^(\S+)\s*(.*)$/;if(!(t=t||(t=this.events)))return this;for(e in this.undelegateEvents(),this._delegate=new s(this.element),t)({}).hasOwnProperty.call(t,e)&&(i=t[e],o(this[i])&&(i=this[i]),i&&(n=e.match(r),this.delegate(n[1],n[2],i.bind(this))));return this.trigger("component:bound"),this},delegate:function(t,e,i){return this._delegate.on(t,e,i),this},undelegateEvents:function(){return this._delegate&&this._delegate.destroy(),this.element.removeAttribute("data-bound"),this},uniqueId:function(t){return t+"_"+Math.random().toString(36).substr(2,9)}}),a.extend=function(t){function e(){return this._super=a.prototype,a.apply(this,arguments)}return e.prototype=Object.create(a.prototype),n(e.prototype,t),n(e,a),t.hasOwnProperty("ui")&&t.ui.hasOwnProperty("base")&&(e.selector=t.ui.base),e.constants={},e},a.init=function(t){for(var e,i=(t||document).querySelectorAll(this.selector),n=[],s=0,r=i.length;s<r;s++)!1===(e=i[s]).hasAttribute("data-bound")&&n.push(new this(e));return n},t.exports=a},function(t,e){t.exports={assign:function t(e){e=e||{};for(var i=1,n=arguments.length;i<n;i++){var s=arguments[i]||{},r=void 0;for(r in s)if(Object.prototype.hasOwnProperty.call(s,r)){var o=s[r];a=o,"[object Object]"===Object.prototype.toString.call(a)?t(e[r]||(e[r]={}),o):e[r]=o}}var a;return e}}},function(t,e,i){"use strict";var n=i(10);t.exports=function(t){return new n(t)},t.exports.Delegate=n},function(t,e,i){"use strict";function n(t){this.listenerMap=[{},{}],t&&this.root(t),this.handle=n.prototype.handle.bind(this)}t.exports=n,n.prototype.root=function(t){var e,i=this.listenerMap;if(this.rootElement){for(e in i[1])i[1].hasOwnProperty(e)&&this.rootElement.removeEventListener(e,this.handle,!0);for(e in i[0])i[0].hasOwnProperty(e)&&this.rootElement.removeEventListener(e,this.handle,!1)}if(!t||!t.addEventListener)return this.rootElement&&delete this.rootElement,this;for(e in this.rootElement=t,i[1])i[1].hasOwnProperty(e)&&this.rootElement.addEventListener(e,this.handle,!0);for(e in i[0])i[0].hasOwnProperty(e)&&this.rootElement.addEventListener(e,this.handle,!1);return this},n.prototype.captureForType=function(t){return-1!==["blur","error","focus","load","resize","scroll"].indexOf(t)},n.prototype.on=function(t,e,i,n){var a,l,c,h;if(!t)throw new TypeError("Invalid event type: "+t);if("function"==typeof e&&(n=i,i=e,e=null),void 0===n&&(n=this.captureForType(t)),"function"!=typeof i)throw new TypeError("Handler must be a type of Function");return a=this.rootElement,(l=this.listenerMap[n?1:0])[t]||(a&&a.addEventListener(t,this.handle,n),l[t]=[]),e?/^[a-z]+$/i.test(e)?(h=e,c=r):/^#[a-z0-9\-_]+$/i.test(e)?(h=e.slice(1),c=o):(h=e,c=s):(h=null,c=function(t,e){return this.rootElement===window?e===document:this.rootElement===e}.bind(this)),l[t].push({selector:e,handler:i,matcher:c,matcherParam:h}),this},n.prototype.off=function(t,e,i,n){var s,r,o,a,l;if("function"==typeof e&&(n=i,i=e,e=null),void 0===n)return this.off(t,e,i,!0),this.off(t,e,i,!1),this;if(o=this.listenerMap[n?1:0],!t){for(l in o)o.hasOwnProperty(l)&&this.off(l,e,i);return this}if(!(a=o[t])||!a.length)return this;for(s=a.length-1;s>=0;s--)r=a[s],e&&e!==r.selector||i&&i!==r.handler||a.splice(s,1);return a.length||(delete o[t],this.rootElement&&this.rootElement.removeEventListener(t,this.handle,n)),this},n.prototype.handle=function(t){var e,i,n,s,r,o,a=t.type,l=[];if(!0!==t.ftLabsDelegateIgnore){switch(3===(o=t.target).nodeType&&(o=o.parentNode),n=this.rootElement,t.eventPhase||(t.target!==t.currentTarget?3:2)){case 1:l=this.listenerMap[1][a];break;case 2:this.listenerMap[0]&&this.listenerMap[0][a]&&(l=l.concat(this.listenerMap[0][a])),this.listenerMap[1]&&this.listenerMap[1][a]&&(l=l.concat(this.listenerMap[1][a]));break;case 3:l=this.listenerMap[0][a]}for(i=l.length;o&&i;){for(e=0;e<i&&(s=l[e]);e++)if(s.matcher.call(o,s.matcherParam,o)&&(r=this.fire(t,o,s)),!1===r)return t.ftLabsDelegateIgnore=!0,void t.preventDefault();if(o===n)break;i=l.length,o=o.parentElement}}},n.prototype.fire=function(t,e,i){return i.handler.call(e,t,e)};var s=function(t){if(t){var e=t.prototype;return e.matches||e.matchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector}}(Element);function r(t,e){return t.toLowerCase()===e.tagName.toLowerCase()}function o(t,e){return t===e.id}n.prototype.destroy=function(){this.off(),this.root()}},function(t,e){function i(t){return(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})(t)}var n=Object.prototype.toString;function s(t){return void 0===t}function r(t){return"[object String]"===n.call(t)}var o=Array.isArray||function(t){return"[object Array]"===n.call(t)};t.exports={isUndefined:s,isDefined:function(t){return void 0!==t},isObject:function(t){return null!==t&&"object"===i(t)},isString:r,isNumber:function(t){return"[object Number]"===n.call(t)},isDate:function(t){return"[object Date]"===n.call(t)},isArray:o,isFunction:function(t){return"[object Function]"===n.call(t)},isEmpty:function(t){return s(t)||null===t||r(t)&&t.length<=0||/^\s*$/.test(t)}}},function(t,e,i){var n=i(0),s=i(13),r={BASE_CLASS:"o-expandable_content__transition",EXPANDED:"o-expandable_content__expanded",COLLAPSED:"o-expandable_content__collapsed",OPEN_DEFAULT:"o-expandable_content__onload-open"};function o(t){var e,i=new s(t,r);return this.addEventListener=n.on,this.dispatchEvent=n.trigger,this.removeEventListener=n.off,this.animateOff=i.animateOff,this.animateOn=i.animateOn,this.halt=i.halt,this.isAnimated=i.isAnimated,this.setElement=i.setElement,this.remove=i.remove,this.init=function(){return i.init(),i.addEventListener(s.END_EVENT,function(){t.classList.contains(r.EXPANDED)?(this.dispatchEvent("expandEnd",{target:this}),t.scrollHeight>e&&(t.style.maxHeight=t.scrollHeight+"px")):t.classList.contains(r.COLLAPSED)&&this.dispatchEvent("collapseEnd",{target:this})}.bind(this)),t.classList.contains(r.OPEN_DEFAULT)?this.expand():this.collapse(),this},this.toggleExpandable=function(){return t.classList.contains(r.COLLAPSED)?this.expand():this.collapse(),this},this.collapse=function(){return this.dispatchEvent("collapseBegin",{target:this}),e=t.scrollHeight,t.style.maxHeight="0",i.applyClass(r.COLLAPSED),this},this.expand=function(){return this.dispatchEvent("expandBegin",{target:this}),(!e||t.scrollHeight>e)&&(e=t.scrollHeight),t.style.maxHeight=e+"px",i.applyClass(r.EXPANDED),this},this}o.CLASSES=r,t.exports=o},function(t,e,i){var n=i(0);function s(t,e){var i,r,o,a,l,c=e,h=!1,u=!1;function d(t){i&&(E(),p()),(i=t).classList.add(c.BASE_CLASS),o=function(t){if(!t){throw new Error("Element does not have TransitionEnd event. It may be null!")}var e,i,n={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(i in n)if(n.hasOwnProperty(i)&&void 0!==t.style[i]){e=n[i];break}return e}(i)}function p(){return i?(i.classList.remove(s.NO_ANIMATION_CLASS),this):this}function f(){h&&(i.style.webkitTransitionDuration="0",i.style.mozTransitionDuration="0",i.style.oTransitionDuration="0",i.style.transitionDuration="0",i.removeEventListener(o,a),a(),i.style.webkitTransitionDuration="",i.style.mozTransitionDuration="",i.style.oTransitionDuration="",i.style.transitionDuration="")}function g(){i.removeEventListener(o,a)}function m(){var t;for(t in c)c.hasOwnProperty(t)&&c[t]!==c.BASE_CLASS&&i.classList.contains(c[t])&&i.classList.remove(c[t])}function E(){return!!i&&(f(),i.classList.remove(c.BASE_CLASS),m(),!0)}return this.addEventListener=n.on,this.trigger=n.trigger,this.removeEventListener=n.off,this.animateOff=function(){return i?(i.classList.add(s.NO_ANIMATION_CLASS),this):this},this.animateOn=p,this.applyClass=function(t){return!!i&&(u||(m(),u=!0),!i.classList.contains(t)&&(g(),i.classList.remove(r),r=t,l(),i.classList.add(r),!0))},this.halt=f,this.init=function(){return a=function(){g(),this.trigger(s.END_EVENT,{target:this}),h=!1}.bind(this),l=function(){h=!0,o?(i.addEventListener(o,a),this.trigger(s.BEGIN_EVENT,{target:this})):(this.trigger(s.BEGIN_EVENT,{target:this}),a())}.bind(this),d(t),this},this.isAnimated=function(){return!!i&&!i.classList.contains(s.NO_ANIMATION_CLASS)},this.remove=E,this.setElement=d,this}s.BEGIN_EVENT="transitionBegin",s.END_EVENT="transitionEnd",s.NO_ANIMATION_CLASS="u-no-animation",t.exports=s},function(t,e,i){var n=i(2),s=i(3),r=i(15),o=i(16),a=s.extend({ui:{base:".o-table"},modifiers:[r,o]});a.constants.DIRECTIONS=n.DIRECTIONS,t.exports=a},function(t,e,i){var n=i(2),s=i(1).closest,r=n.DIRECTIONS,o=n.UNDEFINED,a={ui:{base:".o-table__sortable",tableBody:"tbody",sortButton:".sorted-up, .sorted-down"},classes:{sortDown:"sorted-down",sortUp:"sorted-up"},events:{"click .sortable":"onSortableClick"},initialize:function(){this.sortClass=o,this.sortColumnIndex=o,this.sortDirection=o,this.tableData=[],this.bindProperties(),this.ui.sortButton&&(this.sortColumnIndex=this.getColumnIndex(),this.sortDirection=r.UP,this.ui.sortButton.classList.contains(this.classes.sortDown)&&(this.sortDirection=r.DOWN),this.updateTable())},bindProperties:function(){var t;Object.defineProperty(this,"sortDirection",{configurable:!0,get:function(){return t},set:function(e){e===r.UP?this.sortClass=this.classes.sortUp:e===r.DOWN&&(this.sortClass=this.classes.sortDown),t=e}})},getColumnIndex:function(t){return s(t||this.ui.sortButton,"td, th").cellIndex},updateTable:function(){return this.updateTableData()&&this.updateTableDom()},updateTableData:function(t){var e,i=this.ui.tableBody.querySelectorAll("tr");this.tableData=[],t=t||this.sortColumnIndex;for(var n=0,s=i.length;n<s;++n)(e=i[n].cells[t])&&(e=e.textContent.trim()),this.tableData.push([e,i[n]]);var r=this.ui.sortButton.getAttribute("data-sort_type");return this.tableData.sort(this.tableDataSorter(this.sortDirection,r)),this.tableData},updateTableDom:function(){var t=this.ui.tableBody;for(;t.lastChild;)t.removeChild(t.lastChild);for(var e=document.createDocumentFragment(),i=0;i<this.tableData.length;i++)e.appendChild(this.tableData[i][1]);return t.appendChild(e),this.trigger("table:updated"),t},tableDataSorter:function(t,e){return function(i,n){var s=t===r.DOWN?-1:1,o=0,a=/[^\d.-]/g;return i=i[0],n=n[0],"number"===e&&(i=Number(i.replace(a,"")),n=Number(n.replace(a,""))),i<n?o=-1*s:i>n&&(o=s),o}},onSortableClick:function(t){this.ui.sortButton&&this.ui.sortButton.classList.remove(this.sortClass);this.ui.sortButton===t.target?this.sortDirection=~this.sortDirection:(this.ui.sortButton=t.target,this.sortColumnIndex=this.getColumnIndex(),this.sortDirection=r.UP);return this.ui.sortButton.classList.add(this.sortClass),this.updateTable(),this}};t.exports=a},function(t,e,i){var n=i(1).closest,s={ui:{base:".o-table__row-links"},events:{"click tbody tr":"onRowLinkClick"},onRowLinkClick:function(t){var e=t.target;if(e&&"A"===e.tagName)return;var i=(e=n(t.target,"tr")).querySelector("a");i&&(window.location=i.getAttribute("href"))}};t.exports=s}]);
\No newline at end of file