@fremtind/jkl-cookie-consent-react
Advanced tools
Comparing version 4.0.6 to 4.0.7
@@ -1,1 +0,1 @@ | ||
import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/slicedToArray";import*as r from"react";import n,{useMemo as i,useEffect as a}from"react";import{usePreviousValue as o}from"@fremtind/jkl-react-hooks";import s from"@babel/runtime/helpers/extends";import u from"@babel/runtime/helpers/typeof";import{UnorderedList as c,CheckListItem as l}from"@fremtind/jkl-list-react";import{Checkbox as f}from"@fremtind/jkl-checkbox-react";import{PrimaryButton as d,TertiaryButton as p}from"@fremtind/jkl-button-react";import h from"@babel/runtime/helpers/asyncToGenerator";import v from"@babel/runtime/helpers/classCallCheck";import m from"@babel/runtime/helpers/createClass";import b from"@babel/runtime/helpers/toConsumableArray";import y from"@babel/runtime/regenerator";function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function k(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?g(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var O="fremtind-cookie-consent",w=function(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:O,t=document.cookie.split(";").map((function(e){return e.trim().split("=")})).find((function(t){return t[0]===e}));if(t)return t}();return t?JSON.parse(t[1]):e?e():void 0},j=function(e){if(e)return"denied"!==e},x=function(e){var r=Object.entries(k(k({},{functional:null,marketing:null,statistics:null}),e)).map((function(e){var r=t(e,2),n=r[0],i=r[1];return[n,j(i)]}));return Object.fromEntries(r)},_=function(e){var r={functional:void 0,marketing:void 0,statistics:void 0},n=Object.entries(k(k({},r),e)).map((function(e){var r,n=t(e,2),i=n[0],a=n[1];return[i,(r=a,void 0===r?null:!1===r||"false"===String(r).toLowerCase()?"denied":"accepted")]}));return Object.fromEntries(n)};function E(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function S(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?E(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):E(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var A=n.createContext(void 0),V=function(e,t){switch(t.type){case"SET_SHOW_CONSENT":return S(S({},e),{},{isOpen:t.payload});case"SET_SHOW_SETTINGS":return S(S({},e),{},{showSettings:t.payload});case"UPDATE_CONSENT":return S(S({},e),{},{consent:S(S({},e.consent),t.payload)});default:throw new Error("Unhandled action type: ".concat(t.type))}},C=function(e){var r=e.children,o=e.cookieAdapter,s=e.marketing,u=e.functional,c=e.statistics,l=i((function(){var e;return null!==(e=w(o))&&void 0!==e?e:{marketing:null,functional:null,statistics:null}}),[o]),f=i((function(){return{marketing:null!=s&&s,functional:null!=u&&u,statistics:null!=c&&c}}),[s,u,c]),d=n.useReducer(V,{isOpen:!1,showSettings:!1,requirement:f,consent:l}),p=t(d,2),h=p[0],v=p[1];a((function(){!function(e,r){if(r){for(var n=new Map(Object.entries(r)),i=0,a=Object.entries(e);i<a.length;i++){var o=t(a[i],2),s=o[0];if(o[1]&&null===n.get(s))return!0}return!1}return Object.values(e).some((function(e){return e}))}(f,l)?l&&v({type:"UPDATE_CONSENT",payload:l}):v({type:"SET_SHOW_CONSENT",payload:!0})}),[f,l]);var m={state:h,dispatch:v};return n.createElement(A.Provider,{value:m},r)},D=function(){var e=n.useContext(A);if(void 0===e)throw new Error("useCookieConsentState must be used within a CookieConsentProvider");return S({dispatch:e.dispatch},e.state)},F=function(){var e=n.useContext(A);if(void 0===e)throw new Error("useCookieConsent must be used within a CookieConsentProvider");return{openConsentModalWithSettings:function(){e.dispatch({type:"SET_SHOW_CONSENT",payload:!0}),e.dispatch({type:"SET_SHOW_SETTINGS",payload:!0})}}};var N,T=(N=require("react"))&&"object"===u(N)&&"default"in N?N.default:N;function P(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function M(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function L(e){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function B(e,t){return(B=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function I(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function U(e,t,r){return(U=I()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&B(i,r.prototype),i}).apply(null,arguments)}function R(e){var t="function"==typeof Map?new Map:void 0;return(R=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return U(e,arguments,L(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),B(n,e)})(e)}function H(e,t){return!t||"object"!==u(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function W(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var q="undefined"!=typeof window;q&&/(android)/i.test(navigator.userAgent),q&&/iPad|iPhone|iPod/.test(String(navigator.platform)),q||global.HTMLElement||(global.HTMLElement=function(){return function e(){P(this,e)}}());var z,G,K=(z="undefined"==typeof window?{}:window.Element.prototype,G=z.matches||z.msMatchesSelector||z.webkitMatchesSelector,z.closest?function(e,t){return e.closest(t)}:function(e,t){for(e.correspondingUseElement&&(e=e.correspondingUseElement);e;e=e.parentElement)if(G.call(e,t))return e;return null});function J(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:!this.hasAttribute(t);return!r===e.hasAttribute(t)&&e[r?"setAttribute":"removeAttribute"](t,""),r}function $(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(e){if(e.nodeType)return[e];if("string"==typeof e)return[].slice.call(t.querySelectorAll(e));if(e.length)return[].slice.call(e)}return[]}var Z="[tabindex],a,button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled])",Q=function(e){function t(){return P(this,t),H(this,L(t).apply(this,arguments))}var r,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&B(e,t)}(t,R(HTMLElement)),r=t,i=[{key:"observedAttributes",get:function(){return["hidden","backdrop"]}}],(n=[{key:"connectedCallback",value:function(){this._focus=!0,this._autoBackdrop=null,this.attributeChangedCallback(),this.addEventListener("transitionend",this),document.addEventListener("keydown",this),document.addEventListener("click",this)}},{key:"disconnectedCallback",value:function(){te(this._focus),this._autoBackdrop&&this._autoBackdrop.parentNode.removeChild(this._autoBackdrop),this._focus=this._autoBackdrop=null,this.removeEventListener("transitionend",this),document.removeEventListener("keydown",this),document.removeEventListener("click",this)}},{key:"attributeChangedCallback",value:function(e,t,r){var n=this;if(this._focus){var i="backdrop"===e&&X(this,t),a=this.backdrop;if(this.className=this.className,this.setAttribute("role","dialog"),this.setAttribute("aria-modal",Boolean(a)),i&&i.setAttribute("hidden",""),a&&J(a,"hidden",this.hidden),this.hidden)te(this._focus);else{var o=window.getComputedStyle(this).getPropertyValue("z-index");if(("auto"===o||"0"===o)&&""===this.style.zIndex){var s=$(this.nodeName).filter((function(e){return e!==a&&!n.contains(e)&&Y(e)}));o=Math.min(Math.max.apply(Math,[1].concat(W(s.map(ee)))),2e9),a&&(a.style.zIndex=o+1),this.style.zIndex=o+2}this._focus=document.activeElement||document.body,setTimeout((function(){return re(n)}))}"hidden"===e&&r!==t&&function(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i="prevent_recursive_dispatch_maximum_callstack".concat(t);if(e[i])return!0;e[i]=!0,"function"==typeof window.CustomEvent?r=new window.CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n}):(r=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,n);e.dispatchEvent(r);e[i]=null}(this,"dialog.toggle")}}},{key:"handleEvent",value:function(e){if(!e.defaultPrevented)if("transitionend"!==e.type||e.target!==this||this.hidden){if("click"===e.type){if(e.target===this.backdrop&&!this.strict)return this.close();var t=K(e.target,"button"),r=t&&t.getAttribute("for");"close"===r&&K(e.target,this.nodeName)===this?this.close():r===this.id&&this.show()}else if("keydown"===e.type&&(9===e.keyCode||27===e.keyCode)&&!this.hidden){if($("".concat(this.nodeName,":not([hidden])")).sort((function(e,t){return ee(e)-ee(t)})).pop()!==this)return;9===e.keyCode&&function(e,t){var r=$(Z,e).filter(Y),n=r[t.shiftKey?0:r.length-1];t.target!==n&&e.contains(t.target)||(t.preventDefault(),r[t.shiftKey?r.length-1:0].focus())}(this,e),27!==e.keyCode||this.strict||(e.preventDefault(),this.close())}}else re(this)}},{key:"close",value:function(){this.hidden=!0}},{key:"show",value:function(){this.hidden=!1}},{key:"open",get:function(){return!this.hidden},set:function(e){this.hidden=!e}},{key:"strict",get:function(){return this.hasAttribute("strict")},set:function(e){J(this,"strict",e)}},{key:"hidden",get:function(){return this.hasAttribute("hidden")},set:function(e){J(this,"hidden",e)}},{key:"backdrop",get:function(){return X(this,this.getAttribute("backdrop"))},set:function(e){this.setAttribute("backdrop",e||"false")}}])&&M(r.prototype,n),i&&M(r,i),t}();function X(e,t){var r=e.nextElementSibling;return!(!e.parentNode||"false"===t)&&(t&&"true"!==t?document.getElementById(t)||!1:r&&"BACKDROP"===r.nodeName?r:(e._autoBackdrop=document.createElement("backdrop"),e.insertAdjacentElement("afterend",e._autoBackdrop)))}function Y(e){return e.clientWidth&&e.clientHeight&&"hidden"!==window.getComputedStyle(e).getPropertyValue("visibility")}function ee(e){for(var t=e,r=1;t;t=t.offsetParent)r+=Number(window.getComputedStyle(t).getPropertyValue("z-index"))||0;return r}function te(e){setTimeout((function(){try{e.focus()}catch(e){}}))}function re(e){if(!e.contains(document.activeElement)&&Y(e)){var t=$("[autofocus]",e).concat($(Z,e)).filter(Y)[0];try{t.focus()}catch(t){console.warn(e,'is initialized without focusable elements. Please add [tabindex="-1"] the main element (for instance a <h1>)')}}}var ne=function(){var e="undefined"==typeof window?{}:window.Element.prototype,t=e.matches||e.msMatchesSelector||e.webkitMatchesSelector;return e.closest?function(e,t){return e.closest(t)}:function(e,r){for(;e;e=e.parentElement)if(t.call(e,r))return e;return null}}();var ie=function(e,t){void 0===t&&(t={});var r=(t.name||e.name||String(e).match(/function ([^(]+)/)[1]).replace(/.[A-Z]/g,(function(e){return e[0]+"-"+e[1]})),n=t.props||[],i=t.customEvents||[],a=i.reduce((function(e,t){return e[t]="on"+t.replace(/(^|\.)./g,(function(e){return e.slice(-1).toUpperCase()})),e}),{}),o=n.concat("forwardRef",Object.keys(a).map((function(e){return a[e]}))),s=(r+"-"+(t.suffix||"react")).replace(/\W+/g,"-").toLowerCase();return function(t){function r(e){var r=this;t.call(this,e),this.ref=function(e){return"function"==typeof r.props.forwardRef?r.props.forwardRef(e):r.props.forwardRef&&(r.props.forwardRef.current=e),r.el=e},Object.keys(a).forEach((function(e){var t=a[e];r[e]=function(e){r.props[t]&&ne(e.target,r.el.nodeName)===r.el&&r.props[t](e)}}))}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.componentDidMount=function(){var t=this;window.customElements.get(s)||window.customElements.define(s,e),n.forEach((function(e){e in t.props&&(t.el[e]=t.props[e])})),i.forEach((function(e){t.el.addEventListener(e,t[e])}))},r.prototype.componentDidUpdate=function(e){var t=this;n.forEach((function(r){e[r]!==t.props[r]&&(t.el[r]=t.props[r])}))},r.prototype.componentWillUnmount=function(){var e=this;i.forEach((function(t){e.el.removeEventListener(t,e[t])}))},r.prototype.render=function(){var e=this;return T.createElement(s,Object.keys(this.props).reduce((function(t,r){return-1===o.indexOf(r)&&("className"===r?t.class=e.props[r]:!0===e.props[r]?t[r]="":!1!==e.props[r]&&(t[r]=e.props[r])),t}),{ref:this.ref}))},r}(T.Component)}(Q,{customEvents:["dialog.toggle"],props:["backdrop"],suffix:"3.0.7"});function ae(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return oe(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return oe(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function oe(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var se=function(e){return"checkbox"===e.type},ue=function(e){return e instanceof Date},ce=function(e){return null==e},le=function(e){return"object"===u(e)},fe=function(e){return!ce(e)&&!Array.isArray(e)&&le(e)&&!ue(e)},de=function(e){return e.substring(0,e.search(/.\d/))||e},pe=function(e,t){return b(e).some((function(e){return de(t)===e}))},he=function(e){return e.filter(Boolean)},ve=function(e){return void 0===e},me=function(e,t,r){if(fe(e)&&t){var n=he(t.split(/[,[\].]+?/)).reduce((function(e,t){return ce(e)?e:e[t]}),e);return ve(n)||n===e?ve(e[t])?r:e[t]:n}},be="blur",ye="onBlur",ge="onChange",ke="onSubmit",Oe="onTouched",we="all",je="max",xe="min",_e="maxLength",Ee="minLength",Se="pattern",Ae="required",Ve="validate",Ce=function(e,t){var r=Object.assign({},e);return delete r[t],r},De=r.createContext(null);De.displayName="RHFContext";var Fe=function(e){return r.createElement(De.Provider,{value:Ce(e,"children")},e.children)},Ne=function(e,t,r){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];function i(i){return function(){if(i in e)return t[i]!==we&&(t[i]=!n||we),r&&(r[i]=!0),e[i]}}var a={};for(var o in e)Object.defineProperty(a,o,{get:i(o)});return a},Te=function(e){return fe(e)&&!Object.keys(e).length},Pe=function(e,t,r){var n=Ce(e,"name");return Te(n)||Object.keys(n).length>=Object.keys(t).length||Object.keys(n).find((function(e){return t[e]===(!r||we)}))},Me=function(e){return Array.isArray(e)?e:[e]},Le=function(e){return/^\w*$/.test(e)},Be=function(e){return he(e.replace(/["|']|\]/g,"").split(/\.|\[/))};function Ie(e,t,r){for(var n=-1,i=Le(t)?[t]:Be(t),a=i.length,o=a-1;++n<a;){var s=i[n],u=r;if(n!==o){var c=e[s];u=fe(c)||Array.isArray(c)?c:isNaN(+i[n+1])?{}:[]}e[s]=u,e=e[s]}return e}var Ue=function(t,r,n,i,a){return r?Object.assign(Object.assign({},n[t]),{types:Object.assign(Object.assign({},n[t]&&n[t].types?n[t].types:{}),e({},i,a||!0))}):{}},Re=function e(t,r,n){var i,a=ae(n||Object.keys(t));try{for(a.s();!(i=a.n()).done;){var o=i.value,s=me(t,o);if(s){var u=s._f,c=Ce(s,"_f");if(u&&r(u.name)){if(u.ref.focus&&ve(u.ref.focus()))break;if(u.refs){u.refs[0].focus();break}}else fe(c)&&e(c,r)}}}catch(e){a.e(e)}finally{a.f()}};function He(e){var t,r=Array.isArray(e);if(e instanceof Date)t=new Date(e.getTime());else{if(!r&&!fe(e))return e;for(var n in t=r?[]:{},e)t[n]=He(e[n])}return t}var We=function(e){return ce(e)||!le(e)};function qe(e,t){if(We(e)||We(t)||ue(e)||ue(t))return e===t;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(var i=0,a=r;i<a.length;i++){var o=a[i],s=e[o];if(!n.includes(o))return!1;if("ref"!==o){var u=t[o];if((fe(s)||Array.isArray(s))&&(fe(u)||Array.isArray(u))?!qe(s,u):s!==u)return!1}}return!0}var ze=function(e){return{isOnSubmit:!e||e===ke,isOnBlur:e===ye,isOnChange:e===ge,isOnAll:e===we,isOnTouch:e===Oe}},Ge=function(e){return"boolean"==typeof e},Ke=function(e){return"file"===e.type},Je=function(e){return"function"==typeof e},$e=function(e){return e instanceof HTMLElement},Ze=function(e){return"select-multiple"===e.type},Qe=function(e){return"radio"===e.type},Xe=function(e){return Qe(e)||se(e)},Ye=function(e){return"string"==typeof e},et="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document,tt=function(e){return!$e(e)||!document.contains(e)},rt=function(e,t){return e.map((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Ce(e,t)}))},nt=function(){function e(){v(this,e),this.tearDowns=[]}return m(e,[{key:"add",value:function(e){this.tearDowns.push(e)}},{key:"unsubscribe",value:function(){var e,t=ae(this.tearDowns);try{for(t.s();!(e=t.n()).done;){(0,e.value)()}}catch(e){t.e(e)}finally{t.f()}this.tearDowns=[]}}]),e}(),it=function(){function e(t,r){var n=this;v(this,e),this.observer=t,this.closed=!1,r.add((function(){return n.closed=!0}))}return m(e,[{key:"next",value:function(e){this.closed||this.observer.next(e)}}]),e}(),at=function(){function e(){v(this,e),this.observers=[]}return m(e,[{key:"next",value:function(e){var t,r=ae(this.observers);try{for(r.s();!(t=r.n()).done;){t.value.next(e)}}catch(e){r.e(e)}finally{r.f()}}},{key:"subscribe",value:function(e){var t=new nt,r=new it(e,t);return this.observers.push(r),t}},{key:"unsubscribe",value:function(){this.observers=[]}}]),e}();function ot(e,t){var r,n=Le(t)?[t]:Be(t),i=1==n.length?e:function(e,t){for(var r=t.slice(0,-1).length,n=0;n<r;)e=ve(e)?n++:e[t[n++]];return e}(e,n),a=n[n.length-1];i&&delete i[a];for(var o=0;o<n.slice(0,-1).length;o++){var s=-1,u=void 0,c=n.slice(0,-(o+1)),l=c.length-1;for(o>0&&(r=e);++s<c.length;){var f=c[s];u=u?u[f]:e[f],l===s&&(fe(u)&&Te(u)||Array.isArray(u)&&!u.filter((function(e){return fe(e)&&!Te(e)||Ge(e)})).length)&&(r?delete r[f]:delete e[f]),r=u}}return e}var st={value:!1,isValid:!1},ut={value:!0,isValid:!0},ct=function(e){if(Array.isArray(e)){if(e.length>1){var t=e.filter((function(e){return e&&e.checked&&!e.disabled})).map((function(e){return e.value}));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!ve(e[0].attributes.value)?ve(e[0].value)||""===e[0].value?ut:{value:e[0].value,isValid:!0}:ut:st}return st},lt=function(e,t){var r=t.valueAsNumber,n=t.valueAsDate,i=t.setValueAs;return ve(e)?e:r?""===e?NaN:+e:n?new Date(e):i?i(e):e},ft={isValid:!1,value:null},dt=function(e){return Array.isArray(e)?e.reduce((function(e,t){return t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e}),ft):ft};function pt(e){var t,r=e.ref;if(!(e.refs?e.refs.every((function(e){return e.disabled})):r.disabled))return Ke(r)?r.files:Qe(r)?dt(e.refs).value:Ze(r)?(t=r.options,b(t).filter((function(e){return e.selected})).map((function(e){return e.value}))):se(r)?ct(e.refs).value:lt(ve(r.value)?e.ref.value:r.value,e)}var ht=function(e,t,r,n){var i,a={},o=ae(e);try{for(o.s();!(i=o.n()).done;){var s=i.value,u=me(t,s);u&&Ie(a,s,u._f)}}catch(e){o.e(e)}finally{o.f()}return{criteriaMode:r,names:b(e),fields:a,shouldUseNativeValidation:n}},vt=function(e){return e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate)};function mt(e,t){if(We(e)||We(t))return t;for(var r in t){var n=e[r],i=t[r];try{e[r]=fe(n)&&fe(i)||Array.isArray(n)&&Array.isArray(i)?mt(n,i):i}catch(e){}}return e}function bt(t,r,n,i,a){for(var o=-1;++o<t.length;){for(var s in t[o])Array.isArray(t[o][s])?(!n[o]&&(n[o]={}),n[o][s]=[],bt(t[o][s],me(r[o]||{},s,[]),n[o][s],n[o],s)):!ce(r)&&qe(me(r[o]||{},s),t[o][s])?Ie(n[o]||{},s):n[o]=Object.assign(Object.assign({},n[o]),e({},s,!0));i&&!n.length&&delete i[a]}return n}var yt=function(e,t,r){return mt(bt(e,t,r.slice(0,e.length)),bt(t,e,r.slice(0,e.length)))},gt=function(e,t,r,n,i){return!i.isOnAll&&(!r&&i.isOnTouch?!(t||e):(r?n.isOnBlur:i.isOnBlur)?!e:!(r?n.isOnChange:i.isOnChange)||e)},kt=function(e,t){return!he(me(e,t,[])).length&&ot(e,t)},Ot=function(e){return Ye(e)||r.isValidElement(e)},wt=function(e){return e instanceof RegExp};function jt(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"validate";if(Ot(e)||Array.isArray(e)&&e.every(Ot)||Ge(e)&&!e)return{type:r,message:Ot(e)?e:"",ref:t}}var xt=function(e){return fe(e)&&!wt(e)?e:{value:e,message:""}},_t=function(){var e=h(y.mark((function e(t,r,n,i){var a,o,s,u,c,l,f,d,p,h,v,m,b,g,k,O,w,j,x,_,E,S,A,V,C,D,F,N,T,P,M,L,B,I,U,R,H,W,q,z,G,K,J,$;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t._f,o=a.ref,s=a.refs,u=a.required,c=a.maxLength,l=a.minLength,f=a.min,d=a.max,p=a.pattern,h=a.validate,v=a.name,m=a.valueAsNumber,b=a.mount,g=a.disabled,b&&!g){e.next=3;break}return e.abrupt("return",{});case 3:if(k=s?s[0]:o,O=function(e){i&&k.reportValidity&&(k.setCustomValidity(Ge(e)?"":e||" "),k.reportValidity())},w={},j=Qe(o),x=se(o),_=j||x,E=(m||Ke(o))&&!o.value||""===r||Array.isArray(r)&&!r.length,S=Ue.bind(null,v,n,w),A=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:_e,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Ee,a=e?t:r;w[v]=Object.assign({type:e?n:i,message:a,ref:o},S(e?n:i,a))},!u||!(!_&&(E||ce(r))||Ge(r)&&!r||x&&!ct(s).isValid||j&&!dt(s).isValid)){e.next=19;break}if(V=Ot(u)?{value:!!u,message:u}:xt(u),C=V.value,D=V.message,!C){e.next=19;break}if(w[v]=Object.assign({type:Ae,message:D,ref:k},S(Ae,D)),n){e.next=19;break}return O(D),e.abrupt("return",w);case 19:if(E||ce(f)&&ce(d)){e.next=28;break}if(T=xt(d),P=xt(f),isNaN(r)?(L=o.valueAsDate||new Date(r),Ye(T.value)&&(F=L>new Date(T.value)),Ye(P.value)&&(N=L<new Date(P.value))):(M=o.valueAsNumber||parseFloat(r),ce(T.value)||(F=M>T.value),ce(P.value)||(N=M<P.value)),!F&&!N){e.next=28;break}if(A(!!F,T.message,P.message,je,xe),n){e.next=28;break}return O(w[v].message),e.abrupt("return",w);case 28:if(!c&&!l||E||!Ye(r)){e.next=38;break}if(B=xt(c),I=xt(l),U=!ce(B.value)&&r.length>B.value,R=!ce(I.value)&&r.length<I.value,!U&&!R){e.next=38;break}if(A(U,B.message,I.message),n){e.next=38;break}return O(w[v].message),e.abrupt("return",w);case 38:if(!p||E||!Ye(r)){e.next=45;break}if(H=xt(p),W=H.value,q=H.message,!wt(W)||r.match(W)){e.next=45;break}if(w[v]=Object.assign({type:Se,message:q,ref:o},S(Se,q)),n){e.next=45;break}return O(q),e.abrupt("return",w);case 45:if(!h){e.next=79;break}if(!Je(h)){e.next=58;break}return e.next=49,h(r);case 49:if(z=e.sent,!(G=jt(z,k))){e.next=56;break}if(w[v]=Object.assign(Object.assign({},G),S(Ve,G.message)),n){e.next=56;break}return O(G.message),e.abrupt("return",w);case 56:e.next=79;break;case 58:if(!fe(h)){e.next=79;break}K={},e.t0=y.keys(h);case 61:if((e.t1=e.t0()).done){e.next=75;break}if(J=e.t1.value,Te(K)||n){e.next=65;break}return e.abrupt("break",75);case 65:return e.t2=jt,e.next=68,h[J](r);case 68:e.t3=e.sent,e.t4=k,e.t5=J,($=(0,e.t2)(e.t3,e.t4,e.t5))&&(K=Object.assign(Object.assign({},$),S(J,$.message)),O($.message),n&&(w[v]=K)),e.next=61;break;case 75:if(Te(K)){e.next=79;break}if(w[v]=Object.assign({ref:k},K),n){e.next=79;break}return e.abrupt("return",w);case 79:return O(!0),e.abrupt("return",w);case 81:case"end":return e.stop()}}),e)})));return function(t,r,n,i){return e.apply(this,arguments)}}(),Et={mode:ke,reValidateMode:ge,shouldFocusError:!0},St="undefined"==typeof window;function At(){var r,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=Object.assign(Object.assign({},Et),n),a={isDirty:!1,isValidating:!1,dirtyFields:{},isSubmitted:!1,submitCount:0,touchedFields:{},isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,errors:{}},o={},s={},u=i.defaultValues||{},c=!1,l=!1,f=0,d={mount:new Set,unMount:new Set,array:new Set,watch:new Set},p={},v={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={watch:new at,control:new at,array:new at,state:new at},g=ze(i.mode),k=ze(i.reValidateMode),O=i.criteriaMode===we,w=function(e,t){return function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];clearTimeout(f),f=window.setTimeout((function(){return e.apply(void 0,n)}),t)}},j=function(e){return d.watchAll||d.watch.has(e)||d.watch.has((e.match(/\w+/)||[])[0])},x=function(e,t){Ie(a.errors,e,t),m.state.next({errors:a.errors})},_=function(){var e=h(y.mark((function e(t,i,o,s,u){var c,l,d;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:c=me(a.errors,i),l=v.isValid&&a.isValid!==o,n.delayError&&s?(r=r||w(x,n.delayError))(i,s):(clearTimeout(f),s?Ie(a.errors,i,s):ot(a.errors,i)),(s?qe(c,s):!c)&&Te(u)&&!l||t||(d=Object.assign(Object.assign(Object.assign({},u),l?{isValid:o}:{}),{errors:a.errors,name:i}),a=Object.assign(Object.assign({},a),d),m.state.next(d)),p[i]--,v.isValidating&&!p[i]&&(m.state.next({isValidating:!1}),p={});case 6:case"end":return e.stop()}}),e)})));return function(t,r,n,i,a){return e.apply(this,arguments)}}(),E=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3?arguments[3]:void 0,i=me(o,e);if(i){var a=i._f;if(a){Ie(s,e,lt(t,a));var u=et&&$e(a.ref)&&ce(t)?"":t;Ke(a.ref)&&!Ye(u)?a.ref.files=u:Ze(a.ref)?b(a.ref.options).forEach((function(e){return e.selected=u.includes(e.value)})):a.refs?se(a.ref)?a.refs.length>1?a.refs.forEach((function(e){return e.checked=Array.isArray(u)?!!u.find((function(t){return t===e.value})):u===e.value})):a.refs[0].checked=!!u:a.refs.forEach((function(e){return e.checked=e.value===u})):a.ref.value=u,n&&m.control.next({values:H(),name:e}),(r.shouldDirty||r.shouldTouch)&&S(e,u,r.shouldTouch),r.shouldValidate&&R(e)}}},S=function(e,t,r){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i={name:e},o=!1;if(v.isDirty){var s=a.isDirty;a.isDirty=N(),i.isDirty=a.isDirty,o=s!==i.isDirty}if(v.dirtyFields&&!r){var c=me(a.dirtyFields,e),l=!qe(me(u,e),t);l?Ie(a.dirtyFields,e,!0):ot(a.dirtyFields,e),i.dirtyFields=a.dirtyFields,o=o||c!==me(a.dirtyFields,e)}var f=me(a.touchedFields,e);return r&&!f&&(Ie(a.touchedFields,e,r),i.touchedFields=a.touchedFields,o=o||v.touchedFields&&f!==r),o&&n&&m.state.next(i),o?i:{}},A=function(){var e=h(y.mark((function e(t){return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!i.resolver){e.next=6;break}return e.next=3,i.resolver(Object.assign({},s),i.context,ht(t||d.mount,o,i.criteriaMode,i.shouldUseNativeValidation));case 3:e.t0=e.sent,e.next=7;break;case 6:e.t0={};case 7:return e.abrupt("return",e.t0);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),V=function(){var e=h(y.mark((function e(t){var r,n,i,o,s,u;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,A();case 2:if(r=e.sent,n=r.errors,t){i=ae(t);try{for(i.s();!(o=i.n()).done;)s=o.value,(u=me(n,s))?Ie(a.errors,s,u):ot(a.errors,s)}catch(e){i.e(e)}finally{i.f()}}else a.errors=n;return e.abrupt("return",n);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),C=function(){var e=h(y.mark((function e(t,r){var n,o,u,c,l,f,d=arguments;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=d.length>2&&void 0!==d[2]?d[2]:{valid:!0},e.t0=y.keys(t);case 2:if((e.t1=e.t0()).done){e.next=23;break}if(o=e.t1.value,!(u=t[o])){e.next=21;break}if(c=u._f,l=Ce(u,"_f"),!c){e.next=17;break}return e.next=11,_t(u,me(s,c.name),O,i.shouldUseNativeValidation);case 11:if(!(f=e.sent)[c.name]){e.next=16;break}if(n.valid=!1,!r){e.next=16;break}return e.abrupt("break",23);case 16:r||(f[c.name]?Ie(a.errors,c.name,f[c.name]):ot(a.errors,c.name));case 17:if(e.t2=l,!e.t2){e.next=21;break}return e.next=21,C(l,r,n);case 21:e.next=2;break;case 23:return e.abrupt("return",n.valid);case 24:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),D=function(){var e=h(y.mark((function e(t){var r,n,u,c,l,f,d,h,b,w,x,E,V,C,D,F,N,P,M,L;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.type,n=t.target,u=t.target,c=u.value,l=u.name,f=u.type,!(d=me(o,l))){e.next=35;break}if(w=f?pt(d._f):c,x=r===be,E=!vt(d._f)&&!i.resolver&&!me(a.errors,l)&&!d._f.deps||gt(x,me(a.touchedFields,l),a.isSubmitted,k,g),V=!x&&j(l),Ie(s,l,w),C=S(l,w,x,!1),D=!Te(C)||V,!x&&m.watch.next({name:l,type:r}),!E){e.next=13;break}return e.abrupt("return",D&&m.state.next(Object.assign({name:l},V?{}:C)));case 13:if(!x&&V&&m.state.next({}),p[l]=(p[l],1),v.isValidating&&m.state.next({isValidating:!0}),!i.resolver){e.next=26;break}return e.next=19,A([l]);case 19:F=e.sent,N=F.errors,h=me(N,l),se(n)&&!h&&(P=de(l),M=me(o,P),Array.isArray(M)&&M.every((function(e){return e._f&&se(e._f.ref)}))&&((L=me(N,P,{})).type&&(h=L),l=P)),b=Te(N),e.next=33;break;case 26:return e.next=28,_t(d,me(s,l),O,i.shouldUseNativeValidation);case 28:return e.t0=l,h=e.sent[e.t0],e.next=32,T(!0);case 32:b=e.sent;case 33:d._f.deps&&R(d._f.deps),_(!1,l,b,h,C);case 35:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),F=function(e,t,r){var n=me(o,e);if(n){var i=me(s,e),a=ve(i)?me(u,e):i;ve(a)||t&&t.defaultChecked||r?Ie(s,e,r?a:pt(n._f)):E(e,a)}l&&T()},N=function(e,t){return e&&t&&Ie(s,e,t),!qe(Object.assign({},H()),u)},T=function(){var e=h(y.mark((function e(t){var r;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=!1,!v.isValid){e.next=15;break}if(!i.resolver){e.next=10;break}return e.t1=Te,e.next=6,A();case 6:e.t2=e.sent.errors,e.t0=(0,e.t1)(e.t2),e.next=13;break;case 10:return e.next=12,C(o,!0);case 12:e.t0=e.sent;case 13:r=e.t0,t||r===a.isValid||(a.isValid=r,m.state.next({isValid:r}));case 15:return e.abrupt("return",r);case 16:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),P=function e(r,n,i){return Object.entries(n).forEach((function(n){var a=t(n,2),s=a[0],u=a[1],c="".concat(r,".").concat(s),l=me(o,c);!d.array.has(r)&&We(u)&&(!l||l._f)||ue(u)?E(c,u,i,!0):e(c,u,i)}))},M=function(t,r,n,i){var a=Object.assign({},n||l?s:ve(r)?u:Ye(t)?e({},t,r):r);if(!t)return i&&(d.watchAll=!0),a;var o,c=[],f=ae(Me(t));try{for(f.s();!(o=f.n()).done;){var p=o.value;i&&d.watch.add(p),c.push(me(a,p))}}catch(e){f.e(e)}finally{f.f()}return Array.isArray(t)?c:c[0]},L=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";for(var n in t){var i=t[n],a=r+(r?".":"")+n,u=me(o,a);u&&u._f||(fe(i)&&Object.keys(i).length||Array.isArray(i)&&i.length?e(i,a):u||Ie(s,a,i))}},B=function(e,t,r,n){var i,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],f=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],d=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],p=rt(l,e);if(c=!0,d&&me(o,t)&&(i=r(me(o,t),n.argA,n.argB),f&&Ie(o,t,i)),i=r(me(s,t),n.argA,n.argB),f&&Ie(s,t,i),Array.isArray(me(a.errors,t))){var h=r(me(a.errors,t),n.argA,n.argB);f&&Ie(a.errors,t,h),kt(a.errors,t)}if(v.touchedFields&&me(a.touchedFields,t)){var b=r(me(a.touchedFields,t),n.argA,n.argB);f&&Ie(a.touchedFields,t,b),kt(a.touchedFields,t)}(v.dirtyFields||v.isDirty)&&(Ie(a.dirtyFields,t,yt(rt(p,e),me(u,t,[]),me(a.dirtyFields,t,[]))),p&&Ie(a.dirtyFields,t,yt(rt(p,e),me(u,t,[]),me(a.dirtyFields,t,[]))),kt(a.dirtyFields,t)),m.state.next({isDirty:N(t,rt(p,e)),dirtyFields:a.dirtyFields,errors:a.errors,isValid:a.isValid})},I=function(e){return me(l?s:u,e,[])},U=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=me(o,e),i=d.array.has(e);Ie(s,e,t),i?(m.array.next({name:e,values:s}),(v.isDirty||v.dirtyFields)&&r.shouldDirty&&(Ie(a.dirtyFields,e,yt(t,me(u,e,[]),me(a.dirtyFields,e,[]))),m.state.next({name:e,dirtyFields:a.dirtyFields,isDirty:N(e,t)}))):!n||n._f||ce(t)?E(e,t,r,!0):P(e,t,r),j(e)&&m.state.next({}),m.watch.next({name:e})},R=function(){var t=h(y.mark((function t(r){var n,s,u,c,l=arguments;return y.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=l.length>1&&void 0!==l[1]?l[1]:{},s=Me(r),m.state.next({isValidating:!0}),!i.resolver){t.next=10;break}return t.next=6,V(ve(r)?r:s);case 6:c=t.sent,u=r?s.every((function(e){return!me(c,e)})):Te(c),t.next=20;break;case 10:if(!r){t.next=17;break}return t.next=13,Promise.all(s.map(function(){var t=h(y.mark((function t(r){var n;return y.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=me(o,r),t.next=3,C(n._f?e({},r,n):n);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 13:u=t.sent.every(Boolean),T(),t.next=20;break;case 17:return t.next=19,C(o);case 19:u=t.sent;case 20:return m.state.next(Object.assign(Object.assign({},Ye(r)?{name:r}:{}),{errors:a.errors,isValid:u,isValidating:!1})),n.shouldFocus&&!u&&Re(o,(function(e){return me(a.errors,e)}),r?s:d.mount),t.abrupt("return",u);case 23:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),H=function(e){var t=Object.assign(Object.assign({},u),s);return ve(e)?t:Ye(e)?me(t,e):e.map((function(e){return me(t,e)}))},W=function(e){e?Me(e).forEach((function(e){return ot(a.errors,e)})):a.errors={},m.state.next({errors:a.errors})},q=function(e,t,r){var n=(me(o,e,{_f:{}})._f||{}).ref;Ie(a.errors,e,Object.assign(Object.assign({},t),{ref:n})),m.state.next({name:e,errors:a.errors,isValid:!1}),r&&r.shouldFocus&&n&&n.focus&&n.focus()},z=function(e,t){return Je(e)?m.watch.subscribe({next:function(r){return e(M(void 0,t),r)}}):M(e,t,!1,!0)},G=function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=ae(e?Me(e):d.mount);try{for(n.s();!(t=n.n()).done;){var c=t.value;d.mount.delete(c),d.array.delete(c),me(o,c)&&(r.keepValue||(ot(o,c),ot(s,c)),!r.keepError&&ot(a.errors,c),!r.keepDirty&&ot(a.dirtyFields,c),!r.keepTouched&&ot(a.touchedFields,c),!i.shouldUnregister&&!r.keepDefaultValue&&ot(u,c))}}catch(e){n.e(e)}finally{n.f()}m.watch.next({}),m.state.next(Object.assign(Object.assign({},a),r.keepDirty?{isDirty:N()}:{})),!r.keepIsValid&&T()},K=function(e,t,r){J(e,r);var n=me(o,e),i=ve(t.value)&&t.querySelectorAll&&t.querySelectorAll("input,select,textarea")[0]||t,a=Xe(i);i===n._f.ref||a&&he(n._f.refs||[]).find((function(e){return e===i}))||(n={_f:a?Object.assign(Object.assign({},n._f),{refs:[].concat(b(he(n._f.refs||[]).filter((function(e){return $e(e)&&document.contains(e)}))),[i]),ref:{type:i.type,name:e}}):Object.assign(Object.assign({},n._f),{ref:i})},Ie(o,e,n),(!r||!r.disabled)&&F(e,i))},J=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=me(o,e);return Ie(o,e,{_f:Object.assign(Object.assign(Object.assign({},r&&r._f?r._f:{ref:{name:e}}),{name:e,mount:!0}),t)}),t.value&&Ie(s,e,t.value),Ge(t.disabled)&&r&&Ie(s,e,t.disabled?void 0:me(s,e,pt(r._f))),d.mount.add(e),!r&&F(e,void 0,!0),St?{name:e}:Object.assign(Object.assign({name:e},ve(t.disabled)?{}:{disabled:t.disabled}),{onChange:D,onBlur:D,ref:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(r){if(r)K(e,r,t);else{var n=me(o,e,{}),a=i.shouldUnregister||t.shouldUnregister;n._f&&(n._f.mount=!1),a&&(!pe(d.array,e)||!c)&&d.unMount.add(e)}}))})},$=function(e,t){return function(){var r=h(y.mark((function r(n){var u,c,l,f,p;return y.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n&&(n.preventDefault&&n.preventDefault(),n.persist&&n.persist()),u=!0,c=Object.assign({},s),m.state.next({isSubmitting:!0}),r.prev=4,!i.resolver){r.next=15;break}return r.next=8,A();case 8:l=r.sent,f=l.errors,p=l.values,a.errors=f,c=p,r.next=17;break;case 15:return r.next=17,C(o);case 17:if(!Te(a.errors)||!Object.keys(a.errors).every((function(e){return me(c,e)}))){r.next=23;break}return m.state.next({errors:{},isSubmitting:!0}),r.next=21,e(c,n);case 21:r.next=28;break;case 23:if(r.t0=t,!r.t0){r.next=27;break}return r.next=27,t(a.errors,n);case 27:i.shouldFocusError&&Re(o,(function(e){return me(a.errors,e)}),d.mount);case 28:r.next=34;break;case 30:throw r.prev=30,r.t1=r.catch(4),u=!1,r.t1;case 34:return r.prev=34,a.isSubmitted=!0,m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Te(a.errors)&&u,submitCount:a.submitCount+1,errors:a.errors}),r.finish(34);case 38:case"end":return r.stop()}}),r,null,[[4,30,34,38]])})));return function(e){return r.apply(this,arguments)}}()},Z=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e||u,n=He(r);if(s=n,et&&!t.keepValues){var i,c=ae(d.mount);try{for(c.s();!(i=c.n()).done;){var f=i.value,p=me(o,f);if(p&&p._f){var h=Array.isArray(p._f.refs)?p._f.refs[0]:p._f.ref;try{$e(h)&&h.closest("form").reset();break}catch(e){}}}}catch(e){c.e(e)}finally{c.f()}}t.keepDefaultValues||(u=Object.assign({},r)),t.keepValues||(o={},m.control.next({values:t.keepDefaultValues?u:Object.assign({},r)}),m.watch.next({}),m.array.next({values:n})),d={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},m.state.next({submitCount:t.keepSubmitCount?a.submitCount:0,isDirty:t.keepDirty?a.isDirty:!!t.keepDefaultValues&&qe(e,u),isSubmitted:!!t.keepIsSubmitted&&a.isSubmitted,dirtyFields:t.keepDirty?a.dirtyFields:{},touchedFields:t.keepTouched?a.touchedFields:{},errors:t.keepErrors?a.errors:{},isSubmitting:!1,isSubmitSuccessful:!1}),l=!!t.keepIsValid},Q=function(e){return me(o,e)._f.ref.focus()},X=function(){var e,t=ae(d.unMount);try{for(t.s();!(e=t.n()).done;){var r=e.value,n=me(o,r);n&&(n._f.refs?n._f.refs.every(tt):tt(n._f.ref))&&G(r)}}catch(e){t.e(e)}finally{t.f()}d.unMount=new Set};return{control:{register:J,unregister:G,_getWatch:M,_getIsDirty:N,_updateValid:T,_updateValues:L,_removeFields:X,_updateFieldArray:B,_getFieldArrayValue:I,_subjects:m,_shouldUnregister:i.shouldUnregister,_proxyFormState:v,get _fields(){return o},set _fields(e){o=e},get _formValues(){return s},set _formValues(e){s=e},get _isMounted(){return l},set _isMounted(e){l=e},get _defaultValues(){return u},set _defaultValues(e){u=e},get _names(){return d},set _names(e){d=e},get _isInAction(){return c},set _isInAction(e){c=e},get _formState(){return a},set _formState(e){a=e},_updateProps:function(e){i=Object.assign(Object.assign({},Et),e)}},trigger:R,register:J,handleSubmit:$,watch:z,setValue:U,getValues:H,reset:Z,clearErrors:W,unregister:G,setError:q,setFocus:Q}}var Vt=function(e){var t=e.name,i=e.label,a=e.children,o=r.useContext(De).register;return n.createElement(n.Fragment,null,n.createElement(f,s({value:"True"},o(t),{className:"jkl-cookie-consent-modal__checkbox"}),i),n.createElement("p",{className:"jkl-cookie-consent-modal__info-text"},a))},Ct=function(e){var i=e.onAccept,a=D(),o=a.consent,s=a.dispatch,u=a.isOpen,f=a.requirement,h=a.showSettings,v=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.useRef(),i=r.useState({isDirty:!1,isValidating:!1,dirtyFields:{},isSubmitted:!1,submitCount:0,touchedFields:{},isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,errors:{}}),a=t(i,2),o=a[0],s=a[1];n.current?n.current.control._updateProps(e):n.current=Object.assign(Object.assign({},At(e)),{formState:o});var u=n.current.control;return r.useEffect((function(){var e=u._subjects.state.subscribe({next:function(e){Pe(e,u._proxyFormState,!0)&&(u._formState=Object.assign(Object.assign({},u._formState),e),s(Object.assign({},u._formState)))}});return function(){e.unsubscribe()}}),[u]),r.useEffect((function(){u._isMounted||(u._isMounted=!0,u._proxyFormState.isValid&&u._updateValid(),!e.shouldUnregister&&u._updateValues(u._defaultValues)),u._removeFields()})),n.current.formState=Ne(o,u._proxyFormState),n.current}({defaultValues:x(o)}),m=function(e){i("implicit"===e?_(f):e)};return n.createElement(ie,{backdrop:!0,strict:!0,hidden:!u,"aria-label":"Informasjonskapsler",className:"jkl-cookie-consent-modal","data-testautoid":"jkl-cookie-consent-modal"},h?n.createElement(Fe,v,n.createElement("h1",{className:"jkl-cookie-consent-modal__header"},"Informasjonskapsler"),n.createElement(c,{className:"jkl-cookie-consent-modal__checklist"},n.createElement(l,null,"Nettsidene skal fungere teknisk")),n.createElement("p",{className:"jkl-cookie-consent-modal__info-text"},"For at nettsidene skal fungere, må vi bruke tekniske informasjonskapsler. Denne kan derfor ikke slås av."),n.createElement("form",{onSubmit:v.handleSubmit((function(e){m(_(e))}))},f.functional&&n.createElement(Vt,{name:"functional",label:"Tillat funksjonelle"},"Funksjonelle informasjonskapsler lagrer opplysninger om din bruk av nettsidene og hvilke innstillinger du har gjort, slik at du kan få funksjonalitet tilpasset deg."),f.statistics&&n.createElement(Vt,{name:"statistics",label:"Tillat statistikk"},"Informasjonskapslene lagrer statistikk som hjelper oss med å forstå hvordan nettsidene blir brukt, slik at vi kan gjøre dem bedre og enklere å bruke."),f.marketing&&n.createElement(Vt,{name:"marketing",label:"Tillat personlig markedsføring"},"Dette gjør at vi kan gi deg mer relevant og tilpasset markedsføring, også gjennom våre samarbeidspartnere, på for eksempel nettsider, annonser og i sosiale medier."),n.createElement("div",{className:"jkl-cookie-consent-modal__button-group"},n.createElement(d,{"data-testid":"jkl-cookie-consent-godta"},"Godta")))):n.createElement(n.Fragment,null,n.createElement("h1",{className:"jkl-cookie-consent-modal__header"},"Vi bruker informasjonskapsler slik at:"),n.createElement(c,{className:"jkl-cookie-consent-modal__checklist"},n.createElement(l,null,"Nettsidene skal fungere teknisk"),f.functional&&n.createElement(l,null,"Nettsidene skal tilpasses din bruk, dine valg og dine innstillinger."),f.statistics&&n.createElement(l,null,"Vi kan samle statistikk på hvordan nettsidene brukes og dermed kunne forbedre tjenestene våre."),f.marketing&&n.createElement(l,null,"Vi kan gi deg personlig tilpasset innhold og relevante annonser, også gjennom våre samarbeidspartnere, på for eksempel nettsider og i sosiale medier.")),n.createElement("div",{className:"jkl-cookie-consent-modal__button-group"},n.createElement(d,{onClick:function(){return m("implicit")},"data-testid":"jkl-cookie-consent-godta"},"Godta"),n.createElement(p,{onClick:function(){s({type:"SET_SHOW_SETTINGS",payload:!0})}},"Innstillinger"))))};function Dt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ft(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?Dt(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Dt(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var Nt=function(e){var r=e.blocking,i=e.onAccept,s=D(),u=s.dispatch,c=s.consent,l=o(c);if(a((function(){i&&c!==l&&i(c)}),[i,c,l]),navigator&&!navigator.cookieEnabled)return i&&i({functional:"denied",marketing:"denied",statistics:"denied"}),null;return r?n.createElement(Ct,{onAccept:function(e){var r=Object.fromEntries(Object.entries(e).filter((function(e){var r=t(e,2);return r[0],null!=r[1]}))),n=Ft(Ft({},c),r);u({type:"UPDATE_CONSENT",payload:n}),u({type:"SET_SHOW_CONSENT",payload:!1}),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10368e3,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:O,n=[];n.push("".concat(r,"=").concat(JSON.stringify(e))),n.push("max-age=".concat(t)),n.push("SameSite=Lax"),document.cookie=n.join(";")}(n)}}):null};export{Nt as CookieConsent,C as CookieConsentProvider,F as useCookieConsent}; | ||
import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/slicedToArray";import*as r from"react";import n,{useMemo as i,useEffect as a}from"react";import{usePreviousValue as o}from"@fremtind/jkl-react-hooks";import s from"@babel/runtime/helpers/extends";import u from"@babel/runtime/helpers/typeof";import{UnorderedList as c,CheckListItem as l}from"@fremtind/jkl-list-react";import{Checkbox as f}from"@fremtind/jkl-checkbox-react";import{PrimaryButton as d,TertiaryButton as p}from"@fremtind/jkl-button-react";import h from"@babel/runtime/helpers/asyncToGenerator";import m from"@babel/runtime/helpers/classCallCheck";import v from"@babel/runtime/helpers/createClass";import b from"@babel/runtime/helpers/toConsumableArray";import y from"@babel/runtime/regenerator";function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function k(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?g(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var O="fremtind-cookie-consent",w=function(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:O,t=document.cookie.split(";").map((function(e){return e.trim().split("=")})).find((function(t){return t[0]===e}));if(t)return t}();return t?JSON.parse(t[1]):e?e():void 0},j=function(e){if(e)return"denied"!==e},x=function(e){var r=Object.entries(k(k({},{functional:null,marketing:null,statistics:null}),e)).map((function(e){var r=t(e,2),n=r[0],i=r[1];return[n,j(i)]}));return Object.fromEntries(r)},_=function(e){var r={functional:void 0,marketing:void 0,statistics:void 0},n=Object.entries(k(k({},r),e)).map((function(e){var r,n=t(e,2),i=n[0],a=n[1];return[i,(r=a,void 0===r?null:!1===r||"false"===String(r).toLowerCase()?"denied":"accepted")]}));return Object.fromEntries(n)};function E(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function S(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?E(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):E(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var A=n.createContext(void 0),V=function(e,t){switch(t.type){case"SET_SHOW_CONSENT":return S(S({},e),{},{isOpen:t.payload});case"SET_SHOW_SETTINGS":return S(S({},e),{},{showSettings:t.payload});case"UPDATE_CONSENT":return S(S({},e),{},{consent:S(S({},e.consent),t.payload)});default:throw new Error("Unhandled action type: ".concat(t.type))}},C=function(e){var r=e.children,o=e.cookieAdapter,s=e.marketing,u=e.functional,c=e.statistics,l=i((function(){var e;return null!==(e=w(o))&&void 0!==e?e:{marketing:null,functional:null,statistics:null}}),[o]),f=i((function(){return{marketing:null!=s&&s,functional:null!=u&&u,statistics:null!=c&&c}}),[s,u,c]),d=n.useReducer(V,{isOpen:!1,showSettings:!1,requirement:f,consent:l}),p=t(d,2),h=p[0],m=p[1];a((function(){!function(e,r){if(r){for(var n=new Map(Object.entries(r)),i=0,a=Object.entries(e);i<a.length;i++){var o=t(a[i],2),s=o[0];if(o[1]&&null===n.get(s))return!0}return!1}return Object.values(e).some((function(e){return e}))}(f,l)?l&&m({type:"UPDATE_CONSENT",payload:l}):m({type:"SET_SHOW_CONSENT",payload:!0})}),[f,l]);var v={state:h,dispatch:m};return n.createElement(A.Provider,{value:v},r)},F=function(){var e=n.useContext(A);if(void 0===e)throw new Error("useCookieConsentState must be used within a CookieConsentProvider");return S({dispatch:e.dispatch},e.state)},D=function(){var e=n.useContext(A);if(void 0===e)throw new Error("useCookieConsent must be used within a CookieConsentProvider");return{openConsentModalWithSettings:function(){e.dispatch({type:"SET_SHOW_CONSENT",payload:!0}),e.dispatch({type:"SET_SHOW_SETTINGS",payload:!0})}}};function N(e){return e&&"object"===u(e)&&"default"in e?e:{default:e}}var P=N(require("react"));function T(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function M(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function B(e){return(B=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function U(e,t){return(U=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function L(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function I(e,t,r){return(I=L()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&U(i,r.prototype),i}).apply(null,arguments)}function R(e){var t="function"==typeof Map?new Map:void 0;return(R=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return I(e,arguments,B(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),U(n,e)})(e)}function H(e,t){return!t||"object"!==u(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function W(e){return function(e){if(Array.isArray(e))return q(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return q(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return q(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var z="undefined"!=typeof window;z&&/(android)/i.test(navigator.userAgent),z&&/iPad|iPhone|iPod/.test(String(navigator.platform)),z||global.HTMLElement||(global.HTMLElement=function(){return function e(){T(this,e)}}());var G,K,$=(G="undefined"==typeof window?{}:window.Element.prototype,K=G.matches||G.msMatchesSelector||G.webkitMatchesSelector,G.closest?function(e,t){return e.closest(t)}:function(e,t){for(e.correspondingUseElement&&(e=e.correspondingUseElement);e;e=e.parentElement)if(K.call(e,t))return e;return null});function J(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:!this.hasAttribute(t);return!r===e.hasAttribute(t)&&e[r?"setAttribute":"removeAttribute"](t,""),r}function Z(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(e){if(e.nodeType)return[e];if("string"==typeof e)return[].slice.call(t.querySelectorAll(e));if(e.length)return[].slice.call(e)}return[]}var Q="[tabindex],a,button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled])",X=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&U(e,t)}(s,R(HTMLElement));var t,r,n,i,a,o=(t=s,r=L(),function(){var e,n=B(t);if(r){var i=B(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return H(this,e)});function s(){return T(this,s),o.apply(this,arguments)}return n=s,a=[{key:"observedAttributes",get:function(){return["hidden","backdrop"]}}],(i=[{key:"connectedCallback",value:function(){this._focus=!0,this._autoBackdrop=null,this.attributeChangedCallback(),this.addEventListener("transitionend",this),document.addEventListener("keydown",this),document.addEventListener("click",this)}},{key:"disconnectedCallback",value:function(){re(this._focus),this._autoBackdrop&&this._autoBackdrop.parentNode.removeChild(this._autoBackdrop),this._focus=this._autoBackdrop=null,this.removeEventListener("transitionend",this),document.removeEventListener("keydown",this),document.removeEventListener("click",this)}},{key:"attributeChangedCallback",value:function(e,t,r){var n=this;if(this._focus){var i="backdrop"===e&&Y(this,t),a=this.backdrop;if(this.className=this.className,this.setAttribute("role","dialog"),this.setAttribute("aria-modal",Boolean(a)),i&&i.setAttribute("hidden",""),a&&J(a,"hidden",this.hidden),this.hidden)re(this._focus);else{var o=window.getComputedStyle(this).getPropertyValue("z-index");if(("auto"===o||"0"===o)&&""===this.style.zIndex){var s=Z(this.nodeName).filter((function(e){return e!==a&&!n.contains(e)&&ee(e)}));o=Math.min(Math.max.apply(Math,[1].concat(W(s.map(te)))),2e9),a&&(a.style.zIndex=o+1),this.style.zIndex=o+2}this._focus=document.activeElement||document.body,setTimeout((function(){return ne(n)}))}"hidden"===e&&r!==t&&function(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i="prevent_recursive_dispatch_maximum_callstack".concat(t);if(e[i])return!0;e[i]=!0,"function"==typeof window.CustomEvent?r=new window.CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n}):(r=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,n);e.dispatchEvent(r);e[i]=null}(this,"dialog.toggle")}}},{key:"handleEvent",value:function(e){if(!e.defaultPrevented)if("transitionend"!==e.type||e.target!==this||this.hidden){if("click"===e.type){if(e.target===this.backdrop&&!this.strict)return this.close();var t=$(e.target,"button"),r=t&&(t.getAttribute("data-for")||t.getAttribute("for"));"close"===r&&$(e.target,this.nodeName)===this?this.close():r===this.id&&this.show()}else if("keydown"===e.type&&(9===e.keyCode||27===e.keyCode)&&!this.hidden){if(Z("".concat(this.nodeName,":not([hidden])")).sort((function(e,t){return te(e)-te(t)})).pop()!==this)return;9===e.keyCode&&function(e,t){var r=Z(Q,e).filter(ee),n=r[t.shiftKey?0:r.length-1];t.target!==n&&e.contains(t.target)||(t.preventDefault(),r[t.shiftKey?r.length-1:0].focus())}(this,e),27!==e.keyCode||this.strict||(e.preventDefault(),this.close())}}else ne(this)}},{key:"close",value:function(){this.hidden=!0}},{key:"show",value:function(){this.hidden=!1}},{key:"open",get:function(){return!this.hidden},set:function(e){this.hidden=!e}},{key:"strict",get:function(){return this.hasAttribute("strict")},set:function(e){J(this,"strict",e)}},{key:"hidden",get:function(){return this.hasAttribute("hidden")},set:function(e){J(this,"hidden",e)}},{key:"backdrop",get:function(){return Y(this,this.getAttribute("backdrop"))},set:function(e){this.setAttribute("backdrop",e||"false")}}])&&M(n.prototype,i),a&&M(n,a),s}();function Y(e,t){var r=e.nextElementSibling;return!(!e.parentNode||"false"===t)&&(t&&"true"!==t?document.getElementById(t)||!1:r&&"BACKDROP"===r.nodeName?r:(e._autoBackdrop=document.createElement("backdrop"),e.insertAdjacentElement("afterend",e._autoBackdrop)))}function ee(e){return e.offsetWidth&&e.offsetHeight&&"hidden"!==window.getComputedStyle(e).getPropertyValue("visibility")}function te(e){for(var t=1,r=e;r;r=r.offsetParent)t+=Number(window.getComputedStyle(r).getPropertyValue("z-index"))||0;return t}function re(e){setTimeout((function(){try{e.focus()}catch(e){}}))}function ne(e){if(!e.contains(document.activeElement)&&ee(e)){var t=Z("[autofocus]",e).concat(Z(Q,e)).filter(ee)[0];try{t.focus()}catch(t){console.warn(e,'is initialized without focusable elements. Please add [tabindex="-1"] the main element (for instance a <h1>)')}}}var ie=function(){var e="undefined"==typeof window?{}:window.Element.prototype,t=e.matches||e.msMatchesSelector||e.webkitMatchesSelector;return e.closest?function(e,t){return e.closest(t)}:function(e,r){for(;e;e=e.parentElement)if(t.call(e,r))return e;return null}}();var ae=function(e,t){void 0===t&&(t={});var r=(t.name||e.name||String(e).match(/function ([^(]+)/)[1]).replace(/.[A-Z]/g,(function(e){return e[0]+"-"+e[1]})),n=t.props||[],i=t.customEvents||[],a=i.reduce((function(e,t){return e[t]="on"+t.replace(/(^|\.)./g,(function(e){return e.slice(-1).toUpperCase()})),e}),{}),o=n.concat("forwardRef",Object.keys(a).map((function(e){return a[e]}))),s=(r+"-"+(t.suffix||"react")).replace(/\W+/g,"-").toLowerCase();return function(t){function r(e){var r=this;t.call(this,e),this.ref=function(e){return"function"==typeof r.props.forwardRef?r.props.forwardRef(e):r.props.forwardRef&&(r.props.forwardRef.current=e),r.el=e},Object.keys(a).forEach((function(e){var t=a[e];r[e]=function(e){r.props[t]&&ie(e.target,r.el.nodeName)===r.el&&r.props[t](e)}}))}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.componentDidMount=function(){var t=this;window.customElements.get(s)||window.customElements.define(s,e),n.forEach((function(e){e in t.props&&(t.el[e]=t.props[e])})),i.forEach((function(e){t.el.addEventListener(e,t[e])}))},r.prototype.componentDidUpdate=function(e){var t=this;n.forEach((function(r){e[r]!==t.props[r]&&(t.el[r]=t.props[r])}))},r.prototype.componentWillUnmount=function(){var e=this;i.forEach((function(t){e.el.removeEventListener(t,e[t])}))},r.prototype.render=function(){var e=this;return P.default.createElement(s,Object.keys(this.props).reduce((function(t,r){return-1===o.indexOf(r)&&("className"===r?t.class=e.props[r]:!0===e.props[r]?t[r]="":!1!==e.props[r]&&(t[r]=e.props[r])),t}),{ref:this.ref}))},r}(P.default.Component)}(X,{customEvents:["dialog.toggle"],props:["backdrop"],suffix:"3.1.0"});function oe(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return se(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return se(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function se(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var ue=function(e){return"checkbox"===e.type},ce=function(e){return e instanceof Date},le=function(e){return null==e},fe=function(e){return"object"===u(e)},de=function(e){return!le(e)&&!Array.isArray(e)&&fe(e)&&!ce(e)},pe=function(e){return e.substring(0,e.search(/.\d/))||e},he=function(e,t){return b(e).some((function(e){return pe(t)===e}))},me=function(e){return e.filter(Boolean)},ve=function(e){return void 0===e},be=function(e,t,r){if(de(e)&&t){var n=me(t.split(/[,[\].]+?/)).reduce((function(e,t){return le(e)?e:e[t]}),e);return ve(n)||n===e?ve(e[t])?r:e[t]:n}},ye="blur",ge="onBlur",ke="onChange",Oe="onSubmit",we="onTouched",je="all",xe="max",_e="min",Ee="maxLength",Se="minLength",Ae="pattern",Ve="required",Ce="validate",Fe=function(e,t){var r=Object.assign({},e);return delete r[t],r},De=r.createContext(null);De.displayName="RHFContext";var Ne=function(e){return r.createElement(De.Provider,{value:Fe(e,"children")},e.children)},Pe=function(e,t,r){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];function i(i){return function(){if(i in e)return t[i]!==je&&(t[i]=!n||je),r&&(r[i]=!0),e[i]}}var a={};for(var o in e)Object.defineProperty(a,o,{get:i(o)});return a},Te=function(e){return de(e)&&!Object.keys(e).length},Me=function(e,t,r){var n=Fe(e,"name");return Te(n)||Object.keys(n).length>=Object.keys(t).length||Object.keys(n).find((function(e){return t[e]===(!r||je)}))},Be=function(e){return Array.isArray(e)?e:[e]};function Ue(e){var t=e.disabled,n=e.subject,i=e.callback,a=r.useRef(n),o=r.useRef();t?a.current&&(o.current&&o.current.unsubscribe(),a.current=o.current=void 0):(a.current||(a.current=n),!o.current&&a.current&&(o.current=a.current.subscribe({next:i}))),r.useEffect((function(){return function(){o.current&&o.current.unsubscribe()}}),[])}var Le=function(t,r,n,i,a){return r?Object.assign(Object.assign({},n[t]),{types:Object.assign(Object.assign({},n[t]&&n[t].types?n[t].types:{}),e({},i,a||!0))}):{}},Ie=function(e){return/^\w*$/.test(e)},Re=function(e){return me(e.replace(/["|']|\]/g,"").split(/\.|\[/))};function He(e,t,r){for(var n=-1,i=Ie(t)?[t]:Re(t),a=i.length,o=a-1;++n<a;){var s=i[n],u=r;if(n!==o){var c=e[s];u=de(c)||Array.isArray(c)?c:isNaN(+i[n+1])?{}:[]}e[s]=u,e=e[s]}return e}var We=function e(t,r,n){var i,a=oe(n||Object.keys(t));try{for(a.s();!(i=a.n()).done;){var o=i.value,s=be(t,o);if(s){var u=s._f,c=Fe(s,"_f");if(u&&r(u.name)){if(u.ref.focus&&ve(u.ref.focus()))break;if(u.refs){u.refs[0].focus();break}}else de(c)&&e(c,r)}}}catch(e){a.e(e)}finally{a.f()}},qe=function(e,t){return e.map((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Fe(e,t)}))};function ze(e){var t,r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(!r&&!de(e))return e;for(var n in t=r?[]:{},e)t[n]=ze(e[n])}return t}var Ge=function(e){return le(e)||!fe(e)};function Ke(e,t){if(Ge(e)||Ge(t)||ce(e)||ce(t))return e===t;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(var i=0,a=r;i<a.length;i++){var o=a[i],s=e[o];if(!n.includes(o))return!1;if("ref"!==o){var u=t[o];if((de(s)||Array.isArray(s))&&(de(u)||Array.isArray(u))?!Ke(s,u):s!==u)return!1}}return!0}var $e=function(e){return{isOnSubmit:!e||e===Oe,isOnBlur:e===ge,isOnChange:e===ke,isOnAll:e===je,isOnTouch:e===we}},Je=function(e){return"boolean"==typeof e},Ze=function(e){return"file"===e.type},Qe=function(e){return"function"==typeof e},Xe=function(e){return e instanceof HTMLElement},Ye=function(e){return"select-multiple"===e.type},et=function(e){return"radio"===e.type},tt=function(e){return et(e)||ue(e)},rt=function(e){return"string"==typeof e},nt="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document,it=function(e){return!Xe(e)||!document.contains(e)},at=function(){function e(){m(this,e),this.tearDowns=[]}return v(e,[{key:"add",value:function(e){this.tearDowns.push(e)}},{key:"unsubscribe",value:function(){var e,t=oe(this.tearDowns);try{for(t.s();!(e=t.n()).done;){(0,e.value)()}}catch(e){t.e(e)}finally{t.f()}this.tearDowns=[]}}]),e}(),ot=function(){function e(t,r){var n=this;m(this,e),this.observer=t,this.closed=!1,r.add((function(){return n.closed=!0}))}return v(e,[{key:"next",value:function(e){this.closed||this.observer.next(e)}}]),e}(),st=function(){function e(){m(this,e),this.observers=[]}return v(e,[{key:"next",value:function(e){var t,r=oe(this.observers);try{for(r.s();!(t=r.n()).done;){t.value.next(e)}}catch(e){r.e(e)}finally{r.f()}}},{key:"subscribe",value:function(e){var t=new at,r=new ot(e,t);return this.observers.push(r),t}},{key:"unsubscribe",value:function(){this.observers=[]}}]),e}();function ut(e,t){var r,n=Ie(t)?[t]:Re(t),i=1==n.length?e:function(e,t){for(var r=t.slice(0,-1).length,n=0;n<r;)e=ve(e)?n++:e[t[n++]];return e}(e,n),a=n[n.length-1];i&&delete i[a];for(var o=0;o<n.slice(0,-1).length;o++){var s=-1,u=void 0,c=n.slice(0,-(o+1)),l=c.length-1;for(o>0&&(r=e);++s<c.length;){var f=c[s];u=u?u[f]:e[f],l===s&&(de(u)&&Te(u)||Array.isArray(u)&&!u.filter((function(e){return de(e)&&!Te(e)||Je(e)})).length)&&(r?delete r[f]:delete e[f]),r=u}}return e}var ct={value:!1,isValid:!1},lt={value:!0,isValid:!0},ft=function(e){if(Array.isArray(e)){if(e.length>1){var t=e.filter((function(e){return e&&e.checked&&!e.disabled})).map((function(e){return e.value}));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!ve(e[0].attributes.value)?ve(e[0].value)||""===e[0].value?lt:{value:e[0].value,isValid:!0}:lt:ct}return ct},dt=function(e,t){var r=t.valueAsNumber,n=t.valueAsDate,i=t.setValueAs;return ve(e)?e:r?""===e?NaN:+e:n?new Date(e):i?i(e):e},pt={isValid:!1,value:null},ht=function(e){return Array.isArray(e)?e.reduce((function(e,t){return t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e}),pt):pt};function mt(e){var t,r=e.ref;if(!(e.refs?e.refs.every((function(e){return e.disabled})):r.disabled))return Ze(r)?r.files:et(r)?ht(e.refs).value:Ye(r)?(t=r.options,b(t).filter((function(e){return e.selected})).map((function(e){return e.value}))):ue(r)?ft(e.refs).value:dt(ve(r.value)?e.ref.value:r.value,e)}var vt=function(e,t,r,n){var i,a={},o=oe(e);try{for(o.s();!(i=o.n()).done;){var s=i.value,u=be(t,s);u&&He(a,s,u._f)}}catch(e){o.e(e)}finally{o.f()}return{criteriaMode:r,names:b(e),fields:a,shouldUseNativeValidation:n}},bt=function(e){return e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate)};function yt(e,t){if(Ge(e)||Ge(t))return t;for(var r in t){var n=e[r],i=t[r];try{e[r]=de(n)&&de(i)||Array.isArray(n)&&Array.isArray(i)?yt(n,i):i}catch(e){}}return e}function gt(t,r,n,i,a){for(var o=-1;++o<t.length;){for(var s in t[o])Array.isArray(t[o][s])?(!n[o]&&(n[o]={}),n[o][s]=[],gt(t[o][s],be(r[o]||{},s,[]),n[o][s],n[o],s)):!le(r)&&Ke(be(r[o]||{},s),t[o][s])?He(n[o]||{},s):n[o]=Object.assign(Object.assign({},n[o]),e({},s,!0));i&&!n.length&&delete i[a]}return n}var kt=function(e,t,r){return yt(gt(e,t,r.slice(0,e.length)),gt(t,e,r.slice(0,e.length)))},Ot=function(e,t,r,n,i){return!i.isOnAll&&(!r&&i.isOnTouch?!(t||e):(r?n.isOnBlur:i.isOnBlur)?!e:!(r?n.isOnChange:i.isOnChange)||e)},wt=function(e,t){return!me(be(e,t,[])).length&&ut(e,t)},jt=function(e){return rt(e)||r.isValidElement(e)},xt=function(e){return e instanceof RegExp};function _t(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"validate";if(jt(e)||Array.isArray(e)&&e.every(jt)||Je(e)&&!e)return{type:r,message:jt(e)?e:"",ref:t}}var Et=function(e){return de(e)&&!xt(e)?e:{value:e,message:""}},St=function(){var e=h(y.mark((function e(t,r,n,i){var a,o,s,u,c,l,f,d,p,h,m,v,b,g,k,O,w,j,x,_,E,S,A,V,C,F,D,N,P,T,M,B,U,L,I,R,H,W,q,z,G,K,$,J;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t._f,o=a.ref,s=a.refs,u=a.required,c=a.maxLength,l=a.minLength,f=a.min,d=a.max,p=a.pattern,h=a.validate,m=a.name,v=a.valueAsNumber,b=a.mount,g=a.disabled,b&&!g){e.next=3;break}return e.abrupt("return",{});case 3:if(k=s?s[0]:o,O=function(e){i&&k.reportValidity&&(k.setCustomValidity(Je(e)?"":e||" "),k.reportValidity())},w={},j=et(o),x=ue(o),_=j||x,E=(v||Ze(o))&&!o.value||""===r||Array.isArray(r)&&!r.length,S=Le.bind(null,m,n,w),A=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ee,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Se,a=e?t:r;w[m]=Object.assign({type:e?n:i,message:a,ref:o},S(e?n:i,a))},!u||!(!_&&(E||le(r))||Je(r)&&!r||x&&!ft(s).isValid||j&&!ht(s).isValid)){e.next=19;break}if(V=jt(u)?{value:!!u,message:u}:Et(u),C=V.value,F=V.message,!C){e.next=19;break}if(w[m]=Object.assign({type:Ve,message:F,ref:k},S(Ve,F)),n){e.next=19;break}return O(F),e.abrupt("return",w);case 19:if(E||le(f)&&le(d)){e.next=28;break}if(P=Et(d),T=Et(f),isNaN(r)?(B=o.valueAsDate||new Date(r),rt(P.value)&&(D=B>new Date(P.value)),rt(T.value)&&(N=B<new Date(T.value))):(M=o.valueAsNumber||parseFloat(r),le(P.value)||(D=M>P.value),le(T.value)||(N=M<T.value)),!D&&!N){e.next=28;break}if(A(!!D,P.message,T.message,xe,_e),n){e.next=28;break}return O(w[m].message),e.abrupt("return",w);case 28:if(!c&&!l||E||!rt(r)){e.next=38;break}if(U=Et(c),L=Et(l),I=!le(U.value)&&r.length>U.value,R=!le(L.value)&&r.length<L.value,!I&&!R){e.next=38;break}if(A(I,U.message,L.message),n){e.next=38;break}return O(w[m].message),e.abrupt("return",w);case 38:if(!p||E||!rt(r)){e.next=45;break}if(H=Et(p),W=H.value,q=H.message,!xt(W)||r.match(W)){e.next=45;break}if(w[m]=Object.assign({type:Ae,message:q,ref:o},S(Ae,q)),n){e.next=45;break}return O(q),e.abrupt("return",w);case 45:if(!h){e.next=79;break}if(!Qe(h)){e.next=58;break}return e.next=49,h(r);case 49:if(z=e.sent,!(G=_t(z,k))){e.next=56;break}if(w[m]=Object.assign(Object.assign({},G),S(Ce,G.message)),n){e.next=56;break}return O(G.message),e.abrupt("return",w);case 56:e.next=79;break;case 58:if(!de(h)){e.next=79;break}K={},e.t0=y.keys(h);case 61:if((e.t1=e.t0()).done){e.next=75;break}if($=e.t1.value,Te(K)||n){e.next=65;break}return e.abrupt("break",75);case 65:return e.t2=_t,e.next=68,h[$](r);case 68:e.t3=e.sent,e.t4=k,e.t5=$,(J=(0,e.t2)(e.t3,e.t4,e.t5))&&(K=Object.assign(Object.assign({},J),S($,J.message)),O(J.message),n&&(w[m]=K)),e.next=61;break;case 75:if(Te(K)){e.next=79;break}if(w[m]=Object.assign({ref:k},K),n){e.next=79;break}return e.abrupt("return",w);case 79:return O(!0),e.abrupt("return",w);case 81:case"end":return e.stop()}}),e)})));return function(t,r,n,i){return e.apply(this,arguments)}}(),At={mode:Oe,reValidateMode:ke,shouldFocusError:!0},Vt="undefined"==typeof window;function Ct(){var r,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=Object.assign(Object.assign({},At),n),a={isDirty:!1,isValidating:!1,dirtyFields:{},isSubmitted:!1,submitCount:0,touchedFields:{},isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,errors:{}},o={},s=i.defaultValues||{},u=i.shouldUnregister?{}:ze(s),c={action:!1,mount:!1,watch:!1},l=0,f={mount:new Set,unMount:new Set,array:new Set,watch:new Set},d={},p={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={watch:new st,control:new st,array:new st,state:new st},v=$e(i.mode),g=$e(i.reValidateMode),k=i.criteriaMode===je,O=function(e,t){return function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];clearTimeout(l),l=window.setTimeout((function(){return e.apply(void 0,n)}),t)}},w=function(e){return f.watchAll||f.watch.has(e)||f.watch.has((e.match(/\w+/)||[])[0])},j=function(e,t){He(a.errors,e,t),m.state.next({errors:a.errors})},x=function(){var e=h(y.mark((function e(t,i,o,s,u){var c,f,h;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:c=be(a.errors,i),f=p.isValid&&a.isValid!==o,n.delayError&&s?(r=r||O(j,n.delayError))(i,s):(clearTimeout(l),s?He(a.errors,i,s):ut(a.errors,i)),(s?Ke(c,s):!c)&&Te(u)&&!f||t||(h=Object.assign(Object.assign(Object.assign({},u),f?{isValid:o}:{}),{errors:a.errors,name:i}),a=Object.assign(Object.assign({},a),h),m.state.next(h)),d[i]--,p.isValidating&&!d[i]&&(m.state.next({isValidating:!1}),d={});case 6:case"end":return e.stop()}}),e)})));return function(t,r,n,i,a){return e.apply(this,arguments)}}(),_=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3?arguments[3]:void 0,i=be(o,e),a=t;if(i){var s=i._f;s&&(He(u,e,dt(t,s)),a=nt&&Xe(s.ref)&&le(t)?"":t,Ze(s.ref)&&!rt(a)?s.ref.files=a:Ye(s.ref)?b(s.ref.options).forEach((function(e){return e.selected=a.includes(e.value)})):s.refs?ue(s.ref)?s.refs.length>1?s.refs.forEach((function(e){return e.checked=Array.isArray(a)?!!a.find((function(t){return t===e.value})):a===e.value})):s.refs[0].checked=!!a:s.refs.forEach((function(e){return e.checked=e.value===a})):s.ref.value=a,n&&m.control.next({values:u,name:e}))}(r.shouldDirty||r.shouldTouch)&&E(e,a,r.shouldTouch),r.shouldValidate&&L(e)},E=function(e,t,r){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i={name:e},o=!1;if(p.isDirty){var u=a.isDirty;a.isDirty=D(),i.isDirty=a.isDirty,o=u!==i.isDirty}if(p.dirtyFields&&!r){var c=be(a.dirtyFields,e),l=!Ke(be(s,e),t);l?He(a.dirtyFields,e,!0):ut(a.dirtyFields,e),i.dirtyFields=a.dirtyFields,o=o||c!==be(a.dirtyFields,e)}var f=be(a.touchedFields,e);return r&&!f&&(He(a.touchedFields,e,r),i.touchedFields=a.touchedFields,o=o||p.touchedFields&&f!==r),o&&n&&m.state.next(i),o?i:{}},S=function(){var e=h(y.mark((function e(t){return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!i.resolver){e.next=6;break}return e.next=3,i.resolver(Object.assign({},u),i.context,vt(t||f.mount,o,i.criteriaMode,i.shouldUseNativeValidation));case 3:e.t0=e.sent,e.next=7;break;case 6:e.t0={};case 7:return e.abrupt("return",e.t0);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),A=function(){var e=h(y.mark((function e(t){var r,n,i,o,s,u;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,S();case 2:if(r=e.sent,n=r.errors,t){i=oe(t);try{for(i.s();!(o=i.n()).done;)s=o.value,(u=be(n,s))?He(a.errors,s,u):ut(a.errors,s)}catch(e){i.e(e)}finally{i.f()}}else a.errors=n;return e.abrupt("return",n);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),V=function(){var e=h(y.mark((function e(t,r){var n,o,s,c,l,f,d=arguments;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=d.length>2&&void 0!==d[2]?d[2]:{valid:!0},e.t0=y.keys(t);case 2:if((e.t1=e.t0()).done){e.next=23;break}if(o=e.t1.value,!(s=t[o])){e.next=21;break}if(c=s._f,l=Fe(s,"_f"),!c){e.next=17;break}return e.next=11,St(s,be(u,c.name),k,i.shouldUseNativeValidation);case 11:if(!(f=e.sent)[c.name]){e.next=16;break}if(n.valid=!1,!r){e.next=16;break}return e.abrupt("break",23);case 16:r||(f[c.name]?He(a.errors,c.name,f[c.name]):ut(a.errors,c.name));case 17:if(e.t2=l,!e.t2){e.next=21;break}return e.next=21,V(l,r,n);case 21:e.next=2;break;case 23:return e.abrupt("return",n.valid);case 24:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),C=function(){var e=h(y.mark((function e(t){var r,n,s,c,l,f,h,b,O,j,_,A,V,C,F,D;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.target,n=r.name,!(s=be(o,n))){e.next=37;break}if(f=r.type?mt(s._f):r.value,(h=t.type===ye)&&s._f.onBlur?s._f.onBlur(t):s._f.onChange&&s._f.onChange(t),b=!bt(s._f)&&!i.resolver&&!be(a.errors,n)&&!s._f.deps||Ot(h,be(a.touchedFields,n),a.isSubmitted,g,v),O=!h&&w(n),He(u,n,f),j=E(n,f,h,!1),_=!Te(j)||O,!h&&m.watch.next({name:n,type:t.type}),!b){e.next=15;break}return e.abrupt("return",_&&m.state.next(Object.assign({name:n},O?{}:j)));case 15:if(!h&&O&&m.state.next({}),d[n]=(d[n],1),p.isValidating&&m.state.next({isValidating:!0}),!i.resolver){e.next=28;break}return e.next=21,S([n]);case 21:A=e.sent,V=A.errors,c=be(V,n),ue(r)&&!c&&(C=pe(n),F=be(o,C),Array.isArray(F)&&F.every((function(e){return e._f&&ue(e._f.ref)}))&&((D=be(V,C,{})).type&&(c=D),n=C)),l=Te(V),e.next=35;break;case 28:return e.next=30,St(s,be(u,n),k,i.shouldUseNativeValidation);case 30:return e.t0=n,c=e.sent[e.t0],e.next=34,N(!0);case 34:l=e.sent;case 35:s._f.deps&&L(s._f.deps),x(!1,n,l,c,j);case 37:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),F=function(e,t,r){var n=be(o,e);if(n){var i=be(u,e),a=ve(i)?be(s,e):i;ve(a)||r&&r.defaultChecked||t?He(u,e,t?a:mt(n._f)):_(e,a)}c.mount&&N()},D=function(e,t){return e&&t&&He(u,e,t),!Ke(Object.assign({},I()),s)},N=function(){var e=h(y.mark((function e(t){var r;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=!1,!p.isValid){e.next=15;break}if(!i.resolver){e.next=10;break}return e.t1=Te,e.next=6,S();case 6:e.t2=e.sent.errors,e.t0=(0,e.t1)(e.t2),e.next=13;break;case 10:return e.next=12,V(o,!0);case 12:e.t0=e.sent;case 13:r=e.t0,t||r===a.isValid||(a.isValid=r,m.state.next({isValid:r}));case 15:return e.abrupt("return",r);case 16:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),P=function e(r,n,i){return Object.entries(n).forEach((function(n){var a=t(n,2),s=a[0],u=a[1],c="".concat(r,".").concat(s),l=be(o,c);!f.array.has(r)&&Ge(u)&&(!l||l._f)||ce(u)?_(c,u,i,!0):e(c,u,i)}))},T=function(t,r,n,i){var a=Object.assign({},n||c.mount?u:ve(r)?s:rt(t)?e({},t,r):r);if(!t)return i&&(f.watchAll=!0),a;var o,l=[],d=oe(Be(t));try{for(d.s();!(o=d.n()).done;){var p=o.value;i&&f.watch.add(p),l.push(be(a,p))}}catch(e){d.e(e)}finally{d.f()}return Array.isArray(t)?l:l[0]},M=function(e,t,r,n){var i,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],l=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],f=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];if(c.action=!0,f&&be(o,t)&&(i=r(be(o,t),n.argA,n.argB),l&&He(o,t,i)),Array.isArray(be(a.errors,t))){var d=r(be(a.errors,t),n.argA,n.argB);l&&He(a.errors,t,d),wt(a.errors,t)}if(p.touchedFields&&be(a.touchedFields,t)){var h=r(be(a.touchedFields,t),n.argA,n.argB);l&&He(a.touchedFields,t,h),wt(a.touchedFields,t)}(p.dirtyFields||p.isDirty)&&(He(a.dirtyFields,t,kt(qe(u,e),be(s,t,[]),be(a.dirtyFields,t,[]))),u&&He(a.dirtyFields,t,kt(qe(u,e),be(s,t,[]),be(a.dirtyFields,t,[]))),wt(a.dirtyFields,t)),m.state.next({isDirty:D(t,qe(u,e)),dirtyFields:a.dirtyFields,errors:a.errors,isValid:a.isValid})},B=function(e){return be(c.mount?u:s,e,[])},U=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=be(o,e),i=f.array.has(e);He(u,e,t),i?(m.array.next({name:e,values:u}),(p.isDirty||p.dirtyFields)&&r.shouldDirty&&(He(a.dirtyFields,e,kt(t,be(s,e,[]),be(a.dirtyFields,e,[]))),m.state.next({name:e,dirtyFields:a.dirtyFields,isDirty:D(e,t)}))):!n||n._f||le(t)?_(e,t,r,!0):P(e,t,r),w(e)&&m.state.next({}),m.watch.next({name:e})},L=function(){var t=h(y.mark((function t(r){var n,s,u,c,l=arguments;return y.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=l.length>1&&void 0!==l[1]?l[1]:{},s=Be(r),m.state.next({isValidating:!0}),!i.resolver){t.next=10;break}return t.next=6,A(ve(r)?r:s);case 6:c=t.sent,u=r?s.every((function(e){return!be(c,e)})):Te(c),t.next=20;break;case 10:if(!r){t.next=17;break}return t.next=13,Promise.all(s.map(function(){var t=h(y.mark((function t(r){var n;return y.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=be(o,r),t.next=3,V(n&&n._f?e({},r,n):n);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 13:u=t.sent.every(Boolean),N(),t.next=20;break;case 17:return t.next=19,V(o);case 19:u=t.sent;case 20:return m.state.next(Object.assign(Object.assign({},rt(r)?{name:r}:{}),{errors:a.errors,isValid:u,isValidating:!1})),n.shouldFocus&&!u&&We(o,(function(e){return be(a.errors,e)}),r?s:f.mount),t.abrupt("return",u);case 23:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),I=function(e){var t=Object.assign(Object.assign({},s),c.mount?u:{});return ve(e)?t:rt(e)?be(t,e):e.map((function(e){return be(t,e)}))},R=function(e){e?Be(e).forEach((function(e){return ut(a.errors,e)})):a.errors={},m.state.next({errors:a.errors})},H=function(e,t,r){var n=(be(o,e,{_f:{}})._f||{}).ref;He(a.errors,e,Object.assign(Object.assign({},t),{ref:n})),m.state.next({name:e,errors:a.errors,isValid:!1}),r&&r.shouldFocus&&n&&n.focus&&n.focus()},W=function(e,t){return Qe(e)?m.watch.subscribe({next:function(r){return e(T(void 0,t),r)}}):T(e,t,!1,!0)},q=function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=oe(e?Be(e):f.mount);try{for(n.s();!(t=n.n()).done;){var c=t.value;f.mount.delete(c),f.array.delete(c),be(o,c)&&(r.keepValue||(ut(o,c),ut(u,c)),!r.keepError&&ut(a.errors,c),!r.keepDirty&&ut(a.dirtyFields,c),!r.keepTouched&&ut(a.touchedFields,c),!i.shouldUnregister&&!r.keepDefaultValue&&ut(s,c))}}catch(e){n.e(e)}finally{n.f()}m.watch.next({}),m.state.next(Object.assign(Object.assign({},a),r.keepDirty?{isDirty:D()}:{})),!r.keepIsValid&&N()},z=function(e,t,r){G(e,r);var n=be(o,e),i=ve(t.value)&&t.querySelectorAll&&t.querySelectorAll("input,select,textarea")[0]||t,a=tt(i);i===n._f.ref||a&&me(n._f.refs||[]).find((function(e){return e===i}))||(n={_f:a?Object.assign(Object.assign({},n._f),{refs:[].concat(b(me(n._f.refs||[]).filter((function(e){return Xe(e)&&document.contains(e)}))),[i]),ref:{type:i.type,name:e}}):Object.assign(Object.assign({},n._f),{ref:i})},He(o,e,n),(!r||!r.disabled)&&F(e,!1,i))},G=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=be(o,e);return He(o,e,{_f:Object.assign(Object.assign(Object.assign({},r&&r._f?r._f:{ref:{name:e}}),{name:e,mount:!0}),t)}),f.mount.add(e),ve(t.value)||He(u,e,t.value),r&&Je(t.disabled)&&He(u,e,t.disabled?void 0:be(u,e,mt(r._f))),!r&&F(e,!0),Vt?{name:e}:Object.assign(Object.assign({name:e},Je(t.disabled)?{disabled:t.disabled}:{}),{onChange:C,onBlur:C,ref:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(r){if(r)z(e,r,t);else{var n=be(o,e,{}),a=i.shouldUnregister||t.shouldUnregister;n._f&&(n._f.mount=!1),a&&(!he(f.array,e)||!c.action)&&f.unMount.add(e)}}))})},K=function(e,t){return function(){var r=h(y.mark((function r(n){var s,c,l,d,p;return y.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n&&(n.preventDefault&&n.preventDefault(),n.persist&&n.persist()),s=!0,c=Object.assign({},u),m.state.next({isSubmitting:!0}),r.prev=4,!i.resolver){r.next=15;break}return r.next=8,S();case 8:l=r.sent,d=l.errors,p=l.values,a.errors=d,c=p,r.next=17;break;case 15:return r.next=17,V(o);case 17:if(!Te(a.errors)||!Object.keys(a.errors).every((function(e){return be(c,e)}))){r.next=23;break}return m.state.next({errors:{},isSubmitting:!0}),r.next=21,e(c,n);case 21:r.next=28;break;case 23:if(r.t0=t,!r.t0){r.next=27;break}return r.next=27,t(a.errors,n);case 27:i.shouldFocusError&&We(o,(function(e){return be(a.errors,e)}),f.mount);case 28:r.next=34;break;case 30:throw r.prev=30,r.t1=r.catch(4),s=!1,r.t1;case 34:return r.prev=34,a.isSubmitted=!0,m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Te(a.errors)&&s,submitCount:a.submitCount+1,errors:a.errors}),r.finish(34);case 38:case"end":return r.stop()}}),r,null,[[4,30,34,38]])})));return function(e){return r.apply(this,arguments)}}()},$=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e||s,i=ze(r);if(t.keepValues||(u=n.shouldUnregister?{}:i),nt&&!t.keepValues){var l,d=oe(f.mount);try{for(d.s();!(l=d.n()).done;){var h=l.value,v=be(o,h);if(v&&v._f){var b=Array.isArray(v._f.refs)?v._f.refs[0]:v._f.ref;try{Xe(b)&&b.closest("form").reset();break}catch(e){}}}}catch(e){d.e(e)}finally{d.f()}}t.keepDefaultValues||(s=Object.assign({},r)),t.keepValues||(o={},m.control.next({values:t.keepDefaultValues?s:Object.assign({},r)}),m.watch.next({}),m.array.next({values:i})),f={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},m.state.next({submitCount:t.keepSubmitCount?a.submitCount:0,isDirty:t.keepDirty?a.isDirty:!!t.keepDefaultValues&&Ke(e,s),isSubmitted:!!t.keepIsSubmitted&&a.isSubmitted,dirtyFields:t.keepDirty?a.dirtyFields:{},touchedFields:t.keepTouched?a.touchedFields:{},errors:t.keepErrors?a.errors:{},isSubmitting:!1,isSubmitSuccessful:!1}),c.mount=!p.isValid||!!t.keepIsValid,c.watch=!!n.shouldUnregister},J=function(e){return be(o,e)._f.ref.focus()},Z=function(){var e,t=oe(f.unMount);try{for(t.s();!(e=t.n()).done;){var r=e.value,n=be(o,r);n&&(n._f.refs?n._f.refs.every(it):it(n._f.ref))&&q(r)}}catch(e){t.e(e)}finally{t.f()}f.unMount=new Set};return{control:{register:G,unregister:q,_getWatch:T,_getIsDirty:D,_updateValid:N,_removeFields:Z,_updateFieldArray:M,_getFieldArrayValue:B,_subjects:m,_shouldUnregister:i.shouldUnregister,_proxyFormState:p,get _fields(){return o},set _fields(e){o=e},get _formValues(){return u},set _formValues(e){u=e},get _stateFlags(){return c},set _stateFlags(e){c=e},get _defaultValues(){return s},set _defaultValues(e){s=e},get _names(){return f},set _names(e){f=e},get _formState(){return a},set _formState(e){a=e},_updateProps:function(e){i=Object.assign(Object.assign({},At),e)}},trigger:L,register:G,handleSubmit:K,watch:W,setValue:U,getValues:I,reset:$,clearErrors:R,unregister:q,setError:H,setFocus:J}}var Ft=function(e){var t=e.name,i=e.label,a=e.children,o=r.useContext(De).register;return n.createElement(n.Fragment,null,n.createElement(f,s({value:"True"},o(t),{className:"jkl-cookie-consent-modal__checkbox"}),i),n.createElement("p",{className:"jkl-cookie-consent-modal__info-text"},a))},Dt=function(e){var i=e.onAccept,a=F(),o=a.consent,s=a.dispatch,u=a.isOpen,f=a.requirement,h=a.showSettings,m=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.useRef(),i=r.useState({isDirty:!1,isValidating:!1,dirtyFields:{},isSubmitted:!1,submitCount:0,touchedFields:{},isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,errors:{}}),a=t(i,2),o=a[0],s=a[1];n.current?n.current.control._updateProps(e):n.current=Object.assign(Object.assign({},Ct(e)),{formState:o});var u=n.current.control;return Ue({subject:u._subjects.state,callback:function(e){Me(e,u._proxyFormState,!0)&&(u._formState=Object.assign(Object.assign({},u._formState),e),s(Object.assign({},u._formState)))}}),r.useEffect((function(){u._stateFlags.mount||(u._proxyFormState.isValid&&u._updateValid(),u._stateFlags.mount=!0),u._stateFlags.watch&&(u._stateFlags.watch=!1,u._subjects.state.next({})),u._removeFields()})),n.current.formState=Pe(o,u._proxyFormState),n.current}({defaultValues:x(o)}),v=function(e){i("implicit"===e?_(f):e)};return n.createElement(ae,{backdrop:!0,strict:!0,hidden:!u,"aria-label":"Informasjonskapsler",className:"jkl-cookie-consent-modal","data-testautoid":"jkl-cookie-consent-modal"},h?n.createElement(Ne,m,n.createElement("h1",{className:"jkl-cookie-consent-modal__header"},"Informasjonskapsler"),n.createElement(c,{className:"jkl-cookie-consent-modal__checklist"},n.createElement(l,null,"Nettsidene skal fungere teknisk")),n.createElement("p",{className:"jkl-cookie-consent-modal__info-text"},"For at nettsidene skal fungere, må vi bruke tekniske informasjonskapsler. Denne kan derfor ikke slås av."),n.createElement("form",{onSubmit:m.handleSubmit((function(e){v(_(e))}))},f.functional&&n.createElement(Ft,{name:"functional",label:"Tillat funksjonelle"},"Funksjonelle informasjonskapsler lagrer opplysninger om din bruk av nettsidene og hvilke innstillinger du har gjort, slik at du kan få funksjonalitet tilpasset deg."),f.statistics&&n.createElement(Ft,{name:"statistics",label:"Tillat statistikk"},"Informasjonskapslene lagrer statistikk som hjelper oss med å forstå hvordan nettsidene blir brukt, slik at vi kan gjøre dem bedre og enklere å bruke."),f.marketing&&n.createElement(Ft,{name:"marketing",label:"Tillat personlig markedsføring"},"Dette gjør at vi kan gi deg mer relevant og tilpasset markedsføring, også gjennom våre samarbeidspartnere, på for eksempel nettsider, annonser og i sosiale medier."),n.createElement("div",{className:"jkl-cookie-consent-modal__button-group"},n.createElement(d,{"data-testid":"jkl-cookie-consent-godta"},"Godta")))):n.createElement(n.Fragment,null,n.createElement("h1",{className:"jkl-cookie-consent-modal__header"},"Vi bruker informasjonskapsler slik at:"),n.createElement(c,{className:"jkl-cookie-consent-modal__checklist"},n.createElement(l,null,"Nettsidene skal fungere teknisk"),f.functional&&n.createElement(l,null,"Nettsidene skal tilpasses din bruk, dine valg og dine innstillinger."),f.statistics&&n.createElement(l,null,"Vi kan samle statistikk på hvordan nettsidene brukes og dermed kunne forbedre tjenestene våre."),f.marketing&&n.createElement(l,null,"Vi kan gi deg personlig tilpasset innhold og relevante annonser, også gjennom våre samarbeidspartnere, på for eksempel nettsider og i sosiale medier.")),n.createElement("div",{className:"jkl-cookie-consent-modal__button-group"},n.createElement(d,{onClick:function(){return v("implicit")},"data-testid":"jkl-cookie-consent-godta"},"Godta"),n.createElement(p,{onClick:function(){s({type:"SET_SHOW_SETTINGS",payload:!0})}},"Innstillinger"))))};function Nt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Pt(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?Nt(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Nt(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var Tt=function(e){var r=e.blocking,i=e.onAccept,s=F(),u=s.dispatch,c=s.consent,l=o(c);if(a((function(){i&&c!==l&&i(c)}),[i,c,l]),navigator&&!navigator.cookieEnabled)return i&&i({functional:"denied",marketing:"denied",statistics:"denied"}),null;return r?n.createElement(Dt,{onAccept:function(e){var r=Object.fromEntries(Object.entries(e).filter((function(e){var r=t(e,2);return r[0],null!=r[1]}))),n=Pt(Pt({},c),r);u({type:"UPDATE_CONSENT",payload:n}),u({type:"SET_SHOW_CONSENT",payload:!1}),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10368e3,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:O,n=[];n.push("".concat(r,"=").concat(JSON.stringify(e))),n.push("max-age=".concat(t)),n.push("SameSite=Lax"),document.cookie=n.join(";")}(n)}}):null};export{Tt as CookieConsent,C as CookieConsentProvider,D as useCookieConsent}; |
@@ -1,1 +0,1 @@ | ||
import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/slicedToArray";import*as r from"react";import n,{useMemo as i,useEffect as a}from"react";import{usePreviousValue as o}from"@fremtind/jkl-react-hooks";import s from"@babel/runtime/helpers/extends";import u from"@babel/runtime/helpers/typeof";import{UnorderedList as c,CheckListItem as l}from"@fremtind/jkl-list-react";import{Checkbox as f}from"@fremtind/jkl-checkbox-react";import{PrimaryButton as d,TertiaryButton as p}from"@fremtind/jkl-button-react";import h from"@babel/runtime/helpers/asyncToGenerator";import v from"@babel/runtime/helpers/classCallCheck";import m from"@babel/runtime/helpers/createClass";import b from"@babel/runtime/helpers/toConsumableArray";import y from"@babel/runtime/regenerator";function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function k(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?g(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var O="fremtind-cookie-consent",w=function(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:O,t=document.cookie.split(";").map((function(e){return e.trim().split("=")})).find((function(t){return t[0]===e}));if(t)return t}();return t?JSON.parse(t[1]):e?e():void 0},j=function(e){if(e)return"denied"!==e},x=function(e){var r=Object.entries(k(k({},{functional:null,marketing:null,statistics:null}),e)).map((function(e){var r=t(e,2),n=r[0],i=r[1];return[n,j(i)]}));return Object.fromEntries(r)},_=function(e){var r={functional:void 0,marketing:void 0,statistics:void 0},n=Object.entries(k(k({},r),e)).map((function(e){var r,n=t(e,2),i=n[0],a=n[1];return[i,(r=a,void 0===r?null:!1===r||"false"===String(r).toLowerCase()?"denied":"accepted")]}));return Object.fromEntries(n)};function E(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function S(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?E(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):E(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var A=n.createContext(void 0),V=function(e,t){switch(t.type){case"SET_SHOW_CONSENT":return S(S({},e),{},{isOpen:t.payload});case"SET_SHOW_SETTINGS":return S(S({},e),{},{showSettings:t.payload});case"UPDATE_CONSENT":return S(S({},e),{},{consent:S(S({},e.consent),t.payload)});default:throw new Error("Unhandled action type: ".concat(t.type))}},C=function(e){var r=e.children,o=e.cookieAdapter,s=e.marketing,u=e.functional,c=e.statistics,l=i((function(){var e;return null!==(e=w(o))&&void 0!==e?e:{marketing:null,functional:null,statistics:null}}),[o]),f=i((function(){return{marketing:null!=s&&s,functional:null!=u&&u,statistics:null!=c&&c}}),[s,u,c]),d=n.useReducer(V,{isOpen:!1,showSettings:!1,requirement:f,consent:l}),p=t(d,2),h=p[0],v=p[1];a((function(){!function(e,r){if(r){for(var n=new Map(Object.entries(r)),i=0,a=Object.entries(e);i<a.length;i++){var o=t(a[i],2),s=o[0];if(o[1]&&null===n.get(s))return!0}return!1}return Object.values(e).some((function(e){return e}))}(f,l)?l&&v({type:"UPDATE_CONSENT",payload:l}):v({type:"SET_SHOW_CONSENT",payload:!0})}),[f,l]);var m={state:h,dispatch:v};return n.createElement(A.Provider,{value:m},r)},D=function(){var e=n.useContext(A);if(void 0===e)throw new Error("useCookieConsentState must be used within a CookieConsentProvider");return S({dispatch:e.dispatch},e.state)},F=function(){var e=n.useContext(A);if(void 0===e)throw new Error("useCookieConsent must be used within a CookieConsentProvider");return{openConsentModalWithSettings:function(){e.dispatch({type:"SET_SHOW_CONSENT",payload:!0}),e.dispatch({type:"SET_SHOW_SETTINGS",payload:!0})}}};var N,T=(N=require("react"))&&"object"===u(N)&&"default"in N?N.default:N;function P(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function M(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function L(e){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function B(e,t){return(B=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function I(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function U(e,t,r){return(U=I()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&B(i,r.prototype),i}).apply(null,arguments)}function R(e){var t="function"==typeof Map?new Map:void 0;return(R=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return U(e,arguments,L(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),B(n,e)})(e)}function H(e,t){return!t||"object"!==u(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function W(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var q="undefined"!=typeof window;q&&/(android)/i.test(navigator.userAgent),q&&/iPad|iPhone|iPod/.test(String(navigator.platform)),q||global.HTMLElement||(global.HTMLElement=function(){return function e(){P(this,e)}}());var z,G,K=(z="undefined"==typeof window?{}:window.Element.prototype,G=z.matches||z.msMatchesSelector||z.webkitMatchesSelector,z.closest?function(e,t){return e.closest(t)}:function(e,t){for(e.correspondingUseElement&&(e=e.correspondingUseElement);e;e=e.parentElement)if(G.call(e,t))return e;return null});function J(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:!this.hasAttribute(t);return!r===e.hasAttribute(t)&&e[r?"setAttribute":"removeAttribute"](t,""),r}function $(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(e){if(e.nodeType)return[e];if("string"==typeof e)return[].slice.call(t.querySelectorAll(e));if(e.length)return[].slice.call(e)}return[]}var Z="[tabindex],a,button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled])",Q=function(e){function t(){return P(this,t),H(this,L(t).apply(this,arguments))}var r,n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&B(e,t)}(t,R(HTMLElement)),r=t,i=[{key:"observedAttributes",get:function(){return["hidden","backdrop"]}}],(n=[{key:"connectedCallback",value:function(){this._focus=!0,this._autoBackdrop=null,this.attributeChangedCallback(),this.addEventListener("transitionend",this),document.addEventListener("keydown",this),document.addEventListener("click",this)}},{key:"disconnectedCallback",value:function(){te(this._focus),this._autoBackdrop&&this._autoBackdrop.parentNode.removeChild(this._autoBackdrop),this._focus=this._autoBackdrop=null,this.removeEventListener("transitionend",this),document.removeEventListener("keydown",this),document.removeEventListener("click",this)}},{key:"attributeChangedCallback",value:function(e,t,r){var n=this;if(this._focus){var i="backdrop"===e&&X(this,t),a=this.backdrop;if(this.className=this.className,this.setAttribute("role","dialog"),this.setAttribute("aria-modal",Boolean(a)),i&&i.setAttribute("hidden",""),a&&J(a,"hidden",this.hidden),this.hidden)te(this._focus);else{var o=window.getComputedStyle(this).getPropertyValue("z-index");if(("auto"===o||"0"===o)&&""===this.style.zIndex){var s=$(this.nodeName).filter((function(e){return e!==a&&!n.contains(e)&&Y(e)}));o=Math.min(Math.max.apply(Math,[1].concat(W(s.map(ee)))),2e9),a&&(a.style.zIndex=o+1),this.style.zIndex=o+2}this._focus=document.activeElement||document.body,setTimeout((function(){return re(n)}))}"hidden"===e&&r!==t&&function(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i="prevent_recursive_dispatch_maximum_callstack".concat(t);if(e[i])return!0;e[i]=!0,"function"==typeof window.CustomEvent?r=new window.CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n}):(r=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,n);e.dispatchEvent(r);e[i]=null}(this,"dialog.toggle")}}},{key:"handleEvent",value:function(e){if(!e.defaultPrevented)if("transitionend"!==e.type||e.target!==this||this.hidden){if("click"===e.type){if(e.target===this.backdrop&&!this.strict)return this.close();var t=K(e.target,"button"),r=t&&t.getAttribute("for");"close"===r&&K(e.target,this.nodeName)===this?this.close():r===this.id&&this.show()}else if("keydown"===e.type&&(9===e.keyCode||27===e.keyCode)&&!this.hidden){if($("".concat(this.nodeName,":not([hidden])")).sort((function(e,t){return ee(e)-ee(t)})).pop()!==this)return;9===e.keyCode&&function(e,t){var r=$(Z,e).filter(Y),n=r[t.shiftKey?0:r.length-1];t.target!==n&&e.contains(t.target)||(t.preventDefault(),r[t.shiftKey?r.length-1:0].focus())}(this,e),27!==e.keyCode||this.strict||(e.preventDefault(),this.close())}}else re(this)}},{key:"close",value:function(){this.hidden=!0}},{key:"show",value:function(){this.hidden=!1}},{key:"open",get:function(){return!this.hidden},set:function(e){this.hidden=!e}},{key:"strict",get:function(){return this.hasAttribute("strict")},set:function(e){J(this,"strict",e)}},{key:"hidden",get:function(){return this.hasAttribute("hidden")},set:function(e){J(this,"hidden",e)}},{key:"backdrop",get:function(){return X(this,this.getAttribute("backdrop"))},set:function(e){this.setAttribute("backdrop",e||"false")}}])&&M(r.prototype,n),i&&M(r,i),t}();function X(e,t){var r=e.nextElementSibling;return!(!e.parentNode||"false"===t)&&(t&&"true"!==t?document.getElementById(t)||!1:r&&"BACKDROP"===r.nodeName?r:(e._autoBackdrop=document.createElement("backdrop"),e.insertAdjacentElement("afterend",e._autoBackdrop)))}function Y(e){return e.clientWidth&&e.clientHeight&&"hidden"!==window.getComputedStyle(e).getPropertyValue("visibility")}function ee(e){for(var t=e,r=1;t;t=t.offsetParent)r+=Number(window.getComputedStyle(t).getPropertyValue("z-index"))||0;return r}function te(e){setTimeout((function(){try{e.focus()}catch(e){}}))}function re(e){if(!e.contains(document.activeElement)&&Y(e)){var t=$("[autofocus]",e).concat($(Z,e)).filter(Y)[0];try{t.focus()}catch(t){console.warn(e,'is initialized without focusable elements. Please add [tabindex="-1"] the main element (for instance a <h1>)')}}}var ne=function(){var e="undefined"==typeof window?{}:window.Element.prototype,t=e.matches||e.msMatchesSelector||e.webkitMatchesSelector;return e.closest?function(e,t){return e.closest(t)}:function(e,r){for(;e;e=e.parentElement)if(t.call(e,r))return e;return null}}();var ie=function(e,t){void 0===t&&(t={});var r=(t.name||e.name||String(e).match(/function ([^(]+)/)[1]).replace(/.[A-Z]/g,(function(e){return e[0]+"-"+e[1]})),n=t.props||[],i=t.customEvents||[],a=i.reduce((function(e,t){return e[t]="on"+t.replace(/(^|\.)./g,(function(e){return e.slice(-1).toUpperCase()})),e}),{}),o=n.concat("forwardRef",Object.keys(a).map((function(e){return a[e]}))),s=(r+"-"+(t.suffix||"react")).replace(/\W+/g,"-").toLowerCase();return function(t){function r(e){var r=this;t.call(this,e),this.ref=function(e){return"function"==typeof r.props.forwardRef?r.props.forwardRef(e):r.props.forwardRef&&(r.props.forwardRef.current=e),r.el=e},Object.keys(a).forEach((function(e){var t=a[e];r[e]=function(e){r.props[t]&&ne(e.target,r.el.nodeName)===r.el&&r.props[t](e)}}))}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.componentDidMount=function(){var t=this;window.customElements.get(s)||window.customElements.define(s,e),n.forEach((function(e){e in t.props&&(t.el[e]=t.props[e])})),i.forEach((function(e){t.el.addEventListener(e,t[e])}))},r.prototype.componentDidUpdate=function(e){var t=this;n.forEach((function(r){e[r]!==t.props[r]&&(t.el[r]=t.props[r])}))},r.prototype.componentWillUnmount=function(){var e=this;i.forEach((function(t){e.el.removeEventListener(t,e[t])}))},r.prototype.render=function(){var e=this;return T.createElement(s,Object.keys(this.props).reduce((function(t,r){return-1===o.indexOf(r)&&("className"===r?t.class=e.props[r]:!0===e.props[r]?t[r]="":!1!==e.props[r]&&(t[r]=e.props[r])),t}),{ref:this.ref}))},r}(T.Component)}(Q,{customEvents:["dialog.toggle"],props:["backdrop"],suffix:"3.0.7"});function ae(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return oe(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return oe(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function oe(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var se=function(e){return"checkbox"===e.type},ue=function(e){return e instanceof Date},ce=function(e){return null==e},le=function(e){return"object"===u(e)},fe=function(e){return!ce(e)&&!Array.isArray(e)&&le(e)&&!ue(e)},de=function(e){return e.substring(0,e.search(/.\d/))||e},pe=function(e,t){return b(e).some((function(e){return de(t)===e}))},he=function(e){return e.filter(Boolean)},ve=function(e){return void 0===e},me=function(e,t,r){if(fe(e)&&t){var n=he(t.split(/[,[\].]+?/)).reduce((function(e,t){return ce(e)?e:e[t]}),e);return ve(n)||n===e?ve(e[t])?r:e[t]:n}},be="blur",ye="onBlur",ge="onChange",ke="onSubmit",Oe="onTouched",we="all",je="max",xe="min",_e="maxLength",Ee="minLength",Se="pattern",Ae="required",Ve="validate",Ce=function(e,t){var r=Object.assign({},e);return delete r[t],r},De=r.createContext(null);De.displayName="RHFContext";var Fe=function(e){return r.createElement(De.Provider,{value:Ce(e,"children")},e.children)},Ne=function(e,t,r){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];function i(i){return function(){if(i in e)return t[i]!==we&&(t[i]=!n||we),r&&(r[i]=!0),e[i]}}var a={};for(var o in e)Object.defineProperty(a,o,{get:i(o)});return a},Te=function(e){return fe(e)&&!Object.keys(e).length},Pe=function(e,t,r){var n=Ce(e,"name");return Te(n)||Object.keys(n).length>=Object.keys(t).length||Object.keys(n).find((function(e){return t[e]===(!r||we)}))},Me=function(e){return Array.isArray(e)?e:[e]},Le=function(e){return/^\w*$/.test(e)},Be=function(e){return he(e.replace(/["|']|\]/g,"").split(/\.|\[/))};function Ie(e,t,r){for(var n=-1,i=Le(t)?[t]:Be(t),a=i.length,o=a-1;++n<a;){var s=i[n],u=r;if(n!==o){var c=e[s];u=fe(c)||Array.isArray(c)?c:isNaN(+i[n+1])?{}:[]}e[s]=u,e=e[s]}return e}var Ue=function(t,r,n,i,a){return r?Object.assign(Object.assign({},n[t]),{types:Object.assign(Object.assign({},n[t]&&n[t].types?n[t].types:{}),e({},i,a||!0))}):{}},Re=function e(t,r,n){var i,a=ae(n||Object.keys(t));try{for(a.s();!(i=a.n()).done;){var o=i.value,s=me(t,o);if(s){var u=s._f,c=Ce(s,"_f");if(u&&r(u.name)){if(u.ref.focus&&ve(u.ref.focus()))break;if(u.refs){u.refs[0].focus();break}}else fe(c)&&e(c,r)}}}catch(e){a.e(e)}finally{a.f()}};function He(e){var t,r=Array.isArray(e);if(e instanceof Date)t=new Date(e.getTime());else{if(!r&&!fe(e))return e;for(var n in t=r?[]:{},e)t[n]=He(e[n])}return t}var We=function(e){return ce(e)||!le(e)};function qe(e,t){if(We(e)||We(t)||ue(e)||ue(t))return e===t;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(var i=0,a=r;i<a.length;i++){var o=a[i],s=e[o];if(!n.includes(o))return!1;if("ref"!==o){var u=t[o];if((fe(s)||Array.isArray(s))&&(fe(u)||Array.isArray(u))?!qe(s,u):s!==u)return!1}}return!0}var ze=function(e){return{isOnSubmit:!e||e===ke,isOnBlur:e===ye,isOnChange:e===ge,isOnAll:e===we,isOnTouch:e===Oe}},Ge=function(e){return"boolean"==typeof e},Ke=function(e){return"file"===e.type},Je=function(e){return"function"==typeof e},$e=function(e){return e instanceof HTMLElement},Ze=function(e){return"select-multiple"===e.type},Qe=function(e){return"radio"===e.type},Xe=function(e){return Qe(e)||se(e)},Ye=function(e){return"string"==typeof e},et="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document,tt=function(e){return!$e(e)||!document.contains(e)},rt=function(e,t){return e.map((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Ce(e,t)}))},nt=function(){function e(){v(this,e),this.tearDowns=[]}return m(e,[{key:"add",value:function(e){this.tearDowns.push(e)}},{key:"unsubscribe",value:function(){var e,t=ae(this.tearDowns);try{for(t.s();!(e=t.n()).done;){(0,e.value)()}}catch(e){t.e(e)}finally{t.f()}this.tearDowns=[]}}]),e}(),it=function(){function e(t,r){var n=this;v(this,e),this.observer=t,this.closed=!1,r.add((function(){return n.closed=!0}))}return m(e,[{key:"next",value:function(e){this.closed||this.observer.next(e)}}]),e}(),at=function(){function e(){v(this,e),this.observers=[]}return m(e,[{key:"next",value:function(e){var t,r=ae(this.observers);try{for(r.s();!(t=r.n()).done;){t.value.next(e)}}catch(e){r.e(e)}finally{r.f()}}},{key:"subscribe",value:function(e){var t=new nt,r=new it(e,t);return this.observers.push(r),t}},{key:"unsubscribe",value:function(){this.observers=[]}}]),e}();function ot(e,t){var r,n=Le(t)?[t]:Be(t),i=1==n.length?e:function(e,t){for(var r=t.slice(0,-1).length,n=0;n<r;)e=ve(e)?n++:e[t[n++]];return e}(e,n),a=n[n.length-1];i&&delete i[a];for(var o=0;o<n.slice(0,-1).length;o++){var s=-1,u=void 0,c=n.slice(0,-(o+1)),l=c.length-1;for(o>0&&(r=e);++s<c.length;){var f=c[s];u=u?u[f]:e[f],l===s&&(fe(u)&&Te(u)||Array.isArray(u)&&!u.filter((function(e){return fe(e)&&!Te(e)||Ge(e)})).length)&&(r?delete r[f]:delete e[f]),r=u}}return e}var st={value:!1,isValid:!1},ut={value:!0,isValid:!0},ct=function(e){if(Array.isArray(e)){if(e.length>1){var t=e.filter((function(e){return e&&e.checked&&!e.disabled})).map((function(e){return e.value}));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!ve(e[0].attributes.value)?ve(e[0].value)||""===e[0].value?ut:{value:e[0].value,isValid:!0}:ut:st}return st},lt=function(e,t){var r=t.valueAsNumber,n=t.valueAsDate,i=t.setValueAs;return ve(e)?e:r?""===e?NaN:+e:n?new Date(e):i?i(e):e},ft={isValid:!1,value:null},dt=function(e){return Array.isArray(e)?e.reduce((function(e,t){return t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e}),ft):ft};function pt(e){var t,r=e.ref;if(!(e.refs?e.refs.every((function(e){return e.disabled})):r.disabled))return Ke(r)?r.files:Qe(r)?dt(e.refs).value:Ze(r)?(t=r.options,b(t).filter((function(e){return e.selected})).map((function(e){return e.value}))):se(r)?ct(e.refs).value:lt(ve(r.value)?e.ref.value:r.value,e)}var ht=function(e,t,r,n){var i,a={},o=ae(e);try{for(o.s();!(i=o.n()).done;){var s=i.value,u=me(t,s);u&&Ie(a,s,u._f)}}catch(e){o.e(e)}finally{o.f()}return{criteriaMode:r,names:b(e),fields:a,shouldUseNativeValidation:n}},vt=function(e){return e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate)};function mt(e,t){if(We(e)||We(t))return t;for(var r in t){var n=e[r],i=t[r];try{e[r]=fe(n)&&fe(i)||Array.isArray(n)&&Array.isArray(i)?mt(n,i):i}catch(e){}}return e}function bt(t,r,n,i,a){for(var o=-1;++o<t.length;){for(var s in t[o])Array.isArray(t[o][s])?(!n[o]&&(n[o]={}),n[o][s]=[],bt(t[o][s],me(r[o]||{},s,[]),n[o][s],n[o],s)):!ce(r)&&qe(me(r[o]||{},s),t[o][s])?Ie(n[o]||{},s):n[o]=Object.assign(Object.assign({},n[o]),e({},s,!0));i&&!n.length&&delete i[a]}return n}var yt=function(e,t,r){return mt(bt(e,t,r.slice(0,e.length)),bt(t,e,r.slice(0,e.length)))},gt=function(e,t,r,n,i){return!i.isOnAll&&(!r&&i.isOnTouch?!(t||e):(r?n.isOnBlur:i.isOnBlur)?!e:!(r?n.isOnChange:i.isOnChange)||e)},kt=function(e,t){return!he(me(e,t,[])).length&&ot(e,t)},Ot=function(e){return Ye(e)||r.isValidElement(e)},wt=function(e){return e instanceof RegExp};function jt(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"validate";if(Ot(e)||Array.isArray(e)&&e.every(Ot)||Ge(e)&&!e)return{type:r,message:Ot(e)?e:"",ref:t}}var xt=function(e){return fe(e)&&!wt(e)?e:{value:e,message:""}},_t=function(){var e=h(y.mark((function e(t,r,n,i){var a,o,s,u,c,l,f,d,p,h,v,m,b,g,k,O,w,j,x,_,E,S,A,V,C,D,F,N,T,P,M,L,B,I,U,R,H,W,q,z,G,K,J,$;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t._f,o=a.ref,s=a.refs,u=a.required,c=a.maxLength,l=a.minLength,f=a.min,d=a.max,p=a.pattern,h=a.validate,v=a.name,m=a.valueAsNumber,b=a.mount,g=a.disabled,b&&!g){e.next=3;break}return e.abrupt("return",{});case 3:if(k=s?s[0]:o,O=function(e){i&&k.reportValidity&&(k.setCustomValidity(Ge(e)?"":e||" "),k.reportValidity())},w={},j=Qe(o),x=se(o),_=j||x,E=(m||Ke(o))&&!o.value||""===r||Array.isArray(r)&&!r.length,S=Ue.bind(null,v,n,w),A=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:_e,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Ee,a=e?t:r;w[v]=Object.assign({type:e?n:i,message:a,ref:o},S(e?n:i,a))},!u||!(!_&&(E||ce(r))||Ge(r)&&!r||x&&!ct(s).isValid||j&&!dt(s).isValid)){e.next=19;break}if(V=Ot(u)?{value:!!u,message:u}:xt(u),C=V.value,D=V.message,!C){e.next=19;break}if(w[v]=Object.assign({type:Ae,message:D,ref:k},S(Ae,D)),n){e.next=19;break}return O(D),e.abrupt("return",w);case 19:if(E||ce(f)&&ce(d)){e.next=28;break}if(T=xt(d),P=xt(f),isNaN(r)?(L=o.valueAsDate||new Date(r),Ye(T.value)&&(F=L>new Date(T.value)),Ye(P.value)&&(N=L<new Date(P.value))):(M=o.valueAsNumber||parseFloat(r),ce(T.value)||(F=M>T.value),ce(P.value)||(N=M<P.value)),!F&&!N){e.next=28;break}if(A(!!F,T.message,P.message,je,xe),n){e.next=28;break}return O(w[v].message),e.abrupt("return",w);case 28:if(!c&&!l||E||!Ye(r)){e.next=38;break}if(B=xt(c),I=xt(l),U=!ce(B.value)&&r.length>B.value,R=!ce(I.value)&&r.length<I.value,!U&&!R){e.next=38;break}if(A(U,B.message,I.message),n){e.next=38;break}return O(w[v].message),e.abrupt("return",w);case 38:if(!p||E||!Ye(r)){e.next=45;break}if(H=xt(p),W=H.value,q=H.message,!wt(W)||r.match(W)){e.next=45;break}if(w[v]=Object.assign({type:Se,message:q,ref:o},S(Se,q)),n){e.next=45;break}return O(q),e.abrupt("return",w);case 45:if(!h){e.next=79;break}if(!Je(h)){e.next=58;break}return e.next=49,h(r);case 49:if(z=e.sent,!(G=jt(z,k))){e.next=56;break}if(w[v]=Object.assign(Object.assign({},G),S(Ve,G.message)),n){e.next=56;break}return O(G.message),e.abrupt("return",w);case 56:e.next=79;break;case 58:if(!fe(h)){e.next=79;break}K={},e.t0=y.keys(h);case 61:if((e.t1=e.t0()).done){e.next=75;break}if(J=e.t1.value,Te(K)||n){e.next=65;break}return e.abrupt("break",75);case 65:return e.t2=jt,e.next=68,h[J](r);case 68:e.t3=e.sent,e.t4=k,e.t5=J,($=(0,e.t2)(e.t3,e.t4,e.t5))&&(K=Object.assign(Object.assign({},$),S(J,$.message)),O($.message),n&&(w[v]=K)),e.next=61;break;case 75:if(Te(K)){e.next=79;break}if(w[v]=Object.assign({ref:k},K),n){e.next=79;break}return e.abrupt("return",w);case 79:return O(!0),e.abrupt("return",w);case 81:case"end":return e.stop()}}),e)})));return function(t,r,n,i){return e.apply(this,arguments)}}(),Et={mode:ke,reValidateMode:ge,shouldFocusError:!0},St="undefined"==typeof window;function At(){var r,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=Object.assign(Object.assign({},Et),n),a={isDirty:!1,isValidating:!1,dirtyFields:{},isSubmitted:!1,submitCount:0,touchedFields:{},isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,errors:{}},o={},s={},u=i.defaultValues||{},c=!1,l=!1,f=0,d={mount:new Set,unMount:new Set,array:new Set,watch:new Set},p={},v={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={watch:new at,control:new at,array:new at,state:new at},g=ze(i.mode),k=ze(i.reValidateMode),O=i.criteriaMode===we,w=function(e,t){return function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];clearTimeout(f),f=window.setTimeout((function(){return e.apply(void 0,n)}),t)}},j=function(e){return d.watchAll||d.watch.has(e)||d.watch.has((e.match(/\w+/)||[])[0])},x=function(e,t){Ie(a.errors,e,t),m.state.next({errors:a.errors})},_=function(){var e=h(y.mark((function e(t,i,o,s,u){var c,l,d;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:c=me(a.errors,i),l=v.isValid&&a.isValid!==o,n.delayError&&s?(r=r||w(x,n.delayError))(i,s):(clearTimeout(f),s?Ie(a.errors,i,s):ot(a.errors,i)),(s?qe(c,s):!c)&&Te(u)&&!l||t||(d=Object.assign(Object.assign(Object.assign({},u),l?{isValid:o}:{}),{errors:a.errors,name:i}),a=Object.assign(Object.assign({},a),d),m.state.next(d)),p[i]--,v.isValidating&&!p[i]&&(m.state.next({isValidating:!1}),p={});case 6:case"end":return e.stop()}}),e)})));return function(t,r,n,i,a){return e.apply(this,arguments)}}(),E=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3?arguments[3]:void 0,i=me(o,e);if(i){var a=i._f;if(a){Ie(s,e,lt(t,a));var u=et&&$e(a.ref)&&ce(t)?"":t;Ke(a.ref)&&!Ye(u)?a.ref.files=u:Ze(a.ref)?b(a.ref.options).forEach((function(e){return e.selected=u.includes(e.value)})):a.refs?se(a.ref)?a.refs.length>1?a.refs.forEach((function(e){return e.checked=Array.isArray(u)?!!u.find((function(t){return t===e.value})):u===e.value})):a.refs[0].checked=!!u:a.refs.forEach((function(e){return e.checked=e.value===u})):a.ref.value=u,n&&m.control.next({values:H(),name:e}),(r.shouldDirty||r.shouldTouch)&&S(e,u,r.shouldTouch),r.shouldValidate&&R(e)}}},S=function(e,t,r){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i={name:e},o=!1;if(v.isDirty){var s=a.isDirty;a.isDirty=N(),i.isDirty=a.isDirty,o=s!==i.isDirty}if(v.dirtyFields&&!r){var c=me(a.dirtyFields,e),l=!qe(me(u,e),t);l?Ie(a.dirtyFields,e,!0):ot(a.dirtyFields,e),i.dirtyFields=a.dirtyFields,o=o||c!==me(a.dirtyFields,e)}var f=me(a.touchedFields,e);return r&&!f&&(Ie(a.touchedFields,e,r),i.touchedFields=a.touchedFields,o=o||v.touchedFields&&f!==r),o&&n&&m.state.next(i),o?i:{}},A=function(){var e=h(y.mark((function e(t){return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!i.resolver){e.next=6;break}return e.next=3,i.resolver(Object.assign({},s),i.context,ht(t||d.mount,o,i.criteriaMode,i.shouldUseNativeValidation));case 3:e.t0=e.sent,e.next=7;break;case 6:e.t0={};case 7:return e.abrupt("return",e.t0);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),V=function(){var e=h(y.mark((function e(t){var r,n,i,o,s,u;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,A();case 2:if(r=e.sent,n=r.errors,t){i=ae(t);try{for(i.s();!(o=i.n()).done;)s=o.value,(u=me(n,s))?Ie(a.errors,s,u):ot(a.errors,s)}catch(e){i.e(e)}finally{i.f()}}else a.errors=n;return e.abrupt("return",n);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),C=function(){var e=h(y.mark((function e(t,r){var n,o,u,c,l,f,d=arguments;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=d.length>2&&void 0!==d[2]?d[2]:{valid:!0},e.t0=y.keys(t);case 2:if((e.t1=e.t0()).done){e.next=23;break}if(o=e.t1.value,!(u=t[o])){e.next=21;break}if(c=u._f,l=Ce(u,"_f"),!c){e.next=17;break}return e.next=11,_t(u,me(s,c.name),O,i.shouldUseNativeValidation);case 11:if(!(f=e.sent)[c.name]){e.next=16;break}if(n.valid=!1,!r){e.next=16;break}return e.abrupt("break",23);case 16:r||(f[c.name]?Ie(a.errors,c.name,f[c.name]):ot(a.errors,c.name));case 17:if(e.t2=l,!e.t2){e.next=21;break}return e.next=21,C(l,r,n);case 21:e.next=2;break;case 23:return e.abrupt("return",n.valid);case 24:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),D=function(){var e=h(y.mark((function e(t){var r,n,u,c,l,f,d,h,b,w,x,E,V,C,D,F,N,P,M,L;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.type,n=t.target,u=t.target,c=u.value,l=u.name,f=u.type,!(d=me(o,l))){e.next=35;break}if(w=f?pt(d._f):c,x=r===be,E=!vt(d._f)&&!i.resolver&&!me(a.errors,l)&&!d._f.deps||gt(x,me(a.touchedFields,l),a.isSubmitted,k,g),V=!x&&j(l),Ie(s,l,w),C=S(l,w,x,!1),D=!Te(C)||V,!x&&m.watch.next({name:l,type:r}),!E){e.next=13;break}return e.abrupt("return",D&&m.state.next(Object.assign({name:l},V?{}:C)));case 13:if(!x&&V&&m.state.next({}),p[l]=(p[l],1),v.isValidating&&m.state.next({isValidating:!0}),!i.resolver){e.next=26;break}return e.next=19,A([l]);case 19:F=e.sent,N=F.errors,h=me(N,l),se(n)&&!h&&(P=de(l),M=me(o,P),Array.isArray(M)&&M.every((function(e){return e._f&&se(e._f.ref)}))&&((L=me(N,P,{})).type&&(h=L),l=P)),b=Te(N),e.next=33;break;case 26:return e.next=28,_t(d,me(s,l),O,i.shouldUseNativeValidation);case 28:return e.t0=l,h=e.sent[e.t0],e.next=32,T(!0);case 32:b=e.sent;case 33:d._f.deps&&R(d._f.deps),_(!1,l,b,h,C);case 35:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),F=function(e,t,r){var n=me(o,e);if(n){var i=me(s,e),a=ve(i)?me(u,e):i;ve(a)||t&&t.defaultChecked||r?Ie(s,e,r?a:pt(n._f)):E(e,a)}l&&T()},N=function(e,t){return e&&t&&Ie(s,e,t),!qe(Object.assign({},H()),u)},T=function(){var e=h(y.mark((function e(t){var r;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=!1,!v.isValid){e.next=15;break}if(!i.resolver){e.next=10;break}return e.t1=Te,e.next=6,A();case 6:e.t2=e.sent.errors,e.t0=(0,e.t1)(e.t2),e.next=13;break;case 10:return e.next=12,C(o,!0);case 12:e.t0=e.sent;case 13:r=e.t0,t||r===a.isValid||(a.isValid=r,m.state.next({isValid:r}));case 15:return e.abrupt("return",r);case 16:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),P=function e(r,n,i){return Object.entries(n).forEach((function(n){var a=t(n,2),s=a[0],u=a[1],c="".concat(r,".").concat(s),l=me(o,c);!d.array.has(r)&&We(u)&&(!l||l._f)||ue(u)?E(c,u,i,!0):e(c,u,i)}))},M=function(t,r,n,i){var a=Object.assign({},n||l?s:ve(r)?u:Ye(t)?e({},t,r):r);if(!t)return i&&(d.watchAll=!0),a;var o,c=[],f=ae(Me(t));try{for(f.s();!(o=f.n()).done;){var p=o.value;i&&d.watch.add(p),c.push(me(a,p))}}catch(e){f.e(e)}finally{f.f()}return Array.isArray(t)?c:c[0]},L=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";for(var n in t){var i=t[n],a=r+(r?".":"")+n,u=me(o,a);u&&u._f||(fe(i)&&Object.keys(i).length||Array.isArray(i)&&i.length?e(i,a):u||Ie(s,a,i))}},B=function(e,t,r,n){var i,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],f=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],d=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],p=rt(l,e);if(c=!0,d&&me(o,t)&&(i=r(me(o,t),n.argA,n.argB),f&&Ie(o,t,i)),i=r(me(s,t),n.argA,n.argB),f&&Ie(s,t,i),Array.isArray(me(a.errors,t))){var h=r(me(a.errors,t),n.argA,n.argB);f&&Ie(a.errors,t,h),kt(a.errors,t)}if(v.touchedFields&&me(a.touchedFields,t)){var b=r(me(a.touchedFields,t),n.argA,n.argB);f&&Ie(a.touchedFields,t,b),kt(a.touchedFields,t)}(v.dirtyFields||v.isDirty)&&(Ie(a.dirtyFields,t,yt(rt(p,e),me(u,t,[]),me(a.dirtyFields,t,[]))),p&&Ie(a.dirtyFields,t,yt(rt(p,e),me(u,t,[]),me(a.dirtyFields,t,[]))),kt(a.dirtyFields,t)),m.state.next({isDirty:N(t,rt(p,e)),dirtyFields:a.dirtyFields,errors:a.errors,isValid:a.isValid})},I=function(e){return me(l?s:u,e,[])},U=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=me(o,e),i=d.array.has(e);Ie(s,e,t),i?(m.array.next({name:e,values:s}),(v.isDirty||v.dirtyFields)&&r.shouldDirty&&(Ie(a.dirtyFields,e,yt(t,me(u,e,[]),me(a.dirtyFields,e,[]))),m.state.next({name:e,dirtyFields:a.dirtyFields,isDirty:N(e,t)}))):!n||n._f||ce(t)?E(e,t,r,!0):P(e,t,r),j(e)&&m.state.next({}),m.watch.next({name:e})},R=function(){var t=h(y.mark((function t(r){var n,s,u,c,l=arguments;return y.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=l.length>1&&void 0!==l[1]?l[1]:{},s=Me(r),m.state.next({isValidating:!0}),!i.resolver){t.next=10;break}return t.next=6,V(ve(r)?r:s);case 6:c=t.sent,u=r?s.every((function(e){return!me(c,e)})):Te(c),t.next=20;break;case 10:if(!r){t.next=17;break}return t.next=13,Promise.all(s.map(function(){var t=h(y.mark((function t(r){var n;return y.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=me(o,r),t.next=3,C(n._f?e({},r,n):n);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 13:u=t.sent.every(Boolean),T(),t.next=20;break;case 17:return t.next=19,C(o);case 19:u=t.sent;case 20:return m.state.next(Object.assign(Object.assign({},Ye(r)?{name:r}:{}),{errors:a.errors,isValid:u,isValidating:!1})),n.shouldFocus&&!u&&Re(o,(function(e){return me(a.errors,e)}),r?s:d.mount),t.abrupt("return",u);case 23:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),H=function(e){var t=Object.assign(Object.assign({},u),s);return ve(e)?t:Ye(e)?me(t,e):e.map((function(e){return me(t,e)}))},W=function(e){e?Me(e).forEach((function(e){return ot(a.errors,e)})):a.errors={},m.state.next({errors:a.errors})},q=function(e,t,r){var n=(me(o,e,{_f:{}})._f||{}).ref;Ie(a.errors,e,Object.assign(Object.assign({},t),{ref:n})),m.state.next({name:e,errors:a.errors,isValid:!1}),r&&r.shouldFocus&&n&&n.focus&&n.focus()},z=function(e,t){return Je(e)?m.watch.subscribe({next:function(r){return e(M(void 0,t),r)}}):M(e,t,!1,!0)},G=function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=ae(e?Me(e):d.mount);try{for(n.s();!(t=n.n()).done;){var c=t.value;d.mount.delete(c),d.array.delete(c),me(o,c)&&(r.keepValue||(ot(o,c),ot(s,c)),!r.keepError&&ot(a.errors,c),!r.keepDirty&&ot(a.dirtyFields,c),!r.keepTouched&&ot(a.touchedFields,c),!i.shouldUnregister&&!r.keepDefaultValue&&ot(u,c))}}catch(e){n.e(e)}finally{n.f()}m.watch.next({}),m.state.next(Object.assign(Object.assign({},a),r.keepDirty?{isDirty:N()}:{})),!r.keepIsValid&&T()},K=function(e,t,r){J(e,r);var n=me(o,e),i=ve(t.value)&&t.querySelectorAll&&t.querySelectorAll("input,select,textarea")[0]||t,a=Xe(i);i===n._f.ref||a&&he(n._f.refs||[]).find((function(e){return e===i}))||(n={_f:a?Object.assign(Object.assign({},n._f),{refs:[].concat(b(he(n._f.refs||[]).filter((function(e){return $e(e)&&document.contains(e)}))),[i]),ref:{type:i.type,name:e}}):Object.assign(Object.assign({},n._f),{ref:i})},Ie(o,e,n),(!r||!r.disabled)&&F(e,i))},J=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=me(o,e);return Ie(o,e,{_f:Object.assign(Object.assign(Object.assign({},r&&r._f?r._f:{ref:{name:e}}),{name:e,mount:!0}),t)}),t.value&&Ie(s,e,t.value),Ge(t.disabled)&&r&&Ie(s,e,t.disabled?void 0:me(s,e,pt(r._f))),d.mount.add(e),!r&&F(e,void 0,!0),St?{name:e}:Object.assign(Object.assign({name:e},ve(t.disabled)?{}:{disabled:t.disabled}),{onChange:D,onBlur:D,ref:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(r){if(r)K(e,r,t);else{var n=me(o,e,{}),a=i.shouldUnregister||t.shouldUnregister;n._f&&(n._f.mount=!1),a&&(!pe(d.array,e)||!c)&&d.unMount.add(e)}}))})},$=function(e,t){return function(){var r=h(y.mark((function r(n){var u,c,l,f,p;return y.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n&&(n.preventDefault&&n.preventDefault(),n.persist&&n.persist()),u=!0,c=Object.assign({},s),m.state.next({isSubmitting:!0}),r.prev=4,!i.resolver){r.next=15;break}return r.next=8,A();case 8:l=r.sent,f=l.errors,p=l.values,a.errors=f,c=p,r.next=17;break;case 15:return r.next=17,C(o);case 17:if(!Te(a.errors)||!Object.keys(a.errors).every((function(e){return me(c,e)}))){r.next=23;break}return m.state.next({errors:{},isSubmitting:!0}),r.next=21,e(c,n);case 21:r.next=28;break;case 23:if(r.t0=t,!r.t0){r.next=27;break}return r.next=27,t(a.errors,n);case 27:i.shouldFocusError&&Re(o,(function(e){return me(a.errors,e)}),d.mount);case 28:r.next=34;break;case 30:throw r.prev=30,r.t1=r.catch(4),u=!1,r.t1;case 34:return r.prev=34,a.isSubmitted=!0,m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Te(a.errors)&&u,submitCount:a.submitCount+1,errors:a.errors}),r.finish(34);case 38:case"end":return r.stop()}}),r,null,[[4,30,34,38]])})));return function(e){return r.apply(this,arguments)}}()},Z=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e||u,n=He(r);if(s=n,et&&!t.keepValues){var i,c=ae(d.mount);try{for(c.s();!(i=c.n()).done;){var f=i.value,p=me(o,f);if(p&&p._f){var h=Array.isArray(p._f.refs)?p._f.refs[0]:p._f.ref;try{$e(h)&&h.closest("form").reset();break}catch(e){}}}}catch(e){c.e(e)}finally{c.f()}}t.keepDefaultValues||(u=Object.assign({},r)),t.keepValues||(o={},m.control.next({values:t.keepDefaultValues?u:Object.assign({},r)}),m.watch.next({}),m.array.next({values:n})),d={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},m.state.next({submitCount:t.keepSubmitCount?a.submitCount:0,isDirty:t.keepDirty?a.isDirty:!!t.keepDefaultValues&&qe(e,u),isSubmitted:!!t.keepIsSubmitted&&a.isSubmitted,dirtyFields:t.keepDirty?a.dirtyFields:{},touchedFields:t.keepTouched?a.touchedFields:{},errors:t.keepErrors?a.errors:{},isSubmitting:!1,isSubmitSuccessful:!1}),l=!!t.keepIsValid},Q=function(e){return me(o,e)._f.ref.focus()},X=function(){var e,t=ae(d.unMount);try{for(t.s();!(e=t.n()).done;){var r=e.value,n=me(o,r);n&&(n._f.refs?n._f.refs.every(tt):tt(n._f.ref))&&G(r)}}catch(e){t.e(e)}finally{t.f()}d.unMount=new Set};return{control:{register:J,unregister:G,_getWatch:M,_getIsDirty:N,_updateValid:T,_updateValues:L,_removeFields:X,_updateFieldArray:B,_getFieldArrayValue:I,_subjects:m,_shouldUnregister:i.shouldUnregister,_proxyFormState:v,get _fields(){return o},set _fields(e){o=e},get _formValues(){return s},set _formValues(e){s=e},get _isMounted(){return l},set _isMounted(e){l=e},get _defaultValues(){return u},set _defaultValues(e){u=e},get _names(){return d},set _names(e){d=e},get _isInAction(){return c},set _isInAction(e){c=e},get _formState(){return a},set _formState(e){a=e},_updateProps:function(e){i=Object.assign(Object.assign({},Et),e)}},trigger:R,register:J,handleSubmit:$,watch:z,setValue:U,getValues:H,reset:Z,clearErrors:W,unregister:G,setError:q,setFocus:Q}}var Vt=function(e){var t=e.name,i=e.label,a=e.children,o=r.useContext(De).register;return n.createElement(n.Fragment,null,n.createElement(f,s({value:"True"},o(t),{className:"jkl-cookie-consent-modal__checkbox"}),i),n.createElement("p",{className:"jkl-cookie-consent-modal__info-text"},a))},Ct=function(e){var i=e.onAccept,a=D(),o=a.consent,s=a.dispatch,u=a.isOpen,f=a.requirement,h=a.showSettings,v=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.useRef(),i=r.useState({isDirty:!1,isValidating:!1,dirtyFields:{},isSubmitted:!1,submitCount:0,touchedFields:{},isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,errors:{}}),a=t(i,2),o=a[0],s=a[1];n.current?n.current.control._updateProps(e):n.current=Object.assign(Object.assign({},At(e)),{formState:o});var u=n.current.control;return r.useEffect((function(){var e=u._subjects.state.subscribe({next:function(e){Pe(e,u._proxyFormState,!0)&&(u._formState=Object.assign(Object.assign({},u._formState),e),s(Object.assign({},u._formState)))}});return function(){e.unsubscribe()}}),[u]),r.useEffect((function(){u._isMounted||(u._isMounted=!0,u._proxyFormState.isValid&&u._updateValid(),!e.shouldUnregister&&u._updateValues(u._defaultValues)),u._removeFields()})),n.current.formState=Ne(o,u._proxyFormState),n.current}({defaultValues:x(o)}),m=function(e){i("implicit"===e?_(f):e)};return n.createElement(ie,{backdrop:!0,strict:!0,hidden:!u,"aria-label":"Informasjonskapsler",className:"jkl-cookie-consent-modal","data-testautoid":"jkl-cookie-consent-modal"},h?n.createElement(Fe,v,n.createElement("h1",{className:"jkl-cookie-consent-modal__header"},"Informasjonskapsler"),n.createElement(c,{className:"jkl-cookie-consent-modal__checklist"},n.createElement(l,null,"Nettsidene skal fungere teknisk")),n.createElement("p",{className:"jkl-cookie-consent-modal__info-text"},"For at nettsidene skal fungere, må vi bruke tekniske informasjonskapsler. Denne kan derfor ikke slås av."),n.createElement("form",{onSubmit:v.handleSubmit((function(e){m(_(e))}))},f.functional&&n.createElement(Vt,{name:"functional",label:"Tillat funksjonelle"},"Funksjonelle informasjonskapsler lagrer opplysninger om din bruk av nettsidene og hvilke innstillinger du har gjort, slik at du kan få funksjonalitet tilpasset deg."),f.statistics&&n.createElement(Vt,{name:"statistics",label:"Tillat statistikk"},"Informasjonskapslene lagrer statistikk som hjelper oss med å forstå hvordan nettsidene blir brukt, slik at vi kan gjøre dem bedre og enklere å bruke."),f.marketing&&n.createElement(Vt,{name:"marketing",label:"Tillat personlig markedsføring"},"Dette gjør at vi kan gi deg mer relevant og tilpasset markedsføring, også gjennom våre samarbeidspartnere, på for eksempel nettsider, annonser og i sosiale medier."),n.createElement("div",{className:"jkl-cookie-consent-modal__button-group"},n.createElement(d,{"data-testid":"jkl-cookie-consent-godta"},"Godta")))):n.createElement(n.Fragment,null,n.createElement("h1",{className:"jkl-cookie-consent-modal__header"},"Vi bruker informasjonskapsler slik at:"),n.createElement(c,{className:"jkl-cookie-consent-modal__checklist"},n.createElement(l,null,"Nettsidene skal fungere teknisk"),f.functional&&n.createElement(l,null,"Nettsidene skal tilpasses din bruk, dine valg og dine innstillinger."),f.statistics&&n.createElement(l,null,"Vi kan samle statistikk på hvordan nettsidene brukes og dermed kunne forbedre tjenestene våre."),f.marketing&&n.createElement(l,null,"Vi kan gi deg personlig tilpasset innhold og relevante annonser, også gjennom våre samarbeidspartnere, på for eksempel nettsider og i sosiale medier.")),n.createElement("div",{className:"jkl-cookie-consent-modal__button-group"},n.createElement(d,{onClick:function(){return m("implicit")},"data-testid":"jkl-cookie-consent-godta"},"Godta"),n.createElement(p,{onClick:function(){s({type:"SET_SHOW_SETTINGS",payload:!0})}},"Innstillinger"))))};function Dt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ft(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?Dt(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Dt(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var Nt=function(e){var r=e.blocking,i=e.onAccept,s=D(),u=s.dispatch,c=s.consent,l=o(c);if(a((function(){i&&c!==l&&i(c)}),[i,c,l]),navigator&&!navigator.cookieEnabled)return i&&i({functional:"denied",marketing:"denied",statistics:"denied"}),null;return r?n.createElement(Ct,{onAccept:function(e){var r=Object.fromEntries(Object.entries(e).filter((function(e){var r=t(e,2);return r[0],null!=r[1]}))),n=Ft(Ft({},c),r);u({type:"UPDATE_CONSENT",payload:n}),u({type:"SET_SHOW_CONSENT",payload:!1}),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10368e3,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:O,n=[];n.push("".concat(r,"=").concat(JSON.stringify(e))),n.push("max-age=".concat(t)),n.push("SameSite=Lax"),document.cookie=n.join(";")}(n)}}):null};export{Nt as CookieConsent,C as CookieConsentProvider,F as useCookieConsent}; | ||
import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/slicedToArray";import*as r from"react";import n,{useMemo as i,useEffect as a}from"react";import{usePreviousValue as o}from"@fremtind/jkl-react-hooks";import s from"@babel/runtime/helpers/extends";import u from"@babel/runtime/helpers/typeof";import{UnorderedList as c,CheckListItem as l}from"@fremtind/jkl-list-react";import{Checkbox as f}from"@fremtind/jkl-checkbox-react";import{PrimaryButton as d,TertiaryButton as p}from"@fremtind/jkl-button-react";import h from"@babel/runtime/helpers/asyncToGenerator";import m from"@babel/runtime/helpers/classCallCheck";import v from"@babel/runtime/helpers/createClass";import b from"@babel/runtime/helpers/toConsumableArray";import y from"@babel/runtime/regenerator";function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function k(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?g(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var O="fremtind-cookie-consent",w=function(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:O,t=document.cookie.split(";").map((function(e){return e.trim().split("=")})).find((function(t){return t[0]===e}));if(t)return t}();return t?JSON.parse(t[1]):e?e():void 0},j=function(e){if(e)return"denied"!==e},x=function(e){var r=Object.entries(k(k({},{functional:null,marketing:null,statistics:null}),e)).map((function(e){var r=t(e,2),n=r[0],i=r[1];return[n,j(i)]}));return Object.fromEntries(r)},_=function(e){var r={functional:void 0,marketing:void 0,statistics:void 0},n=Object.entries(k(k({},r),e)).map((function(e){var r,n=t(e,2),i=n[0],a=n[1];return[i,(r=a,void 0===r?null:!1===r||"false"===String(r).toLowerCase()?"denied":"accepted")]}));return Object.fromEntries(n)};function E(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function S(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?E(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):E(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var A=n.createContext(void 0),V=function(e,t){switch(t.type){case"SET_SHOW_CONSENT":return S(S({},e),{},{isOpen:t.payload});case"SET_SHOW_SETTINGS":return S(S({},e),{},{showSettings:t.payload});case"UPDATE_CONSENT":return S(S({},e),{},{consent:S(S({},e.consent),t.payload)});default:throw new Error("Unhandled action type: ".concat(t.type))}},C=function(e){var r=e.children,o=e.cookieAdapter,s=e.marketing,u=e.functional,c=e.statistics,l=i((function(){var e;return null!==(e=w(o))&&void 0!==e?e:{marketing:null,functional:null,statistics:null}}),[o]),f=i((function(){return{marketing:null!=s&&s,functional:null!=u&&u,statistics:null!=c&&c}}),[s,u,c]),d=n.useReducer(V,{isOpen:!1,showSettings:!1,requirement:f,consent:l}),p=t(d,2),h=p[0],m=p[1];a((function(){!function(e,r){if(r){for(var n=new Map(Object.entries(r)),i=0,a=Object.entries(e);i<a.length;i++){var o=t(a[i],2),s=o[0];if(o[1]&&null===n.get(s))return!0}return!1}return Object.values(e).some((function(e){return e}))}(f,l)?l&&m({type:"UPDATE_CONSENT",payload:l}):m({type:"SET_SHOW_CONSENT",payload:!0})}),[f,l]);var v={state:h,dispatch:m};return n.createElement(A.Provider,{value:v},r)},F=function(){var e=n.useContext(A);if(void 0===e)throw new Error("useCookieConsentState must be used within a CookieConsentProvider");return S({dispatch:e.dispatch},e.state)},D=function(){var e=n.useContext(A);if(void 0===e)throw new Error("useCookieConsent must be used within a CookieConsentProvider");return{openConsentModalWithSettings:function(){e.dispatch({type:"SET_SHOW_CONSENT",payload:!0}),e.dispatch({type:"SET_SHOW_SETTINGS",payload:!0})}}};function N(e){return e&&"object"===u(e)&&"default"in e?e:{default:e}}var P=N(require("react"));function T(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function M(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function B(e){return(B=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function U(e,t){return(U=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function L(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function I(e,t,r){return(I=L()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&U(i,r.prototype),i}).apply(null,arguments)}function R(e){var t="function"==typeof Map?new Map:void 0;return(R=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return I(e,arguments,B(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),U(n,e)})(e)}function H(e,t){return!t||"object"!==u(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function W(e){return function(e){if(Array.isArray(e))return q(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return q(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return q(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var z="undefined"!=typeof window;z&&/(android)/i.test(navigator.userAgent),z&&/iPad|iPhone|iPod/.test(String(navigator.platform)),z||global.HTMLElement||(global.HTMLElement=function(){return function e(){T(this,e)}}());var G,K,$=(G="undefined"==typeof window?{}:window.Element.prototype,K=G.matches||G.msMatchesSelector||G.webkitMatchesSelector,G.closest?function(e,t){return e.closest(t)}:function(e,t){for(e.correspondingUseElement&&(e=e.correspondingUseElement);e;e=e.parentElement)if(K.call(e,t))return e;return null});function J(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:!this.hasAttribute(t);return!r===e.hasAttribute(t)&&e[r?"setAttribute":"removeAttribute"](t,""),r}function Z(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;if(e){if(e.nodeType)return[e];if("string"==typeof e)return[].slice.call(t.querySelectorAll(e));if(e.length)return[].slice.call(e)}return[]}var Q="[tabindex],a,button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled])",X=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&U(e,t)}(s,R(HTMLElement));var t,r,n,i,a,o=(t=s,r=L(),function(){var e,n=B(t);if(r){var i=B(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return H(this,e)});function s(){return T(this,s),o.apply(this,arguments)}return n=s,a=[{key:"observedAttributes",get:function(){return["hidden","backdrop"]}}],(i=[{key:"connectedCallback",value:function(){this._focus=!0,this._autoBackdrop=null,this.attributeChangedCallback(),this.addEventListener("transitionend",this),document.addEventListener("keydown",this),document.addEventListener("click",this)}},{key:"disconnectedCallback",value:function(){re(this._focus),this._autoBackdrop&&this._autoBackdrop.parentNode.removeChild(this._autoBackdrop),this._focus=this._autoBackdrop=null,this.removeEventListener("transitionend",this),document.removeEventListener("keydown",this),document.removeEventListener("click",this)}},{key:"attributeChangedCallback",value:function(e,t,r){var n=this;if(this._focus){var i="backdrop"===e&&Y(this,t),a=this.backdrop;if(this.className=this.className,this.setAttribute("role","dialog"),this.setAttribute("aria-modal",Boolean(a)),i&&i.setAttribute("hidden",""),a&&J(a,"hidden",this.hidden),this.hidden)re(this._focus);else{var o=window.getComputedStyle(this).getPropertyValue("z-index");if(("auto"===o||"0"===o)&&""===this.style.zIndex){var s=Z(this.nodeName).filter((function(e){return e!==a&&!n.contains(e)&&ee(e)}));o=Math.min(Math.max.apply(Math,[1].concat(W(s.map(te)))),2e9),a&&(a.style.zIndex=o+1),this.style.zIndex=o+2}this._focus=document.activeElement||document.body,setTimeout((function(){return ne(n)}))}"hidden"===e&&r!==t&&function(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i="prevent_recursive_dispatch_maximum_callstack".concat(t);if(e[i])return!0;e[i]=!0,"function"==typeof window.CustomEvent?r=new window.CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n}):(r=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,n);e.dispatchEvent(r);e[i]=null}(this,"dialog.toggle")}}},{key:"handleEvent",value:function(e){if(!e.defaultPrevented)if("transitionend"!==e.type||e.target!==this||this.hidden){if("click"===e.type){if(e.target===this.backdrop&&!this.strict)return this.close();var t=$(e.target,"button"),r=t&&(t.getAttribute("data-for")||t.getAttribute("for"));"close"===r&&$(e.target,this.nodeName)===this?this.close():r===this.id&&this.show()}else if("keydown"===e.type&&(9===e.keyCode||27===e.keyCode)&&!this.hidden){if(Z("".concat(this.nodeName,":not([hidden])")).sort((function(e,t){return te(e)-te(t)})).pop()!==this)return;9===e.keyCode&&function(e,t){var r=Z(Q,e).filter(ee),n=r[t.shiftKey?0:r.length-1];t.target!==n&&e.contains(t.target)||(t.preventDefault(),r[t.shiftKey?r.length-1:0].focus())}(this,e),27!==e.keyCode||this.strict||(e.preventDefault(),this.close())}}else ne(this)}},{key:"close",value:function(){this.hidden=!0}},{key:"show",value:function(){this.hidden=!1}},{key:"open",get:function(){return!this.hidden},set:function(e){this.hidden=!e}},{key:"strict",get:function(){return this.hasAttribute("strict")},set:function(e){J(this,"strict",e)}},{key:"hidden",get:function(){return this.hasAttribute("hidden")},set:function(e){J(this,"hidden",e)}},{key:"backdrop",get:function(){return Y(this,this.getAttribute("backdrop"))},set:function(e){this.setAttribute("backdrop",e||"false")}}])&&M(n.prototype,i),a&&M(n,a),s}();function Y(e,t){var r=e.nextElementSibling;return!(!e.parentNode||"false"===t)&&(t&&"true"!==t?document.getElementById(t)||!1:r&&"BACKDROP"===r.nodeName?r:(e._autoBackdrop=document.createElement("backdrop"),e.insertAdjacentElement("afterend",e._autoBackdrop)))}function ee(e){return e.offsetWidth&&e.offsetHeight&&"hidden"!==window.getComputedStyle(e).getPropertyValue("visibility")}function te(e){for(var t=1,r=e;r;r=r.offsetParent)t+=Number(window.getComputedStyle(r).getPropertyValue("z-index"))||0;return t}function re(e){setTimeout((function(){try{e.focus()}catch(e){}}))}function ne(e){if(!e.contains(document.activeElement)&&ee(e)){var t=Z("[autofocus]",e).concat(Z(Q,e)).filter(ee)[0];try{t.focus()}catch(t){console.warn(e,'is initialized without focusable elements. Please add [tabindex="-1"] the main element (for instance a <h1>)')}}}var ie=function(){var e="undefined"==typeof window?{}:window.Element.prototype,t=e.matches||e.msMatchesSelector||e.webkitMatchesSelector;return e.closest?function(e,t){return e.closest(t)}:function(e,r){for(;e;e=e.parentElement)if(t.call(e,r))return e;return null}}();var ae=function(e,t){void 0===t&&(t={});var r=(t.name||e.name||String(e).match(/function ([^(]+)/)[1]).replace(/.[A-Z]/g,(function(e){return e[0]+"-"+e[1]})),n=t.props||[],i=t.customEvents||[],a=i.reduce((function(e,t){return e[t]="on"+t.replace(/(^|\.)./g,(function(e){return e.slice(-1).toUpperCase()})),e}),{}),o=n.concat("forwardRef",Object.keys(a).map((function(e){return a[e]}))),s=(r+"-"+(t.suffix||"react")).replace(/\W+/g,"-").toLowerCase();return function(t){function r(e){var r=this;t.call(this,e),this.ref=function(e){return"function"==typeof r.props.forwardRef?r.props.forwardRef(e):r.props.forwardRef&&(r.props.forwardRef.current=e),r.el=e},Object.keys(a).forEach((function(e){var t=a[e];r[e]=function(e){r.props[t]&&ie(e.target,r.el.nodeName)===r.el&&r.props[t](e)}}))}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.componentDidMount=function(){var t=this;window.customElements.get(s)||window.customElements.define(s,e),n.forEach((function(e){e in t.props&&(t.el[e]=t.props[e])})),i.forEach((function(e){t.el.addEventListener(e,t[e])}))},r.prototype.componentDidUpdate=function(e){var t=this;n.forEach((function(r){e[r]!==t.props[r]&&(t.el[r]=t.props[r])}))},r.prototype.componentWillUnmount=function(){var e=this;i.forEach((function(t){e.el.removeEventListener(t,e[t])}))},r.prototype.render=function(){var e=this;return P.default.createElement(s,Object.keys(this.props).reduce((function(t,r){return-1===o.indexOf(r)&&("className"===r?t.class=e.props[r]:!0===e.props[r]?t[r]="":!1!==e.props[r]&&(t[r]=e.props[r])),t}),{ref:this.ref}))},r}(P.default.Component)}(X,{customEvents:["dialog.toggle"],props:["backdrop"],suffix:"3.1.0"});function oe(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return se(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return se(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function se(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var ue=function(e){return"checkbox"===e.type},ce=function(e){return e instanceof Date},le=function(e){return null==e},fe=function(e){return"object"===u(e)},de=function(e){return!le(e)&&!Array.isArray(e)&&fe(e)&&!ce(e)},pe=function(e){return e.substring(0,e.search(/.\d/))||e},he=function(e,t){return b(e).some((function(e){return pe(t)===e}))},me=function(e){return e.filter(Boolean)},ve=function(e){return void 0===e},be=function(e,t,r){if(de(e)&&t){var n=me(t.split(/[,[\].]+?/)).reduce((function(e,t){return le(e)?e:e[t]}),e);return ve(n)||n===e?ve(e[t])?r:e[t]:n}},ye="blur",ge="onBlur",ke="onChange",Oe="onSubmit",we="onTouched",je="all",xe="max",_e="min",Ee="maxLength",Se="minLength",Ae="pattern",Ve="required",Ce="validate",Fe=function(e,t){var r=Object.assign({},e);return delete r[t],r},De=r.createContext(null);De.displayName="RHFContext";var Ne=function(e){return r.createElement(De.Provider,{value:Fe(e,"children")},e.children)},Pe=function(e,t,r){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];function i(i){return function(){if(i in e)return t[i]!==je&&(t[i]=!n||je),r&&(r[i]=!0),e[i]}}var a={};for(var o in e)Object.defineProperty(a,o,{get:i(o)});return a},Te=function(e){return de(e)&&!Object.keys(e).length},Me=function(e,t,r){var n=Fe(e,"name");return Te(n)||Object.keys(n).length>=Object.keys(t).length||Object.keys(n).find((function(e){return t[e]===(!r||je)}))},Be=function(e){return Array.isArray(e)?e:[e]};function Ue(e){var t=e.disabled,n=e.subject,i=e.callback,a=r.useRef(n),o=r.useRef();t?a.current&&(o.current&&o.current.unsubscribe(),a.current=o.current=void 0):(a.current||(a.current=n),!o.current&&a.current&&(o.current=a.current.subscribe({next:i}))),r.useEffect((function(){return function(){o.current&&o.current.unsubscribe()}}),[])}var Le=function(t,r,n,i,a){return r?Object.assign(Object.assign({},n[t]),{types:Object.assign(Object.assign({},n[t]&&n[t].types?n[t].types:{}),e({},i,a||!0))}):{}},Ie=function(e){return/^\w*$/.test(e)},Re=function(e){return me(e.replace(/["|']|\]/g,"").split(/\.|\[/))};function He(e,t,r){for(var n=-1,i=Ie(t)?[t]:Re(t),a=i.length,o=a-1;++n<a;){var s=i[n],u=r;if(n!==o){var c=e[s];u=de(c)||Array.isArray(c)?c:isNaN(+i[n+1])?{}:[]}e[s]=u,e=e[s]}return e}var We=function e(t,r,n){var i,a=oe(n||Object.keys(t));try{for(a.s();!(i=a.n()).done;){var o=i.value,s=be(t,o);if(s){var u=s._f,c=Fe(s,"_f");if(u&&r(u.name)){if(u.ref.focus&&ve(u.ref.focus()))break;if(u.refs){u.refs[0].focus();break}}else de(c)&&e(c,r)}}}catch(e){a.e(e)}finally{a.f()}},qe=function(e,t){return e.map((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Fe(e,t)}))};function ze(e){var t,r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(!r&&!de(e))return e;for(var n in t=r?[]:{},e)t[n]=ze(e[n])}return t}var Ge=function(e){return le(e)||!fe(e)};function Ke(e,t){if(Ge(e)||Ge(t)||ce(e)||ce(t))return e===t;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(var i=0,a=r;i<a.length;i++){var o=a[i],s=e[o];if(!n.includes(o))return!1;if("ref"!==o){var u=t[o];if((de(s)||Array.isArray(s))&&(de(u)||Array.isArray(u))?!Ke(s,u):s!==u)return!1}}return!0}var $e=function(e){return{isOnSubmit:!e||e===Oe,isOnBlur:e===ge,isOnChange:e===ke,isOnAll:e===je,isOnTouch:e===we}},Je=function(e){return"boolean"==typeof e},Ze=function(e){return"file"===e.type},Qe=function(e){return"function"==typeof e},Xe=function(e){return e instanceof HTMLElement},Ye=function(e){return"select-multiple"===e.type},et=function(e){return"radio"===e.type},tt=function(e){return et(e)||ue(e)},rt=function(e){return"string"==typeof e},nt="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document,it=function(e){return!Xe(e)||!document.contains(e)},at=function(){function e(){m(this,e),this.tearDowns=[]}return v(e,[{key:"add",value:function(e){this.tearDowns.push(e)}},{key:"unsubscribe",value:function(){var e,t=oe(this.tearDowns);try{for(t.s();!(e=t.n()).done;){(0,e.value)()}}catch(e){t.e(e)}finally{t.f()}this.tearDowns=[]}}]),e}(),ot=function(){function e(t,r){var n=this;m(this,e),this.observer=t,this.closed=!1,r.add((function(){return n.closed=!0}))}return v(e,[{key:"next",value:function(e){this.closed||this.observer.next(e)}}]),e}(),st=function(){function e(){m(this,e),this.observers=[]}return v(e,[{key:"next",value:function(e){var t,r=oe(this.observers);try{for(r.s();!(t=r.n()).done;){t.value.next(e)}}catch(e){r.e(e)}finally{r.f()}}},{key:"subscribe",value:function(e){var t=new at,r=new ot(e,t);return this.observers.push(r),t}},{key:"unsubscribe",value:function(){this.observers=[]}}]),e}();function ut(e,t){var r,n=Ie(t)?[t]:Re(t),i=1==n.length?e:function(e,t){for(var r=t.slice(0,-1).length,n=0;n<r;)e=ve(e)?n++:e[t[n++]];return e}(e,n),a=n[n.length-1];i&&delete i[a];for(var o=0;o<n.slice(0,-1).length;o++){var s=-1,u=void 0,c=n.slice(0,-(o+1)),l=c.length-1;for(o>0&&(r=e);++s<c.length;){var f=c[s];u=u?u[f]:e[f],l===s&&(de(u)&&Te(u)||Array.isArray(u)&&!u.filter((function(e){return de(e)&&!Te(e)||Je(e)})).length)&&(r?delete r[f]:delete e[f]),r=u}}return e}var ct={value:!1,isValid:!1},lt={value:!0,isValid:!0},ft=function(e){if(Array.isArray(e)){if(e.length>1){var t=e.filter((function(e){return e&&e.checked&&!e.disabled})).map((function(e){return e.value}));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!ve(e[0].attributes.value)?ve(e[0].value)||""===e[0].value?lt:{value:e[0].value,isValid:!0}:lt:ct}return ct},dt=function(e,t){var r=t.valueAsNumber,n=t.valueAsDate,i=t.setValueAs;return ve(e)?e:r?""===e?NaN:+e:n?new Date(e):i?i(e):e},pt={isValid:!1,value:null},ht=function(e){return Array.isArray(e)?e.reduce((function(e,t){return t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e}),pt):pt};function mt(e){var t,r=e.ref;if(!(e.refs?e.refs.every((function(e){return e.disabled})):r.disabled))return Ze(r)?r.files:et(r)?ht(e.refs).value:Ye(r)?(t=r.options,b(t).filter((function(e){return e.selected})).map((function(e){return e.value}))):ue(r)?ft(e.refs).value:dt(ve(r.value)?e.ref.value:r.value,e)}var vt=function(e,t,r,n){var i,a={},o=oe(e);try{for(o.s();!(i=o.n()).done;){var s=i.value,u=be(t,s);u&&He(a,s,u._f)}}catch(e){o.e(e)}finally{o.f()}return{criteriaMode:r,names:b(e),fields:a,shouldUseNativeValidation:n}},bt=function(e){return e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate)};function yt(e,t){if(Ge(e)||Ge(t))return t;for(var r in t){var n=e[r],i=t[r];try{e[r]=de(n)&&de(i)||Array.isArray(n)&&Array.isArray(i)?yt(n,i):i}catch(e){}}return e}function gt(t,r,n,i,a){for(var o=-1;++o<t.length;){for(var s in t[o])Array.isArray(t[o][s])?(!n[o]&&(n[o]={}),n[o][s]=[],gt(t[o][s],be(r[o]||{},s,[]),n[o][s],n[o],s)):!le(r)&&Ke(be(r[o]||{},s),t[o][s])?He(n[o]||{},s):n[o]=Object.assign(Object.assign({},n[o]),e({},s,!0));i&&!n.length&&delete i[a]}return n}var kt=function(e,t,r){return yt(gt(e,t,r.slice(0,e.length)),gt(t,e,r.slice(0,e.length)))},Ot=function(e,t,r,n,i){return!i.isOnAll&&(!r&&i.isOnTouch?!(t||e):(r?n.isOnBlur:i.isOnBlur)?!e:!(r?n.isOnChange:i.isOnChange)||e)},wt=function(e,t){return!me(be(e,t,[])).length&&ut(e,t)},jt=function(e){return rt(e)||r.isValidElement(e)},xt=function(e){return e instanceof RegExp};function _t(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"validate";if(jt(e)||Array.isArray(e)&&e.every(jt)||Je(e)&&!e)return{type:r,message:jt(e)?e:"",ref:t}}var Et=function(e){return de(e)&&!xt(e)?e:{value:e,message:""}},St=function(){var e=h(y.mark((function e(t,r,n,i){var a,o,s,u,c,l,f,d,p,h,m,v,b,g,k,O,w,j,x,_,E,S,A,V,C,F,D,N,P,T,M,B,U,L,I,R,H,W,q,z,G,K,$,J;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t._f,o=a.ref,s=a.refs,u=a.required,c=a.maxLength,l=a.minLength,f=a.min,d=a.max,p=a.pattern,h=a.validate,m=a.name,v=a.valueAsNumber,b=a.mount,g=a.disabled,b&&!g){e.next=3;break}return e.abrupt("return",{});case 3:if(k=s?s[0]:o,O=function(e){i&&k.reportValidity&&(k.setCustomValidity(Je(e)?"":e||" "),k.reportValidity())},w={},j=et(o),x=ue(o),_=j||x,E=(v||Ze(o))&&!o.value||""===r||Array.isArray(r)&&!r.length,S=Le.bind(null,m,n,w),A=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ee,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Se,a=e?t:r;w[m]=Object.assign({type:e?n:i,message:a,ref:o},S(e?n:i,a))},!u||!(!_&&(E||le(r))||Je(r)&&!r||x&&!ft(s).isValid||j&&!ht(s).isValid)){e.next=19;break}if(V=jt(u)?{value:!!u,message:u}:Et(u),C=V.value,F=V.message,!C){e.next=19;break}if(w[m]=Object.assign({type:Ve,message:F,ref:k},S(Ve,F)),n){e.next=19;break}return O(F),e.abrupt("return",w);case 19:if(E||le(f)&&le(d)){e.next=28;break}if(P=Et(d),T=Et(f),isNaN(r)?(B=o.valueAsDate||new Date(r),rt(P.value)&&(D=B>new Date(P.value)),rt(T.value)&&(N=B<new Date(T.value))):(M=o.valueAsNumber||parseFloat(r),le(P.value)||(D=M>P.value),le(T.value)||(N=M<T.value)),!D&&!N){e.next=28;break}if(A(!!D,P.message,T.message,xe,_e),n){e.next=28;break}return O(w[m].message),e.abrupt("return",w);case 28:if(!c&&!l||E||!rt(r)){e.next=38;break}if(U=Et(c),L=Et(l),I=!le(U.value)&&r.length>U.value,R=!le(L.value)&&r.length<L.value,!I&&!R){e.next=38;break}if(A(I,U.message,L.message),n){e.next=38;break}return O(w[m].message),e.abrupt("return",w);case 38:if(!p||E||!rt(r)){e.next=45;break}if(H=Et(p),W=H.value,q=H.message,!xt(W)||r.match(W)){e.next=45;break}if(w[m]=Object.assign({type:Ae,message:q,ref:o},S(Ae,q)),n){e.next=45;break}return O(q),e.abrupt("return",w);case 45:if(!h){e.next=79;break}if(!Qe(h)){e.next=58;break}return e.next=49,h(r);case 49:if(z=e.sent,!(G=_t(z,k))){e.next=56;break}if(w[m]=Object.assign(Object.assign({},G),S(Ce,G.message)),n){e.next=56;break}return O(G.message),e.abrupt("return",w);case 56:e.next=79;break;case 58:if(!de(h)){e.next=79;break}K={},e.t0=y.keys(h);case 61:if((e.t1=e.t0()).done){e.next=75;break}if($=e.t1.value,Te(K)||n){e.next=65;break}return e.abrupt("break",75);case 65:return e.t2=_t,e.next=68,h[$](r);case 68:e.t3=e.sent,e.t4=k,e.t5=$,(J=(0,e.t2)(e.t3,e.t4,e.t5))&&(K=Object.assign(Object.assign({},J),S($,J.message)),O(J.message),n&&(w[m]=K)),e.next=61;break;case 75:if(Te(K)){e.next=79;break}if(w[m]=Object.assign({ref:k},K),n){e.next=79;break}return e.abrupt("return",w);case 79:return O(!0),e.abrupt("return",w);case 81:case"end":return e.stop()}}),e)})));return function(t,r,n,i){return e.apply(this,arguments)}}(),At={mode:Oe,reValidateMode:ke,shouldFocusError:!0},Vt="undefined"==typeof window;function Ct(){var r,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=Object.assign(Object.assign({},At),n),a={isDirty:!1,isValidating:!1,dirtyFields:{},isSubmitted:!1,submitCount:0,touchedFields:{},isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,errors:{}},o={},s=i.defaultValues||{},u=i.shouldUnregister?{}:ze(s),c={action:!1,mount:!1,watch:!1},l=0,f={mount:new Set,unMount:new Set,array:new Set,watch:new Set},d={},p={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={watch:new st,control:new st,array:new st,state:new st},v=$e(i.mode),g=$e(i.reValidateMode),k=i.criteriaMode===je,O=function(e,t){return function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];clearTimeout(l),l=window.setTimeout((function(){return e.apply(void 0,n)}),t)}},w=function(e){return f.watchAll||f.watch.has(e)||f.watch.has((e.match(/\w+/)||[])[0])},j=function(e,t){He(a.errors,e,t),m.state.next({errors:a.errors})},x=function(){var e=h(y.mark((function e(t,i,o,s,u){var c,f,h;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:c=be(a.errors,i),f=p.isValid&&a.isValid!==o,n.delayError&&s?(r=r||O(j,n.delayError))(i,s):(clearTimeout(l),s?He(a.errors,i,s):ut(a.errors,i)),(s?Ke(c,s):!c)&&Te(u)&&!f||t||(h=Object.assign(Object.assign(Object.assign({},u),f?{isValid:o}:{}),{errors:a.errors,name:i}),a=Object.assign(Object.assign({},a),h),m.state.next(h)),d[i]--,p.isValidating&&!d[i]&&(m.state.next({isValidating:!1}),d={});case 6:case"end":return e.stop()}}),e)})));return function(t,r,n,i,a){return e.apply(this,arguments)}}(),_=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3?arguments[3]:void 0,i=be(o,e),a=t;if(i){var s=i._f;s&&(He(u,e,dt(t,s)),a=nt&&Xe(s.ref)&&le(t)?"":t,Ze(s.ref)&&!rt(a)?s.ref.files=a:Ye(s.ref)?b(s.ref.options).forEach((function(e){return e.selected=a.includes(e.value)})):s.refs?ue(s.ref)?s.refs.length>1?s.refs.forEach((function(e){return e.checked=Array.isArray(a)?!!a.find((function(t){return t===e.value})):a===e.value})):s.refs[0].checked=!!a:s.refs.forEach((function(e){return e.checked=e.value===a})):s.ref.value=a,n&&m.control.next({values:u,name:e}))}(r.shouldDirty||r.shouldTouch)&&E(e,a,r.shouldTouch),r.shouldValidate&&L(e)},E=function(e,t,r){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i={name:e},o=!1;if(p.isDirty){var u=a.isDirty;a.isDirty=D(),i.isDirty=a.isDirty,o=u!==i.isDirty}if(p.dirtyFields&&!r){var c=be(a.dirtyFields,e),l=!Ke(be(s,e),t);l?He(a.dirtyFields,e,!0):ut(a.dirtyFields,e),i.dirtyFields=a.dirtyFields,o=o||c!==be(a.dirtyFields,e)}var f=be(a.touchedFields,e);return r&&!f&&(He(a.touchedFields,e,r),i.touchedFields=a.touchedFields,o=o||p.touchedFields&&f!==r),o&&n&&m.state.next(i),o?i:{}},S=function(){var e=h(y.mark((function e(t){return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!i.resolver){e.next=6;break}return e.next=3,i.resolver(Object.assign({},u),i.context,vt(t||f.mount,o,i.criteriaMode,i.shouldUseNativeValidation));case 3:e.t0=e.sent,e.next=7;break;case 6:e.t0={};case 7:return e.abrupt("return",e.t0);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),A=function(){var e=h(y.mark((function e(t){var r,n,i,o,s,u;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,S();case 2:if(r=e.sent,n=r.errors,t){i=oe(t);try{for(i.s();!(o=i.n()).done;)s=o.value,(u=be(n,s))?He(a.errors,s,u):ut(a.errors,s)}catch(e){i.e(e)}finally{i.f()}}else a.errors=n;return e.abrupt("return",n);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),V=function(){var e=h(y.mark((function e(t,r){var n,o,s,c,l,f,d=arguments;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=d.length>2&&void 0!==d[2]?d[2]:{valid:!0},e.t0=y.keys(t);case 2:if((e.t1=e.t0()).done){e.next=23;break}if(o=e.t1.value,!(s=t[o])){e.next=21;break}if(c=s._f,l=Fe(s,"_f"),!c){e.next=17;break}return e.next=11,St(s,be(u,c.name),k,i.shouldUseNativeValidation);case 11:if(!(f=e.sent)[c.name]){e.next=16;break}if(n.valid=!1,!r){e.next=16;break}return e.abrupt("break",23);case 16:r||(f[c.name]?He(a.errors,c.name,f[c.name]):ut(a.errors,c.name));case 17:if(e.t2=l,!e.t2){e.next=21;break}return e.next=21,V(l,r,n);case 21:e.next=2;break;case 23:return e.abrupt("return",n.valid);case 24:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),C=function(){var e=h(y.mark((function e(t){var r,n,s,c,l,f,h,b,O,j,_,A,V,C,F,D;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.target,n=r.name,!(s=be(o,n))){e.next=37;break}if(f=r.type?mt(s._f):r.value,(h=t.type===ye)&&s._f.onBlur?s._f.onBlur(t):s._f.onChange&&s._f.onChange(t),b=!bt(s._f)&&!i.resolver&&!be(a.errors,n)&&!s._f.deps||Ot(h,be(a.touchedFields,n),a.isSubmitted,g,v),O=!h&&w(n),He(u,n,f),j=E(n,f,h,!1),_=!Te(j)||O,!h&&m.watch.next({name:n,type:t.type}),!b){e.next=15;break}return e.abrupt("return",_&&m.state.next(Object.assign({name:n},O?{}:j)));case 15:if(!h&&O&&m.state.next({}),d[n]=(d[n],1),p.isValidating&&m.state.next({isValidating:!0}),!i.resolver){e.next=28;break}return e.next=21,S([n]);case 21:A=e.sent,V=A.errors,c=be(V,n),ue(r)&&!c&&(C=pe(n),F=be(o,C),Array.isArray(F)&&F.every((function(e){return e._f&&ue(e._f.ref)}))&&((D=be(V,C,{})).type&&(c=D),n=C)),l=Te(V),e.next=35;break;case 28:return e.next=30,St(s,be(u,n),k,i.shouldUseNativeValidation);case 30:return e.t0=n,c=e.sent[e.t0],e.next=34,N(!0);case 34:l=e.sent;case 35:s._f.deps&&L(s._f.deps),x(!1,n,l,c,j);case 37:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),F=function(e,t,r){var n=be(o,e);if(n){var i=be(u,e),a=ve(i)?be(s,e):i;ve(a)||r&&r.defaultChecked||t?He(u,e,t?a:mt(n._f)):_(e,a)}c.mount&&N()},D=function(e,t){return e&&t&&He(u,e,t),!Ke(Object.assign({},I()),s)},N=function(){var e=h(y.mark((function e(t){var r;return y.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=!1,!p.isValid){e.next=15;break}if(!i.resolver){e.next=10;break}return e.t1=Te,e.next=6,S();case 6:e.t2=e.sent.errors,e.t0=(0,e.t1)(e.t2),e.next=13;break;case 10:return e.next=12,V(o,!0);case 12:e.t0=e.sent;case 13:r=e.t0,t||r===a.isValid||(a.isValid=r,m.state.next({isValid:r}));case 15:return e.abrupt("return",r);case 16:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),P=function e(r,n,i){return Object.entries(n).forEach((function(n){var a=t(n,2),s=a[0],u=a[1],c="".concat(r,".").concat(s),l=be(o,c);!f.array.has(r)&&Ge(u)&&(!l||l._f)||ce(u)?_(c,u,i,!0):e(c,u,i)}))},T=function(t,r,n,i){var a=Object.assign({},n||c.mount?u:ve(r)?s:rt(t)?e({},t,r):r);if(!t)return i&&(f.watchAll=!0),a;var o,l=[],d=oe(Be(t));try{for(d.s();!(o=d.n()).done;){var p=o.value;i&&f.watch.add(p),l.push(be(a,p))}}catch(e){d.e(e)}finally{d.f()}return Array.isArray(t)?l:l[0]},M=function(e,t,r,n){var i,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],l=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],f=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];if(c.action=!0,f&&be(o,t)&&(i=r(be(o,t),n.argA,n.argB),l&&He(o,t,i)),Array.isArray(be(a.errors,t))){var d=r(be(a.errors,t),n.argA,n.argB);l&&He(a.errors,t,d),wt(a.errors,t)}if(p.touchedFields&&be(a.touchedFields,t)){var h=r(be(a.touchedFields,t),n.argA,n.argB);l&&He(a.touchedFields,t,h),wt(a.touchedFields,t)}(p.dirtyFields||p.isDirty)&&(He(a.dirtyFields,t,kt(qe(u,e),be(s,t,[]),be(a.dirtyFields,t,[]))),u&&He(a.dirtyFields,t,kt(qe(u,e),be(s,t,[]),be(a.dirtyFields,t,[]))),wt(a.dirtyFields,t)),m.state.next({isDirty:D(t,qe(u,e)),dirtyFields:a.dirtyFields,errors:a.errors,isValid:a.isValid})},B=function(e){return be(c.mount?u:s,e,[])},U=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=be(o,e),i=f.array.has(e);He(u,e,t),i?(m.array.next({name:e,values:u}),(p.isDirty||p.dirtyFields)&&r.shouldDirty&&(He(a.dirtyFields,e,kt(t,be(s,e,[]),be(a.dirtyFields,e,[]))),m.state.next({name:e,dirtyFields:a.dirtyFields,isDirty:D(e,t)}))):!n||n._f||le(t)?_(e,t,r,!0):P(e,t,r),w(e)&&m.state.next({}),m.watch.next({name:e})},L=function(){var t=h(y.mark((function t(r){var n,s,u,c,l=arguments;return y.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=l.length>1&&void 0!==l[1]?l[1]:{},s=Be(r),m.state.next({isValidating:!0}),!i.resolver){t.next=10;break}return t.next=6,A(ve(r)?r:s);case 6:c=t.sent,u=r?s.every((function(e){return!be(c,e)})):Te(c),t.next=20;break;case 10:if(!r){t.next=17;break}return t.next=13,Promise.all(s.map(function(){var t=h(y.mark((function t(r){var n;return y.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=be(o,r),t.next=3,V(n&&n._f?e({},r,n):n);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 13:u=t.sent.every(Boolean),N(),t.next=20;break;case 17:return t.next=19,V(o);case 19:u=t.sent;case 20:return m.state.next(Object.assign(Object.assign({},rt(r)?{name:r}:{}),{errors:a.errors,isValid:u,isValidating:!1})),n.shouldFocus&&!u&&We(o,(function(e){return be(a.errors,e)}),r?s:f.mount),t.abrupt("return",u);case 23:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),I=function(e){var t=Object.assign(Object.assign({},s),c.mount?u:{});return ve(e)?t:rt(e)?be(t,e):e.map((function(e){return be(t,e)}))},R=function(e){e?Be(e).forEach((function(e){return ut(a.errors,e)})):a.errors={},m.state.next({errors:a.errors})},H=function(e,t,r){var n=(be(o,e,{_f:{}})._f||{}).ref;He(a.errors,e,Object.assign(Object.assign({},t),{ref:n})),m.state.next({name:e,errors:a.errors,isValid:!1}),r&&r.shouldFocus&&n&&n.focus&&n.focus()},W=function(e,t){return Qe(e)?m.watch.subscribe({next:function(r){return e(T(void 0,t),r)}}):T(e,t,!1,!0)},q=function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=oe(e?Be(e):f.mount);try{for(n.s();!(t=n.n()).done;){var c=t.value;f.mount.delete(c),f.array.delete(c),be(o,c)&&(r.keepValue||(ut(o,c),ut(u,c)),!r.keepError&&ut(a.errors,c),!r.keepDirty&&ut(a.dirtyFields,c),!r.keepTouched&&ut(a.touchedFields,c),!i.shouldUnregister&&!r.keepDefaultValue&&ut(s,c))}}catch(e){n.e(e)}finally{n.f()}m.watch.next({}),m.state.next(Object.assign(Object.assign({},a),r.keepDirty?{isDirty:D()}:{})),!r.keepIsValid&&N()},z=function(e,t,r){G(e,r);var n=be(o,e),i=ve(t.value)&&t.querySelectorAll&&t.querySelectorAll("input,select,textarea")[0]||t,a=tt(i);i===n._f.ref||a&&me(n._f.refs||[]).find((function(e){return e===i}))||(n={_f:a?Object.assign(Object.assign({},n._f),{refs:[].concat(b(me(n._f.refs||[]).filter((function(e){return Xe(e)&&document.contains(e)}))),[i]),ref:{type:i.type,name:e}}):Object.assign(Object.assign({},n._f),{ref:i})},He(o,e,n),(!r||!r.disabled)&&F(e,!1,i))},G=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=be(o,e);return He(o,e,{_f:Object.assign(Object.assign(Object.assign({},r&&r._f?r._f:{ref:{name:e}}),{name:e,mount:!0}),t)}),f.mount.add(e),ve(t.value)||He(u,e,t.value),r&&Je(t.disabled)&&He(u,e,t.disabled?void 0:be(u,e,mt(r._f))),!r&&F(e,!0),Vt?{name:e}:Object.assign(Object.assign({name:e},Je(t.disabled)?{disabled:t.disabled}:{}),{onChange:C,onBlur:C,ref:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(r){if(r)z(e,r,t);else{var n=be(o,e,{}),a=i.shouldUnregister||t.shouldUnregister;n._f&&(n._f.mount=!1),a&&(!he(f.array,e)||!c.action)&&f.unMount.add(e)}}))})},K=function(e,t){return function(){var r=h(y.mark((function r(n){var s,c,l,d,p;return y.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n&&(n.preventDefault&&n.preventDefault(),n.persist&&n.persist()),s=!0,c=Object.assign({},u),m.state.next({isSubmitting:!0}),r.prev=4,!i.resolver){r.next=15;break}return r.next=8,S();case 8:l=r.sent,d=l.errors,p=l.values,a.errors=d,c=p,r.next=17;break;case 15:return r.next=17,V(o);case 17:if(!Te(a.errors)||!Object.keys(a.errors).every((function(e){return be(c,e)}))){r.next=23;break}return m.state.next({errors:{},isSubmitting:!0}),r.next=21,e(c,n);case 21:r.next=28;break;case 23:if(r.t0=t,!r.t0){r.next=27;break}return r.next=27,t(a.errors,n);case 27:i.shouldFocusError&&We(o,(function(e){return be(a.errors,e)}),f.mount);case 28:r.next=34;break;case 30:throw r.prev=30,r.t1=r.catch(4),s=!1,r.t1;case 34:return r.prev=34,a.isSubmitted=!0,m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Te(a.errors)&&s,submitCount:a.submitCount+1,errors:a.errors}),r.finish(34);case 38:case"end":return r.stop()}}),r,null,[[4,30,34,38]])})));return function(e){return r.apply(this,arguments)}}()},$=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e||s,i=ze(r);if(t.keepValues||(u=n.shouldUnregister?{}:i),nt&&!t.keepValues){var l,d=oe(f.mount);try{for(d.s();!(l=d.n()).done;){var h=l.value,v=be(o,h);if(v&&v._f){var b=Array.isArray(v._f.refs)?v._f.refs[0]:v._f.ref;try{Xe(b)&&b.closest("form").reset();break}catch(e){}}}}catch(e){d.e(e)}finally{d.f()}}t.keepDefaultValues||(s=Object.assign({},r)),t.keepValues||(o={},m.control.next({values:t.keepDefaultValues?s:Object.assign({},r)}),m.watch.next({}),m.array.next({values:i})),f={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},m.state.next({submitCount:t.keepSubmitCount?a.submitCount:0,isDirty:t.keepDirty?a.isDirty:!!t.keepDefaultValues&&Ke(e,s),isSubmitted:!!t.keepIsSubmitted&&a.isSubmitted,dirtyFields:t.keepDirty?a.dirtyFields:{},touchedFields:t.keepTouched?a.touchedFields:{},errors:t.keepErrors?a.errors:{},isSubmitting:!1,isSubmitSuccessful:!1}),c.mount=!p.isValid||!!t.keepIsValid,c.watch=!!n.shouldUnregister},J=function(e){return be(o,e)._f.ref.focus()},Z=function(){var e,t=oe(f.unMount);try{for(t.s();!(e=t.n()).done;){var r=e.value,n=be(o,r);n&&(n._f.refs?n._f.refs.every(it):it(n._f.ref))&&q(r)}}catch(e){t.e(e)}finally{t.f()}f.unMount=new Set};return{control:{register:G,unregister:q,_getWatch:T,_getIsDirty:D,_updateValid:N,_removeFields:Z,_updateFieldArray:M,_getFieldArrayValue:B,_subjects:m,_shouldUnregister:i.shouldUnregister,_proxyFormState:p,get _fields(){return o},set _fields(e){o=e},get _formValues(){return u},set _formValues(e){u=e},get _stateFlags(){return c},set _stateFlags(e){c=e},get _defaultValues(){return s},set _defaultValues(e){s=e},get _names(){return f},set _names(e){f=e},get _formState(){return a},set _formState(e){a=e},_updateProps:function(e){i=Object.assign(Object.assign({},At),e)}},trigger:L,register:G,handleSubmit:K,watch:W,setValue:U,getValues:I,reset:$,clearErrors:R,unregister:q,setError:H,setFocus:J}}var Ft=function(e){var t=e.name,i=e.label,a=e.children,o=r.useContext(De).register;return n.createElement(n.Fragment,null,n.createElement(f,s({value:"True"},o(t),{className:"jkl-cookie-consent-modal__checkbox"}),i),n.createElement("p",{className:"jkl-cookie-consent-modal__info-text"},a))},Dt=function(e){var i=e.onAccept,a=F(),o=a.consent,s=a.dispatch,u=a.isOpen,f=a.requirement,h=a.showSettings,m=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.useRef(),i=r.useState({isDirty:!1,isValidating:!1,dirtyFields:{},isSubmitted:!1,submitCount:0,touchedFields:{},isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,errors:{}}),a=t(i,2),o=a[0],s=a[1];n.current?n.current.control._updateProps(e):n.current=Object.assign(Object.assign({},Ct(e)),{formState:o});var u=n.current.control;return Ue({subject:u._subjects.state,callback:function(e){Me(e,u._proxyFormState,!0)&&(u._formState=Object.assign(Object.assign({},u._formState),e),s(Object.assign({},u._formState)))}}),r.useEffect((function(){u._stateFlags.mount||(u._proxyFormState.isValid&&u._updateValid(),u._stateFlags.mount=!0),u._stateFlags.watch&&(u._stateFlags.watch=!1,u._subjects.state.next({})),u._removeFields()})),n.current.formState=Pe(o,u._proxyFormState),n.current}({defaultValues:x(o)}),v=function(e){i("implicit"===e?_(f):e)};return n.createElement(ae,{backdrop:!0,strict:!0,hidden:!u,"aria-label":"Informasjonskapsler",className:"jkl-cookie-consent-modal","data-testautoid":"jkl-cookie-consent-modal"},h?n.createElement(Ne,m,n.createElement("h1",{className:"jkl-cookie-consent-modal__header"},"Informasjonskapsler"),n.createElement(c,{className:"jkl-cookie-consent-modal__checklist"},n.createElement(l,null,"Nettsidene skal fungere teknisk")),n.createElement("p",{className:"jkl-cookie-consent-modal__info-text"},"For at nettsidene skal fungere, må vi bruke tekniske informasjonskapsler. Denne kan derfor ikke slås av."),n.createElement("form",{onSubmit:m.handleSubmit((function(e){v(_(e))}))},f.functional&&n.createElement(Ft,{name:"functional",label:"Tillat funksjonelle"},"Funksjonelle informasjonskapsler lagrer opplysninger om din bruk av nettsidene og hvilke innstillinger du har gjort, slik at du kan få funksjonalitet tilpasset deg."),f.statistics&&n.createElement(Ft,{name:"statistics",label:"Tillat statistikk"},"Informasjonskapslene lagrer statistikk som hjelper oss med å forstå hvordan nettsidene blir brukt, slik at vi kan gjøre dem bedre og enklere å bruke."),f.marketing&&n.createElement(Ft,{name:"marketing",label:"Tillat personlig markedsføring"},"Dette gjør at vi kan gi deg mer relevant og tilpasset markedsføring, også gjennom våre samarbeidspartnere, på for eksempel nettsider, annonser og i sosiale medier."),n.createElement("div",{className:"jkl-cookie-consent-modal__button-group"},n.createElement(d,{"data-testid":"jkl-cookie-consent-godta"},"Godta")))):n.createElement(n.Fragment,null,n.createElement("h1",{className:"jkl-cookie-consent-modal__header"},"Vi bruker informasjonskapsler slik at:"),n.createElement(c,{className:"jkl-cookie-consent-modal__checklist"},n.createElement(l,null,"Nettsidene skal fungere teknisk"),f.functional&&n.createElement(l,null,"Nettsidene skal tilpasses din bruk, dine valg og dine innstillinger."),f.statistics&&n.createElement(l,null,"Vi kan samle statistikk på hvordan nettsidene brukes og dermed kunne forbedre tjenestene våre."),f.marketing&&n.createElement(l,null,"Vi kan gi deg personlig tilpasset innhold og relevante annonser, også gjennom våre samarbeidspartnere, på for eksempel nettsider og i sosiale medier.")),n.createElement("div",{className:"jkl-cookie-consent-modal__button-group"},n.createElement(d,{onClick:function(){return v("implicit")},"data-testid":"jkl-cookie-consent-godta"},"Godta"),n.createElement(p,{onClick:function(){s({type:"SET_SHOW_SETTINGS",payload:!0})}},"Innstillinger"))))};function Nt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Pt(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?Nt(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Nt(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var Tt=function(e){var r=e.blocking,i=e.onAccept,s=F(),u=s.dispatch,c=s.consent,l=o(c);if(a((function(){i&&c!==l&&i(c)}),[i,c,l]),navigator&&!navigator.cookieEnabled)return i&&i({functional:"denied",marketing:"denied",statistics:"denied"}),null;return r?n.createElement(Dt,{onAccept:function(e){var r=Object.fromEntries(Object.entries(e).filter((function(e){var r=t(e,2);return r[0],null!=r[1]}))),n=Pt(Pt({},c),r);u({type:"UPDATE_CONSENT",payload:n}),u({type:"SET_SHOW_CONSENT",payload:!1}),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10368e3,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:O,n=[];n.push("".concat(r,"=").concat(JSON.stringify(e))),n.push("max-age=".concat(t)),n.push("SameSite=Lax"),document.cookie=n.join(";")}(n)}}):null};export{Tt as CookieConsent,C as CookieConsentProvider,D as useCookieConsent}; |
{ | ||
"name": "@fremtind/jkl-cookie-consent-react", | ||
"version": "4.0.6", | ||
"version": "4.0.7", | ||
"publishConfig": { | ||
@@ -8,3 +8,3 @@ "access": "public" | ||
"description": "Jøkul react cookie consent component", | ||
"homepage": "https://fremtind.github.io/jokul", | ||
"homepage": "https://jokul.fremtind.no", | ||
"keywords": [ | ||
@@ -38,8 +38,8 @@ "cookie consent", | ||
"@babel/runtime": "^7.9.0", | ||
"@fremtind/jkl-button": "^4.0.4", | ||
"@fremtind/jkl-button-react": "^5.0.6", | ||
"@fremtind/jkl-cookie-consent": "^4.0.4", | ||
"@fremtind/jkl-list": "^5.0.3", | ||
"@fremtind/jkl-list-react": "^5.0.4", | ||
"@fremtind/jkl-react-hooks": "^5.0.3", | ||
"@fremtind/jkl-button": "^4.0.5", | ||
"@fremtind/jkl-button-react": "^5.0.7", | ||
"@fremtind/jkl-cookie-consent": "^4.0.5", | ||
"@fremtind/jkl-list": "^5.0.4", | ||
"@fremtind/jkl-list-react": "^5.0.5", | ||
"@fremtind/jkl-react-hooks": "^5.0.4", | ||
"@nrk/core-dialog": "^3.0.7", | ||
@@ -61,3 +61,3 @@ "classnames": "^2.2.6" | ||
}, | ||
"gitHead": "284dfaab0916d576bd7385e39b87ad531f6e1640" | ||
"gitHead": "7ba1ffe11b8e8f301528486906c449d3c63f2376" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
446372
9012