@observablehq/stdlib
Advanced tools
Comparing version 3.20.0 to 3.21.0
@@ -1,2 +0,2 @@ | ||
// @observablehq/stdlib v3.20.0 Copyright 2022 Observable, Inc. | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).observablehq=e.observablehq||{})}(this,(function(e){"use strict";var t={},n={};function r(e){return new Function("d","return {"+e.map((function(e,t){return JSON.stringify(e)+": d["+t+'] || ""'})).join(",")+"}")}function o(e){var t=Object.create(null),n=[];return e.forEach((function(e){for(var r in e)r in t||n.push(t[r]=r)})),n}function a(e,t){var n=e+"",r=n.length;return r<t?new Array(t-r+1).join(0)+n:n}function i(e){var t,n=e.getUTCHours(),r=e.getUTCMinutes(),o=e.getUTCSeconds(),i=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":((t=e.getUTCFullYear())<0?"-"+a(-t,6):t>9999?"+"+a(t,6):a(t,4))+"-"+a(e.getUTCMonth()+1,2)+"-"+a(e.getUTCDate(),2)+(i?"T"+a(n,2)+":"+a(r,2)+":"+a(o,2)+"."+a(i,3)+"Z":o?"T"+a(n,2)+":"+a(r,2)+":"+a(o,2)+"Z":r||n?"T"+a(n,2)+":"+a(r,2)+"Z":"")}function s(e){var a=new RegExp('["'+e+"\n\r]"),s=e.charCodeAt(0);function c(e,r){var o,a=[],i=e.length,c=0,l=0,u=i<=0,f=!1;function d(){if(u)return n;if(f)return f=!1,t;var r,o,a=c;if(34===e.charCodeAt(a)){for(;c++<i&&34!==e.charCodeAt(c)||34===e.charCodeAt(++c););return(r=c)>=i?u=!0:10===(o=e.charCodeAt(c++))?f=!0:13===o&&(f=!0,10===e.charCodeAt(c)&&++c),e.slice(a+1,r-1).replace(/""/g,'"')}for(;c<i;){if(10===(o=e.charCodeAt(r=c++)))f=!0;else if(13===o)f=!0,10===e.charCodeAt(c)&&++c;else if(o!==s)continue;return e.slice(a,r)}return u=!0,e.slice(a,i)}for(10===e.charCodeAt(i-1)&&--i,13===e.charCodeAt(i-1)&&--i;(o=d())!==n;){for(var h=[];o!==t&&o!==n;)h.push(o),o=d();r&&null==(h=r(h,l++))||a.push(h)}return a}function l(t,n){return t.map((function(t){return n.map((function(e){return f(t[e])})).join(e)}))}function u(t){return t.map(f).join(e)}function f(e){return null==e?"":e instanceof Date?i(e):a.test(e+="")?'"'+e.replace(/"/g,'""')+'"':e}return{parse:function(e,t){var n,o,a=c(e,(function(e,a){if(n)return n(e,a-1);o=e,n=t?function(e,t){var n=r(e);return function(r,o){return t(n(r),o,e)}}(e,t):r(e)}));return a.columns=o||[],a},parseRows:c,format:function(t,n){return null==n&&(n=o(t)),[n.map(f).join(e)].concat(l(t,n)).join("\n")},formatBody:function(e,t){return null==t&&(t=o(e)),l(e,t).join("\n")},formatRows:function(e){return e.map(u).join("\n")},formatRow:u,formatValue:f}}var c=s(","),l=c.parse,u=c.parseRows,f=s("\t"),d=f.parse,h=f.parseRows;function m(e){for(var t in e){var n,r,o=e[t].trim();if(o)if("true"===o)o=!0;else if("false"===o)o=!1;else if("NaN"===o)o=NaN;else if(isNaN(n=+o)){if(!(r=o.match(/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/)))continue;p&&r[4]&&!r[7]&&(o=o.replace(/-/g,"/").replace(/T/," ")),o=new Date(o)}else o=n;else o=null;e[t]=o}return e}const p=new Date("2019-01-01T00:00").getHours()||new Date("2019-07-01T00:00").getHours();function b(e,t,n){return{resolve:(r=n)=>`${e}@${t}/${r}`}}const w=b("d3","7.6.1","dist/d3.min.js"),v=b("@observablehq/inputs","0.10.4","dist/inputs.min.js"),y=b("@observablehq/plot","0.6.0","dist/plot.umd.min.js"),g=b("@observablehq/graphviz","0.2.1","dist/graphviz.min.js"),E=b("@observablehq/highlight.js","2.0.0","highlight.min.js"),x=b("@observablehq/katex","0.11.1","dist/katex.min.js"),j=b("lodash","4.17.21","lodash.min.js"),N=b("htl","0.3.1","dist/htl.min.js"),T=b("jszip","3.10.0","dist/jszip.min.js"),A=b("marked","0.3.12","marked.min.js"),C=b("sql.js","1.7.0","dist/sql-wasm.js"),L=b("vega","5.22.1","build/vega.min.js"),O=b("vega-lite","5.5.0","build/vega-lite.min.js"),R=b("vega-lite-api","5.0.0","build/vega-lite-api.min.js"),P=b("apache-arrow","4.0.1","Arrow.es2015.min.js"),q=b("arquero","4.8.8","dist/arquero.min.js"),$=b("topojson-client","3.1.0","dist/topojson-client.min.js"),k=b("exceljs","4.3.0","dist/exceljs.min.js"),I=b("mermaid","9.1.6","dist/mermaid.min.js"),S=b("leaflet","1.8.0","dist/leaflet.js"),M=new Map,U=[],_=U.map,D=U.some,F=U.hasOwnProperty,B=/^((?:@[^/@]+\/)?[^/@]+)(?:@([^/]+))?(?:\/(.*))?$/,H=/^\d+\.\d+\.\d+(-[\w-.+]+)?$/,W=/(?:\.[^/]*|\/)$/;class RequireError extends Error{constructor(e){super(e)}}function z(e){const t=B.exec(e);return t&&{name:t[1],version:t[2],path:t[3]}}function V(e="https://cdn.jsdelivr.net/npm/",t=["unpkg","jsdelivr","browser","main"]){if(!/\/$/.test(e))throw new Error("origin lacks trailing slash");function n(t){const n=`${e}${t.name}${t.version?`@${t.version}`:""}/package.json`;let r=M.get(n);return r||M.set(n,r=fetch(n).then((e=>{if(!e.ok)throw new RequireError("unable to load package.json");return e.redirected&&!M.has(e.url)&&M.set(e.url,r),e.json()}))),r}return async function(r,o){if(r.startsWith(e)&&(r=r.substring(e.length)),/^(\w+:)|\/\//i.test(r))return r;if(/^[.]{0,2}\//i.test(r))return new URL(r,null==o?location:o).href;if(!r.length||/^[\s._]/.test(r)||/\s$/.test(r))throw new RequireError("illegal name");const a=z(r);if(!a)return`${e}${r}`;if(!a.version&&null!=o&&o.startsWith(e)){const t=await n(z(o.substring(e.length)));a.version=t.dependencies&&t.dependencies[a.name]||t.peerDependencies&&t.peerDependencies[a.name]}if(a.path&&!W.test(a.path)&&(a.path+=".js"),a.path&&a.version&&H.test(a.version))return`${e}${a.name}@${a.version}/${a.path}`;const i=await n(a);return`${e}${i.name}@${i.version}/${a.path||function(e){for(const n of t){let t=e[n];if("string"==typeof t)return t.startsWith("./")&&(t=t.slice(2)),W.test(t)?t:`${t}.js`}}(i)||"index.js"}`}}RequireError.prototype.name=RequireError.name;var Z=G(V());function G(e){const t=new Map,n=o(null);function r(e){if("string"!=typeof e)return e;let n=t.get(e);return n||t.set(e,n=new Promise(((t,n)=>{const r=document.createElement("script");r.onload=()=>{try{t(U.pop()(o(e)))}catch(e){n(new RequireError("invalid module"))}r.remove()},r.onerror=()=>{n(new RequireError("unable to load module")),r.remove()},r.async=!0,r.src=e,window.define=X,document.head.appendChild(r)}))),n}function o(t){return n=>Promise.resolve(e(n,t)).then(r)}function a(e){return arguments.length>1?Promise.all(_.call(arguments,n)).then(Y):n(e)}return a.alias=function(t){return G(((n,r)=>n in t&&(r=null,"string"!=typeof(n=t[n]))?n:e(n,r)))},a.resolve=e,a}function Y(e){const t={};for(const n of e)for(const e in n)F.call(n,e)&&(null==n[e]?Object.defineProperty(t,e,{get:Q(n,e)}):t[e]=n[e]);return t}function Q(e,t){return()=>e[t]}function K(e){return"exports"===(e+="")||"module"===e}function X(e,t,n){const r=arguments.length;r<2?(n=e,t=[]):r<3&&(n=t,t="string"==typeof e?[]:e),U.push(D.call(t,K)?e=>{const r={},o={exports:r};return Promise.all(_.call(t,(t=>"exports"===(t+="")?r:"module"===t?o:e(t)))).then((e=>(n.apply(null,e),o.exports)))}:e=>Promise.all(_.call(t,e)).then((e=>"function"==typeof n?n.apply(null,e):n)))}X.amd={};let J=Z;async function ee(e){const[t,n]=await Promise.all([e(C.resolve()),e.resolve(C.resolve("dist/"))]);return t({locateFile:e=>`${n}${e}`})}class SQLiteDatabaseClient{constructor(e){Object.defineProperties(this,{_db:{value:e}})}static async open(e){const[t,n]=await Promise.all([ee(J),Promise.resolve(e).then(ne)]);return new SQLiteDatabaseClient(new t.Database(n))}async query(e,t){return await async function(e,t,n){const[r]=await e.exec(t,n);if(!r)return[];const{columns:o,values:a}=r,i=a.map((e=>Object.fromEntries(e.map(((e,t)=>[o[t],e])))));return i.columns=o,i}(this._db,e,t)}async queryRow(e,t){return(await this.query(e,t))[0]||null}async explain(e,t){return re("pre",{className:"observablehq--inspect"},[oe((await this.query(`EXPLAIN QUERY PLAN ${e}`,t)).map((e=>e.detail)).join("\n"))])}async describeTables({schema:e}={}){return this.query(`SELECT NULLIF(schema, 'main') AS schema, name FROM pragma_table_list() WHERE type = 'table'${null==e?"":" AND schema = ?"} AND name NOT LIKE 'sqlite_%'`,null==e?[]:[e])}async describeColumns({schema:e,table:t}={}){if(null==t)throw new Error("missing table");const n=await this.query(`SELECT name, type, "notnull" FROM pragma_table_info(?${null==e?"":", ?"}) ORDER BY cid`,null==e?[t]:[t,e]);if(!n.length)throw new Error(`table not found: ${t}`);return n.map((({name:e,type:t,notnull:n})=>({name:e,type:te(t),databaseType:t,nullable:!n})))}async describe(e){const t=await(void 0===e?this.query("SELECT name FROM sqlite_master WHERE type = 'table'"):this.query("SELECT * FROM pragma_table_info(?)",[e]));if(!t.length)throw new Error("Not found");const{columns:n}=t;return re("table",{value:t},[re("thead",[re("tr",n.map((e=>re("th",[oe(e)]))))]),re("tbody",t.map((e=>re("tr",n.map((t=>re("td",[oe(e[t])])))))))])}async sql(){return this.query(...this.queryTag.apply(this,arguments))}queryTag(e,...t){return[e.join("?"),t]}}function te(e){switch(e){case"NULL":return"null";case"INT":case"INTEGER":case"TINYINT":case"SMALLINT":case"MEDIUMINT":case"BIGINT":case"UNSIGNED BIG INT":case"INT2":case"INT8":return"integer";case"TEXT":case"CLOB":case"DATE":case"DATETIME":return"string";case"REAL":case"DOUBLE":case"DOUBLE PRECISION":case"FLOAT":case"NUMERIC":return"number";case"BLOB":return"buffer";default:return/^(?:(?:(?:VARYING|NATIVE) )?CHARACTER|(?:N|VAR|NVAR)CHAR)\(/.test(e)?"string":/^(?:DECIMAL|NUMERIC)\(/.test(e)?"number":"other"}}function ne(e){return"string"==typeof e?fetch(e).then(ne):e instanceof Response||e instanceof Blob?e.arrayBuffer().then(ne):e instanceof ArrayBuffer?new Uint8Array(e):e}function re(e,t,n){2===arguments.length&&(n=t,t=void 0);const r=document.createElement(e);if(void 0!==t)for(const e in t)r[e]=t[e];if(void 0!==n)for(const e of n)r.appendChild(e);return r}function oe(e){return document.createTextNode(e)}Object.defineProperty(SQLiteDatabaseClient.prototype,"dialect",{value:"sqlite"});class Workbook{constructor(e){Object.defineProperties(this,{_:{value:e},sheetNames:{value:e.worksheets.map((e=>e.name)),enumerable:!0}})}sheet(e,t){const n="number"==typeof e?this.sheetNames[e]:this.sheetNames.includes(e+="")?e:null;if(null==n)throw new Error(`Sheet not found: ${e}`);return function(e,{range:t,headers:n}={}){let[[r,o],[a,i]]=function(e=":",{columnCount:t,rowCount:n}){if(!(e+="").match(/^[A-Z]*\d*:[A-Z]*\d*$/))throw new Error("Malformed range specifier");const[[r=0,o=0],[a=t-1,i=n-1]]=e.split(":").map(ce);return[[r,o],[a,i]]}(t,e);const s=n?e._rows[o++]:null;let c=new Set(["#"]);for(let e=r;e<=a;e++){const t=s?ae(s.findCell(e+1)):null;let n=t&&t+""||se(e);for(;c.has(n);)n+="_";c.add(n)}c=new Array(r).concat(Array.from(c));const l=new Array(i-o+1);for(let t=o;t<=i;t++){const n=l[t-o]=Object.create(null,{"#":{value:t+1}}),i=e.getRow(t+1);if(i.hasValues)for(let e=r;e<=a;e++){const t=ae(i.findCell(e+1));null!=t&&(n[c[e+1]]=t)}}return l.columns=c.filter((()=>!0)),l}(this._.getWorksheet(n),t)}}function ae(e){if(!e)return;const{value:t}=e;if(t&&"object"==typeof t&&!(t instanceof Date)){if(t.formula||t.sharedFormula)return t.result&&t.result.error?NaN:t.result;if(t.richText)return ie(t);if(t.text){let{text:e}=t;return e.richText&&(e=ie(e)),t.hyperlink&&t.hyperlink!==e?`${t.hyperlink} ${e}`:e}return t}return t}function ie(e){return e.richText.map((e=>e.text)).join("")}function se(e){let t="";e++;do{t=String.fromCharCode(64+(e%26||26))+t}while(e=Math.floor((e-1)/26));return t}function ce(e){const[,t,n]=e.match(/^([A-Z]*)(\d*)$/);let r=0;if(t)for(let e=0;e<t.length;e++)r+=Math.pow(26,t.length-e-1)*(t.charCodeAt(e)-64);return[r?r-1:void 0,n?+n-1:void 0]}async function le(e){const t=await fetch(await e.url());if(!t.ok)throw new Error(`Unable to load file: ${e.name}`);return t}async function ue(e,t,{array:n=!1,typed:r=!1}={}){const o=await e.text();return("\t"===t?n?h:d:n?u:l)(o,r&&m)}class fe{constructor(e,t){Object.defineProperty(this,"name",{value:e,enumerable:!0}),void 0!==t&&Object.defineProperty(this,"mimeType",{value:t+"",enumerable:!0})}async blob(){return(await le(this)).blob()}async arrayBuffer(){return(await le(this)).arrayBuffer()}async text(){return(await le(this)).text()}async json(){return(await le(this)).json()}async stream(){return(await le(this)).body}async csv(e){return ue(this,",",e)}async tsv(e){return ue(this,"\t",e)}async image(e){const t=await this.url();return new Promise(((n,r)=>{const o=new Image;new URL(t,document.baseURI).origin!==new URL(location).origin&&(o.crossOrigin="anonymous"),Object.assign(o,e),o.onload=()=>n(o),o.onerror=()=>r(new Error(`Unable to load file: ${this.name}`)),o.src=t}))}async arrow(){const[e,t]=await Promise.all([J(P.resolve()),le(this)]);return e.Table.from(t)}async sqlite(){return SQLiteDatabaseClient.open(le(this))}async zip(){const[e,t]=await Promise.all([J(T.resolve()),this.arrayBuffer()]);return new ZipArchive(await e.loadAsync(t))}async xml(e="application/xml"){return(new DOMParser).parseFromString(await this.text(),e)}async html(){return this.xml("text/html")}async xlsx(){const[e,t]=await Promise.all([J(k.resolve()),this.arrayBuffer()]);return new Workbook(await(new e.Workbook).xlsx.load(t))}}class FileAttachment extends fe{constructor(e,t,n){super(t,n),Object.defineProperty(this,"_url",{value:e})}async url(){return await this._url+""}}function de(e){throw new Error(`File not found: ${e}`)}class ZipArchive{constructor(e){Object.defineProperty(this,"_",{value:e}),this.filenames=Object.keys(e.files).filter((t=>!e.files[t].dir))}file(e){const t=this._.file(e+="");if(!t||t.dir)throw new Error(`file not found: ${e}`);return new ZipArchiveEntry(t)}}class ZipArchiveEntry extends fe{constructor(e){super(e.name),Object.defineProperty(this,"_",{value:e}),Object.defineProperty(this,"_url",{writable:!0})}async url(){return this._url||(this._url=this.blob().then(URL.createObjectURL))}async blob(){return this._.async("blob")}async arrayBuffer(){return this._.async("arraybuffer")}async text(){return this._.async("text")}async json(){return JSON.parse(await this.text())}}var he={math:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};var me=0;function pe(e){return new be("O-"+(null==e?"":e+"-")+ ++me)}function be(e){this.id=e,this.href=new URL(`#${e}`,location)+""}be.prototype.toString=function(){return"url("+this.href+")"};var we={canvas:function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,n},context2d:function(e,t,n){null==n&&(n=devicePixelRatio);var r=document.createElement("canvas");r.width=e*n,r.height=t*n,r.style.width=e+"px";var o=r.getContext("2d");return o.scale(n,n),o},download:function(e,t="untitled",n="Save"){const r=document.createElement("a"),o=r.appendChild(document.createElement("button"));async function a(){await new Promise(requestAnimationFrame),URL.revokeObjectURL(r.href),r.removeAttribute("href"),o.textContent=n,o.disabled=!1}return o.textContent=n,r.download=t,r.onclick=async t=>{if(o.disabled=!0,r.href)return a();o.textContent="Saving…";try{const t=await("function"==typeof e?e():e);o.textContent="Download",r.href=URL.createObjectURL(t)}catch(e){o.textContent=n}if(t.eventPhase)return a();o.disabled=!1},r},element:function(e,t){var n,r=e+="",o=r.indexOf(":");o>=0&&"xmlns"!==(r=e.slice(0,o))&&(e=e.slice(o+1));var a=he.hasOwnProperty(r)?document.createElementNS(he[r],e):document.createElement(e);if(t)for(var i in t)o=(r=i).indexOf(":"),n=t[i],o>=0&&"xmlns"!==(r=i.slice(0,o))&&(i=i.slice(o+1)),he.hasOwnProperty(r)?a.setAttributeNS(he[r],i,n):a.setAttribute(i,n);return a},input:function(e){var t=document.createElement("input");return null!=e&&(t.type=e),t},range:function(e,t,n){1===arguments.length&&(t=e,e=null);var r=document.createElement("input");return r.min=e=null==e?0:+e,r.max=t=null==t?1:+t,r.step=null==n?"any":n=+n,r.type="range",r},select:function(e){var t=document.createElement("select");return Array.prototype.forEach.call(e,(function(e){var n=document.createElement("option");n.value=n.textContent=e,t.appendChild(n)})),t},svg:function(e,t){var n=document.createElementNS("http://www.w3.org/2000/svg","svg");return n.setAttribute("viewBox",[0,0,e,t]),n.setAttribute("width",e),n.setAttribute("height",t),n},text:function(e){return document.createTextNode(e)},uid:pe};var ve={buffer:function(e){return new Promise((function(t,n){var r=new FileReader;r.onload=function(){t(r.result)},r.onerror=n,r.readAsArrayBuffer(e)}))},text:function(e){return new Promise((function(t,n){var r=new FileReader;r.onload=function(){t(r.result)},r.onerror=n,r.readAsText(e)}))},url:function(e){return new Promise((function(t,n){var r=new FileReader;r.onload=function(){t(r.result)},r.onerror=n,r.readAsDataURL(e)}))}};function ye(){return this}function ge(e,t){let n=!1;if("function"!=typeof t)throw new Error("dispose is not a function");return{[Symbol.iterator]:ye,next:()=>n?{done:!0}:(n=!0,{done:!1,value:e}),return:()=>(n=!0,t(e),{done:!0}),throw:()=>({done:n=!0})}}function Ee(e){let t,n,r=!1;const o=e((function(e){n?(n(e),n=null):r=!0;return t=e}));if(null!=o&&"function"!=typeof o)throw new Error("function"==typeof o.then?"async initializers are not supported":"initializer returned something, but not a dispose function");return{[Symbol.iterator]:ye,throw:()=>({done:!0}),return:()=>(null!=o&&o(),{done:!0}),next:function(){return{done:!1,value:r?(r=!1,Promise.resolve(t)):new Promise((e=>n=e))}}}}function xe(e){switch(e.type){case"range":case"number":return e.valueAsNumber;case"date":return e.valueAsDate;case"checkbox":return e.checked;case"file":return e.multiple?e.files:e.files[0];case"select-multiple":return Array.from(e.selectedOptions,(e=>e.value));default:return e.value}}var je={disposable:ge,filter:function*(e,t){for(var n,r=-1;!(n=e.next()).done;)t(n.value,++r)&&(yield n.value)},input:function(e){return Ee((function(t){var n=function(e){switch(e.type){case"button":case"submit":case"checkbox":return"click";case"file":return"change";default:return"input"}}(e),r=xe(e);function o(){t(xe(e))}return e.addEventListener(n,o),void 0!==r&&t(r),function(){e.removeEventListener(n,o)}}))},map:function*(e,t){for(var n,r=-1;!(n=e.next()).done;)yield t(n.value,++r)},observe:Ee,queue:function(e){let t;const n=[],r=e((function(e){n.push(e),t&&(t(n.shift()),t=null);return e}));if(null!=r&&"function"!=typeof r)throw new Error("function"==typeof r.then?"async initializers are not supported":"initializer returned something, but not a dispose function");return{[Symbol.iterator]:ye,throw:()=>({done:!0}),return:()=>(null!=r&&r(),{done:!0}),next:function(){return{done:!1,value:n.length?Promise.resolve(n.shift()):new Promise((e=>t=e))}}}},range:function*(e,t,n){e=+e,t=+t,n=(o=arguments.length)<2?(t=e,e=0,1):o<3?1:+n;for(var r=-1,o=0|Math.max(0,Math.ceil((t-e)/n));++r<o;)yield e+r*n},valueAt:function(e,t){if(!(!isFinite(t=+t)||t<0||t!=t|0))for(var n,r=-1;!(n=e.next()).done;)if(++r===t)return n.value},worker:function(e){const t=URL.createObjectURL(new Blob([e],{type:"text/javascript"})),n=new Worker(t);return ge(n,(()=>{n.terminate(),URL.revokeObjectURL(t)}))}};function Ne(e,t){return function(n){var r,o,a,i,s,c,l,u,f=n[0],d=[],h=null,m=-1;for(s=1,c=arguments.length;s<c;++s){if((r=arguments[s])instanceof Node)d[++m]=r,f+="\x3c!--o:"+m+"--\x3e";else if(Array.isArray(r)){for(l=0,u=r.length;l<u;++l)(o=r[l])instanceof Node?(null===h&&(d[++m]=h=document.createDocumentFragment(),f+="\x3c!--o:"+m+"--\x3e"),h.appendChild(o)):(h=null,f+=o);h=null}else f+=r;f+=n[s]}if(h=e(f),++m>0){for(a=new Array(m),i=document.createTreeWalker(h,NodeFilter.SHOW_COMMENT,null,!1);i.nextNode();)o=i.currentNode,/^o:/.test(o.nodeValue)&&(a[+o.nodeValue.slice(2)]=o);for(s=0;s<m;++s)(o=a[s])&&o.parentNode.replaceChild(d[s],o)}return 1===h.childNodes.length?h.removeChild(h.firstChild):11===h.nodeType?((o=t()).appendChild(h),o):h}}var Te=Ne((function(e){var t=document.createElement("template");return t.innerHTML=e.trim(),document.importNode(t.content,!0)}),(function(){return document.createElement("span")}));function Ae(e){let t;Object.defineProperties(this,{generator:{value:Ee((e=>{t=e}))},value:{get:()=>e,set:n=>t(e=n)}}),void 0!==e&&t(e)}function*Ce(){for(;;)yield Date.now()}var Le=new Map;function Oe(e,t){var n;return(n=Le.get(e=+e))?n.then((()=>t)):(n=Date.now())>=e?Promise.resolve(t):function(e,t){var n=new Promise((function(n){Le.delete(t);var r=t-e;if(!(r>0))throw new Error("invalid time");if(r>2147483647)throw new Error("too long to wait");setTimeout(n,r)}));return Le.set(t,n),n}(n,e).then((()=>t))}var Re={delay:function(e,t){return new Promise((function(n){setTimeout((function(){n(t)}),e)}))},tick:function(e,t){return Oe(Math.ceil((Date.now()+1)/e)*e,t)},when:Oe};function Pe(e,t){if(/^(\w+:)|\/\//i.test(e))return e;if(/^[.]{0,2}\//i.test(e))return new URL(e,null==t?location:t).href;if(!e.length||/^[\s._]/.test(e)||/\s$/.test(e))throw new Error("illegal name");return"https://unpkg.com/"+e}var qe=Ne((function(e){var t=document.createElementNS("http://www.w3.org/2000/svg","g");return t.innerHTML=e.trim(),t}),(function(){return document.createElementNS("http://www.w3.org/2000/svg","g")})),$e=String.raw;function ke(e){return new Promise((function(t,n){var r=document.createElement("link");r.rel="stylesheet",r.href=e,r.onerror=n,r.onload=t,document.head.appendChild(r)}))}function Ie(){return Ee((function(e){var t=e(document.body.clientWidth);function n(){var n=document.body.clientWidth;n!==t&&e(t=n)}return window.addEventListener("resize",n),function(){window.removeEventListener("resize",n)}}))}const Se=Object.assign((async(e,t,n)=>{const r=Ue(t,await e);return r?Me(await e,r,n):null}),{sql:(e,t)=>async function(){return Me(e,arguments,t)}});async function Me(e,t,n){if(e){if("function"==typeof e.queryTag){const r=new AbortController,o={signal:r.signal};if(n.then((()=>r.abort("invalidated"))),"function"==typeof e.queryStream)return async function*(e){const t=await e,n=[];n.done=!1,n.error=null,n.schema=t.schema;try{const e=t.readRows();do{const t=await e.next();if(t.done)n.done=!0;else for(const e of t.value)n.push(e);yield n}while(!n.done)}catch(e){n.error=e,yield n}}(e.queryStream(...e.queryTag.apply(e,t),o));if("function"==typeof e.query)return e.query(...e.queryTag.apply(e,t),o)}if("function"==typeof e.sql)return e.sql.apply(e,t);throw new Error("source does not implement query, queryStream, or sql")}}function Ue(e,t){const n=t&&"function"==typeof t.escape?t.escape:e=>e,{select:r,from:o,filter:a,sort:i,slice:s}=e;if(null===o.table||null===r.columns||r.columns&&0===r.columns.length)return;const c=[[`SELECT ${r.columns.map((e=>`t.${n(e)}`))} FROM ${_e(o.table,n)} t`]];for(let e=0;e<a.length;++e)De(e?"\nAND ":"\nWHERE ",c),Be(a[e],c);for(let e=0;e<i.length;++e)De(e?", ":"\nORDER BY ",c),Fe(i[e],c);return null===s.to&&null===s.from||De("\nLIMIT "+(null!==s.to?s.to-(s.from||0):1e9),c),null!==s.from&&De(` OFFSET ${s.from}`,c),c}function _e(e,t){if("object"==typeof e){let n="";return null!=e.database&&(n+=t(e.database)+"."),null!=e.schema&&(n+=t(e.schema)+"."),n+=t(e.table),n}return e}function De(e,t){const n=t[0];n[n.length-1]+=e}function Fe({column:e,direction:t},n){De(`t.${e} ${t.toUpperCase()}`,n)}function Be({type:e,operands:t},n){if(t.length<1)throw new Error("Invalid operand length");if(1===t.length)switch(He(t[0],n),e){case"n":return void De(" IS NULL",n);case"nn":return void De(" IS NOT NULL",n);default:throw new Error("Invalid filter operation")}if(2!==t.length||["in","nin"].includes(e)){var r;switch(He(t[0],n),e){case"in":De(" IN (",n);break;case"nin":De(" NOT IN (",n);break;default:throw new Error("Invalid filter operation")}!function(e,t){let n=!0;for(const r of e)n?n=!1:De(",",t),t.push(r.value),t[0].push("")}(t.slice(1),n),De(")",n)}else{if(["c","nc"].includes(e)){switch(He(t[0],n),e){case"c":De(" LIKE ",n);break;case"nc":De(" NOT LIKE ",n)}return void He((r=t[1],{...r,value:`%${r.value}%`}),n)}switch(He(t[0],n),e){case"eq":De(" = ",n);break;case"ne":De(" <> ",n);break;case"gt":De(" > ",n);break;case"lt":De(" < ",n);break;case"gte":De(" >= ",n);break;case"lte":De(" <= ",n);break;default:throw new Error("Invalid filter operation")}He(t[1],n)}}function He(e,t){"column"===e.type?De(`t.${e.value}`,t):(t.push(e.value),t[0].push(""))}var We=Object.assign(Object.defineProperties((function(e){const t=function(e){return null==e?J:G(e)}(e);var n;Object.defineProperties(this,(n={FileAttachment:()=>de,Mutable:()=>Ae,now:Ce,width:Ie,dot:()=>t(g.resolve()),htl:()=>t(N.resolve()),html:()=>Te,md:()=>function(e){return e(A.resolve()).then((function(t){return Ne((function(n){var r=document.createElement("div");r.innerHTML=t(n,{langPrefix:""}).trim();var o=r.querySelectorAll("pre code[class]");return o.length>0&&e(E.resolve()).then((function(t){o.forEach((function(n){function r(){t.highlightBlock(n),n.parentNode.classList.add("observablehq--md-pre")}t.getLanguage(n.className)?r():e(E.resolve("async-languages/index.js")).then((r=>{if(r.has(n.className))return e(E.resolve("async-languages/"+r.get(n.className))).then((e=>{t.registerLanguage(n.className,e)}))})).then(r,r)}))})),r}),(function(){return document.createElement("div")}))}))}(t),svg:()=>qe,tex:()=>function(e){return Promise.all([e(x.resolve()),e.resolve(x.resolve("dist/katex.min.css")).then(ke)]).then((function(e){var t=e[0],n=r();function r(e){return function(){var n=document.createElement("div");return t.render($e.apply(String,arguments),n,e),n.removeChild(n.firstChild)}}return n.options=r,n.block=r({displayMode:!0}),n}))}(t),_:()=>t(j.resolve()),aq:()=>t.alias({"apache-arrow":P.resolve()})(q.resolve()),Arrow:()=>t(P.resolve()),d3:()=>t(w.resolve()),Inputs:()=>t(v.resolve()).then((e=>({...e,file:e.fileOf(fe)}))),L:()=>async function(e){const t=await e(S.resolve());if(!t._style){const n=document.createElement("link");n.rel="stylesheet",n.href=await e.resolve(S.resolve("dist/leaflet.css")),t._style=document.head.appendChild(n)}return t}(t),mermaid:()=>async function(e){const t=await e(I.resolve());return t.initialize({securityLevel:"loose",theme:"neutral"}),function(){const e=document.createElement("div");return e.innerHTML=t.render(pe().id,String.raw.apply(String,arguments)),e.removeChild(e.firstChild)}}(t),Plot:()=>t(y.resolve()),__query:()=>Se,require:()=>t,resolve:()=>Pe,SQLite:()=>ee(t),SQLiteDatabaseClient:()=>SQLiteDatabaseClient,topojson:()=>t($.resolve()),vl:()=>async function(e){const[t,n,r]=await Promise.all([L,O,R].map((t=>e(t.resolve()))));return r.register(t,n)}(t),aapl:()=>new FileAttachment("https://static.observableusercontent.com/files/3ccff97fd2d93da734e76829b2b066eafdaac6a1fafdec0faf6ebc443271cfc109d29e80dd217468fcb2aff1e6bffdc73f356cc48feb657f35378e6abbbb63b9").csv({typed:!0}),alphabet:()=>new FileAttachment("https://static.observableusercontent.com/files/75d52e6c3130b1cae83cda89305e17b50f33e7420ef205587a135e8562bcfd22e483cf4fa2fb5df6dff66f9c5d19740be1cfaf47406286e2eb6574b49ffc685d").csv({typed:!0}),cars:()=>new FileAttachment("https://static.observableusercontent.com/files/048ec3dfd528110c0665dfa363dd28bc516ffb7247231f3ab25005036717f5c4c232a5efc7bb74bc03037155cb72b1abe85a33d86eb9f1a336196030443be4f6").csv({typed:!0}),citywages:()=>new FileAttachment("https://static.observableusercontent.com/files/39837ec5121fcc163131dbc2fe8c1a2e0b3423a5d1e96b5ce371e2ac2e20a290d78b71a4fb08b9fa6a0107776e17fb78af313b8ea70f4cc6648fad68ddf06f7a").csv({typed:!0}),diamonds:()=>new FileAttachment("https://static.observableusercontent.com/files/87942b1f5d061a21fa4bb8f2162db44e3ef0f7391301f867ab5ba718b225a63091af20675f0bfe7f922db097b217b377135203a7eab34651e21a8d09f4e37252").csv({typed:!0}),flare:()=>new FileAttachment("https://static.observableusercontent.com/files/a6b0d94a7f5828fd133765a934f4c9746d2010e2f342d335923991f31b14120de96b5cb4f160d509d8dc627f0107d7f5b5070d2516f01e4c862b5b4867533000").csv({typed:!0}),industries:()=>new FileAttachment("https://static.observableusercontent.com/files/76f13741128340cc88798c0a0b7fa5a2df8370f57554000774ab8ee9ae785ffa2903010cad670d4939af3e9c17e5e18e7e05ed2b38b848ac2fc1a0066aa0005f").csv({typed:!0}),miserables:()=>new FileAttachment("https://static.observableusercontent.com/files/31d904f6e21d42d4963ece9c8cc4fbd75efcbdc404bf511bc79906f0a1be68b5a01e935f65123670ed04e35ca8cae3c2b943f82bf8db49c5a67c85cbb58db052").json(),olympians:()=>new FileAttachment("https://static.observableusercontent.com/files/31ca24545a0603dce099d10ee89ee5ae72d29fa55e8fc7c9ffb5ded87ac83060d80f1d9e21f4ae8eb04c1e8940b7287d179fe8060d887fb1f055f430e210007c").csv({typed:!0}),penguins:()=>new FileAttachment("https://static.observableusercontent.com/files/715db1223e067f00500780077febc6cebbdd90c151d3d78317c802732252052ab0e367039872ab9c77d6ef99e5f55a0724b35ddc898a1c99cb14c31a379af80a").csv({typed:!0}),weather:()=>new FileAttachment("https://static.observableusercontent.com/files/693a46b22b33db0f042728700e0c73e836fa13d55446df89120682d55339c6db7cc9e574d3d73f24ecc9bc7eb9ac9a1e7e104a1ee52c00aab1e77eb102913c1f").csv({typed:!0}),DOM:we,Files:ve,Generators:je,Promises:Re},Object.fromEntries(Object.entries(n).map(ze))))}),{resolve:{get:()=>J.resolve,enumerable:!0,configurable:!0},require:{get:()=>J,set:function(e){J=e},enumerable:!0,configurable:!0}}),{resolveFrom:V,requireFrom:G});function ze([e,t]){return[e,{value:t,writable:!0,enumerable:!0}]}e.AbstractFile=fe,e.FileAttachments=function(e){return Object.assign((t=>{const n=e(t+="");if(null==n)throw new Error(`File not found: ${t}`);if("object"==typeof n&&"url"in n){const{url:e,mimeType:r}=n;return new FileAttachment(e,t,r)}return new FileAttachment(n,t)}),{prototype:FileAttachment.prototype})},e.Library=We,e.makeQueryTemplate=Ue,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
// @observablehq/stdlib v3.21.0 Copyright 2022 Observable, Inc. | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).observablehq=e.observablehq||{})}(this,(function(e){"use strict";var t={},n={};function r(e){return new Function("d","return {"+e.map((function(e,t){return JSON.stringify(e)+": d["+t+'] || ""'})).join(",")+"}")}function o(e){var t=Object.create(null),n=[];return e.forEach((function(e){for(var r in e)r in t||n.push(t[r]=r)})),n}function a(e,t){var n=e+"",r=n.length;return r<t?new Array(t-r+1).join(0)+n:n}function i(e){var t,n=e.getUTCHours(),r=e.getUTCMinutes(),o=e.getUTCSeconds(),i=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":((t=e.getUTCFullYear())<0?"-"+a(-t,6):t>9999?"+"+a(t,6):a(t,4))+"-"+a(e.getUTCMonth()+1,2)+"-"+a(e.getUTCDate(),2)+(i?"T"+a(n,2)+":"+a(r,2)+":"+a(o,2)+"."+a(i,3)+"Z":o?"T"+a(n,2)+":"+a(r,2)+":"+a(o,2)+"Z":r||n?"T"+a(n,2)+":"+a(r,2)+"Z":"")}function s(e){var a=new RegExp('["'+e+"\n\r]"),s=e.charCodeAt(0);function c(e,r){var o,a=[],i=e.length,c=0,l=0,u=i<=0,f=!1;function d(){if(u)return n;if(f)return f=!1,t;var r,o,a=c;if(34===e.charCodeAt(a)){for(;c++<i&&34!==e.charCodeAt(c)||34===e.charCodeAt(++c););return(r=c)>=i?u=!0:10===(o=e.charCodeAt(c++))?f=!0:13===o&&(f=!0,10===e.charCodeAt(c)&&++c),e.slice(a+1,r-1).replace(/""/g,'"')}for(;c<i;){if(10===(o=e.charCodeAt(r=c++)))f=!0;else if(13===o)f=!0,10===e.charCodeAt(c)&&++c;else if(o!==s)continue;return e.slice(a,r)}return u=!0,e.slice(a,i)}for(10===e.charCodeAt(i-1)&&--i,13===e.charCodeAt(i-1)&&--i;(o=d())!==n;){for(var h=[];o!==t&&o!==n;)h.push(o),o=d();r&&null==(h=r(h,l++))||a.push(h)}return a}function l(t,n){return t.map((function(t){return n.map((function(e){return f(t[e])})).join(e)}))}function u(t){return t.map(f).join(e)}function f(e){return null==e?"":e instanceof Date?i(e):a.test(e+="")?'"'+e.replace(/"/g,'""')+'"':e}return{parse:function(e,t){var n,o,a=c(e,(function(e,a){if(n)return n(e,a-1);o=e,n=t?function(e,t){var n=r(e);return function(r,o){return t(n(r),o,e)}}(e,t):r(e)}));return a.columns=o||[],a},parseRows:c,format:function(t,n){return null==n&&(n=o(t)),[n.map(f).join(e)].concat(l(t,n)).join("\n")},formatBody:function(e,t){return null==t&&(t=o(e)),l(e,t).join("\n")},formatRows:function(e){return e.map(u).join("\n")},formatRow:u,formatValue:f}}var c=s(","),l=c.parse,u=c.parseRows,f=s("\t"),d=f.parse,h=f.parseRows;function m(e){for(var t in e){var n,r,o=e[t].trim();if(o)if("true"===o)o=!0;else if("false"===o)o=!1;else if("NaN"===o)o=NaN;else if(isNaN(n=+o)){if(!(r=o.match(/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/)))continue;p&&r[4]&&!r[7]&&(o=o.replace(/-/g,"/").replace(/T/," ")),o=new Date(o)}else o=n;else o=null;e[t]=o}return e}const p=new Date("2019-01-01T00:00").getHours()||new Date("2019-07-01T00:00").getHours();function b(e,t,n){return{resolve:(r=n)=>`${e}@${t}/${r}`}}const w=b("d3","7.6.1","dist/d3.min.js"),v=b("@observablehq/inputs","0.10.4","dist/inputs.min.js"),y=b("@observablehq/plot","0.6.0","dist/plot.umd.min.js"),g=b("@observablehq/graphviz","0.2.1","dist/graphviz.min.js"),E=b("@observablehq/highlight.js","2.0.0","highlight.min.js"),x=b("@observablehq/katex","0.11.1","dist/katex.min.js"),j=b("lodash","4.17.21","lodash.min.js"),A=b("htl","0.3.1","dist/htl.min.js"),N=b("jszip","3.10.0","dist/jszip.min.js"),T=b("marked","0.3.12","marked.min.js"),C=b("sql.js","1.7.0","dist/sql-wasm.js"),O=b("vega","5.22.1","build/vega.min.js"),L=b("vega-lite","5.5.0","build/vega-lite.min.js"),k=b("vega-lite-api","5.0.0","build/vega-lite-api.min.js"),q=b("apache-arrow","4.0.1","Arrow.es2015.min.js"),R=b("arquero","4.8.8","dist/arquero.min.js"),P=b("topojson-client","3.1.0","dist/topojson-client.min.js"),$=b("exceljs","4.3.0","dist/exceljs.min.js"),M=b("mermaid","9.1.6","dist/mermaid.min.js"),S=b("leaflet","1.8.0","dist/leaflet.js"),I=new Map,U=[],D=U.map,_=U.some,F=U.hasOwnProperty,B=/^((?:@[^/@]+\/)?[^/@]+)(?:@([^/]+))?(?:\/(.*))?$/,H=/^\d+\.\d+\.\d+(-[\w-.+]+)?$/,W=/(?:\.[^/]*|\/)$/;class RequireError extends Error{constructor(e){super(e)}}function z(e){const t=B.exec(e);return t&&{name:t[1],version:t[2],path:t[3]}}function V(e="https://cdn.jsdelivr.net/npm/",t=["unpkg","jsdelivr","browser","main"]){if(!/\/$/.test(e))throw new Error("origin lacks trailing slash");function n(t){const n=`${e}${t.name}${t.version?`@${t.version}`:""}/package.json`;let r=I.get(n);return r||I.set(n,r=fetch(n).then((e=>{if(!e.ok)throw new RequireError("unable to load package.json");return e.redirected&&!I.has(e.url)&&I.set(e.url,r),e.json()}))),r}return async function(r,o){if(r.startsWith(e)&&(r=r.substring(e.length)),/^(\w+:)|\/\//i.test(r))return r;if(/^[.]{0,2}\//i.test(r))return new URL(r,null==o?location:o).href;if(!r.length||/^[\s._]/.test(r)||/\s$/.test(r))throw new RequireError("illegal name");const a=z(r);if(!a)return`${e}${r}`;if(!a.version&&null!=o&&o.startsWith(e)){const t=await n(z(o.substring(e.length)));a.version=t.dependencies&&t.dependencies[a.name]||t.peerDependencies&&t.peerDependencies[a.name]}if(a.path&&!W.test(a.path)&&(a.path+=".js"),a.path&&a.version&&H.test(a.version))return`${e}${a.name}@${a.version}/${a.path}`;const i=await n(a);return`${e}${i.name}@${i.version}/${a.path||function(e){for(const n of t){let t=e[n];if("string"==typeof t)return t.startsWith("./")&&(t=t.slice(2)),W.test(t)?t:`${t}.js`}}(i)||"index.js"}`}}RequireError.prototype.name=RequireError.name;var Z=G(V());function G(e){const t=new Map,n=o(null);function r(e){if("string"!=typeof e)return e;let n=t.get(e);return n||t.set(e,n=new Promise(((t,n)=>{const r=document.createElement("script");r.onload=()=>{try{t(U.pop()(o(e)))}catch(e){n(new RequireError("invalid module"))}r.remove()},r.onerror=()=>{n(new RequireError("unable to load module")),r.remove()},r.async=!0,r.src=e,window.define=X,document.head.appendChild(r)}))),n}function o(t){return n=>Promise.resolve(e(n,t)).then(r)}function a(e){return arguments.length>1?Promise.all(D.call(arguments,n)).then(Y):n(e)}return a.alias=function(t){return G(((n,r)=>n in t&&(r=null,"string"!=typeof(n=t[n]))?n:e(n,r)))},a.resolve=e,a}function Y(e){const t={};for(const n of e)for(const e in n)F.call(n,e)&&(null==n[e]?Object.defineProperty(t,e,{get:Q(n,e)}):t[e]=n[e]);return t}function Q(e,t){return()=>e[t]}function K(e){return"exports"===(e+="")||"module"===e}function X(e,t,n){const r=arguments.length;r<2?(n=e,t=[]):r<3&&(n=t,t="string"==typeof e?[]:e),U.push(_.call(t,K)?e=>{const r={},o={exports:r};return Promise.all(D.call(t,(t=>"exports"===(t+="")?r:"module"===t?o:e(t)))).then((e=>(n.apply(null,e),o.exports)))}:e=>Promise.all(D.call(t,e)).then((e=>"function"==typeof n?n.apply(null,e):n)))}X.amd={};let J=Z;async function ee(e){const[t,n]=await Promise.all([e(C.resolve()),e.resolve(C.resolve("dist/"))]);return t({locateFile:e=>`${n}${e}`})}class SQLiteDatabaseClient{constructor(e){Object.defineProperties(this,{_db:{value:e}})}static async open(e){const[t,n]=await Promise.all([ee(J),Promise.resolve(e).then(ne)]);return new SQLiteDatabaseClient(new t.Database(n))}async query(e,t){return await async function(e,t,n){const[r]=await e.exec(t,n);if(!r)return[];const{columns:o,values:a}=r,i=a.map((e=>Object.fromEntries(e.map(((e,t)=>[o[t],e])))));return i.columns=o,i}(this._db,e,t)}async queryRow(e,t){return(await this.query(e,t))[0]||null}async explain(e,t){return re("pre",{className:"observablehq--inspect"},[oe((await this.query(`EXPLAIN QUERY PLAN ${e}`,t)).map((e=>e.detail)).join("\n"))])}async describeTables({schema:e}={}){return this.query(`SELECT NULLIF(schema, 'main') AS schema, name FROM pragma_table_list() WHERE type = 'table'${null==e?"":" AND schema = ?"} AND name NOT LIKE 'sqlite_%'`,null==e?[]:[e])}async describeColumns({schema:e,table:t}={}){if(null==t)throw new Error("missing table");const n=await this.query(`SELECT name, type, "notnull" FROM pragma_table_info(?${null==e?"":", ?"}) ORDER BY cid`,null==e?[t]:[t,e]);if(!n.length)throw new Error(`table not found: ${t}`);return n.map((({name:e,type:t,notnull:n})=>({name:e,type:te(t),databaseType:t,nullable:!n})))}async describe(e){const t=await(void 0===e?this.query("SELECT name FROM sqlite_master WHERE type = 'table'"):this.query("SELECT * FROM pragma_table_info(?)",[e]));if(!t.length)throw new Error("Not found");const{columns:n}=t;return re("table",{value:t},[re("thead",[re("tr",n.map((e=>re("th",[oe(e)]))))]),re("tbody",t.map((e=>re("tr",n.map((t=>re("td",[oe(e[t])])))))))])}async sql(){return this.query(...this.queryTag.apply(this,arguments))}queryTag(e,...t){return[e.join("?"),t]}}function te(e){switch(e){case"NULL":return"null";case"INT":case"INTEGER":case"TINYINT":case"SMALLINT":case"MEDIUMINT":case"BIGINT":case"UNSIGNED BIG INT":case"INT2":case"INT8":return"integer";case"TEXT":case"CLOB":case"DATE":case"DATETIME":return"string";case"REAL":case"DOUBLE":case"DOUBLE PRECISION":case"FLOAT":case"NUMERIC":return"number";case"BLOB":return"buffer";default:return/^(?:(?:(?:VARYING|NATIVE) )?CHARACTER|(?:N|VAR|NVAR)CHAR)\(/.test(e)?"string":/^(?:DECIMAL|NUMERIC)\(/.test(e)?"number":"other"}}function ne(e){return"string"==typeof e?fetch(e).then(ne):e instanceof Response||e instanceof Blob?e.arrayBuffer().then(ne):e instanceof ArrayBuffer?new Uint8Array(e):e}function re(e,t,n){2===arguments.length&&(n=t,t=void 0);const r=document.createElement(e);if(void 0!==t)for(const e in t)r[e]=t[e];if(void 0!==n)for(const e of n)r.appendChild(e);return r}function oe(e){return document.createTextNode(e)}Object.defineProperty(SQLiteDatabaseClient.prototype,"dialect",{value:"sqlite"});class Workbook{constructor(e){Object.defineProperties(this,{_:{value:e},sheetNames:{value:e.worksheets.map((e=>e.name)),enumerable:!0}})}sheet(e,t){const n="number"==typeof e?this.sheetNames[e]:this.sheetNames.includes(e+="")?e:null;if(null==n)throw new Error(`Sheet not found: ${e}`);return function(e,{range:t,headers:n}={}){let[[r,o],[a,i]]=function(e=":",{columnCount:t,rowCount:n}){if(!(e+="").match(/^[A-Z]*\d*:[A-Z]*\d*$/))throw new Error("Malformed range specifier");const[[r=0,o=0],[a=t-1,i=n-1]]=e.split(":").map(ce);return[[r,o],[a,i]]}(t,e);const s=n?e._rows[o++]:null;let c=new Set(["#"]);for(let e=r;e<=a;e++){const t=s?ae(s.findCell(e+1)):null;let n=t&&t+""||se(e);for(;c.has(n);)n+="_";c.add(n)}c=new Array(r).concat(Array.from(c));const l=new Array(i-o+1);for(let t=o;t<=i;t++){const n=l[t-o]=Object.create(null,{"#":{value:t+1}}),i=e.getRow(t+1);if(i.hasValues)for(let e=r;e<=a;e++){const t=ae(i.findCell(e+1));null!=t&&(n[c[e+1]]=t)}}return l.columns=c.filter((()=>!0)),l}(this._.getWorksheet(n),t)}}function ae(e){if(!e)return;const{value:t}=e;if(t&&"object"==typeof t&&!(t instanceof Date)){if(t.formula||t.sharedFormula)return t.result&&t.result.error?NaN:t.result;if(t.richText)return ie(t);if(t.text){let{text:e}=t;return e.richText&&(e=ie(e)),t.hyperlink&&t.hyperlink!==e?`${t.hyperlink} ${e}`:e}return t}return t}function ie(e){return e.richText.map((e=>e.text)).join("")}function se(e){let t="";e++;do{t=String.fromCharCode(64+(e%26||26))+t}while(e=Math.floor((e-1)/26));return t}function ce(e){const[,t,n]=e.match(/^([A-Z]*)(\d*)$/);let r=0;if(t)for(let e=0;e<t.length;e++)r+=Math.pow(26,t.length-e-1)*(t.charCodeAt(e)-64);return[r?r-1:void 0,n?+n-1:void 0]}async function le(e){const t=await fetch(await e.url());if(!t.ok)throw new Error(`Unable to load file: ${e.name}`);return t}async function ue(e,t,{array:n=!1,typed:r=!1}={}){const o=await e.text();return("\t"===t?n?h:d:n?u:l)(o,r&&m)}class fe{constructor(e,t){Object.defineProperty(this,"name",{value:e,enumerable:!0}),void 0!==t&&Object.defineProperty(this,"mimeType",{value:t+"",enumerable:!0})}async blob(){return(await le(this)).blob()}async arrayBuffer(){return(await le(this)).arrayBuffer()}async text(){return(await le(this)).text()}async json(){return(await le(this)).json()}async stream(){return(await le(this)).body}async csv(e){return ue(this,",",e)}async tsv(e){return ue(this,"\t",e)}async image(e){const t=await this.url();return new Promise(((n,r)=>{const o=new Image;new URL(t,document.baseURI).origin!==new URL(location).origin&&(o.crossOrigin="anonymous"),Object.assign(o,e),o.onload=()=>n(o),o.onerror=()=>r(new Error(`Unable to load file: ${this.name}`)),o.src=t}))}async arrow(){const[e,t]=await Promise.all([J(q.resolve()),le(this)]);return e.Table.from(t)}async sqlite(){return SQLiteDatabaseClient.open(le(this))}async zip(){const[e,t]=await Promise.all([J(N.resolve()),this.arrayBuffer()]);return new ZipArchive(await e.loadAsync(t))}async xml(e="application/xml"){return(new DOMParser).parseFromString(await this.text(),e)}async html(){return this.xml("text/html")}async xlsx(){const[e,t]=await Promise.all([J($.resolve()),this.arrayBuffer()]);return new Workbook(await(new e.Workbook).xlsx.load(t))}}class FileAttachment extends fe{constructor(e,t,n){super(t,n),Object.defineProperty(this,"_url",{value:e})}async url(){return await this._url+""}}function de(e){throw new Error(`File not found: ${e}`)}class ZipArchive{constructor(e){Object.defineProperty(this,"_",{value:e}),this.filenames=Object.keys(e.files).filter((t=>!e.files[t].dir))}file(e){const t=this._.file(e+="");if(!t||t.dir)throw new Error(`file not found: ${e}`);return new ZipArchiveEntry(t)}}class ZipArchiveEntry extends fe{constructor(e){super(e.name),Object.defineProperty(this,"_",{value:e}),Object.defineProperty(this,"_url",{writable:!0})}async url(){return this._url||(this._url=this.blob().then(URL.createObjectURL))}async blob(){return this._.async("blob")}async arrayBuffer(){return this._.async("arraybuffer")}async text(){return this._.async("text")}async json(){return JSON.parse(await this.text())}}var he={math:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};var me=0;function pe(e){return new be("O-"+(null==e?"":e+"-")+ ++me)}function be(e){this.id=e,this.href=new URL(`#${e}`,location)+""}be.prototype.toString=function(){return"url("+this.href+")"};var we={canvas:function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,n},context2d:function(e,t,n){null==n&&(n=devicePixelRatio);var r=document.createElement("canvas");r.width=e*n,r.height=t*n,r.style.width=e+"px";var o=r.getContext("2d");return o.scale(n,n),o},download:function(e,t="untitled",n="Save"){const r=document.createElement("a"),o=r.appendChild(document.createElement("button"));async function a(){await new Promise(requestAnimationFrame),URL.revokeObjectURL(r.href),r.removeAttribute("href"),o.textContent=n,o.disabled=!1}return o.textContent=n,r.download=t,r.onclick=async t=>{if(o.disabled=!0,r.href)return a();o.textContent="Saving…";try{const t=await("function"==typeof e?e():e);o.textContent="Download",r.href=URL.createObjectURL(t)}catch(e){o.textContent=n}if(t.eventPhase)return a();o.disabled=!1},r},element:function(e,t){var n,r=e+="",o=r.indexOf(":");o>=0&&"xmlns"!==(r=e.slice(0,o))&&(e=e.slice(o+1));var a=he.hasOwnProperty(r)?document.createElementNS(he[r],e):document.createElement(e);if(t)for(var i in t)o=(r=i).indexOf(":"),n=t[i],o>=0&&"xmlns"!==(r=i.slice(0,o))&&(i=i.slice(o+1)),he.hasOwnProperty(r)?a.setAttributeNS(he[r],i,n):a.setAttribute(i,n);return a},input:function(e){var t=document.createElement("input");return null!=e&&(t.type=e),t},range:function(e,t,n){1===arguments.length&&(t=e,e=null);var r=document.createElement("input");return r.min=e=null==e?0:+e,r.max=t=null==t?1:+t,r.step=null==n?"any":n=+n,r.type="range",r},select:function(e){var t=document.createElement("select");return Array.prototype.forEach.call(e,(function(e){var n=document.createElement("option");n.value=n.textContent=e,t.appendChild(n)})),t},svg:function(e,t){var n=document.createElementNS("http://www.w3.org/2000/svg","svg");return n.setAttribute("viewBox",[0,0,e,t]),n.setAttribute("width",e),n.setAttribute("height",t),n},text:function(e){return document.createTextNode(e)},uid:pe};var ve={buffer:function(e){return new Promise((function(t,n){var r=new FileReader;r.onload=function(){t(r.result)},r.onerror=n,r.readAsArrayBuffer(e)}))},text:function(e){return new Promise((function(t,n){var r=new FileReader;r.onload=function(){t(r.result)},r.onerror=n,r.readAsText(e)}))},url:function(e){return new Promise((function(t,n){var r=new FileReader;r.onload=function(){t(r.result)},r.onerror=n,r.readAsDataURL(e)}))}};function ye(){return this}function ge(e,t){let n=!1;if("function"!=typeof t)throw new Error("dispose is not a function");return{[Symbol.iterator]:ye,next:()=>n?{done:!0}:(n=!0,{done:!1,value:e}),return:()=>(n=!0,t(e),{done:!0}),throw:()=>({done:n=!0})}}function Ee(e){let t,n,r=!1;const o=e((function(e){n?(n(e),n=null):r=!0;return t=e}));if(null!=o&&"function"!=typeof o)throw new Error("function"==typeof o.then?"async initializers are not supported":"initializer returned something, but not a dispose function");return{[Symbol.iterator]:ye,throw:()=>({done:!0}),return:()=>(null!=o&&o(),{done:!0}),next:function(){return{done:!1,value:r?(r=!1,Promise.resolve(t)):new Promise((e=>n=e))}}}}function xe(e){switch(e.type){case"range":case"number":return e.valueAsNumber;case"date":return e.valueAsDate;case"checkbox":return e.checked;case"file":return e.multiple?e.files:e.files[0];case"select-multiple":return Array.from(e.selectedOptions,(e=>e.value));default:return e.value}}var je={disposable:ge,filter:function*(e,t){for(var n,r=-1;!(n=e.next()).done;)t(n.value,++r)&&(yield n.value)},input:function(e){return Ee((function(t){var n=function(e){switch(e.type){case"button":case"submit":case"checkbox":return"click";case"file":return"change";default:return"input"}}(e),r=xe(e);function o(){t(xe(e))}return e.addEventListener(n,o),void 0!==r&&t(r),function(){e.removeEventListener(n,o)}}))},map:function*(e,t){for(var n,r=-1;!(n=e.next()).done;)yield t(n.value,++r)},observe:Ee,queue:function(e){let t;const n=[],r=e((function(e){n.push(e),t&&(t(n.shift()),t=null);return e}));if(null!=r&&"function"!=typeof r)throw new Error("function"==typeof r.then?"async initializers are not supported":"initializer returned something, but not a dispose function");return{[Symbol.iterator]:ye,throw:()=>({done:!0}),return:()=>(null!=r&&r(),{done:!0}),next:function(){return{done:!1,value:n.length?Promise.resolve(n.shift()):new Promise((e=>t=e))}}}},range:function*(e,t,n){e=+e,t=+t,n=(o=arguments.length)<2?(t=e,e=0,1):o<3?1:+n;for(var r=-1,o=0|Math.max(0,Math.ceil((t-e)/n));++r<o;)yield e+r*n},valueAt:function(e,t){if(!(!isFinite(t=+t)||t<0||t!=t|0))for(var n,r=-1;!(n=e.next()).done;)if(++r===t)return n.value},worker:function(e){const t=URL.createObjectURL(new Blob([e],{type:"text/javascript"})),n=new Worker(t);return ge(n,(()=>{n.terminate(),URL.revokeObjectURL(t)}))}};function Ae(e,t){return function(n){var r,o,a,i,s,c,l,u,f=n[0],d=[],h=null,m=-1;for(s=1,c=arguments.length;s<c;++s){if((r=arguments[s])instanceof Node)d[++m]=r,f+="\x3c!--o:"+m+"--\x3e";else if(Array.isArray(r)){for(l=0,u=r.length;l<u;++l)(o=r[l])instanceof Node?(null===h&&(d[++m]=h=document.createDocumentFragment(),f+="\x3c!--o:"+m+"--\x3e"),h.appendChild(o)):(h=null,f+=o);h=null}else f+=r;f+=n[s]}if(h=e(f),++m>0){for(a=new Array(m),i=document.createTreeWalker(h,NodeFilter.SHOW_COMMENT,null,!1);i.nextNode();)o=i.currentNode,/^o:/.test(o.nodeValue)&&(a[+o.nodeValue.slice(2)]=o);for(s=0;s<m;++s)(o=a[s])&&o.parentNode.replaceChild(d[s],o)}return 1===h.childNodes.length?h.removeChild(h.firstChild):11===h.nodeType?((o=t()).appendChild(h),o):h}}var Ne=Ae((function(e){var t=document.createElement("template");return t.innerHTML=e.trim(),document.importNode(t.content,!0)}),(function(){return document.createElement("span")}));function Te(e){let t;Object.defineProperties(this,{generator:{value:Ee((e=>{t=e}))},value:{get:()=>e,set:n=>t(e=n)}}),void 0!==e&&t(e)}function*Ce(){for(;;)yield Date.now()}var Oe=new Map;function Le(e,t){var n;return(n=Oe.get(e=+e))?n.then((()=>t)):(n=Date.now())>=e?Promise.resolve(t):function(e,t){var n=new Promise((function(n){Oe.delete(t);var r=t-e;if(!(r>0))throw new Error("invalid time");if(r>2147483647)throw new Error("too long to wait");setTimeout(n,r)}));return Oe.set(t,n),n}(n,e).then((()=>t))}var ke={delay:function(e,t){return new Promise((function(n){setTimeout((function(){n(t)}),e)}))},tick:function(e,t){return Le(Math.ceil((Date.now()+1)/e)*e,t)},when:Le};function qe(e,t){if(/^(\w+:)|\/\//i.test(e))return e;if(/^[.]{0,2}\//i.test(e))return new URL(e,null==t?location:t).href;if(!e.length||/^[\s._]/.test(e)||/\s$/.test(e))throw new Error("illegal name");return"https://unpkg.com/"+e}var Re=Ae((function(e){var t=document.createElementNS("http://www.w3.org/2000/svg","g");return t.innerHTML=e.trim(),t}),(function(){return document.createElementNS("http://www.w3.org/2000/svg","g")})),Pe=String.raw;function $e(e){return new Promise((function(t,n){var r=document.createElement("link");r.rel="stylesheet",r.href=e,r.onerror=n,r.onload=t,document.head.appendChild(r)}))}function Me(){return Ee((function(e){var t=e(document.body.clientWidth);function n(){var n=document.body.clientWidth;n!==t&&e(t=n)}return window.addEventListener("resize",n),function(){window.removeEventListener("resize",n)}}))}function Se(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Ie(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Ue(e,t){return e&&("function"==typeof e.sql||"function"==typeof e.queryTag&&("function"==typeof e.query||"function"==typeof e.queryStream))&&("table"!==t||"function"==typeof e.describeColumns)&&e!==He}function De(e){return Array.isArray(e)&&(n=e.schema,Array.isArray(n)&&n.every((e=>e&&"string"==typeof e.name))||(t=e.columns,Array.isArray(t)&&t.every((e=>"string"==typeof e)))||function(e){const t=Math.min(20,e.length);for(let n=0;n<t;++n){const t=e[n];if(null===t||"object"!=typeof t)return!1}return t>0&&function(e){for(const t in e)return!0;return!1}(e[0])}(e)||_e(e)||Fe(e))||Be(e);var t,n}function _e(e){const t=Math.min(20,e.length);if(!(t>0))return!1;let n,r=!1;for(let o=0;o<t;++o){const t=e[o];if(null==t)continue;const a=typeof t;if(void 0===n)switch(a){case"number":case"boolean":case"string":case"bigint":n=a;break;default:return!1}else if(a!==n)return!1;r=!0}return r}function Fe(e){const t=Math.min(20,e.length);if(!(t>0))return!1;let n=!1;for(let r=0;r<t;++r){const t=e[r];if(null!=t){if(!(t instanceof Date))return!1;n=!0}}return n}function Be(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}const He=Object.assign((async(e,t,n)=>{if(Ue(e=await e))return We(e,ze(t,e),n);if(De(e))return function(e,t){n=e,(Be(n)||_e(n)||Fe(n))&&(e=Array.from(e,(e=>({value:e}))));var n;const r=e;let{schema:o,columns:a}=e;for(const{type:n,operands:r}of t.filter){const[{value:t}]=r,o=r.slice(1).map((({value:e})=>e));switch(n){case"eq":{const[n]=o;if(n instanceof Date){const r=+n;e=e.filter((e=>+e[t]===r))}else e=e.filter((e=>e[t]===n));break}case"ne":{const[n]=o;e=e.filter((e=>e[t]!==n));break}case"c":{const[n]=o;e=e.filter((e=>"string"==typeof e[t]&&e[t].includes(n)));break}case"nc":{const[n]=o;e=e.filter((e=>"string"==typeof e[t]&&!e[t].includes(n)));break}case"in":{const n=new Set(o);e=e.filter((e=>n.has(e[t])));break}case"nin":{const n=new Set(o);e=e.filter((e=>!n.has(e[t])));break}case"n":e=e.filter((e=>null==e[t]));break;case"nn":e=e.filter((e=>null!=e[t]));break;case"lt":{const[n]=o;e=e.filter((e=>e[t]<n));break}case"lte":{const[n]=o;e=e.filter((e=>e[t]<=n));break}case"gt":{const[n]=o;e=e.filter((e=>e[t]>n));break}case"gte":{const[n]=o;e=e.filter((e=>e[t]>=n));break}default:throw new Error(`unknown filter type: ${n}`)}}for(const{column:n,direction:o}of function(e){if("function"!=typeof e[Symbol.iterator])throw new TypeError("values is not iterable");return Array.from(e).reverse()}(t.sort)){const t="desc"===o?Ie:Se;e===r&&(e=e.slice()),e.sort(((e,r)=>t(e[n],r[n])))}let{from:i,to:s}=t.slice;i=null==i?0:Math.max(0,i),s=null==s?1/0:Math.max(0,s),(i>0||s<1/0)&&(e=e.slice(Math.max(0,i),Math.max(0,s)));if(t.select.columns){if(o){const e=new Map(o.map((e=>[e.name,e])));o=t.select.columns.map((t=>e.get(t)))}a&&(a=t.select.columns),e=e.map((e=>Object.fromEntries(t.select.columns.map((t=>[t,e[t]])))))}e!==r&&(o&&(e.schema=o),a&&(e.columns=a));return e}(e,t);if(!e)throw new Error("missing data source");throw new Error("invalid data source")}),{sql:(e,t)=>async function(){return We(e,arguments,t)}});async function We(e,t,n){if(!e)throw new Error("missing data source");if("function"==typeof e.queryTag){const r=new AbortController,o={signal:r.signal};if(n.then((()=>r.abort("invalidated"))),"function"==typeof e.queryStream)return async function*(e){const t=await e,n=[];n.done=!1,n.error=null,n.schema=t.schema;try{const e=t.readRows();do{const t=await e.next();if(t.done)n.done=!0;else for(const e of t.value)n.push(e);yield n}while(!n.done)}catch(e){n.error=e,yield n}}(e.queryStream(...e.queryTag.apply(e,t),o));if("function"==typeof e.query)return e.query(...e.queryTag.apply(e,t),o)}if("function"==typeof e.sql)return e.sql.apply(e,t);throw new Error("source does not implement query, queryStream, or sql")}function ze(e,t){const n="function"==typeof t.escape?t.escape:e=>e,{select:r,from:o,filter:a,sort:i,slice:s}=e;if(!o.table)throw new Error("missing from table");if(0===r.columns?.length)throw new Error("at least one column must be selected");const c=[[`SELECT ${r.columns?r.columns.map((e=>`t.${n(e)}`)):"*"} FROM ${Ve(o.table,n)} t`]];for(let e=0;e<a.length;++e)Ze(e?"\nAND ":"\nWHERE ",c),Ye(a[e],c);for(let e=0;e<i.length;++e)Ze(e?", ":"\nORDER BY ",c),Ge(i[e],c);return null===s.to&&null===s.from||Ze("\nLIMIT "+(null!==s.to?s.to-(s.from||0):1e9),c),null!==s.from&&Ze(` OFFSET ${s.from}`,c),c}function Ve(e,t){if("object"==typeof e){let n="";return null!=e.database&&(n+=t(e.database)+"."),null!=e.schema&&(n+=t(e.schema)+"."),n+=t(e.table),n}return e}function Ze(e,t){const n=t[0];n[n.length-1]+=e}function Ge({column:e,direction:t},n){Ze(`t.${e} ${t.toUpperCase()}`,n)}function Ye({type:e,operands:t},n){if(t.length<1)throw new Error("Invalid operand length");if(1===t.length)switch(Qe(t[0],n),e){case"n":return void Ze(" IS NULL",n);case"nn":return void Ze(" IS NOT NULL",n);default:throw new Error("Invalid filter operation")}if(2!==t.length||["in","nin"].includes(e)){var r;switch(Qe(t[0],n),e){case"in":Ze(" IN (",n);break;case"nin":Ze(" NOT IN (",n);break;default:throw new Error("Invalid filter operation")}!function(e,t){let n=!0;for(const r of e)n?n=!1:Ze(",",t),t.push(r.value),t[0].push("")}(t.slice(1),n),Ze(")",n)}else{if(["c","nc"].includes(e)){switch(Qe(t[0],n),e){case"c":Ze(" LIKE ",n);break;case"nc":Ze(" NOT LIKE ",n)}return void Qe((r=t[1],{...r,value:`%${r.value}%`}),n)}switch(Qe(t[0],n),e){case"eq":Ze(" = ",n);break;case"ne":Ze(" <> ",n);break;case"gt":Ze(" > ",n);break;case"lt":Ze(" < ",n);break;case"gte":Ze(" >= ",n);break;case"lte":Ze(" <= ",n);break;default:throw new Error("Invalid filter operation")}Qe(t[1],n)}}function Qe(e,t){"column"===e.type?Ze(`t.${e.value}`,t):(t.push(e.value),t[0].push(""))}var Ke=Object.assign(Object.defineProperties((function(e){const t=function(e){return null==e?J:G(e)}(e);var n;Object.defineProperties(this,(n={FileAttachment:()=>de,Mutable:()=>Te,now:Ce,width:Me,dot:()=>t(g.resolve()),htl:()=>t(A.resolve()),html:()=>Ne,md:()=>function(e){return e(T.resolve()).then((function(t){return Ae((function(n){var r=document.createElement("div");r.innerHTML=t(n,{langPrefix:""}).trim();var o=r.querySelectorAll("pre code[class]");return o.length>0&&e(E.resolve()).then((function(t){o.forEach((function(n){function r(){t.highlightBlock(n),n.parentNode.classList.add("observablehq--md-pre")}t.getLanguage(n.className)?r():e(E.resolve("async-languages/index.js")).then((r=>{if(r.has(n.className))return e(E.resolve("async-languages/"+r.get(n.className))).then((e=>{t.registerLanguage(n.className,e)}))})).then(r,r)}))})),r}),(function(){return document.createElement("div")}))}))}(t),svg:()=>Re,tex:()=>function(e){return Promise.all([e(x.resolve()),e.resolve(x.resolve("dist/katex.min.css")).then($e)]).then((function(e){var t=e[0],n=r();function r(e){return function(){var n=document.createElement("div");return t.render(Pe.apply(String,arguments),n,e),n.removeChild(n.firstChild)}}return n.options=r,n.block=r({displayMode:!0}),n}))}(t),_:()=>t(j.resolve()),aq:()=>t.alias({"apache-arrow":q.resolve()})(R.resolve()),Arrow:()=>t(q.resolve()),d3:()=>t(w.resolve()),Inputs:()=>t(v.resolve()).then((e=>({...e,file:e.fileOf(fe)}))),L:()=>async function(e){const t=await e(S.resolve());if(!t._style){const n=document.createElement("link");n.rel="stylesheet",n.href=await e.resolve(S.resolve("dist/leaflet.css")),t._style=document.head.appendChild(n)}return t}(t),mermaid:()=>async function(e){const t=await e(M.resolve());return t.initialize({securityLevel:"loose",theme:"neutral"}),function(){const e=document.createElement("div");return e.innerHTML=t.render(pe().id,String.raw.apply(String,arguments)),e.removeChild(e.firstChild)}}(t),Plot:()=>t(y.resolve()),__query:()=>He,require:()=>t,resolve:()=>qe,SQLite:()=>ee(t),SQLiteDatabaseClient:()=>SQLiteDatabaseClient,topojson:()=>t(P.resolve()),vl:()=>async function(e){const[t,n,r]=await Promise.all([O,L,k].map((t=>e(t.resolve()))));return r.register(t,n)}(t),aapl:()=>new FileAttachment("https://static.observableusercontent.com/files/3ccff97fd2d93da734e76829b2b066eafdaac6a1fafdec0faf6ebc443271cfc109d29e80dd217468fcb2aff1e6bffdc73f356cc48feb657f35378e6abbbb63b9").csv({typed:!0}),alphabet:()=>new FileAttachment("https://static.observableusercontent.com/files/75d52e6c3130b1cae83cda89305e17b50f33e7420ef205587a135e8562bcfd22e483cf4fa2fb5df6dff66f9c5d19740be1cfaf47406286e2eb6574b49ffc685d").csv({typed:!0}),cars:()=>new FileAttachment("https://static.observableusercontent.com/files/048ec3dfd528110c0665dfa363dd28bc516ffb7247231f3ab25005036717f5c4c232a5efc7bb74bc03037155cb72b1abe85a33d86eb9f1a336196030443be4f6").csv({typed:!0}),citywages:()=>new FileAttachment("https://static.observableusercontent.com/files/39837ec5121fcc163131dbc2fe8c1a2e0b3423a5d1e96b5ce371e2ac2e20a290d78b71a4fb08b9fa6a0107776e17fb78af313b8ea70f4cc6648fad68ddf06f7a").csv({typed:!0}),diamonds:()=>new FileAttachment("https://static.observableusercontent.com/files/87942b1f5d061a21fa4bb8f2162db44e3ef0f7391301f867ab5ba718b225a63091af20675f0bfe7f922db097b217b377135203a7eab34651e21a8d09f4e37252").csv({typed:!0}),flare:()=>new FileAttachment("https://static.observableusercontent.com/files/a6b0d94a7f5828fd133765a934f4c9746d2010e2f342d335923991f31b14120de96b5cb4f160d509d8dc627f0107d7f5b5070d2516f01e4c862b5b4867533000").csv({typed:!0}),industries:()=>new FileAttachment("https://static.observableusercontent.com/files/76f13741128340cc88798c0a0b7fa5a2df8370f57554000774ab8ee9ae785ffa2903010cad670d4939af3e9c17e5e18e7e05ed2b38b848ac2fc1a0066aa0005f").csv({typed:!0}),miserables:()=>new FileAttachment("https://static.observableusercontent.com/files/31d904f6e21d42d4963ece9c8cc4fbd75efcbdc404bf511bc79906f0a1be68b5a01e935f65123670ed04e35ca8cae3c2b943f82bf8db49c5a67c85cbb58db052").json(),olympians:()=>new FileAttachment("https://static.observableusercontent.com/files/31ca24545a0603dce099d10ee89ee5ae72d29fa55e8fc7c9ffb5ded87ac83060d80f1d9e21f4ae8eb04c1e8940b7287d179fe8060d887fb1f055f430e210007c").csv({typed:!0}),penguins:()=>new FileAttachment("https://static.observableusercontent.com/files/715db1223e067f00500780077febc6cebbdd90c151d3d78317c802732252052ab0e367039872ab9c77d6ef99e5f55a0724b35ddc898a1c99cb14c31a379af80a").csv({typed:!0}),weather:()=>new FileAttachment("https://static.observableusercontent.com/files/693a46b22b33db0f042728700e0c73e836fa13d55446df89120682d55339c6db7cc9e574d3d73f24ecc9bc7eb9ac9a1e7e104a1ee52c00aab1e77eb102913c1f").csv({typed:!0}),DOM:we,Files:ve,Generators:je,Promises:ke},Object.fromEntries(Object.entries(n).map(Xe))))}),{resolve:{get:()=>J.resolve,enumerable:!0,configurable:!0},require:{get:()=>J,set:function(e){J=e},enumerable:!0,configurable:!0}}),{resolveFrom:V,requireFrom:G});function Xe([e,t]){return[e,{value:t,writable:!0,enumerable:!0}]}e.AbstractFile=fe,e.FileAttachments=function(e){return Object.assign((t=>{const n=e(t+="");if(null==n)throw new Error(`File not found: ${t}`);if("object"==typeof n&&"url"in n){const{url:e,mimeType:r}=n;return new FileAttachment(e,t,r)}return new FileAttachment(n,t)}),{prototype:FileAttachment.prototype})},e.Library=Ke,e.isDataArray=De,e.isDatabaseClient=Ue,e.makeQueryTemplate=ze,Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "@observablehq/stdlib", | ||
"version": "3.20.0", | ||
"version": "3.21.0", | ||
"license": "ISC", | ||
@@ -25,2 +25,3 @@ "main": "dist/stdlib.js", | ||
"dependencies": { | ||
"d3-array": "^3.2.0", | ||
"d3-dsv": "^2.0.0", | ||
@@ -27,0 +28,0 @@ "d3-require": "^1.3.0" |
118
README.md
@@ -28,3 +28,3 @@ # @observablehq/stdlib | ||
<a href="#DOM_canvas" name="DOM_canvas">#</a> DOM.<b>canvas</b>(<i>width</i>, <i>height</i>) [<>](https://github.com/observablehq/stdlib/blob/master/src/dom/canvas.js "Source") | ||
<a href="#DOM_canvas" name="DOM_canvas">#</a> DOM.<b>canvas</b>(<i>width</i>, <i>height</i>) [<>](https://github.com/observablehq/stdlib/blob/main/src/dom/canvas.mjs "Source") | ||
@@ -45,3 +45,3 @@ Returns a new canvas element with the specified *width* and *height*. For example, to create a 960×500 canvas: | ||
<a href="#DOM_context2d" name="DOM_context2d">#</a> DOM.<b>context2d</b>(<i>width</i>, <i>height</i>[, <i>dpi</i>]) [<>](https://github.com/observablehq/stdlib/blob/master/src/dom/context2d.js "Source") | ||
<a href="#DOM_context2d" name="DOM_context2d">#</a> DOM.<b>context2d</b>(<i>width</i>, <i>height</i>[, <i>dpi</i>]) [<>](https://github.com/observablehq/stdlib/blob/main/src/dom/context2d.mjs "Source") | ||
@@ -59,3 +59,3 @@ Returns a new canvas context with the specified *width* and *height* and the specified device pixel ratio *dpi*. If *dpi* is not specified, it defaults to [*window*.devicePixelRatio](https://developer.mozilla.org/docs/Web/API/Window/devicePixelRatio). To access the context’s canvas, use [*context*.canvas](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/canvas). For example, to create a 960×500 canvas: | ||
<a href="#DOM_download" name="DOM_download">#</a> DOM.<b>download</b>(<i>object</i>\[, <i>name</i>\]\[, <i>value</i>\]) [<>](https://github.com/observablehq/stdlib/blob/master/src/dom/download.js "Source") | ||
<a href="#DOM_download" name="DOM_download">#</a> DOM.<b>download</b>(<i>object</i>\[, <i>name</i>\]\[, <i>value</i>\]) [<>](https://github.com/observablehq/stdlib/blob/main/src/dom/download.mjs "Source") | ||
@@ -76,3 +76,3 @@ Returns an anchor element containing a button that when clicked will download a file representing the specified *object*. The *object* should be anything supported by [URL.createObjectURL](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL) such as a [file](https://developer.mozilla.org/docs/Web/API/File) or a [blob](https://developer.mozilla.org/docs/Web/API/Blob). For example, to create a button to download a Canvas element as a PNG: | ||
<a href="#DOM_element" name="DOM_element">#</a> DOM.<b>element</b>(<i>name</i>[, <i>attributes</i>]) [<>](https://github.com/observablehq/stdlib/blob/master/src/dom/element.js "Source") | ||
<a href="#DOM_element" name="DOM_element">#</a> DOM.<b>element</b>(<i>name</i>[, <i>attributes</i>]) [<>](https://github.com/observablehq/stdlib/blob/main/src/dom/element.mjs "Source") | ||
@@ -117,3 +117,3 @@ Returns a new element with the specified *name*. For example, to create an empty H1 element: | ||
<a href="#DOM_input" name="DOM_input">#</a> DOM.<b>input</b>([<i>type</i>]) [<>](https://github.com/observablehq/stdlib/blob/master/src/dom/input.js "Source") | ||
<a href="#DOM_input" name="DOM_input">#</a> DOM.<b>input</b>([<i>type</i>]) [<>](https://github.com/observablehq/stdlib/blob/main/src/dom/input.mjs "Source") | ||
@@ -134,3 +134,3 @@ Returns a new input element with the specified *type*. If *type* is not specified or null, a text input is created. For example, to create a new file input: | ||
<a href="#DOM_range" name="DOM_range">#</a> DOM.<b>range</b>(\[<i>min</i>, \]\[<i>max</i>\]\[, <i>step</i>\]) [<>](https://github.com/observablehq/stdlib/blob/master/src/dom/range.js "Source") | ||
<a href="#DOM_range" name="DOM_range">#</a> DOM.<b>range</b>(\[<i>min</i>, \]\[<i>max</i>\]\[, <i>step</i>\]) [<>](https://github.com/observablehq/stdlib/blob/main/src/dom/range.mjs "Source") | ||
@@ -151,3 +151,3 @@ Returns a new range input element. (See also [DOM.input](#input).) If *max* is specified, sets the maximum value of the range to the specified number; if *max* is not specified or null, sets the maximum value of the range to 1. If *min* is specified, sets the minimum value of the range to the specified number; if *min* is not specified or null, sets the minimum value of the range to 0. If *step* is specified, sets the step value of the range to the specified number; if *step* is not specified or null, sets the step value of the range to `any`. For example, to create a slider that ranges the integers from -180 to +180, inclusive: | ||
<a href="#DOM_select" name="DOM_select">#</a> DOM.<b>select</b>(<i>values</i>) [<>](https://github.com/observablehq/stdlib/blob/master/src/dom/select.js "Source") | ||
<a href="#DOM_select" name="DOM_select">#</a> DOM.<b>select</b>(<i>values</i>) [<>](https://github.com/observablehq/stdlib/blob/main/src/dom/select.mjs "Source") | ||
@@ -180,3 +180,3 @@ Returns a new select element with an option for each string in the specified *values* array. For example, to create a drop-down menu of three colors: | ||
<a href="#DOM_svg" name="DOM_svg">#</a> DOM.<b>svg</b>(<i>width</i>, <i>height</i>) [<>](https://github.com/observablehq/stdlib/blob/master/src/dom/svg.js "Source") | ||
<a href="#DOM_svg" name="DOM_svg">#</a> DOM.<b>svg</b>(<i>width</i>, <i>height</i>) [<>](https://github.com/observablehq/stdlib/blob/main/src/dom/svg.mjs "Source") | ||
@@ -208,3 +208,3 @@ Returns a new SVG element with the specified *width* and *height*. For example, to create a 960×500 blank SVG: | ||
<a href="#DOM_text" name="DOM_text">#</a> DOM.<b>text</b>(<i>string</i>) [<>](https://github.com/observablehq/stdlib/blob/master/src/dom/text.js "Source") | ||
<a href="#DOM_text" name="DOM_text">#</a> DOM.<b>text</b>(<i>string</i>) [<>](https://github.com/observablehq/stdlib/blob/main/src/dom/text.mjs "Source") | ||
@@ -226,3 +226,3 @@ Returns a new text node with the specified *string* value. For example, to say hello: | ||
<a href="#DOM_uid" name="DOM_uid">#</a> DOM.<b>uid</b>([<i>name</i>]) [<>](https://github.com/observablehq/stdlib/blob/master/src/dom/uid.js "Source") | ||
<a href="#DOM_uid" name="DOM_uid">#</a> DOM.<b>uid</b>([<i>name</i>]) [<>](https://github.com/observablehq/stdlib/blob/main/src/dom/uid.mjs "Source") | ||
@@ -258,11 +258,11 @@ Returns a new unique *identifier*. If *name* is specified, the *identifier*.id will be derived from the specified *name*, which may be useful for debugging. If DOM.uid is called repeatedly with the same *name*, every returned *identifier* is still unique (that is, different). Identifiers are useful in SVG: use *identifier*.href for IRI references, such as the [xlink:href](https://www.w3.org/TR/SVG/animate.html#HrefAttribute) attribute; use *identifier*.toString for functional notation, such as the [clip-path](https://www.w3.org/TR/SVG/masking.html#ClipPathProperty) presentation attribute. | ||
<a href="#Files_buffer" name="Files_buffer">#</a> Files.<b>buffer</b>(<i>file</i>) [<>](https://github.com/observablehq/stdlib/blob/master/src/files/buffer.js "Source") | ||
<a href="#Files_buffer" name="Files_buffer">#</a> Files.<b>buffer</b>(<i>file</i>) [<>](https://github.com/observablehq/stdlib/blob/main/src/files/buffer.mjs "Source") | ||
Reads the specified *file*, returning a promise of the ArrayBuffer yielded by [*fileReader*.readAsArrayBuffer](https://developer.mozilla.org/docs/Web/API/FileReader/readAsArrayBuffer). This is useful for reading binary files, such as shapefiles and ZIP archives. | ||
<a href="#Files_text" name="Files_text">#</a> Files.<b>text</b>(<i>file</i>) [<>](https://github.com/observablehq/stdlib/blob/master/src/files/text.js "Source") | ||
<a href="#Files_text" name="Files_text">#</a> Files.<b>text</b>(<i>file</i>) [<>](https://github.com/observablehq/stdlib/blob/main/src/files/text.mjs "Source") | ||
Reads the specified *file*, returning a promise of the string yielded by [*fileReader*.readAsText](https://developer.mozilla.org/docs/Web/API/FileReader/readAsText). This is useful for reading text files, such as plain text, CSV, Markdown and HTML. | ||
<a href="#Files_url" name="Files_url">#</a> Files.<b>url</b>(<i>file</i>) [<>](https://github.com/observablehq/stdlib/blob/master/src/files/url.js "Source") | ||
<a href="#Files_url" name="Files_url">#</a> Files.<b>url</b>(<i>file</i>) [<>](https://github.com/observablehq/stdlib/blob/main/src/files/url.mjs "Source") | ||
@@ -294,3 +294,3 @@ Reads the specified *file*, returning a promise of the data URL yielded by [*fileReader*.readAsDataURL](https://developer.mozilla.org/docs/Web/API/FileReader/readAsDataURL). This is useful for reading a file into memory, represented as a data URL. For example, to display a local file as an image: | ||
<a href="#FileAttachment" name="FileAttachment">#</a> <b>FileAttachment</b>(<i>name</i>) [<>](https://github.com/observablehq/stdlib/blob/master/src/fileAttachment.js "Source") | ||
<a href="#FileAttachment" name="FileAttachment">#</a> <b>FileAttachment</b>(<i>name</i>) [<>](https://github.com/observablehq/stdlib/blob/main/src/fileAttachment.mjs "Source") | ||
@@ -305,3 +305,3 @@ Returns the file attachment with the given *name*, or throws an error if there is no file with the given name. | ||
<a href="#attachment_url" name="attachment_url">#</a> *attachment*.<b>url</b>() [<>](https://github.com/observablehq/stdlib/blob/master/src/fileAttachment.js "Source") | ||
<a href="#attachment_url" name="attachment_url">#</a> *attachment*.<b>url</b>() [<>](https://github.com/observablehq/stdlib/blob/main/src/fileAttachment.mjs "Source") | ||
@@ -314,3 +314,3 @@ Returns a promise to the URL at which the file may be retrieved. | ||
<a href="#attachment_text" name="attachment_text">#</a> *attachment*.<b>text</b>() [<>](https://github.com/observablehq/stdlib/blob/master/src/fileAttachment.js "Source") | ||
<a href="#attachment_text" name="attachment_text">#</a> *attachment*.<b>text</b>() [<>](https://github.com/observablehq/stdlib/blob/main/src/fileAttachment.mjs "Source") | ||
@@ -323,3 +323,3 @@ Returns a promise to the file’s contents as a JavaScript string. | ||
<a href="#attachment_json" name="attachment_json">#</a> *attachment*.<b>json</b>() [<>](https://github.com/observablehq/stdlib/blob/master/src/fileAttachment.js "Source") | ||
<a href="#attachment_json" name="attachment_json">#</a> *attachment*.<b>json</b>() [<>](https://github.com/observablehq/stdlib/blob/main/src/fileAttachment.mjs "Source") | ||
@@ -332,3 +332,3 @@ Returns a promise to the file’s contents, parsed as JSON into JavaScript values. | ||
<a href="#attachment_csv" name="attachment_csv">#</a> *attachment*.<b>csv</b>({<i>array</i> = false, <i>typed</i> = false} = {}) [<>](https://github.com/observablehq/stdlib/blob/master/src/fileAttachment.js "Source") | ||
<a href="#attachment_csv" name="attachment_csv">#</a> *attachment*.<b>csv</b>({<i>array</i> = false, <i>typed</i> = false} = {}) [<>](https://github.com/observablehq/stdlib/blob/main/src/fileAttachment.mjs "Source") | ||
@@ -341,5 +341,5 @@ Returns a promise to the file’s contents, parsed as comma-separated values (CSV) into an array. | ||
If <i>array</i> is true, an array of arrays is returned; otherwise, the first row is assumed to be the header row and an array of objects is returned, and the returned array has a <i>data</i>.columns property that is an array of column names. (See <a href="https://github.com/d3/d3-dsv/blob/master/README.md#dsv_parseRows">d3.csvParseRows</a>.) If <i>typed</i> is true, [automatic type inference](https://observablehq.com/@d3/d3-autotype) is applied; only use this feature if you know your data is compatible. | ||
If <i>array</i> is true, an array of arrays is returned; otherwise, the first row is assumed to be the header row and an array of objects is returned, and the returned array has a <i>data</i>.columns property that is an array of column names. (See <a href="https://github.com/d3/d3-dsv/blob/main/README.md#dsv_parseRows">d3.csvParseRows</a>.) If <i>typed</i> is true, [automatic type inference](https://observablehq.com/@d3/d3-autotype) is applied; only use this feature if you know your data is compatible. | ||
<a href="#attachment_csv" name="attachment_tsv">#</a> *attachment*.<b>tsv</b>({<i>array</i> = false, <i>typed</i> = false} = {}) [<>](https://github.com/observablehq/stdlib/blob/master/src/fileAttachment.js "Source") | ||
<a href="#attachment_csv" name="attachment_tsv">#</a> *attachment*.<b>tsv</b>({<i>array</i> = false, <i>typed</i> = false} = {}) [<>](https://github.com/observablehq/stdlib/blob/main/src/fileAttachment.mjs "Source") | ||
@@ -352,5 +352,5 @@ Returns a promise to the file’s contents, parsed as tab-separated values (TSV) into an array. | ||
If <i>array</i> is true, an array of arrays is returned; otherwise, the first row is assumed to be the header row and an array of objects is returned, and the returned array has a <i>data</i>.columns property that is an array of column names. (See <a href="https://github.com/d3/d3-dsv/blob/master/README.md#dsv_parseRows">d3.tsvParseRows</a>.) If <i>typed</i> is true, [automatic type inference](https://observablehq.com/@d3/d3-autotype) is applied; only use this feature if you know your data is compatible. | ||
If <i>array</i> is true, an array of arrays is returned; otherwise, the first row is assumed to be the header row and an array of objects is returned, and the returned array has a <i>data</i>.columns property that is an array of column names. (See <a href="https://github.com/d3/d3-dsv/blob/main/README.md#dsv_parseRows">d3.tsvParseRows</a>.) If <i>typed</i> is true, [automatic type inference](https://observablehq.com/@d3/d3-autotype) is applied; only use this feature if you know your data is compatible. | ||
<a href="#attachment_image" name="attachment_image">#</a> *attachment*.<b>image</b>() [<>](https://github.com/observablehq/stdlib/blob/master/src/fileAttachment.js "Source") | ||
<a href="#attachment_image" name="attachment_image">#</a> *attachment*.<b>image</b>() [<>](https://github.com/observablehq/stdlib/blob/main/src/fileAttachment.mjs "Source") | ||
@@ -363,3 +363,3 @@ Returns a promise to a file loaded as an [Image](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image). The promise resolves when the image has finished loading, making this useful for reading the image pixels in Canvas, or for loading the image into a WebGL texture. Consider [*attachment*.url](#attachment_url) if you want to embed an image in HTML or Markdown. | ||
<a href="#attachment_arrayBuffer" name="attachment_arrayBuffer">#</a> *attachment*.<b>arrayBuffer</b>() [<>](https://github.com/observablehq/stdlib/blob/master/src/fileAttachment.js "Source") | ||
<a href="#attachment_arrayBuffer" name="attachment_arrayBuffer">#</a> *attachment*.<b>arrayBuffer</b>() [<>](https://github.com/observablehq/stdlib/blob/main/src/fileAttachment.mjs "Source") | ||
@@ -372,3 +372,3 @@ Returns a promise to the file’s contents as an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). | ||
<a href="#attachment_stream" name="attachment_stream">#</a> *attachment*.<b>stream</b>() [<>](https://github.com/observablehq/stdlib/blob/master/src/fileAttachment.js "Source") | ||
<a href="#attachment_stream" name="attachment_stream">#</a> *attachment*.<b>stream</b>() [<>](https://github.com/observablehq/stdlib/blob/main/src/fileAttachment.mjs "Source") | ||
@@ -386,3 +386,3 @@ Returns a promise to a [ReadableStream](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API) of the file’s contents. | ||
<a href="#attachment_blob" name="attachment_blob">#</a> *attachment*.<b>blob</b>() [<>](https://github.com/observablehq/stdlib/blob/master/src/fileAttachment.js "Source") | ||
<a href="#attachment_blob" name="attachment_blob">#</a> *attachment*.<b>blob</b>() [<>](https://github.com/observablehq/stdlib/blob/main/src/fileAttachment.mjs "Source") | ||
@@ -395,3 +395,3 @@ Returns a promise to a [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) containing the raw contents of the file. | ||
<a href="#attachment_sqlite" name="attachment_sqlite">#</a> *attachment*.<b>sqlite</b>() [<>](https://github.com/observablehq/stdlib/blob/master/src/fileAttachment.js "Source") | ||
<a href="#attachment_sqlite" name="attachment_sqlite">#</a> *attachment*.<b>sqlite</b>() [<>](https://github.com/observablehq/stdlib/blob/main/src/fileAttachment.mjs "Source") | ||
@@ -404,3 +404,3 @@ Returns a promise to the file loaded as a [SQLite database client](https://observablehq.com/@observablehq/databases). | ||
<a href="#attachment_xlsx" name="attachment_xlsx">#</a> *attachment*.<b>xlsx</b>() [<>](https://github.com/observablehq/stdlib/blob/master/src/xlsx.js "Source") | ||
<a href="#attachment_xlsx" name="attachment_xlsx">#</a> *attachment*.<b>xlsx</b>() [<>](https://github.com/observablehq/stdlib/blob/main/src/xlsx.mjs "Source") | ||
@@ -414,3 +414,3 @@ Returns a promise to the file loaded as a [Workbook](https://observablehq.com/@observablehq/xlsx). | ||
<a href="#attachment_xml" name="attachment_xml">#</a> *attachment*.<b>xml</b>() [<>](https://github.com/observablehq/stdlib/blob/master/src/fileAttachment.js "Source") | ||
<a href="#attachment_xml" name="attachment_xml">#</a> *attachment*.<b>xml</b>() [<>](https://github.com/observablehq/stdlib/blob/main/src/fileAttachment.mjs "Source") | ||
@@ -423,3 +423,3 @@ Returns a promise to an [XMLDocument](https://developer.mozilla.org/en-US/docs/Web/API/XMLDocument) containing the contents of the file. | ||
<a href="#attachment_html" name="attachment_html">#</a> *attachment*.<b>html</b>() [<>](https://github.com/observablehq/stdlib/blob/master/src/fileAttachment.js "Source") | ||
<a href="#attachment_html" name="attachment_html">#</a> *attachment*.<b>html</b>() [<>](https://github.com/observablehq/stdlib/blob/main/src/fileAttachment.mjs "Source") | ||
@@ -432,3 +432,3 @@ Returns a promise to an [HTMLDocument](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDocument) containing the contents of the file. | ||
<a href="#FileAttachments" name="FileAttachments">#</a> <b>FileAttachments</b>(<i>resolve</i>) [<>](https://github.com/observablehq/stdlib/blob/master/src/fileAttachment.js "Source") | ||
<a href="#FileAttachments" name="FileAttachments">#</a> <b>FileAttachments</b>(<i>resolve</i>) [<>](https://github.com/observablehq/stdlib/blob/main/src/fileAttachment.mjs "Source") | ||
@@ -441,3 +441,3 @@ *Note: this function is not part of the Observable standard library (in notebooks), but is provided by this module as a means for defining custom file attachment implementations when working directly with the Observable runtime.* | ||
<a href="#Generators_disposable" name="Generators_disposable">#</a> Generators.<b>disposable</b>(<i>value</i>, <i>dispose</i>) [<>](https://github.com/observablehq/stdlib/blob/master/src/generators/disposable.js "Source") | ||
<a href="#Generators_disposable" name="Generators_disposable">#</a> Generators.<b>disposable</b>(<i>value</i>, <i>dispose</i>) [<>](https://github.com/observablehq/stdlib/blob/main/src/generators/disposable.mjs "Source") | ||
@@ -452,3 +452,3 @@ Returns a new generator that yields the specified *value* exactly once. The [*generator*.return](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Generator/return) method of the generator will call the specified *dispose* function, passing in the specified *value*. When this generator is the return value of a cell, this allows resources associated with the specified *value* to be disposed automatically when a cell is re-evaluated: *generator*.return is called by the Observable runtime on invalidation. For example, to define a cell that creates a self-disposing [Tensor](https://js.tensorflow.org/): | ||
<a href="#Generators_filter" name="Generators_filter">#</a> Generators.<b>filter</b>(<i>iterator</i>, <i>test</i>) [<>](https://github.com/observablehq/stdlib/blob/master/src/generators/filter.js "Source") | ||
<a href="#Generators_filter" name="Generators_filter">#</a> Generators.<b>filter</b>(<i>iterator</i>, <i>test</i>) [<>](https://github.com/observablehq/stdlib/blob/main/src/generators/filter.mjs "Source") | ||
@@ -463,3 +463,3 @@ Returns a generator that yields a subset of values from the specified *iterator*, if and only if the specified *test* function returns truthy for the given value. The *test* function is invoked with the current value from the *iterator* and the current index, starting at 0 and increasing by one. For example, to yield only odd integers in [0, 100]: | ||
<a href="#Generators_input" name="Generators_input">#</a> Generators.<b>input</b>(<i>input</i>) [<>](https://github.com/observablehq/stdlib/blob/master/src/generators/input.js "Source") | ||
<a href="#Generators_input" name="Generators_input">#</a> Generators.<b>input</b>(<i>input</i>) [<>](https://github.com/observablehq/stdlib/blob/main/src/generators/input.mjs "Source") | ||
@@ -500,3 +500,3 @@ Returns a new generator that yields promises to the current value of the specified *input* element; each promise resolves when the *input* element emits an event. (The promise resolves when the event is emitted, even if the value of the input is unchanged.) If the initial value of the *input* is not undefined, the returned generator’s first yielded value is a resolved promise with the initial value of the *input*. | ||
<a href="#Generators_map" name="Generators_map">#</a> Generators.<b>map</b>(<i>iterator</i>, <i>transform</i>) [<>](https://github.com/observablehq/stdlib/blob/master/src/generators/map.js "Source") | ||
<a href="#Generators_map" name="Generators_map">#</a> Generators.<b>map</b>(<i>iterator</i>, <i>transform</i>) [<>](https://github.com/observablehq/stdlib/blob/main/src/generators/map.mjs "Source") | ||
@@ -511,3 +511,3 @@ Returns a generator that yields transformed values from the specified *iterator*, applying the specified *transform* function to each value. The *transform* function is invoked with the current value from the *iterator* and the current index, starting at 0 and increasing by one. For example, to yield perfect squares: | ||
<a href="#Generators_observe" name="Generators_observe">#</a> Generators.<b>observe</b>(<i>initialize</i>) [<>](https://github.com/observablehq/stdlib/blob/master/src/generators/observe.js "Source") | ||
<a href="#Generators_observe" name="Generators_observe">#</a> Generators.<b>observe</b>(<i>initialize</i>) [<>](https://github.com/observablehq/stdlib/blob/main/src/generators/observe.mjs "Source") | ||
@@ -555,3 +555,3 @@ Returns a generator that yields promises to an observable value, adapting a push-based data source (such as an [Observable](https://github.com/tc39/proposal-observable/blob/master/README.md), an [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter) or an [EventTarget](https://developer.mozilla.org/docs/Web/API/EventTarget)) to a pull-based one. | ||
<a href="#Generators_queue" name="Generators_queue">#</a> Generators.<b>queue</b>(<i>initialize</i>) [<>](https://github.com/observablehq/stdlib/blob/master/src/generators/queue.js "Source") | ||
<a href="#Generators_queue" name="Generators_queue">#</a> Generators.<b>queue</b>(<i>initialize</i>) [<>](https://github.com/observablehq/stdlib/blob/main/src/generators/queue.mjs "Source") | ||
@@ -597,5 +597,5 @@ Returns a generator that yields promises to an observable value, adapting a push-based data source (such as an [Observable](https://github.com/tc39/proposal-observable/blob/master/README.md), an [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter) or an [EventTarget](https://developer.mozilla.org/docs/Web/API/EventTarget)) to a pull-based one. The specified *initialize* function is invoked before Generators.queue returns, being passed a *change* function; calling *change* triggers the resolution of the current promise with the passed value. The *initialize* function may also return a *dispose* function; this function will be called when the generator is [disposed](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Generator/return). (See [invalidation](#invalidation).) | ||
<a href="#Generators_range" name="Generators_range">#</a> Generators.<b>range</b>([<i>start</i>, ]<i>stop</i>[, <i>step</i>]) [<>](https://github.com/observablehq/stdlib/blob/master/src/generators/range.js "Source") | ||
<a href="#Generators_range" name="Generators_range">#</a> Generators.<b>range</b>([<i>start</i>, ]<i>stop</i>[, <i>step</i>]) [<>](https://github.com/observablehq/stdlib/blob/main/src/generators/range.mjs "Source") | ||
Returns a generator yielding an arithmetic progression, similar to the Python built-in [range](https://docs.python.org/3/library/stdtypes.html#typesseq-range). This method is often used to iterate over a sequence of uniformly-spaced numeric values, such as the indexes of an array or the ticks of a linear scale. (See also [d3.range](https://github.com/d3/d3-array/blob/master/README.md#range).) | ||
Returns a generator yielding an arithmetic progression, similar to the Python built-in [range](https://docs.python.org/3/library/stdtypes.html#typesseq-range). This method is often used to iterate over a sequence of uniformly-spaced numeric values, such as the indexes of an array or the ticks of a linear scale. (See also [d3.range](https://github.com/d3/d3-array/blob/main/README.md#range).) | ||
@@ -639,3 +639,3 @@ For example, to iterator over the integers from 0 to 100: | ||
<a href="#Generators_valueAt" name="Generators_valueAt">#</a> Generators.<b>valueAt</b>(<i>iterator</i>, <i>index</i>) [<>](https://github.com/observablehq/stdlib/blob/master/src/generators/valueAt.js "Source") | ||
<a href="#Generators_valueAt" name="Generators_valueAt">#</a> Generators.<b>valueAt</b>(<i>iterator</i>, <i>index</i>) [<>](https://github.com/observablehq/stdlib/blob/main/src/generators/valueAt.mjs "Source") | ||
@@ -650,3 +650,3 @@ Returns the value from the specified *iterator* at the specified *index*. For example, to return the first element from the iterator: | ||
<a href="#Generators_worker" name="Generators_worker">#</a> Generators.<b>worker</b>(<i>source</i>) [<>](https://github.com/observablehq/stdlib/blob/master/src/generators/worker.js "Source") | ||
<a href="#Generators_worker" name="Generators_worker">#</a> Generators.<b>worker</b>(<i>source</i>) [<>](https://github.com/observablehq/stdlib/blob/main/src/generators/worker.mjs "Source") | ||
@@ -667,3 +667,3 @@ Returns a new [disposable generator](#Generators_disposable) that yields a [dedicated Worker](https://developer.mozilla.org/docs/Web/API/Web_Workers_API) running the specified JavaScript *source*. For example, to create a worker that echos messages sent to it: | ||
<a href="#Promises_delay" name="Promises_delay">#</a> Promises.<b>delay</b>(<i>duration</i>[, <i>value</i>]) [<>](https://github.com/observablehq/stdlib/blob/master/src/promises/delay.js "Source") | ||
<a href="#Promises_delay" name="Promises_delay">#</a> Promises.<b>delay</b>(<i>duration</i>[, <i>value</i>]) [<>](https://github.com/observablehq/stdlib/blob/main/src/promises/delay.mjs "Source") | ||
@@ -684,3 +684,3 @@ Returns a promise that resolves with the specified *value* after the specified *duration* in milliseconds. For example, to define a cell that increments approximately every second: | ||
<a href="#Promises_tick" name="Promises_tick">#</a> Promises.<b>tick</b>(<i>duration</i>[, <i>value</i>]) [<>](https://github.com/observablehq/stdlib/blob/master/src/promises/tick.js "Source") | ||
<a href="#Promises_tick" name="Promises_tick">#</a> Promises.<b>tick</b>(<i>duration</i>[, <i>value</i>]) [<>](https://github.com/observablehq/stdlib/blob/main/src/promises/tick.mjs "Source") | ||
@@ -711,3 +711,3 @@ Returns a promise that resolves with the specified *value* at the next integer multiple of *milliseconds* since the UNIX epoch. This is much like [Promises.delay](#Promises_delay), except it allows promises to be synchronized. For example, to define a cell that increments every second, on the second: | ||
<a href="#Promises_when" name="Promises_when">#</a> Promises.<b>when</b>(<i>date</i>[, <i>value</i>]) [<>](https://github.com/observablehq/stdlib/blob/master/src/promises/when.js "Source") | ||
<a href="#Promises_when" name="Promises_when">#</a> Promises.<b>when</b>(<i>date</i>[, <i>value</i>]) [<>](https://github.com/observablehq/stdlib/blob/main/src/promises/when.mjs "Source") | ||
@@ -733,3 +733,3 @@ Returns a promise that resolves with the specified *value* at the specified *date*. This method relies on [setTimeout](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout), and thus the specified *date* must be no longer than 2,147,483,647 milliseconds (24.9 days) from now. | ||
<a href="#now" name="now">#</a> <b>now</b> [<>](https://github.com/observablehq/stdlib/blob/master/src/now.js "Source") | ||
<a href="#now" name="now">#</a> <b>now</b> [<>](https://github.com/observablehq/stdlib/blob/main/src/now.mjs "Source") | ||
@@ -742,3 +742,3 @@ The current value of [Date.now](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date/now). For example, to display the current time in Markdown: | ||
<a href="#width" name="width">#</a> <b>width</b> [<>](https://github.com/observablehq/stdlib/blob/master/src/width.js "Source") | ||
<a href="#width" name="width">#</a> <b>width</b> [<>](https://github.com/observablehq/stdlib/blob/main/src/width.mjs "Source") | ||
@@ -753,3 +753,3 @@ The current width of cells. For example, to make a rounded rectangle in SVG that resizes to fit the page: | ||
<a href="#visibility" name="visibility">#</a> <b>visibility</b>([<i>value</i>]) [<>](https://github.com/observablehq/runtime/blob/master/src/runtime.js "Source") | ||
<a href="#visibility" name="visibility">#</a> <b>visibility</b>([<i>value</i>]) [<>](https://github.com/observablehq/runtime/blob/main/src/runtime.mjs "Source") | ||
@@ -760,3 +760,3 @@ Returns a promise that resolves with the specified *value* when this cell is visible in the viewport. The visibility function is provided by the runtime rather than the standard library because it resolves to a different function for each cell. | ||
<a href="#html" name="html">#</a> <b>html</b>\`<i>string</i>\` [<>](https://github.com/observablehq/stdlib/blob/master/src/html.js "Source") | ||
<a href="#html" name="html">#</a> <b>html</b>\`<i>string</i>\` [<>](https://github.com/observablehq/stdlib/blob/main/src/html.mjs "Source") | ||
@@ -797,3 +797,3 @@ Returns the HTML element represented by the specified HTML *string* literal. This function is intended to be used as a [tagged template literal](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Template_literals#Tagged_template_literals_and_escape_sequences). Leading and trailing whitespace is automatically trimmed. For example, to create an H1 element whose content is “Hello, world!”: | ||
<a href="#svg" name="svg">#</a> <b>svg</b>\`<i>string</i>\` [<>](https://github.com/observablehq/stdlib/blob/master/src/svg.js "Source") | ||
<a href="#svg" name="svg">#</a> <b>svg</b>\`<i>string</i>\` [<>](https://github.com/observablehq/stdlib/blob/main/src/svg.mjs "Source") | ||
@@ -830,3 +830,3 @@ Returns the SVG element represented by the specified SVG *string* literal. This function is intended to be used as a [tagged template literal](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Template_literals#Tagged_template_literals_and_escape_sequences). Leading and trailing whitespace is automatically trimmed. For example, to create an SVG element whose content is a circle: | ||
<a href="#md" name="md">#</a> <b>md</b>\`<i>string</i>\` [<>](https://github.com/observablehq/stdlib/blob/master/src/md.js "Source") | ||
<a href="#md" name="md">#</a> <b>md</b>\`<i>string</i>\` [<>](https://github.com/observablehq/stdlib/blob/main/src/md.mjs "Source") | ||
@@ -868,3 +868,3 @@ Returns the HTML element represented by the specified Markdown *string* literal. Implemented by [Marked](https://github.com/markedjs/marked). Leading and trailing whitespace is automatically trimmed. For example, to create an H1 element whose content is “Hello, world!”: | ||
<a href="#tex" name="tex">#</a> <b>tex</b>\`<i>string</i>\` [<>](https://github.com/observablehq/stdlib/blob/master/src/tex.js "Source") | ||
<a href="#tex" name="tex">#</a> <b>tex</b>\`<i>string</i>\` [<>](https://github.com/observablehq/stdlib/blob/main/src/tex.mjs "Source") | ||
@@ -877,3 +877,3 @@ Returns the HTML element represented by the specified LaTeX *string* literal. Implemented by [KaTeX](https://github.com/Khan/KaTeX). | ||
<a href="#tex_block" name="tex_block">#</a> tex.<b>block</b>\`<i>string</i>\` [<>](https://github.com/observablehq/stdlib/blob/master/src/tex.js "Source") | ||
<a href="#tex_block" name="tex_block">#</a> tex.<b>block</b>\`<i>string</i>\` [<>](https://github.com/observablehq/stdlib/blob/main/src/tex.mjs "Source") | ||
@@ -886,3 +886,3 @@ Equivalent to [tex](#tex), but uses KaTeX’s display mode to produce a bigger block element rather than a smaller inline element. | ||
<a href="#tex_options" name="tex_options">#</a> tex.<b>options</b>(<i>options</i>) [<>](https://github.com/observablehq/stdlib/blob/master/src/tex.js "Source") | ||
<a href="#tex_options" name="tex_options">#</a> tex.<b>options</b>(<i>options</i>) [<>](https://github.com/observablehq/stdlib/blob/main/src/tex.mjs "Source") | ||
@@ -897,3 +897,3 @@ Returns a function equivalent to [tex](#tex), but with the specified *options*. | ||
<a href="#require" name="require">#</a> <b>require</b>(<i>names…</i>) [<>](https://github.com/d3/d3-require/blob/master/index.js "Source") | ||
<a href="#require" name="require">#</a> <b>require</b>(<i>names…</i>) [<>](https://github.com/d3/d3-require/blob/main/index.mjs "Source") | ||
@@ -920,3 +920,3 @@ Returns a promise of the [asynchronous module definition](https://github.com/amdjs/amdjs-api/blob/master/AMD.md) (AMD) with the specified *names*, loaded from npm. Each module *name* can be a package (or scoped package) name optionally followed by the at sign (`@`) and a semver range. For example, to load [d3-array](https://github.com/d3/d3-array): | ||
<a href="#require_resolve" name="require_resolve">#</a> require.<b>resolve</b>(<i>name</i>) [<>](https://github.com/d3/d3-require/blob/master/index.js "Source") | ||
<a href="#require_resolve" name="require_resolve">#</a> require.<b>resolve</b>(<i>name</i>) [<>](https://github.com/d3/d3-require/blob/main/index.mjs "Source") | ||
@@ -929,3 +929,3 @@ Returns a promise to the resolved URL to require the module with the specified *name*. For example: | ||
<a href="#require_alias" name="require_alias">#</a> require.<b>alias</b>(<i>aliases</i>) [<>](https://github.com/d3/d3-require/blob/master/index.js "Source") | ||
<a href="#require_alias" name="require_alias">#</a> require.<b>alias</b>(<i>aliases</i>) [<>](https://github.com/d3/d3-require/blob/main/index.mjs "Source") | ||
@@ -970,5 +970,5 @@ Returns a [require function](#require) with the specified *aliases*. For each key in the specified *aliases* object, any require of that key is substituted with the corresponding value. For example: | ||
<a href="#Library" name="Library">#</a> <b>Library</b>([<i>resolve</i>]) [<>](https://github.com/observablehq/stdlib/blob/master/src/library.js "Source") | ||
<a href="#Library" name="Library">#</a> <b>Library</b>([<i>resolve</i>]) [<>](https://github.com/observablehq/stdlib/blob/main/src/library.mjs "Source") | ||
Returns a new standard library object. If a *resolve* function is specified, it is a function that returns a promise to the URL of the module with the specified *name*; this is used internally by [require](#require) (and by extension, [md](#md) and [tex](#tex)). See [d3-require](https://github.com/d3/d3-require/blob/master/README.md) for details. | ||
Returns a new standard library object. If a *resolve* function is specified, it is a function that returns a promise to the URL of the module with the specified *name*; this is used internally by [require](#require) (and by extension, [md](#md) and [tex](#tex)). See [d3-require](https://github.com/d3/d3-require/blob/main/README.md) for details. | ||
@@ -984,4 +984,4 @@ For example, to create the default standard library, and then use it to create a [canvas](#DOM_canvas): | ||
<a href="#Library_resolve" name="Library_resolve">#</a> Library.<b>resolve</b>(<i>name</i>[, <i>base</i>]) [<>](https://github.com/observablehq/stdlib/blob/master/src/library.js "Source") | ||
<a href="#Library_resolve" name="Library_resolve">#</a> Library.<b>resolve</b>(<i>name</i>[, <i>base</i>]) [<>](https://github.com/observablehq/stdlib/blob/main/src/library.mjs "Source") | ||
An alias for [d3.require.resolve](https://github.com/d3/d3-require/blob/master/README.md#require_resolve). | ||
An alias for [d3.require.resolve](https://github.com/d3/d3-require/blob/main/README.md#require_resolve). |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
134324
1638
3
+ Addedd3-array@^3.2.0
+ Addedd3-array@3.2.4(transitive)
+ Addedinternmap@2.0.3(transitive)