pdap-design-system 2.0.4 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.cjs +3 -3
- package/dist/index.js +222 -216
- package/dist/utils/vuelidate.test.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),X=require("vue-router"),le=e.defineComponent({__name:"PdapButton",props:{intent:{default:"primary"},isLoading:{type:Boolean,default:!1}},setup(t){const r=t,n=e.reactive({"pdap-button":!0,[`pdap-button-${r.intent}`]:!!r.intent,"pdap-button-loading":r.isLoading});return(a,o)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(n)},[e.renderSlot(a.$slots,"default")],2))}});const U=e.defineComponent({__name:"FlexContainer",props:{alignment:{default:"start"},component:{default:"div"}},setup(t){const r=t,n=e.reactive({"pdap-flex-container":!0,[`pdap-flex-container-${r.alignment}`]:!0});return(a,o)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.component),{class:e.normalizeClass(n)},{default:e.withCtx(()=>[e.renderSlot(a.$slots,"default")]),_:3},8,["class"]))}});const ke={class:"pdap-footer"},Re={class:"pdap-footer-social-links"},Ve=["href"],Oe=e.createElementVNode("p",{class:"pdap-footer-copyright"},[e.createTextVNode(" © 2023 Police Data Accessibility Project"),e.createElementVNode("br")],-1),Be=e.createElementVNode("p",{class:"pdap-footer-copyright"},[e.createTextVNode(" PDAP is a non-profit. EIN: 85-4207132. "),e.createElementVNode("a",{href:"https://docs.pdap.io/meta/policy/pdap-privacy-policy",alt:"Privacy Policy"}," Privacy Policy"),e.createTextVNode(". "),e.createElementVNode("a",{href:"mailto:contact@pdap.io"},"contact@pdap.io")],-1),Te={class:"pdap-footer-widget-links"},je=e.createElementVNode("a",{href:"https://www.guidestar.org/profile/85-4207132",target:"_blank"},[e.createElementVNode("img",{src:"https://widgets.guidestar.org/gximage2?o=9973356&l=v4"})],-1),Ae=["href"],Se=["src"],Ne=["src"],Le=e.defineComponent({__name:"PdapFooter",props:{logoImageSrc:{default:"node_modules/pdap-design-system/dist/images/acronym.svg"},logoImageAnchorPath:{default:"/"}},setup(t){const r=t,n=e.inject("footerLinks",[{href:"https://github.com/orgs/Police-Data-Accessibility-Project",text:"Github"},{href:"https://discord.gg/wMqex8nKZJ",text:"Discord"},{href:"https://www.linkedin.com/company/pdap",text:"LinkedIn"},{path:"/jobs",text:"Jobs"}]),a=r.logoImageAnchorPath.startsWith("/");return(o,s)=>{const c=e.resolveComponent("router-link");return e.openBlock(),e.createElementBlock("footer",ke,[e.createVNode(U,{alignment:"center"},{default:e.withCtx(()=>[e.createElementVNode("ul",Re,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),l=>(e.openBlock(),e.createElementBlock("li",{key:l.text,class:"pdap-footer-link-container"},[l.href?(e.openBlock(),e.createElementBlock("a",{key:0,class:"pdap-footer-social-link",href:l.href,target:"_blank",referrerpolicy:"no-referrer"},e.toDisplayString(l.text),9,Ve)):e.createCommentVNode("",!0),l.path?(e.openBlock(),e.createBlock(c,{key:1,"active-class":"pdap-footer-social-link-current","exact-active-class":"pdap-footer-social-link-current-exact",class:"pdap-footer-social-link",to:l.path},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.text),1)]),_:2},1032,["to"])):e.createCommentVNode("",!0)]))),128))]),Oe,Be,e.createElementVNode("div",Te,[je,e.unref(a)?(e.openBlock(),e.createBlock(c,{key:1,to:o.logoImageAnchorPath,class:"pdap-footer-logo"},{default:e.withCtx(()=>[e.createElementVNode("img",{src:o.logoImageSrc,loading:"lazy",width:"250",alt:"Police Data Accessibility Project Logo"},null,8,Ne)]),_:1},8,["to"])):(e.openBlock(),e.createElementBlock("a",{key:0,href:o.logoImageAnchorPath,class:"pdap-footer-logo"},[e.createElementVNode("img",{src:o.logoImageSrc,loading:"lazy",width:"250",alt:"Police Data Accessibility Project Logo"},null,8,Se)],8,Ae))])]),_:1})])}}});function Y(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);r&&(a=a.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,a)}return n}function P(t){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?Y(Object(n),!0).forEach(function(a){Ie(t,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Y(Object(n)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(n,a))})}return t}function Ie(t,r,n){return r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function ee(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return Object.keys(t).reduce((n,a)=>(r.includes(a)||(n[a]=e.unref(t[a])),n),{})}function L(t){return typeof t=="function"}function ze(t){return e.isReactive(t)||e.isReadonly(t)}function ue(t,r,n){let a=t;const o=r.split(".");for(let s=0;s<o.length;s++){if(!a[o[s]])return n;a=a[o[s]]}return a}function H(t,r,n){return e.computed(()=>t.some(a=>ue(r,a,{[n]:!1})[n]))}function te(t,r,n){return e.computed(()=>t.reduce((a,o)=>{const s=ue(r,o,{[n]:!1})[n]||[];return a.concat(s)},[]))}function de(t,r,n,a){return t.call(a,e.unref(r),e.unref(n),a)}function me(t){return t.$valid!==void 0?!t.$valid:!t}function De(t,r,n,a,o,s,c){let{$lazy:l,$rewardEarly:u}=o,m=arguments.length>7&&arguments[7]!==void 0?arguments[7]:[],d=arguments.length>8?arguments[8]:void 0,f=arguments.length>9?arguments[9]:void 0,g=arguments.length>10?arguments[10]:void 0;const h=e.ref(!!a.value),i=e.ref(0);n.value=!1;const p=e.watch([r,a].concat(m,g),()=>{if(l&&!a.value||u&&!f.value&&!n.value)return;let $;try{$=de(t,r,d,c)}catch(v){$=Promise.reject(v)}i.value++,n.value=!!i.value,h.value=!1,Promise.resolve($).then(v=>{i.value--,n.value=!!i.value,s.value=v,h.value=me(v)}).catch(v=>{i.value--,n.value=!!i.value,s.value=v,h.value=!0})},{immediate:!0,deep:typeof r=="object"});return{$invalid:h,$unwatch:p}}function Me(t,r,n,a,o,s,c,l){let{$lazy:u,$rewardEarly:m}=a;const d=()=>({}),f=e.computed(()=>{if(u&&!n.value||m&&!l.value)return!1;let g=!0;try{const h=de(t,r,c,s);o.value=h,g=me(h)}catch(h){o.value=h}return g});return{$unwatch:d,$invalid:f}}function qe(t,r,n,a,o,s,c,l,u,m,d){const f=e.ref(!1),g=t.$params||{},h=e.ref(null);let i,p;t.$async?{$invalid:i,$unwatch:p}=De(t.$validator,r,f,n,a,h,o,t.$watchTargets,u,m,d):{$invalid:i,$unwatch:p}=Me(t.$validator,r,n,a,h,o,u,m);const $=t.$message;return{$message:L($)?e.computed(()=>$(ee({$pending:f,$invalid:i,$params:ee(g),$model:r,$response:h,$validator:s,$propertyPath:l,$property:c}))):$||"",$params:g,$pending:f,$invalid:i,$response:h,$unwatch:p}}function Fe(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const r=e.unref(t),n=Object.keys(r),a={},o={},s={};let c=null;return n.forEach(l=>{const u=r[l];switch(!0){case L(u.$validator):a[l]=u;break;case L(u):a[l]={$validator:u};break;case l==="$validationGroups":c=u;break;case l.startsWith("$"):s[l]=u;break;default:o[l]=u}}),{rules:a,nestedValidators:o,config:s,validationGroups:c}}const He="__root";function Ge(t,r,n,a,o,s,c,l,u){const m=Object.keys(t),d=a.get(o,t),f=e.ref(!1),g=e.ref(!1),h=e.ref(0);if(d){if(!d.$partial)return d;d.$unwatch(),f.value=d.$dirty.value}const i={$dirty:f,$path:o,$touch:()=>{f.value||(f.value=!0)},$reset:()=>{f.value&&(f.value=!1)},$commit:()=>{}};return m.length?(m.forEach(p=>{i[p]=qe(t[p],r,i.$dirty,s,c,p,n,o,u,g,h)}),i.$externalResults=e.computed(()=>l.value?[].concat(l.value).map((p,$)=>({$propertyPath:o,$property:n,$validator:"$externalResults",$uid:`${o}-externalResult-${$}`,$message:p,$params:{},$response:null,$pending:!1})):[]),i.$invalid=e.computed(()=>{const p=m.some($=>e.unref(i[$].$invalid));return g.value=p,!!i.$externalResults.value.length||p}),i.$pending=e.computed(()=>m.some(p=>e.unref(i[p].$pending))),i.$error=e.computed(()=>i.$dirty.value?i.$pending.value||i.$invalid.value:!1),i.$silentErrors=e.computed(()=>m.filter(p=>e.unref(i[p].$invalid)).map(p=>{const $=i[p];return e.reactive({$propertyPath:o,$property:n,$validator:p,$uid:`${o}-${p}`,$message:$.$message,$params:$.$params,$response:$.$response,$pending:$.$pending})}).concat(i.$externalResults.value)),i.$errors=e.computed(()=>i.$dirty.value?i.$silentErrors.value:[]),i.$unwatch=()=>m.forEach(p=>{i[p].$unwatch()}),i.$commit=()=>{g.value=!0,h.value=Date.now()},a.set(o,t,i),i):(d&&a.set(o,t,i),i)}function Xe(t,r,n,a,o,s,c){const l=Object.keys(t);return l.length?l.reduce((u,m)=>(u[m]=G({validations:t[m],state:r,key:m,parentKey:n,resultsCache:a,globalConfig:o,instance:s,externalResults:c}),u),{}):{}}function Ue(t,r,n){const a=e.computed(()=>[r,n].filter(i=>i).reduce((i,p)=>i.concat(Object.values(e.unref(p))),[])),o=e.computed({get(){return t.$dirty.value||(a.value.length?a.value.every(i=>i.$dirty):!1)},set(i){t.$dirty.value=i}}),s=e.computed(()=>{const i=e.unref(t.$silentErrors)||[],p=a.value.filter($=>(e.unref($).$silentErrors||[]).length).reduce(($,v)=>$.concat(...v.$silentErrors),[]);return i.concat(p)}),c=e.computed(()=>{const i=e.unref(t.$errors)||[],p=a.value.filter($=>(e.unref($).$errors||[]).length).reduce(($,v)=>$.concat(...v.$errors),[]);return i.concat(p)}),l=e.computed(()=>a.value.some(i=>i.$invalid)||e.unref(t.$invalid)||!1),u=e.computed(()=>a.value.some(i=>e.unref(i.$pending))||e.unref(t.$pending)||!1),m=e.computed(()=>a.value.some(i=>i.$dirty)||a.value.some(i=>i.$anyDirty)||o.value),d=e.computed(()=>o.value?u.value||l.value:!1),f=()=>{t.$touch(),a.value.forEach(i=>{i.$touch()})},g=()=>{t.$commit(),a.value.forEach(i=>{i.$commit()})},h=()=>{t.$reset(),a.value.forEach(i=>{i.$reset()})};return a.value.length&&a.value.every(i=>i.$dirty)&&f(),{$dirty:o,$errors:c,$invalid:l,$anyDirty:m,$error:d,$pending:u,$touch:f,$reset:h,$silentErrors:s,$commit:g}}function G(t){let{validations:r,state:n,key:a,parentKey:o,childResults:s,resultsCache:c,globalConfig:l={},instance:u,externalResults:m}=t;const d=o?`${o}.${a}`:a,{rules:f,nestedValidators:g,config:h,validationGroups:i}=Fe(r),p=P(P({},l),h),$=a?e.computed(()=>{const y=e.unref(n);return y?e.unref(y[a]):void 0}):n,v=P({},e.unref(m)||{}),B=e.computed(()=>{const y=e.unref(m);return a?y?e.unref(y[a]):void 0:y}),D=Ge(f,$,a,c,d,p,u,B,n),w=Xe(g,$,d,c,p,u,B),R={};i&&Object.entries(i).forEach(y=>{let[V,E]=y;R[V]={$invalid:H(E,w,"$invalid"),$error:H(E,w,"$error"),$pending:H(E,w,"$pending"),$errors:te(E,w,"$errors"),$silentErrors:te(E,w,"$silentErrors")}});const{$dirty:x,$errors:S,$invalid:M,$anyDirty:ye,$error:_e,$pending:q,$touch:F,$reset:we,$silentErrors:be,$commit:J}=Ue(D,w,s),xe=a?e.computed({get:()=>e.unref($),set:y=>{x.value=!0;const V=e.unref(n),E=e.unref(m);E&&(E[a]=v[a]),e.isRef(V[a])?V[a].value=y:V[a]=y}}):null;a&&p.$autoDirty&&e.watch($,()=>{x.value||F();const y=e.unref(m);y&&(y[a]=v[a])},{flush:"sync"});async function Ee(){return F(),p.$rewardEarly&&(J(),await e.nextTick()),await e.nextTick(),new Promise(y=>{if(!q.value)return y(!M.value);const V=e.watch(q,()=>{y(!M.value),V()})})}function Pe(y){return(s.value||{})[y]}function Ce(){e.isRef(m)?m.value=v:Object.keys(v).length===0?Object.keys(m).forEach(y=>{delete m[y]}):Object.assign(m,v)}return e.reactive(P(P(P({},D),{},{$model:xe,$dirty:x,$error:_e,$errors:S,$invalid:M,$anyDirty:ye,$pending:q,$touch:F,$reset:we,$path:d||He,$silentErrors:be,$validate:Ee,$commit:J},s&&{$getResultsForChild:Pe,$clearExternalResults:Ce,$validationGroups:R}),w))}class We{constructor(){this.storage=new Map}set(r,n,a){this.storage.set(r,{rules:n,result:a})}checkRulesValidity(r,n,a){const o=Object.keys(a),s=Object.keys(n);return s.length!==o.length||!s.every(l=>o.includes(l))?!1:s.every(l=>n[l].$params?Object.keys(n[l].$params).every(u=>e.unref(a[l].$params[u])===e.unref(n[l].$params[u])):!0)}get(r,n){const a=this.storage.get(r);if(!a)return;const{rules:o,result:s}=a,c=this.checkRulesValidity(r,n,o),l=s.$unwatch?s.$unwatch:()=>({});return c?s:{$dirty:s.$dirty,$partial:!0,$unwatch:l}}}const N={COLLECT_ALL:!0,COLLECT_NONE:!1},re=Symbol("vuelidate#injectChildResults"),ne=Symbol("vuelidate#removeChildResults");function Ke(t){let{$scope:r,instance:n}=t;const a={},o=e.ref([]),s=e.computed(()=>o.value.reduce((d,f)=>(d[f]=e.unref(a[f]),d),{}));function c(d,f){let{$registerAs:g,$scope:h,$stopPropagation:i}=f;i||r===N.COLLECT_NONE||h===N.COLLECT_NONE||r!==N.COLLECT_ALL&&r!==h||(a[g]=d,o.value.push(g))}n.__vuelidateInjectInstances=[].concat(n.__vuelidateInjectInstances||[],c);function l(d){o.value=o.value.filter(f=>f!==d),delete a[d]}n.__vuelidateRemoveInstances=[].concat(n.__vuelidateRemoveInstances||[],l);const u=e.inject(re,[]);e.provide(re,n.__vuelidateInjectInstances);const m=e.inject(ne,[]);return e.provide(ne,n.__vuelidateRemoveInstances),{childResults:s,sendValidationResultsToParent:u,removeValidationResultsFromParent:m}}function pe(t){return new Proxy(t,{get(r,n){return typeof r[n]=="object"?pe(r[n]):e.computed(()=>r[n])}})}let ae=0;function Qe(t,r){var n;let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};arguments.length===1&&(a=t,t=void 0,r=void 0);let{$registerAs:o,$scope:s=N.COLLECT_ALL,$stopPropagation:c,$externalResults:l,currentVueInstance:u}=a;const m=u||((n=e.getCurrentInstance())===null||n===void 0?void 0:n.proxy),d=m?m.$options:{};o||(ae+=1,o=`_vuelidate_${ae}`);const f=e.ref({}),g=new We,{childResults:h,sendValidationResultsToParent:i,removeValidationResultsFromParent:p}=m?Ke({$scope:s,instance:m}):{childResults:e.ref({})};if(!t&&d.validations){const $=d.validations;r=e.ref({}),e.onBeforeMount(()=>{r.value=m,e.watch(()=>L($)?$.call(r.value,new pe(r.value)):$,v=>{f.value=G({validations:v,state:r,childResults:h,resultsCache:g,globalConfig:a,instance:m,externalResults:l||m.vuelidateExternalResults})},{immediate:!0})}),a=d.validationsConfig||a}else{const $=e.isRef(t)||ze(t)?t:e.reactive(t||{});e.watch($,v=>{f.value=G({validations:v,state:r,childResults:h,resultsCache:g,globalConfig:a,instance:m??{},externalResults:l})},{immediate:!0})}return m&&(i.forEach($=>$(f,{$registerAs:o,$scope:s,$stopPropagation:c})),e.onBeforeUnmount(()=>p.forEach($=>$(o)))),e.computed(()=>P(P({},e.unref(f.value)),h.value))}var b=(t=>(t.CHECKBOX="checkbox",t.TEXT="text",t))(b||{});const Ze=["id","name","placeholder","value"],Je=["id","name","checked","value"],Ye=["id"],et=["for"],fe=e.defineComponent({__name:"PdapInput",props:{error:{},id:{},label:{},name:{},placeholder:{},type:{},value:{},defaultChecked:{type:Boolean}},emits:["change","input"],setup(t,{emit:r}){const n=t,a=r,o=()=>{c.value=!c.value,a("change",c.value.toString())},s=u=>{a("input",u.target.value)},c=e.ref(n.defaultChecked),l=e.computed(()=>`pdap-${n.name}-input-error`);return(u,m)=>{var d;return e.openBlock(),e.createBlock(e.unref(he),{class:e.normalizeClass({"pdap-input":!0,"pdap-input-error":Number((d=u.error)==null?void 0:d.length)>=1})},{default:e.withCtx(()=>[u.type===e.unref(b).TEXT?(e.openBlock(),e.createElementBlock("input",e.mergeProps({key:0,id:u.id,type:"text",name:u.name,placeholder:u.placeholder,value:u.value},u.$attrs,{onInput:s}),null,16,Ze)):u.type===e.unref(b).CHECKBOX?(e.openBlock(),e.createElementBlock("input",e.mergeProps({key:1,id:u.id,class:"pdap-input-checkbox",name:u.name,checked:c.value,type:"checkbox",value:u.value},u.$attrs,{onChange:o}),null,16,Je)):e.createCommentVNode("",!0),u.error?(e.openBlock(),e.createElementBlock("div",{key:2,id:l.value,class:"pdap-input-error-message"},e.toDisplayString(u.error),9,Ye)):e.createCommentVNode("",!0),e.createElementVNode("label",{class:"pdap-input-label",for:u.id},e.toDisplayString(u.label),9,et)]),_:1},8,["class"])}}});function oe(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);r&&(a=a.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,a)}return n}function T(t){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?oe(Object(n),!0).forEach(function(a){tt(t,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):oe(Object(n)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(n,a))})}return t}function tt(t,r,n){return r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function j(t){return typeof t=="function"}function I(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function z(t){return j(t.$validator)?T({},t):{$validator:t}}function rt(t){return I(t)&&j(t.then)}function C(t){return typeof t=="object"?t.$valid:t}function O(t){return t.$validator||t}function W(t,r){if(!I(t))throw new Error(`[@vuelidate/validators]: First parameter to "withParams" should be an object, provided ${typeof t}`);if(!I(r)&&!j(r))throw new Error("[@vuelidate/validators]: Validator must be a function or object with $validator parameter");const n=z(r);return n.$params=T(T({},n.$params||{}),t),n}function A(t,r){if(!j(t)&&typeof e.unref(t)!="string")throw new Error(`[@vuelidate/validators]: First parameter to "withMessage" should be string or a function returning a string, provided ${typeof t}`);if(!I(r)&&!j(r))throw new Error("[@vuelidate/validators]: Validator must be a function or object with $validator parameter");const n=z(r);return n.$message=t,n}function nt(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];const n=z(t);return T(T({},n),{},{$async:!0,$watchTargets:r})}function at(t){return{$validator(r){for(var n=arguments.length,a=new Array(n>1?n-1:0),o=1;o<n;o++)a[o-1]=arguments[o];return e.unref(r).reduce((s,c,l)=>{const u=Object.entries(c).reduce((m,d)=>{let[f,g]=d;const h=t[f]||{},i=Object.entries(h).reduce((p,$)=>{let[v,B]=$;const w=O(B).call(this,g,c,l,...a),R=C(w);if(p.$data[v]=w,p.$data.$invalid=!R||!!p.$data.$invalid,p.$data.$error=p.$data.$invalid,!R){let x=B.$message||"";const S=B.$params||{};typeof x=="function"&&(x=x({$pending:!1,$invalid:!R,$params:S,$model:g,$response:w})),p.$errors.push({$property:f,$message:x,$params:S,$response:w,$model:g,$pending:!1,$validator:v})}return{$valid:p.$valid&&R,$data:p.$data,$errors:p.$errors}},{$valid:!0,$data:{},$errors:[]});return m.$data[f]=i.$data,m.$errors[f]=i.$errors,{$valid:m.$valid&&i.$valid,$data:m.$data,$errors:m.$errors}},{$valid:!0,$data:{},$errors:{}});return{$valid:s.$valid&&u.$valid,$data:s.$data.concat(u.$data),$errors:s.$errors.concat(u.$errors)}},{$valid:!0,$data:[],$errors:[]})},$message:r=>{let{$response:n}=r;return n?n.$errors.map(a=>Object.values(a).map(o=>o.map(s=>s.$message)).reduce((o,s)=>o.concat(s),[])):[]}}}const _=t=>{if(t=e.unref(t),Array.isArray(t))return!!t.length;if(t==null)return!1;if(t===!1)return!0;if(t instanceof Date)return!isNaN(t.getTime());if(typeof t=="object"){for(let r in t)return!0;return!1}return!!String(t).length},K=t=>(t=e.unref(t),Array.isArray(t)?t.length:typeof t=="object"?Object.keys(t).length:String(t).length);function k(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return a=>(a=e.unref(a),!_(a)||r.every(o=>(o.lastIndex=0,o.test(a))))}var Q=Object.freeze({__proto__:null,forEach:at,len:K,normalizeValidatorObject:z,regex:k,req:_,unwrap:e.unref,unwrapNormalizedValidator:O,unwrapValidatorResponse:C,withAsync:nt,withMessage:A,withParams:W}),ot=k(/^[a-zA-Z]*$/),st={$validator:ot,$message:"The value is not alphabetical",$params:{type:"alpha"}},it=k(/^[a-zA-Z0-9]*$/),ct={$validator:it,$message:"The value must be alpha-numeric",$params:{type:"alphaNum"}},lt=k(/^\d*(\.\d+)?$/),ut={$validator:lt,$message:"Value must be numeric",$params:{type:"numeric"}};function dt(t,r){return n=>!_(n)||(!/\s/.test(n)||n instanceof Date)&&+e.unref(t)<=+n&&+e.unref(r)>=+n}function mt(t,r){return{$validator:dt(t,r),$message:n=>{let{$params:a}=n;return`The value must be between ${a.min} and ${a.max}`},$params:{min:t,max:r,type:"between"}}}const pt=/^(?:[A-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9]{2,}(?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i;var ft=k(pt),$t={$validator:ft,$message:"Value is not a valid email address",$params:{type:"email"}};function gt(t){if(!_(t))return!0;if(typeof t!="string")return!1;const r=t.split(".");return r.length===4&&r.every(ht)}const ht=t=>{if(t.length>3||t.length===0||t[0]==="0"&&t!=="0"||!t.match(/^\d+$/))return!1;const r=+t|0;return r>=0&&r<=255};var vt={$validator:gt,$message:"The value is not a valid IP address",$params:{type:"ipAddress"}};function yt(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:":";return r=>{if(t=e.unref(t),!_(r))return!0;if(typeof r!="string")return!1;const n=typeof t=="string"&&t!==""?r.split(t):r.length===12||r.length===16?r.match(/.{2}/g):null;return n!==null&&(n.length===6||n.length===8)&&n.every(_t)}}const _t=t=>t.toLowerCase().match(/^[0-9a-f]{2}$/);function wt(t){return{$validator:yt(t),$message:"The value is not a valid MAC Address",$params:{type:"macAddress"}}}function bt(t){return r=>!_(r)||K(r)<=e.unref(t)}function xt(t){return{$validator:bt(t),$message:r=>{let{$params:n}=r;return`The maximum length allowed is ${n.max}`},$params:{max:t,type:"maxLength"}}}function Et(t){return r=>!_(r)||K(r)>=e.unref(t)}function Pt(t){return{$validator:Et(t),$message:r=>{let{$params:n}=r;return`This field should be at least ${n.min} characters long`},$params:{min:t,type:"minLength"}}}function Ct(t){return typeof t=="string"&&(t=t.trim()),_(t)}var Z={$validator:Ct,$message:"Value is required",$params:{type:"required"}};const se=(t,r)=>t?_(typeof r=="string"?r.trim():r):!0;function kt(t){return function(r,n){if(typeof t!="function")return se(e.unref(t),r);const a=t.call(this,r,n);return se(a,r)}}function Rt(t){return{$validator:kt(t),$message:"The value is required",$params:{type:"requiredIf",prop:t}}}const ie=(t,r)=>t?!0:_(typeof r=="string"?r.trim():r);function Vt(t){return function(r,n){if(typeof t!="function")return ie(e.unref(t),r);const a=t.call(this,r,n);return ie(a,r)}}function Ot(t){return{$validator:Vt(t),$message:"The value is required",$params:{type:"requiredUnless",prop:t}}}function Bt(t){return r=>e.unref(r)===e.unref(t)}function Tt(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"other";return{$validator:Bt(t),$message:n=>`The value must be equal to the ${r} value`,$params:{equalTo:t,otherName:r,type:"sameAs"}}}const jt=/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i;var At=k(jt),St={$validator:At,$message:"The value is not a valid URL address",$params:{type:"url"}};function Nt(t){return function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return t.reduce((o,s)=>C(o)?o:O(s).apply(this,n),!1)}}function Lt(t){return function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return t.reduce(async(o,s)=>{const c=await o;return C(c)?c:O(s).apply(this,n)},Promise.resolve(!1))}}function It(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];const a=r.some(c=>c.$async),o=r.reduce((c,l)=>l.$watchTargets?c.concat(l.$watchTargets):c,[]);let s=()=>!1;return r.length&&(s=a?Lt(r):Nt(r)),{$async:a,$validator:s,$watchTargets:o}}function zt(){return W({type:"or"},A("The value does not match any of the provided validators",It(...arguments)))}function Dt(t){return function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return t.reduce((o,s)=>C(o)?O(s).apply(this,n):o,!0)}}function Mt(t){return function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return t.reduce(async(o,s)=>{const c=await o;return C(c)?O(s).apply(this,n):c},Promise.resolve(!0))}}function qt(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];const a=r.some(c=>c.$async),o=r.reduce((c,l)=>l.$watchTargets?c.concat(l.$watchTargets):c,[]);let s=()=>!1;return r.length&&(s=a?Mt(r):Dt(r)),{$async:a,$validator:s,$watchTargets:o}}function Ft(){return W({type:"and"},A("The value does not match all of the provided validators",qt(...arguments)))}function Ht(t){return function(r,n){if(!_(r))return!0;const a=O(t).call(this,r,n);return rt(a)?a.then(o=>!C(o)):!C(a)}}function Gt(t){return{$validator:Ht(t),$message:"The value does not match the provided validator",$params:{type:"not"}}}function Xt(t){return r=>!_(r)||(!/\s/.test(r)||r instanceof Date)&&+r>=+e.unref(t)}function Ut(t){return{$validator:Xt(t),$message:r=>{let{$params:n}=r;return`The minimum value allowed is ${n.min}`},$params:{min:t,type:"minValue"}}}function Wt(t){return r=>!_(r)||(!/\s/.test(r)||r instanceof Date)&&+r<=+e.unref(t)}var Kt=t=>({$validator:Wt(t),$message:r=>{let{$params:n}=r;return`The maximum value allowed is ${n.max}`},$params:{max:t,type:"maxValue"}}),Qt=k(/(^[0-9]*$)|(^-[0-9]+$)/),Zt={$validator:Qt,$message:"Value is not an integer",$params:{type:"integer"}},Jt=k(/^[-]?\d*(\.\d+)?$/),Yt={$validator:Jt,$message:"Value must be decimal",$params:{type:"decimal"}};function er(t){let{t:r,messagePath:n=o=>{let{$validator:s}=o;return`validations.${s}`},messageParams:a=o=>o}=t;return function(s){let{withArguments:c=!1,messagePath:l=n,messageParams:u=a}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};function m(d){return r(l(d),u(T({model:d.$model,property:d.$property,pending:d.$pending,invalid:d.$invalid,response:d.$response,validator:d.$validator,propertyPath:d.$propertyPath},d.$params)))}return c&&typeof s=="function"?function(){return A(m,s(...arguments))}:A(m,s)}}const $e=Object.freeze(Object.defineProperty({__proto__:null,alpha:st,alphaNum:ct,and:Ft,between:mt,createI18nMessage:er,decimal:Yt,email:$t,helpers:Q,integer:Zt,ipAddress:vt,macAddress:wt,maxLength:xt,maxValue:Kt,minLength:Pt,minValue:Ut,not:Gt,numeric:ut,or:zt,required:Z,requiredIf:Rt,requiredUnless:Ot,sameAs:Tt,url:St},Symbol.toStringTag,{value:"Module"}));function ce(t){return["maxLength","minLength"].includes(t)}function tr(t,r){return{[t]:$e[t](r)}}function rr(t,r,n){return{[t]:Q.withMessage(n,$e[t](r))}}function nr(){return{required:Z}}function ar(t){return{required:Q.withMessage(t,Z)}}function or(t,r){if(ce(t)&&typeof r.message=="string"&&typeof r.value=="number")return rr(t,r.value,r.message);if(ce(t)&&typeof r.message>"u"&&typeof r.value=="number")return tr(t,r.value);if(t==="required"&&typeof r.message=="string")return ar(r.message);if(t==="required"&&typeof r.message>"u")return nr();throw new Error("No valid rule detected")}const sr={key:0,class:"pdap-form-error-message"},ge=e.defineComponent({__name:"PdapForm",props:{error:{default:null},id:{},name:{},schema:{}},emits:["submit"],setup(t,{emit:r}){const n=t,a=r,o=e.ref(n.schema.reduce((d,f)=>{switch(f.type){case b.CHECKBOX:return{...d,[f.name]:String(f.defaultChecked)};case b.TEXT:default:return{...d,[f.name]:f.value}}},{})),s=n.schema.reduce((d,f)=>{const g=Object.entries(f.validators??{}).reduce((h,[i,p])=>({...h,...or(i,p)}),{});return{...d,[f.name]:{...g}}},{}),c=Qe(s,o,{$autoDirty:!1,$lazy:!0}),l=e.ref(n.error);function u(d,f){o.value[d]=f}e.watchEffect(()=>{n.error?l.value=n.error:l.value&&c.value.$errors.length===0?l.value=null:!l.value&&c.value.$errors.length>0&&(l.value="Please update this form to correct the errors")}),e.watchEffect(()=>{console.debug(`PdapForm ${n.name}
|
2
|
-
`,{props:n,values:o,vuelidate:{rules:s,v$:
|
3
|
-
`,"Did you forget to inject some linkData for the Nav component?"));const n=e.reactive({isExpanded:!1,isMobile:!0}),a=e.reactive({"pdap-nav":!0});e.onBeforeMount(()=>{o(),window.addEventListener("resize",o)}),e.onBeforeUnmount(()=>{window.removeEventListener("resize",o)});async function o(){window.innerWidth<=1024?n.isMobile=!0:n.isMobile=!1,await e.nextTick()}async function s(){var
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),X=require("vue-router"),le=e.defineComponent({__name:"PdapButton",props:{intent:{default:"primary"},isLoading:{type:Boolean,default:!1}},setup(t){const r=t,n=e.reactive({"pdap-button":!0,[`pdap-button-${r.intent}`]:!!r.intent,"pdap-button-loading":r.isLoading});return(a,o)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(n)},[e.renderSlot(a.$slots,"default")],2))}});const U=e.defineComponent({__name:"FlexContainer",props:{alignment:{default:"start"},component:{default:"div"}},setup(t){const r=t,n=e.reactive({"pdap-flex-container":!0,[`pdap-flex-container-${r.alignment}`]:!0});return(a,o)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.component),{class:e.normalizeClass(n)},{default:e.withCtx(()=>[e.renderSlot(a.$slots,"default")]),_:3},8,["class"]))}});const ke={class:"pdap-footer"},Re={class:"pdap-footer-social-links"},Ve=["href"],Oe=e.createElementVNode("p",{class:"pdap-footer-copyright"},[e.createTextVNode(" © 2023 Police Data Accessibility Project"),e.createElementVNode("br")],-1),Be=e.createElementVNode("p",{class:"pdap-footer-copyright"},[e.createTextVNode(" PDAP is a non-profit. EIN: 85-4207132. "),e.createElementVNode("a",{href:"https://docs.pdap.io/meta/policy/pdap-privacy-policy",alt:"Privacy Policy"}," Privacy Policy"),e.createTextVNode(". "),e.createElementVNode("a",{href:"mailto:contact@pdap.io"},"contact@pdap.io")],-1),je={class:"pdap-footer-widget-links"},Te=e.createElementVNode("a",{href:"https://www.guidestar.org/profile/85-4207132",target:"_blank"},[e.createElementVNode("img",{src:"https://widgets.guidestar.org/gximage2?o=9973356&l=v4"})],-1),Ae=["href"],Se=["src"],Ne=["src"],Le=e.defineComponent({__name:"PdapFooter",props:{logoImageSrc:{default:"node_modules/pdap-design-system/dist/images/acronym.svg"},logoImageAnchorPath:{default:"/"}},setup(t){const r=t,n=e.inject("footerLinks",[{href:"https://github.com/orgs/Police-Data-Accessibility-Project",text:"Github"},{href:"https://discord.gg/wMqex8nKZJ",text:"Discord"},{href:"https://www.linkedin.com/company/pdap",text:"LinkedIn"},{path:"/jobs",text:"Jobs"}]),a=r.logoImageAnchorPath.startsWith("/");return(o,s)=>{const l=e.resolveComponent("router-link");return e.openBlock(),e.createElementBlock("footer",ke,[e.createVNode(U,{alignment:"center"},{default:e.withCtx(()=>[e.createElementVNode("ul",Re,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),c=>(e.openBlock(),e.createElementBlock("li",{key:c.text,class:"pdap-footer-link-container"},[c.href?(e.openBlock(),e.createElementBlock("a",{key:0,class:"pdap-footer-social-link",href:c.href,target:"_blank",referrerpolicy:"no-referrer"},e.toDisplayString(c.text),9,Ve)):e.createCommentVNode("",!0),c.path?(e.openBlock(),e.createBlock(l,{key:1,"active-class":"pdap-footer-social-link-current","exact-active-class":"pdap-footer-social-link-current-exact",class:"pdap-footer-social-link",to:c.path},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.text),1)]),_:2},1032,["to"])):e.createCommentVNode("",!0)]))),128))]),Oe,Be,e.createElementVNode("div",je,[Te,e.unref(a)?(e.openBlock(),e.createBlock(l,{key:1,to:o.logoImageAnchorPath,class:"pdap-footer-logo"},{default:e.withCtx(()=>[e.createElementVNode("img",{src:o.logoImageSrc,loading:"lazy",width:"250",alt:"Police Data Accessibility Project Logo"},null,8,Ne)]),_:1},8,["to"])):(e.openBlock(),e.createElementBlock("a",{key:0,href:o.logoImageAnchorPath,class:"pdap-footer-logo"},[e.createElementVNode("img",{src:o.logoImageSrc,loading:"lazy",width:"250",alt:"Police Data Accessibility Project Logo"},null,8,Se)],8,Ae))])]),_:1})])}}});function Y(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);r&&(a=a.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,a)}return n}function P(t){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?Y(Object(n),!0).forEach(function(a){Ie(t,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Y(Object(n)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(n,a))})}return t}function Ie(t,r,n){return r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function ee(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return Object.keys(t).reduce((n,a)=>(r.includes(a)||(n[a]=e.unref(t[a])),n),{})}function L(t){return typeof t=="function"}function ze(t){return e.isReactive(t)||e.isReadonly(t)}function ue(t,r,n){let a=t;const o=r.split(".");for(let s=0;s<o.length;s++){if(!a[o[s]])return n;a=a[o[s]]}return a}function H(t,r,n){return e.computed(()=>t.some(a=>ue(r,a,{[n]:!1})[n]))}function te(t,r,n){return e.computed(()=>t.reduce((a,o)=>{const s=ue(r,o,{[n]:!1})[n]||[];return a.concat(s)},[]))}function de(t,r,n,a){return t.call(a,e.unref(r),e.unref(n),a)}function me(t){return t.$valid!==void 0?!t.$valid:!t}function De(t,r,n,a,o,s,l){let{$lazy:c,$rewardEarly:u}=o,d=arguments.length>7&&arguments[7]!==void 0?arguments[7]:[],m=arguments.length>8?arguments[8]:void 0,f=arguments.length>9?arguments[9]:void 0,g=arguments.length>10?arguments[10]:void 0;const h=e.ref(!!a.value),i=e.ref(0);n.value=!1;const p=e.watch([r,a].concat(d,g),()=>{if(c&&!a.value||u&&!f.value&&!n.value)return;let $;try{$=de(t,r,m,l)}catch(v){$=Promise.reject(v)}i.value++,n.value=!!i.value,h.value=!1,Promise.resolve($).then(v=>{i.value--,n.value=!!i.value,s.value=v,h.value=me(v)}).catch(v=>{i.value--,n.value=!!i.value,s.value=v,h.value=!0})},{immediate:!0,deep:typeof r=="object"});return{$invalid:h,$unwatch:p}}function Me(t,r,n,a,o,s,l,c){let{$lazy:u,$rewardEarly:d}=a;const m=()=>({}),f=e.computed(()=>{if(u&&!n.value||d&&!c.value)return!1;let g=!0;try{const h=de(t,r,l,s);o.value=h,g=me(h)}catch(h){o.value=h}return g});return{$unwatch:m,$invalid:f}}function qe(t,r,n,a,o,s,l,c,u,d,m){const f=e.ref(!1),g=t.$params||{},h=e.ref(null);let i,p;t.$async?{$invalid:i,$unwatch:p}=De(t.$validator,r,f,n,a,h,o,t.$watchTargets,u,d,m):{$invalid:i,$unwatch:p}=Me(t.$validator,r,n,a,h,o,u,d);const $=t.$message;return{$message:L($)?e.computed(()=>$(ee({$pending:f,$invalid:i,$params:ee(g),$model:r,$response:h,$validator:s,$propertyPath:c,$property:l}))):$||"",$params:g,$pending:f,$invalid:i,$response:h,$unwatch:p}}function Fe(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const r=e.unref(t),n=Object.keys(r),a={},o={},s={};let l=null;return n.forEach(c=>{const u=r[c];switch(!0){case L(u.$validator):a[c]=u;break;case L(u):a[c]={$validator:u};break;case c==="$validationGroups":l=u;break;case c.startsWith("$"):s[c]=u;break;default:o[c]=u}}),{rules:a,nestedValidators:o,config:s,validationGroups:l}}const He="__root";function Ge(t,r,n,a,o,s,l,c,u){const d=Object.keys(t),m=a.get(o,t),f=e.ref(!1),g=e.ref(!1),h=e.ref(0);if(m){if(!m.$partial)return m;m.$unwatch(),f.value=m.$dirty.value}const i={$dirty:f,$path:o,$touch:()=>{f.value||(f.value=!0)},$reset:()=>{f.value&&(f.value=!1)},$commit:()=>{}};return d.length?(d.forEach(p=>{i[p]=qe(t[p],r,i.$dirty,s,l,p,n,o,u,g,h)}),i.$externalResults=e.computed(()=>c.value?[].concat(c.value).map((p,$)=>({$propertyPath:o,$property:n,$validator:"$externalResults",$uid:`${o}-externalResult-${$}`,$message:p,$params:{},$response:null,$pending:!1})):[]),i.$invalid=e.computed(()=>{const p=d.some($=>e.unref(i[$].$invalid));return g.value=p,!!i.$externalResults.value.length||p}),i.$pending=e.computed(()=>d.some(p=>e.unref(i[p].$pending))),i.$error=e.computed(()=>i.$dirty.value?i.$pending.value||i.$invalid.value:!1),i.$silentErrors=e.computed(()=>d.filter(p=>e.unref(i[p].$invalid)).map(p=>{const $=i[p];return e.reactive({$propertyPath:o,$property:n,$validator:p,$uid:`${o}-${p}`,$message:$.$message,$params:$.$params,$response:$.$response,$pending:$.$pending})}).concat(i.$externalResults.value)),i.$errors=e.computed(()=>i.$dirty.value?i.$silentErrors.value:[]),i.$unwatch=()=>d.forEach(p=>{i[p].$unwatch()}),i.$commit=()=>{g.value=!0,h.value=Date.now()},a.set(o,t,i),i):(m&&a.set(o,t,i),i)}function Xe(t,r,n,a,o,s,l){const c=Object.keys(t);return c.length?c.reduce((u,d)=>(u[d]=G({validations:t[d],state:r,key:d,parentKey:n,resultsCache:a,globalConfig:o,instance:s,externalResults:l}),u),{}):{}}function Ue(t,r,n){const a=e.computed(()=>[r,n].filter(i=>i).reduce((i,p)=>i.concat(Object.values(e.unref(p))),[])),o=e.computed({get(){return t.$dirty.value||(a.value.length?a.value.every(i=>i.$dirty):!1)},set(i){t.$dirty.value=i}}),s=e.computed(()=>{const i=e.unref(t.$silentErrors)||[],p=a.value.filter($=>(e.unref($).$silentErrors||[]).length).reduce(($,v)=>$.concat(...v.$silentErrors),[]);return i.concat(p)}),l=e.computed(()=>{const i=e.unref(t.$errors)||[],p=a.value.filter($=>(e.unref($).$errors||[]).length).reduce(($,v)=>$.concat(...v.$errors),[]);return i.concat(p)}),c=e.computed(()=>a.value.some(i=>i.$invalid)||e.unref(t.$invalid)||!1),u=e.computed(()=>a.value.some(i=>e.unref(i.$pending))||e.unref(t.$pending)||!1),d=e.computed(()=>a.value.some(i=>i.$dirty)||a.value.some(i=>i.$anyDirty)||o.value),m=e.computed(()=>o.value?u.value||c.value:!1),f=()=>{t.$touch(),a.value.forEach(i=>{i.$touch()})},g=()=>{t.$commit(),a.value.forEach(i=>{i.$commit()})},h=()=>{t.$reset(),a.value.forEach(i=>{i.$reset()})};return a.value.length&&a.value.every(i=>i.$dirty)&&f(),{$dirty:o,$errors:l,$invalid:c,$anyDirty:d,$error:m,$pending:u,$touch:f,$reset:h,$silentErrors:s,$commit:g}}function G(t){let{validations:r,state:n,key:a,parentKey:o,childResults:s,resultsCache:l,globalConfig:c={},instance:u,externalResults:d}=t;const m=o?`${o}.${a}`:a,{rules:f,nestedValidators:g,config:h,validationGroups:i}=Fe(r),p=P(P({},c),h),$=a?e.computed(()=>{const y=e.unref(n);return y?e.unref(y[a]):void 0}):n,v=P({},e.unref(d)||{}),B=e.computed(()=>{const y=e.unref(d);return a?y?e.unref(y[a]):void 0:y}),D=Ge(f,$,a,l,m,p,u,B,n),w=Xe(g,$,m,l,p,u,B),R={};i&&Object.entries(i).forEach(y=>{let[V,E]=y;R[V]={$invalid:H(E,w,"$invalid"),$error:H(E,w,"$error"),$pending:H(E,w,"$pending"),$errors:te(E,w,"$errors"),$silentErrors:te(E,w,"$silentErrors")}});const{$dirty:x,$errors:S,$invalid:M,$anyDirty:ye,$error:_e,$pending:q,$touch:F,$reset:we,$silentErrors:be,$commit:J}=Ue(D,w,s),xe=a?e.computed({get:()=>e.unref($),set:y=>{x.value=!0;const V=e.unref(n),E=e.unref(d);E&&(E[a]=v[a]),e.isRef(V[a])?V[a].value=y:V[a]=y}}):null;a&&p.$autoDirty&&e.watch($,()=>{x.value||F();const y=e.unref(d);y&&(y[a]=v[a])},{flush:"sync"});async function Ee(){return F(),p.$rewardEarly&&(J(),await e.nextTick()),await e.nextTick(),new Promise(y=>{if(!q.value)return y(!M.value);const V=e.watch(q,()=>{y(!M.value),V()})})}function Pe(y){return(s.value||{})[y]}function Ce(){e.isRef(d)?d.value=v:Object.keys(v).length===0?Object.keys(d).forEach(y=>{delete d[y]}):Object.assign(d,v)}return e.reactive(P(P(P({},D),{},{$model:xe,$dirty:x,$error:_e,$errors:S,$invalid:M,$anyDirty:ye,$pending:q,$touch:F,$reset:we,$path:m||He,$silentErrors:be,$validate:Ee,$commit:J},s&&{$getResultsForChild:Pe,$clearExternalResults:Ce,$validationGroups:R}),w))}class We{constructor(){this.storage=new Map}set(r,n,a){this.storage.set(r,{rules:n,result:a})}checkRulesValidity(r,n,a){const o=Object.keys(a),s=Object.keys(n);return s.length!==o.length||!s.every(c=>o.includes(c))?!1:s.every(c=>n[c].$params?Object.keys(n[c].$params).every(u=>e.unref(a[c].$params[u])===e.unref(n[c].$params[u])):!0)}get(r,n){const a=this.storage.get(r);if(!a)return;const{rules:o,result:s}=a,l=this.checkRulesValidity(r,n,o),c=s.$unwatch?s.$unwatch:()=>({});return l?s:{$dirty:s.$dirty,$partial:!0,$unwatch:c}}}const N={COLLECT_ALL:!0,COLLECT_NONE:!1},re=Symbol("vuelidate#injectChildResults"),ne=Symbol("vuelidate#removeChildResults");function Ke(t){let{$scope:r,instance:n}=t;const a={},o=e.ref([]),s=e.computed(()=>o.value.reduce((m,f)=>(m[f]=e.unref(a[f]),m),{}));function l(m,f){let{$registerAs:g,$scope:h,$stopPropagation:i}=f;i||r===N.COLLECT_NONE||h===N.COLLECT_NONE||r!==N.COLLECT_ALL&&r!==h||(a[g]=m,o.value.push(g))}n.__vuelidateInjectInstances=[].concat(n.__vuelidateInjectInstances||[],l);function c(m){o.value=o.value.filter(f=>f!==m),delete a[m]}n.__vuelidateRemoveInstances=[].concat(n.__vuelidateRemoveInstances||[],c);const u=e.inject(re,[]);e.provide(re,n.__vuelidateInjectInstances);const d=e.inject(ne,[]);return e.provide(ne,n.__vuelidateRemoveInstances),{childResults:s,sendValidationResultsToParent:u,removeValidationResultsFromParent:d}}function pe(t){return new Proxy(t,{get(r,n){return typeof r[n]=="object"?pe(r[n]):e.computed(()=>r[n])}})}let ae=0;function Qe(t,r){var n;let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};arguments.length===1&&(a=t,t=void 0,r=void 0);let{$registerAs:o,$scope:s=N.COLLECT_ALL,$stopPropagation:l,$externalResults:c,currentVueInstance:u}=a;const d=u||((n=e.getCurrentInstance())===null||n===void 0?void 0:n.proxy),m=d?d.$options:{};o||(ae+=1,o=`_vuelidate_${ae}`);const f=e.ref({}),g=new We,{childResults:h,sendValidationResultsToParent:i,removeValidationResultsFromParent:p}=d?Ke({$scope:s,instance:d}):{childResults:e.ref({})};if(!t&&m.validations){const $=m.validations;r=e.ref({}),e.onBeforeMount(()=>{r.value=d,e.watch(()=>L($)?$.call(r.value,new pe(r.value)):$,v=>{f.value=G({validations:v,state:r,childResults:h,resultsCache:g,globalConfig:a,instance:d,externalResults:c||d.vuelidateExternalResults})},{immediate:!0})}),a=m.validationsConfig||a}else{const $=e.isRef(t)||ze(t)?t:e.reactive(t||{});e.watch($,v=>{f.value=G({validations:v,state:r,childResults:h,resultsCache:g,globalConfig:a,instance:d??{},externalResults:c})},{immediate:!0})}return d&&(i.forEach($=>$(f,{$registerAs:o,$scope:s,$stopPropagation:l})),e.onBeforeUnmount(()=>p.forEach($=>$(o)))),e.computed(()=>P(P({},e.unref(f.value)),h.value))}var b=(t=>(t.CHECKBOX="checkbox",t.TEXT="text",t))(b||{});const Ze=["id","name","placeholder","value"],Je=["id","name","checked","value"],Ye=["id"],et=["for"],fe=e.defineComponent({__name:"PdapInput",props:{error:{},id:{},label:{},name:{},placeholder:{},type:{},value:{},defaultChecked:{type:Boolean}},emits:["change","input"],setup(t,{emit:r}){const n=t,a=r,o=()=>{l.value=!l.value,a("change",l.value.toString())},s=u=>{a("input",u.target.value)},l=e.ref(n.defaultChecked),c=e.computed(()=>`pdap-${n.name}-input-error`);return(u,d)=>{var m;return e.openBlock(),e.createBlock(e.unref(he),{class:e.normalizeClass({"pdap-input":!0,"pdap-input-error":Number((m=u.error)==null?void 0:m.length)>=1})},{default:e.withCtx(()=>[u.type===e.unref(b).TEXT?(e.openBlock(),e.createElementBlock("input",e.mergeProps({key:0,id:u.id,type:"text",name:u.name,placeholder:u.placeholder,value:u.value},u.$attrs,{onInput:s}),null,16,Ze)):u.type===e.unref(b).CHECKBOX?(e.openBlock(),e.createElementBlock("input",e.mergeProps({key:1,id:u.id,class:"pdap-input-checkbox",name:u.name,checked:l.value,type:"checkbox",value:u.value},u.$attrs,{onChange:o}),null,16,Je)):e.createCommentVNode("",!0),u.error?(e.openBlock(),e.createElementBlock("div",{key:2,id:c.value,class:"pdap-input-error-message"},e.toDisplayString(u.error),9,Ye)):e.createCommentVNode("",!0),e.createElementVNode("label",{class:"pdap-input-label",for:u.id},e.toDisplayString(u.label),9,et)]),_:1},8,["class"])}}});function oe(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);r&&(a=a.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,a)}return n}function j(t){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?oe(Object(n),!0).forEach(function(a){tt(t,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):oe(Object(n)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(n,a))})}return t}function tt(t,r,n){return r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function T(t){return typeof t=="function"}function I(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function z(t){return T(t.$validator)?j({},t):{$validator:t}}function rt(t){return I(t)&&T(t.then)}function C(t){return typeof t=="object"?t.$valid:t}function O(t){return t.$validator||t}function W(t,r){if(!I(t))throw new Error(`[@vuelidate/validators]: First parameter to "withParams" should be an object, provided ${typeof t}`);if(!I(r)&&!T(r))throw new Error("[@vuelidate/validators]: Validator must be a function or object with $validator parameter");const n=z(r);return n.$params=j(j({},n.$params||{}),t),n}function A(t,r){if(!T(t)&&typeof e.unref(t)!="string")throw new Error(`[@vuelidate/validators]: First parameter to "withMessage" should be string or a function returning a string, provided ${typeof t}`);if(!I(r)&&!T(r))throw new Error("[@vuelidate/validators]: Validator must be a function or object with $validator parameter");const n=z(r);return n.$message=t,n}function nt(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];const n=z(t);return j(j({},n),{},{$async:!0,$watchTargets:r})}function at(t){return{$validator(r){for(var n=arguments.length,a=new Array(n>1?n-1:0),o=1;o<n;o++)a[o-1]=arguments[o];return e.unref(r).reduce((s,l,c)=>{const u=Object.entries(l).reduce((d,m)=>{let[f,g]=m;const h=t[f]||{},i=Object.entries(h).reduce((p,$)=>{let[v,B]=$;const w=O(B).call(this,g,l,c,...a),R=C(w);if(p.$data[v]=w,p.$data.$invalid=!R||!!p.$data.$invalid,p.$data.$error=p.$data.$invalid,!R){let x=B.$message||"";const S=B.$params||{};typeof x=="function"&&(x=x({$pending:!1,$invalid:!R,$params:S,$model:g,$response:w})),p.$errors.push({$property:f,$message:x,$params:S,$response:w,$model:g,$pending:!1,$validator:v})}return{$valid:p.$valid&&R,$data:p.$data,$errors:p.$errors}},{$valid:!0,$data:{},$errors:[]});return d.$data[f]=i.$data,d.$errors[f]=i.$errors,{$valid:d.$valid&&i.$valid,$data:d.$data,$errors:d.$errors}},{$valid:!0,$data:{},$errors:{}});return{$valid:s.$valid&&u.$valid,$data:s.$data.concat(u.$data),$errors:s.$errors.concat(u.$errors)}},{$valid:!0,$data:[],$errors:[]})},$message:r=>{let{$response:n}=r;return n?n.$errors.map(a=>Object.values(a).map(o=>o.map(s=>s.$message)).reduce((o,s)=>o.concat(s),[])):[]}}}const _=t=>{if(t=e.unref(t),Array.isArray(t))return!!t.length;if(t==null)return!1;if(t===!1)return!0;if(t instanceof Date)return!isNaN(t.getTime());if(typeof t=="object"){for(let r in t)return!0;return!1}return!!String(t).length},K=t=>(t=e.unref(t),Array.isArray(t)?t.length:typeof t=="object"?Object.keys(t).length:String(t).length);function k(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return a=>(a=e.unref(a),!_(a)||r.every(o=>(o.lastIndex=0,o.test(a))))}var Q=Object.freeze({__proto__:null,forEach:at,len:K,normalizeValidatorObject:z,regex:k,req:_,unwrap:e.unref,unwrapNormalizedValidator:O,unwrapValidatorResponse:C,withAsync:nt,withMessage:A,withParams:W}),ot=k(/^[a-zA-Z]*$/),st={$validator:ot,$message:"The value is not alphabetical",$params:{type:"alpha"}},it=k(/^[a-zA-Z0-9]*$/),ct={$validator:it,$message:"The value must be alpha-numeric",$params:{type:"alphaNum"}},lt=k(/^\d*(\.\d+)?$/),ut={$validator:lt,$message:"Value must be numeric",$params:{type:"numeric"}};function dt(t,r){return n=>!_(n)||(!/\s/.test(n)||n instanceof Date)&&+e.unref(t)<=+n&&+e.unref(r)>=+n}function mt(t,r){return{$validator:dt(t,r),$message:n=>{let{$params:a}=n;return`The value must be between ${a.min} and ${a.max}`},$params:{min:t,max:r,type:"between"}}}const pt=/^(?:[A-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9]{2,}(?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i;var ft=k(pt),$t={$validator:ft,$message:"Value is not a valid email address",$params:{type:"email"}};function gt(t){if(!_(t))return!0;if(typeof t!="string")return!1;const r=t.split(".");return r.length===4&&r.every(ht)}const ht=t=>{if(t.length>3||t.length===0||t[0]==="0"&&t!=="0"||!t.match(/^\d+$/))return!1;const r=+t|0;return r>=0&&r<=255};var vt={$validator:gt,$message:"The value is not a valid IP address",$params:{type:"ipAddress"}};function yt(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:":";return r=>{if(t=e.unref(t),!_(r))return!0;if(typeof r!="string")return!1;const n=typeof t=="string"&&t!==""?r.split(t):r.length===12||r.length===16?r.match(/.{2}/g):null;return n!==null&&(n.length===6||n.length===8)&&n.every(_t)}}const _t=t=>t.toLowerCase().match(/^[0-9a-f]{2}$/);function wt(t){return{$validator:yt(t),$message:"The value is not a valid MAC Address",$params:{type:"macAddress"}}}function bt(t){return r=>!_(r)||K(r)<=e.unref(t)}function xt(t){return{$validator:bt(t),$message:r=>{let{$params:n}=r;return`The maximum length allowed is ${n.max}`},$params:{max:t,type:"maxLength"}}}function Et(t){return r=>!_(r)||K(r)>=e.unref(t)}function Pt(t){return{$validator:Et(t),$message:r=>{let{$params:n}=r;return`This field should be at least ${n.min} characters long`},$params:{min:t,type:"minLength"}}}function Ct(t){return typeof t=="string"&&(t=t.trim()),_(t)}var Z={$validator:Ct,$message:"Value is required",$params:{type:"required"}};const se=(t,r)=>t?_(typeof r=="string"?r.trim():r):!0;function kt(t){return function(r,n){if(typeof t!="function")return se(e.unref(t),r);const a=t.call(this,r,n);return se(a,r)}}function Rt(t){return{$validator:kt(t),$message:"The value is required",$params:{type:"requiredIf",prop:t}}}const ie=(t,r)=>t?!0:_(typeof r=="string"?r.trim():r);function Vt(t){return function(r,n){if(typeof t!="function")return ie(e.unref(t),r);const a=t.call(this,r,n);return ie(a,r)}}function Ot(t){return{$validator:Vt(t),$message:"The value is required",$params:{type:"requiredUnless",prop:t}}}function Bt(t){return r=>e.unref(r)===e.unref(t)}function jt(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"other";return{$validator:Bt(t),$message:n=>`The value must be equal to the ${r} value`,$params:{equalTo:t,otherName:r,type:"sameAs"}}}const Tt=/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i;var At=k(Tt),St={$validator:At,$message:"The value is not a valid URL address",$params:{type:"url"}};function Nt(t){return function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return t.reduce((o,s)=>C(o)?o:O(s).apply(this,n),!1)}}function Lt(t){return function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return t.reduce(async(o,s)=>{const l=await o;return C(l)?l:O(s).apply(this,n)},Promise.resolve(!1))}}function It(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];const a=r.some(l=>l.$async),o=r.reduce((l,c)=>c.$watchTargets?l.concat(c.$watchTargets):l,[]);let s=()=>!1;return r.length&&(s=a?Lt(r):Nt(r)),{$async:a,$validator:s,$watchTargets:o}}function zt(){return W({type:"or"},A("The value does not match any of the provided validators",It(...arguments)))}function Dt(t){return function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return t.reduce((o,s)=>C(o)?O(s).apply(this,n):o,!0)}}function Mt(t){return function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return t.reduce(async(o,s)=>{const l=await o;return C(l)?O(s).apply(this,n):l},Promise.resolve(!0))}}function qt(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];const a=r.some(l=>l.$async),o=r.reduce((l,c)=>c.$watchTargets?l.concat(c.$watchTargets):l,[]);let s=()=>!1;return r.length&&(s=a?Mt(r):Dt(r)),{$async:a,$validator:s,$watchTargets:o}}function Ft(){return W({type:"and"},A("The value does not match all of the provided validators",qt(...arguments)))}function Ht(t){return function(r,n){if(!_(r))return!0;const a=O(t).call(this,r,n);return rt(a)?a.then(o=>!C(o)):!C(a)}}function Gt(t){return{$validator:Ht(t),$message:"The value does not match the provided validator",$params:{type:"not"}}}function Xt(t){return r=>!_(r)||(!/\s/.test(r)||r instanceof Date)&&+r>=+e.unref(t)}function Ut(t){return{$validator:Xt(t),$message:r=>{let{$params:n}=r;return`The minimum value allowed is ${n.min}`},$params:{min:t,type:"minValue"}}}function Wt(t){return r=>!_(r)||(!/\s/.test(r)||r instanceof Date)&&+r<=+e.unref(t)}var Kt=t=>({$validator:Wt(t),$message:r=>{let{$params:n}=r;return`The maximum value allowed is ${n.max}`},$params:{max:t,type:"maxValue"}}),Qt=k(/(^[0-9]*$)|(^-[0-9]+$)/),Zt={$validator:Qt,$message:"Value is not an integer",$params:{type:"integer"}},Jt=k(/^[-]?\d*(\.\d+)?$/),Yt={$validator:Jt,$message:"Value must be decimal",$params:{type:"decimal"}};function er(t){let{t:r,messagePath:n=o=>{let{$validator:s}=o;return`validations.${s}`},messageParams:a=o=>o}=t;return function(s){let{withArguments:l=!1,messagePath:c=n,messageParams:u=a}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};function d(m){return r(c(m),u(j({model:m.$model,property:m.$property,pending:m.$pending,invalid:m.$invalid,response:m.$response,validator:m.$validator,propertyPath:m.$propertyPath},m.$params)))}return l&&typeof s=="function"?function(){return A(d,s(...arguments))}:A(d,s)}}const $e=Object.freeze(Object.defineProperty({__proto__:null,alpha:st,alphaNum:ct,and:Ft,between:mt,createI18nMessage:er,decimal:Yt,email:$t,helpers:Q,integer:Zt,ipAddress:vt,macAddress:wt,maxLength:xt,maxValue:Kt,minLength:Pt,minValue:Ut,not:Gt,numeric:ut,or:zt,required:Z,requiredIf:Rt,requiredUnless:Ot,sameAs:jt,url:St},Symbol.toStringTag,{value:"Module"}));function ce(t){return["maxLength","minLength"].includes(t)}function tr(t,r){return{[t]:$e[t](r)}}function rr(t,r,n){return{[t]:Q.withMessage(n,$e[t](r))}}function nr(){return{required:Z}}function ar(t){return{required:Q.withMessage(t,Z)}}function or(t,r){if(ce(t)&&typeof r.message=="string"&&typeof r.value=="number")return rr(t,r.value,r.message);if(ce(t)&&typeof r.message>"u"&&typeof r.value=="number")return tr(t,r.value);if(t==="required"&&typeof r.message=="string")return ar(r.message);if(t==="required"&&typeof r.message>"u")return nr();throw new Error("No valid rule detected")}const sr={key:0,class:"pdap-form-error-message"},ge=e.defineComponent({__name:"PdapForm",props:{error:{default:null},id:{},name:{},schema:{}},emits:["submit"],setup(t,{emit:r}){const n=t,a=r,o=e.ref(n.schema.reduce((m,f)=>{switch(f.type){case b.CHECKBOX:return{...m,[f.name]:String(f.defaultChecked)};case b.TEXT:default:return{...m,[f.name]:f.value}}},{})),s=n.schema.reduce((m,f)=>{const g=Object.entries(f.validators??{}).reduce((h,[i,p])=>({...h,...or(i,p)}),{});return{...m,[f.name]:{...g}}},{}),l=Qe(s,o,{$autoDirty:!1,$lazy:!0}),c=e.ref(n.error);function u(m,f){o.value[m]=f}e.watchEffect(()=>{n.error?c.value=n.error:c.value&&l.value.$errors.length===0?c.value=null:!c.value&&l.value.$errors.length>0&&(c.value="Please update this form to correct the errors")}),e.watchEffect(()=>{console.debug(`PdapForm ${n.name}
|
2
|
+
`,{errorMessage:c.value,props:n,values:o,vuelidate:{rules:s,v$:l}})});async function d(m){if(await l.value.$validate()){a("submit",{...o.value}),l.value.$reset(),m.target.reset(),o.value=Object.entries(o.value).reduce((h,[i,p])=>({...h,[i]:["true","false"].includes(p)?p:""}),{});return}}return(m,f)=>(e.openBlock(),e.createElementBlock("form",{class:"pdap-form",onSubmit:f[0]||(f[0]=e.withModifiers(g=>d(g),["prevent"]))},[typeof c.value=="string"?(e.openBlock(),e.createElementBlock("div",sr,e.toDisplayString(c.value),1)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.schema,g=>{var h,i,p,$;return e.openBlock(),e.createBlock(fe,e.mergeProps((delete g.validators,g),{key:g.name,error:(h=e.unref(l)[g.name])!=null&&h.$error?($=(p=(i=e.unref(l)[g.name])==null?void 0:i.$errors)==null?void 0:p[0])==null?void 0:$.$message:"",value:o.value[g.name],onChange:v=>g.type!==e.unref(b).TEXT?u(g.name,v):void 0,onInput:v=>g.type===e.unref(b).TEXT?u(g.name,v):void 0}),null,16,["error","value","onChange","onInput"])}),128)),e.renderSlot(m.$slots,"default")],32))}});const he=e.defineComponent({__name:"GridContainer",props:{columns:{default:"auto"},component:{default:"div"},rows:{default:"auto"},templateColumns:{},templateRows:{}},setup(t){const r=t,n=e.reactive({"pdap-grid-container":!0,[`pdap-grid-container-column-${r.columns}`]:r.columns!=="auto"}),a=r.templateRows||typeof r.rows=="number",o=r.templateRows??`repeat(${r.rows}, minmax(0, 1fr))`,s=e.reactive({...a&&{gridTemplateRows:o},...r.templateColumns&&{gridTemplateColumns:r.templateColumns}});return(l,c)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.component),{class:e.normalizeClass(n),style:e.normalizeStyle(s)},{default:e.withCtx(()=>[e.renderSlot(l.$slots,"default")]),_:3},8,["class","style"]))}});const ir=e.defineComponent({__name:"GridItem",props:{component:{default:"div"},spanColumn:{default:1},spanRow:{default:1}},setup(t){const r=t,n=e.reactive({"pdap-grid-item":!0,[`pdap-grid-item-span-column-${r.spanColumn}`]:r.spanColumn>1}),a=e.reactive({...r.spanRow>1&&{gridRow:`span ${r.spanRow} / span ${r.spanRow}`}});return(o,s)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.component),{class:e.normalizeClass(n),style:e.normalizeStyle(a)},{default:e.withCtx(()=>[e.renderSlot(o.$slots,"default")]),_:3},8,["class","style"]))}});const cr=e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512"},[e.createElementVNode("path",{d:"M0 96C0 78.3 14.3 64 32 64H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"})],-1),lr=[cr],ur=["aria-expanded"],dr=["href"],ve=e.defineComponent({__name:"PdapNav",props:{topPosition:{}},setup(t){let r=e.inject("navLinks");typeof r>"u"&&(r=[],console.error(`Hey, PDAP developer
|
3
|
+
`,"Did you forget to inject some linkData for the Nav component?"));const n=e.reactive({isExpanded:!1,isMobile:!0}),a=e.reactive({"pdap-nav":!0});e.onBeforeMount(()=>{o(),window.addEventListener("resize",o)}),e.onBeforeUnmount(()=>{window.removeEventListener("resize",o)});async function o(){window.innerWidth<=1024?n.isMobile=!0:n.isMobile=!1,await e.nextTick()}async function s(){var c,u;const l=document.querySelector("body");!n.isExpanded&&n.isMobile?(n.isExpanded=!0,l!=null&&l.classList.contains("lock-scroll")||(c=document.querySelector("body"))==null||c.classList.add("lock-scroll")):n.isExpanded&&n.isMobile&&(n.isExpanded=!1,(u=document.querySelector("body"))==null||u.classList.remove("lock-scroll")),await e.nextTick()}return(l,c)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{"aria-controls":"nav",class:"pdap-nav-open-button",role:"button",onClick:s},lr),e.createElementVNode("nav",{id:"nav","aria-expanded":n.isMobile&&n.isExpanded||!n.isMobile,class:e.normalizeClass(a),style:e.normalizeStyle(n.isMobile?{top:`${l.topPosition}px`}:{})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),u=>(e.openBlock(),e.createElementBlock("li",{key:u.text,class:"pdap-nav-link-container"},[u.href?(e.openBlock(),e.createElementBlock("a",{key:0,class:"pdap-nav-link",href:u.href,target:"_blank",referrerpolicy:"no-referrer",onClick:s},e.toDisplayString(u.text),9,dr)):e.createCommentVNode("",!0),u.path?(e.openBlock(),e.createBlock(e.unref(X.RouterLink),{key:1,"active-class":"pdap-nav-link-current","exact-active-class":"pdap-nav-link-current-exact",class:"pdap-nav-link",to:u.path,onClick:s},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.text),1)]),_:2},1032,["to"])):e.createCommentVNode("",!0)]))),128))],14,ur)],64))}});const mr=["href"],pr=["src"],fr=["src"],$r=e.defineComponent({__name:"PdapHeader",props:{logoImageSrc:{default:"node_modules/pdap-design-system/dist/images/lockup.svg"},logoImageAnchorPath:{default:"/"}},setup(t){const r=t,n=e.ref(),a=e.ref(null),o=r.logoImageAnchorPath.startsWith("/");e.onMounted(()=>{s(),window.addEventListener("resize",s)}),e.onBeforeUnmount(()=>{window.removeEventListener("resize",s)});function s(){a.value&&(n.value=a.value.offsetHeight)}return(l,c)=>(e.openBlock(),e.createElementBlock("header",{ref_key:"el",ref:a,class:"pdap-header"},[e.unref(o)?(e.openBlock(),e.createBlock(e.unref(X.RouterLink),{key:1,to:l.logoImageAnchorPath,class:"logo"},{default:e.withCtx(()=>[e.createElementVNode("img",{src:l.logoImageSrc,loading:"lazy",width:"250",alt:"Police Data Accessibility Project Logo"},null,8,fr)]),_:1},8,["to"])):(e.openBlock(),e.createElementBlock("a",{key:0,href:l.logoImageAnchorPath,class:"logo"},[e.createElementVNode("img",{src:l.logoImageSrc,loading:"lazy",width:"250",alt:"Police Data Accessibility Project Logo"},null,8,pr)],8,mr)),e.createVNode(ve,{"top-position":n.value},null,8,["top-position"])],512))}});const gr=e.defineComponent({__name:"QuickSearchForm",props:{mode:{default:"prod"}},setup(t){const r=X.useRouter(),n=t,a=[{id:"search-term",name:"searchTerm",label:"What are you looking for?",type:b.TEXT,placeholder:"Enter a keyword, type of public records, or 'all'",value:""},{id:"location",name:"location",label:"From where?",type:b.TEXT,placeholder:"Enter a state, county, municipality, or 'all'",value:""}],o=e.ref(void 0);function s(l){if(Object.values(l).every(d=>!d)){o.value="Either a search term or a location is required.";return}let{location:c,searchTerm:u}=l;if(c=c&&c.length>0?c:"all",u=u&&u.length>0?u:"all",r.getRoutes().some(d=>d.path.includes("/search/")))r.push(`/search/${u}/${c}`);else{const d=n.mode==="prod"?"https://data-sources.pdap.io":"https://data-sources.pdap.dev";window.location.assign(`${d}/search/${u}/${c}`)}}return(l,c)=>(e.openBlock(),e.createBlock(U,{alignment:"center",component:"div",class:"pdap-quick-search-form"},{default:e.withCtx(()=>[e.createVNode(ge,{id:"quick-search-form",class:"small",error:o.value,schema:a,name:"quickSearchForm",onSubmit:s},{default:e.withCtx(()=>[e.createVNode(le,{type:"submit"},{default:e.withCtx(()=>[e.createTextVNode("Search Data Sources")]),_:1})]),_:1},8,["error"])]),_:1}))}});const hr=["alt","src"],vr=e.defineComponent({__name:"TileIcon",props:{imgAltText:{},imgSrc:{}},setup(t){return(r,n)=>(e.openBlock(),e.createElementBlock("img",{class:"pdap-tile-icon",alt:r.imgAltText,src:r.imgSrc},null,8,hr))}});exports.Button=le;exports.FlexContainer=U;exports.Footer=Le;exports.Form=ge;exports.GridContainer=he;exports.GridItem=ir;exports.Header=$r;exports.Input=fe;exports.Nav=ve;exports.PdapInputTypes=b;exports.QuickSearchForm=gr;exports.TileIcon=vr;
|
package/dist/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineComponent as j, reactive as C, openBlock as v, createElementBlock as b, normalizeClass as G, renderSlot as K, createBlock as A, resolveDynamicComponent as me, withCtx as E, inject as J, resolveComponent as Qe, createVNode as Y, createElementVNode as P, Fragment as ee, renderList as fe, unref as
|
1
|
+
import { defineComponent as j, reactive as C, openBlock as v, createElementBlock as b, normalizeClass as G, renderSlot as K, createBlock as A, resolveDynamicComponent as me, withCtx as E, inject as J, resolveComponent as Qe, createVNode as Y, createElementVNode as P, Fragment as ee, renderList as fe, unref as d, toDisplayString as D, createCommentVNode as q, createTextVNode as B, getCurrentInstance as Ze, ref as x, onBeforeMount as Ve, watch as X, isRef as ce, onBeforeUnmount as $e, computed as _, isReactive as Je, isReadonly as Ye, provide as be, nextTick as te, mergeProps as de, watchEffect as Pe, withModifiers as et, normalizeStyle as ge, onMounted as tt } from "vue";
|
2
2
|
import { RouterLink as Se, useRouter as rt } from "vue-router";
|
3
3
|
const nt = /* @__PURE__ */ j({
|
4
4
|
__name: "PdapButton",
|
@@ -82,31 +82,31 @@ const at = { class: "pdap-footer" }, st = { class: "pdap-footer-social-links" },
|
|
82
82
|
}
|
83
83
|
]), n = t.logoImageAnchorPath.startsWith("/");
|
84
84
|
return (a, s) => {
|
85
|
-
const
|
85
|
+
const u = Qe("router-link");
|
86
86
|
return v(), b("footer", at, [
|
87
87
|
Y(ke, { alignment: "center" }, {
|
88
88
|
default: E(() => [
|
89
89
|
P("ul", st, [
|
90
|
-
(v(!0), b(ee, null, fe(
|
91
|
-
key:
|
90
|
+
(v(!0), b(ee, null, fe(d(r), (i) => (v(), b("li", {
|
91
|
+
key: i.text,
|
92
92
|
class: "pdap-footer-link-container"
|
93
93
|
}, [
|
94
|
-
|
94
|
+
i.href ? (v(), b("a", {
|
95
95
|
key: 0,
|
96
96
|
class: "pdap-footer-social-link",
|
97
|
-
href:
|
97
|
+
href: i.href,
|
98
98
|
target: "_blank",
|
99
99
|
referrerpolicy: "no-referrer"
|
100
|
-
}, D(
|
101
|
-
|
100
|
+
}, D(i.text), 9, ot)) : q("", !0),
|
101
|
+
i.path ? (v(), A(u, {
|
102
102
|
key: 1,
|
103
103
|
"active-class": "pdap-footer-social-link-current",
|
104
104
|
"exact-active-class": "pdap-footer-social-link-current-exact",
|
105
105
|
class: "pdap-footer-social-link",
|
106
|
-
to:
|
106
|
+
to: i.path
|
107
107
|
}, {
|
108
108
|
default: E(() => [
|
109
|
-
B(D(
|
109
|
+
B(D(i.text), 1)
|
110
110
|
]),
|
111
111
|
_: 2
|
112
112
|
}, 1032, ["to"])) : q("", !0)
|
@@ -116,7 +116,7 @@ const at = { class: "pdap-footer" }, st = { class: "pdap-footer-social-links" },
|
|
116
116
|
ut,
|
117
117
|
P("div", lt, [
|
118
118
|
ct,
|
119
|
-
|
119
|
+
d(n) ? (v(), A(u, {
|
120
120
|
key: 1,
|
121
121
|
to: a.logoImageAnchorPath,
|
122
122
|
class: "pdap-footer-logo"
|
@@ -181,7 +181,7 @@ function ft(e, t, r) {
|
|
181
181
|
}
|
182
182
|
function Re(e) {
|
183
183
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
|
184
|
-
return Object.keys(e).reduce((r, n) => (t.includes(n) || (r[n] =
|
184
|
+
return Object.keys(e).reduce((r, n) => (t.includes(n) || (r[n] = d(e[n])), r), {});
|
185
185
|
}
|
186
186
|
function re(e) {
|
187
187
|
return typeof e == "function";
|
@@ -213,24 +213,24 @@ function Oe(e, t, r) {
|
|
213
213
|
}, []));
|
214
214
|
}
|
215
215
|
function Me(e, t, r, n) {
|
216
|
-
return e.call(n,
|
216
|
+
return e.call(n, d(t), d(r), n);
|
217
217
|
}
|
218
218
|
function De(e) {
|
219
219
|
return e.$valid !== void 0 ? !e.$valid : !e;
|
220
220
|
}
|
221
|
-
function gt(e, t, r, n, a, s,
|
221
|
+
function gt(e, t, r, n, a, s, u) {
|
222
222
|
let {
|
223
|
-
$lazy:
|
223
|
+
$lazy: i,
|
224
224
|
$rewardEarly: l
|
225
|
-
} = a,
|
225
|
+
} = a, c = arguments.length > 7 && arguments[7] !== void 0 ? arguments[7] : [], p = arguments.length > 8 ? arguments[8] : void 0, f = arguments.length > 9 ? arguments[9] : void 0, g = arguments.length > 10 ? arguments[10] : void 0;
|
226
226
|
const h = x(!!n.value), o = x(0);
|
227
227
|
r.value = !1;
|
228
|
-
const m = X([t, n].concat(
|
229
|
-
if (
|
228
|
+
const m = X([t, n].concat(c, g), () => {
|
229
|
+
if (i && !n.value || l && !f.value && !r.value)
|
230
230
|
return;
|
231
231
|
let $;
|
232
232
|
try {
|
233
|
-
$ = Me(e, t,
|
233
|
+
$ = Me(e, t, p, u);
|
234
234
|
} catch (y) {
|
235
235
|
$ = Promise.reject(y);
|
236
236
|
}
|
@@ -248,17 +248,17 @@ function gt(e, t, r, n, a, s, i) {
|
|
248
248
|
$unwatch: m
|
249
249
|
};
|
250
250
|
}
|
251
|
-
function ht(e, t, r, n, a, s,
|
251
|
+
function ht(e, t, r, n, a, s, u, i) {
|
252
252
|
let {
|
253
253
|
$lazy: l,
|
254
|
-
$rewardEarly:
|
254
|
+
$rewardEarly: c
|
255
255
|
} = n;
|
256
|
-
const
|
257
|
-
if (l && !r.value ||
|
256
|
+
const p = () => ({}), f = _(() => {
|
257
|
+
if (l && !r.value || c && !i.value)
|
258
258
|
return !1;
|
259
259
|
let g = !0;
|
260
260
|
try {
|
261
|
-
const h = Me(e, t,
|
261
|
+
const h = Me(e, t, u, s);
|
262
262
|
a.value = h, g = De(h);
|
263
263
|
} catch (h) {
|
264
264
|
a.value = h;
|
@@ -266,20 +266,20 @@ function ht(e, t, r, n, a, s, i, u) {
|
|
266
266
|
return g;
|
267
267
|
});
|
268
268
|
return {
|
269
|
-
$unwatch:
|
269
|
+
$unwatch: p,
|
270
270
|
$invalid: f
|
271
271
|
};
|
272
272
|
}
|
273
|
-
function vt(e, t, r, n, a, s,
|
273
|
+
function vt(e, t, r, n, a, s, u, i, l, c, p) {
|
274
274
|
const f = x(!1), g = e.$params || {}, h = x(null);
|
275
275
|
let o, m;
|
276
276
|
e.$async ? {
|
277
277
|
$invalid: o,
|
278
278
|
$unwatch: m
|
279
|
-
} = gt(e.$validator, t, f, r, n, h, a, e.$watchTargets, l,
|
279
|
+
} = gt(e.$validator, t, f, r, n, h, a, e.$watchTargets, l, c, p) : {
|
280
280
|
$invalid: o,
|
281
281
|
$unwatch: m
|
282
|
-
} = ht(e.$validator, t, r, n, h, a, l,
|
282
|
+
} = ht(e.$validator, t, r, n, h, a, l, c);
|
283
283
|
const $ = e.$message;
|
284
284
|
return {
|
285
285
|
$message: re($) ? _(() => $(Re({
|
@@ -289,8 +289,8 @@ function vt(e, t, r, n, a, s, i, u, l, p, d) {
|
|
289
289
|
$model: t,
|
290
290
|
$response: h,
|
291
291
|
$validator: s,
|
292
|
-
$propertyPath:
|
293
|
-
$property:
|
292
|
+
$propertyPath: i,
|
293
|
+
$property: u
|
294
294
|
}))) : $ || "",
|
295
295
|
$params: g,
|
296
296
|
$pending: f,
|
@@ -301,42 +301,42 @@ function vt(e, t, r, n, a, s, i, u, l, p, d) {
|
|
301
301
|
}
|
302
302
|
function yt() {
|
303
303
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
304
|
-
const t =
|
305
|
-
let
|
306
|
-
return r.forEach((
|
307
|
-
const l = t[
|
304
|
+
const t = d(e), r = Object.keys(t), n = {}, a = {}, s = {};
|
305
|
+
let u = null;
|
306
|
+
return r.forEach((i) => {
|
307
|
+
const l = t[i];
|
308
308
|
switch (!0) {
|
309
309
|
case re(l.$validator):
|
310
|
-
n[
|
310
|
+
n[i] = l;
|
311
311
|
break;
|
312
312
|
case re(l):
|
313
|
-
n[
|
313
|
+
n[i] = {
|
314
314
|
$validator: l
|
315
315
|
};
|
316
316
|
break;
|
317
|
-
case
|
318
|
-
|
317
|
+
case i === "$validationGroups":
|
318
|
+
u = l;
|
319
319
|
break;
|
320
|
-
case
|
321
|
-
s[
|
320
|
+
case i.startsWith("$"):
|
321
|
+
s[i] = l;
|
322
322
|
break;
|
323
323
|
default:
|
324
|
-
a[
|
324
|
+
a[i] = l;
|
325
325
|
}
|
326
326
|
}), {
|
327
327
|
rules: n,
|
328
328
|
nestedValidators: a,
|
329
329
|
config: s,
|
330
|
-
validationGroups:
|
330
|
+
validationGroups: u
|
331
331
|
};
|
332
332
|
}
|
333
333
|
const _t = "__root";
|
334
|
-
function wt(e, t, r, n, a, s,
|
335
|
-
const
|
336
|
-
if (
|
337
|
-
if (!
|
338
|
-
return
|
339
|
-
|
334
|
+
function wt(e, t, r, n, a, s, u, i, l) {
|
335
|
+
const c = Object.keys(e), p = n.get(a, e), f = x(!1), g = x(!1), h = x(0);
|
336
|
+
if (p) {
|
337
|
+
if (!p.$partial)
|
338
|
+
return p;
|
339
|
+
p.$unwatch(), f.value = p.$dirty.value;
|
340
340
|
}
|
341
341
|
const o = {
|
342
342
|
$dirty: f,
|
@@ -350,9 +350,9 @@ function wt(e, t, r, n, a, s, i, u, l) {
|
|
350
350
|
$commit: () => {
|
351
351
|
}
|
352
352
|
};
|
353
|
-
return
|
354
|
-
o[m] = vt(e[m], t, o.$dirty, s,
|
355
|
-
}), o.$externalResults = _(() =>
|
353
|
+
return c.length ? (c.forEach((m) => {
|
354
|
+
o[m] = vt(e[m], t, o.$dirty, s, u, m, r, a, l, g, h);
|
355
|
+
}), o.$externalResults = _(() => i.value ? [].concat(i.value).map((m, $) => ({
|
356
356
|
$propertyPath: a,
|
357
357
|
$property: r,
|
358
358
|
$validator: "$externalResults",
|
@@ -362,9 +362,9 @@ function wt(e, t, r, n, a, s, i, u, l) {
|
|
362
362
|
$response: null,
|
363
363
|
$pending: !1
|
364
364
|
})) : []), o.$invalid = _(() => {
|
365
|
-
const m =
|
365
|
+
const m = c.some(($) => d(o[$].$invalid));
|
366
366
|
return g.value = m, !!o.$externalResults.value.length || m;
|
367
|
-
}), o.$pending = _(() =>
|
367
|
+
}), o.$pending = _(() => c.some((m) => d(o[m].$pending))), o.$error = _(() => o.$dirty.value ? o.$pending.value || o.$invalid.value : !1), o.$silentErrors = _(() => c.filter((m) => d(o[m].$invalid)).map((m) => {
|
368
368
|
const $ = o[m];
|
369
369
|
return C({
|
370
370
|
$propertyPath: a,
|
@@ -376,27 +376,27 @@ function wt(e, t, r, n, a, s, i, u, l) {
|
|
376
376
|
$response: $.$response,
|
377
377
|
$pending: $.$pending
|
378
378
|
});
|
379
|
-
}).concat(o.$externalResults.value)), o.$errors = _(() => o.$dirty.value ? o.$silentErrors.value : []), o.$unwatch = () =>
|
379
|
+
}).concat(o.$externalResults.value)), o.$errors = _(() => o.$dirty.value ? o.$silentErrors.value : []), o.$unwatch = () => c.forEach((m) => {
|
380
380
|
o[m].$unwatch();
|
381
381
|
}), o.$commit = () => {
|
382
382
|
g.value = !0, h.value = Date.now();
|
383
|
-
}, n.set(a, e, o), o) : (
|
383
|
+
}, n.set(a, e, o), o) : (p && n.set(a, e, o), o);
|
384
384
|
}
|
385
|
-
function bt(e, t, r, n, a, s,
|
386
|
-
const
|
387
|
-
return
|
388
|
-
validations: e[
|
385
|
+
function bt(e, t, r, n, a, s, u) {
|
386
|
+
const i = Object.keys(e);
|
387
|
+
return i.length ? i.reduce((l, c) => (l[c] = pe({
|
388
|
+
validations: e[c],
|
389
389
|
state: t,
|
390
|
-
key:
|
390
|
+
key: c,
|
391
391
|
parentKey: r,
|
392
392
|
resultsCache: n,
|
393
393
|
globalConfig: a,
|
394
394
|
instance: s,
|
395
|
-
externalResults:
|
395
|
+
externalResults: u
|
396
396
|
}), l), {}) : {};
|
397
397
|
}
|
398
398
|
function Pt(e, t, r) {
|
399
|
-
const n = _(() => [t, r].filter((o) => o).reduce((o, m) => o.concat(Object.values(
|
399
|
+
const n = _(() => [t, r].filter((o) => o).reduce((o, m) => o.concat(Object.values(d(m))), [])), a = _({
|
400
400
|
get() {
|
401
401
|
return e.$dirty.value || (n.value.length ? n.value.every((o) => o.$dirty) : !1);
|
402
402
|
},
|
@@ -404,12 +404,12 @@ function Pt(e, t, r) {
|
|
404
404
|
e.$dirty.value = o;
|
405
405
|
}
|
406
406
|
}), s = _(() => {
|
407
|
-
const o =
|
407
|
+
const o = d(e.$silentErrors) || [], m = n.value.filter(($) => (d($).$silentErrors || []).length).reduce(($, y) => $.concat(...y.$silentErrors), []);
|
408
408
|
return o.concat(m);
|
409
|
-
}),
|
410
|
-
const o =
|
409
|
+
}), u = _(() => {
|
410
|
+
const o = d(e.$errors) || [], m = n.value.filter(($) => (d($).$errors || []).length).reduce(($, y) => $.concat(...y.$errors), []);
|
411
411
|
return o.concat(m);
|
412
|
-
}),
|
412
|
+
}), i = _(() => n.value.some((o) => o.$invalid) || d(e.$invalid) || !1), l = _(() => n.value.some((o) => d(o.$pending)) || d(e.$pending) || !1), c = _(() => n.value.some((o) => o.$dirty) || n.value.some((o) => o.$anyDirty) || a.value), p = _(() => a.value ? l.value || i.value : !1), f = () => {
|
413
413
|
e.$touch(), n.value.forEach((o) => {
|
414
414
|
o.$touch();
|
415
415
|
});
|
@@ -424,10 +424,10 @@ function Pt(e, t, r) {
|
|
424
424
|
};
|
425
425
|
return n.value.length && n.value.every((o) => o.$dirty) && f(), {
|
426
426
|
$dirty: a,
|
427
|
-
$errors:
|
428
|
-
$invalid:
|
429
|
-
$anyDirty:
|
430
|
-
$error:
|
427
|
+
$errors: u,
|
428
|
+
$invalid: i,
|
429
|
+
$anyDirty: c,
|
430
|
+
$error: p,
|
431
431
|
$pending: l,
|
432
432
|
$touch: f,
|
433
433
|
$reset: h,
|
@@ -442,23 +442,23 @@ function pe(e) {
|
|
442
442
|
key: n,
|
443
443
|
parentKey: a,
|
444
444
|
childResults: s,
|
445
|
-
resultsCache:
|
446
|
-
globalConfig:
|
445
|
+
resultsCache: u,
|
446
|
+
globalConfig: i = {},
|
447
447
|
instance: l,
|
448
|
-
externalResults:
|
448
|
+
externalResults: c
|
449
449
|
} = e;
|
450
|
-
const
|
450
|
+
const p = a ? `${a}.${n}` : n, {
|
451
451
|
rules: f,
|
452
452
|
nestedValidators: g,
|
453
453
|
config: h,
|
454
454
|
validationGroups: o
|
455
|
-
} = yt(t), m = V(V({},
|
456
|
-
const w =
|
457
|
-
return w ?
|
458
|
-
}) : r, y = V({}, c
|
459
|
-
const w = c
|
460
|
-
return n ? w ?
|
461
|
-
}), se = wt(f, $, n,
|
455
|
+
} = yt(t), m = V(V({}, i), h), $ = n ? _(() => {
|
456
|
+
const w = d(r);
|
457
|
+
return w ? d(w[n]) : void 0;
|
458
|
+
}) : r, y = V({}, d(c) || {}), F = _(() => {
|
459
|
+
const w = d(c);
|
460
|
+
return n ? w ? d(w[n]) : void 0 : w;
|
461
|
+
}), se = wt(f, $, n, u, p, m, l, F, r), O = bt(g, $, p, u, m, l, F), z = {};
|
462
462
|
o && Object.entries(o).forEach((w) => {
|
463
463
|
let [M, L] = w;
|
464
464
|
z[M] = {
|
@@ -481,16 +481,16 @@ function pe(e) {
|
|
481
481
|
$silentErrors: Ge,
|
482
482
|
$commit: we
|
483
483
|
} = Pt(se, O, s), Xe = n ? _({
|
484
|
-
get: () =>
|
484
|
+
get: () => d($),
|
485
485
|
set: (w) => {
|
486
486
|
I.value = !0;
|
487
|
-
const M =
|
487
|
+
const M = d(r), L = d(c);
|
488
488
|
L && (L[n] = y[n]), ce(M[n]) ? M[n].value = w : M[n] = w;
|
489
489
|
}
|
490
490
|
}) : null;
|
491
491
|
n && m.$autoDirty && X($, () => {
|
492
492
|
I.value || ue();
|
493
|
-
const w = c
|
493
|
+
const w = d(c);
|
494
494
|
w && (w[n] = y[n]);
|
495
495
|
}, {
|
496
496
|
flush: "sync"
|
@@ -508,9 +508,9 @@ function pe(e) {
|
|
508
508
|
return (s.value || {})[w];
|
509
509
|
}
|
510
510
|
function Ke() {
|
511
|
-
ce(
|
512
|
-
delete
|
513
|
-
}) : Object.assign(
|
511
|
+
ce(c) ? c.value = y : Object.keys(y).length === 0 ? Object.keys(c).forEach((w) => {
|
512
|
+
delete c[w];
|
513
|
+
}) : Object.assign(c, y);
|
514
514
|
}
|
515
515
|
return C(V(V(V({}, se), {}, {
|
516
516
|
$model: Xe,
|
@@ -522,7 +522,7 @@ function pe(e) {
|
|
522
522
|
$pending: ie,
|
523
523
|
$touch: ue,
|
524
524
|
$reset: He,
|
525
|
-
$path:
|
525
|
+
$path: p || _t,
|
526
526
|
$silentErrors: Ge,
|
527
527
|
$validate: We,
|
528
528
|
$commit: we
|
@@ -544,7 +544,7 @@ class xt {
|
|
544
544
|
}
|
545
545
|
checkRulesValidity(t, r, n) {
|
546
546
|
const a = Object.keys(n), s = Object.keys(r);
|
547
|
-
return s.length !== a.length || !s.every((
|
547
|
+
return s.length !== a.length || !s.every((i) => a.includes(i)) ? !1 : s.every((i) => r[i].$params ? Object.keys(r[i].$params).every((l) => d(n[i].$params[l]) === d(r[i].$params[l])) : !0);
|
548
548
|
}
|
549
549
|
get(t, r) {
|
550
550
|
const n = this.storage.get(t);
|
@@ -553,11 +553,11 @@ class xt {
|
|
553
553
|
const {
|
554
554
|
rules: a,
|
555
555
|
result: s
|
556
|
-
} = n,
|
557
|
-
return
|
556
|
+
} = n, u = this.checkRulesValidity(t, r, a), i = s.$unwatch ? s.$unwatch : () => ({});
|
557
|
+
return u ? s : {
|
558
558
|
$dirty: s.$dirty,
|
559
559
|
$partial: !0,
|
560
|
-
$unwatch:
|
560
|
+
$unwatch: i
|
561
561
|
};
|
562
562
|
}
|
563
563
|
}
|
@@ -570,27 +570,27 @@ function Rt(e) {
|
|
570
570
|
$scope: t,
|
571
571
|
instance: r
|
572
572
|
} = e;
|
573
|
-
const n = {}, a = x([]), s = _(() => a.value.reduce((
|
574
|
-
function
|
573
|
+
const n = {}, a = x([]), s = _(() => a.value.reduce((p, f) => (p[f] = d(n[f]), p), {}));
|
574
|
+
function u(p, f) {
|
575
575
|
let {
|
576
576
|
$registerAs: g,
|
577
577
|
$scope: h,
|
578
578
|
$stopPropagation: o
|
579
579
|
} = f;
|
580
|
-
o || t === Z.COLLECT_NONE || h === Z.COLLECT_NONE || t !== Z.COLLECT_ALL && t !== h || (n[g] =
|
580
|
+
o || t === Z.COLLECT_NONE || h === Z.COLLECT_NONE || t !== Z.COLLECT_ALL && t !== h || (n[g] = p, a.value.push(g));
|
581
581
|
}
|
582
|
-
r.__vuelidateInjectInstances = [].concat(r.__vuelidateInjectInstances || [],
|
583
|
-
function
|
584
|
-
a.value = a.value.filter((f) => f !==
|
582
|
+
r.__vuelidateInjectInstances = [].concat(r.__vuelidateInjectInstances || [], u);
|
583
|
+
function i(p) {
|
584
|
+
a.value = a.value.filter((f) => f !== p), delete n[p];
|
585
585
|
}
|
586
|
-
r.__vuelidateRemoveInstances = [].concat(r.__vuelidateRemoveInstances || [],
|
586
|
+
r.__vuelidateRemoveInstances = [].concat(r.__vuelidateRemoveInstances || [], i);
|
587
587
|
const l = J(Ee, []);
|
588
588
|
be(Ee, r.__vuelidateInjectInstances);
|
589
|
-
const
|
589
|
+
const c = J(Ce, []);
|
590
590
|
return be(Ce, r.__vuelidateRemoveInstances), {
|
591
591
|
childResults: s,
|
592
592
|
sendValidationResultsToParent: l,
|
593
|
-
removeValidationResultsFromParent:
|
593
|
+
removeValidationResultsFromParent: c
|
594
594
|
};
|
595
595
|
}
|
596
596
|
function qe(e) {
|
@@ -608,39 +608,39 @@ function Ot(e, t) {
|
|
608
608
|
let {
|
609
609
|
$registerAs: a,
|
610
610
|
$scope: s = Z.COLLECT_ALL,
|
611
|
-
$stopPropagation:
|
612
|
-
$externalResults:
|
611
|
+
$stopPropagation: u,
|
612
|
+
$externalResults: i,
|
613
613
|
currentVueInstance: l
|
614
614
|
} = n;
|
615
|
-
const
|
615
|
+
const c = l || ((r = Ze()) === null || r === void 0 ? void 0 : r.proxy), p = c ? c.$options : {};
|
616
616
|
a || (je += 1, a = `_vuelidate_${je}`);
|
617
617
|
const f = x({}), g = new xt(), {
|
618
618
|
childResults: h,
|
619
619
|
sendValidationResultsToParent: o,
|
620
620
|
removeValidationResultsFromParent: m
|
621
|
-
} =
|
621
|
+
} = c ? Rt({
|
622
622
|
$scope: s,
|
623
|
-
instance:
|
623
|
+
instance: c
|
624
624
|
}) : {
|
625
625
|
childResults: x({})
|
626
626
|
};
|
627
|
-
if (!e &&
|
628
|
-
const $ =
|
627
|
+
if (!e && p.validations) {
|
628
|
+
const $ = p.validations;
|
629
629
|
t = x({}), Ve(() => {
|
630
|
-
t.value =
|
630
|
+
t.value = c, X(() => re($) ? $.call(t.value, new qe(t.value)) : $, (y) => {
|
631
631
|
f.value = pe({
|
632
632
|
validations: y,
|
633
633
|
state: t,
|
634
634
|
childResults: h,
|
635
635
|
resultsCache: g,
|
636
636
|
globalConfig: n,
|
637
|
-
instance:
|
638
|
-
externalResults:
|
637
|
+
instance: c,
|
638
|
+
externalResults: i || c.vuelidateExternalResults
|
639
639
|
});
|
640
640
|
}, {
|
641
641
|
immediate: !0
|
642
642
|
});
|
643
|
-
}), n =
|
643
|
+
}), n = p.validationsConfig || n;
|
644
644
|
} else {
|
645
645
|
const $ = ce(e) || $t(e) ? e : C(e || {});
|
646
646
|
X($, (y) => {
|
@@ -650,18 +650,18 @@ function Ot(e, t) {
|
|
650
650
|
childResults: h,
|
651
651
|
resultsCache: g,
|
652
652
|
globalConfig: n,
|
653
|
-
instance:
|
654
|
-
externalResults:
|
653
|
+
instance: c ?? {},
|
654
|
+
externalResults: i
|
655
655
|
});
|
656
656
|
}, {
|
657
657
|
immediate: !0
|
658
658
|
});
|
659
659
|
}
|
660
|
-
return
|
660
|
+
return c && (o.forEach(($) => $(f, {
|
661
661
|
$registerAs: a,
|
662
662
|
$scope: s,
|
663
|
-
$stopPropagation:
|
664
|
-
})), $e(() => m.forEach(($) => $(a)))), _(() => V(V({},
|
663
|
+
$stopPropagation: u
|
664
|
+
})), $e(() => m.forEach(($) => $(a)))), _(() => V(V({}, d(f.value)), h.value));
|
665
665
|
}
|
666
666
|
var T = /* @__PURE__ */ ((e) => (e.CHECKBOX = "checkbox", e.TEXT = "text", e))(T || {});
|
667
667
|
const Et = ["id", "name", "placeholder", "value"], Ct = ["id", "name", "checked", "value"], jt = ["id"], At = ["for"], Tt = /* @__PURE__ */ j({
|
@@ -679,38 +679,38 @@ const Et = ["id", "name", "placeholder", "value"], Ct = ["id", "name", "checked"
|
|
679
679
|
emits: ["change", "input"],
|
680
680
|
setup(e, { emit: t }) {
|
681
681
|
const r = e, n = t, a = () => {
|
682
|
-
|
682
|
+
u.value = !u.value, n("change", u.value.toString());
|
683
683
|
}, s = (l) => {
|
684
684
|
n("input", l.target.value);
|
685
|
-
},
|
686
|
-
return (l,
|
687
|
-
var
|
688
|
-
return v(), A(
|
685
|
+
}, u = x(r.defaultChecked), i = _(() => `pdap-${r.name}-input-error`);
|
686
|
+
return (l, c) => {
|
687
|
+
var p;
|
688
|
+
return v(), A(d(Dr), {
|
689
689
|
class: G({
|
690
690
|
"pdap-input": !0,
|
691
|
-
"pdap-input-error": Number((
|
691
|
+
"pdap-input-error": Number((p = l.error) == null ? void 0 : p.length) >= 1
|
692
692
|
})
|
693
693
|
}, {
|
694
694
|
default: E(() => [
|
695
|
-
l.type ===
|
695
|
+
l.type === d(T).TEXT ? (v(), b("input", de({
|
696
696
|
key: 0,
|
697
697
|
id: l.id,
|
698
698
|
type: "text",
|
699
699
|
name: l.name,
|
700
700
|
placeholder: l.placeholder,
|
701
701
|
value: l.value
|
702
|
-
}, l.$attrs, { onInput: s }), null, 16, Et)) : l.type ===
|
702
|
+
}, l.$attrs, { onInput: s }), null, 16, Et)) : l.type === d(T).CHECKBOX ? (v(), b("input", de({
|
703
703
|
key: 1,
|
704
704
|
id: l.id,
|
705
705
|
class: "pdap-input-checkbox",
|
706
706
|
name: l.name,
|
707
|
-
checked:
|
707
|
+
checked: u.value,
|
708
708
|
type: "checkbox",
|
709
709
|
value: l.value
|
710
710
|
}, l.$attrs, { onChange: a }), null, 16, Ct)) : q("", !0),
|
711
711
|
l.error ? (v(), b("div", {
|
712
712
|
key: 2,
|
713
|
-
id:
|
713
|
+
id: i.value,
|
714
714
|
class: "pdap-input-error-message"
|
715
715
|
}, D(l.error), 9, jt)) : q("", !0),
|
716
716
|
P("label", {
|
@@ -781,7 +781,7 @@ function he(e, t) {
|
|
781
781
|
return r.$params = H(H({}, r.$params || {}), e), r;
|
782
782
|
}
|
783
783
|
function U(e, t) {
|
784
|
-
if (!W(e) && typeof
|
784
|
+
if (!W(e) && typeof d(e) != "string")
|
785
785
|
throw new Error(`[@vuelidate/validators]: First parameter to "withMessage" should be string or a function returning a string, provided ${typeof e}`);
|
786
786
|
if (!ne(t) && !W(t))
|
787
787
|
throw new Error("[@vuelidate/validators]: Validator must be a function or object with $validator parameter");
|
@@ -801,12 +801,12 @@ function St(e) {
|
|
801
801
|
$validator(t) {
|
802
802
|
for (var r = arguments.length, n = new Array(r > 1 ? r - 1 : 0), a = 1; a < r; a++)
|
803
803
|
n[a - 1] = arguments[a];
|
804
|
-
return
|
805
|
-
const l = Object.entries(
|
806
|
-
let [f, g] =
|
804
|
+
return d(t).reduce((s, u, i) => {
|
805
|
+
const l = Object.entries(u).reduce((c, p) => {
|
806
|
+
let [f, g] = p;
|
807
807
|
const h = e[f] || {}, o = Object.entries(h).reduce((m, $) => {
|
808
808
|
let [y, F] = $;
|
809
|
-
const O = N(F).call(this, g,
|
809
|
+
const O = N(F).call(this, g, u, i, ...n), z = S(O);
|
810
810
|
if (m.$data[y] = O, m.$data.$invalid = !z || !!m.$data.$invalid, m.$data.$error = m.$data.$invalid, !z) {
|
811
811
|
let I = F.$message || "";
|
812
812
|
const Q = F.$params || {};
|
@@ -836,10 +836,10 @@ function St(e) {
|
|
836
836
|
$data: {},
|
837
837
|
$errors: []
|
838
838
|
});
|
839
|
-
return
|
840
|
-
$valid:
|
841
|
-
$data:
|
842
|
-
$errors:
|
839
|
+
return c.$data[f] = o.$data, c.$errors[f] = o.$errors, {
|
840
|
+
$valid: c.$valid && o.$valid,
|
841
|
+
$data: c.$data,
|
842
|
+
$errors: c.$errors
|
843
843
|
};
|
844
844
|
}, {
|
845
845
|
$valid: !0,
|
@@ -866,7 +866,7 @@ function St(e) {
|
|
866
866
|
};
|
867
867
|
}
|
868
868
|
const R = (e) => {
|
869
|
-
if (e =
|
869
|
+
if (e = d(e), Array.isArray(e))
|
870
870
|
return !!e.length;
|
871
871
|
if (e == null)
|
872
872
|
return !1;
|
@@ -880,11 +880,11 @@ const R = (e) => {
|
|
880
880
|
return !1;
|
881
881
|
}
|
882
882
|
return !!String(e).length;
|
883
|
-
}, ve = (e) => (e =
|
883
|
+
}, ve = (e) => (e = d(e), Array.isArray(e) ? e.length : typeof e == "object" ? Object.keys(e).length : String(e).length);
|
884
884
|
function k() {
|
885
885
|
for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
|
886
886
|
t[r] = arguments[r];
|
887
|
-
return (n) => (n =
|
887
|
+
return (n) => (n = d(n), !R(n) || t.every((a) => (a.lastIndex = 0, a.test(n))));
|
888
888
|
}
|
889
889
|
var ye = /* @__PURE__ */ Object.freeze({
|
890
890
|
__proto__: null,
|
@@ -893,7 +893,7 @@ var ye = /* @__PURE__ */ Object.freeze({
|
|
893
893
|
normalizeValidatorObject: ae,
|
894
894
|
regex: k,
|
895
895
|
req: R,
|
896
|
-
unwrap:
|
896
|
+
unwrap: d,
|
897
897
|
unwrapNormalizedValidator: N,
|
898
898
|
unwrapValidatorResponse: S,
|
899
899
|
withAsync: Vt,
|
@@ -919,7 +919,7 @@ var ye = /* @__PURE__ */ Object.freeze({
|
|
919
919
|
}
|
920
920
|
};
|
921
921
|
function Ft(e, t) {
|
922
|
-
return (r) => !R(r) || (!/\s/.test(r) || r instanceof Date) && +
|
922
|
+
return (r) => !R(r) || (!/\s/.test(r) || r instanceof Date) && +d(e) <= +r && +d(t) >= +r;
|
923
923
|
}
|
924
924
|
function Bt(e, t) {
|
925
925
|
return {
|
@@ -969,7 +969,7 @@ var Kt = {
|
|
969
969
|
function Qt() {
|
970
970
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ":";
|
971
971
|
return (t) => {
|
972
|
-
if (e =
|
972
|
+
if (e = d(e), !R(t))
|
973
973
|
return !0;
|
974
974
|
if (typeof t != "string")
|
975
975
|
return !1;
|
@@ -988,7 +988,7 @@ function Jt(e) {
|
|
988
988
|
};
|
989
989
|
}
|
990
990
|
function Yt(e) {
|
991
|
-
return (t) => !R(t) || ve(t) <=
|
991
|
+
return (t) => !R(t) || ve(t) <= d(e);
|
992
992
|
}
|
993
993
|
function er(e) {
|
994
994
|
return {
|
@@ -1006,7 +1006,7 @@ function er(e) {
|
|
1006
1006
|
};
|
1007
1007
|
}
|
1008
1008
|
function tr(e) {
|
1009
|
-
return (t) => !R(t) || ve(t) >=
|
1009
|
+
return (t) => !R(t) || ve(t) >= d(e);
|
1010
1010
|
}
|
1011
1011
|
function rr(e) {
|
1012
1012
|
return {
|
@@ -1037,7 +1037,7 @@ const Te = (e, t) => e ? R(typeof t == "string" ? t.trim() : t) : !0;
|
|
1037
1037
|
function ar(e) {
|
1038
1038
|
return function(t, r) {
|
1039
1039
|
if (typeof e != "function")
|
1040
|
-
return Te(
|
1040
|
+
return Te(d(e), t);
|
1041
1041
|
const n = e.call(this, t, r);
|
1042
1042
|
return Te(n, t);
|
1043
1043
|
};
|
@@ -1056,7 +1056,7 @@ const Ie = (e, t) => e ? !0 : R(typeof t == "string" ? t.trim() : t);
|
|
1056
1056
|
function or(e) {
|
1057
1057
|
return function(t, r) {
|
1058
1058
|
if (typeof e != "function")
|
1059
|
-
return Ie(
|
1059
|
+
return Ie(d(e), t);
|
1060
1060
|
const n = e.call(this, t, r);
|
1061
1061
|
return Ie(n, t);
|
1062
1062
|
};
|
@@ -1072,7 +1072,7 @@ function ir(e) {
|
|
1072
1072
|
};
|
1073
1073
|
}
|
1074
1074
|
function ur(e) {
|
1075
|
-
return (t) =>
|
1075
|
+
return (t) => d(t) === d(e);
|
1076
1076
|
}
|
1077
1077
|
function lr(e) {
|
1078
1078
|
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "other";
|
@@ -1106,15 +1106,15 @@ function fr(e) {
|
|
1106
1106
|
for (var t = arguments.length, r = new Array(t), n = 0; n < t; n++)
|
1107
1107
|
r[n] = arguments[n];
|
1108
1108
|
return e.reduce(async (a, s) => {
|
1109
|
-
const
|
1110
|
-
return S(
|
1109
|
+
const u = await a;
|
1110
|
+
return S(u) ? u : N(s).apply(this, r);
|
1111
1111
|
}, Promise.resolve(!1));
|
1112
1112
|
};
|
1113
1113
|
}
|
1114
1114
|
function $r() {
|
1115
1115
|
for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
|
1116
1116
|
t[r] = arguments[r];
|
1117
|
-
const n = t.some((
|
1117
|
+
const n = t.some((u) => u.$async), a = t.reduce((u, i) => i.$watchTargets ? u.concat(i.$watchTargets) : u, []);
|
1118
1118
|
let s = () => !1;
|
1119
1119
|
return t.length && (s = n ? fr(t) : mr(t)), {
|
1120
1120
|
$async: n,
|
@@ -1139,15 +1139,15 @@ function vr(e) {
|
|
1139
1139
|
for (var t = arguments.length, r = new Array(t), n = 0; n < t; n++)
|
1140
1140
|
r[n] = arguments[n];
|
1141
1141
|
return e.reduce(async (a, s) => {
|
1142
|
-
const
|
1143
|
-
return S(
|
1142
|
+
const u = await a;
|
1143
|
+
return S(u) ? N(s).apply(this, r) : u;
|
1144
1144
|
}, Promise.resolve(!0));
|
1145
1145
|
};
|
1146
1146
|
}
|
1147
1147
|
function yr() {
|
1148
1148
|
for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
|
1149
1149
|
t[r] = arguments[r];
|
1150
|
-
const n = t.some((
|
1150
|
+
const n = t.some((u) => u.$async), a = t.reduce((u, i) => i.$watchTargets ? u.concat(i.$watchTargets) : u, []);
|
1151
1151
|
let s = () => !1;
|
1152
1152
|
return t.length && (s = n ? vr(t) : hr(t)), {
|
1153
1153
|
$async: n,
|
@@ -1178,7 +1178,7 @@ function br(e) {
|
|
1178
1178
|
};
|
1179
1179
|
}
|
1180
1180
|
function Pr(e) {
|
1181
|
-
return (t) => !R(t) || (!/\s/.test(t) || t instanceof Date) && +t >= +
|
1181
|
+
return (t) => !R(t) || (!/\s/.test(t) || t instanceof Date) && +t >= +d(e);
|
1182
1182
|
}
|
1183
1183
|
function xr(e) {
|
1184
1184
|
return {
|
@@ -1196,7 +1196,7 @@ function xr(e) {
|
|
1196
1196
|
};
|
1197
1197
|
}
|
1198
1198
|
function Rr(e) {
|
1199
|
-
return (t) => !R(t) || (!/\s/.test(t) || t instanceof Date) && +t <= +
|
1199
|
+
return (t) => !R(t) || (!/\s/.test(t) || t instanceof Date) && +t <= +d(e);
|
1200
1200
|
}
|
1201
1201
|
var Or = (e) => ({
|
1202
1202
|
$validator: Rr(e),
|
@@ -1236,24 +1236,24 @@ function Tr(e) {
|
|
1236
1236
|
} = e;
|
1237
1237
|
return function(s) {
|
1238
1238
|
let {
|
1239
|
-
withArguments:
|
1240
|
-
messagePath:
|
1239
|
+
withArguments: u = !1,
|
1240
|
+
messagePath: i = r,
|
1241
1241
|
messageParams: l = n
|
1242
1242
|
} = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
1243
|
-
function p
|
1244
|
-
return t(
|
1245
|
-
model:
|
1246
|
-
property:
|
1247
|
-
pending:
|
1248
|
-
invalid:
|
1249
|
-
response:
|
1250
|
-
validator:
|
1251
|
-
propertyPath:
|
1252
|
-
},
|
1243
|
+
function c(p) {
|
1244
|
+
return t(i(p), l(H({
|
1245
|
+
model: p.$model,
|
1246
|
+
property: p.$property,
|
1247
|
+
pending: p.$pending,
|
1248
|
+
invalid: p.$invalid,
|
1249
|
+
response: p.$response,
|
1250
|
+
validator: p.$validator,
|
1251
|
+
propertyPath: p.$propertyPath
|
1252
|
+
}, p.$params)));
|
1253
1253
|
}
|
1254
|
-
return
|
1255
|
-
return U(
|
1256
|
-
} : U(
|
1254
|
+
return u && typeof s == "function" ? function() {
|
1255
|
+
return U(c, s(...arguments));
|
1256
|
+
} : U(c, s);
|
1257
1257
|
};
|
1258
1258
|
}
|
1259
1259
|
const Ne = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
@@ -1332,16 +1332,16 @@ const zr = {
|
|
1332
1332
|
emits: ["submit"],
|
1333
1333
|
setup(e, { emit: t }) {
|
1334
1334
|
const r = e, n = t, a = x(
|
1335
|
-
r.schema.reduce((
|
1335
|
+
r.schema.reduce((p, f) => {
|
1336
1336
|
switch (f.type) {
|
1337
1337
|
case T.CHECKBOX:
|
1338
|
-
return { ...
|
1338
|
+
return { ...p, [f.name]: String(f.defaultChecked) };
|
1339
1339
|
case T.TEXT:
|
1340
1340
|
default:
|
1341
|
-
return { ...
|
1341
|
+
return { ...p, [f.name]: f.value };
|
1342
1342
|
}
|
1343
1343
|
}, {})
|
1344
|
-
), s = r.schema.reduce((
|
1344
|
+
), s = r.schema.reduce((p, f) => {
|
1345
1345
|
const g = Object.entries(f.validators ?? {}).reduce(
|
1346
1346
|
(h, [o, m]) => ({
|
1347
1347
|
...h,
|
@@ -1350,50 +1350,51 @@ const zr = {
|
|
1350
1350
|
{}
|
1351
1351
|
);
|
1352
1352
|
return {
|
1353
|
-
...
|
1353
|
+
...p,
|
1354
1354
|
[f.name]: {
|
1355
1355
|
...g
|
1356
1356
|
}
|
1357
1357
|
};
|
1358
|
-
}, {}),
|
1359
|
-
function l(
|
1360
|
-
a.value[
|
1358
|
+
}, {}), u = Ot(s, a, { $autoDirty: !1, $lazy: !0 }), i = x(r.error);
|
1359
|
+
function l(p, f) {
|
1360
|
+
a.value[p] = f;
|
1361
1361
|
}
|
1362
1362
|
Pe(() => {
|
1363
|
-
r.error ?
|
1363
|
+
r.error ? i.value = r.error : i.value && u.value.$errors.length === 0 ? i.value = null : !i.value && u.value.$errors.length > 0 && (i.value = "Please update this form to correct the errors");
|
1364
1364
|
}), Pe(() => {
|
1365
1365
|
console.debug(`PdapForm ${r.name}
|
1366
1366
|
`, {
|
1367
|
+
errorMessage: i.value,
|
1367
1368
|
props: r,
|
1368
1369
|
values: a,
|
1369
1370
|
vuelidate: {
|
1370
1371
|
rules: s,
|
1371
|
-
v$:
|
1372
|
+
v$: u
|
1372
1373
|
}
|
1373
1374
|
});
|
1374
1375
|
});
|
1375
|
-
async function p
|
1376
|
-
if (await
|
1377
|
-
n("submit", { ...a.value }),
|
1376
|
+
async function c(p) {
|
1377
|
+
if (await u.value.$validate()) {
|
1378
|
+
n("submit", { ...a.value }), u.value.$reset(), p.target.reset(), a.value = Object.entries(a.value).reduce((h, [o, m]) => ({ ...h, [o]: ["true", "false"].includes(m) ? m : "" }), {});
|
1378
1379
|
return;
|
1379
1380
|
}
|
1380
1381
|
}
|
1381
|
-
return (
|
1382
|
+
return (p, f) => (v(), b("form", {
|
1382
1383
|
class: "pdap-form",
|
1383
|
-
onSubmit: f[0] || (f[0] = et((g) =>
|
1384
|
+
onSubmit: f[0] || (f[0] = et((g) => c(g), ["prevent"]))
|
1384
1385
|
}, [
|
1385
|
-
typeof
|
1386
|
-
(v(!0), b(ee, null, fe(
|
1386
|
+
typeof i.value == "string" ? (v(), b("div", zr, D(i.value), 1)) : q("", !0),
|
1387
|
+
(v(!0), b(ee, null, fe(p.schema, (g) => {
|
1387
1388
|
var h, o, m, $;
|
1388
1389
|
return v(), A(Tt, de((delete g.validators, g), {
|
1389
1390
|
key: g.name,
|
1390
|
-
error: (h =
|
1391
|
+
error: (h = d(u)[g.name]) != null && h.$error ? ($ = (m = (o = d(u)[g.name]) == null ? void 0 : o.$errors) == null ? void 0 : m[0]) == null ? void 0 : $.$message : "",
|
1391
1392
|
value: a.value[g.name],
|
1392
|
-
onChange: (y) => g.type !==
|
1393
|
-
onInput: (y) => g.type ===
|
1393
|
+
onChange: (y) => g.type !== d(T).TEXT ? l(g.name, y) : void 0,
|
1394
|
+
onInput: (y) => g.type === d(T).TEXT ? l(g.name, y) : void 0
|
1394
1395
|
}), null, 16, ["error", "value", "onChange", "onInput"]);
|
1395
1396
|
}), 128)),
|
1396
|
-
K(
|
1397
|
+
K(p.$slots, "default")
|
1397
1398
|
], 32));
|
1398
1399
|
}
|
1399
1400
|
});
|
@@ -1416,12 +1417,12 @@ const Dr = /* @__PURE__ */ j({
|
|
1416
1417
|
},
|
1417
1418
|
...t.templateColumns && { gridTemplateColumns: t.templateColumns }
|
1418
1419
|
});
|
1419
|
-
return (
|
1420
|
+
return (u, i) => (v(), A(me(u.component), {
|
1420
1421
|
class: G(r),
|
1421
1422
|
style: ge(s)
|
1422
1423
|
}, {
|
1423
1424
|
default: E(() => [
|
1424
|
-
K(
|
1425
|
+
K(u.$slots, "default")
|
1425
1426
|
]),
|
1426
1427
|
_: 3
|
1427
1428
|
}, 8, ["class", "style"]));
|
@@ -1489,11 +1490,11 @@ const qr = /* @__PURE__ */ P("svg", {
|
|
1489
1490
|
window.innerWidth <= 1024 ? r.isMobile = !0 : r.isMobile = !1, await te();
|
1490
1491
|
}
|
1491
1492
|
async function s() {
|
1492
|
-
var
|
1493
|
-
const
|
1494
|
-
!r.isExpanded && r.isMobile ? (r.isExpanded = !0,
|
1493
|
+
var i, l;
|
1494
|
+
const u = document.querySelector("body");
|
1495
|
+
!r.isExpanded && r.isMobile ? (r.isExpanded = !0, u != null && u.classList.contains("lock-scroll") || (i = document.querySelector("body")) == null || i.classList.add("lock-scroll")) : r.isExpanded && r.isMobile && (r.isExpanded = !1, (l = document.querySelector("body")) == null || l.classList.remove("lock-scroll")), await te();
|
1495
1496
|
}
|
1496
|
-
return (
|
1497
|
+
return (u, i) => (v(), b(ee, null, [
|
1497
1498
|
P("div", {
|
1498
1499
|
"aria-controls": "nav",
|
1499
1500
|
class: "pdap-nav-open-button",
|
@@ -1504,9 +1505,9 @@ const qr = /* @__PURE__ */ P("svg", {
|
|
1504
1505
|
id: "nav",
|
1505
1506
|
"aria-expanded": r.isMobile && r.isExpanded || !r.isMobile,
|
1506
1507
|
class: G(n),
|
1507
|
-
style: ge(r.isMobile ? { top: `${
|
1508
|
+
style: ge(r.isMobile ? { top: `${u.topPosition}px` } : {})
|
1508
1509
|
}, [
|
1509
|
-
(v(!0), b(ee, null, fe(
|
1510
|
+
(v(!0), b(ee, null, fe(d(t), (l) => (v(), b("li", {
|
1510
1511
|
key: l.text,
|
1511
1512
|
class: "pdap-nav-link-container"
|
1512
1513
|
}, [
|
@@ -1518,7 +1519,7 @@ const qr = /* @__PURE__ */ P("svg", {
|
|
1518
1519
|
referrerpolicy: "no-referrer",
|
1519
1520
|
onClick: s
|
1520
1521
|
}, D(l.text), 9, Br)) : q("", !0),
|
1521
|
-
l.path ? (v(), A(
|
1522
|
+
l.path ? (v(), A(d(Se), {
|
1522
1523
|
key: 1,
|
1523
1524
|
"active-class": "pdap-nav-link-current",
|
1524
1525
|
"exact-active-class": "pdap-nav-link-current-exact",
|
@@ -1552,19 +1553,19 @@ const Gr = ["href"], Xr = ["src"], Wr = ["src"], Yr = /* @__PURE__ */ j({
|
|
1552
1553
|
function s() {
|
1553
1554
|
n.value && (r.value = n.value.offsetHeight);
|
1554
1555
|
}
|
1555
|
-
return (
|
1556
|
+
return (u, i) => (v(), b("header", {
|
1556
1557
|
ref_key: "el",
|
1557
1558
|
ref: n,
|
1558
1559
|
class: "pdap-header"
|
1559
1560
|
}, [
|
1560
|
-
|
1561
|
+
d(a) ? (v(), A(d(Se), {
|
1561
1562
|
key: 1,
|
1562
|
-
to:
|
1563
|
+
to: u.logoImageAnchorPath,
|
1563
1564
|
class: "logo"
|
1564
1565
|
}, {
|
1565
1566
|
default: E(() => [
|
1566
1567
|
P("img", {
|
1567
|
-
src:
|
1568
|
+
src: u.logoImageSrc,
|
1568
1569
|
loading: "lazy",
|
1569
1570
|
width: "250",
|
1570
1571
|
alt: "Police Data Accessibility Project Logo"
|
@@ -1573,11 +1574,11 @@ const Gr = ["href"], Xr = ["src"], Wr = ["src"], Yr = /* @__PURE__ */ j({
|
|
1573
1574
|
_: 1
|
1574
1575
|
}, 8, ["to"])) : (v(), b("a", {
|
1575
1576
|
key: 0,
|
1576
|
-
href:
|
1577
|
+
href: u.logoImageAnchorPath,
|
1577
1578
|
class: "logo"
|
1578
1579
|
}, [
|
1579
1580
|
P("img", {
|
1580
|
-
src:
|
1581
|
+
src: u.logoImageSrc,
|
1581
1582
|
loading: "lazy",
|
1582
1583
|
width: "250",
|
1583
1584
|
alt: "Police Data Accessibility Project Logo"
|
@@ -1610,17 +1611,21 @@ const en = /* @__PURE__ */ j({
|
|
1610
1611
|
placeholder: "Enter a state, county, municipality, or 'all'",
|
1611
1612
|
value: ""
|
1612
1613
|
}
|
1613
|
-
];
|
1614
|
-
function
|
1615
|
-
|
1616
|
-
|
1617
|
-
|
1614
|
+
], a = x(void 0);
|
1615
|
+
function s(u) {
|
1616
|
+
if (Object.values(u).every((c) => !c)) {
|
1617
|
+
a.value = "Either a search term or a location is required.";
|
1618
|
+
return;
|
1619
|
+
}
|
1620
|
+
let { location: i, searchTerm: l } = u;
|
1621
|
+
if (i = i && i.length > 0 ? i : "all", l = l && l.length > 0 ? l : "all", t.getRoutes().some((c) => c.path.includes("/search/")))
|
1622
|
+
t.push(`/search/${l}/${i}`);
|
1618
1623
|
else {
|
1619
|
-
const
|
1620
|
-
window.location.assign(`${
|
1624
|
+
const c = r.mode === "prod" ? "https://data-sources.pdap.io" : "https://data-sources.pdap.dev";
|
1625
|
+
window.location.assign(`${c}/search/${l}/${i}`);
|
1621
1626
|
}
|
1622
1627
|
}
|
1623
|
-
return (
|
1628
|
+
return (u, i) => (v(), A(ke, {
|
1624
1629
|
alignment: "center",
|
1625
1630
|
component: "div",
|
1626
1631
|
class: "pdap-quick-search-form"
|
@@ -1629,9 +1634,10 @@ const en = /* @__PURE__ */ j({
|
|
1629
1634
|
Y(Mr, {
|
1630
1635
|
id: "quick-search-form",
|
1631
1636
|
class: "small",
|
1637
|
+
error: a.value,
|
1632
1638
|
schema: n,
|
1633
1639
|
name: "quickSearchForm",
|
1634
|
-
onSubmit:
|
1640
|
+
onSubmit: s
|
1635
1641
|
}, {
|
1636
1642
|
default: E(() => [
|
1637
1643
|
Y(nt, { type: "submit" }, {
|
@@ -1642,7 +1648,7 @@ const en = /* @__PURE__ */ j({
|
|
1642
1648
|
})
|
1643
1649
|
]),
|
1644
1650
|
_: 1
|
1645
|
-
})
|
1651
|
+
}, 8, ["error"])
|
1646
1652
|
]),
|
1647
1653
|
_: 1
|
1648
1654
|
}));
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|