Socket
Socket
Sign inDemoInstall

prismic.io

Package Overview
Dependencies
Maintainers
3
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prismic.io - npm Package Compare versions

Comparing version 1.0.22 to 1.0.23

dist/prismic.io-1.0.23.min.js

2

dist/prismic.io.min.js

@@ -1,1 +0,1 @@

!function(){Object.create||(Object.create=function(){function t(){}return function(e){if(1!=arguments.length)throw new Error("Object.create implementation only accepts one parameter.");return t.prototype=e,new t}}())}(),function(t,e){"use strict";function n(t,e,n,r,i,o){this.name=t,this.fields=e,this.form_method=n,this.rel=r,this.enctype=i,this.action=o}function r(t,e,n){this.api=t,this.form=e,this.data=n||{};for(var r in e.fields)e.fields[r]["default"]&&(this.data[r]=[e.fields[r]["default"]])}function i(t,e,n,r,i,o,s,a){this.page=t,this.results_per_page=e,this.results_size=n,this.total_results_size=r,this.total_pages=i,this.next_page=o,this.prev_page=s,this.results=a}function o(t,e,n,r){this.id=t,this.slug=e,this.type=n,this.tags=r}function s(t,e,n,r,i){this.ref=t,this.label=e,this.isMaster=n,this.scheduledAt=r,this.id=i}function a(){this.cache={},this.states={}}var u=function(e,n,r,i,o,s){var a=new u.fn.init(e,r,i,o,s);return a.get(function(e,r){return n&&e?n(e):(r&&(a.data=r,a.bookmarks=r.bookmarks,a.experiments=new t.Prismic.Experiments(r.experiments)),n?n(null,a):void 0)}),a};u.fn=u.prototype={AT:"at",ANY:"any",SIMILAR:"similar",FULLTEXT:"fulltext",NUMBER:{GT:"number.gt",LT:"number.lt"},DATE:{AFTER:"date.after",BEFORE:"date.before",BETWEEN:"date.between"},DOCUMENT:{ID:"document.id",TYPE:"document.type",TAGS:"document.tags"},constructor:u,data:null,get:function(t){var e=this,n=this.apiCacheKey;this.apiCache.get(n,function(r,i){return r?t(r):i?t(null,i):void e.requestHandler(e.url,function(r,i,o,s){if(r)return t(r,null,o);var a=e.parse(i);s|=e.apiDataTTL,e.apiCache.set(n,a,s,function(e){return e?t(e,null,o):t(null,a,o)})})})},refresh:function(e){var n=this,r=this.apiCacheKey;this.apiCache.remove(r,function(r){if(e&&r)return e(r);if(!e&&r)throw r;n.get(function(r,i){if(e&&r)return e(r);if(!e&&r)throw r;return n.data=i,n.bookmarks=i.bookmarks,n.experiments=new t.Prismic.Experiments(i.experiments),e?e():void 0})})},parse:function(t){var e,r,i,o,a,u,c,l={};for(c in t.forms)t.forms.hasOwnProperty(c)&&(u=t.forms[c],this.accessToken&&(u.fields.access_token={},u.fields.access_token.type="string",u.fields.access_token["default"]=this.accessToken),i=new n(u.name,u.fields,u.form_method,u.rel,u.enctype,u.action),l[c]=i);if(e=t.refs.map(function(t){return new s(t.ref,t.label,t.isMasterRef,t.scheduledAt,t.id)})||[],r=e.filter(function(t){return t.isMaster===!0}),o=t.types,a=t.tags,0===r.length)throw"No master ref.";return{bookmarks:t.bookmarks||{},refs:e,forms:l,master:r[0],types:o,tags:a,oauthInitiate:t.oauth_initiate,oauthToken:t.oauth_token}},init:function(e,n,r,i,o){return this.url=e+(n?(e.indexOf("?")>-1?"&":"?")+"access_token="+n:""),this.accessToken=n,this.requestHandler=r||t.Prismic.Utils.request(),this.apiCache=i||new a,this.apiCacheKey=this.url+(this.accessToken?"#"+this.accessToken:""),this.apiDataTTL=o||5,this},forms:function(t){return this.form(t)},form:function(t){var e=this.data.forms[t];return e?new r(this,e,{}):void 0},master:function(){return this.data.master.ref},ref:function(t){for(var e=0;e<this.data.refs.length;e++)if(this.data.refs[e].label==t)return this.data.refs[e].ref},currentExperiment:function(){return this.experiments.current()},parseDoc:function(e){var n=[];e.linked_documents&&(n=e.linked_documents.map(function(t){return new o(t.id,t.slug,t.type,t.tags)}));var r={};for(var i in e.data[e.type])r[e.type+"."+i]=e.data[e.type][i];return new t.Prismic.Document(e.id,e.type,e.href,e.tags,e.slugs,n,r)}},u.fn.init.prototype=u.fn,n.prototype={},r.prototype={set:function(t,n){var r=this.form.fields[t];if(!r)throw new Error("Unknown field "+t);var i=this.data[t]||[];return(""===n||n===e)&&(n=null),r.multiple?n&&i.push(n):i=n&&[n],this.data[t]=i,this},ref:function(t){return this.set("ref",t)},query:function(t){if("string"==typeof t)return this.set("q",t);var e=[].slice.apply(arguments),n=[];return e.forEach(function(t){var e=0===t[1].indexOf("my.")||0===t[1].indexOf("document.")?t[1]:'"'+t[1]+'"';n.push("[:d = "+t[0]+"("+e+", "+function(){return t.slice(2).map(function(t){return"string"==typeof t?'"'+t+'"':Array.isArray(t)?"["+t.map(function(t){return'"'+t+'"'}).join(",")+"]":t instanceof Date?t.getTime():t}).join(",")}()+")]")}),this.query("["+n.join("")+"]")},pageSize:function(t){return this.set("pageSize",t)},page:function(t){return this.set("page",t)},orderings:function(t){return this.set("orderings",t)},submit:function(t){var e=this.form.action;if(this.data){var n=e.indexOf("?")>-1?"&":"?";for(var r in this.data)if(this.data.hasOwnProperty(r)){var o=this.data[r];if(o)for(var s=0;s<o.length;s++)e+=n+r+"="+encodeURIComponent(o[s]),n="&"}}var a=e+(this.api.accessToken?"#"+this.api.accessToken:""),c=this.api.apiCache,l=this;c.get(a,function(n,r){return n?t(n):r?t(null,r):void l.api.requestHandler(e,function(e,n,r,o){if(e)return void t(e,null,r);var s=n.results.map(u.fn.parseDoc),l=new i(n.page,n.results_per_page,n.results_size,n.total_results_size,n.total_pages,n.next_page,n.prev_page,s||[]);return o?void c.set(a,l,o,function(e){return e?t(e):t(null,l)}):t(null,l)})})}},s.prototype={},a.prototype={get:function(t,e){var n=this.cache[t];return n&&!this.isExpired(t)?e(null,n.data):e()},set:function(t,e,n,r){return this.cache[t]={data:e,expiredIn:n?Date.now()+1e3*n:0},r()},isExpired:function(t){var e=this.cache[t];return e?0!==e.expiredIn&&e.expiredIn<Date.now():!1},remove:function(t,e){return delete this.cache[t],e()},clear:function(t,e){return this.cache={},e()}},t.Prismic={Api:u}}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t,e){"use strict";var n=function(){return"undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest?function(t,e){var n=new XMLHttpRequest,r=function(){var t,r=/max-age\s*=\s*(\d+)/.exec(n.getResponseHeader("Cache-Control"));r&&r.length>1&&(t=parseInt(r[1],10)),e(null,JSON.parse(n.responseText),n,t)},i=function(){var r=n.status;e(new Error("Unexpected status code ["+r+"] on URL "+t),null,n)};n.onreadystatechange=function(){4===n.readyState&&(n.status&&200==n.status?r():i())},n.open("GET",t,!0),n.setRequestHeader("Accept","application/json"),n.send()}:void 0},r=function(){return"undefined"!=typeof XDomainRequest?function(t,e){var n=new XDomainRequest,r=function(){var t,r=/max-age\s*=\s*(\d+)/.exec(xhr.getResponseHeader("Cache-Control"));r&&r.length>1&&(t=parseInt(r[1],10)),e(null,JSON.parse(n.responseText),n,t)},i=function(t){e(new Error(t),null,n)};n.onload=function(){r(n)},n.onerror=function(){i("Unexpected status code on URL "+t)},n.open("GET",t,!0),n.ontimeout=function(){i("Request timeout")},n.onprogress=function(){},n.send()}:void 0},i=function(){if("function"==typeof require&&require("http")){var t=require("http"),n=require("https"),r=require("url"),i=(require("querystring"),require("../package.json"));return function(o,s){var a=r.parse(o),u="https:"==a.protocol?n:t,c={hostname:a.hostname,path:a.path,query:a.query,headers:{Accept:"application/json","User-Agent":"Prismic-javascript-kit/"+i.version+" NodeJS/"+process.version}};u.get(c,function(t){if(t.statusCode&&200==t.statusCode){var n="";t.setEncoding("utf8"),t.on("data",function(t){n+=t}),t.on("end",function(){var r=JSON.parse(n),i=t.headers["cache-control"],o=i&&/max-age=(\d+)/.test(i)?parseInt(/max-age=(\d+)/.exec(i)[1],10):e;s(null,r,t,o)})}else s(new Error("Unexpected status code ["+t.statusCode+"] on URL "+o),null,t)})}}},o=null,s=null,a=function(){var e=n()||r()||i()||function(){throw new Error("No request handler available (tried XMLHttpRequest & NodeJS)")}();return function(){var n=this,r=+new Date,i=arguments;o&&r<o+t.Prismic.Utils.THRESHOLD?(clearTimeout(s),s=setTimeout(function(){o=r,e.apply(n,i)},t.Prismic.Utils.THRESHOLD)):(o=r,e.apply(n,i))}};t.Prismic.Utils={THRESHOLD:50,request:a}}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t){"use strict";function e(){}function n(t,e,n,r,i,o,s){this.id=t,this.type=e,this.href=n,this.tags=r,this.slug=i?i[0]:"-",this.slugs=i,this.linkedDocuments=o,this.fragments=s}function r(t){this.fragments=t}function i(t){var e={};return t&&"[object Function]"===e.toString.call(t)}e.prototype={get:function(e){var n=this._getFragments(e);return n.length?t.Prismic.Fragments.initField(n[0]):null},getAll:function(e){return this._getFragments(e).map(function(e){return t.Prismic.Fragments.initField(e)},this)},getImage:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.Image?n:n instanceof t.Prismic.Fragments.StructuredText?n:null},getAllImages:function(e){var n=this.getAll(e);return n.map(function(e){if(e instanceof t.Prismic.Fragments.Image)return e;if(e instanceof t.Prismic.Fragments.StructuredText)throw new Error("Not done.");return null})},getImageView:function(e,n){var r=this.get(e);if(r instanceof t.Prismic.Fragments.Image)return r.getView(n);if(r instanceof t.Prismic.Fragments.StructuredText)for(var i=0;i<r.blocks.length;i++)if("image"==r.blocks[i].type)return r.blocks[i];return null},getAllImageViews:function(t,e){return this.getAllImages(t).map(function(t){return t.getView(e)})},getTimestamp:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.Timestamp?n.value:void 0},getDate:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.Date?n.value:void 0},getBoolean:function(t){var e=this.get(t);return e.value&&("yes"==e.value.toLowerCase()||"on"==e.value.toLowerCase()||"true"==e.value.toLowerCase())},getText:function(e,n){var r=this.get(e);return r instanceof t.Prismic.Fragments.StructuredText?r.blocks.map(function(t){return t.text?t.text+(n?n:""):void 0}).join("\n"):r instanceof t.Prismic.Fragments.Text&&r.value?r.value+(n?n:""):r instanceof t.Prismic.Fragments.Number&&r.value?r.value+(n?n:""):r instanceof t.Prismic.Fragments.Select&&r.value?r.value+(n?n:""):r instanceof t.Prismic.Fragments.Color&&r.value?r.value+(n?n:""):void 0},getStructuredText:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.StructuredText?n:null},getLink:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.WebLink||n instanceof t.Prismic.Fragments.DocumentLink||n instanceof t.Prismic.Fragments.ImageLink?n:null},getNumber:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.Number?n.value:null},getColor:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.Color?n.value:null},getGeoPoint:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.GeoPoint?n:null},getGroup:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.Group?n:null},getHtml:function(t,e){if(!i(e)){var n=e;e=function(t,e){return n.linkResolver(n,t,e)}}var r=this.get(t);return r&&r.asHtml?r.asHtml(e):null},asHtml:function(t){if(!i(t)){var e=t;t=function(t,n){return e.linkResolver(e,t,n)}}var n=[];for(var r in this.fragments){var o=this.get(r);n.push(o&&o.asHtml?'<section data-field="'+r+'">'+o.asHtml(t)+"</section>":"")}return n.join("")},asText:function(t){if(!i(t)){var e=t;t=function(t,n){return e.linkResolver(e,t,n)}}var n=[];for(var r in this.fragments){var o=this.get(r);n.push(o&&o.asText?o.asText(t):"")}return n.join("")},_getFragments:function(t){return this.fragments&&this.fragments[t]?Array.isArray(this.fragments[t])?this.fragments[t]:[this.fragments[t]]:[]}},n.prototype=Object.create(e.prototype,{}),r.prototype=Object.create(e.prototype,{}),t.Prismic.Document=n,t.Prismic.GroupDoc=r}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t){"use strict";function e(t){this.value=t}function n(t){this.value=t,this.document=t.document,this.isBroken=t.isBroken}function r(t){this.value=t}function i(t){this.value=t}function o(t){this.value=t}function s(t){this.value=t}function a(t){this.value=t}function u(t){this.latitude=t.latitude,this.longitude=t.longitude}function c(t){this.value=t}function l(t){this.value=new Date(t)}function f(t){var e=24==t.length?t.substring(0,22)+":"+t.substring(22,24):t;this.value=new Date(e)}function h(t){this.value=t}function p(t,e){this.main=t,this.views=e||{}}function m(t,e,n,r){this.url=t,this.width=e,this.height=n,this.alt=r}function d(e){this.value=[];for(var n=0;n<e.length;n++)this.value.push(new t.Prismic.GroupDoc(e[n]))}function g(t){this.blocks=t}function v(t){return t&&t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function y(t,e,n,r){if(!e||!e.length)return v(t);var i={},o={};e.forEach(function(t){i[t.start]||(i[t.start]=[]),o[t.end]||(o[t.end]=[]),i[t.start].push(t),o[t.end].unshift(t)});for(var s,a="",u=[],c=0,l=t.length+1;l>c;c++)o[c]&&o[c].forEach(function(){var t=u.pop(),e=k(t.span,t.text,r);0===u.length?a+=e:u[u.length-1].text+=e}),i[c]&&(i[c].sort(function(t,e){return e.end-e.start-(t.end-t.start)}),i[c].forEach(function(t){var e=null;if("hyperlink"==t.type){var r=x(t.data);if(!r)return console&&console.error&&console.error("Impossible to convert span.data as a Fragment",t),"";e=r.url(n),t.url=e}var i={span:t,text:""};u.push(i)})),c<t.length&&(s=t[c],0===u.length?a+=v(s):u[u.length-1].text+=v(s));return a}function x(t){var v={Color:a,Number:c,Date:l,Timestamp:f,Text:e,Embed:h,GeoPoint:u,Select:s,StructuredText:g,"Link.document":n,"Link.web":r,"Link.file":i,"Link.image":o,Group:d};if(v[t.type])return new v[t.type](t.value);if("Image"===t.type){var y=t.value.main,x=new p(new m(y.url,y.dimensions.width,y.dimensions.height,y.alt),{});for(var b in t.value.views)y=t.value.views[b],x.views[b]=new m(y.url,y.dimensions.width,y.dimensions.height,y.alt);return x}console&&console.log&&console.log("Fragment type not supported: ",t.type)}function b(t){var e={};return t&&"[object Function]"===e.toString.call(t)}function k(t,e,n){if(n){var r=n(t,e);if(r)return r}var i={heading1:"h1",heading2:"h2",heading3:"h3",heading4:"h4",heading5:"h5",heading6:"h6",paragraph:"p",preformatted:"pre","list-item":"li","o-list-item":"li","group-list-item":"ul","group-o-list-item":"ol",strong:"strong",em:"em"};if(i[t.type]){var o=i[t.type],s=t.label?' class="'+t.label+'"':"";return"<"+o+s+">"+e+"</"+o+">"}if("image"==t.type){var a=t.label?" "+t.label:"",u='<img src="'+t.url+'" alt="'+t.alt+'">';return'<p class="block-img'+a+'">'+(t.linkUrl?'<a href="'+t.linkUrl+'">'+u+"</a>":u)+"</p>"}return"embed"==t.type?'<div data-oembed="'+t.embed_url+'" data-oembed-type="'+t.type+'" data-oembed-provider="'+t.provider_name+(t.label?'" class="'+t.label:"")+'">'+t.oembed.html+"</div>":"hyperlink"===t.type?'<a href="'+t.url+'">'+e+"</a>":"label"===t.type?'<span class="'+t.data.label+'">'+e+"</span>":"<!-- Warning: "+t.type+" not implemented. Upgrade the Developer Kit. -->"+e}e.prototype={asHtml:function(){return"<span>"+this.value+"</span>"},asText:function(){return this.value}},n.prototype={asHtml:function(t){return'<a href="'+this.url(t)+'">'+this.url(t)+"</a>"},url:function(t){return t(this.document,this.isBroken)},asText:function(t){return this.url(t)}},r.prototype={asHtml:function(){return'<a href="'+this.url()+'">'+this.url()+"</a>"},url:function(){return this.value.url},asText:function(){return this.url()}},i.prototype={asHtml:function(){return'<a href="'+this.url()+'">'+this.value.file.name+"</a>"},url:function(){return this.value.file.url},asText:function(){return this.url()}},o.prototype={asHtml:function(){return'<a href="'+this.url()+'"><img src="'+this.url()+'" alt="'+this.alt+'"></a>'},url:function(){return this.value.image.url},asText:function(){return this.url()}},s.prototype={asHtml:function(){return"<span>"+this.value+"</span>"},asText:function(){return this.value}},a.prototype={asHtml:function(){return"<span>"+this.value+"</span>"},asText:function(){return this.value}},u.prototype={asHtml:function(){return'<div class="geopoint"><span class="latitude">'+this.latitude+'</span><span class="longitude">'+this.longitude+"</span></div>"},asText:function(){return"("+this.latitude+","+this.longitude+")"}},c.prototype={asHtml:function(){return"<span>"+this.value+"</span>"},asText:function(){return this.value.toString()}},l.prototype={asHtml:function(){return"<time>"+this.value+"</time>"},asText:function(){return this.value.toString()}},f.prototype={asHtml:function(){return"<time>"+this.value+"</time>"},asText:function(){return this.value.toString()}},h.prototype={asHtml:function(){return this.value.oembed.html},asText:function(){return""}},p.prototype={getView:function(t){return"main"===t?this.main:this.views[t]},asHtml:function(){return this.main.asHtml()},asText:function(){return""}},m.prototype={ratio:function(){return this.width/this.height},asHtml:function(){return"<img src="+this.url+" width="+this.width+" height="+this.height+' alt="'+this.alt+'">'},asText:function(){return""}},d.prototype={asHtml:function(t){for(var e="",n=0;n<this.value.length;n++)e+=this.value[n].asHtml(t);return e},toArray:function(){return this.value},asText:function(t){for(var e="",n=0;n<this.value.length;n++)for(var r in this.value[n])e+=this.value[n][r].asText(t);return e}},g.prototype={getTitle:function(){for(var t=0;t<this.blocks.length;t++){var e=this.blocks[t];if(0===e.type.indexOf("heading"))return e}},getFirstParagraph:function(){for(var t=0;t<this.blocks.length;t++){var e=this.blocks[t];if("paragraph"==e.type)return e}},getParagraphs:function(){for(var t=[],e=0;e<this.blocks.length;e++){var n=this.blocks[e];"paragraph"==n.type&&t.push(n)}return t},getParagraph:function(t){return this.getParagraphs()[t]},getFirstImage:function(){for(var t=0;t<this.blocks.length;t++){var e=this.blocks[t];if("image"==e.type)return new m(e.url,e.dimensions.width,e.dimensions.height,e.alt)}},asHtml:function(t,e){var n,r,i=[],o=[];if(!b(t)){var s=t;t=function(t,e){return s.linkResolver(s,t,e)}}if(Array.isArray(this.blocks)){for(var a=0;a<this.blocks.length;a++){if(r=this.blocks[a],"image"==r.type&&r.linkTo){var u=x(r.linkTo);r.linkUrl=u.url(t)}"list-item"!==r.type&&"o-list-item"!==r.type?(i.push(r),n=null):n&&n.type=="group-"+r.type?n.blocks.push(r):(n={type:"group-"+r.type,blocks:[r]},i.push(n))}var c=function(n){var r="";return n.blocks?n.blocks.forEach(function(t){r+=k(t,c(t),e)}):r=y(n.text,n.spans,t,e),r};i.forEach(function(t){o.push(k(t,c(t),e))})}return o.join("")},asText:function(){for(var t=[],e=0;e<this.blocks.length;e++){var n=this.blocks[e];n.text&&t.push(n.text)}return t.join(" ")}},t.Prismic.Fragments={Image:p,ImageView:m,Text:e,Number:c,Date:l,Timestamp:f,Select:s,Color:a,StructuredText:g,WebLink:r,DocumentLink:n,ImageLink:o,FileLink:i,Group:d,GeoPoint:u,initField:x,insertSpans:y}}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t){"use strict";var e={at:function(t,e){return["at",t,e]},any:function(t,e){return["any",t,e]},fulltext:function(t,e){return["fulltext",t,e]},similar:function(t,e){return["similar",t,e]},gt:function(t,e){return["number.gt",t,e]},lt:function(t,e){return["number.lt",t,e]},inRange:function(t,e,n){return["number.inRange",t,e,n]},dateBefore:function(t,e){return["date.before",t,e]},dateAfter:function(t,e){return["date.after",t,e]},dateBetween:function(t,e,n){return["date.between",t,e,n]},dayOfMonth:function(t,e){return["date.day-of-month",t,e]},dayOfMonthAfter:function(t,e){return["date.day-of-month-after",t,e]},dayOfMonthBefore:function(t,e){return["date.day-of-month-before",t,e]},dayOfWeek:function(t,e){return["date.day-of-week",t,e]},dayOfWeekAfter:function(t,e){return["date.day-of-week-after",t,e]},dayOfWeekBefore:function(t,e){return["date.day-of-week-before",t,e]},month:function(t,e){return["date.month",t,e]},monthBefore:function(t,e){return["date.month-before",t,e]},monthAfter:function(t,e){return["date.month-after",t,e]},year:function(t,e){return["date.year",t,e]},hour:function(t,e){return["date.hour",t,e]},hourBefore:function(t,e){return["date.hour-before",t,e]},hourAfter:function(t,e){return["date.hour-after",t,e]},near:function(t,e,n,r){return["geopoint.near",t,e,n,r]}};t.Prismic.Predicates=e}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t){"use strict";function e(t){var e=[],r=[];t&&(t.drafts&&t.drafts.forEach(function(t){e.push(new n(t))}),t.running&&t.running.forEach(function(t){r.push(new n(t))})),this.drafts=e,this.running=r,this.cookieName=i}function n(t){this.data=t;var e=[];t.variations&&t.variations.forEach(function(t){e.push(new r(t))}),this.variations=e}function r(t){this.data=t}var i="io.prismic.experiment";e.prototype.current=function(){return this.running.length>0?this.running[0]:null},e.prototype.refFromCookie=function(t){if(!t||""===t.trim())return null;var e=t.trim().split("%20");if(e.length<2)return null;var n=e[0],r=parseInt(e[1],10);return this.running.forEach(function(t){return t.googleId()==n?t.variations.length>r?t.variations[r]:null:void 0}),null},n.prototype.id=function(){return this.data.id},n.prototype.googleId=function(){return this.data.googleId},n.prototype.name=function(){return this.data.name},r.prototype.id=function(){return this.data.id},r.prototype.ref=function(){return this.data.ref},r.prototype.label=function(){return this.data.label},t.Prismic.Experiments=e,t.Prismic.Experiment=n,t.Prismic.Variation=r}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t){t.Prismic.version="1.0.22"}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window);
!function(){Object.create||(Object.create=function(){function t(){}return function(e){if(1!=arguments.length)throw new Error("Object.create implementation only accepts one parameter.");return t.prototype=e,new t}}())}(),function(t,e){"use strict";function n(t,e,n,r,i,o){this.name=t,this.fields=e,this.form_method=n,this.rel=r,this.enctype=i,this.action=o}function r(t,e,n){this.api=t,this.form=e,this.data=n||{};for(var r in e.fields)e.fields[r]["default"]&&(this.data[r]=[e.fields[r]["default"]])}function i(t,e,n,r,i,o,s,a){this.page=t,this.results_per_page=e,this.results_size=n,this.total_results_size=r,this.total_pages=i,this.next_page=o,this.prev_page=s,this.results=a}function o(t,e,n,r){this.id=t,this.slug=e,this.type=n,this.tags=r}function s(t,e,n,r,i){this.ref=t,this.label=e,this.isMaster=n,this.scheduledAt=r,this.id=i}function a(){this.cache={},this.states={}}var u=function(e,n,r,i,o,s){var a=new u.fn.init(e,r,i,o,s);return a.get(function(e,r){return n&&e?n(e):(r&&(a.data=r,a.bookmarks=r.bookmarks,a.experiments=new t.Prismic.Experiments(r.experiments)),n?n(null,a):void 0)}),a};u.fn=u.prototype={AT:"at",ANY:"any",SIMILAR:"similar",FULLTEXT:"fulltext",NUMBER:{GT:"number.gt",LT:"number.lt"},DATE:{AFTER:"date.after",BEFORE:"date.before",BETWEEN:"date.between"},DOCUMENT:{ID:"document.id",TYPE:"document.type",TAGS:"document.tags"},constructor:u,data:null,get:function(t){var e=this,n=this.apiCacheKey;this.apiCache.get(n,function(r,i){return r?t(r):i?t(null,i):void e.requestHandler(e.url,function(r,i,o,s){if(r)return t(r,null,o);var a=e.parse(i);s|=e.apiDataTTL,e.apiCache.set(n,a,s,function(e){return e?t(e,null,o):t(null,a,o)})})})},refresh:function(e){var n=this,r=this.apiCacheKey;this.apiCache.remove(r,function(r){if(e&&r)return e(r);if(!e&&r)throw r;n.get(function(r,i){if(e&&r)return e(r);if(!e&&r)throw r;return n.data=i,n.bookmarks=i.bookmarks,n.experiments=new t.Prismic.Experiments(i.experiments),e?e():void 0})})},parse:function(t){var e,r,i,o,a,u,c,l={};for(c in t.forms)t.forms.hasOwnProperty(c)&&(u=t.forms[c],this.accessToken&&(u.fields.access_token={},u.fields.access_token.type="string",u.fields.access_token["default"]=this.accessToken),i=new n(u.name,u.fields,u.form_method,u.rel,u.enctype,u.action),l[c]=i);if(e=t.refs.map(function(t){return new s(t.ref,t.label,t.isMasterRef,t.scheduledAt,t.id)})||[],r=e.filter(function(t){return t.isMaster===!0}),o=t.types,a=t.tags,0===r.length)throw"No master ref.";return{bookmarks:t.bookmarks||{},refs:e,forms:l,master:r[0],types:o,tags:a,oauthInitiate:t.oauth_initiate,oauthToken:t.oauth_token}},init:function(e,n,r,i,o){return this.url=e+(n?(e.indexOf("?")>-1?"&":"?")+"access_token="+n:""),this.accessToken=n,this.requestHandler=r||t.Prismic.Utils.request(),this.apiCache=i||new a,this.apiCacheKey=this.url+(this.accessToken?"#"+this.accessToken:""),this.apiDataTTL=o||5,this},forms:function(t){return this.form(t)},form:function(t){var e=this.data.forms[t];return e?new r(this,e,{}):void 0},master:function(){return this.data.master.ref},ref:function(t){for(var e=0;e<this.data.refs.length;e++)if(this.data.refs[e].label==t)return this.data.refs[e].ref},currentExperiment:function(){return this.experiments.current()},parseDoc:function(e){var n=[];e.linked_documents&&(n=e.linked_documents.map(function(t){return new o(t.id,t.slug,t.type,t.tags)}));var r={};for(var i in e.data[e.type])r[e.type+"."+i]=e.data[e.type][i];return new t.Prismic.Document(e.id,e.type,e.href,e.tags,e.slugs,n,r)}},u.fn.init.prototype=u.fn,n.prototype={},r.prototype={set:function(t,n){var r=this.form.fields[t];if(!r)throw new Error("Unknown field "+t);var i=this.data[t]||[];return(""===n||n===e)&&(n=null),r.multiple?n&&i.push(n):i=n&&[n],this.data[t]=i,this},ref:function(t){return this.set("ref",t)},query:function(t){if("string"==typeof t)return this.set("q",t);var e=[].slice.apply(arguments),n=[];return e.forEach(function(t){var e=0===t[1].indexOf("my.")||0===t[1].indexOf("document.")?t[1]:'"'+t[1]+'"';n.push("[:d = "+t[0]+"("+e+", "+function(){return t.slice(2).map(function(t){return"string"==typeof t?'"'+t+'"':Array.isArray(t)?"["+t.map(function(t){return'"'+t+'"'}).join(",")+"]":t instanceof Date?t.getTime():t}).join(",")}()+")]")}),this.query("["+n.join("")+"]")},pageSize:function(t){return this.set("pageSize",t)},page:function(t){return this.set("page",t)},orderings:function(t){return this.set("orderings",t)},submit:function(t){var e=this.form.action;if(this.data){var n=e.indexOf("?")>-1?"&":"?";for(var r in this.data)if(this.data.hasOwnProperty(r)){var o=this.data[r];if(o)for(var s=0;s<o.length;s++)e+=n+r+"="+encodeURIComponent(o[s]),n="&"}}var a=e+(this.api.accessToken?"#"+this.api.accessToken:""),c=this.api.apiCache,l=this;c.get(a,function(n,r){return n?t(n):r?t(null,r):void l.api.requestHandler(e,function(e,n,r,o){if(e)return void t(e,null,r);var s=n.results.map(u.fn.parseDoc),l=new i(n.page,n.results_per_page,n.results_size,n.total_results_size,n.total_pages,n.next_page,n.prev_page,s||[]);return o?void c.set(a,l,o,function(e){return e?t(e):t(null,l)}):t(null,l)})})}},s.prototype={},a.prototype={get:function(t,e){var n=this.cache[t];return n&&!this.isExpired(t)?e(null,n.data):e()},set:function(t,e,n,r){return this.cache[t]={data:e,expiredIn:n?Date.now()+1e3*n:0},r()},isExpired:function(t){var e=this.cache[t];return e?0!==e.expiredIn&&e.expiredIn<Date.now():!1},remove:function(t,e){return delete this.cache[t],e()},clear:function(t,e){return this.cache={},e()}},t.Prismic={Api:u}}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t,e){"use strict";var n=function(){return"undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest?function(t,e){var n=new XMLHttpRequest,r=function(){var t,r=/max-age\s*=\s*(\d+)/.exec(n.getResponseHeader("Cache-Control"));r&&r.length>1&&(t=parseInt(r[1],10)),e(null,JSON.parse(n.responseText),n,t)},i=function(){var r=n.status;e(new Error("Unexpected status code ["+r+"] on URL "+t),null,n)};n.onreadystatechange=function(){4===n.readyState&&(n.status&&200==n.status?r():i())},n.open("GET",t,!0),n.setRequestHeader("Accept","application/json"),n.send()}:void 0},r=function(){return"undefined"!=typeof XDomainRequest?function(t,e){var n=new XDomainRequest,r=function(){var t,r=/max-age\s*=\s*(\d+)/.exec(xhr.getResponseHeader("Cache-Control"));r&&r.length>1&&(t=parseInt(r[1],10)),e(null,JSON.parse(n.responseText),n,t)},i=function(t){e(new Error(t),null,n)};n.onload=function(){r(n)},n.onerror=function(){i("Unexpected status code on URL "+t)},n.open("GET",t,!0),n.ontimeout=function(){i("Request timeout")},n.onprogress=function(){},n.send()}:void 0},i=function(){if("function"==typeof require&&require("http")){var t=require("http"),n=require("https"),r=require("url"),i=(require("querystring"),require("../package.json"));return function(o,s){var a=r.parse(o),u="https:"==a.protocol?n:t,c={hostname:a.hostname,path:a.path,query:a.query,headers:{Accept:"application/json","User-Agent":"Prismic-javascript-kit/"+i.version+" NodeJS/"+process.version}};u.get(c,function(t){if(t.statusCode&&200==t.statusCode){var n="";t.setEncoding("utf8"),t.on("data",function(t){n+=t}),t.on("end",function(){var r=JSON.parse(n),i=t.headers["cache-control"],o=i&&/max-age=(\d+)/.test(i)?parseInt(/max-age=(\d+)/.exec(i)[1],10):e;s(null,r,t,o)})}else s(new Error("Unexpected status code ["+t.statusCode+"] on URL "+o),null,t)})}}},o=0,s=[],a=function(){if(!(0===s.length||o>=t.Prismic.Utils.MAX_CONNECTIONS)){o++;var e=s.shift(),u=n()||r()||i()||function(){throw new Error("No request handler available (tried XMLHttpRequest & NodeJS)")}();u.call(this,e.url,function(t,n,r,i){o--,e.callback(t,n,r,i),a()})}},u=function(){return function(t,e){s.push({url:t,callback:e}),a()}};t.Prismic.Utils={MAX_CONNECTIONS:20,request:u}}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t){"use strict";function e(){}function n(t,e,n,r,i,o,s){this.id=t,this.type=e,this.href=n,this.tags=r,this.slug=i?i[0]:"-",this.slugs=i,this.linkedDocuments=o,this.fragments=s}function r(t){this.fragments=t}function i(t){var e={};return t&&"[object Function]"===e.toString.call(t)}e.prototype={get:function(e){var n=this._getFragments(e);return n.length?t.Prismic.Fragments.initField(n[0]):null},getAll:function(e){return this._getFragments(e).map(function(e){return t.Prismic.Fragments.initField(e)},this)},getImage:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.Image?n:n instanceof t.Prismic.Fragments.StructuredText?n:null},getAllImages:function(e){var n=this.getAll(e);return n.map(function(e){if(e instanceof t.Prismic.Fragments.Image)return e;if(e instanceof t.Prismic.Fragments.StructuredText)throw new Error("Not done.");return null})},getImageView:function(e,n){var r=this.get(e);if(r instanceof t.Prismic.Fragments.Image)return r.getView(n);if(r instanceof t.Prismic.Fragments.StructuredText)for(var i=0;i<r.blocks.length;i++)if("image"==r.blocks[i].type)return r.blocks[i];return null},getAllImageViews:function(t,e){return this.getAllImages(t).map(function(t){return t.getView(e)})},getTimestamp:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.Timestamp?n.value:void 0},getDate:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.Date?n.value:void 0},getBoolean:function(t){var e=this.get(t);return e.value&&("yes"==e.value.toLowerCase()||"on"==e.value.toLowerCase()||"true"==e.value.toLowerCase())},getText:function(e,n){var r=this.get(e);return r instanceof t.Prismic.Fragments.StructuredText?r.blocks.map(function(t){return t.text?t.text+(n?n:""):void 0}).join("\n"):r instanceof t.Prismic.Fragments.Text&&r.value?r.value+(n?n:""):r instanceof t.Prismic.Fragments.Number&&r.value?r.value+(n?n:""):r instanceof t.Prismic.Fragments.Select&&r.value?r.value+(n?n:""):r instanceof t.Prismic.Fragments.Color&&r.value?r.value+(n?n:""):void 0},getStructuredText:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.StructuredText?n:null},getLink:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.WebLink||n instanceof t.Prismic.Fragments.DocumentLink||n instanceof t.Prismic.Fragments.ImageLink?n:null},getNumber:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.Number?n.value:null},getColor:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.Color?n.value:null},getGeoPoint:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.GeoPoint?n:null},getGroup:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.Group?n:null},getHtml:function(t,e){if(!i(e)){var n=e;e=function(t,e){return n.linkResolver(n,t,e)}}var r=this.get(t);return r&&r.asHtml?r.asHtml(e):null},asHtml:function(t){if(!i(t)){var e=t;t=function(t,n){return e.linkResolver(e,t,n)}}var n=[];for(var r in this.fragments){var o=this.get(r);n.push(o&&o.asHtml?'<section data-field="'+r+'">'+o.asHtml(t)+"</section>":"")}return n.join("")},asText:function(t){if(!i(t)){var e=t;t=function(t,n){return e.linkResolver(e,t,n)}}var n=[];for(var r in this.fragments){var o=this.get(r);n.push(o&&o.asText?o.asText(t):"")}return n.join("")},_getFragments:function(t){return this.fragments&&this.fragments[t]?Array.isArray(this.fragments[t])?this.fragments[t]:[this.fragments[t]]:[]}},n.prototype=Object.create(e.prototype,{}),r.prototype=Object.create(e.prototype,{}),t.Prismic.Document=n,t.Prismic.GroupDoc=r}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t){"use strict";function e(t){this.value=t}function n(t){this.value=t,this.document=t.document,this.isBroken=t.isBroken}function r(t){this.value=t}function i(t){this.value=t}function o(t){this.value=t}function s(t){this.value=t}function a(t){this.value=t}function u(t){this.latitude=t.latitude,this.longitude=t.longitude}function c(t){this.value=t}function l(t){this.value=new Date(t)}function f(t){var e=24==t.length?t.substring(0,22)+":"+t.substring(22,24):t;this.value=new Date(e)}function h(t){this.value=t}function p(t,e){this.main=t,this.views=e||{}}function m(t,e,n,r){this.url=t,this.width=e,this.height=n,this.alt=r}function d(e){this.value=[];for(var n=0;n<e.length;n++)this.value.push(new t.Prismic.GroupDoc(e[n]))}function g(t){this.blocks=t}function v(t){return t&&t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function y(t,e,n,r){if(!e||!e.length)return v(t);var i={},o={};e.forEach(function(t){i[t.start]||(i[t.start]=[]),o[t.end]||(o[t.end]=[]),i[t.start].push(t),o[t.end].unshift(t)});for(var s,a="",u=[],c=0,l=t.length+1;l>c;c++)o[c]&&o[c].forEach(function(){var t=u.pop(),e=k(t.span,t.text,r);0===u.length?a+=e:u[u.length-1].text+=e}),i[c]&&(i[c].sort(function(t,e){return e.end-e.start-(t.end-t.start)}),i[c].forEach(function(t){var e=null;if("hyperlink"==t.type){var r=x(t.data);if(!r)return console&&console.error&&console.error("Impossible to convert span.data as a Fragment",t),"";e=r.url(n),t.url=e}var i={span:t,text:""};u.push(i)})),c<t.length&&(s=t[c],0===u.length?a+=v(s):u[u.length-1].text+=v(s));return a}function x(t){var v={Color:a,Number:c,Date:l,Timestamp:f,Text:e,Embed:h,GeoPoint:u,Select:s,StructuredText:g,"Link.document":n,"Link.web":r,"Link.file":i,"Link.image":o,Group:d};if(v[t.type])return new v[t.type](t.value);if("Image"===t.type){var y=t.value.main,x=new p(new m(y.url,y.dimensions.width,y.dimensions.height,y.alt),{});for(var b in t.value.views)y=t.value.views[b],x.views[b]=new m(y.url,y.dimensions.width,y.dimensions.height,y.alt);return x}console&&console.log&&console.log("Fragment type not supported: ",t.type)}function b(t){var e={};return t&&"[object Function]"===e.toString.call(t)}function k(t,e,n){if(n){var r=n(t,e);if(r)return r}var i={heading1:"h1",heading2:"h2",heading3:"h3",heading4:"h4",heading5:"h5",heading6:"h6",paragraph:"p",preformatted:"pre","list-item":"li","o-list-item":"li","group-list-item":"ul","group-o-list-item":"ol",strong:"strong",em:"em"};if(i[t.type]){var o=i[t.type],s=t.label?' class="'+t.label+'"':"";return"<"+o+s+">"+e+"</"+o+">"}if("image"==t.type){var a=t.label?" "+t.label:"",u='<img src="'+t.url+'" alt="'+t.alt+'">';return'<p class="block-img'+a+'">'+(t.linkUrl?'<a href="'+t.linkUrl+'">'+u+"</a>":u)+"</p>"}return"embed"==t.type?'<div data-oembed="'+t.embed_url+'" data-oembed-type="'+t.type+'" data-oembed-provider="'+t.provider_name+(t.label?'" class="'+t.label:"")+'">'+t.oembed.html+"</div>":"hyperlink"===t.type?'<a href="'+t.url+'">'+e+"</a>":"label"===t.type?'<span class="'+t.data.label+'">'+e+"</span>":"<!-- Warning: "+t.type+" not implemented. Upgrade the Developer Kit. -->"+e}e.prototype={asHtml:function(){return"<span>"+this.value+"</span>"},asText:function(){return this.value}},n.prototype={asHtml:function(t){return'<a href="'+this.url(t)+'">'+this.url(t)+"</a>"},url:function(t){return t(this.document,this.isBroken)},asText:function(t){return this.url(t)}},r.prototype={asHtml:function(){return'<a href="'+this.url()+'">'+this.url()+"</a>"},url:function(){return this.value.url},asText:function(){return this.url()}},i.prototype={asHtml:function(){return'<a href="'+this.url()+'">'+this.value.file.name+"</a>"},url:function(){return this.value.file.url},asText:function(){return this.url()}},o.prototype={asHtml:function(){return'<a href="'+this.url()+'"><img src="'+this.url()+'" alt="'+this.alt+'"></a>'},url:function(){return this.value.image.url},asText:function(){return this.url()}},s.prototype={asHtml:function(){return"<span>"+this.value+"</span>"},asText:function(){return this.value}},a.prototype={asHtml:function(){return"<span>"+this.value+"</span>"},asText:function(){return this.value}},u.prototype={asHtml:function(){return'<div class="geopoint"><span class="latitude">'+this.latitude+'</span><span class="longitude">'+this.longitude+"</span></div>"},asText:function(){return"("+this.latitude+","+this.longitude+")"}},c.prototype={asHtml:function(){return"<span>"+this.value+"</span>"},asText:function(){return this.value.toString()}},l.prototype={asHtml:function(){return"<time>"+this.value+"</time>"},asText:function(){return this.value.toString()}},f.prototype={asHtml:function(){return"<time>"+this.value+"</time>"},asText:function(){return this.value.toString()}},h.prototype={asHtml:function(){return this.value.oembed.html},asText:function(){return""}},p.prototype={getView:function(t){return"main"===t?this.main:this.views[t]},asHtml:function(){return this.main.asHtml()},asText:function(){return""}},m.prototype={ratio:function(){return this.width/this.height},asHtml:function(){return"<img src="+this.url+" width="+this.width+" height="+this.height+' alt="'+this.alt+'">'},asText:function(){return""}},d.prototype={asHtml:function(t){for(var e="",n=0;n<this.value.length;n++)e+=this.value[n].asHtml(t);return e},toArray:function(){return this.value},asText:function(t){for(var e="",n=0;n<this.value.length;n++)for(var r in this.value[n])e+=this.value[n][r].asText(t);return e}},g.prototype={getTitle:function(){for(var t=0;t<this.blocks.length;t++){var e=this.blocks[t];if(0===e.type.indexOf("heading"))return e}},getFirstParagraph:function(){for(var t=0;t<this.blocks.length;t++){var e=this.blocks[t];if("paragraph"==e.type)return e}},getParagraphs:function(){for(var t=[],e=0;e<this.blocks.length;e++){var n=this.blocks[e];"paragraph"==n.type&&t.push(n)}return t},getParagraph:function(t){return this.getParagraphs()[t]},getFirstImage:function(){for(var t=0;t<this.blocks.length;t++){var e=this.blocks[t];if("image"==e.type)return new m(e.url,e.dimensions.width,e.dimensions.height,e.alt)}},asHtml:function(t,e){var n,r,i=[],o=[];if(!b(t)){var s=t;t=function(t,e){return s.linkResolver(s,t,e)}}if(Array.isArray(this.blocks)){for(var a=0;a<this.blocks.length;a++){if(r=this.blocks[a],"image"==r.type&&r.linkTo){var u=x(r.linkTo);r.linkUrl=u.url(t)}"list-item"!==r.type&&"o-list-item"!==r.type?(i.push(r),n=null):n&&n.type=="group-"+r.type?n.blocks.push(r):(n={type:"group-"+r.type,blocks:[r]},i.push(n))}var c=function(n){var r="";return n.blocks?n.blocks.forEach(function(t){r+=k(t,c(t),e)}):r=y(n.text,n.spans,t,e),r};i.forEach(function(t){o.push(k(t,c(t),e))})}return o.join("")},asText:function(){for(var t=[],e=0;e<this.blocks.length;e++){var n=this.blocks[e];n.text&&t.push(n.text)}return t.join(" ")}},t.Prismic.Fragments={Image:p,ImageView:m,Text:e,Number:c,Date:l,Timestamp:f,Select:s,Color:a,StructuredText:g,WebLink:r,DocumentLink:n,ImageLink:o,FileLink:i,Group:d,GeoPoint:u,initField:x,insertSpans:y}}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t){"use strict";var e={at:function(t,e){return["at",t,e]},any:function(t,e){return["any",t,e]},fulltext:function(t,e){return["fulltext",t,e]},similar:function(t,e){return["similar",t,e]},gt:function(t,e){return["number.gt",t,e]},lt:function(t,e){return["number.lt",t,e]},inRange:function(t,e,n){return["number.inRange",t,e,n]},dateBefore:function(t,e){return["date.before",t,e]},dateAfter:function(t,e){return["date.after",t,e]},dateBetween:function(t,e,n){return["date.between",t,e,n]},dayOfMonth:function(t,e){return["date.day-of-month",t,e]},dayOfMonthAfter:function(t,e){return["date.day-of-month-after",t,e]},dayOfMonthBefore:function(t,e){return["date.day-of-month-before",t,e]},dayOfWeek:function(t,e){return["date.day-of-week",t,e]},dayOfWeekAfter:function(t,e){return["date.day-of-week-after",t,e]},dayOfWeekBefore:function(t,e){return["date.day-of-week-before",t,e]},month:function(t,e){return["date.month",t,e]},monthBefore:function(t,e){return["date.month-before",t,e]},monthAfter:function(t,e){return["date.month-after",t,e]},year:function(t,e){return["date.year",t,e]},hour:function(t,e){return["date.hour",t,e]},hourBefore:function(t,e){return["date.hour-before",t,e]},hourAfter:function(t,e){return["date.hour-after",t,e]},near:function(t,e,n,r){return["geopoint.near",t,e,n,r]}};t.Prismic.Predicates=e}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t){"use strict";function e(t){var e=[],r=[];t&&(t.drafts&&t.drafts.forEach(function(t){e.push(new n(t))}),t.running&&t.running.forEach(function(t){r.push(new n(t))})),this.drafts=e,this.running=r,this.cookieName=i}function n(t){this.data=t;var e=[];t.variations&&t.variations.forEach(function(t){e.push(new r(t))}),this.variations=e}function r(t){this.data=t}var i="io.prismic.experiment";e.prototype.current=function(){return this.running.length>0?this.running[0]:null},e.prototype.refFromCookie=function(t){if(!t||""===t.trim())return null;var e=t.trim().split("%20");if(e.length<2)return null;var n=e[0],r=parseInt(e[1],10);return this.running.forEach(function(t){return t.googleId()==n?t.variations.length>r?t.variations[r]:null:void 0}),null},n.prototype.id=function(){return this.data.id},n.prototype.googleId=function(){return this.data.googleId},n.prototype.name=function(){return this.data.name},r.prototype.id=function(){return this.data.id},r.prototype.ref=function(){return this.data.ref},r.prototype.label=function(){return this.data.label},t.Prismic.Experiments=e,t.Prismic.Experiment=n,t.Prismic.Variation=r}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t){t.Prismic.version="1.0.23"}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window);

@@ -44,3 +44,3 @@ var gulp = require('gulp'),

gulp.task('concat', ['version'], function() {
gulp.src(SOURCES.concat('src/version.js'))
return gulp.src(SOURCES.concat('src/version.js'))
.pipe(concat('prismic.io.js'))

@@ -51,3 +51,3 @@ .pipe(gulp.dest('dist'))

gulp.task('minify', ['version'], function() {
gulp.src(SOURCES.concat('src/version.js'))
return gulp.src(SOURCES.concat('src/version.js'))
.pipe(concat('prismic.io.min.js'))

@@ -59,3 +59,3 @@ .pipe(uglify())

gulp.task('copy', ['test', 'version'], function() {
gulp.src(SOURCES.concat('src/version.js'))
return gulp.src(SOURCES.concat('src/version.js'))
.pipe(concat('prismic.io-%VERSION%.min.js'.replace('%VERSION%', pkg.version)))

@@ -67,3 +67,3 @@ .pipe(uglify())

gulp.task('doc', function() {
gulp.src(SOURCES.concat(['README.md']))
return gulp.src(SOURCES.concat(['README.md']))
.pipe(jsdoc('doc'))

@@ -73,9 +73,8 @@ });

gulp.task('deploy:doc', ['doc'], function () {
gulp.src("./doc/**/*")
return gulp.src("./doc/**/*")
.pipe(deploy());
});
gulp.task('deploy:gist', ['test:doc'], function () {
gulp.src("./test/doc.js")
gulp.task('deploy:gist', ['test:doc'], function (cb) {
return gulp.src("./test/doc.js")
.pipe(gist());

@@ -95,3 +94,3 @@ });

gulp.task('jshint', function() {
gulp.src(SOURCES)
return gulp.src(SOURCES)
.pipe(jshint())

@@ -98,0 +97,0 @@ .pipe(jshint.reporter('default'))

@@ -12,3 +12,3 @@ {

],
"version": "1.0.22",
"version": "1.0.23",
"devDependencies": {

@@ -15,0 +15,0 @@ "codeclimate-test-reporter": "~0.0.4",

## JavaScript development kit for prismic.io
[![npm version](https://badge.fury.io/js/prismic.io.svg)](http://badge.fury.io/js/prismic.io)
[![Build Status](https://api.travis-ci.org/prismicio/javascript-kit.png)](https://travis-ci.org/prismicio/javascript-kit)

@@ -4,0 +5,0 @@ [![Code Climate](https://codeclimate.com/github/prismicio/javascript-kit.png)](https://codeclimate.com/github/prismicio/javascript-kit)

@@ -149,25 +149,29 @@ (function (Global, undefined) {

var last = null;
var deferTimer = null;
// Number of requests currently running (capped by MAX_CONNECTIONS)
var running = 0;
// Requests in queue
var queue = [];
var request = function () {
var processQueue = function() {
if (queue.length === 0 || running >= Global.Prismic.Utils.MAX_CONNECTIONS) {
return;
}
running++;
var next = queue.shift();
var fn = ajaxRequest() || xdomainRequest() || nodeJSRequest() ||
(function() {throw new Error("No request handler available (tried XMLHttpRequest & NodeJS)");})();
return function () {
var context = this;
fn.call(this, next.url, function(error, result, xhr, ttl) {
running--;
next.callback(error, result, xhr, ttl);
processQueue();
});
};
var now = +new Date(),
args = arguments;
if (last && now < last + Global.Prismic.Utils.THRESHOLD) {
// wait before firing the request
clearTimeout(deferTimer);
deferTimer = setTimeout(function () {
last = now;
fn.apply(context, args);
}, Global.Prismic.Utils.THRESHOLD);
} else {
// Call it right away
last = now;
fn.apply(context, args);
}
var request = function () {
return function (url, callback) {
queue.push({
'url': url,
'callback': callback
});
processQueue();
};

@@ -177,3 +181,3 @@ };

Global.Prismic.Utils = {
THRESHOLD: 50, // Minimum delay between 2 requests in milliseconds (50ms => 20 requests/second)
MAX_CONNECTIONS: 20, // Number of maximum simultaneous connections to the prismic server
request: request

@@ -180,0 +184,0 @@ };

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc