pdap-design-system 2.1.7 → 2.1.8
Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.cjs
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),X=require("vue-router"),ce=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 I=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",target:"_blank"},[e.createElementVNode("br"),e.createTextVNode(" Privacy Policy "),e.createElementVNode("i",{class:"fa fa-external-link"})]),e.createElementVNode("br"),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),Se=["href"],Ne=["src"],Ae=["src"],Ie=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 u=e.resolveComponent("router-link");return e.openBlock(),e.createElementBlock("footer",ke,[e.createVNode(I,{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(u,{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(u,{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,Ae)]),_: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,Ne)],8,Se))])]),_: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){Le(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 Le(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 G(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,u){let{$lazy:c,$rewardEarly:l}=o,d=arguments.length>7&&arguments[7]!==void 0?arguments[7]:[],g=arguments.length>8?arguments[8]:void 0,p=arguments.length>9?arguments[9]:void 0,$=arguments.length>10?arguments[10]:void 0;const h=e.ref(!!a.value),i=e.ref(0);n.value=!1;const m=e.watch([r,a].concat(d,$),()=>{if(c&&!a.value||l&&!p.value&&!n.value)return;let f;try{f=de(t,r,g,u)}catch(v){f=Promise.reject(v)}i.value++,n.value=!!i.value,h.value=!1,Promise.resolve(f).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:m}}function Me(t,r,n,a,o,s,u,c){let{$lazy:l,$rewardEarly:d}=a;const g=()=>({}),p=e.computed(()=>{if(l&&!n.value||d&&!c.value)return!1;let $=!0;try{const h=de(t,r,u,s);o.value=h,$=me(h)}catch(h){o.value=h}return $});return{$unwatch:g,$invalid:p}}function Fe(t,r,n,a,o,s,u,c,l,d,g){const p=e.ref(!1),$=t.$params||{},h=e.ref(null);let i,m;t.$async?{$invalid:i,$unwatch:m}=De(t.$validator,r,p,n,a,h,o,t.$watchTargets,l,d,g):{$invalid:i,$unwatch:m}=Me(t.$validator,r,n,a,h,o,l,d);const f=t.$message;return{$message:L(f)?e.computed(()=>f(ee({$pending:p,$invalid:i,$params:ee($),$model:r,$response:h,$validator:s,$propertyPath:c,$property:u}))):f||"",$params:$,$pending:p,$invalid:i,$response:h,$unwatch:m}}function qe(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const r=e.unref(t),n=Object.keys(r),a={},o={},s={};let u=null;return n.forEach(c=>{const l=r[c];switch(!0){case L(l.$validator):a[c]=l;break;case L(l):a[c]={$validator:l};break;case c==="$validationGroups":u=l;break;case c.startsWith("$"):s[c]=l;break;default:o[c]=l}}),{rules:a,nestedValidators:o,config:s,validationGroups:u}}const He="__root";function Ge(t,r,n,a,o,s,u,c,l){const d=Object.keys(t),g=a.get(o,t),p=e.ref(!1),$=e.ref(!1),h=e.ref(0);if(g){if(!g.$partial)return g;g.$unwatch(),p.value=g.$dirty.value}const i={$dirty:p,$path:o,$touch:()=>{p.value||(p.value=!0)},$reset:()=>{p.value&&(p.value=!1)},$commit:()=>{}};return d.length?(d.forEach(m=>{i[m]=Fe(t[m],r,i.$dirty,s,u,m,n,o,l,$,h)}),i.$externalResults=e.computed(()=>c.value?[].concat(c.value).map((m,f)=>({$propertyPath:o,$property:n,$validator:"$externalResults",$uid:`${o}-externalResult-${f}`,$message:m,$params:{},$response:null,$pending:!1})):[]),i.$invalid=e.computed(()=>{const m=d.some(f=>e.unref(i[f].$invalid));return $.value=m,!!i.$externalResults.value.length||m}),i.$pending=e.computed(()=>d.some(m=>e.unref(i[m].$pending))),i.$error=e.computed(()=>i.$dirty.value?i.$pending.value||i.$invalid.value:!1),i.$silentErrors=e.computed(()=>d.filter(m=>e.unref(i[m].$invalid)).map(m=>{const f=i[m];return e.reactive({$propertyPath:o,$property:n,$validator:m,$uid:`${o}-${m}`,$message:f.$message,$params:f.$params,$response:f.$response,$pending:f.$pending})}).concat(i.$externalResults.value)),i.$errors=e.computed(()=>i.$dirty.value?i.$silentErrors.value:[]),i.$unwatch=()=>d.forEach(m=>{i[m].$unwatch()}),i.$commit=()=>{$.value=!0,h.value=Date.now()},a.set(o,t,i),i):(g&&a.set(o,t,i),i)}function Ue(t,r,n,a,o,s,u){const c=Object.keys(t);return c.length?c.reduce((l,d)=>(l[d]=U({validations:t[d],state:r,key:d,parentKey:n,resultsCache:a,globalConfig:o,instance:s,externalResults:u}),l),{}):{}}function Xe(t,r,n){const a=e.computed(()=>[r,n].filter(i=>i).reduce((i,m)=>i.concat(Object.values(e.unref(m))),[])),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)||[],m=a.value.filter(f=>(e.unref(f).$silentErrors||[]).length).reduce((f,v)=>f.concat(...v.$silentErrors),[]);return i.concat(m)}),u=e.computed(()=>{const i=e.unref(t.$errors)||[],m=a.value.filter(f=>(e.unref(f).$errors||[]).length).reduce((f,v)=>f.concat(...v.$errors),[]);return i.concat(m)}),c=e.computed(()=>a.value.some(i=>i.$invalid)||e.unref(t.$invalid)||!1),l=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),g=e.computed(()=>o.value?l.value||c.value:!1),p=()=>{t.$touch(),a.value.forEach(i=>{i.$touch()})},$=()=>{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)&&p(),{$dirty:o,$errors:u,$invalid:c,$anyDirty:d,$error:g,$pending:l,$touch:p,$reset:h,$silentErrors:s,$commit:$}}function U(t){let{validations:r,state:n,key:a,parentKey:o,childResults:s,resultsCache:u,globalConfig:c={},instance:l,externalResults:d}=t;const g=o?`${o}.${a}`:a,{rules:p,nestedValidators:$,config:h,validationGroups:i}=qe(r),m=P(P({},c),h),f=a?e.computed(()=>{const y=e.unref(n);return y?e.unref(y[a]):void 0}):n,v=P({},e.unref(d)||{}),w=e.computed(()=>{const y=e.unref(d);return a?y?e.unref(y[a]):void 0:y}),M=Ge(p,f,a,u,g,m,l,w,n),b=Ue($,f,g,u,m,l,w),V={};i&&Object.entries(i).forEach(y=>{let[O,C]=y;V[O]={$invalid:G(C,b,"$invalid"),$error:G(C,b,"$error"),$pending:G(C,b,"$pending"),$errors:te(C,b,"$errors"),$silentErrors:te(C,b,"$silentErrors")}});const{$dirty:E,$errors:N,$invalid:F,$anyDirty:ye,$error:_e,$pending:q,$touch:H,$reset:be,$silentErrors:we,$commit:J}=Xe(M,b,s),xe=a?e.computed({get:()=>e.unref(f),set:y=>{E.value=!0;const O=e.unref(n),C=e.unref(d);C&&(C[a]=v[a]),e.isRef(O[a])?O[a].value=y:O[a]=y}}):null;a&&m.$autoDirty&&e.watch(f,()=>{E.value||H();const y=e.unref(d);y&&(y[a]=v[a])},{flush:"sync"});async function Ee(){return H(),m.$rewardEarly&&(J(),await e.nextTick()),await e.nextTick(),new Promise(y=>{if(!q.value)return y(!F.value);const O=e.watch(q,()=>{y(!F.value),O()})})}function Ce(y){return(s.value||{})[y]}function Pe(){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({},M),{},{$model:xe,$dirty:E,$error:_e,$errors:N,$invalid:F,$anyDirty:ye,$pending:q,$touch:H,$reset:be,$path:g||He,$silentErrors:we,$validate:Ee,$commit:J},s&&{$getResultsForChild:Ce,$clearExternalResults:Pe,$validationGroups:V}),b))}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(l=>e.unref(a[c].$params[l])===e.unref(n[c].$params[l])):!0)}get(r,n){const a=this.storage.get(r);if(!a)return;const{rules:o,result:s}=a,u=this.checkRulesValidity(r,n,o),c=s.$unwatch?s.$unwatch:()=>({});return u?s:{$dirty:s.$dirty,$partial:!0,$unwatch:c}}}const A={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((g,p)=>(g[p]=e.unref(a[p]),g),{}));function u(g,p){let{$registerAs:$,$scope:h,$stopPropagation:i}=p;i||r===A.COLLECT_NONE||h===A.COLLECT_NONE||r!==A.COLLECT_ALL&&r!==h||(a[$]=g,o.value.push($))}n.__vuelidateInjectInstances=[].concat(n.__vuelidateInjectInstances||[],u);function c(g){o.value=o.value.filter(p=>p!==g),delete a[g]}n.__vuelidateRemoveInstances=[].concat(n.__vuelidateRemoveInstances||[],c);const l=e.inject(re,[]);e.provide(re,n.__vuelidateInjectInstances);const d=e.inject(ne,[]);return e.provide(ne,n.__vuelidateRemoveInstances),{childResults:s,sendValidationResultsToParent:l,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=A.COLLECT_ALL,$stopPropagation:u,$externalResults:c,currentVueInstance:l}=a;const d=l||((n=e.getCurrentInstance())===null||n===void 0?void 0:n.proxy),g=d?d.$options:{};o||(ae+=1,o=`_vuelidate_${ae}`);const p=e.ref({}),$=new We,{childResults:h,sendValidationResultsToParent:i,removeValidationResultsFromParent:m}=d?Ke({$scope:s,instance:d}):{childResults:e.ref({})};if(!t&&g.validations){const f=g.validations;r=e.ref({}),e.onBeforeMount(()=>{r.value=d,e.watch(()=>L(f)?f.call(r.value,new pe(r.value)):f,v=>{p.value=U({validations:v,state:r,childResults:h,resultsCache:$,globalConfig:a,instance:d,externalResults:c||d.vuelidateExternalResults})},{immediate:!0})}),a=g.validationsConfig||a}else{const f=e.isRef(t)||ze(t)?t:e.reactive(t||{});e.watch(f,v=>{p.value=U({validations:v,state:r,childResults:h,resultsCache:$,globalConfig:a,instance:d??{},externalResults:c})},{immediate:!0})}return d&&(i.forEach(f=>f(p,{$registerAs:o,$scope:s,$stopPropagation:u})),e.onBeforeUnmount(()=>m.forEach(f=>f(o)))),e.computed(()=>P(P({},e.unref(p.value)),h.value))}var x=(t=>(t.CHECKBOX="checkbox",t.TEXT="text",t))(x||{});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=()=>{u.value=!u.value,a("change",u.value.toString())},s=l=>{a("input",l.target.value)},u=e.ref(n.defaultChecked),c=e.computed(()=>`pdap-${n.name}-input-error`);return(l,d)=>{var g;return e.openBlock(),e.createBlock(e.unref($e),{class:e.normalizeClass({"pdap-input":!0,"pdap-input-error":Number((g=l.error)==null?void 0:g.length)>=1})},{default:e.withCtx(()=>[l.type===e.unref(x).TEXT?(e.openBlock(),e.createElementBlock("input",e.mergeProps({key:0,id:l.id,type:"text",name:l.name,placeholder:l.placeholder,value:l.value},l.$attrs,{onInput:s}),null,16,Ze)):l.type===e.unref(x).CHECKBOX?(e.openBlock(),e.createElementBlock("input",e.mergeProps({key:1,id:l.id,class:"pdap-input-checkbox",name:l.name,checked:u.value,type:"checkbox",value:l.value},l.$attrs,{onChange:o}),null,16,Je)):e.createCommentVNode("",!0),l.error?(e.openBlock(),e.createElementBlock("div",{key:2,id:c.value,class:"pdap-input-error-message"},e.toDisplayString(l.error),9,Ye)):e.createCommentVNode("",!0),e.createElementVNode("label",{class:"pdap-input-label",for:l.id},e.toDisplayString(l.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 z(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function D(t){return T(t.$validator)?j({},t):{$validator:t}}function rt(t){return z(t)&&T(t.then)}function k(t){return typeof t=="object"?t.$valid:t}function B(t){return t.$validator||t}function W(t,r){if(!z(t))throw new Error(`[@vuelidate/validators]: First parameter to "withParams" should be an object, provided ${typeof t}`);if(!z(r)&&!T(r))throw new Error("[@vuelidate/validators]: Validator must be a function or object with $validator parameter");const n=D(r);return n.$params=j(j({},n.$params||{}),t),n}function S(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(!z(r)&&!T(r))throw new Error("[@vuelidate/validators]: Validator must be a function or object with $validator parameter");const n=D(r);return n.$message=t,n}function nt(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];const n=D(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,u,c)=>{const l=Object.entries(u).reduce((d,g)=>{let[p,$]=g;const h=t[p]||{},i=Object.entries(h).reduce((m,f)=>{let[v,w]=f;const b=B(w).call(this,$,u,c,...a),V=k(b);if(m.$data[v]=b,m.$data.$invalid=!V||!!m.$data.$invalid,m.$data.$error=m.$data.$invalid,!V){let E=w.$message||"";const N=w.$params||{};typeof E=="function"&&(E=E({$pending:!1,$invalid:!V,$params:N,$model:$,$response:b})),m.$errors.push({$property:p,$message:E,$params:N,$response:b,$model:$,$pending:!1,$validator:v})}return{$valid:m.$valid&&V,$data:m.$data,$errors:m.$errors}},{$valid:!0,$data:{},$errors:[]});return d.$data[p]=i.$data,d.$errors[p]=i.$errors,{$valid:d.$valid&&i.$valid,$data:d.$data,$errors:d.$errors}},{$valid:!0,$data:{},$errors:{}});return{$valid:s.$valid&&l.$valid,$data:s.$data.concat(l.$data),$errors:s.$errors.concat(l.$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 R(){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:D,regex:R,req:_,unwrap:e.unref,unwrapNormalizedValidator:B,unwrapValidatorResponse:k,withAsync:nt,withMessage:S,withParams:W}),ot=R(/^[a-zA-Z]*$/),st={$validator:ot,$message:"The value is not alphabetical",$params:{type:"alpha"}},lt=R(/^[a-zA-Z0-9]*$/),it={$validator:lt,$message:"The value must be alpha-numeric",$params:{type:"alphaNum"}},ct=R(/^\d*(\.\d+)?$/),ut={$validator:ct,$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=R(pt),gt={$validator:ft,$message:"Value is not a valid email address",$params:{type:"email"}};function ht(t){if(!_(t))return!0;if(typeof t!="string")return!1;const r=t.split(".");return r.length===4&&r.every($t)}const $t=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:ht,$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 bt(t){return{$validator:yt(t),$message:"The value is not a valid MAC Address",$params:{type:"macAddress"}}}function wt(t){return r=>!_(r)||K(r)<=e.unref(t)}function xt(t){return{$validator:wt(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 Ct(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 Pt(t){return typeof t=="string"&&(t=t.trim()),_(t)}var Z={$validator:Pt,$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 le=(t,r)=>t?!0:_(typeof r=="string"?r.trim():r);function Vt(t){return function(r,n){if(typeof t!="function")return le(e.unref(t),r);const a=t.call(this,r,n);return le(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 St=R(Tt),Nt={$validator:St,$message:"The value is not a valid URL address",$params:{type:"url"}};function At(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)=>k(o)?o:B(s).apply(this,n),!1)}}function It(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 u=await o;return k(u)?u:B(s).apply(this,n)},Promise.resolve(!1))}}function Lt(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];const a=r.some(u=>u.$async),o=r.reduce((u,c)=>c.$watchTargets?u.concat(c.$watchTargets):u,[]);let s=()=>!1;return r.length&&(s=a?It(r):At(r)),{$async:a,$validator:s,$watchTargets:o}}function zt(){return W({type:"or"},S("The value does not match any of the provided validators",Lt(...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)=>k(o)?B(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 u=await o;return k(u)?B(s).apply(this,n):u},Promise.resolve(!0))}}function Ft(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];const a=r.some(u=>u.$async),o=r.reduce((u,c)=>c.$watchTargets?u.concat(c.$watchTargets):u,[]);let s=()=>!1;return r.length&&(s=a?Mt(r):Dt(r)),{$async:a,$validator:s,$watchTargets:o}}function qt(){return W({type:"and"},S("The value does not match all of the provided validators",Ft(...arguments)))}function Ht(t){return function(r,n){if(!_(r))return!0;const a=B(t).call(this,r,n);return rt(a)?a.then(o=>!k(o)):!k(a)}}function Gt(t){return{$validator:Ht(t),$message:"The value does not match the provided validator",$params:{type:"not"}}}function Ut(t){return r=>!_(r)||(!/\s/.test(r)||r instanceof Date)&&+r>=+e.unref(t)}function Xt(t){return{$validator:Ut(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=R(/(^[0-9]*$)|(^-[0-9]+$)/),Zt={$validator:Qt,$message:"Value is not an integer",$params:{type:"integer"}},Jt=R(/^[-]?\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:u=!1,messagePath:c=n,messageParams:l=a}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};function d(g){return r(c(g),l(j({model:g.$model,property:g.$property,pending:g.$pending,invalid:g.$invalid,response:g.$response,validator:g.$validator,propertyPath:g.$propertyPath},g.$params)))}return u&&typeof s=="function"?function(){return S(d,s(...arguments))}:S(d,s)}}const ge=Object.freeze(Object.defineProperty({__proto__:null,alpha:st,alphaNum:it,and:qt,between:mt,createI18nMessage:er,decimal:Yt,email:gt,helpers:Q,integer:Zt,ipAddress:vt,macAddress:bt,maxLength:xt,maxValue:Kt,minLength:Ct,minValue:Xt,not:Gt,numeric:ut,or:zt,required:Z,requiredIf:Rt,requiredUnless:Ot,sameAs:jt,url:Nt},Symbol.toStringTag,{value:"Module"}));function ie(t){return["maxLength","minLength"].includes(t)}function tr(t,r){return{[t]:ge[t](r)}}function rr(t,r,n){return{[t]:Q.withMessage(n,ge[t](r))}}function nr(){return{required:Z}}function ar(t){return{required:Q.withMessage(t,Z)}}function or(t,r){if(ie(t)&&typeof r.message=="string"&&typeof r.value=="number")return rr(t,r.value,r.message);if(ie(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"},he=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.map(p=>{const $={...p};return delete $.validators,$})),s=e.ref(n.schema.reduce((p,$)=>{switch($.type){case x.CHECKBOX:return{...p,[$.name]:String($.defaultChecked)};case x.TEXT:default:return{...p,[$.name]:$.value}}},{})),u=n.schema.reduce((p,$)=>{const h=Object.entries($.validators??{}).reduce((i,[m,f])=>({...i,...or(m,f)}),{});return{...p,[$.name]:{...h}}},{}),c=Qe(u,s,{$autoDirty:!1,$lazy:!0}),l=e.ref(n.error);function d(p,$){s.value[p]=$}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
2
|
`,{errorMessage:l.value,props:n,values:s,vuelidate:{rules:u,v$:c}})});async function g(p){if(await c.value.$validate()){a("submit",{...s.value}),c.value.$reset(),p.target.reset(),s.value=Object.entries(s.value).reduce((i,[m,f])=>({...i,[m]:["true","false"].includes(f)?f:""}),{});return}}return(p,$)=>(e.openBlock(),e.createElementBlock("form",{class:"pdap-form",onSubmit:$[0]||($[0]=e.withModifiers(h=>g(h),["prevent"]))},[typeof l.value=="string"?(e.openBlock(),e.createElementBlock("div",sr,e.toDisplayString(l.value),1)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,h=>{var i,m,f,v;return e.openBlock(),e.createBlock(fe,e.mergeProps(h,{key:h.name,error:(i=e.unref(c)[h.name])!=null&&i.$error?(v=(f=(m=e.unref(c)[h.name])==null?void 0:m.$errors)==null?void 0:f[0])==null?void 0:v.$message:"",value:s.value[h.name],onChange:w=>h.type!==e.unref(x).TEXT?d(h.name,w):void 0,onInput:w=>h.type===e.unref(x).TEXT?d(h.name,w):void 0}),null,16,["error","value","onChange","onInput"])}),128)),e.renderSlot(p.$slots,"default")],32))}});const $e=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(u,c)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.component),{class:e.normalizeClass(n),style:e.normalizeStyle(s)},{default:e.withCtx(()=>[e.renderSlot(u.$slots,"default")]),_:3},8,["class","style"]))}});const lr=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 ir=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),cr=[ir],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,l;const u=document.querySelector("body");!n.isExpanded&&n.isMobile?(n.isExpanded=!0,u!=null&&u.classList.contains("lock-scroll")||(c=document.querySelector("body"))==null||c.classList.add("lock-scroll")):n.isExpanded&&n.isMobile&&(n.isExpanded=!1,(l=document.querySelector("body"))==null||l.classList.remove("lock-scroll")),await e.nextTick()}return(u,c)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{"aria-controls":"nav",class:"pdap-nav-open-button",role:"button",onClick:s},cr),e.createElementVNode("nav",{id:"nav","aria-expanded":n.isMobile&&n.isExpanded||!n.isMobile,class:e.normalizeClass(a),style:e.normalizeStyle(n.isMobile?{top:`${u.topPosition}px`}:{})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),l=>(e.openBlock(),e.createElementBlock("li",{key:l.text,class:"pdap-nav-link-container"},[l.href?(e.openBlock(),e.createElementBlock("a",{key:0,class:"pdap-nav-link",href:l.href,target:"_blank",referrerpolicy:"no-referrer",onClick:s},e.toDisplayString(l.text),9,dr)):e.createCommentVNode("",!0),l.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:l.path,onClick:s},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.text),1)]),_:2},1032,["to"])):e.createCommentVNode("",!0)]))),128))],14,ur)],64))}});const mr=["href"],pr=["src"],fr=["src"],gr=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(u,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:u.logoImageAnchorPath,class:"logo"},{default:e.withCtx(()=>[e.createElementVNode("img",{src:u.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:u.logoImageAnchorPath,class:"logo"},[e.createElementVNode("img",{src:u.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 hr=e.createElementVNode("h2",{class:"mt-0"},"Search our database",-1),$r=e.createElementVNode("p",{class:"pb-4 md:pb-8"},[e.createTextVNode(" If you have a question to answer, we may already know about helpful data in your area. "),e.createElementVNode("a",{href:"https://pdap.io/data"},"Learn more about the data here.")],-1),vr=e.defineComponent({__name:"QuickSearchForm",props:{
|
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,l;const u=document.querySelector("body");!n.isExpanded&&n.isMobile?(n.isExpanded=!0,u!=null&&u.classList.contains("lock-scroll")||(c=document.querySelector("body"))==null||c.classList.add("lock-scroll")):n.isExpanded&&n.isMobile&&(n.isExpanded=!1,(l=document.querySelector("body"))==null||l.classList.remove("lock-scroll")),await e.nextTick()}return(u,c)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{"aria-controls":"nav",class:"pdap-nav-open-button",role:"button",onClick:s},cr),e.createElementVNode("nav",{id:"nav","aria-expanded":n.isMobile&&n.isExpanded||!n.isMobile,class:e.normalizeClass(a),style:e.normalizeStyle(n.isMobile?{top:`${u.topPosition}px`}:{})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),l=>(e.openBlock(),e.createElementBlock("li",{key:l.text,class:"pdap-nav-link-container"},[l.href?(e.openBlock(),e.createElementBlock("a",{key:0,class:"pdap-nav-link",href:l.href,target:"_blank",referrerpolicy:"no-referrer",onClick:s},e.toDisplayString(l.text),9,dr)):e.createCommentVNode("",!0),l.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:l.path,onClick:s},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.text),1)]),_:2},1032,["to"])):e.createCommentVNode("",!0)]))),128))],14,ur)],64))}});const mr=["href"],pr=["src"],fr=["src"],gr=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(u,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:u.logoImageAnchorPath,class:"logo"},{default:e.withCtx(()=>[e.createElementVNode("img",{src:u.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:u.logoImageAnchorPath,class:"logo"},[e.createElementVNode("img",{src:u.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 hr=e.createElementVNode("h2",{class:"mt-0"},"Search our database",-1),$r=e.createElementVNode("p",{class:"pb-4 md:pb-8"},[e.createTextVNode(" If you have a question to answer, we may already know about helpful data in your area. "),e.createElementVNode("a",{href:"https://pdap.io/data"},"Learn more about the data here.")],-1),vr=e.defineComponent({__name:"QuickSearchForm",props:{baseUrlForRedirect:{default:"https://data-sources.pdap.io"}},setup(t){const r=X.useRouter(),n=t,a=[{id:"search-term",name:"searchTerm",label:"What are you looking for?",type:x.TEXT,placeholder:"Enter a keyword, or 'all'",value:""},{id:"location",name:"location",label:"From where?",type:x.TEXT,placeholder:"Enter a place, or 'all'",value:""}],o=e.ref(void 0);function s(u){if(Object.values(u).every(d=>!d)){o.value="Either a search term or a location is required.";return}let{location:c,searchTerm:l}=u;c=c&&c.length>0?c:"all",l=l&&l.length>0?l:"all",r.getRoutes().some(d=>d.path.includes("/search/"))?r.push(`/search/${l}/${c}`):window.location.assign(`${n.baseUrlForRedirect}/search/${l}/${c}`)}return(u,c)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(I,{class:"p-0"},{default:e.withCtx(()=>[hr,$r]),_:1}),e.createVNode(I,{alignment:"center",class:"pdap-quick-search-form h-full max-h-[75-vh] justify-start p-0"},{default:e.withCtx(()=>[e.createVNode(he,{id:"quick-search-form",class:"flex flex-wrap gap-x-4",error:o.value,schema:a,name:"quickSearchForm",onSubmit:s},{default:e.withCtx(()=>[e.createVNode(ce,{type:"submit",class:"flex-grow-0 flex-shrink-0 basis-full max-w-[unset] mt-4"},{default:e.withCtx(()=>[e.createTextVNode("Search Data Sources")]),_:1})]),_:1},8,["error"])]),_:1})],64))}});const yr=["alt","src"],_r=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,yr))}});const br={content:["./src/**/*.vue","./src/**/*.css"],theme:{extend:{colors:{brand:{blue:{light:"rgba(var(--color-brand-blue-light)/<alpha-value>)",medium:"rgba(var(--color-brand-blue-medium)/<alpha-value>)"},gold:"rgba(var(--color-brand-gold)/<alpha-value>)",wine:"rgba(var(--color-brand-wine)/<alpha-value>)"},neutral:{50:"rgba(var(--color-neutral-50)/<alpha-value>)",100:"rgba(var(--color-neutral-100)/<alpha-value>)",200:"rgba(var(--color-neutral-200)/<alpha-value>)",300:"rgba(var(--color-neutral-300)/<alpha-value>)",400:"rgba(var(--color-neutral-400)/<alpha-value>)",500:"rgba(var(--color-neutral-500)/<alpha-value>)",600:"rgba(var(--color-neutral-600)/<alpha-value>)",700:"rgba(var(--color-neutral-700)/<alpha-value>)",800:"rgba(var(--color-neutral-800)/<alpha-value>)",900:"rgba(var(--color-neutral-900)/<alpha-value>)",950:"rgba(var(--color-neutral-950)/<alpha-value>)"}},brightness:{85:".85"},maxWidth:{"4xl":"59rem"},screens:{xs:"500px"}},fontFamily:{sans:['"Libre Franklin"',"ui-sans-serif","system-ui","-apple-system","BlinkMacSystemFont",'"Segoe UI"',"Roboto","Oxygen","Ubuntu","Cantarell",'"Fira Sans"','"Droid Sans"','"Helvetica Neue"',"sans-serif"],serif:["ui-serif","Georgia"],mono:['"Source Code Pro"',"monospace","ui-monospace","SFMono-Regular"]},fontSize:{xs:"0.75rem",sm:"0.875rem",med:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.75rem","4xl":"2rem","5xl":"2.625rem","6xl":"3rem"}}},wr=Object.freeze(Object.defineProperty({__proto__:null,default:br},Symbol.toStringTag,{value:"Module"}));exports.Button=ce;exports.FlexContainer=I;exports.Footer=Ie;exports.Form=he;exports.GridContainer=$e;exports.GridItem=lr;exports.Header=gr;exports.Input=fe;exports.Nav=ve;exports.PdapInputTypes=x;exports.QuickSearchForm=vr;exports.TileIcon=_r;exports.tailwindConfig=wr;
|
package/dist/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineComponent as j, reactive as C, openBlock as v, createElementBlock as x, normalizeClass as X, renderSlot as Z, createBlock as S, resolveDynamicComponent as fe, withCtx as R, inject as ee, resolveComponent as Qe, createVNode as H, createElementVNode as b, Fragment as
|
1
|
+
import { defineComponent as j, reactive as C, openBlock as v, createElementBlock as x, normalizeClass as X, renderSlot as Z, createBlock as S, resolveDynamicComponent as fe, withCtx as R, inject as ee, resolveComponent as Qe, createVNode as H, createElementVNode as b, Fragment as U, renderList as ge, unref as d, toDisplayString as F, createCommentVNode as q, createTextVNode as N, getCurrentInstance as Ze, ref as P, onBeforeMount as Ve, watch as W, isRef as ce, onBeforeUnmount as $e, computed as _, isReactive as Je, isReadonly as Ye, provide as xe, nextTick as te, mergeProps as de, watchEffect as Pe, withModifiers as et, normalizeStyle as he, onMounted as tt } from "vue";
|
2
2
|
import { RouterLink as ke, useRouter as rt } from "vue-router";
|
3
3
|
const at = /* @__PURE__ */ j({
|
4
4
|
__name: "PdapButton",
|
@@ -92,7 +92,7 @@ const nt = { class: "pdap-footer" }, st = { class: "pdap-footer-social-links" },
|
|
92
92
|
H(pe, { alignment: "center" }, {
|
93
93
|
default: R(() => [
|
94
94
|
b("ul", st, [
|
95
|
-
(v(!0), x(
|
95
|
+
(v(!0), x(U, null, ge(d(r), (l) => (v(), x("li", {
|
96
96
|
key: l.text,
|
97
97
|
class: "pdap-footer-link-container"
|
98
98
|
}, [
|
@@ -230,7 +230,7 @@ function $t(e, t, r, a, n, s, u) {
|
|
230
230
|
} = n, c = arguments.length > 7 && arguments[7] !== void 0 ? arguments[7] : [], g = arguments.length > 8 ? arguments[8] : void 0, m = arguments.length > 9 ? arguments[9] : void 0, h = arguments.length > 10 ? arguments[10] : void 0;
|
231
231
|
const $ = P(!!a.value), i = P(0);
|
232
232
|
r.value = !1;
|
233
|
-
const p =
|
233
|
+
const p = W([t, a].concat(c, h), () => {
|
234
234
|
if (l && !a.value || o && !m.value && !r.value)
|
235
235
|
return;
|
236
236
|
let f;
|
@@ -493,23 +493,23 @@ function me(e) {
|
|
493
493
|
L && (L[a] = y[a]), ce(D[a]) ? D[a].value = w : D[a] = w;
|
494
494
|
}
|
495
495
|
}) : null;
|
496
|
-
a && p.$autoDirty &&
|
496
|
+
a && p.$autoDirty && W(f, () => {
|
497
497
|
I.value || le();
|
498
498
|
const w = d(c);
|
499
499
|
w && (w[a] = y[a]);
|
500
500
|
}, {
|
501
501
|
flush: "sync"
|
502
502
|
});
|
503
|
-
async function
|
503
|
+
async function Ue() {
|
504
504
|
return le(), p.$rewardEarly && (we(), await te()), await te(), new Promise((w) => {
|
505
505
|
if (!ie.value)
|
506
506
|
return w(!oe.value);
|
507
|
-
const D =
|
507
|
+
const D = W(ie, () => {
|
508
508
|
w(!oe.value), D();
|
509
509
|
});
|
510
510
|
});
|
511
511
|
}
|
512
|
-
function
|
512
|
+
function We(w) {
|
513
513
|
return (s.value || {})[w];
|
514
514
|
}
|
515
515
|
function Ke() {
|
@@ -529,10 +529,10 @@ function me(e) {
|
|
529
529
|
$reset: He,
|
530
530
|
$path: g || _t,
|
531
531
|
$silentErrors: Ge,
|
532
|
-
$validate:
|
532
|
+
$validate: Ue,
|
533
533
|
$commit: we
|
534
534
|
}, s && {
|
535
|
-
$getResultsForChild:
|
535
|
+
$getResultsForChild: We,
|
536
536
|
$clearExternalResults: Ke,
|
537
537
|
$validationGroups: M
|
538
538
|
}), E));
|
@@ -632,7 +632,7 @@ function Ot(e, t) {
|
|
632
632
|
if (!e && g.validations) {
|
633
633
|
const f = g.validations;
|
634
634
|
t = P({}), Ve(() => {
|
635
|
-
t.value = c,
|
635
|
+
t.value = c, W(() => re(f) ? f.call(t.value, new Fe(t.value)) : f, (y) => {
|
636
636
|
m.value = me({
|
637
637
|
validations: y,
|
638
638
|
state: t,
|
@@ -648,7 +648,7 @@ function Ot(e, t) {
|
|
648
648
|
}), a = g.validationsConfig || a;
|
649
649
|
} else {
|
650
650
|
const f = ce(e) || gt(e) ? e : C(e || {});
|
651
|
-
|
651
|
+
W(f, (y) => {
|
652
652
|
m.value = me({
|
653
653
|
validations: y,
|
654
654
|
state: t,
|
@@ -950,22 +950,22 @@ var Gt = z(Ht), Xt = {
|
|
950
950
|
type: "email"
|
951
951
|
}
|
952
952
|
};
|
953
|
-
function
|
953
|
+
function Ut(e) {
|
954
954
|
if (!O(e))
|
955
955
|
return !0;
|
956
956
|
if (typeof e != "string")
|
957
957
|
return !1;
|
958
958
|
const t = e.split(".");
|
959
|
-
return t.length === 4 && t.every(
|
959
|
+
return t.length === 4 && t.every(Wt);
|
960
960
|
}
|
961
|
-
const
|
961
|
+
const Wt = (e) => {
|
962
962
|
if (e.length > 3 || e.length === 0 || e[0] === "0" && e !== "0" || !e.match(/^\d+$/))
|
963
963
|
return !1;
|
964
964
|
const t = +e | 0;
|
965
965
|
return t >= 0 && t <= 255;
|
966
966
|
};
|
967
967
|
var Kt = {
|
968
|
-
$validator:
|
968
|
+
$validator: Ut,
|
969
969
|
$message: "The value is not a valid IP address",
|
970
970
|
$params: {
|
971
971
|
type: "ipAddress"
|
@@ -1394,7 +1394,7 @@ const zr = {
|
|
1394
1394
|
onSubmit: h[0] || (h[0] = et(($) => g($), ["prevent"]))
|
1395
1395
|
}, [
|
1396
1396
|
typeof o.value == "string" ? (v(), x("div", zr, F(o.value), 1)) : q("", !0),
|
1397
|
-
(v(!0), x(
|
1397
|
+
(v(!0), x(U, null, ge(n.value, ($) => {
|
1398
1398
|
var i, p, f, y;
|
1399
1399
|
return v(), S(Tt, de($, {
|
1400
1400
|
key: $.name,
|
@@ -1504,7 +1504,7 @@ const Fr = /* @__PURE__ */ b("svg", {
|
|
1504
1504
|
const u = document.querySelector("body");
|
1505
1505
|
!r.isExpanded && r.isMobile ? (r.isExpanded = !0, u != null && u.classList.contains("lock-scroll") || (l = document.querySelector("body")) == null || l.classList.add("lock-scroll")) : r.isExpanded && r.isMobile && (r.isExpanded = !1, (o = document.querySelector("body")) == null || o.classList.remove("lock-scroll")), await te();
|
1506
1506
|
}
|
1507
|
-
return (u, l) => (v(), x(
|
1507
|
+
return (u, l) => (v(), x(U, null, [
|
1508
1508
|
b("div", {
|
1509
1509
|
"aria-controls": "nav",
|
1510
1510
|
class: "pdap-nav-open-button",
|
@@ -1517,7 +1517,7 @@ const Fr = /* @__PURE__ */ b("svg", {
|
|
1517
1517
|
class: X(a),
|
1518
1518
|
style: he(r.isMobile ? { top: `${u.topPosition}px` } : {})
|
1519
1519
|
}, [
|
1520
|
-
(v(!0), x(
|
1520
|
+
(v(!0), x(U, null, ge(d(t), (o) => (v(), x("li", {
|
1521
1521
|
key: o.text,
|
1522
1522
|
class: "pdap-nav-link-container"
|
1523
1523
|
}, [
|
@@ -1547,7 +1547,7 @@ const Fr = /* @__PURE__ */ b("svg", {
|
|
1547
1547
|
], 64));
|
1548
1548
|
}
|
1549
1549
|
});
|
1550
|
-
const Gr = ["href"], Xr = ["src"],
|
1550
|
+
const Gr = ["href"], Xr = ["src"], Ur = ["src"], ra = /* @__PURE__ */ j({
|
1551
1551
|
__name: "PdapHeader",
|
1552
1552
|
props: {
|
1553
1553
|
logoImageSrc: { default: "node_modules/pdap-design-system/dist/images/lockup.svg" },
|
@@ -1579,7 +1579,7 @@ const Gr = ["href"], Xr = ["src"], Wr = ["src"], ra = /* @__PURE__ */ j({
|
|
1579
1579
|
loading: "lazy",
|
1580
1580
|
width: "250",
|
1581
1581
|
alt: "Police Data Accessibility Project Logo"
|
1582
|
-
}, null, 8,
|
1582
|
+
}, null, 8, Ur)
|
1583
1583
|
]),
|
1584
1584
|
_: 1
|
1585
1585
|
}, 8, ["to"])) : (v(), x("a", {
|
@@ -1598,13 +1598,13 @@ const Gr = ["href"], Xr = ["src"], Wr = ["src"], ra = /* @__PURE__ */ j({
|
|
1598
1598
|
], 512));
|
1599
1599
|
}
|
1600
1600
|
});
|
1601
|
-
const
|
1601
|
+
const Wr = /* @__PURE__ */ b("h2", { class: "mt-0" }, "Search our database", -1), Kr = /* @__PURE__ */ b("p", { class: "pb-4 md:pb-8" }, [
|
1602
1602
|
/* @__PURE__ */ N(" If you have a question to answer, we may already know about helpful data in your area. "),
|
1603
1603
|
/* @__PURE__ */ b("a", { href: "https://pdap.io/data" }, "Learn more about the data here.")
|
1604
1604
|
], -1), aa = /* @__PURE__ */ j({
|
1605
1605
|
__name: "QuickSearchForm",
|
1606
1606
|
props: {
|
1607
|
-
|
1607
|
+
baseUrlForRedirect: { default: "https://data-sources.pdap.io" }
|
1608
1608
|
},
|
1609
1609
|
setup(e) {
|
1610
1610
|
const t = rt(), r = e, a = [
|
@@ -1631,17 +1631,14 @@ const Ur = /* @__PURE__ */ b("h2", { class: "mt-0" }, "Search our database", -1)
|
|
1631
1631
|
return;
|
1632
1632
|
}
|
1633
1633
|
let { location: l, searchTerm: o } = u;
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
const c = r.mode === "prod" ? "https://data-sources.pdap.io" : "https://data-sources.pdap.dev";
|
1638
|
-
window.location.assign(`${c}/search/${o}/${l}`);
|
1639
|
-
}
|
1634
|
+
l = l && l.length > 0 ? l : "all", o = o && o.length > 0 ? o : "all", t.getRoutes().some((c) => c.path.includes("/search/")) ? t.push(`/search/${o}/${l}`) : window.location.assign(
|
1635
|
+
`${r.baseUrlForRedirect}/search/${o}/${l}`
|
1636
|
+
);
|
1640
1637
|
}
|
1641
|
-
return (u, l) => (v(), x(
|
1638
|
+
return (u, l) => (v(), x(U, null, [
|
1642
1639
|
H(pe, { class: "p-0" }, {
|
1643
1640
|
default: R(() => [
|
1644
|
-
|
1641
|
+
Wr,
|
1645
1642
|
Kr
|
1646
1643
|
]),
|
1647
1644
|
_: 1
|
@@ -1,13 +1,13 @@
|
|
1
1
|
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
2
|
-
|
2
|
+
baseUrlForRedirect: string;
|
3
3
|
}>, {
|
4
|
-
|
4
|
+
baseUrlForRedirect: string;
|
5
5
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
6
|
-
|
6
|
+
baseUrlForRedirect: string;
|
7
7
|
}>, {
|
8
|
-
|
8
|
+
baseUrlForRedirect: string;
|
9
9
|
}>>>, {
|
10
|
-
|
10
|
+
baseUrlForRedirect: string;
|
11
11
|
}, {}>;
|
12
12
|
export default _default;
|
13
13
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|