prismic.io
Advanced tools
Comparing version 1.0.27 to 1.0.28
@@ -1,1 +0,1 @@ | ||
!function(){"function"!=typeof Object.create&&(Object.create=function(){var t=function(){};return function(e){if(arguments.length>1)throw Error("Second argument not supported");if("object"!=typeof e)throw TypeError("Argument must be an object");t.prototype=e;var n={};return t.prototype=null,n}}())}(),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,experiments:t.experiments,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(n){var r=[];n.linked_documents&&(r=n.linked_documents.map(function(t){return new o(t.id,t.slug,t.type,t.tags)}));var i={};for(var s in n.data[n.type])i[n.type+"."+s]=n.data[n.type][s];var a=[];if(n.slugs!==e)for(var u=0;u<n.slugs.length;u++)a.push(decodeURIComponent(n.slugs[u]));return new t.Prismic.Document(n.id,n.type,n.href,n.tags,a,r,i)},previewSession:function(e,n,r,i){var o=this,s=t.Prismic.Predicates;this.requestHandler(e,function(t,a,u){if(t)return console.log("Error from the request"),void i(t,r,u);try{var c=a.mainDocument;c?o.form("everything").query(s.at("document.id",c)).ref(e).submit(function(t,e){0===e.results.length?i(null,r,u):i(null,n(e.results[0]),u)}):i(null,r,u)}catch(l){console.log("Caught e ",l),i(l,r,u)}})}},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"string"==typeof t?this.set("orderings",t):t?this.set("orderings","["+t.join(",")+"]"):this},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={experimentCookie:"io.prismic.experiment",previewCookie:"io.prismic.preview",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,"&").replace(/</g,"<").replace(/>/g,">").replace(/\n/g,"<br>")}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();if("undefined"!=typeof t){var 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}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}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(" ");if(e.length<2)return null;var n=e[0],r=parseInt(e[1],10),i=this.running.filter(function(t){return t.googleId()==n&&t.variations.length>r})[0];return i?i.variations[r].ref():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.27"}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window); | ||
!function(){"function"!=typeof Object.create&&(Object.create=function(){var t=function(){};return function(e){if(arguments.length>1)throw Error("Second argument not supported");if("object"!=typeof e)throw TypeError("Argument must be an object");t.prototype=e;var n={};return t.prototype=null,n}}())}(),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,i){this.ref=t,this.label=e,this.isMaster=n,this.scheduledAt=r,this.id=i}function s(){this.cache={},this.states={}}var a=function(e,n,r,i,o,s){var u=new a.fn.init(e,r,i,o,s);return u.get(function(e,r){return n&&e?n(e):(r&&(u.data=r,u.bookmarks=r.bookmarks,u.experiments=new t.Prismic.Experiments(r.experiments)),n?n(null,u):void 0)}),u};a.fn=a.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:a,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,s,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 o(t.ref,t.label,t.isMasterRef,t.scheduledAt,t.id)})||[],r=e.filter(function(t){return t.isMaster===!0}),s=t.types,a=t.tags,0===r.length)throw"No master ref.";return{bookmarks:t.bookmarks||{},refs:e,forms:l,master:r[0],types:s,tags:a,experiments:t.experiments,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 s,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(n){var r={};for(var i in n.data[n.type])r[n.type+"."+i]=n.data[n.type][i];var o=[];if(n.slugs!==e)for(var s=0;s<n.slugs.length;s++)o.push(decodeURIComponent(n.slugs[s]));return new t.Prismic.Document(n.id,n.type,n.href,n.tags,o,r)},previewSession:function(e,n,r,i){var o=this,s=t.Prismic.Predicates;this.requestHandler(e,function(t,a,u){if(t)return console.log("Error from the request"),void i(t,r,u);try{var c=a.mainDocument;c?o.form("everything").query(s.at("document.id",c)).ref(e).submit(function(t,e){0===e.results.length?i(null,r,u):i(null,n(e.results[0]),u)}):i(null,r,u)}catch(l){console.log("Caught e ",l),i(l,r,u)}})}},a.fn.init.prototype=a.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"string"==typeof t?this.set("orderings",t):t?this.set("orderings","["+t.join(",")+"]"):this},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 u=e+(this.api.accessToken?"#"+this.api.accessToken:""),c=this.api.apiCache,l=this;c.get(u,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(a.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(u,l,o,function(e){return e?t(e):t(null,l)}):t(null,l)})})}},o.prototype={},s.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={experimentCookie:"io.prismic.experiment",previewCookie:"io.prismic.preview",Api:a}}("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(t,e,n,r){this.id=t,this.slug=e,this.type=n,this.tags=r}function n(){}function r(t,e,n,r,i,o){this.id=t,this.type=e,this.href=n,this.tags=r,this.slug=i?i[0]:"-",this.slugs=i,this.fragments=o}function i(t){this.fragments=t}function o(t){var e={};return t&&"[object Function]"===e.toString.call(t)}n.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(!o(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(!o(t)){var e=t;t=function(t,n){return e.linkResolver(e,t,n)}}var n=[];for(var r in this.fragments){var i=this.get(r);n.push(i&&i.asHtml?'<section data-field="'+r+'">'+i.asHtml(t)+"</section>":"")}return n.join("")},asText:function(t){if(!o(t)){var e=t;t=function(t,n){return e.linkResolver(e,t,n)}}var n=[];for(var r in this.fragments){var i=this.get(r);n.push(i&&i.asText?i.asText(t):"")}return n.join("")},linkedDocuments:function(){var e,n,r,i=[];for(var o in this.fragments){var s=this.get(o);if(s instanceof t.Prismic.Fragments.DocumentLink&&i.push(s.document),s instanceof t.Prismic.Fragments.StructuredText)for(e=0;e<s.blocks.length;e++){var a=s.blocks[e];"image"==a.type&&a.linkTo&&(r=t.Prismic.Fragments.initField(a.linkTo),r instanceof DocumentLink&&i.push(r.document));var u=a.spans||[];for(n=0;n<u.length;n++){var c=u[n];"hyperlink"==c.type&&(r=t.Prismic.Fragments.initField(c.data),r instanceof t.Prismic.Fragments.DocumentLink&&i.push(r.document))}}if(s instanceof t.Prismic.Fragments.Group)for(e=0;e<s.value.length;e++)i=i.concat(s.value[e].linkedDocuments())}return i},_getFragments:function(t){return this.fragments&&this.fragments[t]?Array.isArray(this.fragments[t])?this.fragments[t]:[this.fragments[t]]:[]}},r.prototype=Object.create(n.prototype),i.prototype=Object.create(n.prototype),t.Prismic.LinkedDocument=e,t.Prismic.Document=r,t.Prismic.GroupDoc=i}("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(e){this.value=e,this.document=new t.Prismic.LinkedDocument(e.document.id,e.document.slug,e.document.type,e.document.tags),this.isBroken=e.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,"&").replace(/</g,"<").replace(/>/g,">").replace(/\n/g,"<br>")}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();if("undefined"!=typeof t){var 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}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}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(" ");if(e.length<2)return null;var n=e[0],r=parseInt(e[1],10),i=this.running.filter(function(t){return t.googleId()==n&&t.variations.length>r})[0];return i?i.variations[r].ref():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.28"}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window); |
@@ -12,3 +12,3 @@ { | ||
], | ||
"version": "1.0.27", | ||
"version": "1.0.28", | ||
"devDependencies": { | ||
@@ -15,0 +15,0 @@ "codeclimate-test-reporter": "~0.0.4", |
@@ -281,9 +281,2 @@ (function (Global, undefined) { | ||
parseDoc: function(json) { | ||
var linkedDocuments = []; | ||
if(json.linked_documents) { | ||
linkedDocuments = json.linked_documents.map(function(linkedDoc) { | ||
return new LinkedDocument(linkedDoc['id'], linkedDoc['slug'], linkedDoc['type'], linkedDoc['tags']); | ||
}); | ||
} | ||
var fragments = {}; | ||
@@ -307,3 +300,2 @@ for(var field in json.data[json.type]) { | ||
slugs, | ||
linkedDocuments, | ||
fragments | ||
@@ -620,26 +612,2 @@ ); | ||
/** | ||
* A link to a document as in "related document" (not a hyperlink). | ||
* @constructor | ||
* @global | ||
*/ | ||
function LinkedDocument(id, slug, type, tags) { | ||
/** | ||
* @type {string} | ||
*/ | ||
this.id = id; | ||
/** | ||
* @type {string} | ||
*/ | ||
this.slug = slug; | ||
/** | ||
* @type {string} | ||
*/ | ||
this.type = type; | ||
/** | ||
* @type {Array} | ||
*/ | ||
this.tags = tags; | ||
} | ||
/** | ||
* Embodies a prismic.io ref (a past or future point in time you can query) | ||
@@ -646,0 +614,0 @@ * @constructor |
@@ -6,2 +6,26 @@ (function (Global, undefined) { | ||
/** | ||
* A link to a document as in "related document" (not a hyperlink). | ||
* @constructor | ||
* @global | ||
*/ | ||
function LinkedDocument(id, slug, type, tags) { | ||
/** | ||
* @type {string} | ||
*/ | ||
this.id = id; | ||
/** | ||
* @type {string} | ||
*/ | ||
this.slug = slug; | ||
/** | ||
* @type {string} | ||
*/ | ||
this.type = type; | ||
/** | ||
* @type {Array} | ||
*/ | ||
this.tags = tags; | ||
} | ||
/** | ||
* Functions to access fragments: superclass for Document and Doc (from Group), not supposed to be created directly | ||
@@ -364,3 +388,46 @@ * @constructor | ||
/** | ||
* Linked documents, as an array of {@link LinkedDocument} | ||
* @returns {Array} | ||
*/ | ||
linkedDocuments: function() { | ||
var i, j, link; | ||
var result = []; | ||
for (var field in this.fragments) { | ||
var fragment = this.get(field); | ||
if (fragment instanceof Global.Prismic.Fragments.DocumentLink) { | ||
result.push(fragment.document); | ||
} | ||
if (fragment instanceof Global.Prismic.Fragments.StructuredText) { | ||
for (i = 0; i < fragment.blocks.length; i++) { | ||
var block = fragment.blocks[i]; | ||
if (block.type == "image" && block.linkTo) { | ||
link = Global.Prismic.Fragments.initField(block.linkTo); | ||
if (link instanceof DocumentLink) { | ||
result.push(link.document); | ||
} | ||
} | ||
var spans = block.spans || []; | ||
for (j = 0; j < spans.length; j++) { | ||
var span = spans[j]; | ||
if (span.type == "hyperlink") { | ||
link = Global.Prismic.Fragments.initField(span.data); | ||
if (link instanceof Global.Prismic.Fragments.DocumentLink) { | ||
result.push(link.document); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
if (fragment instanceof Global.Prismic.Fragments.Group) { | ||
for (i = 0; i < fragment.value.length; i++) { | ||
result = result.concat(fragment.value[i].linkedDocuments()); | ||
} | ||
} | ||
} | ||
return result; | ||
}, | ||
/** | ||
* An array of the fragments with the given fragment name. | ||
@@ -393,3 +460,3 @@ * The array is often a single-element array, expect when the fragment is a multiple fragment. | ||
*/ | ||
function Document(id, type, href, tags, slugs, linkedDocuments, fragments) { | ||
function Document(id, type, href, tags, slugs, fragments) { | ||
@@ -426,7 +493,3 @@ /** | ||
this.slugs = slugs; | ||
/** | ||
* Linked documents, as an array of {@link LinkedDocument} | ||
* @type {array} | ||
*/ | ||
this.linkedDocuments = linkedDocuments; | ||
this.fragments = fragments; | ||
@@ -452,2 +515,3 @@ } | ||
Global.Prismic.LinkedDocument = LinkedDocument; | ||
Global.Prismic.Document = Document; | ||
@@ -454,0 +518,0 @@ Global.Prismic.GroupDoc = GroupDoc; |
@@ -45,5 +45,5 @@ (function (Global, undefined) { | ||
* @field | ||
* @description the document link's JSON object, exactly as is returned in the JSON responses (see API documentation: https://developers.prismic.io/documentation/UjBe8bGIJ3EKtgBZ/api-documentation#json-responses) | ||
* @description the LinkedDocument | ||
*/ | ||
this.document = data.document; | ||
this.document = new Global.Prismic.LinkedDocument(data.document.id, data.document.slug, data.document.type, data.document.tags); | ||
/** | ||
@@ -596,3 +596,3 @@ * @field | ||
* @params {object} ctx - mandatory ctx object, with a useable linkResolver function (please read prismic.io online documentation about this) | ||
* @returns {array} - the array of groups, each group being a JSON object with subfragment name as keys, and subfragment as values | ||
* @returns {Array} - the array of groups, each group being a JSON object with subfragment name as keys, and subfragment as values | ||
*/ | ||
@@ -599,0 +599,0 @@ toArray: function(){ |
@@ -5,3 +5,3 @@ (function(Prismic) { | ||
var testRepository = 'https://lesbonneschoses.cdn.prismic.io/api', | ||
var testRepository = 'https://lesbonneschoses.prismic.io/api', | ||
Predicates = Prismic.Predicates, | ||
@@ -43,3 +43,3 @@ assert = chai.assert; | ||
// startgist:b253d8fddfdd4cceef7a:prismic-api.js | ||
Prismic.Api('https://lesbonneschoses.cdn.prismic.io/api', function (err, Api) { | ||
Prismic.Api('https://lesbonneschoses.prismic.io/api', function (err, Api) { | ||
if (err) throw err; // gisthide | ||
@@ -56,5 +56,5 @@ // You can use the Api object inside this block | ||
// startgist:1b2552233271e329b785:prismic-apiPrivate.js | ||
Prismic.Api('https://lesbonneschoses.cdn.prismic.io/api', function (err, Api) { | ||
Prismic.Api('https://lesbonneschoses.prismic.io/api', function (err, Api) { | ||
// This will fail because the token is invalid, but this is how to access a private API | ||
assert.equal(err.message, "Unexpected status code [401] on URL https://lesbonneschoses.cdn.prismic.io/api?access_token=MC5-XXXXXXX-vRfvv70"); // gisthide | ||
assert.equal(err.message, "Unexpected status code [401] on URL https://lesbonneschoses.prismic.io/api?access_token=MC5-XXXXXXX-vRfvv70"); // gisthide | ||
done(); // gisthide | ||
@@ -68,3 +68,3 @@ }, "MC5-XXXXXXX-vRfvv70"); | ||
var previewToken = 'MC5VbDdXQmtuTTB6Z0hNWHF3.c--_vVbvv73vv73vv73vv71EA--_vS_vv73vv70T77-9Ke-_ve-_vWfvv70ebO-_ve-_ve-_vQN377-9ce-_vRfvv70'; | ||
Prismic.Api('https://lesbonneschoses.cdn.prismic.io/api', function (err, Api) { | ||
Prismic.Api('https://lesbonneschoses.prismic.io/api', function (err, Api) { | ||
if (err) throw err; // gisthide | ||
@@ -94,3 +94,3 @@ var stPatrickRef = Api.ref("St-Patrick specials"); | ||
// startgist:f3f7d4b970e964131271:prismic-simplequery.js | ||
Prismic.Api('https://lesbonneschoses.cdn.prismic.io/api', function (err, Api) { | ||
Prismic.Api('https://lesbonneschoses.prismic.io/api', function (err, Api) { | ||
if (err) throw err; // gisthide | ||
@@ -100,6 +100,3 @@ Api.form('everything') | ||
.query(Prismic.Predicates.at("document.type", "product")).submit(function (err, response) { | ||
if (err) { | ||
console.log(err); | ||
done(); | ||
} // gisthide | ||
if (err) { console.log(err); done(); } // gisthide | ||
// The documents object contains a Response object with all documents of type "product". | ||
@@ -125,3 +122,3 @@ var page = response.page; // The current page number, the first one being 1 | ||
// startgist:55eb59485855e40680c9:prismic-orderings.js | ||
Prismic.Api('https://lesbonneschoses.cdn.prismic.io/api', function (err, Api) { | ||
Prismic.Api('https://lesbonneschoses.prismic.io/api', function (err, Api) { | ||
if (err) throw err; // gisthide | ||
@@ -145,3 +142,3 @@ Api.form('everything') | ||
// startgist:2bdf83055d57f35d5d85:prismic-predicates.js | ||
Prismic.Api('https://lesbonneschoses.cdn.prismic.io/api', function (err, Api) { | ||
Prismic.Api('https://lesbonneschoses.prismic.io/api', function (err, Api) { | ||
if (err) throw err; // gisthide | ||
@@ -207,3 +204,3 @@ Api.form('everything').ref(Api.master()).query( | ||
'<h1>Our world-famous Pastry Art Brainstorm event</h1>' + | ||
'<img src=\"https://lesbonneschoses.cdn.prismic.io/lesbonneschoses/c38f9e5a1a6c43aa7aae516c154013a2cee2bc75.jpg\" alt=\"\">' + | ||
'<img src=\"https://prismic-io.s3.amazonaws.com/lesbonneschoses/c38f9e5a1a6c43aa7aae516c154013a2cee2bc75.jpg\" alt=\"\">' + | ||
'<p>Each year, <em>Les Bonnes Choses</em> organizes a world-famous two-day event called the \"Pastry Art Brainstorm\", and which is the perfect excuse for every fine pastry artist in the world to exercise their art, and build their skills up. The event is a multiple win-win operation, at many levels: see what the event is, as seen by many point of views.</p>' + | ||
@@ -233,3 +230,3 @@ '<h2>As seen by the top pastry artists worldwide</h2>' + | ||
it('prismic-getText.js', function (done) { | ||
Prismic.Api('https://lesbonneschoses.cdn.prismic.io/api', function (err, Api) { | ||
Prismic.Api('https://lesbonneschoses.prismic.io/api', function (err, Api) { | ||
if (err) throw err; // gisthide | ||
@@ -250,3 +247,3 @@ Api.form('everything').query(Predicates.at("document.id", "UlfoxUnM0wkXYXbl")).ref(Api.master()).submit(function (err, documents) { | ||
it('prismic-getNumber.js', function (done) { | ||
Prismic.Api('https://lesbonneschoses.cdn.prismic.io/api', function (err, Api) { | ||
Prismic.Api('https://lesbonneschoses.prismic.io/api', function (err, Api) { | ||
if (err) throw err; | ||
@@ -272,3 +269,3 @@ Api.form('everything').query(Predicates.at("document.id", "UlfoxUnM0wkXYXbO")).ref(Api.master()).submit(function (err, documents) { | ||
it('prismic-images.js', function (done) { | ||
Prismic.Api('https://lesbonneschoses.cdn.prismic.io/api', function (err, Api) { | ||
Prismic.Api('https://lesbonneschoses.prismic.io/api', function (err, Api) { | ||
if (err) throw err; | ||
@@ -284,3 +281,3 @@ Api.form('everything').query(Predicates.at("document.id", "UlfoxUnM0wkXYXbO")).ref(Api.master()).submit(function (err, documents) { | ||
// endgist | ||
assert.equal(url, "https://lesbonneschoses.cdn.prismic.io/lesbonneschoses/f606ad513fcc2a73b909817119b84d6fd0d61a6d.png"); | ||
assert.equal(url, "https://prismic-io.s3.amazonaws.com/lesbonneschoses/f606ad513fcc2a73b909817119b84d6fd0d61a6d.png"); | ||
done(); | ||
@@ -292,3 +289,3 @@ }); | ||
it('prismic-dateTimestamp.js', function (done) { | ||
Prismic.Api('https://lesbonneschoses.cdn.prismic.io/api', function (err, Api) { | ||
Prismic.Api('https://lesbonneschoses.prismic.io/api', function (err, Api) { | ||
if (err) throw err; | ||
@@ -390,3 +387,6 @@ Api.form('everything').query(Predicates.at("document.id", "UlfoxUnM0wkXYXbl")).ref(Api.master()).submit(function (err, documents) { | ||
// endgist | ||
assert.equal(docs[0].getStructuredText("desc").asHtml(), "<p>A detailed step by step point of view on how installing happens.</p>"); | ||
assert.equal( | ||
docs[0].getStructuredText("desc").asHtml(), | ||
"<p>A detailed step by step point of view on how installing happens.</p>" | ||
); | ||
}); | ||
@@ -519,3 +519,3 @@ | ||
it('prismic-asHtml.js', function (done) { | ||
Prismic.Api('https://lesbonneschoses.cdn.prismic.io/api', function (err, Api) { | ||
Prismic.Api('https://lesbonneschoses.prismic.io/api', function (err, Api) { | ||
if (err) { | ||
@@ -539,3 +539,3 @@ console.log(err); | ||
// endgist | ||
assert.equal(html, '<h1>Get the right approach to ganache</h1><p>A lot of people touch base with us to know about one of our key ingredients, and the essential role it plays in our creations: ganache.</p><p>Indeed, ganache is the macaron\'s softener, or else, macarons would be but tough biscuits; it is the cupcake\'s wrapper, or else, cupcakes would be but plain old cake. We even sometimes use ganache within our cupcakes, to soften the cake itself, or as a support to our pies\' content.</p><h2>How to approach ganache</h2><p class=\"block-img\"><img src=\"https://lesbonneschoses.cdn.prismic.io/lesbonneschoses/ee7b984b98db4516aba2eabd54ab498293913c6c.jpg\" alt=\"\"></p><p>Apart from the taste balance, which is always a challenge when it comes to pastry, the tough part about ganache is about thickness. It is even harder to predict through all the phases the ganache gets to meet (how long will it get melted? how long will it remain in the fridge?). Things get a hell of a lot easier to get once you consider that there are two main ways to get the perfect ganache:</p><ul><li><strong>working from the top down</strong>: start with a thick, almost hard material, and soften it by manipulating it, or by mixing it with a more liquid ingredient (like milk)</li><li><strong>working from the bottom up</strong>: start from a liquid-ish state, and harden it by miwing it with thicker ingredients, or by leaving it in the fridge longer.</li></ul><p>We do hope this advice will empower you in your ganache-making skills. Let us know how you did with it!</p><h2>Ganache at <em>Les Bonnes Choses</em></h2><p>We have a saying at Les Bonnes Choses: \"Once you can make ganache, you can make anything.\"</p><p>As you may know, we like to give our workshop artists the ability to master their art to the top; that is why our Preparation Experts always start off as being Ganache Specialists for Les Bonnes Choses. That way, they\'re given an opportunity to focus on one exercise before moving on. Once they master their ganache, and are able to provide the most optimal delight to our customers, we consider they\'ll thrive as they work on other kinds of preparations.</p><h2>About the chocolate in our ganache</h2><p>Now, we\'ve also had a lot of questions about how our chocolate gets made. It\'s true, as you might know, that we make it ourselves, from Columbian cocoa and French cow milk, with a process that much resembles the one in the following Discovery Channel documentary.</p><div data-oembed=\"undefined\" data-oembed-type=\"embed\" data-oembed-provider=\"undefined\"><iframe width=\"459\" height=\"344\" src=\"http://www.youtube.com/embed/Ye78F3-CuXY?feature=oembed\" frameborder=\"0\" allowfullscreen></iframe></div>'); | ||
assert.equal(html, '<h1>Get the right approach to ganache</h1><p>A lot of people touch base with us to know about one of our key ingredients, and the essential role it plays in our creations: ganache.</p><p>Indeed, ganache is the macaron\'s softener, or else, macarons would be but tough biscuits; it is the cupcake\'s wrapper, or else, cupcakes would be but plain old cake. We even sometimes use ganache within our cupcakes, to soften the cake itself, or as a support to our pies\' content.</p><h2>How to approach ganache</h2><p class=\"block-img\"><img src=\"https://prismic-io.s3.amazonaws.com/lesbonneschoses/ee7b984b98db4516aba2eabd54ab498293913c6c.jpg\" alt=\"\"></p><p>Apart from the taste balance, which is always a challenge when it comes to pastry, the tough part about ganache is about thickness. It is even harder to predict through all the phases the ganache gets to meet (how long will it get melted? how long will it remain in the fridge?). Things get a hell of a lot easier to get once you consider that there are two main ways to get the perfect ganache:</p><ul><li><strong>working from the top down</strong>: start with a thick, almost hard material, and soften it by manipulating it, or by mixing it with a more liquid ingredient (like milk)</li><li><strong>working from the bottom up</strong>: start from a liquid-ish state, and harden it by miwing it with thicker ingredients, or by leaving it in the fridge longer.</li></ul><p>We do hope this advice will empower you in your ganache-making skills. Let us know how you did with it!</p><h2>Ganache at <em>Les Bonnes Choses</em></h2><p>We have a saying at Les Bonnes Choses: \"Once you can make ganache, you can make anything.\"</p><p>As you may know, we like to give our workshop artists the ability to master their art to the top; that is why our Preparation Experts always start off as being Ganache Specialists for Les Bonnes Choses. That way, they\'re given an opportunity to focus on one exercise before moving on. Once they master their ganache, and are able to provide the most optimal delight to our customers, we consider they\'ll thrive as they work on other kinds of preparations.</p><h2>About the chocolate in our ganache</h2><p>Now, we\'ve also had a lot of questions about how our chocolate gets made. It\'s true, as you might know, that we make it ourselves, from Columbian cocoa and French cow milk, with a process that much resembles the one in the following Discovery Channel documentary.</p><div data-oembed=\"undefined\" data-oembed-type=\"embed\" data-oembed-provider=\"undefined\"><iframe width=\"459\" height=\"344\" src=\"http://www.youtube.com/embed/Ye78F3-CuXY?feature=oembed\" frameborder=\"0\" allowfullscreen></iframe></div>'); | ||
done(); | ||
@@ -542,0 +542,0 @@ }); |
@@ -89,4 +89,4 @@ (function(Prismic) { | ||
var document = response.results[0]; | ||
assert.equal(document.linkedDocuments.length, 1); | ||
assert.equal(document.linkedDocuments[0].id, 'U0w8OwEAACoAQEvB'); | ||
assert.equal(document.linkedDocuments().length, 1); | ||
assert.equal(document.linkedDocuments()[0].id, 'U0w8OwEAACoAQEvB'); | ||
done(); | ||
@@ -110,4 +110,4 @@ }); | ||
var document = response.results[0]; | ||
assert.equal(document.linkedDocuments.length, 1); | ||
assert.equal(document.linkedDocuments[0].id, 'U0w8OwEAACoAQEvB'); | ||
assert.equal(document.linkedDocuments().length, 1); | ||
assert.equal(document.linkedDocuments()[0].id, 'U0w8OwEAACoAQEvB'); | ||
done(); | ||
@@ -114,0 +114,0 @@ }); |
@@ -128,9 +128,2 @@ (function(Prismic) { | ||
function getLinkResolver(ref) { | ||
return function (doc, isBroken) { | ||
if (isBroken) return '#broken'; | ||
return "/testing_url/" + doc.id + "/" + doc.slug + (ref ? ('?ref=' + ref) : ''); | ||
}; | ||
} | ||
})(window.Prismic); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
785337
50
8559
25
79