From d6a35b4872b6bc8d4ab76d82392e4a11ed8454bb Mon Sep 17 00:00:00 2001 From: flarum-bot Date: Sun, 29 Sep 2024 17:44:32 +0000 Subject: [PATCH] Bundled output for commit aa2f624e26c33c16c86a7e30bdbe3a42834c4e24 Includes transpiled JS/TS, and Typescript declaration files (typings). [skip ci] --- js/dist/admin.js | 2 +- js/dist/admin.js.map | 2 +- js/dist/forum.js | 3 ++- js/dist/forum.js.map | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/js/dist/admin.js b/js/dist/admin.js index 6e3cc93..f4ca30b 100644 --- a/js/dist/admin.js +++ b/js/dist/admin.js @@ -1,2 +1,2 @@ -(()=>{var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};(()=>{"use strict";e.r(t),e.d(t,{components:()=>ve,helpers:()=>be,models:()=>ye});const r=flarum.core.compat["admin/app"];var n=e.n(r);function o(e,t){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},o(e,t)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,o(e,t)}const a=flarum.core.compat["common/Model"];var s=e.n(a);const l=flarum.core.compat["common/utils/computed"];var c=e.n(l),d=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),o=0;o0&&t.matches(e)})).length>0;if(e===t)return!0;if(void 0!==w(e).getConfig("connectWith")&&null!==w(e).getConfig("connectWith"))return w(e).getConfig("connectWith")===w(t).getConfig("connectWith")}return!1},U={items:null,connectWith:null,disableIEFix:null,acceptFrom:null,copy:!1,placeholder:null,placeholderClass:"sortable-placeholder",draggingClass:"sortable-dragging",hoverClass:!1,dropTargetContainerClass:!1,debounce:0,throttleTime:100,maxItems:0,itemSerializer:void 0,containerSerializer:void 0,customDragImage:null,orientation:"vertical"},X=function(e){T(e,"dragstart"),T(e,"dragend"),T(e,"dragover"),T(e,"dragenter"),T(e,"drop"),T(e,"mouseenter"),T(e,"mouseleave")},G=function(e,t){e&&T(e,"dragleave"),t&&t!==e&&T(t,"dragleave")},V=function(e){var t;(t=e).h5s&&delete t.h5s.data,C(e,"aria-dropeffect")},J=function(e){C(e,"aria-grabbed"),C(e,"aria-copied"),C(e,"draggable"),C(e,"role")};function K(e,t){if(t.composedPath)return t.composedPath().find((function(e){return e.isSortable}));for(;!0!==e.isSortable;)e=e.parentElement;return e}function Q(e,t){var r=g(e,"opts"),n=v(e.children,r.items).filter((function(e){return e.contains(t)||e.shadowRoot&&e.shadowRoot.contains(t)}));return n.length>0?n[0]:t}var Z=function(e){var t=g(e,"opts"),r=v(e.children,t.items),n=z(r,t.handle);x(e,"aria-dropeffect","move"),g(e,"_disabled","false"),x(n,"draggable","true"),!1===t.disableIEFix&&"function"==typeof(document||window.document).createElement("span").dragDrop&&E(n,"mousedown",(function(){if(-1!==r.indexOf(this))this.dragDrop();else{for(var e=this.parentElement;-1===r.indexOf(e);)e=e.parentElement;e.dragDrop()}}))};function $(e,t){var r=String(t);return t=t||{},"string"==typeof e&&(e=document.querySelectorAll(e)),e instanceof HTMLElement&&(e=[e]),e=Array.prototype.slice.call(e),/serialize/.test(r)?e.map((function(e){var t=g(e,"opts");return function(e,t,r){if(void 0===t&&(t=function(e,t){return e}),void 0===r&&(r=function(e){return e}),!(e instanceof HTMLElement)||1==!e.isSortable)throw new Error("You need to provide a sortableContainer to be serialized.");if("function"!=typeof t||"function"!=typeof r)throw new Error("You need to provide a valid serializer for items and the container.");var n=g(e,"opts").items,o=v(e.children,n),i=o.map((function(t){return{parent:e,node:t,html:t.outerHTML,index:H(t,o)}}));return{container:r({node:e,itemCount:i.length}),items:i.map((function(r){return t(r,e)}))}}(e,t.itemSerializer,t.containerSerializer)})):(e.forEach((function(e){if(/enable|disable|destroy/.test(r))return $[r](e);["connectWith","disableIEFix"].forEach((function(e){Object.prototype.hasOwnProperty.call(t,e)&&null!==t[e]&&console.warn('HTML5Sortable: You are using the deprecated configuration "'+e+'". This will be removed in an upcoming version, make sure to migrate to the new options when updating.')})),t=Object.assign({},U,w(e).config,t),w(e).config=t,g(e,"opts",t),e.isSortable=!0,function(e){var t=g(e,"opts"),r=v(e.children,t.items),n=z(r,t.handle);g(e,"_disabled","false"),X(r),G(P,D),T(n,"mousedown"),T(e,"dragover"),T(e,"dragenter"),T(e,"drop")}(e);var n,o=v(e.children,t.items);if(null!==t.placeholder&&void 0!==t.placeholder){var i=document.createElement(e.tagName);t.placeholder instanceof HTMLElement?i.appendChild(t.placeholder):i.innerHTML=t.placeholder,n=i.children[0]}w(e).placeholder=function(e,t,r){var n;if(void 0===r&&(r="sortable-placeholder"),!(e instanceof HTMLElement))throw new Error("You must provide a valid element as a sortable.");if(!(t instanceof HTMLElement)&&void 0!==t)throw new Error("You must provide a valid element as a placeholder or set ot to undefined.");return void 0===t&&(["UL","OL"].includes(e.tagName)?t=document.createElement("li"):["TABLE","TBODY"].includes(e.tagName)?(t=document.createElement("tr")).innerHTML='':t=document.createElement("div")),"string"==typeof r&&(n=t.classList).add.apply(n,r.split(" ")),t}(e,n,t.placeholderClass),g(e,"items",t.items),t.acceptFrom?g(e,"acceptFrom",t.acceptFrom):t.connectWith&&g(e,"connectWith",t.connectWith),Z(e),x(o,"role","option"),x(o,"aria-grabbed","false"),function(e,t){if("string"==typeof w(e).getConfig("hoverClass")){var r=w(e).getConfig("hoverClass").split(" ");!0===t?(E(e,"mousemove",function(e,t){var r=this;if(void 0===t&&(t=250),"number"!=typeof t)throw new Error("You must provide a number as the second argument for throttle.");var n=null;return function(){for(var o=[],i=0;i=t)&&(n=a,e.apply(r,o))}}((function(t){0===t.buttons&&v(e.children,w(e).getConfig("items")).forEach((function(e){var n,o;e!==t.target?(n=e.classList).remove.apply(n,r):(o=e.classList).add.apply(o,r)}))}),w(e).getConfig("throttleTime"))),E(e,"mouseleave",(function(){v(e.children,w(e).getConfig("items")).forEach((function(e){var t;(t=e.classList).remove.apply(t,r)}))}))):(T(e,"mousemove"),T(e,"mouseleave"))}}(e,!0),E(e,"dragstart",(function(e){var r=q(e);if(!0!==r.isSortable&&(e.stopImmediatePropagation(),(!t.handle||r.matches(t.handle))&&"false"!==r.getAttribute("draggable"))){var n=K(r,e),o=Q(n,r);M=v(n.children,t.items),S=M.indexOf(o),A=H(o,n.children),P=n,function(e,t,r){if(!(e instanceof Event))throw new Error("setDragImage requires a DragEvent as the first argument.");if(!(t instanceof HTMLElement))throw new Error("setDragImage requires the dragged element as the second argument.");if(r||(r=W),e.dataTransfer&&e.dataTransfer.setDragImage){var n=r(t,O(t),e);if(!(n.element instanceof HTMLElement)||"number"!=typeof n.posX||"number"!=typeof n.posY)throw new Error("The customDragImage function you provided must return and object with the properties element[string], posX[integer], posY[integer].");e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setData("text/plain",q(e).id),e.dataTransfer.setDragImage(n.element,n.posX,n.posY)}}(e,o,t.customDragImage),F=N(o),L=k(o),o.classList.add(t.draggingClass),_=function(e,t){var r=e;return!0===w(t).getConfig("copy")&&(x(r=e.cloneNode(!0),"aria-copied","true"),e.parentElement.appendChild(r),r.style.display="none",r.oldDisplay=e.style.display),r}(o,n),x(_,"aria-grabbed","true"),n.dispatchEvent(new CustomEvent("sortstart",{detail:{origin:{elementIndex:A,index:S,container:P},item:_,originalTarget:r}}))}})),E(e,"dragenter",(function(r){var n=q(r),o=K(n,r);o&&o!==D&&(I=v(o.children,g(o,"items")).filter((function(t){return t!==w(e).placeholder})),t.dropTargetContainerClass&&o.classList.add(t.dropTargetContainerClass),o.dispatchEvent(new CustomEvent("sortenter",{detail:{origin:{elementIndex:A,index:S,container:P},destination:{container:o,itemsBeforeUpdate:I},item:_,originalTarget:n}})),E(o,"dragleave",(function(e){var r=e.relatedTarget||e.fromElement;e.currentTarget.contains(r)||(t.dropTargetContainerClass&&o.classList.remove(t.dropTargetContainerClass),o.dispatchEvent(new CustomEvent("sortleave",{detail:{origin:{elementIndex:A,index:S,container:o},item:_,originalTarget:n}})))}))),D=o})),E(e,"dragend",(function(r){if(_){_.classList.remove(t.draggingClass),x(_,"aria-grabbed","false"),"true"===_.getAttribute("aria-copied")&&"true"!==g(_,"dropped")&&_.remove(),_.style.display=_.oldDisplay,delete _.oldDisplay;var n=Array.from(y.values()).map((function(e){return e.placeholder})).filter((function(e){return e instanceof HTMLElement})).filter(j)[0];n&&n.remove(),e.dispatchEvent(new CustomEvent("sortstop",{detail:{origin:{elementIndex:A,index:S,container:P},item:_}})),D=null,_=null,F=null,L=null}})),E(e,"drop",(function(r){if(R(e,_.parentElement)){r.preventDefault(),r.stopPropagation(),g(_,"dropped","true");var n=Array.from(y.values()).map((function(e){return e.placeholder})).filter((function(e){return e instanceof HTMLElement})).filter(j)[0];B(n,_),n.remove(),e.dispatchEvent(new CustomEvent("sortstop",{detail:{origin:{elementIndex:A,index:S,container:P},item:_}}));var o=w(e).placeholder,i=v(P.children,t.items).filter((function(e){return e!==o})),a=!0===this.isSortable?this:this.parentElement,s=v(a.children,g(a,"items")).filter((function(e){return e!==o})),l=H(_,Array.from(_.parentElement.children).filter((function(e){return e!==o}))),c=H(_,s);t.dropTargetContainerClass&&a.classList.remove(t.dropTargetContainerClass),A===l&&P===a||e.dispatchEvent(new CustomEvent("sortupdate",{detail:{origin:{elementIndex:A,index:S,container:P,itemsBeforeUpdate:M,items:i},destination:{index:c,elementIndex:l,container:a,itemsBeforeUpdate:I,items:s},item:_}}))}}));var a,s,l,c=(a=function(e,r,n,o){if(_)if(t.forcePlaceholderSize&&(w(e).placeholder.style.height=F+"px",w(e).placeholder.style.width=L+"px"),Array.from(e.children).indexOf(r)>-1){var i=N(r),a=k(r),s=H(w(e).placeholder,r.parentElement.children),l=H(r,r.parentElement.children);if(i>F||a>L){var c=i-F,d=a-L,u=O(r).top,f=O(r).left;if(sl&&("vertical"===t.orientation&&o>u+i-c||"horizontal"===t.orientation&&n>f+a-d))return}void 0===_.oldDisplay&&(_.oldDisplay=_.style.display),"none"!==_.style.display&&(_.style.display="none");var p=!1;try{var m=O(r).top+r.offsetHeight/2,h=O(r).left+r.offsetWidth/2;p="vertical"===t.orientation&&o>=m||"horizontal"===t.orientation&&n>=h}catch(e){p=s=parseInt(n.maxItems)&&_.parentElement!==r||(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=!0===w(r).getConfig("copy")?"copy":"move",c(r,t,e.pageX,e.pageY))}};E(o.concat(e),"dragover",d),E(o.concat(e),"dragenter",d)})),e)}$.destroy=function(e){!function(e){var t=g(e,"opts")||{},r=v(e.children,t.items),n=z(r,t.handle);T(e,"dragover"),T(e,"dragenter"),T(e,"dragstart"),T(e,"dragend"),T(e,"drop"),V(e),T(n,"mousedown"),X(r),J(r),G(P,D),e.isSortable=!1}(e)},$.enable=function(e){Z(e)},$.disable=function(e){!function(e){var t=g(e,"opts"),r=v(e.children,t.items),n=z(r,t.handle);x(e,"aria-dropeffect","none"),g(e,"_disabled","true"),x(n,"draggable","false"),T(n,"mousedown")}(e)},$.__testing={_data:g,_removeItemEvents:X,_removeItemData:J,_removeSortableData:V,_removeContainerEvents:G};const ee=$,te=flarum.core.compat["common/helpers/icon"];var re=e.n(te);const ne=flarum.core.compat["common/utils/extractText"];var oe=e.n(ne);const ie=flarum.core.compat["common/utils/ItemList"];var ae=e.n(ie);const se=flarum.core.compat["common/utils/withAttr"];var le=e.n(se);const ce=flarum.core.compat["common/components/Button"];var de=e.n(ce),ue=function(){function e(){}var t=e.prototype;return t.oninit=function(e){this.policy=e.attrs.policy,this.dirty=!1,this.processing=!1,this.toggleFields=!1,null===this.policy&&this.initNewField()},t.initNewField=function(){this.policy=n().store.createRecord("fof-terms-policies",{attributes:{name:"",url:"",update_message:"",terms_updated_at:""}})},t.boxTitle=function(){return this.policy.exists?this.policy.name():n().translator.trans("fof-terms.admin.buttons.new-policy")},t.view=function(){var e=this;return m(".FoF-Terms-Policiy-Box",[this.policy.exists?m("span.fas.fa-arrows-alt.FoF-Terms-Policiy-Box--handle.js-policy-handle"):null,m(".Button.Button--block.FoF-Terms-Policiy-Header",{onclick:function(){e.toggleFields=!e.toggleFields}},[m(".FoF-Terms-Policiy-Header-Title",this.boxTitle()),m("div",[this.policy.exists?[n().translator.trans("fof-terms.admin.buttons.edit-policy")," "]:null,re()(this.toggleFields?"fas fa-chevron-up":"fas fa-chevron-down")])]),this.toggleFields?this.viewFields():null])},t.viewFields=function(){return m("form.FoF-Terms-Policiy-Body",{onsubmit:this.savePolicy.bind(this)},[this.fields().toArray(),m(".ButtonGroup",[de().component({type:"submit",className:"Button Button--primary",loading:this.processing,disabled:!this.readyToSave()},n().translator.trans("fof-terms.admin.buttons."+(this.policy.exists?"save":"add")+"-policy")),this.policy.exists?de().component({type:"submit",className:"Button Button--danger",loading:this.processing,onclick:this.deletePolicy.bind(this)},n().translator.trans("fof-terms.admin.buttons.delete-policy")):""])])},t.fields=function(){var e=this,t=new(ae());return t.add("name",m(".Form-group",[m("label",n().translator.trans("fof-terms.admin.policies.name")),m("input.FormControl",{type:"text",value:this.policy.name(),oninput:le()("value",this.updateAttribute.bind(this,"name"))}),m(".helpText",n().translator.trans("fof-terms.admin.policies.name-help"))]),100),t.add("url",m(".Form-group",[m("label",n().translator.trans("fof-terms.admin.policies.url")),m("input.FormControl",{type:"url",value:this.policy.url(),oninput:le()("value",this.updateAttribute.bind(this,"url"))}),m(".helpText",n().translator.trans("fof-terms.admin.policies.url-help"))]),95),t.add("update-message",m(".Form-group",[m("label",n().translator.trans("fof-terms.admin.policies.update-message")),m("textarea.FormControl",{value:this.policy.update_message(),oninput:le()("value",this.updateAttribute.bind(this,"update_message"))}),m(".helpText",n().translator.trans("fof-terms.admin.policies.update-message-help"))]),90),t.add("terms-updated-at",m(".Form-group",[m("label",n().translator.trans("fof-terms.admin.policies.terms-updated-at")),m(".FoF-Terms-Input-Group",[m("input.FormControl",{type:"text",value:this.policy.terms_updated_at(),oninput:le()("value",this.updateAttribute.bind(this,"terms_updated_at")),placeholder:n().translator.trans("fof-terms.admin.policies.terms-updated-at-placeholder")}),de().component({className:"Button Button--primary",onclick:function(){e.updateAttribute("terms_updated_at",dayjs().millisecond(0).toISOString())}},n().translator.trans("fof-terms.admin.buttons.set-to-now"))]),m(".helpText",n().translator.trans("fof-terms.admin.policies.terms-updated-at-help"))]),85),this.policy.exists&&t.add("export-url",m(".Form-group",[m("label",n().translator.trans("fof-terms.admin.policies.export-url")),m(".ButtonGroup",["json","csv"].map((function(t){return m("a.Button.FoF-Terms-Export-Button",{href:n().forum.attribute("apiUrl")+"/fof/terms/policies/"+e.policy.id()+"/export."+t,target:"_blank"},t.toUpperCase())}))),m(".helpText",n().translator.trans("fof-terms.admin.policies.export-url-help",{a:m("a",{href:"https://github.com/FriendsOfFlarum/terms/wiki/Export-url",target:"_blank"})}))]),80),t},t.updateAttribute=function(e,t){var r;this.policy.pushAttributes(((r={})[e]=t,r)),this.dirty=!0},t.readyToSave=function(){return this.dirty},t.savePolicy=function(e){var t=this;e.preventDefault(),this.processing=!0;var r=!this.policy.exists;this.policy.save(this.policy.data.attributes).then((function(){r&&(t.initNewField(),t.toggleFields=!1),t.processing=!1,t.dirty=!1,m.redraw()})).catch((function(e){throw t.processing=!1,e}))},t.deletePolicy=function(){var e=this;confirm(oe()(n().translator.trans("fof-terms.admin.messages.delete-policy-confirmation",{name:this.policy.name()})))&&(this.processing=!0,this.policy.delete().then((function(){e.processing=!1,m.redraw()})).catch((function(t){throw e.processing=!1,t})))},e}();function fe(e,t){return void 0===t&&(t="sort"),e.sort((function(e,r){return e[t]()-r[t]()}))}var pe=function(){function e(){}var t=e.prototype;return t.oninit=function(){n().request({method:"GET",url:n().forum.attribute("apiUrl")+"/fof/terms/policies"}).then((function(e){n().store.pushPayload(e),m.redraw()}))},t.oncreate=function(e){this.initsortable(e)},t.onupdate=function(e){this.initsortable(e)},t.initsortable=function(e){var t=this;ee(e.dom.querySelector(".js-policies-container"),{handle:".js-policy-handle"})[0].addEventListener("sortupdate",(function(){var r=[].map.call(e.dom.querySelectorAll(".js-policy-data"),(function(e){return e.dataset.id}));t.updateSort(r)}))},t.view=function(){var e=n().store.all("fof-terms-policies"),t=[];return fe(e).forEach((function(e){t.push(m(".js-policy-data",{key:e.id(),"data-id":e.id()},m(ue,{policy:e})))})),m("div",[m("h2",n().translator.trans("fof-terms.admin.titles.policies")),m(".FoF-Terms-Policies-Container",[m(".js-policies-container",t),m(ue,{policy:null})])])},t.updateSort=function(e){n().request({method:"POST",url:n().forum.attribute("apiUrl")+"/fof/terms/policies/order",body:{sort:e}}).then((function(e){n().store.pushPayload(e),m.redraw()}))},e}(),me="fof-terms.",he="fof-terms.admin.settings.",ge=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.content=function(){return m(".ExtensionPage-settings",[m(".container",[m(".Form-group",[m("label",n().translator.trans(he+"field.signup-legal-text")),m("textarea.FormControl",{bidi:this.setting(me+"signup-legal-text")})]),m(".Form-group",[m("label",h().component({state:this.setting(me+"hide-updated-at")()>0,onchange:this.setting(me+"hide-updated-at")},n().translator.trans(he+"field.hide-updated-at")))]),m(".Form-group",[m("label",n().translator.trans(he+"field.date-format")),m("input[type=text].FormControl",{bidi:this.setting(me+"date-format"),placeholder:"YYYY-MM-DD"}),m(".helpText",n().translator.trans(he+"field.date-format-help",{a:m("a",{href:"https://day.js.org/docs/en/display/format",target:"_blank"})}))]),this.submitButton(),m(pe)])])},t}(f()),ve={PolicyEdit:ue,PolicyList:pe,TermsSettingsPage:ge},ye={Policy:d},be={sortByAttribute:fe};n().initializers.add("fof-terms",(function(){n().store.models["fof-terms-policies"]=d,n().extensionData.for("fof-terms").registerPermission({icon:"fas fa-paperclip",label:n().translator.trans("fof-terms.admin.permissions.see-user-policies-state"),permission:"fof-terms.see-user-policies-state"},"moderate").registerPermission({icon:"fas fa-paperclip",label:n().translator.trans("fof-terms.admin.permissions.postpone-policies-accept"),permission:"fof-terms.postpone-policies-accept"},"moderate").registerPermission({icon:"fas fa-paperclip",label:n().translator.trans("fof-terms.admin.permissions.export-policies"),permission:"fof-terms.export-policies"},"moderate").registerPage(ge)}))})(),module.exports=t})(); +(()=>{var t={n:e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};(()=>{"use strict";t.r(e),t.d(e,{components:()=>bt,helpers:()=>Et,models:()=>wt});const r=flarum.core.compat["admin/app"];var n=t.n(r);function o(t,e){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},o(t,e)}function i(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,o(t,e)}const a=flarum.core.compat["common/Model"];var s=t.n(a);const l=flarum.core.compat["common/utils/computed"];var c=t.n(l),d=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),o=0;o0&&e.matches(t)})).length>0;if(t===e)return!0;if(void 0!==w(t).getConfig("connectWith")&&null!==w(t).getConfig("connectWith"))return w(t).getConfig("connectWith")===w(e).getConfig("connectWith")}return!1},U={items:null,connectWith:null,disableIEFix:null,acceptFrom:null,copy:!1,placeholder:null,placeholderClass:"sortable-placeholder",draggingClass:"sortable-dragging",hoverClass:!1,dropTargetContainerClass:!1,debounce:0,throttleTime:100,maxItems:0,itemSerializer:void 0,containerSerializer:void 0,customDragImage:null,orientation:"vertical"},X=function(t){T(t,"dragstart"),T(t,"dragend"),T(t,"dragover"),T(t,"dragenter"),T(t,"drop"),T(t,"mouseenter"),T(t,"mouseleave")},G=function(t,e){t&&T(t,"dragleave"),e&&e!==t&&T(e,"dragleave")},V=function(t){var e;(e=t).h5s&&delete e.h5s.data,C(t,"aria-dropeffect")},J=function(t){C(t,"aria-grabbed"),C(t,"aria-copied"),C(t,"draggable"),C(t,"role")};function K(t,e){if(e.composedPath)return e.composedPath().find((function(t){return t.isSortable}));for(;!0!==t.isSortable;)t=t.parentElement;return t}function Q(t,e){var r=g(t,"opts"),n=v(t.children,r.items).filter((function(t){return t.contains(e)||t.shadowRoot&&t.shadowRoot.contains(e)}));return n.length>0?n[0]:e}var Z=function(t){var e=g(t,"opts"),r=v(t.children,e.items),n=z(r,e.handle);x(t,"aria-dropeffect","move"),g(t,"_disabled","false"),x(n,"draggable","true"),!1===e.disableIEFix&&"function"==typeof(document||window.document).createElement("span").dragDrop&&E(n,"mousedown",(function(){if(-1!==r.indexOf(this))this.dragDrop();else{for(var t=this.parentElement;-1===r.indexOf(t);)t=t.parentElement;t.dragDrop()}}))};function $(t,e){var r=String(e);return e=e||{},"string"==typeof t&&(t=document.querySelectorAll(t)),t instanceof HTMLElement&&(t=[t]),t=Array.prototype.slice.call(t),/serialize/.test(r)?t.map((function(t){var e=g(t,"opts");return function(t,e,r){if(void 0===e&&(e=function(t,e){return t}),void 0===r&&(r=function(t){return t}),!(t instanceof HTMLElement)||1==!t.isSortable)throw new Error("You need to provide a sortableContainer to be serialized.");if("function"!=typeof e||"function"!=typeof r)throw new Error("You need to provide a valid serializer for items and the container.");var n=g(t,"opts").items,o=v(t.children,n),i=o.map((function(e){return{parent:t,node:e,html:e.outerHTML,index:H(e,o)}}));return{container:r({node:t,itemCount:i.length}),items:i.map((function(r){return e(r,t)}))}}(t,e.itemSerializer,e.containerSerializer)})):(t.forEach((function(t){if(/enable|disable|destroy/.test(r))return $[r](t);["connectWith","disableIEFix"].forEach((function(t){Object.prototype.hasOwnProperty.call(e,t)&&null!==e[t]&&console.warn('HTML5Sortable: You are using the deprecated configuration "'+t+'". This will be removed in an upcoming version, make sure to migrate to the new options when updating.')})),e=Object.assign({},U,w(t).config,e),w(t).config=e,g(t,"opts",e),t.isSortable=!0,function(t){var e=g(t,"opts"),r=v(t.children,e.items),n=z(r,e.handle);g(t,"_disabled","false"),X(r),G(A,D),T(n,"mousedown"),T(t,"dragover"),T(t,"dragenter"),T(t,"drop")}(t);var n,o=v(t.children,e.items);if(null!==e.placeholder&&void 0!==e.placeholder){var i=document.createElement(t.tagName);e.placeholder instanceof HTMLElement?i.appendChild(e.placeholder):i.innerHTML=e.placeholder,n=i.children[0]}w(t).placeholder=function(t,e,r){var n;if(void 0===r&&(r="sortable-placeholder"),!(t instanceof HTMLElement))throw new Error("You must provide a valid element as a sortable.");if(!(e instanceof HTMLElement)&&void 0!==e)throw new Error("You must provide a valid element as a placeholder or set ot to undefined.");return void 0===e&&(["UL","OL"].includes(t.tagName)?e=document.createElement("li"):["TABLE","TBODY"].includes(t.tagName)?(e=document.createElement("tr")).innerHTML='':e=document.createElement("div")),"string"==typeof r&&(n=e.classList).add.apply(n,r.split(" ")),e}(t,n,e.placeholderClass),g(t,"items",e.items),e.acceptFrom?g(t,"acceptFrom",e.acceptFrom):e.connectWith&&g(t,"connectWith",e.connectWith),Z(t),x(o,"role","option"),x(o,"aria-grabbed","false"),function(t,e){if("string"==typeof w(t).getConfig("hoverClass")){var r=w(t).getConfig("hoverClass").split(" ");!0===e?(E(t,"mousemove",function(t,e){var r=this;if(void 0===e&&(e=250),"number"!=typeof e)throw new Error("You must provide a number as the second argument for throttle.");var n=null;return function(){for(var o=[],i=0;i=e)&&(n=a,t.apply(r,o))}}((function(e){0===e.buttons&&v(t.children,w(t).getConfig("items")).forEach((function(t){var n,o;t!==e.target?(n=t.classList).remove.apply(n,r):(o=t.classList).add.apply(o,r)}))}),w(t).getConfig("throttleTime"))),E(t,"mouseleave",(function(){v(t.children,w(t).getConfig("items")).forEach((function(t){var e;(e=t.classList).remove.apply(e,r)}))}))):(T(t,"mousemove"),T(t,"mouseleave"))}}(t,!0),E(t,"dragstart",(function(t){var r=q(t);if(!0!==r.isSortable&&(t.stopImmediatePropagation(),(!e.handle||r.matches(e.handle))&&"false"!==r.getAttribute("draggable"))){var n=K(r,t),o=Q(n,r);M=v(n.children,e.items),P=M.indexOf(o),S=H(o,n.children),A=n,function(t,e,r){if(!(t instanceof Event))throw new Error("setDragImage requires a DragEvent as the first argument.");if(!(e instanceof HTMLElement))throw new Error("setDragImage requires the dragged element as the second argument.");if(r||(r=W),t.dataTransfer&&t.dataTransfer.setDragImage){var n=r(e,O(e),t);if(!(n.element instanceof HTMLElement)||"number"!=typeof n.posX||"number"!=typeof n.posY)throw new Error("The customDragImage function you provided must return and object with the properties element[string], posX[integer], posY[integer].");t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setData("text/plain",q(t).id),t.dataTransfer.setDragImage(n.element,n.posX,n.posY)}}(t,o,e.customDragImage),F=k(o),L=N(o),o.classList.add(e.draggingClass),_=function(t,e){var r=t;return!0===w(e).getConfig("copy")&&(x(r=t.cloneNode(!0),"aria-copied","true"),t.parentElement.appendChild(r),r.style.display="none",r.oldDisplay=t.style.display),r}(o,n),x(_,"aria-grabbed","true"),n.dispatchEvent(new CustomEvent("sortstart",{detail:{origin:{elementIndex:S,index:P,container:A},item:_,originalTarget:r}}))}})),E(t,"dragenter",(function(r){var n=q(r),o=K(n,r);o&&o!==D&&(I=v(o.children,g(o,"items")).filter((function(e){return e!==w(t).placeholder})),e.dropTargetContainerClass&&o.classList.add(e.dropTargetContainerClass),o.dispatchEvent(new CustomEvent("sortenter",{detail:{origin:{elementIndex:S,index:P,container:A},destination:{container:o,itemsBeforeUpdate:I},item:_,originalTarget:n}})),E(o,"dragleave",(function(t){var r=t.relatedTarget||t.fromElement;t.currentTarget.contains(r)||(e.dropTargetContainerClass&&o.classList.remove(e.dropTargetContainerClass),o.dispatchEvent(new CustomEvent("sortleave",{detail:{origin:{elementIndex:S,index:P,container:o},item:_,originalTarget:n}})))}))),D=o})),E(t,"dragend",(function(r){if(_){_.classList.remove(e.draggingClass),x(_,"aria-grabbed","false"),"true"===_.getAttribute("aria-copied")&&"true"!==g(_,"dropped")&&_.remove(),_.style.display=_.oldDisplay,delete _.oldDisplay;var n=Array.from(y.values()).map((function(t){return t.placeholder})).filter((function(t){return t instanceof HTMLElement})).filter(j)[0];n&&n.remove(),t.dispatchEvent(new CustomEvent("sortstop",{detail:{origin:{elementIndex:S,index:P,container:A},item:_}})),D=null,_=null,F=null,L=null}})),E(t,"drop",(function(r){if(R(t,_.parentElement)){r.preventDefault(),r.stopPropagation(),g(_,"dropped","true");var n=Array.from(y.values()).map((function(t){return t.placeholder})).filter((function(t){return t instanceof HTMLElement})).filter(j)[0];B(n,_),n.remove(),t.dispatchEvent(new CustomEvent("sortstop",{detail:{origin:{elementIndex:S,index:P,container:A},item:_}}));var o=w(t).placeholder,i=v(A.children,e.items).filter((function(t){return t!==o})),a=!0===this.isSortable?this:this.parentElement,s=v(a.children,g(a,"items")).filter((function(t){return t!==o})),l=H(_,Array.from(_.parentElement.children).filter((function(t){return t!==o}))),c=H(_,s);e.dropTargetContainerClass&&a.classList.remove(e.dropTargetContainerClass),S===l&&A===a||t.dispatchEvent(new CustomEvent("sortupdate",{detail:{origin:{elementIndex:S,index:P,container:A,itemsBeforeUpdate:M,items:i},destination:{index:c,elementIndex:l,container:a,itemsBeforeUpdate:I,items:s},item:_}}))}}));var a,s,l,c=(a=function(t,r,n,o){if(_)if(e.forcePlaceholderSize&&(w(t).placeholder.style.height=F+"px",w(t).placeholder.style.width=L+"px"),Array.from(t.children).indexOf(r)>-1){var i=k(r),a=N(r),s=H(w(t).placeholder,r.parentElement.children),l=H(r,r.parentElement.children);if(i>F||a>L){var c=i-F,d=a-L,u=O(r).top,p=O(r).left;if(sl&&("vertical"===e.orientation&&o>u+i-c||"horizontal"===e.orientation&&n>p+a-d))return}void 0===_.oldDisplay&&(_.oldDisplay=_.style.display),"none"!==_.style.display&&(_.style.display="none");var f=!1;try{var m=O(r).top+r.offsetHeight/2,h=O(r).left+r.offsetWidth/2;f="vertical"===e.orientation&&o>=m||"horizontal"===e.orientation&&n>=h}catch(t){f=s=parseInt(n.maxItems)&&_.parentElement!==r||(t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect=!0===w(r).getConfig("copy")?"copy":"move",c(r,e,t.pageX,t.pageY))}};E(o.concat(t),"dragover",d),E(o.concat(t),"dragenter",d)})),t)}$.destroy=function(t){!function(t){var e=g(t,"opts")||{},r=v(t.children,e.items),n=z(r,e.handle);T(t,"dragover"),T(t,"dragenter"),T(t,"dragstart"),T(t,"dragend"),T(t,"drop"),V(t),T(n,"mousedown"),X(r),J(r),G(A,D),t.isSortable=!1}(t)},$.enable=function(t){Z(t)},$.disable=function(t){!function(t){var e=g(t,"opts"),r=v(t.children,e.items),n=z(r,e.handle);x(t,"aria-dropeffect","none"),g(t,"_disabled","true"),x(n,"draggable","false"),T(n,"mousedown")}(t)},$.__testing={_data:g,_removeItemEvents:X,_removeItemData:J,_removeSortableData:V,_removeContainerEvents:G};const tt=$,et=flarum.core.compat["common/helpers/icon"];var rt=t.n(et);const nt=flarum.core.compat["common/utils/extractText"];var ot=t.n(nt);const it=flarum.core.compat["common/utils/ItemList"];var at=t.n(it);const st=flarum.core.compat["common/utils/withAttr"];var lt=t.n(st);const ct=flarum.core.compat["common/components/Button"];var dt=t.n(ct),ut=function(){function t(){}var e=t.prototype;return e.oninit=function(t){this.policy=t.attrs.policy,this.dirty=!1,this.processing=!1,this.toggleFields=!1,null===this.policy&&this.initNewField()},e.initNewField=function(){this.policy=n().store.createRecord("fof-terms-policies",{attributes:{name:"",url:"",update_message:"",terms_updated_at:"",optional:!1,additional_info:{}}})},e.boxTitle=function(){return this.policy.exists?this.policy.name():n().translator.trans("fof-terms.admin.buttons.new-policy")},e.view=function(){var t=this;return m(".FoF-Terms-Policiy-Box",[this.policy.exists?m("span.fas.fa-arrows-alt.FoF-Terms-Policiy-Box--handle.js-policy-handle"):null,m(".Button.Button--block.FoF-Terms-Policiy-Header",{onclick:function(){t.toggleFields=!t.toggleFields}},[m(".FoF-Terms-Policiy-Header-Title",this.boxTitle()),m("div",[this.policy.exists?[n().translator.trans("fof-terms.admin.buttons.edit-policy")," "]:null,rt()(this.toggleFields?"fas fa-chevron-up":"fas fa-chevron-down")])]),this.toggleFields?this.viewFields():null])},e.viewFields=function(){var t=this;return m("form.FoF-Terms-Policiy-Body",{onsubmit:this.savePolicy.bind(this)},[this.fields().toArray(),m(".ButtonGroup",[dt().component({type:"submit",className:"Button Button--primary",loading:this.processing,disabled:!this.readyToSave()},n().translator.trans("fof-terms.admin.buttons."+(this.policy.exists?"save":"add")+"-policy")),this.policy.exists?dt().component({type:"submit",className:"Button Button--danger",loading:this.processing,onclick:function(e){return t.deletePolicy(e)}},n().translator.trans("fof-terms.admin.buttons.delete-policy")):""])])},e.fields=function(){var t=this,e=new(at());return e.add("name",m(".Form-group",[m("label",n().translator.trans("fof-terms.admin.policies.name")),m("input.FormControl",{type:"text",value:this.policy.name(),oninput:lt()("value",this.updateAttribute.bind(this,"name"))}),m(".helpText",n().translator.trans("fof-terms.admin.policies.name-help"))]),100),e.add("url",m(".Form-group",[m("label",n().translator.trans("fof-terms.admin.policies.url")),m("input.FormControl",{type:"url",value:this.policy.url(),oninput:lt()("value",this.updateAttribute.bind(this,"url"))}),m(".helpText",n().translator.trans("fof-terms.admin.policies.url-help"))]),95),e.add("update-message",m(".Form-group",[m("label",n().translator.trans("fof-terms.admin.policies.update-message")),m("textarea.FormControl",{value:this.policy.update_message(),oninput:lt()("value",this.updateAttribute.bind(this,"update_message"))}),m(".helpText",n().translator.trans("fof-terms.admin.policies.update-message-help"))]),90),e.add("terms-updated-at",m(".Form-group",[m("label",n().translator.trans("fof-terms.admin.policies.terms-updated-at")),m(".FoF-Terms-Input-Group",[m("input.FormControl",{type:"text",value:this.policy.terms_updated_at(),oninput:lt()("value",this.updateAttribute.bind(this,"terms_updated_at")),placeholder:n().translator.trans("fof-terms.admin.policies.terms-updated-at-placeholder")}),dt().component({className:"Button Button--primary",onclick:function(){t.updateAttribute("terms_updated_at",dayjs().millisecond(0).toISOString())}},n().translator.trans("fof-terms.admin.buttons.set-to-now"))]),m(".helpText",n().translator.trans("fof-terms.admin.policies.terms-updated-at-help"))]),85),e.add("optional",m("[",null,m("div",{class:"Form-group"},m("div",{class:" fof-terms-optional-checkbox"},m("label",{class:"Form-group>label"},n().translator.trans("fof-terms.admin.policies.optional")),m(h(),{className:"fof-terms-Switch-off",state:this.policy.optional(),onchange:function(){t.updateAttribute("optional",!t.policy.optional())}})),m("div",{class:"helpText"},n().translator.trans("fof-terms.admin.policies.optional-help")))),83),this.policy.exists&&e.add("export-url",m(".Form-group",[m("label",n().translator.trans("fof-terms.admin.policies.export-url")),m(".ButtonGroup",["json","csv"].map((function(e){return m("a.Button.FoF-Terms-Export-Button",{href:n().forum.attribute("apiUrl")+"/fof/terms/policies/"+t.policy.id()+"/export."+e,target:"_blank"},e.toUpperCase())}))),m(".helpText",n().translator.trans("fof-terms.admin.policies.export-url-help",{a:m("a",{href:"https://github.com/FriendsOfFlarum/terms/wiki/Export-url",target:"_blank"})}))]),80),e},e.updateAttribute=function(t,e){var r;this.policy.pushAttributes(((r={})[t]=e,r)),this.dirty=!0},e.readyToSave=function(){return this.dirty},e.savePolicy=function(t){var e=this;t.preventDefault(),this.processing=!0;var r=!this.policy.exists;this.policy.save(this.policy.data.attributes).then((function(){r&&(e.initNewField(),e.toggleFields=!1),e.processing=!1,e.dirty=!1,m.redraw()})).catch((function(t){throw e.processing=!1,t}))},e.deletePolicy=function(t){var e=this;t.preventDefault(),confirm(ot()(n().translator.trans("fof-terms.admin.messages.delete-policy-confirmation",{name:this.policy.name()})))&&(this.processing=!0,this.policy.delete().then((function(){e.processing=!1,m.redraw()})).catch((function(t){throw e.processing=!1,t})))},t}();function pt(t,e){return void 0===e&&(e="sort"),t.sort((function(t,r){return t[e]()-r[e]()}))}var ft=function(){function t(){}var e=t.prototype;return e.oninit=function(){n().request({method:"GET",url:n().forum.attribute("apiUrl")+"/fof/terms/policies"}).then((function(t){n().store.pushPayload(t),m.redraw()}))},e.oncreate=function(t){this.initsortable(t)},e.onupdate=function(t){this.initsortable(t)},e.initsortable=function(t){var e=this;tt(t.dom.querySelector(".js-policies-container"),{handle:".js-policy-handle"})[0].addEventListener("sortupdate",(function(){var r=[].map.call(t.dom.querySelectorAll(".js-policy-data"),(function(t){return t.dataset.id}));e.updateSort(r)}))},e.view=function(){var t=n().store.all("fof-terms-policies"),e=[];return pt(t).forEach((function(t){e.push(m(".js-policy-data",{key:t.id(),"data-id":t.id()},m(ut,{policy:t})))})),m("div",[m("h2",n().translator.trans("fof-terms.admin.titles.policies")),m(".FoF-Terms-Policies-Container",[m(".js-policies-container",e),m(ut,{policy:null})])])},e.updateSort=function(t){n().request({method:"POST",url:n().forum.attribute("apiUrl")+"/fof/terms/policies/order",body:{sort:t}}).then((function(t){n().store.pushPayload(t),m.redraw()}))},t}(),mt="fof-terms.",ht="fof-terms.admin.settings.",gt=function(t){function e(){return t.apply(this,arguments)||this}return i(e,t),e.prototype.content=function(){return m(".ExtensionPage-settings",[m(".container",[m(".Form-group",[m("label",n().translator.trans(ht+"field.signup-legal-text")),m("textarea.FormControl",{bidi:this.setting(mt+"signup-legal-text")})]),m(".Form-group",[m("label",h().component({state:this.setting(mt+"hide-updated-at")()>0,onchange:this.setting(mt+"hide-updated-at")},n().translator.trans(ht+"field.hide-updated-at")))]),m(".Form-group",[m("label",n().translator.trans(ht+"field.date-format")),m("input[type=text].FormControl",{bidi:this.setting(mt+"date-format"),placeholder:"YYYY-MM-DD"}),m(".helpText",n().translator.trans(ht+"field.date-format-help",{a:m("a",{href:"https://day.js.org/docs/en/display/format",target:"_blank"})}))]),this.submitButton(),m(ft)])])},e}(p());const vt=flarum.core.compat["common/Component"];var yt=function(t){function e(){return t.apply(this,arguments)||this}i(e,t);var r=e.prototype;return r.oninit=function(e){t.prototype.oninit.call(this,e),this.keyattr=e.attrs.keyattr,this.policy=e.attrs.policy,this.setDirty=e.attrs.setDirty,this.children=e.children,this.updateAttribute=this.updateAttribute.bind(this)},r.view=function(){var t="function"==typeof this.children[0]?this.children[0]({keyattr:this.keyattr,policy:this.policy,updateAttribute:this.updateAttribute}):this.children;return m("div",{class:"Form-group"},t)},r.updateAttribute=function(t){var e,r=this.policy.additional_info();r[this.keyattr]=t,this.policy.pushAttributes(((e={}).additional_info=r,e)),this.setDirty()},e}(t.n(vt)()),bt={PolicyEdit:ut,PolicyList:ft,TermsSettingsPage:gt,ExtensionData:yt},wt={Policy:d},Et={sortByAttribute:pt};n().initializers.add("fof-terms",(function(){n().store.models["fof-terms-policies"]=d,n().extensionData.for("fof-terms").registerPermission({icon:"fas fa-paperclip",label:n().translator.trans("fof-terms.admin.permissions.see-user-policies-state"),permission:"fof-terms.see-user-policies-state"},"moderate").registerPermission({icon:"fas fa-paperclip",label:n().translator.trans("fof-terms.admin.permissions.postpone-policies-accept"),permission:"fof-terms.postpone-policies-accept"},"moderate").registerPermission({icon:"fas fa-paperclip",label:n().translator.trans("fof-terms.admin.permissions.export-policies"),permission:"fof-terms.export-policies"},"moderate").registerPage(gt)}))})(),module.exports=e})(); //# sourceMappingURL=admin.js.map \ No newline at end of file diff --git a/js/dist/admin.js.map b/js/dist/admin.js.map index d9567a4..f7b41a8 100644 --- a/js/dist/admin.js.map +++ b/js/dist/admin.js.map @@ -1 +1 @@ -{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH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KAAKoV,QAAQN,GAAiB,oBAE1C7D,IAAAA,WAAeI,MAAM0D,GAAoB,6BAI/CxD,EAAE,cAAe,CACfA,EAAE,QAASN,IAAAA,WAAeI,MAAM0D,GAAoB,sBACpDxD,EAAE,+BAAgC,CAChC4D,KAAMnV,KAAKoV,QAAQN,GAAiB,eACpC5S,YAAa,eAEfqP,EACE,YACAN,IAAAA,WAAeI,MAAM0D,GAAoB,yBAA0B,CACjElY,EAAG0U,EAAE,IAAK,CACRwB,KAAM,4CACN7N,OAAQ,gBAKhBlF,KAAKwV,eACLjE,EAAEuC,OAGR,EAACkB,CAAA,CA1CmC,CAASS,KCNlCC,GAAa,CACxBnF,WAAAA,GACAuD,WAAAA,GACAkB,kBAAAA,ICLWW,GAAS,CACpBhX,OAAAA,GCDWiX,GAAU,CACrBjB,gBAAAA,ICKF1D,IAAAA,aAAiBzF,IAAI,aAAa,WAChCyF,IAAAA,MAAU0E,OAAO,sBAAwBhX,EAEzCsS,IAAAA,cAAiB,IACV,aACJ4E,mBACC,CACEpE,KAAM,mBACNqE,MAAO7E,IAAAA,WAAeI,MAAM,uDAC5B0E,WAAY,qCAEd,YAEDF,mBACC,CACEpE,KAAM,mBACNqE,MAAO7E,IAAAA,WAAeI,MAAM,wDAC5B0E,WAAY,sCAEd,YAEDF,mBACC,CACEpE,KAAM,mBACNqE,MAAO7E,IAAAA,WAAeI,MAAM,+CAC5B0E,WAAY,6BAEd,YAEDC,aAAahB,GAClB,G","sources":["webpack://@fof/terms/webpack/bootstrap","webpack://@fof/terms/webpack/runtime/compat get default export","webpack://@fof/terms/webpack/runtime/define property getters","webpack://@fof/terms/webpack/runtime/hasOwnProperty shorthand","webpack://@fof/terms/webpack/runtime/make namespace object","webpack://@fof/terms/external root \"flarum.core.compat['admin/app']\"","webpack://@fof/terms/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@fof/terms/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/terms/external root \"flarum.core.compat['common/Model']\"","webpack://@fof/terms/external root \"flarum.core.compat['common/utils/computed']\"","webpack://@fof/terms/./src/common/models/Policy.js","webpack://@fof/terms/external root \"flarum.core.compat['admin/components/ExtensionPage']\"","webpack://@fof/terms/external root \"flarum.core.compat['common/components/Switch']\"","webpack://@fof/terms/./node_modules/html5sortable/dist/html5sortable.es.js","webpack://@fof/terms/external root \"flarum.core.compat['common/helpers/icon']\"","webpack://@fof/terms/external root \"flarum.core.compat['common/utils/extractText']\"","webpack://@fof/terms/external root \"flarum.core.compat['common/utils/ItemList']\"","webpack://@fof/terms/external root \"flarum.core.compat['common/utils/withAttr']\"","webpack://@fof/terms/external root \"flarum.core.compat['common/components/Button']\"","webpack://@fof/terms/./src/admin/components/PolicyEdit.js","webpack://@fof/terms/./src/common/helpers/sortByAttribute.js","webpack://@fof/terms/./src/admin/components/PolicyList.js","webpack://@fof/terms/./src/admin/components/TermsSettingsPage.js","webpack://@fof/terms/./src/admin/components/index.js","webpack://@fof/terms/./src/common/models/index.js","webpack://@fof/terms/./src/common/helpers/index.js","webpack://@fof/terms/./src/admin/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Model'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/computed'];","import Model from 'flarum/common/Model';\nimport computed from 'flarum/common/utils/computed';\n\nexport default class Policy extends Model {\n sort = Model.attribute('sort');\n name = Model.attribute('name');\n url = Model.attribute('url');\n update_message = Model.attribute('update_message');\n terms_updated_at = Model.attribute('terms_updated_at');\n form_key = computed('id', (id) => 'fof_terms_policy_' + id);\n\n apiEndpoint() {\n return '/fof/terms/policies' + (this.exists ? '/' + this.data.id : '');\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/components/ExtensionPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Switch'];","/*\n * HTML5Sortable package\n * https://github.com/lukasoppermann/html5sortable\n *\n * Maintained by Lukas Oppermann \n *\n * Released under the MIT license.\n */\n/**\n * Get or set data on element\n * @param {HTMLElement} element\n * @param {string} key\n * @param {any} value\n * @return {*}\n */\nfunction addData(element, key, value) {\n if (value === undefined) {\n return element && element.h5s && element.h5s.data && element.h5s.data[key];\n }\n else {\n element.h5s = element.h5s || {};\n element.h5s.data = element.h5s.data || {};\n element.h5s.data[key] = value;\n }\n}\n/**\n * Remove data from element\n * @param {HTMLElement} element\n */\nfunction removeData(element) {\n if (element.h5s) {\n delete element.h5s.data;\n }\n}\n\n/* eslint-env browser */\n/**\n * Filter only wanted nodes\n * @param {NodeList|HTMLCollection|Array} nodes\n * @param {String} selector\n * @returns {Array}\n */\nvar _filter = (function (nodes, selector) {\n if (!(nodes instanceof NodeList || nodes instanceof HTMLCollection || nodes instanceof Array)) {\n throw new Error('You must provide a nodeList/HTMLCollection/Array of elements to be filtered.');\n }\n if (typeof selector !== 'string') {\n return Array.from(nodes);\n }\n return Array.from(nodes).filter(function (item) { return item.nodeType === 1 && item.matches(selector); });\n});\n\n/* eslint-env browser */\nvar stores = new Map();\n/**\n * Stores data & configurations per Sortable\n * @param {Object} config\n */\nvar Store = /** @class */ (function () {\n function Store() {\n this._config = new Map(); // eslint-disable-line no-undef\n this._placeholder = undefined; // eslint-disable-line no-undef\n this._data = new Map(); // eslint-disable-line no-undef\n }\n Object.defineProperty(Store.prototype, \"config\", {\n /**\n * get the configuration map of a class instance\n * @method config\n * @return {object}\n */\n get: function () {\n // transform Map to object\n var config = {};\n this._config.forEach(function (value, key) {\n config[key] = value;\n });\n // return object\n return config;\n },\n /**\n * set the configuration of a class instance\n * @method config\n * @param {object} config object of configurations\n */\n set: function (config) {\n if (typeof config !== 'object') {\n throw new Error('You must provide a valid configuration object to the config setter.');\n }\n // combine config with default\n var mergedConfig = Object.assign({}, config);\n // add config to map\n this._config = new Map(Object.entries(mergedConfig));\n },\n enumerable: false,\n configurable: true\n });\n /**\n * set individual configuration of a class instance\n * @method setConfig\n * @param key valid configuration key\n * @param value any value\n * @return void\n */\n Store.prototype.setConfig = function (key, value) {\n if (!this._config.has(key)) {\n throw new Error(\"Trying to set invalid configuration item: \" + key);\n }\n // set config\n this._config.set(key, value);\n };\n /**\n * get an individual configuration of a class instance\n * @method getConfig\n * @param key valid configuration key\n * @return any configuration value\n */\n Store.prototype.getConfig = function (key) {\n if (!this._config.has(key)) {\n throw new Error(\"Invalid configuration item requested: \" + key);\n }\n return this._config.get(key);\n };\n Object.defineProperty(Store.prototype, \"placeholder\", {\n /**\n * get the placeholder for a class instance\n * @method placeholder\n * @return {HTMLElement|null}\n */\n get: function () {\n return this._placeholder;\n },\n /**\n * set the placeholder for a class instance\n * @method placeholder\n * @param {HTMLElement} placeholder\n * @return {void}\n */\n set: function (placeholder) {\n if (!(placeholder instanceof HTMLElement) && placeholder !== null) {\n throw new Error('A placeholder must be an html element or null.');\n }\n this._placeholder = placeholder;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * set an data entry\n * @method setData\n * @param {string} key\n * @param {any} value\n * @return {void}\n */\n Store.prototype.setData = function (key, value) {\n if (typeof key !== 'string') {\n throw new Error('The key must be a string.');\n }\n this._data.set(key, value);\n };\n /**\n * get an data entry\n * @method getData\n * @param {string} key an existing key\n * @return {any}\n */\n Store.prototype.getData = function (key) {\n if (typeof key !== 'string') {\n throw new Error('The key must be a string.');\n }\n return this._data.get(key);\n };\n /**\n * delete an data entry\n * @method deleteData\n * @param {string} key an existing key\n * @return {boolean}\n */\n Store.prototype.deleteData = function (key) {\n if (typeof key !== 'string') {\n throw new Error('The key must be a string.');\n }\n return this._data.delete(key);\n };\n return Store;\n}());\n/**\n * @param {HTMLElement} sortableElement\n * @returns {Class: Store}\n */\nvar store = (function (sortableElement) {\n // if sortableElement is wrong type\n if (!(sortableElement instanceof HTMLElement)) {\n throw new Error('Please provide a sortable to the store function.');\n }\n // create new instance if not avilable\n if (!stores.has(sortableElement)) {\n stores.set(sortableElement, new Store());\n }\n // return instance\n return stores.get(sortableElement);\n});\n\n/**\n * @param {Array|HTMLElement} element\n * @param {Function} callback\n * @param {string} event\n */\nfunction addEventListener(element, eventName, callback) {\n if (element instanceof Array) {\n for (var i = 0; i < element.length; ++i) {\n addEventListener(element[i], eventName, callback);\n }\n return;\n }\n element.addEventListener(eventName, callback);\n store(element).setData(\"event\" + eventName, callback);\n}\n/**\n * @param {Array|HTMLElement} element\n * @param {string} eventName\n */\nfunction removeEventListener(element, eventName) {\n if (element instanceof Array) {\n for (var i = 0; i < element.length; ++i) {\n removeEventListener(element[i], eventName);\n }\n return;\n }\n element.removeEventListener(eventName, store(element).getData(\"event\" + eventName));\n store(element).deleteData(\"event\" + eventName);\n}\n\n/**\n * @param {Array|HTMLElement} element\n * @param {string} attribute\n * @param {string} value\n */\nfunction addAttribute(element, attribute, value) {\n if (element instanceof Array) {\n for (var i = 0; i < element.length; ++i) {\n addAttribute(element[i], attribute, value);\n }\n return;\n }\n element.setAttribute(attribute, value);\n}\n/**\n * @param {Array|HTMLElement} element\n * @param {string} attribute\n */\nfunction removeAttribute(element, attribute) {\n if (element instanceof Array) {\n for (var i = 0; i < element.length; ++i) {\n removeAttribute(element[i], attribute);\n }\n return;\n }\n element.removeAttribute(attribute);\n}\n\n/**\n * @param {HTMLElement} element\n * @returns {Object}\n */\nvar _offset = (function (element) {\n if (!element.parentElement || element.getClientRects().length === 0) {\n throw new Error('target element must be part of the dom');\n }\n var rect = element.getClientRects()[0];\n return {\n left: rect.left + window.pageXOffset,\n right: rect.right + window.pageXOffset,\n top: rect.top + window.pageYOffset,\n bottom: rect.bottom + window.pageYOffset\n };\n});\n\n/**\n * Creates and returns a new debounced version of the passed function which will postpone its execution until after wait milliseconds have elapsed\n * @param {Function} func to debounce\n * @param {number} time to wait before calling function with latest arguments, 0 - no debounce\n * @returns {function} - debounced function\n */\nvar _debounce = (function (func, wait) {\n if (wait === void 0) { wait = 0; }\n var timeout;\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n clearTimeout(timeout);\n timeout = setTimeout(function () {\n func.apply(void 0, args);\n }, wait);\n };\n});\n\n/* eslint-env browser */\n/**\n * Get position of the element relatively to its sibling elements\n * @param {HTMLElement} element\n * @returns {number}\n */\nvar _index = (function (element, elementList) {\n if (!(element instanceof HTMLElement) || !(elementList instanceof NodeList || elementList instanceof HTMLCollection || elementList instanceof Array)) {\n throw new Error('You must provide an element and a list of elements.');\n }\n return Array.from(elementList).indexOf(element);\n});\n\n/* eslint-env browser */\n/**\n * Test whether element is in DOM\n * @param {HTMLElement} element\n * @returns {boolean}\n */\nvar isInDom = (function (element) {\n if (!(element instanceof HTMLElement)) {\n throw new Error('Element is not a node element.');\n }\n return element.parentNode !== null;\n});\n\n/* eslint-env browser */\n/**\n * Insert node before or after target\n * @param {HTMLElement} referenceNode - reference element\n * @param {HTMLElement} newElement - element to be inserted\n * @param {String} position - insert before or after reference element\n */\nvar insertNode = function (referenceNode, newElement, position) {\n if (!(referenceNode instanceof HTMLElement) || !(referenceNode.parentElement instanceof HTMLElement)) {\n throw new Error('target and element must be a node');\n }\n referenceNode.parentElement.insertBefore(newElement, (position === 'before' ? referenceNode : referenceNode.nextElementSibling));\n};\n/**\n * Insert before target\n * @param {HTMLElement} target\n * @param {HTMLElement} element\n */\nvar insertBefore = function (target, element) { return insertNode(target, element, 'before'); };\n/**\n * Insert after target\n * @param {HTMLElement} target\n * @param {HTMLElement} element\n */\nvar insertAfter = function (target, element) { return insertNode(target, element, 'after'); };\n\n/* eslint-env browser */\n/**\n * Filter only wanted nodes\n * @param {HTMLElement} sortableContainer\n * @param {Function} customSerializer\n * @returns {Array}\n */\nvar _serialize = (function (sortableContainer, customItemSerializer, customContainerSerializer) {\n if (customItemSerializer === void 0) { customItemSerializer = function (serializedItem, sortableContainer) { return serializedItem; }; }\n if (customContainerSerializer === void 0) { customContainerSerializer = function (serializedContainer) { return serializedContainer; }; }\n // check for valid sortableContainer\n if (!(sortableContainer instanceof HTMLElement) || !sortableContainer.isSortable === true) {\n throw new Error('You need to provide a sortableContainer to be serialized.');\n }\n // check for valid serializers\n if (typeof customItemSerializer !== 'function' || typeof customContainerSerializer !== 'function') {\n throw new Error('You need to provide a valid serializer for items and the container.');\n }\n // get options\n var options = addData(sortableContainer, 'opts');\n var item = options.items;\n // serialize container\n var items = _filter(sortableContainer.children, item);\n var serializedItems = items.map(function (item) {\n return {\n parent: sortableContainer,\n node: item,\n html: item.outerHTML,\n index: _index(item, items)\n };\n });\n // serialize container\n var container = {\n node: sortableContainer,\n itemCount: serializedItems.length\n };\n return {\n container: customContainerSerializer(container),\n items: serializedItems.map(function (item) { return customItemSerializer(item, sortableContainer); })\n };\n});\n\n/* eslint-env browser */\n/**\n * create a placeholder element\n * @param {HTMLElement} sortableElement a single sortable\n * @param {string|undefined} placeholder a string representing an html element\n * @param {string} placeholderClasses a string representing the classes that should be added to the placeholder\n */\nvar _makePlaceholder = (function (sortableElement, placeholder, placeholderClass) {\n var _a;\n if (placeholderClass === void 0) { placeholderClass = 'sortable-placeholder'; }\n if (!(sortableElement instanceof HTMLElement)) {\n throw new Error('You must provide a valid element as a sortable.');\n }\n // if placeholder is not an element\n if (!(placeholder instanceof HTMLElement) && placeholder !== undefined) {\n throw new Error('You must provide a valid element as a placeholder or set ot to undefined.');\n }\n // if no placeholder element is given\n if (placeholder === undefined) {\n if (['UL', 'OL'].includes(sortableElement.tagName)) {\n placeholder = document.createElement('li');\n }\n else if (['TABLE', 'TBODY'].includes(sortableElement.tagName)) {\n placeholder = document.createElement('tr');\n // set colspan to always all rows, otherwise the item can only be dropped in first column\n placeholder.innerHTML = '';\n }\n else {\n placeholder = document.createElement('div');\n }\n }\n // add classes to placeholder\n if (typeof placeholderClass === 'string') {\n (_a = placeholder.classList).add.apply(_a, placeholderClass.split(' '));\n }\n return placeholder;\n});\n\n/* eslint-env browser */\n/**\n * Get height of an element including padding\n * @param {HTMLElement} element an dom element\n */\nvar _getElementHeight = (function (element) {\n if (!(element instanceof HTMLElement)) {\n throw new Error('You must provide a valid dom element');\n }\n // get calculated style of element\n var style = window.getComputedStyle(element);\n // get only height if element has box-sizing: border-box specified\n if (style.getPropertyValue('box-sizing') === 'border-box') {\n return parseInt(style.getPropertyValue('height'), 10);\n }\n // pick applicable properties, convert to int and reduce by adding\n return ['height', 'padding-top', 'padding-bottom']\n .map(function (key) {\n var int = parseInt(style.getPropertyValue(key), 10);\n return isNaN(int) ? 0 : int;\n })\n .reduce(function (sum, value) { return sum + value; });\n});\n\n/* eslint-env browser */\n/**\n * Get width of an element including padding\n * @param {HTMLElement} element an dom element\n */\nvar _getElementWidth = (function (element) {\n if (!(element instanceof HTMLElement)) {\n throw new Error('You must provide a valid dom element');\n }\n // get calculated style of element\n var style = window.getComputedStyle(element);\n // pick applicable properties, convert to int and reduce by adding\n return ['width', 'padding-left', 'padding-right']\n .map(function (key) {\n var int = parseInt(style.getPropertyValue(key), 10);\n return isNaN(int) ? 0 : int;\n })\n .reduce(function (sum, value) { return sum + value; });\n});\n\n/* eslint-env browser */\n/**\n * get handle or return item\n * @param {Array} items\n * @param {string} selector\n */\nvar _getHandles = (function (items, selector) {\n if (!(items instanceof Array)) {\n throw new Error('You must provide a Array of HTMLElements to be filtered.');\n }\n if (typeof selector !== 'string') {\n return items;\n }\n return items\n // remove items without handle from array\n .filter(function (item) {\n return item.querySelector(selector) instanceof HTMLElement ||\n (item.shadowRoot && item.shadowRoot.querySelector(selector) instanceof HTMLElement);\n })\n // replace item with handle in array\n .map(function (item) {\n return item.querySelector(selector) || (item.shadowRoot && item.shadowRoot.querySelector(selector));\n });\n});\n\n/**\n * @param {Event} event\n * @returns {HTMLElement}\n */\nvar getEventTarget = (function (event) {\n return (event.composedPath && event.composedPath()[0]) || event.target;\n});\n\n/* eslint-env browser */\n/**\n * defaultDragImage returns the current item as dragged image\n * @param {HTMLElement} draggedElement - the item that the user drags\n * @param {object} elementOffset - an object with the offsets top, left, right & bottom\n * @param {Event} event - the original drag event object\n * @return {object} with element, posX and posY properties\n */\nvar defaultDragImage = function (draggedElement, elementOffset, event) {\n return {\n element: draggedElement,\n posX: event.pageX - elementOffset.left,\n posY: event.pageY - elementOffset.top\n };\n};\n/**\n * attaches an element as the drag image to an event\n * @param {Event} event - the original drag event object\n * @param {HTMLElement} draggedElement - the item that the user drags\n * @param {Function} customDragImage - function to create a custom dragImage\n * @return void\n */\nvar setDragImage = (function (event, draggedElement, customDragImage) {\n // check if event is provided\n if (!(event instanceof Event)) {\n throw new Error('setDragImage requires a DragEvent as the first argument.');\n }\n // check if draggedElement is provided\n if (!(draggedElement instanceof HTMLElement)) {\n throw new Error('setDragImage requires the dragged element as the second argument.');\n }\n // set default function of none provided\n if (!customDragImage) {\n customDragImage = defaultDragImage;\n }\n // check if setDragImage method is available\n if (event.dataTransfer && event.dataTransfer.setDragImage) {\n // get the elements offset\n var elementOffset = _offset(draggedElement);\n // get the dragImage\n var dragImage = customDragImage(draggedElement, elementOffset, event);\n // check if custom function returns correct values\n if (!(dragImage.element instanceof HTMLElement) || typeof dragImage.posX !== 'number' || typeof dragImage.posY !== 'number') {\n throw new Error('The customDragImage function you provided must return and object with the properties element[string], posX[integer], posY[integer].');\n }\n // needs to be set for HTML5 drag & drop to work\n event.dataTransfer.effectAllowed = 'copyMove';\n // Firefox requires it to use the event target's id for the data\n event.dataTransfer.setData('text/plain', getEventTarget(event).id);\n // set the drag image on the event\n event.dataTransfer.setDragImage(dragImage.element, dragImage.posX, dragImage.posY);\n }\n});\n\n/**\n * Check if curList accepts items from destList\n * @param {sortable} destination the container an item is move to\n * @param {sortable} origin the container an item comes from\n */\nvar _listsConnected = (function (destination, origin) {\n // check if valid sortable\n if (destination.isSortable === true) {\n var acceptFrom = store(destination).getConfig('acceptFrom');\n // check if acceptFrom is valid\n if (acceptFrom !== null && acceptFrom !== false && typeof acceptFrom !== 'string') {\n throw new Error('HTML5Sortable: Wrong argument, \"acceptFrom\" must be \"null\", \"false\", or a valid selector string.');\n }\n if (acceptFrom !== null) {\n return acceptFrom !== false && acceptFrom.split(',').filter(function (sel) {\n return sel.length > 0 && origin.matches(sel);\n }).length > 0;\n }\n // drop in same list\n if (destination === origin) {\n return true;\n }\n // check if lists are connected with connectWith\n if (store(destination).getConfig('connectWith') !== undefined && store(destination).getConfig('connectWith') !== null) {\n return store(destination).getConfig('connectWith') === store(origin).getConfig('connectWith');\n }\n }\n return false;\n});\n\n/**\n * default configurations\n */\nvar defaultConfiguration = {\n items: null,\n // deprecated\n connectWith: null,\n // deprecated\n disableIEFix: null,\n acceptFrom: null,\n copy: false,\n placeholder: null,\n placeholderClass: 'sortable-placeholder',\n draggingClass: 'sortable-dragging',\n hoverClass: false,\n dropTargetContainerClass: false,\n debounce: 0,\n throttleTime: 100,\n maxItems: 0,\n itemSerializer: undefined,\n containerSerializer: undefined,\n customDragImage: null,\n orientation: 'vertical'\n};\n\n/**\n * make sure a function is only called once within the given amount of time\n * @param {Function} fn the function to throttle\n * @param {number} threshold time limit for throttling\n */\n// must use function to keep this context\nfunction _throttle (fn, threshold) {\n var _this = this;\n if (threshold === void 0) { threshold = 250; }\n // check function\n if (typeof fn !== 'function') {\n throw new Error('You must provide a function as the first argument for throttle.');\n }\n // check threshold\n if (typeof threshold !== 'number') {\n throw new Error('You must provide a number as the second argument for throttle.');\n }\n var lastEventTimestamp = null;\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var now = Date.now();\n if (lastEventTimestamp === null || now - lastEventTimestamp >= threshold) {\n lastEventTimestamp = now;\n fn.apply(_this, args);\n }\n };\n}\n\n/* eslint-env browser */\n/**\n * enable or disable hoverClass on mouseenter/leave if container Items\n * @param {sortable} sortableContainer a valid sortableContainer\n * @param {boolean} enable enable or disable event\n */\n// export default (sortableContainer: sortable, enable: boolean) => {\nvar enableHoverClass = (function (sortableContainer, enable) {\n if (typeof store(sortableContainer).getConfig('hoverClass') === 'string') {\n var hoverClasses_1 = store(sortableContainer).getConfig('hoverClass').split(' ');\n // add class on hover\n if (enable === true) {\n addEventListener(sortableContainer, 'mousemove', _throttle(function (event) {\n // check of no mouse button was pressed when mousemove started == no drag\n if (event.buttons === 0) {\n _filter(sortableContainer.children, store(sortableContainer).getConfig('items')).forEach(function (item) {\n var _a, _b;\n if (item !== event.target) {\n (_a = item.classList).remove.apply(_a, hoverClasses_1);\n }\n else {\n (_b = item.classList).add.apply(_b, hoverClasses_1);\n }\n });\n }\n }, store(sortableContainer).getConfig('throttleTime')));\n // remove class on leave\n addEventListener(sortableContainer, 'mouseleave', function () {\n _filter(sortableContainer.children, store(sortableContainer).getConfig('items')).forEach(function (item) {\n var _a;\n (_a = item.classList).remove.apply(_a, hoverClasses_1);\n });\n });\n // remove events\n }\n else {\n removeEventListener(sortableContainer, 'mousemove');\n removeEventListener(sortableContainer, 'mouseleave');\n }\n }\n});\n\n/* eslint-env browser */\n/*\n * variables global to the plugin\n */\nvar dragging;\nvar draggingHeight;\nvar draggingWidth;\n/*\n * Keeps track of the initialy selected list, where 'dragstart' event was triggered\n * It allows us to move the data in between individual Sortable List instances\n */\n// Origin List - data from before any item was changed\nvar originContainer;\nvar originIndex;\nvar originElementIndex;\nvar originItemsBeforeUpdate;\n// Previous Sortable Container - we dispatch as sortenter event when a\n// dragged item enters a sortableContainer for the first time\nvar previousContainer;\n// Destination List - data from before any item was changed\nvar destinationItemsBeforeUpdate;\n/**\n * remove event handlers from items\n * @param {Array|NodeList} items\n */\nvar _removeItemEvents = function (items) {\n removeEventListener(items, 'dragstart');\n removeEventListener(items, 'dragend');\n removeEventListener(items, 'dragover');\n removeEventListener(items, 'dragenter');\n removeEventListener(items, 'drop');\n removeEventListener(items, 'mouseenter');\n removeEventListener(items, 'mouseleave');\n};\n// Remove container events\nvar _removeContainerEvents = function (originContainer, previousContainer) {\n if (originContainer) {\n removeEventListener(originContainer, 'dragleave');\n }\n if (previousContainer && (previousContainer !== originContainer)) {\n removeEventListener(previousContainer, 'dragleave');\n }\n};\n/**\n * _getDragging returns the current element to drag or\n * a copy of the element.\n * Is Copy Active for sortable\n * @param {HTMLElement} draggedItem - the item that the user drags\n * @param {HTMLElement} sortable a single sortable\n */\nvar _getDragging = function (draggedItem, sortable) {\n var ditem = draggedItem;\n if (store(sortable).getConfig('copy') === true) {\n ditem = draggedItem.cloneNode(true);\n addAttribute(ditem, 'aria-copied', 'true');\n draggedItem.parentElement.appendChild(ditem);\n ditem.style.display = 'none';\n ditem.oldDisplay = draggedItem.style.display;\n }\n return ditem;\n};\n/**\n * Remove data from sortable\n * @param {HTMLElement} sortable a single sortable\n */\nvar _removeSortableData = function (sortable) {\n removeData(sortable);\n removeAttribute(sortable, 'aria-dropeffect');\n};\n/**\n * Remove data from items\n * @param {Array|HTMLElement} items\n */\nvar _removeItemData = function (items) {\n removeAttribute(items, 'aria-grabbed');\n removeAttribute(items, 'aria-copied');\n removeAttribute(items, 'draggable');\n removeAttribute(items, 'role');\n};\n/**\n * find sortable from element. travels up parent element until found or null.\n * @param {HTMLElement} element a single sortable\n * @param {Event} event - the current event. We need to pass it to be able to\n * find Sortable whith shadowRoot (document fragment has no parent)\n */\nfunction findSortable(element, event) {\n if (event.composedPath) {\n return event.composedPath().find(function (el) { return el.isSortable; });\n }\n while (element.isSortable !== true) {\n element = element.parentElement;\n }\n return element;\n}\n/**\n * Dragging event is on the sortable element. finds the top child that\n * contains the element.\n * @param {HTMLElement} sortableElement a single sortable\n * @param {HTMLElement} element is that being dragged\n */\nfunction findDragElement(sortableElement, element) {\n var options = addData(sortableElement, 'opts');\n var items = _filter(sortableElement.children, options.items);\n var itemlist = items.filter(function (ele) {\n return ele.contains(element) || (ele.shadowRoot && ele.shadowRoot.contains(element));\n });\n return itemlist.length > 0 ? itemlist[0] : element;\n}\n/**\n * Destroy the sortable\n * @param {HTMLElement} sortableElement a single sortable\n */\nvar _destroySortable = function (sortableElement) {\n var opts = addData(sortableElement, 'opts') || {};\n var items = _filter(sortableElement.children, opts.items);\n var handles = _getHandles(items, opts.handle);\n // remove event handlers & data from sortable\n removeEventListener(sortableElement, 'dragover');\n removeEventListener(sortableElement, 'dragenter');\n removeEventListener(sortableElement, 'dragstart');\n removeEventListener(sortableElement, 'dragend');\n removeEventListener(sortableElement, 'drop');\n // remove event data from sortable\n _removeSortableData(sortableElement);\n // remove event handlers & data from items\n removeEventListener(handles, 'mousedown');\n _removeItemEvents(items);\n _removeItemData(items);\n _removeContainerEvents(originContainer, previousContainer);\n // clear sortable flag\n sortableElement.isSortable = false;\n};\n/**\n * Enable the sortable\n * @param {HTMLElement} sortableElement a single sortable\n */\nvar _enableSortable = function (sortableElement) {\n var opts = addData(sortableElement, 'opts');\n var items = _filter(sortableElement.children, opts.items);\n var handles = _getHandles(items, opts.handle);\n addAttribute(sortableElement, 'aria-dropeffect', 'move');\n addData(sortableElement, '_disabled', 'false');\n addAttribute(handles, 'draggable', 'true');\n // @todo: remove this fix\n // IE FIX for ghost\n // can be disabled as it has the side effect that other events\n // (e.g. click) will be ignored\n if (opts.disableIEFix === false) {\n var spanEl = (document || window.document).createElement('span');\n if (typeof spanEl.dragDrop === 'function') {\n addEventListener(handles, 'mousedown', function () {\n if (items.indexOf(this) !== -1) {\n this.dragDrop();\n }\n else {\n var parent = this.parentElement;\n while (items.indexOf(parent) === -1) {\n parent = parent.parentElement;\n }\n parent.dragDrop();\n }\n });\n }\n }\n};\n/**\n * Disable the sortable\n * @param {HTMLElement} sortableElement a single sortable\n */\nvar _disableSortable = function (sortableElement) {\n var opts = addData(sortableElement, 'opts');\n var items = _filter(sortableElement.children, opts.items);\n var handles = _getHandles(items, opts.handle);\n addAttribute(sortableElement, 'aria-dropeffect', 'none');\n addData(sortableElement, '_disabled', 'true');\n addAttribute(handles, 'draggable', 'false');\n removeEventListener(handles, 'mousedown');\n};\n/**\n * Reload the sortable\n * @param {HTMLElement} sortableElement a single sortable\n * @description events need to be removed to not be double bound\n */\nvar _reloadSortable = function (sortableElement) {\n var opts = addData(sortableElement, 'opts');\n var items = _filter(sortableElement.children, opts.items);\n var handles = _getHandles(items, opts.handle);\n addData(sortableElement, '_disabled', 'false');\n // remove event handlers from items\n _removeItemEvents(items);\n _removeContainerEvents(originContainer, previousContainer);\n removeEventListener(handles, 'mousedown');\n // remove event handlers from sortable\n removeEventListener(sortableElement, 'dragover');\n removeEventListener(sortableElement, 'dragenter');\n removeEventListener(sortableElement, 'drop');\n};\n/**\n * Public sortable object\n * @param {Array|NodeList} sortableElements\n * @param {object|string} options|method\n */\nfunction sortable(sortableElements, options) {\n // get method string to see if a method is called\n var method = String(options);\n options = options || {};\n // check if the user provided a selector instead of an element\n if (typeof sortableElements === 'string') {\n sortableElements = document.querySelectorAll(sortableElements);\n }\n // if the user provided an element, return it in an array to keep the return value consistant\n if (sortableElements instanceof HTMLElement) {\n sortableElements = [sortableElements];\n }\n sortableElements = Array.prototype.slice.call(sortableElements);\n if (/serialize/.test(method)) {\n return sortableElements.map(function (sortableContainer) {\n var opts = addData(sortableContainer, 'opts');\n return _serialize(sortableContainer, opts.itemSerializer, opts.containerSerializer);\n });\n }\n sortableElements.forEach(function (sortableElement) {\n if (/enable|disable|destroy/.test(method)) {\n return sortable[method](sortableElement);\n }\n // log deprecation\n ['connectWith', 'disableIEFix'].forEach(function (configKey) {\n if (Object.prototype.hasOwnProperty.call(options, configKey) && options[configKey] !== null) {\n console.warn(\"HTML5Sortable: You are using the deprecated configuration \\\"\" + configKey + \"\\\". This will be removed in an upcoming version, make sure to migrate to the new options when updating.\");\n }\n });\n // merge options with default options\n options = Object.assign({}, defaultConfiguration, store(sortableElement).config, options);\n // init data store for sortable\n store(sortableElement).config = options;\n // set options on sortable\n addData(sortableElement, 'opts', options);\n // property to define as sortable\n sortableElement.isSortable = true;\n // reset sortable\n _reloadSortable(sortableElement);\n // initialize\n var listItems = _filter(sortableElement.children, options.items);\n // create element if user defined a placeholder element as a string\n var customPlaceholder;\n if (options.placeholder !== null && options.placeholder !== undefined) {\n var tempContainer = document.createElement(sortableElement.tagName);\n if (options.placeholder instanceof HTMLElement) {\n tempContainer.appendChild(options.placeholder);\n }\n else {\n tempContainer.innerHTML = options.placeholder;\n }\n customPlaceholder = tempContainer.children[0];\n }\n // add placeholder\n store(sortableElement).placeholder = _makePlaceholder(sortableElement, customPlaceholder, options.placeholderClass);\n addData(sortableElement, 'items', options.items);\n if (options.acceptFrom) {\n addData(sortableElement, 'acceptFrom', options.acceptFrom);\n }\n else if (options.connectWith) {\n addData(sortableElement, 'connectWith', options.connectWith);\n }\n _enableSortable(sortableElement);\n addAttribute(listItems, 'role', 'option');\n addAttribute(listItems, 'aria-grabbed', 'false');\n // enable hover class\n enableHoverClass(sortableElement, true);\n /*\n Handle drag events on draggable items\n Handle is set at the sortableElement level as it will bubble up\n from the item\n */\n addEventListener(sortableElement, 'dragstart', function (e) {\n // ignore dragstart events\n var target = getEventTarget(e);\n if (target.isSortable === true) {\n return;\n }\n e.stopImmediatePropagation();\n if ((options.handle && !target.matches(options.handle)) || target.getAttribute('draggable') === 'false') {\n return;\n }\n var sortableContainer = findSortable(target, e);\n var dragItem = findDragElement(sortableContainer, target);\n // grab values\n originItemsBeforeUpdate = _filter(sortableContainer.children, options.items);\n originIndex = originItemsBeforeUpdate.indexOf(dragItem);\n originElementIndex = _index(dragItem, sortableContainer.children);\n originContainer = sortableContainer;\n // add transparent clone or other ghost to cursor\n setDragImage(e, dragItem, options.customDragImage);\n // cache selsection & add attr for dragging\n draggingHeight = _getElementHeight(dragItem);\n draggingWidth = _getElementWidth(dragItem);\n dragItem.classList.add(options.draggingClass);\n dragging = _getDragging(dragItem, sortableContainer);\n addAttribute(dragging, 'aria-grabbed', 'true');\n // dispatch sortstart event on each element in group\n sortableContainer.dispatchEvent(new CustomEvent('sortstart', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: originContainer\n },\n item: dragging,\n originalTarget: target\n }\n }));\n });\n /*\n We are capturing targetSortable before modifications with 'dragenter' event\n */\n addEventListener(sortableElement, 'dragenter', function (e) {\n var target = getEventTarget(e);\n var sortableContainer = findSortable(target, e);\n if (sortableContainer && sortableContainer !== previousContainer) {\n destinationItemsBeforeUpdate = _filter(sortableContainer.children, addData(sortableContainer, 'items'))\n .filter(function (item) { return item !== store(sortableElement).placeholder; });\n if (options.dropTargetContainerClass) {\n sortableContainer.classList.add(options.dropTargetContainerClass);\n }\n sortableContainer.dispatchEvent(new CustomEvent('sortenter', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: originContainer\n },\n destination: {\n container: sortableContainer,\n itemsBeforeUpdate: destinationItemsBeforeUpdate\n },\n item: dragging,\n originalTarget: target\n }\n }));\n addEventListener(sortableContainer, 'dragleave', function (e) {\n // TODO: rename outTarget to be more self-explanatory\n // e.fromElement for very old browsers, similar to relatedTarget\n var outTarget = e.relatedTarget || e.fromElement;\n if (!e.currentTarget.contains(outTarget)) {\n if (options.dropTargetContainerClass) {\n sortableContainer.classList.remove(options.dropTargetContainerClass);\n }\n sortableContainer.dispatchEvent(new CustomEvent('sortleave', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: sortableContainer\n },\n item: dragging,\n originalTarget: target\n }\n }));\n }\n });\n }\n previousContainer = sortableContainer;\n });\n /*\n * Dragend Event - https://developer.mozilla.org/en-US/docs/Web/Events/dragend\n * Fires each time dragEvent end, or ESC pressed\n * We are using it to clean up any draggable elements and placeholders\n */\n addEventListener(sortableElement, 'dragend', function (e) {\n if (!dragging) {\n return;\n }\n dragging.classList.remove(options.draggingClass);\n addAttribute(dragging, 'aria-grabbed', 'false');\n if (dragging.getAttribute('aria-copied') === 'true' && addData(dragging, 'dropped') !== 'true') {\n dragging.remove();\n }\n dragging.style.display = dragging.oldDisplay;\n delete dragging.oldDisplay;\n var visiblePlaceholder = Array.from(stores.values()).map(function (data) { return data.placeholder; })\n .filter(function (placeholder) { return placeholder instanceof HTMLElement; })\n .filter(isInDom)[0];\n if (visiblePlaceholder) {\n visiblePlaceholder.remove();\n }\n // dispatch sortstart event on each element in group\n sortableElement.dispatchEvent(new CustomEvent('sortstop', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: originContainer\n },\n item: dragging\n }\n }));\n previousContainer = null;\n dragging = null;\n draggingHeight = null;\n draggingWidth = null;\n });\n /*\n * Drop Event - https://developer.mozilla.org/en-US/docs/Web/Events/drop\n * Fires when valid drop target area is hit\n */\n addEventListener(sortableElement, 'drop', function (e) {\n if (!_listsConnected(sortableElement, dragging.parentElement)) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n addData(dragging, 'dropped', 'true');\n // get the one placeholder that is currently visible\n var visiblePlaceholder = Array.from(stores.values()).map(function (data) {\n return data.placeholder;\n })\n // filter only HTMLElements\n .filter(function (placeholder) { return placeholder instanceof HTMLElement; })\n // filter only elements in DOM\n .filter(isInDom)[0];\n // attach element after placeholder\n insertAfter(visiblePlaceholder, dragging);\n // remove placeholder from dom\n visiblePlaceholder.remove();\n /*\n * Fires Custom Event - 'sortstop'\n */\n sortableElement.dispatchEvent(new CustomEvent('sortstop', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: originContainer\n },\n item: dragging\n }\n }));\n var placeholder = store(sortableElement).placeholder;\n var originItems = _filter(originContainer.children, options.items)\n .filter(function (item) { return item !== placeholder; });\n var destinationContainer = this.isSortable === true ? this : this.parentElement;\n var destinationItems = _filter(destinationContainer.children, addData(destinationContainer, 'items'))\n .filter(function (item) { return item !== placeholder; });\n var destinationElementIndex = _index(dragging, Array.from(dragging.parentElement.children)\n .filter(function (item) { return item !== placeholder; }));\n var destinationIndex = _index(dragging, destinationItems);\n if (options.dropTargetContainerClass) {\n destinationContainer.classList.remove(options.dropTargetContainerClass);\n }\n /*\n * When a list item changed container lists or index within a list\n * Fires Custom Event - 'sortupdate'\n */\n if (originElementIndex !== destinationElementIndex || originContainer !== destinationContainer) {\n sortableElement.dispatchEvent(new CustomEvent('sortupdate', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: originContainer,\n itemsBeforeUpdate: originItemsBeforeUpdate,\n items: originItems\n },\n destination: {\n index: destinationIndex,\n elementIndex: destinationElementIndex,\n container: destinationContainer,\n itemsBeforeUpdate: destinationItemsBeforeUpdate,\n items: destinationItems\n },\n item: dragging\n }\n }));\n }\n });\n var debouncedDragOverEnter = _debounce(function (sortableElement, element, pageX, pageY) {\n if (!dragging) {\n return;\n }\n // set placeholder height if forcePlaceholderSize option is set\n if (options.forcePlaceholderSize) {\n store(sortableElement).placeholder.style.height = draggingHeight + 'px';\n store(sortableElement).placeholder.style.width = draggingWidth + 'px';\n }\n // if element the draggedItem is dragged onto is within the array of all elements in list\n // (not only items, but also disabled, etc.)\n if (Array.from(sortableElement.children).indexOf(element) > -1) {\n var thisHeight = _getElementHeight(element);\n var thisWidth = _getElementWidth(element);\n var placeholderIndex = _index(store(sortableElement).placeholder, element.parentElement.children);\n var thisIndex = _index(element, element.parentElement.children);\n // Check if `element` is bigger than the draggable. If it is, we have to define a dead zone to prevent flickering\n if (thisHeight > draggingHeight || thisWidth > draggingWidth) {\n // Dead zone?\n var deadZoneVertical = thisHeight - draggingHeight;\n var deadZoneHorizontal = thisWidth - draggingWidth;\n var offsetTop = _offset(element).top;\n var offsetLeft = _offset(element).left;\n if (placeholderIndex < thisIndex &&\n ((options.orientation === 'vertical' && pageY < offsetTop) ||\n (options.orientation === 'horizontal' && pageX < offsetLeft))) {\n return;\n }\n if (placeholderIndex > thisIndex &&\n ((options.orientation === 'vertical' && pageY > offsetTop + thisHeight - deadZoneVertical) ||\n (options.orientation === 'horizontal' && pageX > offsetLeft + thisWidth - deadZoneHorizontal))) {\n return;\n }\n }\n if (dragging.oldDisplay === undefined) {\n dragging.oldDisplay = dragging.style.display;\n }\n if (dragging.style.display !== 'none') {\n dragging.style.display = 'none';\n }\n // To avoid flicker, determine where to position the placeholder\n // based on where the mouse pointer is relative to the elements\n // vertical center.\n var placeAfter = false;\n try {\n var elementMiddleVertical = _offset(element).top + element.offsetHeight / 2;\n var elementMiddleHorizontal = _offset(element).left + element.offsetWidth / 2;\n placeAfter = (options.orientation === 'vertical' && (pageY >= elementMiddleVertical)) ||\n (options.orientation === 'horizontal' && (pageX >= elementMiddleHorizontal));\n }\n catch (e) {\n placeAfter = placeholderIndex < thisIndex;\n }\n if (placeAfter) {\n insertAfter(element, store(sortableElement).placeholder);\n }\n else {\n insertBefore(element, store(sortableElement).placeholder);\n }\n // get placeholders from all stores & remove all but current one\n Array.from(stores.values())\n // remove empty values\n .filter(function (data) { return data.placeholder !== undefined; })\n // foreach placeholder in array if outside of current sorableContainer -> remove from DOM\n .forEach(function (data) {\n if (data.placeholder !== store(sortableElement).placeholder) {\n data.placeholder.remove();\n }\n });\n }\n else {\n // get all placeholders from store\n var placeholders = Array.from(stores.values())\n .filter(function (data) { return data.placeholder !== undefined; })\n .map(function (data) {\n return data.placeholder;\n });\n // check if element is not in placeholders\n if (placeholders.indexOf(element) === -1 && sortableElement === element && !_filter(element.children, options.items).length) {\n placeholders.forEach(function (element) { return element.remove(); });\n element.appendChild(store(sortableElement).placeholder);\n }\n }\n }, options.debounce);\n // Handle dragover and dragenter events on draggable items\n var onDragOverEnter = function (e) {\n var element = e.target;\n var sortableElement = element.isSortable === true ? element : findSortable(element, e);\n element = findDragElement(sortableElement, element);\n if (!dragging || !_listsConnected(sortableElement, dragging.parentElement) || addData(sortableElement, '_disabled') === 'true') {\n return;\n }\n var options = addData(sortableElement, 'opts');\n if (parseInt(options.maxItems) && _filter(sortableElement.children, addData(sortableElement, 'items')).length >= parseInt(options.maxItems) && dragging.parentElement !== sortableElement) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n e.dataTransfer.dropEffect = store(sortableElement).getConfig('copy') === true ? 'copy' : 'move';\n debouncedDragOverEnter(sortableElement, element, e.pageX, e.pageY);\n };\n addEventListener(listItems.concat(sortableElement), 'dragover', onDragOverEnter);\n addEventListener(listItems.concat(sortableElement), 'dragenter', onDragOverEnter);\n });\n return sortableElements;\n}\nsortable.destroy = function (sortableElement) {\n _destroySortable(sortableElement);\n};\nsortable.enable = function (sortableElement) {\n _enableSortable(sortableElement);\n};\nsortable.disable = function (sortableElement) {\n _disableSortable(sortableElement);\n};\n/* START.TESTS_ONLY */\nsortable.__testing = {\n // add internal methods here for testing purposes\n _data: addData,\n _removeItemEvents: _removeItemEvents,\n _removeItemData: _removeItemData,\n _removeSortableData: _removeSortableData,\n _removeContainerEvents: _removeContainerEvents\n};\n\nexport default sortable;\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/icon'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/extractText'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/ItemList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/withAttr'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","import app from 'flarum/admin/app';\nimport icon from 'flarum/common/helpers/icon';\nimport extractText from 'flarum/common/utils/extractText';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport withAttr from 'flarum/common/utils/withAttr';\nimport Button from 'flarum/common/components/Button';\n\n/* global m, dayjs */\n\nexport default class PolicyEdit {\n oninit(vnode) {\n this.policy = vnode.attrs.policy;\n this.dirty = false;\n this.processing = false;\n this.toggleFields = false;\n\n if (this.policy === null) {\n this.initNewField();\n }\n }\n\n initNewField() {\n this.policy = app.store.createRecord('fof-terms-policies', {\n attributes: {\n name: '',\n url: '',\n update_message: '',\n terms_updated_at: '',\n },\n });\n }\n\n boxTitle() {\n if (this.policy.exists) {\n return this.policy.name();\n }\n\n return app.translator.trans('fof-terms.admin.buttons.new-policy');\n }\n\n view() {\n return m('.FoF-Terms-Policiy-Box', [\n this.policy.exists ? m('span.fas.fa-arrows-alt.FoF-Terms-Policiy-Box--handle.js-policy-handle') : null,\n m(\n '.Button.Button--block.FoF-Terms-Policiy-Header',\n {\n onclick: () => {\n this.toggleFields = !this.toggleFields;\n },\n },\n [\n m('.FoF-Terms-Policiy-Header-Title', this.boxTitle()),\n m('div', [\n this.policy.exists ? [app.translator.trans('fof-terms.admin.buttons.edit-policy'), ' '] : null,\n icon(this.toggleFields ? 'fas fa-chevron-up' : 'fas fa-chevron-down'),\n ]),\n ]\n ),\n this.toggleFields ? this.viewFields() : null,\n ]);\n }\n\n viewFields() {\n return m(\n 'form.FoF-Terms-Policiy-Body',\n {\n onsubmit: this.savePolicy.bind(this),\n },\n [\n this.fields().toArray(),\n m('.ButtonGroup', [\n Button.component(\n {\n type: 'submit',\n className: 'Button Button--primary',\n loading: this.processing,\n disabled: !this.readyToSave(),\n },\n app.translator.trans('fof-terms.admin.buttons.' + (this.policy.exists ? 'save' : 'add') + '-policy')\n ),\n this.policy.exists\n ? Button.component(\n {\n type: 'submit',\n className: 'Button Button--danger',\n loading: this.processing,\n onclick: this.deletePolicy.bind(this),\n },\n app.translator.trans('fof-terms.admin.buttons.delete-policy')\n )\n : '',\n ]),\n ]\n );\n }\n\n fields() {\n const fields = new ItemList();\n\n fields.add(\n 'name',\n m('.Form-group', [\n m('label', app.translator.trans('fof-terms.admin.policies.name')),\n m('input.FormControl', {\n type: 'text',\n value: this.policy.name(),\n oninput: withAttr('value', this.updateAttribute.bind(this, 'name')),\n }),\n m('.helpText', app.translator.trans('fof-terms.admin.policies.name-help')),\n ]),\n 100\n );\n\n fields.add(\n 'url',\n m('.Form-group', [\n m('label', app.translator.trans('fof-terms.admin.policies.url')),\n m('input.FormControl', {\n type: 'url',\n value: this.policy.url(),\n oninput: withAttr('value', this.updateAttribute.bind(this, 'url')),\n }),\n m('.helpText', app.translator.trans('fof-terms.admin.policies.url-help')),\n ]),\n 95\n );\n\n fields.add(\n 'update-message',\n m('.Form-group', [\n m('label', app.translator.trans('fof-terms.admin.policies.update-message')),\n m('textarea.FormControl', {\n value: this.policy.update_message(),\n oninput: withAttr('value', this.updateAttribute.bind(this, 'update_message')),\n }),\n m('.helpText', app.translator.trans('fof-terms.admin.policies.update-message-help')),\n ]),\n 90\n );\n\n fields.add(\n 'terms-updated-at',\n m('.Form-group', [\n m('label', app.translator.trans('fof-terms.admin.policies.terms-updated-at')),\n m('.FoF-Terms-Input-Group', [\n m('input.FormControl', {\n type: 'text',\n value: this.policy.terms_updated_at(),\n oninput: withAttr('value', this.updateAttribute.bind(this, 'terms_updated_at')),\n placeholder: app.translator.trans('fof-terms.admin.policies.terms-updated-at-placeholder'),\n }),\n Button.component(\n {\n className: 'Button Button--primary',\n onclick: () => {\n // We set the milliseconds to zero because it might otherwise give the impression\n // that we store them, when in fact the date will be stored in a MySQL TIMESTAMP column\n this.updateAttribute('terms_updated_at', dayjs().millisecond(0).toISOString());\n },\n },\n app.translator.trans('fof-terms.admin.buttons.set-to-now')\n ),\n ]),\n m('.helpText', app.translator.trans('fof-terms.admin.policies.terms-updated-at-help')),\n ]),\n 85\n );\n\n if (this.policy.exists) {\n fields.add(\n 'export-url',\n m('.Form-group', [\n m('label', app.translator.trans('fof-terms.admin.policies.export-url')),\n m(\n '.ButtonGroup',\n ['json', 'csv'].map((format) =>\n m(\n 'a.Button.FoF-Terms-Export-Button',\n {\n href: app.forum.attribute('apiUrl') + '/fof/terms/policies/' + this.policy.id() + '/export.' + format,\n target: '_blank',\n },\n format.toUpperCase()\n )\n )\n ),\n m(\n '.helpText',\n app.translator.trans('fof-terms.admin.policies.export-url-help', {\n a: m('a', {\n href: 'https://github.com/FriendsOfFlarum/terms/wiki/Export-url',\n target: '_blank',\n }),\n })\n ),\n ]),\n 80\n );\n }\n\n return fields;\n }\n\n updateAttribute(attribute, value) {\n this.policy.pushAttributes({\n [attribute]: value,\n });\n\n this.dirty = true;\n }\n\n readyToSave() {\n return this.dirty;\n }\n\n savePolicy(event) {\n event.preventDefault();\n\n this.processing = true;\n\n const createNewRecord = !this.policy.exists;\n\n this.policy\n .save(this.policy.data.attributes)\n .then(() => {\n if (createNewRecord) {\n this.initNewField();\n this.toggleFields = false;\n }\n\n this.processing = false;\n this.dirty = false;\n\n m.redraw();\n })\n .catch((err) => {\n this.processing = false;\n\n throw err;\n });\n }\n\n deletePolicy() {\n if (\n !confirm(\n extractText(\n app.translator.trans('fof-terms.admin.messages.delete-policy-confirmation', {\n name: this.policy.name(),\n })\n )\n )\n ) {\n return;\n }\n\n this.processing = true;\n\n this.policy\n .delete()\n .then(() => {\n this.processing = false;\n\n m.redraw();\n })\n .catch((err) => {\n this.processing = false;\n\n throw err;\n });\n }\n}\n","export default function (items, attr = 'sort') {\n return items.sort((a, b) => a[attr]() - b[attr]());\n}\n","import sortable from 'html5sortable/dist/html5sortable.es.js';\n\nimport app from 'flarum/admin/app';\nimport PolicyEdit from './PolicyEdit';\nimport sortByAttribute from '../../common/helpers/sortByAttribute';\n\n/* global m */\n\nexport default class PolicyList {\n oninit() {\n app\n .request({\n method: 'GET',\n url: app.forum.attribute('apiUrl') + '/fof/terms/policies',\n })\n .then((result) => {\n app.store.pushPayload(result);\n\n m.redraw();\n });\n }\n\n oncreate(vnode) {\n this.initsortable(vnode);\n }\n\n onupdate(vnode) {\n // We could do this without re-creating the sortable on every redraw, but the current system works well\n // \"If it ain't broken, don't fix it\"\n this.initsortable(vnode);\n }\n\n initsortable(vnode) {\n sortable(vnode.dom.querySelector('.js-policies-container'), {\n handle: '.js-policy-handle',\n })[0].addEventListener('sortupdate', () => {\n const sorting = [].map.call(vnode.dom.querySelectorAll('.js-policy-data'), (element) => element.dataset.id);\n\n this.updateSort(sorting);\n });\n }\n\n view() {\n const policies = app.store.all('fof-terms-policies');\n\n let fieldsList = [];\n\n sortByAttribute(policies).forEach((policy) => {\n // Build array of fields to show.\n fieldsList.push(\n m(\n '.js-policy-data',\n {\n key: policy.id(),\n 'data-id': policy.id(),\n },\n m(PolicyEdit, {\n policy,\n })\n )\n );\n });\n\n return m('div', [\n m('h2', app.translator.trans('fof-terms.admin.titles.policies')),\n m('.FoF-Terms-Policies-Container', [\n m('.js-policies-container', fieldsList),\n m(PolicyEdit, {\n policy: null,\n }),\n ]),\n ]);\n }\n\n updateSort(sorting) {\n app\n .request({\n method: 'POST',\n url: app.forum.attribute('apiUrl') + '/fof/terms/policies/order',\n body: {\n sort: sorting,\n },\n })\n .then((result) => {\n // Update sort attributes\n app.store.pushPayload(result);\n\n m.redraw();\n });\n }\n}\n","import app from 'flarum/admin/app';\nimport ExtensionPage from 'flarum/admin/components/ExtensionPage';\nimport Switch from 'flarum/common/components/Switch';\nimport PolicyList from './PolicyList';\n\nconst settingsPrefix = 'fof-terms.';\nconst translationPrefix = 'fof-terms.admin.settings.';\n\n/* global m */\n\nexport default class TermsSettingsPage extends ExtensionPage {\n content() {\n return m('.ExtensionPage-settings', [\n m('.container', [\n m('.Form-group', [\n m('label', app.translator.trans(translationPrefix + 'field.signup-legal-text')),\n m('textarea.FormControl', {\n bidi: this.setting(settingsPrefix + 'signup-legal-text'),\n }),\n ]),\n m('.Form-group', [\n m(\n 'label',\n Switch.component(\n {\n state: this.setting(settingsPrefix + 'hide-updated-at')() > 0,\n onchange: this.setting(settingsPrefix + 'hide-updated-at'),\n },\n app.translator.trans(translationPrefix + 'field.hide-updated-at')\n )\n ),\n ]),\n m('.Form-group', [\n m('label', app.translator.trans(translationPrefix + 'field.date-format')),\n m('input[type=text].FormControl', {\n bidi: this.setting(settingsPrefix + 'date-format'),\n placeholder: 'YYYY-MM-DD',\n }),\n m(\n '.helpText',\n app.translator.trans(translationPrefix + 'field.date-format-help', {\n a: m('a', {\n href: 'https://day.js.org/docs/en/display/format',\n target: '_blank',\n }),\n })\n ),\n ]),\n this.submitButton(),\n m(PolicyList),\n ]),\n ]);\n }\n}\n","import PolicyEdit from './PolicyEdit';\nimport PolicyList from './PolicyList';\nimport TermsSettingsPage from './TermsSettingsPage';\n\nexport const components = {\n PolicyEdit,\n PolicyList,\n TermsSettingsPage,\n};\n","import Policy from './Policy';\n\nexport const models = {\n Policy,\n};\n","import sortByAttribute from './sortByAttribute';\n\nexport const helpers = {\n sortByAttribute,\n};\n","import app from 'flarum/admin/app';\nimport Policy from '../common/models/Policy';\nimport TermsSettingsPage from './components/TermsSettingsPage';\n\nexport * from './components';\nexport * from '../common/models';\nexport * from '../common/helpers';\n\napp.initializers.add('fof-terms', () => {\n app.store.models['fof-terms-policies'] = Policy;\n\n app.extensionData\n .for('fof-terms')\n .registerPermission(\n {\n icon: 'fas fa-paperclip',\n label: app.translator.trans('fof-terms.admin.permissions.see-user-policies-state'),\n permission: 'fof-terms.see-user-policies-state',\n },\n 'moderate'\n )\n .registerPermission(\n {\n icon: 'fas fa-paperclip',\n label: app.translator.trans('fof-terms.admin.permissions.postpone-policies-accept'),\n permission: 'fof-terms.postpone-policies-accept',\n },\n 'moderate'\n )\n .registerPermission(\n {\n icon: 'fas fa-paperclip',\n label: app.translator.trans('fof-terms.admin.permissions.export-policies'),\n permission: 'fof-terms.export-policies',\n },\n 'moderate'\n )\n .registerPage(TermsSettingsPage);\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","_setPrototypeOf","p","setPrototypeOf","bind","__proto__","_inheritsLoose","subClass","superClass","create","constructor","Policy","_Model","_this","_len","arguments","length","args","Array","_key","apply","concat","sort","Model","name","url","update_message","terms_updated_at","form_key","computed","id","apiEndpoint","this","exists","data","addData","element","undefined","h5s","_filter","nodes","selector","NodeList","HTMLCollection","Error","from","filter","item","nodeType","matches","stores","Map","Store","_config","_placeholder","_data","config","forEach","set","mergedConfig","assign","entries","configurable","setConfig","has","getConfig","placeholder","HTMLElement","setData","getData","deleteData","store","sortableElement","addEventListener","eventName","callback","i","removeEventListener","addAttribute","attribute","setAttribute","removeAttribute","dragging","draggingHeight","draggingWidth","originContainer","originIndex","originElementIndex","originItemsBeforeUpdate","previousContainer","destinationItemsBeforeUpdate","_offset","parentElement","getClientRects","rect","left","window","pageXOffset","right","top","pageYOffset","bottom","_index","elementList","indexOf","isInDom","parentNode","insertNode","referenceNode","newElement","position","insertBefore","nextElementSibling","insertAfter","target","_getElementHeight","style","getComputedStyle","getPropertyValue","parseInt","map","int","isNaN","reduce","sum","_getElementWidth","_getHandles","items","querySelector","shadowRoot","getEventTarget","event","composedPath","defaultDragImage","draggedElement","elementOffset","posX","pageX","posY","pageY","_listsConnected","destination","origin","isSortable","acceptFrom","split","sel","defaultConfiguration","connectWith","disableIEFix","copy","placeholderClass","draggingClass","hoverClass","dropTargetContainerClass","debounce","throttleTime","maxItems","itemSerializer","containerSerializer","customDragImage","orientation","_removeItemEvents","_removeContainerEvents","_removeSortableData","sortable","_removeItemData","findSortable","find","el","findDragElement","options","itemlist","children","ele","contains","_enableSortable","opts","handles","handle","document","createElement","dragDrop","parent","sortableElements","method","String","querySelectorAll","slice","test","sortableContainer","customItemSerializer","customContainerSerializer","serializedItem","serializedContainer","serializedItems","node","html","outerHTML","index","container","itemCount","_serialize","configKey","console","warn","_reloadSortable","customPlaceholder","listItems","tempContainer","tagName","appendChild","innerHTML","_a","includes","classList","add","_makePlaceholder","enable","hoverClasses_1","fn","threshold","lastEventTimestamp","_i","now","Date","_throttle","buttons","_b","remove","enableHoverClass","e","stopImmediatePropagation","getAttribute","dragItem","Event","dataTransfer","setDragImage","dragImage","effectAllowed","draggedItem","ditem","cloneNode","display","oldDisplay","_getDragging","dispatchEvent","CustomEvent","detail","elementIndex","originalTarget","itemsBeforeUpdate","outTarget","relatedTarget","fromElement","currentTarget","visiblePlaceholder","values","preventDefault","stopPropagation","originItems","destinationContainer","destinationItems","destinationElementIndex","destinationIndex","func","wait","timeout","debouncedDragOverEnter","forcePlaceholderSize","height","width","thisHeight","thisWidth","placeholderIndex","thisIndex","deadZoneVertical","deadZoneHorizontal","offsetTop","offsetLeft","placeAfter","elementMiddleVertical","offsetHeight","elementMiddleHorizontal","offsetWidth","placeholders","clearTimeout","setTimeout","onDragOverEnter","dropEffect","destroy","_destroySortable","disable","_disableSortable","__testing","PolicyEdit","_proto","oninit","vnode","policy","attrs","dirty","processing","toggleFields","initNewField","app","createRecord","attributes","boxTitle","trans","view","m","onclick","icon","viewFields","onsubmit","savePolicy","fields","toArray","Button","type","className","loading","disabled","readyToSave","deletePolicy","_this2","ItemList","oninput","withAttr","updateAttribute","dayjs","millisecond","toISOString","format","href","toUpperCase","_this$policy$pushAttr","pushAttributes","_this3","createNewRecord","save","then","redraw","err","_this4","confirm","extractText","attr","b","PolicyList","result","pushPayload","oncreate","initsortable","onupdate","dom","sorting","dataset","updateSort","policies","all","fieldsList","sortByAttribute","push","body","settingsPrefix","translationPrefix","TermsSettingsPage","_ExtensionPage","content","bidi","setting","Switch","state","onchange","submitButton","ExtensionPage","components","models","helpers","registerPermission","label","permission","registerPage"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,uFCL9D,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,a,aCAzC,SAASC,EAAgBhB,EAAGiB,GAKzC,OAJAD,EAAkBf,OAAOiB,eAAiBjB,OAAOiB,eAAeC,OAAS,SAAyBnB,EAAGiB,GAEnG,OADAjB,EAAEoB,UAAYH,EACPjB,CACT,EACOgB,EAAgBhB,EAAGiB,EAC5B,CCLe,SAASI,EAAeC,EAAUC,GAC/CD,EAASf,UAAYN,OAAOuB,OAAOD,EAAWhB,WAC9Ce,EAASf,UAAUkB,YAAcH,EACjCJ,EAAeI,EAAUC,EAC3B,CCLA,MAAM,EAA+BV,OAAOC,KAAKC,OAAO,gB,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,yB,aCGnCW,EAAM,SA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A,ICKFhE,IAAAA,aAAiBzF,IAAI,aAAa,WAChCyF,IAAAA,MAAUkF,OAAO,sBAAwB1X,EAEzCwS,IAAAA,cAAiB,IACV,aACJoF,mBACC,CACE5E,KAAM,mBACN6E,MAAOrF,IAAAA,WAAeI,MAAM,uDAC5BkF,WAAY,qCAEd,YAEDF,mBACC,CACE5E,KAAM,mBACN6E,MAAOrF,IAAAA,WAAeI,MAAM,wDAC5BkF,WAAY,sCAEd,YAEDF,mBACC,CACE5E,KAAM,mBACN6E,MAAOrF,IAAAA,WAAeI,MAAM,+CAC5BkF,WAAY,6BAEd,YAEDC,aAAalB,GAClB,G","sources":["webpack://@fof/terms/webpack/bootstrap","webpack://@fof/terms/webpack/runtime/compat get default export","webpack://@fof/terms/webpack/runtime/define property getters","webpack://@fof/terms/webpack/runtime/hasOwnProperty shorthand","webpack://@fof/terms/webpack/runtime/make namespace object","webpack://@fof/terms/external root \"flarum.core.compat['admin/app']\"","webpack://@fof/terms/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@fof/terms/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/terms/external root \"flarum.core.compat['common/Model']\"","webpack://@fof/terms/external root \"flarum.core.compat['common/utils/computed']\"","webpack://@fof/terms/./src/common/models/Policy.js","webpack://@fof/terms/external root \"flarum.core.compat['admin/components/ExtensionPage']\"","webpack://@fof/terms/external root \"flarum.core.compat['common/components/Switch']\"","webpack://@fof/terms/./node_modules/html5sortable/dist/html5sortable.es.js","webpack://@fof/terms/external root \"flarum.core.compat['common/helpers/icon']\"","webpack://@fof/terms/external root \"flarum.core.compat['common/utils/extractText']\"","webpack://@fof/terms/external root \"flarum.core.compat['common/utils/ItemList']\"","webpack://@fof/terms/external root \"flarum.core.compat['common/utils/withAttr']\"","webpack://@fof/terms/external root \"flarum.core.compat['common/components/Button']\"","webpack://@fof/terms/./src/admin/components/PolicyEdit.js","webpack://@fof/terms/./src/common/helpers/sortByAttribute.js","webpack://@fof/terms/./src/admin/components/PolicyList.js","webpack://@fof/terms/./src/admin/components/TermsSettingsPage.js","webpack://@fof/terms/external root \"flarum.core.compat['common/Component']\"","webpack://@fof/terms/./src/admin/components/ExtensionData.js","webpack://@fof/terms/./src/admin/components/index.js","webpack://@fof/terms/./src/common/models/index.js","webpack://@fof/terms/./src/common/helpers/index.js","webpack://@fof/terms/./src/admin/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Model'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/computed'];","import Model from 'flarum/common/Model';\nimport computed from 'flarum/common/utils/computed';\n\nexport default class Policy extends Model {\n sort = Model.attribute('sort');\n name = Model.attribute('name');\n url = Model.attribute('url');\n update_message = Model.attribute('update_message');\n terms_updated_at = Model.attribute('terms_updated_at');\n optional = Model.attribute('optional');\n additional_info = Model.attribute('additional_info');\n form_key = computed('id', (id) => 'fof_terms_policy_' + id);\n\n apiEndpoint() {\n return '/fof/terms/policies' + (this.exists ? '/' + this.data.id : '');\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/components/ExtensionPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Switch'];","/*\n * HTML5Sortable package\n * https://github.com/lukasoppermann/html5sortable\n *\n * Maintained by Lukas Oppermann \n *\n * Released under the MIT license.\n */\n/**\n * Get or set data on element\n * @param {HTMLElement} element\n * @param {string} key\n * @param {any} value\n * @return {*}\n */\nfunction addData(element, key, value) {\n if (value === undefined) {\n return element && element.h5s && element.h5s.data && element.h5s.data[key];\n }\n else {\n element.h5s = element.h5s || {};\n element.h5s.data = element.h5s.data || {};\n element.h5s.data[key] = value;\n }\n}\n/**\n * Remove data from element\n * @param {HTMLElement} element\n */\nfunction removeData(element) {\n if (element.h5s) {\n delete element.h5s.data;\n }\n}\n\n/* eslint-env browser */\n/**\n * Filter only wanted nodes\n * @param {NodeList|HTMLCollection|Array} nodes\n * @param {String} selector\n * @returns {Array}\n */\nvar _filter = (function (nodes, selector) {\n if (!(nodes instanceof NodeList || nodes instanceof HTMLCollection || nodes instanceof Array)) {\n throw new Error('You must provide a nodeList/HTMLCollection/Array of elements to be filtered.');\n }\n if (typeof selector !== 'string') {\n return Array.from(nodes);\n }\n return Array.from(nodes).filter(function (item) { return item.nodeType === 1 && item.matches(selector); });\n});\n\n/* eslint-env browser */\nvar stores = new Map();\n/**\n * Stores data & configurations per Sortable\n * @param {Object} config\n */\nvar Store = /** @class */ (function () {\n function Store() {\n this._config = new Map(); // eslint-disable-line no-undef\n this._placeholder = undefined; // eslint-disable-line no-undef\n this._data = new Map(); // eslint-disable-line no-undef\n }\n Object.defineProperty(Store.prototype, \"config\", {\n /**\n * get the configuration map of a class instance\n * @method config\n * @return {object}\n */\n get: function () {\n // transform Map to object\n var config = {};\n this._config.forEach(function (value, key) {\n config[key] = value;\n });\n // return object\n return config;\n },\n /**\n * set the configuration of a class instance\n * @method config\n * @param {object} config object of configurations\n */\n set: function (config) {\n if (typeof config !== 'object') {\n throw new Error('You must provide a valid configuration object to the config setter.');\n }\n // combine config with default\n var mergedConfig = Object.assign({}, config);\n // add config to map\n this._config = new Map(Object.entries(mergedConfig));\n },\n enumerable: false,\n configurable: true\n });\n /**\n * set individual configuration of a class instance\n * @method setConfig\n * @param key valid configuration key\n * @param value any value\n * @return void\n */\n Store.prototype.setConfig = function (key, value) {\n if (!this._config.has(key)) {\n throw new Error(\"Trying to set invalid configuration item: \" + key);\n }\n // set config\n this._config.set(key, value);\n };\n /**\n * get an individual configuration of a class instance\n * @method getConfig\n * @param key valid configuration key\n * @return any configuration value\n */\n Store.prototype.getConfig = function (key) {\n if (!this._config.has(key)) {\n throw new Error(\"Invalid configuration item requested: \" + key);\n }\n return this._config.get(key);\n };\n Object.defineProperty(Store.prototype, \"placeholder\", {\n /**\n * get the placeholder for a class instance\n * @method placeholder\n * @return {HTMLElement|null}\n */\n get: function () {\n return this._placeholder;\n },\n /**\n * set the placeholder for a class instance\n * @method placeholder\n * @param {HTMLElement} placeholder\n * @return {void}\n */\n set: function (placeholder) {\n if (!(placeholder instanceof HTMLElement) && placeholder !== null) {\n throw new Error('A placeholder must be an html element or null.');\n }\n this._placeholder = placeholder;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * set an data entry\n * @method setData\n * @param {string} key\n * @param {any} value\n * @return {void}\n */\n Store.prototype.setData = function (key, value) {\n if (typeof key !== 'string') {\n throw new Error('The key must be a string.');\n }\n this._data.set(key, value);\n };\n /**\n * get an data entry\n * @method getData\n * @param {string} key an existing key\n * @return {any}\n */\n Store.prototype.getData = function (key) {\n if (typeof key !== 'string') {\n throw new Error('The key must be a string.');\n }\n return this._data.get(key);\n };\n /**\n * delete an data entry\n * @method deleteData\n * @param {string} key an existing key\n * @return {boolean}\n */\n Store.prototype.deleteData = function (key) {\n if (typeof key !== 'string') {\n throw new Error('The key must be a string.');\n }\n return this._data.delete(key);\n };\n return Store;\n}());\n/**\n * @param {HTMLElement} sortableElement\n * @returns {Class: Store}\n */\nvar store = (function (sortableElement) {\n // if sortableElement is wrong type\n if (!(sortableElement instanceof HTMLElement)) {\n throw new Error('Please provide a sortable to the store function.');\n }\n // create new instance if not avilable\n if (!stores.has(sortableElement)) {\n stores.set(sortableElement, new Store());\n }\n // return instance\n return stores.get(sortableElement);\n});\n\n/**\n * @param {Array|HTMLElement} element\n * @param {Function} callback\n * @param {string} event\n */\nfunction addEventListener(element, eventName, callback) {\n if (element instanceof Array) {\n for (var i = 0; i < element.length; ++i) {\n addEventListener(element[i], eventName, callback);\n }\n return;\n }\n element.addEventListener(eventName, callback);\n store(element).setData(\"event\" + eventName, callback);\n}\n/**\n * @param {Array|HTMLElement} element\n * @param {string} eventName\n */\nfunction removeEventListener(element, eventName) {\n if (element instanceof Array) {\n for (var i = 0; i < element.length; ++i) {\n removeEventListener(element[i], eventName);\n }\n return;\n }\n element.removeEventListener(eventName, store(element).getData(\"event\" + eventName));\n store(element).deleteData(\"event\" + eventName);\n}\n\n/**\n * @param {Array|HTMLElement} element\n * @param {string} attribute\n * @param {string} value\n */\nfunction addAttribute(element, attribute, value) {\n if (element instanceof Array) {\n for (var i = 0; i < element.length; ++i) {\n addAttribute(element[i], attribute, value);\n }\n return;\n }\n element.setAttribute(attribute, value);\n}\n/**\n * @param {Array|HTMLElement} element\n * @param {string} attribute\n */\nfunction removeAttribute(element, attribute) {\n if (element instanceof Array) {\n for (var i = 0; i < element.length; ++i) {\n removeAttribute(element[i], attribute);\n }\n return;\n }\n element.removeAttribute(attribute);\n}\n\n/**\n * @param {HTMLElement} element\n * @returns {Object}\n */\nvar _offset = (function (element) {\n if (!element.parentElement || element.getClientRects().length === 0) {\n throw new Error('target element must be part of the dom');\n }\n var rect = element.getClientRects()[0];\n return {\n left: rect.left + window.pageXOffset,\n right: rect.right + window.pageXOffset,\n top: rect.top + window.pageYOffset,\n bottom: rect.bottom + window.pageYOffset\n };\n});\n\n/**\n * Creates and returns a new debounced version of the passed function which will postpone its execution until after wait milliseconds have elapsed\n * @param {Function} func to debounce\n * @param {number} time to wait before calling function with latest arguments, 0 - no debounce\n * @returns {function} - debounced function\n */\nvar _debounce = (function (func, wait) {\n if (wait === void 0) { wait = 0; }\n var timeout;\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n clearTimeout(timeout);\n timeout = setTimeout(function () {\n func.apply(void 0, args);\n }, wait);\n };\n});\n\n/* eslint-env browser */\n/**\n * Get position of the element relatively to its sibling elements\n * @param {HTMLElement} element\n * @returns {number}\n */\nvar _index = (function (element, elementList) {\n if (!(element instanceof HTMLElement) || !(elementList instanceof NodeList || elementList instanceof HTMLCollection || elementList instanceof Array)) {\n throw new Error('You must provide an element and a list of elements.');\n }\n return Array.from(elementList).indexOf(element);\n});\n\n/* eslint-env browser */\n/**\n * Test whether element is in DOM\n * @param {HTMLElement} element\n * @returns {boolean}\n */\nvar isInDom = (function (element) {\n if (!(element instanceof HTMLElement)) {\n throw new Error('Element is not a node element.');\n }\n return element.parentNode !== null;\n});\n\n/* eslint-env browser */\n/**\n * Insert node before or after target\n * @param {HTMLElement} referenceNode - reference element\n * @param {HTMLElement} newElement - element to be inserted\n * @param {String} position - insert before or after reference element\n */\nvar insertNode = function (referenceNode, newElement, position) {\n if (!(referenceNode instanceof HTMLElement) || !(referenceNode.parentElement instanceof HTMLElement)) {\n throw new Error('target and element must be a node');\n }\n referenceNode.parentElement.insertBefore(newElement, (position === 'before' ? referenceNode : referenceNode.nextElementSibling));\n};\n/**\n * Insert before target\n * @param {HTMLElement} target\n * @param {HTMLElement} element\n */\nvar insertBefore = function (target, element) { return insertNode(target, element, 'before'); };\n/**\n * Insert after target\n * @param {HTMLElement} target\n * @param {HTMLElement} element\n */\nvar insertAfter = function (target, element) { return insertNode(target, element, 'after'); };\n\n/* eslint-env browser */\n/**\n * Filter only wanted nodes\n * @param {HTMLElement} sortableContainer\n * @param {Function} customSerializer\n * @returns {Array}\n */\nvar _serialize = (function (sortableContainer, customItemSerializer, customContainerSerializer) {\n if (customItemSerializer === void 0) { customItemSerializer = function (serializedItem, sortableContainer) { return serializedItem; }; }\n if (customContainerSerializer === void 0) { customContainerSerializer = function (serializedContainer) { return serializedContainer; }; }\n // check for valid sortableContainer\n if (!(sortableContainer instanceof HTMLElement) || !sortableContainer.isSortable === true) {\n throw new Error('You need to provide a sortableContainer to be serialized.');\n }\n // check for valid serializers\n if (typeof customItemSerializer !== 'function' || typeof customContainerSerializer !== 'function') {\n throw new Error('You need to provide a valid serializer for items and the container.');\n }\n // get options\n var options = addData(sortableContainer, 'opts');\n var item = options.items;\n // serialize container\n var items = _filter(sortableContainer.children, item);\n var serializedItems = items.map(function (item) {\n return {\n parent: sortableContainer,\n node: item,\n html: item.outerHTML,\n index: _index(item, items)\n };\n });\n // serialize container\n var container = {\n node: sortableContainer,\n itemCount: serializedItems.length\n };\n return {\n container: customContainerSerializer(container),\n items: serializedItems.map(function (item) { return customItemSerializer(item, sortableContainer); })\n };\n});\n\n/* eslint-env browser */\n/**\n * create a placeholder element\n * @param {HTMLElement} sortableElement a single sortable\n * @param {string|undefined} placeholder a string representing an html element\n * @param {string} placeholderClasses a string representing the classes that should be added to the placeholder\n */\nvar _makePlaceholder = (function (sortableElement, placeholder, placeholderClass) {\n var _a;\n if (placeholderClass === void 0) { placeholderClass = 'sortable-placeholder'; }\n if (!(sortableElement instanceof HTMLElement)) {\n throw new Error('You must provide a valid element as a sortable.');\n }\n // if placeholder is not an element\n if (!(placeholder instanceof HTMLElement) && placeholder !== undefined) {\n throw new Error('You must provide a valid element as a placeholder or set ot to undefined.');\n }\n // if no placeholder element is given\n if (placeholder === undefined) {\n if (['UL', 'OL'].includes(sortableElement.tagName)) {\n placeholder = document.createElement('li');\n }\n else if (['TABLE', 'TBODY'].includes(sortableElement.tagName)) {\n placeholder = document.createElement('tr');\n // set colspan to always all rows, otherwise the item can only be dropped in first column\n placeholder.innerHTML = '';\n }\n else {\n placeholder = document.createElement('div');\n }\n }\n // add classes to placeholder\n if (typeof placeholderClass === 'string') {\n (_a = placeholder.classList).add.apply(_a, placeholderClass.split(' '));\n }\n return placeholder;\n});\n\n/* eslint-env browser */\n/**\n * Get height of an element including padding\n * @param {HTMLElement} element an dom element\n */\nvar _getElementHeight = (function (element) {\n if (!(element instanceof HTMLElement)) {\n throw new Error('You must provide a valid dom element');\n }\n // get calculated style of element\n var style = window.getComputedStyle(element);\n // get only height if element has box-sizing: border-box specified\n if (style.getPropertyValue('box-sizing') === 'border-box') {\n return parseInt(style.getPropertyValue('height'), 10);\n }\n // pick applicable properties, convert to int and reduce by adding\n return ['height', 'padding-top', 'padding-bottom']\n .map(function (key) {\n var int = parseInt(style.getPropertyValue(key), 10);\n return isNaN(int) ? 0 : int;\n })\n .reduce(function (sum, value) { return sum + value; });\n});\n\n/* eslint-env browser */\n/**\n * Get width of an element including padding\n * @param {HTMLElement} element an dom element\n */\nvar _getElementWidth = (function (element) {\n if (!(element instanceof HTMLElement)) {\n throw new Error('You must provide a valid dom element');\n }\n // get calculated style of element\n var style = window.getComputedStyle(element);\n // pick applicable properties, convert to int and reduce by adding\n return ['width', 'padding-left', 'padding-right']\n .map(function (key) {\n var int = parseInt(style.getPropertyValue(key), 10);\n return isNaN(int) ? 0 : int;\n })\n .reduce(function (sum, value) { return sum + value; });\n});\n\n/* eslint-env browser */\n/**\n * get handle or return item\n * @param {Array} items\n * @param {string} selector\n */\nvar _getHandles = (function (items, selector) {\n if (!(items instanceof Array)) {\n throw new Error('You must provide a Array of HTMLElements to be filtered.');\n }\n if (typeof selector !== 'string') {\n return items;\n }\n return items\n // remove items without handle from array\n .filter(function (item) {\n return item.querySelector(selector) instanceof HTMLElement ||\n (item.shadowRoot && item.shadowRoot.querySelector(selector) instanceof HTMLElement);\n })\n // replace item with handle in array\n .map(function (item) {\n return item.querySelector(selector) || (item.shadowRoot && item.shadowRoot.querySelector(selector));\n });\n});\n\n/**\n * @param {Event} event\n * @returns {HTMLElement}\n */\nvar getEventTarget = (function (event) {\n return (event.composedPath && event.composedPath()[0]) || event.target;\n});\n\n/* eslint-env browser */\n/**\n * defaultDragImage returns the current item as dragged image\n * @param {HTMLElement} draggedElement - the item that the user drags\n * @param {object} elementOffset - an object with the offsets top, left, right & bottom\n * @param {Event} event - the original drag event object\n * @return {object} with element, posX and posY properties\n */\nvar defaultDragImage = function (draggedElement, elementOffset, event) {\n return {\n element: draggedElement,\n posX: event.pageX - elementOffset.left,\n posY: event.pageY - elementOffset.top\n };\n};\n/**\n * attaches an element as the drag image to an event\n * @param {Event} event - the original drag event object\n * @param {HTMLElement} draggedElement - the item that the user drags\n * @param {Function} customDragImage - function to create a custom dragImage\n * @return void\n */\nvar setDragImage = (function (event, draggedElement, customDragImage) {\n // check if event is provided\n if (!(event instanceof Event)) {\n throw new Error('setDragImage requires a DragEvent as the first argument.');\n }\n // check if draggedElement is provided\n if (!(draggedElement instanceof HTMLElement)) {\n throw new Error('setDragImage requires the dragged element as the second argument.');\n }\n // set default function of none provided\n if (!customDragImage) {\n customDragImage = defaultDragImage;\n }\n // check if setDragImage method is available\n if (event.dataTransfer && event.dataTransfer.setDragImage) {\n // get the elements offset\n var elementOffset = _offset(draggedElement);\n // get the dragImage\n var dragImage = customDragImage(draggedElement, elementOffset, event);\n // check if custom function returns correct values\n if (!(dragImage.element instanceof HTMLElement) || typeof dragImage.posX !== 'number' || typeof dragImage.posY !== 'number') {\n throw new Error('The customDragImage function you provided must return and object with the properties element[string], posX[integer], posY[integer].');\n }\n // needs to be set for HTML5 drag & drop to work\n event.dataTransfer.effectAllowed = 'copyMove';\n // Firefox requires it to use the event target's id for the data\n event.dataTransfer.setData('text/plain', getEventTarget(event).id);\n // set the drag image on the event\n event.dataTransfer.setDragImage(dragImage.element, dragImage.posX, dragImage.posY);\n }\n});\n\n/**\n * Check if curList accepts items from destList\n * @param {sortable} destination the container an item is move to\n * @param {sortable} origin the container an item comes from\n */\nvar _listsConnected = (function (destination, origin) {\n // check if valid sortable\n if (destination.isSortable === true) {\n var acceptFrom = store(destination).getConfig('acceptFrom');\n // check if acceptFrom is valid\n if (acceptFrom !== null && acceptFrom !== false && typeof acceptFrom !== 'string') {\n throw new Error('HTML5Sortable: Wrong argument, \"acceptFrom\" must be \"null\", \"false\", or a valid selector string.');\n }\n if (acceptFrom !== null) {\n return acceptFrom !== false && acceptFrom.split(',').filter(function (sel) {\n return sel.length > 0 && origin.matches(sel);\n }).length > 0;\n }\n // drop in same list\n if (destination === origin) {\n return true;\n }\n // check if lists are connected with connectWith\n if (store(destination).getConfig('connectWith') !== undefined && store(destination).getConfig('connectWith') !== null) {\n return store(destination).getConfig('connectWith') === store(origin).getConfig('connectWith');\n }\n }\n return false;\n});\n\n/**\n * default configurations\n */\nvar defaultConfiguration = {\n items: null,\n // deprecated\n connectWith: null,\n // deprecated\n disableIEFix: null,\n acceptFrom: null,\n copy: false,\n placeholder: null,\n placeholderClass: 'sortable-placeholder',\n draggingClass: 'sortable-dragging',\n hoverClass: false,\n dropTargetContainerClass: false,\n debounce: 0,\n throttleTime: 100,\n maxItems: 0,\n itemSerializer: undefined,\n containerSerializer: undefined,\n customDragImage: null,\n orientation: 'vertical'\n};\n\n/**\n * make sure a function is only called once within the given amount of time\n * @param {Function} fn the function to throttle\n * @param {number} threshold time limit for throttling\n */\n// must use function to keep this context\nfunction _throttle (fn, threshold) {\n var _this = this;\n if (threshold === void 0) { threshold = 250; }\n // check function\n if (typeof fn !== 'function') {\n throw new Error('You must provide a function as the first argument for throttle.');\n }\n // check threshold\n if (typeof threshold !== 'number') {\n throw new Error('You must provide a number as the second argument for throttle.');\n }\n var lastEventTimestamp = null;\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var now = Date.now();\n if (lastEventTimestamp === null || now - lastEventTimestamp >= threshold) {\n lastEventTimestamp = now;\n fn.apply(_this, args);\n }\n };\n}\n\n/* eslint-env browser */\n/**\n * enable or disable hoverClass on mouseenter/leave if container Items\n * @param {sortable} sortableContainer a valid sortableContainer\n * @param {boolean} enable enable or disable event\n */\n// export default (sortableContainer: sortable, enable: boolean) => {\nvar enableHoverClass = (function (sortableContainer, enable) {\n if (typeof store(sortableContainer).getConfig('hoverClass') === 'string') {\n var hoverClasses_1 = store(sortableContainer).getConfig('hoverClass').split(' ');\n // add class on hover\n if (enable === true) {\n addEventListener(sortableContainer, 'mousemove', _throttle(function (event) {\n // check of no mouse button was pressed when mousemove started == no drag\n if (event.buttons === 0) {\n _filter(sortableContainer.children, store(sortableContainer).getConfig('items')).forEach(function (item) {\n var _a, _b;\n if (item !== event.target) {\n (_a = item.classList).remove.apply(_a, hoverClasses_1);\n }\n else {\n (_b = item.classList).add.apply(_b, hoverClasses_1);\n }\n });\n }\n }, store(sortableContainer).getConfig('throttleTime')));\n // remove class on leave\n addEventListener(sortableContainer, 'mouseleave', function () {\n _filter(sortableContainer.children, store(sortableContainer).getConfig('items')).forEach(function (item) {\n var _a;\n (_a = item.classList).remove.apply(_a, hoverClasses_1);\n });\n });\n // remove events\n }\n else {\n removeEventListener(sortableContainer, 'mousemove');\n removeEventListener(sortableContainer, 'mouseleave');\n }\n }\n});\n\n/* eslint-env browser */\n/*\n * variables global to the plugin\n */\nvar dragging;\nvar draggingHeight;\nvar draggingWidth;\n/*\n * Keeps track of the initialy selected list, where 'dragstart' event was triggered\n * It allows us to move the data in between individual Sortable List instances\n */\n// Origin List - data from before any item was changed\nvar originContainer;\nvar originIndex;\nvar originElementIndex;\nvar originItemsBeforeUpdate;\n// Previous Sortable Container - we dispatch as sortenter event when a\n// dragged item enters a sortableContainer for the first time\nvar previousContainer;\n// Destination List - data from before any item was changed\nvar destinationItemsBeforeUpdate;\n/**\n * remove event handlers from items\n * @param {Array|NodeList} items\n */\nvar _removeItemEvents = function (items) {\n removeEventListener(items, 'dragstart');\n removeEventListener(items, 'dragend');\n removeEventListener(items, 'dragover');\n removeEventListener(items, 'dragenter');\n removeEventListener(items, 'drop');\n removeEventListener(items, 'mouseenter');\n removeEventListener(items, 'mouseleave');\n};\n// Remove container events\nvar _removeContainerEvents = function (originContainer, previousContainer) {\n if (originContainer) {\n removeEventListener(originContainer, 'dragleave');\n }\n if (previousContainer && (previousContainer !== originContainer)) {\n removeEventListener(previousContainer, 'dragleave');\n }\n};\n/**\n * _getDragging returns the current element to drag or\n * a copy of the element.\n * Is Copy Active for sortable\n * @param {HTMLElement} draggedItem - the item that the user drags\n * @param {HTMLElement} sortable a single sortable\n */\nvar _getDragging = function (draggedItem, sortable) {\n var ditem = draggedItem;\n if (store(sortable).getConfig('copy') === true) {\n ditem = draggedItem.cloneNode(true);\n addAttribute(ditem, 'aria-copied', 'true');\n draggedItem.parentElement.appendChild(ditem);\n ditem.style.display = 'none';\n ditem.oldDisplay = draggedItem.style.display;\n }\n return ditem;\n};\n/**\n * Remove data from sortable\n * @param {HTMLElement} sortable a single sortable\n */\nvar _removeSortableData = function (sortable) {\n removeData(sortable);\n removeAttribute(sortable, 'aria-dropeffect');\n};\n/**\n * Remove data from items\n * @param {Array|HTMLElement} items\n */\nvar _removeItemData = function (items) {\n removeAttribute(items, 'aria-grabbed');\n removeAttribute(items, 'aria-copied');\n removeAttribute(items, 'draggable');\n removeAttribute(items, 'role');\n};\n/**\n * find sortable from element. travels up parent element until found or null.\n * @param {HTMLElement} element a single sortable\n * @param {Event} event - the current event. We need to pass it to be able to\n * find Sortable whith shadowRoot (document fragment has no parent)\n */\nfunction findSortable(element, event) {\n if (event.composedPath) {\n return event.composedPath().find(function (el) { return el.isSortable; });\n }\n while (element.isSortable !== true) {\n element = element.parentElement;\n }\n return element;\n}\n/**\n * Dragging event is on the sortable element. finds the top child that\n * contains the element.\n * @param {HTMLElement} sortableElement a single sortable\n * @param {HTMLElement} element is that being dragged\n */\nfunction findDragElement(sortableElement, element) {\n var options = addData(sortableElement, 'opts');\n var items = _filter(sortableElement.children, options.items);\n var itemlist = items.filter(function (ele) {\n return ele.contains(element) || (ele.shadowRoot && ele.shadowRoot.contains(element));\n });\n return itemlist.length > 0 ? itemlist[0] : element;\n}\n/**\n * Destroy the sortable\n * @param {HTMLElement} sortableElement a single sortable\n */\nvar _destroySortable = function (sortableElement) {\n var opts = addData(sortableElement, 'opts') || {};\n var items = _filter(sortableElement.children, opts.items);\n var handles = _getHandles(items, opts.handle);\n // remove event handlers & data from sortable\n removeEventListener(sortableElement, 'dragover');\n removeEventListener(sortableElement, 'dragenter');\n removeEventListener(sortableElement, 'dragstart');\n removeEventListener(sortableElement, 'dragend');\n removeEventListener(sortableElement, 'drop');\n // remove event data from sortable\n _removeSortableData(sortableElement);\n // remove event handlers & data from items\n removeEventListener(handles, 'mousedown');\n _removeItemEvents(items);\n _removeItemData(items);\n _removeContainerEvents(originContainer, previousContainer);\n // clear sortable flag\n sortableElement.isSortable = false;\n};\n/**\n * Enable the sortable\n * @param {HTMLElement} sortableElement a single sortable\n */\nvar _enableSortable = function (sortableElement) {\n var opts = addData(sortableElement, 'opts');\n var items = _filter(sortableElement.children, opts.items);\n var handles = _getHandles(items, opts.handle);\n addAttribute(sortableElement, 'aria-dropeffect', 'move');\n addData(sortableElement, '_disabled', 'false');\n addAttribute(handles, 'draggable', 'true');\n // @todo: remove this fix\n // IE FIX for ghost\n // can be disabled as it has the side effect that other events\n // (e.g. click) will be ignored\n if (opts.disableIEFix === false) {\n var spanEl = (document || window.document).createElement('span');\n if (typeof spanEl.dragDrop === 'function') {\n addEventListener(handles, 'mousedown', function () {\n if (items.indexOf(this) !== -1) {\n this.dragDrop();\n }\n else {\n var parent = this.parentElement;\n while (items.indexOf(parent) === -1) {\n parent = parent.parentElement;\n }\n parent.dragDrop();\n }\n });\n }\n }\n};\n/**\n * Disable the sortable\n * @param {HTMLElement} sortableElement a single sortable\n */\nvar _disableSortable = function (sortableElement) {\n var opts = addData(sortableElement, 'opts');\n var items = _filter(sortableElement.children, opts.items);\n var handles = _getHandles(items, opts.handle);\n addAttribute(sortableElement, 'aria-dropeffect', 'none');\n addData(sortableElement, '_disabled', 'true');\n addAttribute(handles, 'draggable', 'false');\n removeEventListener(handles, 'mousedown');\n};\n/**\n * Reload the sortable\n * @param {HTMLElement} sortableElement a single sortable\n * @description events need to be removed to not be double bound\n */\nvar _reloadSortable = function (sortableElement) {\n var opts = addData(sortableElement, 'opts');\n var items = _filter(sortableElement.children, opts.items);\n var handles = _getHandles(items, opts.handle);\n addData(sortableElement, '_disabled', 'false');\n // remove event handlers from items\n _removeItemEvents(items);\n _removeContainerEvents(originContainer, previousContainer);\n removeEventListener(handles, 'mousedown');\n // remove event handlers from sortable\n removeEventListener(sortableElement, 'dragover');\n removeEventListener(sortableElement, 'dragenter');\n removeEventListener(sortableElement, 'drop');\n};\n/**\n * Public sortable object\n * @param {Array|NodeList} sortableElements\n * @param {object|string} options|method\n */\nfunction sortable(sortableElements, options) {\n // get method string to see if a method is called\n var method = String(options);\n options = options || {};\n // check if the user provided a selector instead of an element\n if (typeof sortableElements === 'string') {\n sortableElements = document.querySelectorAll(sortableElements);\n }\n // if the user provided an element, return it in an array to keep the return value consistant\n if (sortableElements instanceof HTMLElement) {\n sortableElements = [sortableElements];\n }\n sortableElements = Array.prototype.slice.call(sortableElements);\n if (/serialize/.test(method)) {\n return sortableElements.map(function (sortableContainer) {\n var opts = addData(sortableContainer, 'opts');\n return _serialize(sortableContainer, opts.itemSerializer, opts.containerSerializer);\n });\n }\n sortableElements.forEach(function (sortableElement) {\n if (/enable|disable|destroy/.test(method)) {\n return sortable[method](sortableElement);\n }\n // log deprecation\n ['connectWith', 'disableIEFix'].forEach(function (configKey) {\n if (Object.prototype.hasOwnProperty.call(options, configKey) && options[configKey] !== null) {\n console.warn(\"HTML5Sortable: You are using the deprecated configuration \\\"\" + configKey + \"\\\". This will be removed in an upcoming version, make sure to migrate to the new options when updating.\");\n }\n });\n // merge options with default options\n options = Object.assign({}, defaultConfiguration, store(sortableElement).config, options);\n // init data store for sortable\n store(sortableElement).config = options;\n // set options on sortable\n addData(sortableElement, 'opts', options);\n // property to define as sortable\n sortableElement.isSortable = true;\n // reset sortable\n _reloadSortable(sortableElement);\n // initialize\n var listItems = _filter(sortableElement.children, options.items);\n // create element if user defined a placeholder element as a string\n var customPlaceholder;\n if (options.placeholder !== null && options.placeholder !== undefined) {\n var tempContainer = document.createElement(sortableElement.tagName);\n if (options.placeholder instanceof HTMLElement) {\n tempContainer.appendChild(options.placeholder);\n }\n else {\n tempContainer.innerHTML = options.placeholder;\n }\n customPlaceholder = tempContainer.children[0];\n }\n // add placeholder\n store(sortableElement).placeholder = _makePlaceholder(sortableElement, customPlaceholder, options.placeholderClass);\n addData(sortableElement, 'items', options.items);\n if (options.acceptFrom) {\n addData(sortableElement, 'acceptFrom', options.acceptFrom);\n }\n else if (options.connectWith) {\n addData(sortableElement, 'connectWith', options.connectWith);\n }\n _enableSortable(sortableElement);\n addAttribute(listItems, 'role', 'option');\n addAttribute(listItems, 'aria-grabbed', 'false');\n // enable hover class\n enableHoverClass(sortableElement, true);\n /*\n Handle drag events on draggable items\n Handle is set at the sortableElement level as it will bubble up\n from the item\n */\n addEventListener(sortableElement, 'dragstart', function (e) {\n // ignore dragstart events\n var target = getEventTarget(e);\n if (target.isSortable === true) {\n return;\n }\n e.stopImmediatePropagation();\n if ((options.handle && !target.matches(options.handle)) || target.getAttribute('draggable') === 'false') {\n return;\n }\n var sortableContainer = findSortable(target, e);\n var dragItem = findDragElement(sortableContainer, target);\n // grab values\n originItemsBeforeUpdate = _filter(sortableContainer.children, options.items);\n originIndex = originItemsBeforeUpdate.indexOf(dragItem);\n originElementIndex = _index(dragItem, sortableContainer.children);\n originContainer = sortableContainer;\n // add transparent clone or other ghost to cursor\n setDragImage(e, dragItem, options.customDragImage);\n // cache selsection & add attr for dragging\n draggingHeight = _getElementHeight(dragItem);\n draggingWidth = _getElementWidth(dragItem);\n dragItem.classList.add(options.draggingClass);\n dragging = _getDragging(dragItem, sortableContainer);\n addAttribute(dragging, 'aria-grabbed', 'true');\n // dispatch sortstart event on each element in group\n sortableContainer.dispatchEvent(new CustomEvent('sortstart', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: originContainer\n },\n item: dragging,\n originalTarget: target\n }\n }));\n });\n /*\n We are capturing targetSortable before modifications with 'dragenter' event\n */\n addEventListener(sortableElement, 'dragenter', function (e) {\n var target = getEventTarget(e);\n var sortableContainer = findSortable(target, e);\n if (sortableContainer && sortableContainer !== previousContainer) {\n destinationItemsBeforeUpdate = _filter(sortableContainer.children, addData(sortableContainer, 'items'))\n .filter(function (item) { return item !== store(sortableElement).placeholder; });\n if (options.dropTargetContainerClass) {\n sortableContainer.classList.add(options.dropTargetContainerClass);\n }\n sortableContainer.dispatchEvent(new CustomEvent('sortenter', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: originContainer\n },\n destination: {\n container: sortableContainer,\n itemsBeforeUpdate: destinationItemsBeforeUpdate\n },\n item: dragging,\n originalTarget: target\n }\n }));\n addEventListener(sortableContainer, 'dragleave', function (e) {\n // TODO: rename outTarget to be more self-explanatory\n // e.fromElement for very old browsers, similar to relatedTarget\n var outTarget = e.relatedTarget || e.fromElement;\n if (!e.currentTarget.contains(outTarget)) {\n if (options.dropTargetContainerClass) {\n sortableContainer.classList.remove(options.dropTargetContainerClass);\n }\n sortableContainer.dispatchEvent(new CustomEvent('sortleave', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: sortableContainer\n },\n item: dragging,\n originalTarget: target\n }\n }));\n }\n });\n }\n previousContainer = sortableContainer;\n });\n /*\n * Dragend Event - https://developer.mozilla.org/en-US/docs/Web/Events/dragend\n * Fires each time dragEvent end, or ESC pressed\n * We are using it to clean up any draggable elements and placeholders\n */\n addEventListener(sortableElement, 'dragend', function (e) {\n if (!dragging) {\n return;\n }\n dragging.classList.remove(options.draggingClass);\n addAttribute(dragging, 'aria-grabbed', 'false');\n if (dragging.getAttribute('aria-copied') === 'true' && addData(dragging, 'dropped') !== 'true') {\n dragging.remove();\n }\n dragging.style.display = dragging.oldDisplay;\n delete dragging.oldDisplay;\n var visiblePlaceholder = Array.from(stores.values()).map(function (data) { return data.placeholder; })\n .filter(function (placeholder) { return placeholder instanceof HTMLElement; })\n .filter(isInDom)[0];\n if (visiblePlaceholder) {\n visiblePlaceholder.remove();\n }\n // dispatch sortstart event on each element in group\n sortableElement.dispatchEvent(new CustomEvent('sortstop', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: originContainer\n },\n item: dragging\n }\n }));\n previousContainer = null;\n dragging = null;\n draggingHeight = null;\n draggingWidth = null;\n });\n /*\n * Drop Event - https://developer.mozilla.org/en-US/docs/Web/Events/drop\n * Fires when valid drop target area is hit\n */\n addEventListener(sortableElement, 'drop', function (e) {\n if (!_listsConnected(sortableElement, dragging.parentElement)) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n addData(dragging, 'dropped', 'true');\n // get the one placeholder that is currently visible\n var visiblePlaceholder = Array.from(stores.values()).map(function (data) {\n return data.placeholder;\n })\n // filter only HTMLElements\n .filter(function (placeholder) { return placeholder instanceof HTMLElement; })\n // filter only elements in DOM\n .filter(isInDom)[0];\n // attach element after placeholder\n insertAfter(visiblePlaceholder, dragging);\n // remove placeholder from dom\n visiblePlaceholder.remove();\n /*\n * Fires Custom Event - 'sortstop'\n */\n sortableElement.dispatchEvent(new CustomEvent('sortstop', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: originContainer\n },\n item: dragging\n }\n }));\n var placeholder = store(sortableElement).placeholder;\n var originItems = _filter(originContainer.children, options.items)\n .filter(function (item) { return item !== placeholder; });\n var destinationContainer = this.isSortable === true ? this : this.parentElement;\n var destinationItems = _filter(destinationContainer.children, addData(destinationContainer, 'items'))\n .filter(function (item) { return item !== placeholder; });\n var destinationElementIndex = _index(dragging, Array.from(dragging.parentElement.children)\n .filter(function (item) { return item !== placeholder; }));\n var destinationIndex = _index(dragging, destinationItems);\n if (options.dropTargetContainerClass) {\n destinationContainer.classList.remove(options.dropTargetContainerClass);\n }\n /*\n * When a list item changed container lists or index within a list\n * Fires Custom Event - 'sortupdate'\n */\n if (originElementIndex !== destinationElementIndex || originContainer !== destinationContainer) {\n sortableElement.dispatchEvent(new CustomEvent('sortupdate', {\n detail: {\n origin: {\n elementIndex: originElementIndex,\n index: originIndex,\n container: originContainer,\n itemsBeforeUpdate: originItemsBeforeUpdate,\n items: originItems\n },\n destination: {\n index: destinationIndex,\n elementIndex: destinationElementIndex,\n container: destinationContainer,\n itemsBeforeUpdate: destinationItemsBeforeUpdate,\n items: destinationItems\n },\n item: dragging\n }\n }));\n }\n });\n var debouncedDragOverEnter = _debounce(function (sortableElement, element, pageX, pageY) {\n if (!dragging) {\n return;\n }\n // set placeholder height if forcePlaceholderSize option is set\n if (options.forcePlaceholderSize) {\n store(sortableElement).placeholder.style.height = draggingHeight + 'px';\n store(sortableElement).placeholder.style.width = draggingWidth + 'px';\n }\n // if element the draggedItem is dragged onto is within the array of all elements in list\n // (not only items, but also disabled, etc.)\n if (Array.from(sortableElement.children).indexOf(element) > -1) {\n var thisHeight = _getElementHeight(element);\n var thisWidth = _getElementWidth(element);\n var placeholderIndex = _index(store(sortableElement).placeholder, element.parentElement.children);\n var thisIndex = _index(element, element.parentElement.children);\n // Check if `element` is bigger than the draggable. If it is, we have to define a dead zone to prevent flickering\n if (thisHeight > draggingHeight || thisWidth > draggingWidth) {\n // Dead zone?\n var deadZoneVertical = thisHeight - draggingHeight;\n var deadZoneHorizontal = thisWidth - draggingWidth;\n var offsetTop = _offset(element).top;\n var offsetLeft = _offset(element).left;\n if (placeholderIndex < thisIndex &&\n ((options.orientation === 'vertical' && pageY < offsetTop) ||\n (options.orientation === 'horizontal' && pageX < offsetLeft))) {\n return;\n }\n if (placeholderIndex > thisIndex &&\n ((options.orientation === 'vertical' && pageY > offsetTop + thisHeight - deadZoneVertical) ||\n (options.orientation === 'horizontal' && pageX > offsetLeft + thisWidth - deadZoneHorizontal))) {\n return;\n }\n }\n if (dragging.oldDisplay === undefined) {\n dragging.oldDisplay = dragging.style.display;\n }\n if (dragging.style.display !== 'none') {\n dragging.style.display = 'none';\n }\n // To avoid flicker, determine where to position the placeholder\n // based on where the mouse pointer is relative to the elements\n // vertical center.\n var placeAfter = false;\n try {\n var elementMiddleVertical = _offset(element).top + element.offsetHeight / 2;\n var elementMiddleHorizontal = _offset(element).left + element.offsetWidth / 2;\n placeAfter = (options.orientation === 'vertical' && (pageY >= elementMiddleVertical)) ||\n (options.orientation === 'horizontal' && (pageX >= elementMiddleHorizontal));\n }\n catch (e) {\n placeAfter = placeholderIndex < thisIndex;\n }\n if (placeAfter) {\n insertAfter(element, store(sortableElement).placeholder);\n }\n else {\n insertBefore(element, store(sortableElement).placeholder);\n }\n // get placeholders from all stores & remove all but current one\n Array.from(stores.values())\n // remove empty values\n .filter(function (data) { return data.placeholder !== undefined; })\n // foreach placeholder in array if outside of current sorableContainer -> remove from DOM\n .forEach(function (data) {\n if (data.placeholder !== store(sortableElement).placeholder) {\n data.placeholder.remove();\n }\n });\n }\n else {\n // get all placeholders from store\n var placeholders = Array.from(stores.values())\n .filter(function (data) { return data.placeholder !== undefined; })\n .map(function (data) {\n return data.placeholder;\n });\n // check if element is not in placeholders\n if (placeholders.indexOf(element) === -1 && sortableElement === element && !_filter(element.children, options.items).length) {\n placeholders.forEach(function (element) { return element.remove(); });\n element.appendChild(store(sortableElement).placeholder);\n }\n }\n }, options.debounce);\n // Handle dragover and dragenter events on draggable items\n var onDragOverEnter = function (e) {\n var element = e.target;\n var sortableElement = element.isSortable === true ? element : findSortable(element, e);\n element = findDragElement(sortableElement, element);\n if (!dragging || !_listsConnected(sortableElement, dragging.parentElement) || addData(sortableElement, '_disabled') === 'true') {\n return;\n }\n var options = addData(sortableElement, 'opts');\n if (parseInt(options.maxItems) && _filter(sortableElement.children, addData(sortableElement, 'items')).length >= parseInt(options.maxItems) && dragging.parentElement !== sortableElement) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n e.dataTransfer.dropEffect = store(sortableElement).getConfig('copy') === true ? 'copy' : 'move';\n debouncedDragOverEnter(sortableElement, element, e.pageX, e.pageY);\n };\n addEventListener(listItems.concat(sortableElement), 'dragover', onDragOverEnter);\n addEventListener(listItems.concat(sortableElement), 'dragenter', onDragOverEnter);\n });\n return sortableElements;\n}\nsortable.destroy = function (sortableElement) {\n _destroySortable(sortableElement);\n};\nsortable.enable = function (sortableElement) {\n _enableSortable(sortableElement);\n};\nsortable.disable = function (sortableElement) {\n _disableSortable(sortableElement);\n};\n/* START.TESTS_ONLY */\nsortable.__testing = {\n // add internal methods here for testing purposes\n _data: addData,\n _removeItemEvents: _removeItemEvents,\n _removeItemData: _removeItemData,\n _removeSortableData: _removeSortableData,\n _removeContainerEvents: _removeContainerEvents\n};\n\nexport default sortable;\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/icon'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/extractText'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/ItemList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/withAttr'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","import app from 'flarum/admin/app';\nimport icon from 'flarum/common/helpers/icon';\nimport extractText from 'flarum/common/utils/extractText';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport withAttr from 'flarum/common/utils/withAttr';\nimport Button from 'flarum/common/components/Button';\nimport Switch from 'flarum/common/components/Switch';\n\n/* global m, dayjs */\n\nexport default class PolicyEdit {\n oninit(vnode) {\n this.policy = vnode.attrs.policy;\n this.dirty = false;\n this.processing = false;\n this.toggleFields = false;\n\n if (this.policy === null) {\n this.initNewField();\n }\n }\n\n initNewField() {\n this.policy = app.store.createRecord('fof-terms-policies', {\n attributes: {\n name: '',\n url: '',\n update_message: '',\n terms_updated_at: '',\n optional: false,\n additional_info: {},\n },\n });\n }\n\n boxTitle() {\n if (this.policy.exists) {\n return this.policy.name();\n }\n\n return app.translator.trans('fof-terms.admin.buttons.new-policy');\n }\n\n view() {\n return m('.FoF-Terms-Policiy-Box', [\n this.policy.exists ? m('span.fas.fa-arrows-alt.FoF-Terms-Policiy-Box--handle.js-policy-handle') : null,\n m(\n '.Button.Button--block.FoF-Terms-Policiy-Header',\n {\n onclick: () => {\n this.toggleFields = !this.toggleFields;\n },\n },\n [\n m('.FoF-Terms-Policiy-Header-Title', this.boxTitle()),\n m('div', [\n this.policy.exists ? [app.translator.trans('fof-terms.admin.buttons.edit-policy'), ' '] : null,\n icon(this.toggleFields ? 'fas fa-chevron-up' : 'fas fa-chevron-down'),\n ]),\n ]\n ),\n this.toggleFields ? this.viewFields() : null,\n ]);\n }\n\n viewFields() {\n return m(\n 'form.FoF-Terms-Policiy-Body',\n {\n onsubmit: this.savePolicy.bind(this),\n },\n [\n this.fields().toArray(),\n m('.ButtonGroup', [\n Button.component(\n {\n type: 'submit',\n className: 'Button Button--primary',\n loading: this.processing,\n disabled: !this.readyToSave(),\n },\n app.translator.trans('fof-terms.admin.buttons.' + (this.policy.exists ? 'save' : 'add') + '-policy')\n ),\n this.policy.exists\n ? Button.component(\n {\n type: 'submit',\n className: 'Button Button--danger',\n loading: this.processing,\n onclick: (event) => this.deletePolicy(event),\n },\n app.translator.trans('fof-terms.admin.buttons.delete-policy')\n )\n : '',\n ]),\n ]\n );\n }\n\n fields() {\n const fields = new ItemList();\n\n fields.add(\n 'name',\n m('.Form-group', [\n m('label', app.translator.trans('fof-terms.admin.policies.name')),\n m('input.FormControl', {\n type: 'text',\n value: this.policy.name(),\n oninput: withAttr('value', this.updateAttribute.bind(this, 'name')),\n }),\n m('.helpText', app.translator.trans('fof-terms.admin.policies.name-help')),\n ]),\n 100\n );\n\n fields.add(\n 'url',\n m('.Form-group', [\n m('label', app.translator.trans('fof-terms.admin.policies.url')),\n m('input.FormControl', {\n type: 'url',\n value: this.policy.url(),\n oninput: withAttr('value', this.updateAttribute.bind(this, 'url')),\n }),\n m('.helpText', app.translator.trans('fof-terms.admin.policies.url-help')),\n ]),\n 95\n );\n\n fields.add(\n 'update-message',\n m('.Form-group', [\n m('label', app.translator.trans('fof-terms.admin.policies.update-message')),\n m('textarea.FormControl', {\n value: this.policy.update_message(),\n oninput: withAttr('value', this.updateAttribute.bind(this, 'update_message')),\n }),\n m('.helpText', app.translator.trans('fof-terms.admin.policies.update-message-help')),\n ]),\n 90\n );\n\n fields.add(\n 'terms-updated-at',\n m('.Form-group', [\n m('label', app.translator.trans('fof-terms.admin.policies.terms-updated-at')),\n m('.FoF-Terms-Input-Group', [\n m('input.FormControl', {\n type: 'text',\n value: this.policy.terms_updated_at(),\n oninput: withAttr('value', this.updateAttribute.bind(this, 'terms_updated_at')),\n placeholder: app.translator.trans('fof-terms.admin.policies.terms-updated-at-placeholder'),\n }),\n Button.component(\n {\n className: 'Button Button--primary',\n onclick: () => {\n // We set the milliseconds to zero because it might otherwise give the impression\n // that we store them, when in fact the date will be stored in a MySQL TIMESTAMP column\n this.updateAttribute('terms_updated_at', dayjs().millisecond(0).toISOString());\n },\n },\n app.translator.trans('fof-terms.admin.buttons.set-to-now')\n ),\n ]),\n m('.helpText', app.translator.trans('fof-terms.admin.policies.terms-updated-at-help')),\n ]),\n 85\n );\n\n fields.add(\n 'optional',\n <>\n
\n
\n \n {\n this.updateAttribute('optional', !this.policy.optional());\n }}\n />\n
\n
{app.translator.trans('fof-terms.admin.policies.optional-help')}
\n
\n ,\n 83\n );\n\n if (this.policy.exists) {\n fields.add(\n 'export-url',\n m('.Form-group', [\n m('label', app.translator.trans('fof-terms.admin.policies.export-url')),\n m(\n '.ButtonGroup',\n ['json', 'csv'].map((format) =>\n m(\n 'a.Button.FoF-Terms-Export-Button',\n {\n href: app.forum.attribute('apiUrl') + '/fof/terms/policies/' + this.policy.id() + '/export.' + format,\n target: '_blank',\n },\n format.toUpperCase()\n )\n )\n ),\n m(\n '.helpText',\n app.translator.trans('fof-terms.admin.policies.export-url-help', {\n a: m('a', {\n href: 'https://github.com/FriendsOfFlarum/terms/wiki/Export-url',\n target: '_blank',\n }),\n })\n ),\n ]),\n 80\n );\n }\n\n return fields;\n }\n\n updateAttribute(attribute, value) {\n this.policy.pushAttributes({\n [attribute]: value,\n });\n this.dirty = true;\n }\n\n readyToSave() {\n return this.dirty;\n }\n\n savePolicy(event) {\n event.preventDefault();\n this.processing = true;\n const createNewRecord = !this.policy.exists;\n this.policy\n .save(this.policy.data.attributes)\n .then(() => {\n if (createNewRecord) {\n this.initNewField();\n this.toggleFields = false;\n }\n\n this.processing = false;\n this.dirty = false;\n\n m.redraw();\n })\n .catch((err) => {\n this.processing = false;\n\n throw err;\n });\n }\n\n deletePolicy(event) {\n event.preventDefault();\n if (\n !confirm(\n extractText(\n app.translator.trans('fof-terms.admin.messages.delete-policy-confirmation', {\n name: this.policy.name(),\n })\n )\n )\n ) {\n return;\n }\n\n this.processing = true;\n\n this.policy\n .delete()\n .then(() => {\n this.processing = false;\n\n m.redraw();\n })\n .catch((err) => {\n this.processing = false;\n\n throw err;\n });\n }\n}\n","export default function (items, attr = 'sort') {\n return items.sort((a, b) => a[attr]() - b[attr]());\n}\n","import sortable from 'html5sortable/dist/html5sortable.es.js';\n\nimport app from 'flarum/admin/app';\nimport PolicyEdit from './PolicyEdit';\nimport sortByAttribute from '../../common/helpers/sortByAttribute';\n\n/* global m */\n\nexport default class PolicyList {\n oninit() {\n app\n .request({\n method: 'GET',\n url: app.forum.attribute('apiUrl') + '/fof/terms/policies',\n })\n .then((result) => {\n app.store.pushPayload(result);\n\n m.redraw();\n });\n }\n\n oncreate(vnode) {\n this.initsortable(vnode);\n }\n\n onupdate(vnode) {\n // We could do this without re-creating the sortable on every redraw, but the current system works well\n // \"If it ain't broken, don't fix it\"\n this.initsortable(vnode);\n }\n\n initsortable(vnode) {\n sortable(vnode.dom.querySelector('.js-policies-container'), {\n handle: '.js-policy-handle',\n })[0].addEventListener('sortupdate', () => {\n const sorting = [].map.call(vnode.dom.querySelectorAll('.js-policy-data'), (element) => element.dataset.id);\n\n this.updateSort(sorting);\n });\n }\n\n view() {\n const policies = app.store.all('fof-terms-policies');\n\n let fieldsList = [];\n\n sortByAttribute(policies).forEach((policy) => {\n // Build array of fields to show.\n fieldsList.push(\n m(\n '.js-policy-data',\n {\n key: policy.id(),\n 'data-id': policy.id(),\n },\n m(PolicyEdit, {\n policy,\n })\n )\n );\n });\n\n return m('div', [\n m('h2', app.translator.trans('fof-terms.admin.titles.policies')),\n m('.FoF-Terms-Policies-Container', [\n m('.js-policies-container', fieldsList),\n m(PolicyEdit, {\n policy: null,\n }),\n ]),\n ]);\n }\n\n updateSort(sorting) {\n app\n .request({\n method: 'POST',\n url: app.forum.attribute('apiUrl') + '/fof/terms/policies/order',\n body: {\n sort: sorting,\n },\n })\n .then((result) => {\n // Update sort attributes\n app.store.pushPayload(result);\n\n m.redraw();\n });\n }\n}\n","import app from 'flarum/admin/app';\nimport ExtensionPage from 'flarum/admin/components/ExtensionPage';\nimport Switch from 'flarum/common/components/Switch';\nimport PolicyList from './PolicyList';\n\nconst settingsPrefix = 'fof-terms.';\nconst translationPrefix = 'fof-terms.admin.settings.';\n\n/* global m */\n\nexport default class TermsSettingsPage extends ExtensionPage {\n content() {\n return m('.ExtensionPage-settings', [\n m('.container', [\n m('.Form-group', [\n m('label', app.translator.trans(translationPrefix + 'field.signup-legal-text')),\n m('textarea.FormControl', {\n bidi: this.setting(settingsPrefix + 'signup-legal-text'),\n }),\n ]),\n m('.Form-group', [\n m(\n 'label',\n Switch.component(\n {\n state: this.setting(settingsPrefix + 'hide-updated-at')() > 0,\n onchange: this.setting(settingsPrefix + 'hide-updated-at'),\n },\n app.translator.trans(translationPrefix + 'field.hide-updated-at')\n )\n ),\n ]),\n m('.Form-group', [\n m('label', app.translator.trans(translationPrefix + 'field.date-format')),\n m('input[type=text].FormControl', {\n bidi: this.setting(settingsPrefix + 'date-format'),\n placeholder: 'YYYY-MM-DD',\n }),\n m(\n '.helpText',\n app.translator.trans(translationPrefix + 'field.date-format-help', {\n a: m('a', {\n href: 'https://day.js.org/docs/en/display/format',\n target: '_blank',\n }),\n })\n ),\n ]),\n this.submitButton(),\n m(PolicyList),\n ]),\n ]);\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Component'];","import Component from 'flarum/common/Component';\n\nexport default class ExtensionData extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n this.keyattr = vnode.attrs.keyattr;\n this.policy = vnode.attrs.policy;\n this.setDirty = vnode.attrs.setDirty;\n this.children = vnode.children;\n\n this.updateAttribute = this.updateAttribute.bind(this); // Bind this to updateAttribute\n }\n\n view() {\n let children =\n typeof this.children[0] === 'function'\n ? this.children[0]({ keyattr: this.keyattr, policy: this.policy, updateAttribute: this.updateAttribute })\n : this.children;\n\n return
{children}
;\n }\n\n updateAttribute(value) {\n let attributes = this.policy.additional_info();\n attributes[this.keyattr] = value;\n this.policy.pushAttributes({\n ['additional_info']: attributes,\n });\n\n this.setDirty();\n }\n}\n","import PolicyEdit from './PolicyEdit';\nimport PolicyList from './PolicyList';\nimport TermsSettingsPage from './TermsSettingsPage';\nimport ExtensionData from './ExtensionData';\n\nexport const components = {\n PolicyEdit,\n PolicyList,\n TermsSettingsPage,\n ExtensionData,\n};\n","import Policy from './Policy';\n\nexport const models = {\n Policy,\n};\n","import sortByAttribute from './sortByAttribute';\n\nexport const helpers = {\n sortByAttribute,\n};\n","import app from 'flarum/admin/app';\nimport Policy from '../common/models/Policy';\nimport TermsSettingsPage from './components/TermsSettingsPage';\n\nexport * from './components';\nexport * from '../common/models';\nexport * from '../common/helpers';\n\napp.initializers.add('fof-terms', () => {\n app.store.models['fof-terms-policies'] = Policy;\n\n app.extensionData\n .for('fof-terms')\n .registerPermission(\n {\n icon: 'fas fa-paperclip',\n label: app.translator.trans('fof-terms.admin.permissions.see-user-policies-state'),\n permission: 'fof-terms.see-user-policies-state',\n },\n 'moderate'\n )\n .registerPermission(\n {\n icon: 'fas fa-paperclip',\n label: app.translator.trans('fof-terms.admin.permissions.postpone-policies-accept'),\n permission: 'fof-terms.postpone-policies-accept',\n },\n 'moderate'\n )\n .registerPermission(\n {\n icon: 'fas fa-paperclip',\n label: app.translator.trans('fof-terms.admin.permissions.export-policies'),\n permission: 'fof-terms.export-policies',\n },\n 'moderate'\n )\n .registerPage(TermsSettingsPage);\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","_setPrototypeOf","p","setPrototypeOf","bind","__proto__","_inheritsLoose","subClass","superClass","create","constructor","Policy","_Model","_this","_len","arguments","length","args","Array","_key","apply","concat","sort","Model","name","url","update_message","terms_updated_at","optional","additional_info","form_key","computed","id","apiEndpoint","this","exists","data","addData","element","undefined","h5s","_filter","nodes","selector","NodeList","HTMLCollection","Error","from","filter","item","nodeType","matches","stores","Map","Store","_config","_placeholder","_data","config","forEach","set","mergedConfig","assign","entries","configurable","setConfig","has","getConfig","placeholder","HTMLElement","setData","getData","deleteData","store","sortableElement","addEventListener","eventName","callback","i","removeEventListener","addAttribute","attribute","setAttribute","removeAttribute","dragging","draggingHeight","draggingWidth","originContainer","originIndex","originElementIndex","originItemsBeforeUpdate","previousContainer","destinationItemsBeforeUpdate","_offset","parentElement","getClientRects","rect","left","window","pageXOffset","right","top","pageYOffset","bottom","_index","elementList","indexOf","isInDom","parentNode","insertNode","referenceNode","newElement","position","insertBefore","nextElementSibling","insertAfter","target","_getElementHeight","style","getComputedStyle","getPropertyValue","parseInt","map","int","isNaN","reduce","sum","_getElementWidth","_getHandles","items","querySelector","shadowRoot","getEventTarget","event","composedPath","defaultDragImage","draggedElement","elementOffset","posX","pageX","posY","pageY","_listsConnected","destination","origin","isSortable","acceptFrom","split","sel","defaultConfiguration","connectWith","disableIEFix","copy","placeholderClass","draggingClass","hoverClass","dropTargetContainerClass","debounce","throttleTime","maxItems","itemSerializer","containerSerializer","customDragImage","orientation","_removeItemEvents","_removeContainerEvents","_removeSortableData","sortable","_removeItemData","findSortable","find","el","findDragElement","options","itemlist","children","ele","contains","_enableSortable","opts","handles","handle","document","createElement","dragDrop","parent","sortableElements","method","String","querySelectorAll","slice","test","sortableContainer","customItemSerializer","customContainerSerializer","serializedItem","serializedContainer","serializedItems","node","html","outerHTML","index","container","itemCount","_serialize","configKey","console","warn","_reloadSortable","customPlaceholder","listItems","tempContainer","tagName","appendChild","innerHTML","_a","includes","classList","add","_makePlaceholder","enable","hoverClasses_1","fn","threshold","lastEventTimestamp","_i","now","Date","_throttle","buttons","_b","remove","enableHoverClass","e","stopImmediatePropagation","getAttribute","dragItem","Event","dataTransfer","setDragImage","dragImage","effectAllowed","draggedItem","ditem","cloneNode","display","oldDisplay","_getDragging","dispatchEvent","CustomEvent","detail","elementIndex","originalTarget","itemsBeforeUpdate","outTarget","relatedTarget","fromElement","currentTarget","visiblePlaceholder","values","preventDefault","stopPropagation","originItems","destinationContainer","destinationItems","destinationElementIndex","destinationIndex","func","wait","timeout","debouncedDragOverEnter","forcePlaceholderSize","height","width","thisHeight","thisWidth","placeholderIndex","thisIndex","deadZoneVertical","deadZoneHorizontal","offsetTop","offsetLeft","placeAfter","elementMiddleVertical","offsetHeight","elementMiddleHorizontal","offsetWidth","placeholders","clearTimeout","setTimeout","onDragOverEnter","dropEffect","destroy","_destroySortable","disable","_disableSortable","__testing","PolicyEdit","_proto","oninit","vnode","policy","attrs","dirty","processing","toggleFields","initNewField","app","createRecord","attributes","boxTitle","trans","view","m","onclick","icon","viewFields","_this2","onsubmit","savePolicy","fields","toArray","Button","type","className","loading","disabled","readyToSave","deletePolicy","_this3","ItemList","oninput","withAttr","updateAttribute","dayjs","millisecond","toISOString","'['","class","Switch","state","onchange","format","href","toUpperCase","_this$policy$pushAttr","pushAttributes","_this4","createNewRecord","save","then","redraw","err","_this5","confirm","extractText","attr","b","PolicyList","result","pushPayload","oncreate","initsortable","onupdate","dom","sorting","dataset","updateSort","policies","all","fieldsList","sortByAttribute","push","body","settingsPrefix","translationPrefix","TermsSettingsPage","_ExtensionPage","content","bidi","setting","submitButton","ExtensionPage","ExtensionData","_Component","keyattr","setDirty","Component","components","models","helpers","registerPermission","label","permission","registerPage"],"sourceRoot":""} \ No newline at end of file diff --git a/js/dist/forum.js b/js/dist/forum.js index 105d3c0..8742969 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,3 @@ -(()=>{var t={n:o=>{var e=o&&o.__esModule?()=>o.default:()=>o;return t.d(e,{a:e}),e},d:(o,e)=>{for(var r in e)t.o(e,r)&&!t.o(o,r)&&Object.defineProperty(o,r,{enumerable:!0,get:e[r]})},o:(t,o)=>Object.prototype.hasOwnProperty.call(t,o),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},o={};(()=>{"use strict";t.r(o),t.d(o,{components:()=>G,helpers:()=>K,models:()=>J});const e=flarum.core.compat["forum/app"];var r=t.n(e);const n=flarum.core.compat["common/Model"];var a=t.n(n);const s=flarum.core.compat["common/models/User"];var c=t.n(s);function i(t,o){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,o){return t.__proto__=o,t},i(t,o)}function f(t,o){t.prototype=Object.create(o.prototype),t.prototype.constructor=t,i(t,o)}const u=flarum.core.compat["common/utils/computed"];var l=t.n(u),p=function(t){function o(){for(var o,e=arguments.length,r=new Array(e),n=0;n1?o-1:0),r=1;r{var t={24:(t,e,r)=>{var o=r(735).default;function n(){"use strict";t.exports=n=function(){return r},t.exports.__esModule=!0,t.exports.default=t.exports;var e,r={},a=Object.prototype,i=a.hasOwnProperty,c=Object.defineProperty||function(t,e,r){t[e]=r.value},s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",f=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function m(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{m({},"")}catch(e){m=function(t,e,r){return t[e]=r}}function p(t,e,r,o){var n=e&&e.prototype instanceof _?e:_,a=Object.create(n.prototype),i=new j(o||[]);return c(a,"_invoke",{value:O(t,r,i)}),a}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=p;var h="suspendedStart",y="suspendedYield",v="executing",g="completed",b={};function _(){}function x(){}function w(){}var P={};m(P,u,(function(){return this}));var k=Object.getPrototypeOf,T=k&&k(k(U([])));T&&T!==a&&i.call(T,u)&&(P=T);var S=w.prototype=_.prototype=Object.create(P);function E(t){["next","throw","return"].forEach((function(e){m(t,e,(function(t){return this._invoke(e,t)}))}))}function L(t,e){function r(n,a,c,s){var u=d(t[n],t,a);if("throw"!==u.type){var f=u.arg,l=f.value;return l&&"object"==o(l)&&i.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,c,s)}),(function(t){r("throw",t,c,s)})):e.resolve(l).then((function(t){f.value=t,c(f)}),(function(t){return r("throw",t,c,s)}))}s(u.arg)}var n;c(this,"_invoke",{value:function(t,o){function a(){return new e((function(e,n){r(t,o,e,n)}))}return n=n?n.then(a,a):a()}})}function O(t,r,o){var n=h;return function(a,i){if(n===v)throw Error("Generator is already running");if(n===g){if("throw"===a)throw i;return{value:e,done:!0}}for(o.method=a,o.arg=i;;){var c=o.delegate;if(c){var s=F(c,o);if(s){if(s===b)continue;return s}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if(n===h)throw n=g,o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);n=v;var u=d(t,r,o);if("normal"===u.type){if(n=o.done?g:y,u.arg===b)continue;return{value:u.arg,done:o.done}}"throw"===u.type&&(n=g,o.method="throw",o.arg=u.arg)}}}function F(t,r){var o=r.method,n=t.iterator[o];if(n===e)return r.delegate=null,"throw"===o&&t.iterator.return&&(r.method="return",r.arg=e,F(t,r),"throw"===r.method)||"return"!==o&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+o+"' method")),b;var a=d(n,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,b;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,b):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,b)}function M(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(M,this),this.reset(!0)}function U(t){if(t||""===t){var r=t[u];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,a=function r(){for(;++n=0;--n){var a=this.tryEntries[n],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=i.call(a,"catchLoc"),u=i.call(a,"finallyLoc");if(s&&u){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&i.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),A(r),b}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var o=r.completion;if("throw"===o.type){var n=o.arg;A(r)}return n}}throw Error("illegal catch attempt")},delegateYield:function(t,r,o){return this.delegate={iterator:U(t),resultName:r,nextLoc:o},"next"===this.method&&(this.arg=e),b}},r}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports},735:t=>{function e(r){return t.exports=e="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.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},183:(t,e,r)=>{var o=r(24)();t.exports=o;try{regeneratorRuntime=o}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}}},e={};function r(o){var n=e[o];if(void 0!==n)return n.exports;var a=e[o]={exports:{}};return t[o](a,a.exports,r),a.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var o in e)r.o(e,o)&&!r.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};(()=>{"use strict";r.r(o),r.d(o,{components:()=>ot,helpers:()=>at,models:()=>nt});const t=flarum.core.compat["forum/app"];var e=r.n(t);const n=flarum.core.compat["common/Model"];var a=r.n(n);const i=flarum.core.compat["common/models/User"];var c=r.n(i);function s(t,e){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},s(t,e)}function u(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,s(t,e)}const f=flarum.core.compat["common/utils/computed"];var l=r.n(f),p=function(t){function e(){for(var e,r=arguments.length,o=new Array(r),n=0;n1?e-1:0),o=1;o {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Model'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/User'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/computed'];","import Model from 'flarum/common/Model';\nimport computed from 'flarum/common/utils/computed';\n\nexport default class Policy extends Model {\n sort = Model.attribute('sort');\n name = Model.attribute('name');\n url = Model.attribute('url');\n update_message = Model.attribute('update_message');\n terms_updated_at = Model.attribute('terms_updated_at');\n form_key = computed('id', (id) => 'fof_terms_policy_' + id);\n\n apiEndpoint() {\n return '/fof/terms/policies' + (this.exists ? '/' + this.data.id : '');\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Page'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/IndexPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Modal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","export default function (items, attr = 'sort') {\n return items.sort((a, b) => a[attr]() - b[attr]());\n}\n","import app from 'flarum/forum/app';\nimport Modal from 'flarum/common/components/Modal';\nimport Button from 'flarum/common/components/Button';\nimport sortByAttribute from '../../common/helpers/sortByAttribute';\n\n/* global m, dayjs */\n\nexport default class AcceptPoliciesModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n app.store.all('fof-terms-policies').forEach((policy) => {\n this[policy.form_key()] = false;\n });\n }\n\n title() {\n return app.translator.trans('fof-terms.forum.accept-modal.title');\n }\n\n className() {\n return 'AcceptPoliciesModal Modal--medium';\n }\n\n content() {\n return m('.Modal-body', this.body());\n }\n\n body() {\n const policies = sortByAttribute(\n app.store.all('fof-terms-policies').filter((policy) => {\n const state = app.session.user.fofTermsPoliciesState()[policy.id()];\n\n return !state || state.has_update;\n })\n );\n\n if (policies.length === 0) {\n return Button.component(\n {\n className: 'Button',\n onclick() {\n app.modal.close();\n },\n },\n app.translator.trans('fof-terms.forum.accept-modal.close')\n );\n }\n\n return policies.map((policy) =>\n m('div', [\n m('h2', policy.name()),\n app.forum.attribute('fof-terms.hide-updated-at')\n ? null\n : m(\n 'p',\n policy.terms_updated_at()\n ? app.translator.trans('fof-terms.forum.accept-modal.updated-at', {\n date: dayjs(policy.terms_updated_at()).format(app.forum.attribute('fof-terms.date-format')),\n })\n : app.translator.trans('fof-terms.forum.accept-modal.updated-recently')\n ),\n policy.update_message() ? m('p', policy.update_message()) : null,\n m(\n '.Form-group',\n m(\n '.FoF-Terms-Check.FoF-Terms-Check--login',\n m('label.checkbox', [\n m('input', {\n type: 'checkbox',\n checked: this[policy.form_key()],\n onchange: () => {\n this[policy.form_key()] = !this[policy.form_key()];\n },\n }),\n app.translator.trans('fof-terms.forum.accept-modal.i-accept', {\n policy: policy.name(),\n a: policy.url()\n ? m('a', {\n href: policy.url(),\n target: '_blank',\n })\n : m('span'),\n }),\n ])\n )\n ),\n Button.component(\n {\n className: 'Button Button--primary',\n disabled: !this[policy.form_key()],\n onclick: () => {\n // We need to save the \"must accept\" property before performing the request\n // Because an updated user serializer will be returned\n const hadToAcceptToInteract = app.session.user.fofTermsPoliciesMustAccept();\n\n app\n .request({\n url: app.forum.attribute('apiUrl') + policy.apiEndpoint() + '/accept',\n method: 'POST',\n errorHandler: this.onerror.bind(this),\n })\n .then((updated) => {\n app.store.pushPayload(updated);\n\n // If this was the last policy to accept, close the modal\n if (policies.length === 1) {\n if (hadToAcceptToInteract) {\n // If the user was previously not allowed to interact with the forum,\n // we refresh to get updated permissions in the frontend\n window.location.reload();\n } else {\n app.modal.close();\n }\n }\n\n m.redraw();\n });\n },\n },\n app.translator.trans('fof-terms.forum.accept-modal.accept')\n ),\n ])\n );\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/SignUpModal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/IndexPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/UserPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/listItems'];","import app from 'flarum/forum/app';\nimport Button from 'flarum/common/components/Button';\nimport listItems from 'flarum/common/helpers/listItems';\nimport AcceptPoliciesModal from './AcceptPoliciesModal';\n\n/* global m */\n\nlet temporarilyHidden = false;\n\n/**\n * Renders similarly to Flarum's Alert, but with an additional .container inside\n */\nexport default class UpdateAlert {\n shouldShowAlert() {\n if (temporarilyHidden) {\n return false;\n }\n\n const user = app.session.user;\n\n return user && user.fofTermsPoliciesHasUpdate();\n }\n\n view() {\n if (!this.shouldShowAlert()) {\n return m('div');\n }\n\n const controls = [\n Button.component(\n {\n className: 'Button Button--link',\n onclick: () => {\n app.modal.show(AcceptPoliciesModal);\n },\n },\n app.translator.trans('fof-terms.forum.update-alert.review')\n ),\n ];\n\n const dismissControl = [];\n\n if (!app.session.user.fofTermsPoliciesMustAccept()) {\n dismissControl.push(\n Button.component({\n icon: 'fas fa-times',\n className: 'Button Button--link Button--icon Alert-dismiss',\n onclick: () => {\n temporarilyHidden = true;\n },\n })\n );\n }\n\n return m(\n '.Alert.Alert-info',\n m('.container', [\n m(\n 'span.Alert-body',\n app.session.user.fofTermsPoliciesMustAccept()\n ? app.translator.trans('fof-terms.forum.update-alert.must-accept-message')\n : app.translator.trans('fof-terms.forum.update-alert.can-accept-message')\n ),\n m('ul.Alert-controls', listItems(controls.concat(dismissControl))),\n ])\n );\n }\n}\n","import { override } from 'flarum/common/extend';\nimport IndexPage from 'flarum/forum/components/IndexPage';\nimport DiscussionPage from 'flarum/forum/components/DiscussionPage';\nimport UserPage from 'flarum/forum/components/UserPage';\nimport UpdateAlert from './components/UpdateAlert';\n\n/* global m */\n\n// This single method will be used to inject the alert into existing components\n// If the view is already an array, we add our content at the start\n// If it isn't an array we wrap the content into a new array\nfunction addAlertToContent(original, ...originalArgs) {\n const existing = original(...originalArgs);\n const additional = m(UpdateAlert);\n\n // if the existing content is an array, add to it\n // This should only happen with the hero() override as other extensions might return an array there\n if (Array.isArray(existing)) {\n existing.unshift(additional);\n\n return existing;\n }\n\n // Otherwise return a new list of elements\n // Use a container div otherwise when extending view() this will prevent the config() method from running\n // as the Component class won't be able to bind config() to an array\n // We could also add to vnode.children but this could cause weird styling if another extension or custom styles\n // change the look of the base page content by targeting the original view root element based on its class\n // By using a new outer container we make sure the alert always stays full width and unaffected by the page view under it\n return m('div', [additional, existing]);\n}\n\nexport default function () {\n // There's no single place we can inject the banner\n // So we use a few different points so it's visible on most pages\n override(IndexPage.prototype, 'hero', addAlertToContent);\n override(DiscussionPage.prototype, 'view', addAlertToContent);\n\n // Covers user profile and settings\n override(UserPage.prototype, 'view', addAlertToContent);\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/UserControls'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/humanTime'];","import app from 'flarum/forum/app';\nimport humanTime from 'flarum/common/helpers/humanTime';\nimport Modal from 'flarum/common/components/Modal';\nimport sortByAttribute from '../../common/helpers/sortByAttribute';\n\n/* global m */\n\nexport default class UserPoliciesStateModal extends Modal {\n title() {\n return app.translator.trans('fof-terms.forum.state-modal.title', {\n username: this.attrs.user.username(),\n });\n }\n\n className() {\n return 'UserPoliciesStateModal Modal--medium';\n }\n\n content() {\n return m(\n '.Modal-body',\n m(\n 'ul',\n sortByAttribute(app.store.all('fof-terms-policies')).map((policy) => {\n const state = this.attrs.user.fofTermsPoliciesState()[policy.id()];\n\n return m('li', [\n policy.name() + ': ',\n state && state.accepted_at\n ? app.translator.trans('fof-terms.forum.state-modal.accepted-at', {\n date: humanTime(state.accepted_at),\n })\n : app.translator.trans('fof-terms.forum.state-modal.not-accepted'),\n ]);\n })\n )\n );\n }\n}\n","import AcceptPoliciesModal from './AcceptPoliciesModal';\nimport UpdateAlert from './UpdateAlert';\nimport UserPoliciesStateModal from './UserPoliciesStateModal';\n\nexport const components = {\n AcceptPoliciesModal,\n UpdateAlert,\n UserPoliciesStateModal,\n};\n","import Policy from './Policy';\n\nexport const models = {\n Policy,\n};\n","import sortByAttribute from './sortByAttribute';\n\nexport const helpers = {\n sortByAttribute,\n};\n","import app from 'flarum/forum/app';\nimport Model from 'flarum/common/Model';\nimport User from 'flarum/common/models/User';\nimport Policy from '../common/models/Policy';\nimport addAcceptModal from './addAcceptModal';\nimport addFieldsToRegister from './addFieldsToRegister';\nimport addUpdateAlert from './addUpdateAlert';\nimport addUserPoliciesStateControl from './addUserPoliciesStateControl';\n\nexport * from './components';\nexport * from '../common/models';\nexport * from '../common/helpers';\n\napp.initializers.add('fof-terms', () => {\n app.store.models['fof-terms-policies'] = Policy;\n\n User.prototype.fofTermsPoliciesState = Model.attribute('fofTermsPoliciesState');\n User.prototype.fofTermsPoliciesHasUpdate = Model.attribute('fofTermsPoliciesHasUpdate');\n User.prototype.fofTermsPoliciesMustAccept = Model.attribute('fofTermsPoliciesMustAccept');\n User.prototype.seeFoFTermsPoliciesState = Model.attribute('seeFoFTermsPoliciesState');\n\n addAcceptModal();\n addFieldsToRegister();\n addUpdateAlert();\n addUserPoliciesStateControl();\n});\n","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport Page from 'flarum/common/components/Page';\nimport IndexPage from 'flarum/common/components/IndexPage';\nimport AcceptPoliciesModal from './components/AcceptPoliciesModal';\n\nexport default function () {\n let initialized = false;\n\n extend(Page.prototype, 'oninit', function () {\n if (initialized) {\n return;\n }\n\n // We only show the modal if the first page loaded was the index page\n // And that new updates are available\n // And that the user *must* accept them\n if (app.current.matches(IndexPage)) {\n const user = app.session.user;\n\n if (user && user.fofTermsPoliciesMustAccept()) {\n // Timeout is necessary because there is a redraw error otherwise\n setTimeout(() => {\n app.modal.show(AcceptPoliciesModal);\n }, 0);\n }\n }\n\n initialized = true;\n });\n}\n","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport SignUpModal from 'flarum/forum/components/SignUpModal';\nimport sortByAttribute from '../common/helpers/sortByAttribute';\n\n/* global m */\n\nexport default function () {\n extend(SignUpModal.prototype, 'oninit', function () {\n this.fofTermsPolicies = sortByAttribute(app.store.all('fof-terms-policies'));\n\n this.fofTermsPolicies.forEach((policy) => {\n this[policy.form_key()] = false;\n });\n });\n\n extend(SignUpModal.prototype, 'fields', function (fields) {\n const legalText = app.forum.attribute('fof-terms.signup-legal-text');\n\n if (legalText) {\n fields.add('fof-terms-legal-text', m('.Form-group', m('.FoF-Terms-SignUp-Legal.Alert', legalText)));\n }\n\n this.fofTermsPolicies.forEach((policy) => {\n fields.add(\n 'fof-terms-policy-' + policy.id(),\n m(\n '.Form-group',\n m(\n '.FoF-Terms-Check.FoF-Terms-Check--signup',\n m('label.checkbox', [\n m('input', {\n type: 'checkbox',\n checked: this[policy.form_key()],\n onchange: () => {\n this[policy.form_key()] = !this[policy.form_key()];\n },\n disabled: this.loading,\n }),\n app.translator.trans('fof-terms.forum.signup.i-accept', {\n policy: policy.name(),\n a: policy.url()\n ? m('a', {\n href: policy.url(),\n target: '_blank',\n })\n : m('span'),\n }),\n ])\n )\n )\n );\n });\n });\n\n extend(SignUpModal.prototype, 'submitData', function (data) {\n this.fofTermsPolicies.forEach((policy) => {\n data[policy.form_key()] = this[policy.form_key()];\n });\n });\n}\n","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport UserControls from 'flarum/forum/utils/UserControls';\nimport Button from 'flarum/common/components/Button';\nimport UserPoliciesStateModal from './components/UserPoliciesStateModal';\n\nexport default function () {\n extend(UserControls, 'moderationControls', (items, user) => {\n if (app.forum.attribute('fof-terms.canSeeUserPoliciesState')) {\n items.add(\n 'fof-terms.state',\n Button.component(\n {\n icon: 'fas fa-paperclip',\n onclick() {\n app.modal.show(UserPoliciesStateModal, { user });\n },\n },\n app.translator.trans('fof-terms.forum.user_controls.state_button')\n )\n );\n }\n });\n}\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","_setPrototypeOf","p","setPrototypeOf","bind","__proto__","_inheritsLoose","subClass","superClass","create","constructor","Policy","_Model","_this","_len","arguments","length","args","Array","_key","apply","concat","sort","Model","name","url","update_message","terms_updated_at","form_key","computed","id","apiEndpoint","this","exists","data","items","attr","b","AcceptPoliciesModal","_Modal","_proto","oninit","vnode","app","all","forEach","policy","title","trans","className","content","m","body","_this2","policies","sortByAttribute","filter","state","user","fofTermsPoliciesState","has_update","Button","onclick","close","map","attribute","date","dayjs","format","type","checked","onchange","href","target","disabled","hadToAcceptToInteract","fofTermsPoliciesMustAccept","method","errorHandler","onerror","then","updated","pushPayload","window","location","reload","redraw","Modal","temporarilyHidden","UpdateAlert","shouldShowAlert","fofTermsPoliciesHasUpdate","view","controls","show","dismissControl","push","icon","listItems","addAlertToContent","original","originalArgs","existing","additional","isArray","unshift","UserPoliciesStateModal","username","attrs","accepted_at","humanTime","components","models","helpers","add","initialized","User","seeFoFTermsPoliciesState","extend","Page","matches","IndexPage","setTimeout","SignUpModal","fofTermsPolicies","fields","legalText","loading","_this3","override","DiscussionPage","UserPage","UserControls"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"forum.js","mappings":";0BAAA,IAAIA,EAAUC,EAAAA,KAAAA,QACd,SAASC,IACP,aACAC,EAAOC,QAAUF,EAAsB,WACrC,OAAOG,CACT,EAAGF,EAAOC,QAAQE,YAAa,EAAMH,EAAOC,QAAiB,QAAID,EAAOC,QACxE,IAAIG,EACFF,EAAI,CAAC,EACLG,EAAIC,OAAOC,UACXC,EAAIH,EAAEI,eACNC,EAAIJ,OAAOK,gBAAkB,SAAUP,EAAGF,EAAGG,GAC3CD,EAAEF,GAAKG,EAAEO,KACX,EACAC,EAAI,mBAAqBC,OAASA,OAAS,CAAC,EAC5CC,EAAIF,EAAEG,UAAY,aAClBC,EAAIJ,EAAEK,eAAiB,kBACvBC,EAAIN,EAAEO,aAAe,gBACvB,SAASC,EAAOjB,EAAGF,EAAGG,GACpB,OAAOC,OAAOK,eAAeP,EAAGF,EAAG,CACjCU,MAAOP,EACPiB,YAAY,EACZC,cAAc,EACdC,UAAU,IACRpB,EAAEF,EACR,CACA,IACEmB,EAAO,CAAC,EAAG,GACb,CAAE,MAAOjB,GACPiB,EAAS,SAAgBjB,EAAGF,EAAGG,GAC7B,OAAOD,EAAEF,GAAKG,CAChB,CACF,CACA,SAASoB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F,SAAQ,eAAAoF,EAAAxC,EAAAvO,IAAAA,MAAE,SAAAgR,EAAOnQ,GAAK,OAAAb,IAAAA,MAAA,SAAAiR,GAAA,cAAAA,EAAAjL,KAAAiL,EAAA5M,MAAA,OAEY,OADhCoM,EAAYtG,EAAOd,MAAMuH,YAAc/P,EACvCuH,EAAK+B,EAAOhB,YAActI,EAAMoQ,EAAA5M,KAAA,EAC1BsK,GAAaxE,EAAQtJ,GAAM,OACjC2J,EAAEgC,SAAS,wBAAAyE,EAAA9K,OAAA,GAAA6K,EAAA,KACZ,gBAAAE,GAAA,OAAAH,EAAArI,MAAA,KAAAJ,UAAA,EALO,IAOP,IACA6B,EAAOrB,MACN0B,EAAC2G,KAAI,CAACtF,OAAO,SAASD,KAAMzB,EAAOrB,OAChCqB,EAAO7E,QAGV6E,EAAO7E,QAKjB,MAED,IAEL,GI1BF","sources":["webpack://@fof/terms/./node_modules/@babel/runtime/helpers/regeneratorRuntime.js","webpack://@fof/terms/./node_modules/@babel/runtime/helpers/typeof.js","webpack://@fof/terms/./node_modules/@babel/runtime/regenerator/index.js","webpack://@fof/terms/webpack/bootstrap","webpack://@fof/terms/webpack/runtime/compat get default export","webpack://@fof/terms/webpack/runtime/define property getters","webpack://@fof/terms/webpack/runtime/hasOwnProperty shorthand","webpack://@fof/terms/webpack/runtime/make namespace object","webpack://@fof/terms/external root \"flarum.core.compat['forum/app']\"","webpack://@fof/terms/external root \"flarum.core.compat['common/Model']\"","webpack://@fof/terms/external root \"flarum.core.compat['common/models/User']\"","webpack://@fof/terms/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@fof/terms/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/terms/external root \"flarum.core.compat['common/utils/computed']\"","webpack://@fof/terms/./src/common/models/Policy.js","webpack://@fof/terms/external root \"flarum.core.compat['common/extend']\"","webpack://@fof/terms/external root \"flarum.core.compat['common/components/Page']\"","webpack://@fof/terms/external root \"flarum.core.compat['common/components/IndexPage']\"","webpack://@fof/terms/external root \"flarum.core.compat['common/components/Modal']\"","webpack://@fof/terms/external root \"flarum.core.compat['common/components/Button']\"","webpack://@fof/terms/./src/common/helpers/sortByAttribute.js","webpack://@fof/terms/./src/forum/components/AcceptPoliciesModal.js","webpack://@fof/terms/external root \"flarum.core.compat['forum/components/SignUpModal']\"","webpack://@fof/terms/external root \"flarum.core.compat['forum/components/IndexPage']\"","webpack://@fof/terms/external root \"flarum.core.compat['forum/components/DiscussionPage']\"","webpack://@fof/terms/external root \"flarum.core.compat['forum/components/UserPage']\"","webpack://@fof/terms/external root \"flarum.core.compat['common/helpers/listItems']\"","webpack://@fof/terms/./src/forum/components/UpdateAlert.js","webpack://@fof/terms/./src/forum/addUpdateAlert.js","webpack://@fof/terms/external root \"flarum.core.compat['forum/utils/UserControls']\"","webpack://@fof/terms/external root \"flarum.core.compat['common/helpers/humanTime']\"","webpack://@fof/terms/./src/forum/components/UserPoliciesStateModal.js","webpack://@fof/terms/./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js","webpack://@fof/terms/external root \"flarum.core.compat['forum/components/SettingsPage']\"","webpack://@fof/terms/external root \"flarum.core.compat['common/components/FieldSet']\"","webpack://@fof/terms/external root \"flarum.core.compat['common/components/Switch']\"","webpack://@fof/terms/external root \"flarum.core.compat['common/components/Link']\"","webpack://@fof/terms/./src/forum/components/addManagePoliciesOption.js","webpack://@fof/terms/./src/forum/components/index.js","webpack://@fof/terms/./src/common/models/index.js","webpack://@fof/terms/./src/common/helpers/index.js","webpack://@fof/terms/./src/forum/index.js","webpack://@fof/terms/./src/forum/addAcceptModal.js","webpack://@fof/terms/./src/forum/addFieldsToRegister.js","webpack://@fof/terms/./src/forum/addUserPoliciesStateControl.js"],"sourcesContent":["var _typeof = require(\"./typeof.js\")[\"default\"];\nfunction _regeneratorRuntime() {\n \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */\n module.exports = _regeneratorRuntime = function _regeneratorRuntime() {\n return e;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n var t,\n e = {},\n r = Object.prototype,\n n = r.hasOwnProperty,\n o = Object.defineProperty || function (t, e, r) {\n t[e] = r.value;\n },\n i = \"function\" == typeof Symbol ? Symbol : {},\n a = i.iterator || \"@@iterator\",\n c = i.asyncIterator || \"@@asyncIterator\",\n u = i.toStringTag || \"@@toStringTag\";\n function define(t, e, r) {\n return Object.defineProperty(t, e, {\n value: r,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }), t[e];\n }\n try {\n define({}, \"\");\n } catch (t) {\n define = function define(t, e, r) {\n return t[e] = r;\n };\n }\n function wrap(t, e, r, n) {\n var i = e && e.prototype instanceof Generator ? e : Generator,\n a = Object.create(i.prototype),\n c = new Context(n || []);\n return o(a, \"_invoke\", {\n value: makeInvokeMethod(t, r, c)\n }), a;\n }\n function tryCatch(t, e, r) {\n try {\n return {\n type: \"normal\",\n arg: t.call(e, r)\n };\n } catch (t) {\n return {\n type: \"throw\",\n arg: t\n };\n }\n }\n e.wrap = wrap;\n var h = \"suspendedStart\",\n l = \"suspendedYield\",\n f = \"executing\",\n s = \"completed\",\n y = {};\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n var p = {};\n define(p, a, function () {\n return this;\n });\n var d = Object.getPrototypeOf,\n v = d && d(d(values([])));\n v && v !== r && n.call(v, a) && (p = v);\n var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);\n function defineIteratorMethods(t) {\n [\"next\", \"throw\", \"return\"].forEach(function (e) {\n define(t, e, function (t) {\n return this._invoke(e, t);\n });\n });\n }\n function AsyncIterator(t, e) {\n function invoke(r, o, i, a) {\n var c = tryCatch(t[r], t, o);\n if (\"throw\" !== c.type) {\n var u = c.arg,\n h = u.value;\n return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) {\n invoke(\"next\", t, i, a);\n }, function (t) {\n invoke(\"throw\", t, i, a);\n }) : e.resolve(h).then(function (t) {\n u.value = t, i(u);\n }, function (t) {\n return invoke(\"throw\", t, i, a);\n });\n }\n a(c.arg);\n }\n var r;\n o(this, \"_invoke\", {\n value: function value(t, n) {\n function callInvokeWithMethodAndArg() {\n return new e(function (e, r) {\n invoke(t, n, e, r);\n });\n }\n return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();\n }\n });\n }\n function makeInvokeMethod(e, r, n) {\n var o = h;\n return function (i, a) {\n if (o === f) throw Error(\"Generator is already running\");\n if (o === s) {\n if (\"throw\" === i) throw a;\n return {\n value: t,\n done: !0\n };\n }\n for (n.method = i, n.arg = a;;) {\n var c = n.delegate;\n if (c) {\n var u = maybeInvokeDelegate(c, n);\n if (u) {\n if (u === y) continue;\n return u;\n }\n }\n if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) {\n if (o === h) throw o = s, n.arg;\n n.dispatchException(n.arg);\n } else \"return\" === n.method && n.abrupt(\"return\", n.arg);\n o = f;\n var p = tryCatch(e, r, n);\n if (\"normal\" === p.type) {\n if (o = n.done ? s : l, p.arg === y) continue;\n return {\n value: p.arg,\n done: n.done\n };\n }\n \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg);\n }\n };\n }\n function maybeInvokeDelegate(e, r) {\n var n = r.method,\n o = e.iterator[n];\n if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y;\n var i = tryCatch(o, e.iterator, r.arg);\n if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y;\n var a = i.arg;\n return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y);\n }\n function pushTryEntry(t) {\n var e = {\n tryLoc: t[0]\n };\n 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);\n }\n function resetTryEntry(t) {\n var e = t.completion || {};\n e.type = \"normal\", delete e.arg, t.completion = e;\n }\n function Context(t) {\n this.tryEntries = [{\n tryLoc: \"root\"\n }], t.forEach(pushTryEntry, this), this.reset(!0);\n }\n function values(e) {\n if (e || \"\" === e) {\n var r = e[a];\n if (r) return r.call(e);\n if (\"function\" == typeof e.next) return e;\n if (!isNaN(e.length)) {\n var o = -1,\n i = function next() {\n for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;\n return next.value = t, next.done = !0, next;\n };\n return i.next = i;\n }\n }\n throw new TypeError(_typeof(e) + \" is not iterable\");\n }\n return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", {\n value: GeneratorFunctionPrototype,\n configurable: !0\n }), o(GeneratorFunctionPrototype, \"constructor\", {\n value: GeneratorFunction,\n configurable: !0\n }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) {\n var e = \"function\" == typeof t && t.constructor;\n return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name));\n }, e.mark = function (t) {\n return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t;\n }, e.awrap = function (t) {\n return {\n __await: t\n };\n }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {\n return this;\n }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {\n void 0 === i && (i = Promise);\n var a = new AsyncIterator(wrap(t, r, n, o), i);\n return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {\n return t.done ? t.value : a.next();\n });\n }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () {\n return this;\n }), define(g, \"toString\", function () {\n return \"[object Generator]\";\n }), e.keys = function (t) {\n var e = Object(t),\n r = [];\n for (var n in e) r.push(n);\n return r.reverse(), function next() {\n for (; r.length;) {\n var t = r.pop();\n if (t in e) return next.value = t, next.done = !1, next;\n }\n return next.done = !0, next;\n };\n }, e.values = values, Context.prototype = {\n constructor: Context,\n reset: function reset(e) {\n if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);\n },\n stop: function stop() {\n this.done = !0;\n var t = this.tryEntries[0].completion;\n if (\"throw\" === t.type) throw t.arg;\n return this.rval;\n },\n dispatchException: function dispatchException(e) {\n if (this.done) throw e;\n var r = this;\n function handle(n, o) {\n return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o;\n }\n for (var o = this.tryEntries.length - 1; o >= 0; --o) {\n var i = this.tryEntries[o],\n a = i.completion;\n if (\"root\" === i.tryLoc) return handle(\"end\");\n if (i.tryLoc <= this.prev) {\n var c = n.call(i, \"catchLoc\"),\n u = n.call(i, \"finallyLoc\");\n if (c && u) {\n if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);\n if (this.prev < i.finallyLoc) return handle(i.finallyLoc);\n } else if (c) {\n if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);\n } else {\n if (!u) throw Error(\"try statement without catch or finally\");\n if (this.prev < i.finallyLoc) return handle(i.finallyLoc);\n }\n }\n }\n },\n abrupt: function abrupt(t, e) {\n for (var r = this.tryEntries.length - 1; r >= 0; --r) {\n var o = this.tryEntries[r];\n if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) {\n var i = o;\n break;\n }\n }\n i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);\n var a = i ? i.completion : {};\n return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a);\n },\n complete: function complete(t, e) {\n if (\"throw\" === t.type) throw t.arg;\n return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y;\n },\n finish: function finish(t) {\n for (var e = this.tryEntries.length - 1; e >= 0; --e) {\n var r = this.tryEntries[e];\n if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;\n }\n },\n \"catch\": function _catch(t) {\n for (var e = this.tryEntries.length - 1; e >= 0; --e) {\n var r = this.tryEntries[e];\n if (r.tryLoc === t) {\n var n = r.completion;\n if (\"throw\" === n.type) {\n var o = n.arg;\n resetTryEntry(r);\n }\n return o;\n }\n }\n throw Error(\"illegal catch attempt\");\n },\n delegateYield: function delegateYield(e, r, n) {\n return this.delegate = {\n iterator: values(e),\n resultName: r,\n nextLoc: n\n }, \"next\" === this.method && (this.arg = t), y;\n }\n }, e;\n}\nmodule.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return (module.exports = _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports), _typeof(o);\n}\nmodule.exports = _typeof, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","// TODO(Babel 8): Remove this file.\n\nvar runtime = require(\"../helpers/regeneratorRuntime\")();\nmodule.exports = runtime;\n\n// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Model'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/User'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/computed'];","import Model from 'flarum/common/Model';\nimport computed from 'flarum/common/utils/computed';\n\nexport default class Policy extends Model {\n sort = Model.attribute('sort');\n name = Model.attribute('name');\n url = Model.attribute('url');\n update_message = Model.attribute('update_message');\n terms_updated_at = Model.attribute('terms_updated_at');\n optional = Model.attribute('optional');\n additional_info = Model.attribute('additional_info');\n form_key = computed('id', (id) => 'fof_terms_policy_' + id);\n\n apiEndpoint() {\n return '/fof/terms/policies' + (this.exists ? '/' + this.data.id : '');\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Page'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/IndexPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Modal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","export default function (items, attr = 'sort') {\n return items.sort((a, b) => a[attr]() - b[attr]());\n}\n","import app from 'flarum/forum/app';\nimport Modal from 'flarum/common/components/Modal';\nimport Button from 'flarum/common/components/Button';\nimport sortByAttribute from '../../common/helpers/sortByAttribute';\n\n/* global m, dayjs */\n\nexport default class AcceptPoliciesModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n app.store.all('fof-terms-policies').forEach((policy) => {\n this[policy.form_key()] = false;\n });\n }\n\n title() {\n return app.translator.trans('fof-terms.forum.accept-modal.title');\n }\n\n className() {\n return 'AcceptPoliciesModal Modal--medium';\n }\n\n content() {\n return m('.Modal-body', this.body());\n }\n\n body() {\n const policies = sortByAttribute(\n app.store.all('fof-terms-policies').filter((policy) => {\n const state = app.session.user.fofTermsPoliciesState()[policy.id()];\n\n return !state || state.has_update;\n })\n );\n\n if (policies.length === 0) {\n return Button.component(\n {\n className: 'Button',\n onclick() {\n app.modal.close();\n },\n },\n app.translator.trans('fof-terms.forum.accept-modal.close')\n );\n }\n\n return policies.map((policy) =>\n m('div', [\n m('h2', policy.name()),\n app.forum.attribute('fof-terms.hide-updated-at')\n ? null\n : m(\n 'p',\n policy.terms_updated_at()\n ? app.translator.trans('fof-terms.forum.accept-modal.updated-at', {\n date: dayjs(policy.terms_updated_at()).format(app.forum.attribute('fof-terms.date-format')),\n })\n : app.translator.trans('fof-terms.forum.accept-modal.updated-recently')\n ),\n policy.update_message() ? m('p', policy.update_message()) : null,\n m(\n '.Form-group',\n m(\n '.FoF-Terms-Check.FoF-Terms-Check--login',\n m('label.checkbox', [\n m('input', {\n type: 'checkbox',\n checked: this[policy.form_key()],\n onchange: () => {\n this[policy.form_key()] = !this[policy.form_key()];\n },\n }),\n app.translator.trans('fof-terms.forum.accept-modal.i-accept', {\n policy: policy.name(),\n a: policy.url()\n ? m('a', {\n href: policy.url(),\n target: '_blank',\n })\n : m('span'),\n }),\n ])\n )\n ),\n Button.component(\n {\n className: 'Button Button--primary',\n disabled: !this[policy.form_key()] && !policy.optional(),\n onclick: () => {\n // We need to save the \"must accept\" property before performing the request\n // Because an updated user serializer will be returned\n const hadToAcceptToInteract = app.session.user.fofTermsPoliciesMustAccept();\n\n app\n .request({\n url: app.forum.attribute('apiUrl') + policy.apiEndpoint() + (this[policy.form_key()] ? '/accept' : '/decline'),\n method: 'POST',\n errorHandler: this.onerror.bind(this),\n })\n .then((updated) => {\n app.store.pushPayload(updated);\n\n // If this was the last policy to accept, close the modal\n if (policies.length === 1) {\n if (hadToAcceptToInteract) {\n // If the user was previously not allowed to interact with the forum,\n // we refresh to get updated permissions in the frontend\n window.location.reload();\n } else {\n app.modal.close();\n }\n }\n\n m.redraw();\n });\n },\n },\n app.translator.trans('fof-terms.forum.accept-modal.accept')\n ),\n ])\n );\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/SignUpModal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/IndexPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/UserPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/listItems'];","import app from 'flarum/forum/app';\nimport Button from 'flarum/common/components/Button';\nimport listItems from 'flarum/common/helpers/listItems';\nimport AcceptPoliciesModal from './AcceptPoliciesModal';\n\n/* global m */\n\nlet temporarilyHidden = false;\n\n/**\n * Renders similarly to Flarum's Alert, but with an additional .container inside\n */\nexport default class UpdateAlert {\n shouldShowAlert() {\n if (temporarilyHidden) {\n return false;\n }\n\n const user = app.session.user;\n\n return user && user.fofTermsPoliciesHasUpdate();\n }\n\n view() {\n if (!this.shouldShowAlert()) {\n return m('div');\n }\n\n const controls = [\n Button.component(\n {\n className: 'Button Button--link',\n onclick: () => {\n app.modal.show(AcceptPoliciesModal);\n },\n },\n app.translator.trans('fof-terms.forum.update-alert.review')\n ),\n ];\n\n const dismissControl = [];\n\n if (!app.session.user.fofTermsPoliciesMustAccept()) {\n dismissControl.push(\n Button.component({\n icon: 'fas fa-times',\n className: 'Button Button--link Button--icon Alert-dismiss',\n onclick: () => {\n temporarilyHidden = true;\n },\n })\n );\n }\n\n return m(\n '.Alert.Alert-info',\n m('.container', [\n m(\n 'span.Alert-body',\n app.session.user.fofTermsPoliciesMustAccept()\n ? app.translator.trans('fof-terms.forum.update-alert.must-accept-message')\n : app.translator.trans('fof-terms.forum.update-alert.can-accept-message')\n ),\n m('ul.Alert-controls', listItems(controls.concat(dismissControl))),\n ])\n );\n }\n}\n","import { override } from 'flarum/common/extend';\nimport IndexPage from 'flarum/forum/components/IndexPage';\nimport DiscussionPage from 'flarum/forum/components/DiscussionPage';\nimport UserPage from 'flarum/forum/components/UserPage';\nimport UpdateAlert from './components/UpdateAlert';\n\n/* global m */\n\n// This single method will be used to inject the alert into existing components\n// If the view is already an array, we add our content at the start\n// If it isn't an array we wrap the content into a new array\nfunction addAlertToContent(original, ...originalArgs) {\n const existing = original(...originalArgs);\n const additional = m(UpdateAlert);\n\n // if the existing content is an array, add to it\n // This should only happen with the hero() override as other extensions might return an array there\n if (Array.isArray(existing)) {\n existing.unshift(additional);\n\n return existing;\n }\n\n // Otherwise return a new list of elements\n // Use a container div otherwise when extending view() this will prevent the config() method from running\n // as the Component class won't be able to bind config() to an array\n // We could also add to vnode.children but this could cause weird styling if another extension or custom styles\n // change the look of the base page content by targeting the original view root element based on its class\n // By using a new outer container we make sure the alert always stays full width and unaffected by the page view under it\n return m('div', [additional, existing]);\n}\n\nexport default function () {\n // There's no single place we can inject the banner\n // So we use a few different points so it's visible on most pages\n override(IndexPage.prototype, 'hero', addAlertToContent);\n override(DiscussionPage.prototype, 'view', addAlertToContent);\n\n // Covers user profile and settings\n override(UserPage.prototype, 'view', addAlertToContent);\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/UserControls'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/humanTime'];","import app from 'flarum/forum/app';\nimport humanTime from 'flarum/common/helpers/humanTime';\nimport Modal from 'flarum/common/components/Modal';\nimport sortByAttribute from '../../common/helpers/sortByAttribute';\n\n/* global m */\n\nexport default class UserPoliciesStateModal extends Modal {\n title() {\n return app.translator.trans('fof-terms.forum.state-modal.title', {\n username: this.attrs.user.username(),\n });\n }\n\n className() {\n return 'UserPoliciesStateModal Modal--medium';\n }\n\n content() {\n return m(\n '.Modal-body',\n m(\n 'ul',\n sortByAttribute(app.store.all('fof-terms-policies')).map((policy) => {\n const state = this.attrs.user.fofTermsPoliciesState()[policy.id()];\n\n return m('li', [\n policy.name() + ': ',\n state && state.accepted_at\n ? app.translator.trans('fof-terms.forum.state-modal.accepted-at', {\n date: humanTime(state.accepted_at),\n })\n : app.translator.trans('fof-terms.forum.state-modal.not-accepted'),\n ]);\n })\n )\n );\n }\n}\n","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\nexport default function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n _next(undefined);\n });\n };\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/SettingsPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/FieldSet'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Switch'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Link'];","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport SettingsPage from 'flarum/forum/components/SettingsPage';\nimport FieldSet from 'flarum/common/components/FieldSet';\nimport Switch from 'flarum/common/components/Switch';\nimport Link from 'flarum/common/components/Link';\n\nasync function updatePolicy(policy, value) {\n const endpoint = `${app.forum.attribute('apiUrl')}${policy.apiEndpoint()}${value ? '/accept' : '/decline'}`;\n const updated = await app.request({\n url: endpoint,\n method: 'POST',\n });\n app.store.pushPayload(updated);\n}\n\nexport default function () {\n extend(SettingsPage.prototype, 'settingsItems', function (items) {\n const policies = app.store.all('fof-terms-policies').filter((policy) => policy.optional());\n\n let policyState = app.session.user.fofTermsPoliciesState();\n\n items.add(\n 'policies',\n
\n {policies.map((policy) => {\n const { is_accepted } = policyState[policy.id()];\n return (\n \n );\n })}\n
,\n -200\n );\n });\n}\n","import AcceptPoliciesModal from './AcceptPoliciesModal';\nimport UpdateAlert from './UpdateAlert';\nimport UserPoliciesStateModal from './UserPoliciesStateModal';\n\nexport const components = {\n AcceptPoliciesModal,\n UpdateAlert,\n UserPoliciesStateModal,\n};\n","import Policy from './Policy';\n\nexport const models = {\n Policy,\n};\n","import sortByAttribute from './sortByAttribute';\n\nexport const helpers = {\n sortByAttribute,\n};\n","import app from 'flarum/forum/app';\nimport Model from 'flarum/common/Model';\nimport User from 'flarum/common/models/User';\nimport Policy from '../common/models/Policy';\nimport addAcceptModal from './addAcceptModal';\nimport addFieldsToRegister from './addFieldsToRegister';\nimport addUpdateAlert from './addUpdateAlert';\nimport addUserPoliciesStateControl from './addUserPoliciesStateControl';\nimport addManagePoliciesOption from './components/addManagePoliciesOption';\n\nexport * from './components';\nexport * from '../common/models';\nexport * from '../common/helpers';\n\napp.initializers.add('fof-terms', () => {\n app.store.models['fof-terms-policies'] = Policy;\n\n User.prototype.fofTermsPoliciesState = Model.attribute('fofTermsPoliciesState');\n User.prototype.fofTermsPoliciesHasUpdate = Model.attribute('fofTermsPoliciesHasUpdate');\n User.prototype.fofTermsPoliciesMustAccept = Model.attribute('fofTermsPoliciesMustAccept');\n User.prototype.seeFoFTermsPoliciesState = Model.attribute('seeFoFTermsPoliciesState');\n\n addAcceptModal();\n addFieldsToRegister();\n addUpdateAlert();\n addUserPoliciesStateControl();\n addManagePoliciesOption();\n});\n","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport Page from 'flarum/common/components/Page';\nimport IndexPage from 'flarum/common/components/IndexPage';\nimport AcceptPoliciesModal from './components/AcceptPoliciesModal';\n\nexport default function () {\n let initialized = false;\n\n extend(Page.prototype, 'oninit', function () {\n if (initialized) {\n return;\n }\n\n // We only show the modal if the first page loaded was the index page\n // And that new updates are available\n // And that the user *must* accept them\n if (app.current.matches(IndexPage)) {\n const user = app.session.user;\n\n if (user && user.fofTermsPoliciesMustAccept()) {\n // Timeout is necessary because there is a redraw error otherwise\n setTimeout(() => {\n app.modal.show(AcceptPoliciesModal);\n }, 0);\n }\n }\n\n initialized = true;\n });\n}\n","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport SignUpModal from 'flarum/forum/components/SignUpModal';\nimport sortByAttribute from '../common/helpers/sortByAttribute';\n\n/* global m */\n\nexport default function () {\n extend(SignUpModal.prototype, 'oninit', function () {\n this.fofTermsPolicies = sortByAttribute(app.store.all('fof-terms-policies'));\n\n this.fofTermsPolicies.forEach((policy) => {\n this[policy.form_key()] = false;\n });\n });\n\n extend(SignUpModal.prototype, 'fields', function (fields) {\n const legalText = app.forum.attribute('fof-terms.signup-legal-text');\n\n if (legalText) {\n fields.add('fof-terms-legal-text', m('.Form-group', m('.FoF-Terms-SignUp-Legal.Alert', legalText)));\n }\n\n this.fofTermsPolicies.forEach((policy) => {\n fields.add(\n 'fof-terms-policy-' + policy.id(),\n m(\n '.Form-group',\n m(\n '.FoF-Terms-Check.FoF-Terms-Check--signup',\n m('label.checkbox', [\n m('input', {\n type: 'checkbox',\n checked: this[policy.form_key()],\n onchange: () => {\n this[policy.form_key()] = !this[policy.form_key()];\n },\n disabled: this.loading,\n }),\n app.translator.trans('fof-terms.forum.signup.i-accept', {\n policy: policy.name(),\n a: policy.url()\n ? m('a', {\n href: policy.url(),\n target: '_blank',\n })\n : m('span'),\n }),\n ])\n )\n )\n );\n });\n });\n\n extend(SignUpModal.prototype, 'submitData', function (data) {\n this.fofTermsPolicies.forEach((policy) => {\n data[policy.form_key()] = this[policy.form_key()];\n });\n });\n}\n","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport UserControls from 'flarum/forum/utils/UserControls';\nimport Button from 'flarum/common/components/Button';\nimport UserPoliciesStateModal from './components/UserPoliciesStateModal';\n\nexport default function () {\n extend(UserControls, 'moderationControls', (items, user) => {\n if (app.forum.attribute('fof-terms.canSeeUserPoliciesState')) {\n items.add(\n 'fof-terms.state',\n Button.component(\n {\n icon: 'fas fa-paperclip',\n onclick() {\n app.modal.show(UserPoliciesStateModal, { user });\n },\n },\n app.translator.trans('fof-terms.forum.user_controls.state_button')\n )\n );\n }\n });\n}\n"],"names":["_typeof","require","_regeneratorRuntime","module","exports","e","__esModule","t","r","Object","prototype","n","hasOwnProperty","o","defineProperty","value","i","Symbol","a","iterator","c","asyncIterator","u","toStringTag","define","enumerable","configurable","writable","wrap","Generator","create","Context","makeInvokeMethod","tryCatch","type","arg","call","h","l","f","s","y","GeneratorFunction","GeneratorFunctionPrototype","p","this","d","getPrototypeOf","v","values","g","defineIteratorMethods","forEach","_invoke","AsyncIterator","invoke","resolve","__await","then","callInvokeWithMethodAndArg","Error","done","method","delegate","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","TypeError","resultName","next","nextLoc","pushTryEntry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","isNaN","length","displayName","isGeneratorFunction","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","keys","reverse","pop","prev","charAt","slice","stop","rval","handle","complete","finish","delegateYield","runtime","regeneratorRuntime","accidentalStrictMode","globalThis","Function","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","getter","definition","key","get","obj","prop","flarum","core","compat","_setPrototypeOf","bind","_inheritsLoose","subClass","superClass","Policy","_Model","_this","_len","arguments","args","Array","_key","apply","concat","sort","Model","url","update_message","terms_updated_at","optional","additional_info","form_key","computed","id","apiEndpoint","exists","data","items","attr","b","AcceptPoliciesModal","_Modal","_proto","oninit","vnode","app","all","policy","title","trans","className","content","m","body","_this2","policies","sortByAttribute","filter","state","user","fofTermsPoliciesState","has_update","Button","onclick","close","map","attribute","date","dayjs","format","checked","onchange","href","target","disabled","hadToAcceptToInteract","fofTermsPoliciesMustAccept","errorHandler","onerror","updated","pushPayload","window","location","reload","redraw","Modal","temporarilyHidden","UpdateAlert","shouldShowAlert","fofTermsPoliciesHasUpdate","view","controls","show","dismissControl","icon","listItems","addAlertToContent","original","originalArgs","existing","additional","isArray","unshift","UserPoliciesStateModal","username","attrs","accepted_at","humanTime","asyncGeneratorStep","gen","reject","_next","_throw","info","error","_asyncToGenerator","fn","self","err","updatePolicy","_x","_x2","_updatePolicy","_callee2","endpoint","_context2","components","models","helpers","add","initialized","User","seeFoFTermsPoliciesState","extend","Page","matches","IndexPage","setTimeout","SignUpModal","fofTermsPolicies","fields","legalText","loading","_this3","override","DiscussionPage","UserPage","UserControls","SettingsPage","policyState","FieldSet","label","is_accepted","class","Switch","_ref","_callee","_context","_x3","Link"],"sourceRoot":""} \ No newline at end of file